From 5d7d7c95d0bb3bf42517be94827af4652f195787 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sat, 9 Nov 2024 15:34:58 +0000 Subject: [PATCH 001/217] 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 002/217] 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 003/217] 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 004/217] 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 005/217] 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 006/217] 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 16f4652feca048d062239b58c86d169f10ac7fb5 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 10 Nov 2024 16:46:22 +0000 Subject: [PATCH 007/217] migrate work on core improvements from feature/better-trait-system to bevy 0.15 --- crates/bevy_mod_scripting_core/Cargo.toml | 16 +- crates/bevy_mod_scripting_core/src/asset.rs | 89 +- .../src/bindings/allocator.rs | 97 + .../src/bindings/mod.rs | 7 + .../src/bindings/proxy.rs | 1117 ++++++++++ .../src/bindings/query.rs | 114 + .../src/bindings/reference.rs | 500 +++++ .../src/bindings/world.rs | 1888 +++++++++++++++++ .../bevy_mod_scripting_core/src/commands.rs | 142 ++ crates/bevy_mod_scripting_core/src/context.rs | 152 ++ crates/bevy_mod_scripting_core/src/docs.rs | 22 +- crates/bevy_mod_scripting_core/src/error.rs | 197 +- crates/bevy_mod_scripting_core/src/event.rs | 242 ++- crates/bevy_mod_scripting_core/src/handler.rs | 37 + crates/bevy_mod_scripting_core/src/lib.rs | 295 ++- crates/bevy_mod_scripting_core/src/runtime.rs | 36 + crates/bevy_mod_scripting_core/src/script.rs | 42 + crates/bevy_mod_scripting_core/src/systems.rs | 587 +++-- 18 files changed, 5165 insertions(+), 415 deletions(-) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/allocator.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/mod.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/proxy.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/query.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/reference.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/world.rs create mode 100644 crates/bevy_mod_scripting_core/src/commands.rs create mode 100644 crates/bevy_mod_scripting_core/src/context.rs create mode 100644 crates/bevy_mod_scripting_core/src/handler.rs create mode 100644 crates/bevy_mod_scripting_core/src/runtime.rs create mode 100644 crates/bevy_mod_scripting_core/src/script.rs diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 027bd286c5..ece7a115a2 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -21,19 +21,9 @@ doc_always = [] [dependencies] -bevy = { workspace = true, default-features = false, features = [ - "bevy_asset", - "bevy_gltf", - "bevy_animation", - "bevy_core_pipeline", - "bevy_ui", - "bevy_pbr", - "bevy_render", - "bevy_text", - "bevy_sprite", -] } -bevy_event_priority = { path = "../bevy_event_priority", version = "0.8.0-alpha.1" } +bevy = { workspace = true, default-features = false, features = ["bevy_asset"] } thiserror = "1.0.31" paste = "1.0.7" parking_lot = "0.12.1" -anyhow = "1.0.75" +lockable = "0.0.8" +smallvec = "1.11" diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index 1dc86bb292..c61bb7c1bf 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -1,8 +1,85 @@ -use bevy::asset::Asset; +use std::{ + borrow::Cow, + path::{Path, PathBuf}, +}; -/// All code assets share this common interface. -/// When adding a new code asset don't forget to implement asset loading -/// and inserting appropriate systems when registering with the app -pub trait CodeAsset: Asset { - fn bytes(&self) -> &[u8]; +use bevy::{ + asset::{Asset, AssetLoader, AsyncReadExt}, + ecs::system::Resource, + reflect::TypePath, + utils::BoxedFuture, +}; + +use crate::{prelude::ScriptError, script::ScriptId}; + +/// Represents a script loaded into memory as an asset +#[derive(Asset, TypePath)] +pub struct ScriptAsset { + pub content: Box<[u8]>, + /// The virtual filesystem path of the asset, used to map to the script Id for asset backed scripts + pub asset_path: PathBuf, + pub language: Cow<'static, str>, +} + +pub struct ScriptAssetLoader { + /// Used to set the language of the script + pub language: Cow<'static, str>, + /// The file extensions this loader should handle + pub extensions: &'static [&'static str], + /// preprocessor to run on the script before saving the content to an asset + pub preprocessor: Option Result<(), ScriptError> + Send + Sync>>, +} + +impl AssetLoader for ScriptAssetLoader { + type Asset = ScriptAsset; + + type Settings = (); + + type Error = ScriptError; + + async fn load( + &self, + reader: &mut dyn bevy::asset::io::Reader, + _settings: &Self::Settings, + load_context: &mut bevy::asset::LoadContext<'_>, + ) -> Result { + let mut content = Vec::new(); + reader.read_to_end(&mut content).await.map_err(|e| { + ScriptError::new_lifecycle_error(e).with_context(load_context.asset_path()) + })?; + if let Some(processor) = &self.preprocessor { + processor(&mut content)?; + } + let asset = ScriptAsset { + content: content.into_boxed_slice(), + asset_path: load_context.path().to_owned(), + language: self.language.clone(), + }; + Ok(asset) + } + + fn extensions(&self) -> &[&str] { + self.extensions + } +} + +#[derive(Clone, Copy, Resource)] +pub struct ScriptAssetSettings { + pub script_id_mapper: AssetPathToScriptIdMapper, +} + +impl Default for ScriptAssetSettings { + fn default() -> Self { + Self { + script_id_mapper: AssetPathToScriptIdMapper { + map: (|path: &Path| path.to_string_lossy().into_owned().into()), + }, + } + } +} + +/// Strategy for mapping asset paths to script ids, by default this is the identity function +#[derive(Clone, Copy)] +pub struct AssetPathToScriptIdMapper { + pub map: fn(&Path) -> ScriptId, } diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs new file mode 100644 index 0000000000..c6394bc6f9 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -0,0 +1,97 @@ +use bevy::ecs::system::Resource; +use bevy::reflect::{PartialReflect, Reflect}; +use std::any::TypeId; +use std::cell::UnsafeCell; +use std::collections::HashMap; +use std::fmt::{Display, Formatter}; +use std::sync::Arc; + +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] +pub struct ReflectAllocationId(pub(crate) usize); +impl ReflectAllocationId { + pub fn id(&self) -> usize { + self.0 + } +} + +#[derive(Clone, Debug)] +pub struct ReflectAllocation(pub(self) Arc>); + +unsafe impl Send for ReflectAllocation {} +unsafe impl Sync for ReflectAllocation {} + +impl ReflectAllocation { + pub fn get_ptr(&self) -> *mut dyn PartialReflect { + self.0.get() + } + pub fn new(value: Arc>) -> Self { + Self(value) + } +} + +impl Display for ReflectAllocationId { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +/// Allocator used to allocate and deallocate `dyn PartialReflect` values +/// Used to be able to ensure we have a "common root" for values allocated outside the world. +#[derive(Resource, Default)] +pub struct ReflectAllocator { + // TODO: experiment with object pools, sparse set etc. + allocations: HashMap, + types: HashMap, +} + +impl ReflectAllocator { + /// Allocates a new [`Reflect`] value and returns an [`AllocationId`] which can be used to access it later + pub fn allocate( + &mut self, + value: T, + ) -> (ReflectAllocationId, ReflectAllocation) { + let id = ReflectAllocationId(self.allocations.len()); + let value = ReflectAllocation::new(Arc::new(UnsafeCell::new(value))); + self.allocations.insert(id, value.clone()); + self.types.insert(id, TypeId::of::()); + (id, value) + } + + pub fn get(&self, id: ReflectAllocationId) -> Option { + self.allocations.get(&id).cloned() + } + + pub fn get_type_id(&self, id: ReflectAllocationId) -> Option { + self.types.get(&id).cloned() + } + + pub fn get_mut(&self, id: ReflectAllocationId) -> Option { + self.allocations.get(&id).cloned() + } + + /// Deallocates the [`PartialReflect`] value with the given [`AllocationId`] + pub fn deallocate(&mut self, id: ReflectAllocationId) { + self.allocations.remove(&id); + } + + /// Runs a garbage collection pass on the allocations, removing any allocations which have no more strong references + /// Needs to be run periodically to prevent memory leaks + pub fn clean_garbage_allocations(&mut self) { + self.allocations.retain(|_, v| Arc::strong_count(&v.0) > 1); + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_reflect_allocator() { + let mut allocator = ReflectAllocator::default(); + let (id, val) = allocator.allocate(0); + assert_eq!(allocator.allocations.len(), 1); + drop(val); + allocator.clean_garbage_allocations(); + assert_eq!(allocator.allocations.len(), 0); + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/mod.rs new file mode 100644 index 0000000000..24f8ddf453 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/mod.rs @@ -0,0 +1,7 @@ +pub mod allocator; +pub mod proxy; +pub mod query; +pub mod reference; +pub mod world; + +pub use {allocator::*, proxy::*, query::*, reference::*, world::*}; diff --git a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs new file mode 100644 index 0000000000..04c65f8180 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs @@ -0,0 +1,1117 @@ +//! Set of traits used to define how types are turned into and from proxies in Lua. +//! Proxies can either be logical "copies" or owned "direct representations" of the instance, or references to one via the [`bevy_mod_scripting_core::bindings::ReflectReference`] construct. +use std::{ + cell::UnsafeCell, + marker::PhantomData, + num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize}, + sync::Arc, +}; + +use bevy::reflect::{FromReflect, Reflect, TypeRegistry}; +use smallvec::SmallVec; + +use crate::{ + bindings::ReflectAllocation, + error::ScriptResult, + prelude::{ReflectAllocator, ScriptError}, +}; + +use super::{ + world::{WorldAccessGuard, WorldAccessUnit, WorldAccessWrite}, + ReflectReference, DEFAULT_INTERVAL, DEFAULT_TIMEOUT, +}; + +/// Inverse to [`Unproxy`], packages up a type into a proxy type. +pub trait Proxy: Sized { + type Input<'a>; + + /// Proxies a type without access to the allocator, types which require access to the allocator will throw an error here + fn proxy<'a>(input: Self::Input<'a>) -> ScriptResult { + Err(ScriptError::new_reflection_error(format!( + "Cannot unproxy type: `{}` without allocator access. Use proxy_with_allocator instead.", + std::any::type_name::(), + ))) + } + + /// Proxies a type with access to the allocator + fn proxy_with_allocator<'a>( + input: Self::Input<'a>, + _allocator: &mut ReflectAllocator, + ) -> ScriptResult { + Self::proxy(input) + } +} + +/// A mechanism for converting proxy types into their represented types. +/// Note this can be implemented by 'meta-proxy' types which themselves aren't proxies, but wrap other proxies and provide a specific unproxying mechanism. +/// `RefProxy` and `RefMutProxy` are such 'meta-proxy' types. +/// +/// the [`Unproxy::Output`] type parameter is the type that this `proxy` will be converted to after unwrapping. +/// +pub trait Unproxy { + type Output<'o> + where + Self: 'o; + + fn collect_accesses<'w>( + &self, + _guard: &WorldAccessGuard<'w>, + _accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, + ) -> ScriptResult<()> { + Ok(()) + } + + fn accesses_len(&self) -> usize { + 0 + } + + /// Unproxies a proxy type into the represented type without world access + /// This will fail on proxies which require world access to unproxy (for example those whose proxies are glorified [`ReflectReference`]'s ) + fn unproxy<'o>(&'o mut self) -> ScriptResult> { + Err(ScriptError::new_reflection_error(format!( + "Cannot unproxy type: `{}` without world access. Use unproxy_with_world instead", + std::any::type_name::(), + ))) + } + + /// Unproxies a proxy type into the represented type with world access + /// # Safety + /// - The caller must not use the accesses in the accesses list after the unproxy call at all, as implementors assume they have unique access to the accesses. + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + _guard: &WorldAccessGuard<'w>, + _accesses: &'o [WorldAccessUnit<'w>], + _type_registry: &TypeRegistry, + _allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + self.unproxy() + } +} + +/// A wrapper type which when unproxied will return a `T` value. +/// Requires the type to be constructible from a reference to the proxy type. +#[derive(Debug, PartialEq, Eq)] +pub struct ValProxy(pub P, PhantomData); + +impl ValProxy { + pub fn new(v: P) -> Self { + Self(v, PhantomData) + } +} + +/// A wrapper type which when unproxied will return a `T` value. +/// Assumes that the proxy type contains a [`ReflectReference`] via [`AsRef`] +#[derive(PartialEq, Eq, Debug)] +pub struct ReflectValProxy(pub P, PhantomData); + +impl ReflectValProxy { + pub fn new(v: P) -> Self { + Self(v, PhantomData) + } +} + +/// A proxy type which when unproxied will return a reference to a `T` value. +/// Assumes that the proxy type contains a [`ReflectReference`] via [`AsRef`] +pub struct ReflectRefProxy(pub P, PhantomData); + +impl ReflectRefProxy { + pub fn new(v: P) -> Self { + Self(v, PhantomData) + } +} + +/// A proxy type which when unproxied will return a mutable reference to a `T` value. +/// Assumes that the proxy type contains a [`ReflectReference`] via [`AsRef`] +#[derive(Debug)] +pub struct ReflectRefMutProxy(pub P, PhantomData); + +impl ReflectRefMutProxy { + pub fn new(v: P) -> Self { + Self(v, PhantomData) + } +} + +impl Unproxy for ValProxy +where + T: for<'l> From<&'l P>, +{ + type Output<'o> = T where Self: 'o; + + fn unproxy<'o>(&'o mut self) -> ScriptResult> { + Ok(T::from(&self.0)) + } +} + +impl Proxy for ValProxy +where + T: Into

, +{ + type Input<'a> = T; + + fn proxy<'a>(input: Self::Input<'a>) -> ScriptResult { + Ok(ValProxy::new(input.into())) + } +} + +impl Proxy for ReflectValProxy +where + T: Reflect, + P: From, +{ + type Input<'a> = T; + + fn proxy_with_allocator<'a>( + input: Self::Input<'a>, + allocator: &mut ReflectAllocator, + ) -> ScriptResult { + Ok(Self::new( + ReflectReference::new_allocated(input, allocator).into(), + )) + } +} + +impl Unproxy for ReflectValProxy +where + P: AsRef, + T: FromReflect, +{ + type Output<'o> = T where Self: 'o; + + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + _accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + let reflect_ref: &ReflectReference = self.0.as_ref(); + let access = reflect_ref.base.base_id.get_reflect_access_id(); + let access = guard + .get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL) + .ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Could not unproxy type: `{}`. Aliasing access.", + std::any::type_name::() + )) + })?; + let out = reflect_ref.reflect( + guard.as_unsafe_world_cell(), + &access, + type_registry, + Some(allocator), + )?; + let out = T::from_reflect(out).ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "FromReflect failed for `{}`.", + std::any::type_name::() + )) + })?; + guard.release_access(access); + Ok(out) + } +} + +impl Proxy for ReflectRefProxy +where + T: FromReflect, + P: From, +{ + type Input<'a> = &'a T; + + fn proxy_with_allocator<'a>( + input: Self::Input<'a>, + allocator: &mut ReflectAllocator, + ) -> ScriptResult { + let inner = T::from_reflect(input).ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "FromReflect failed for `{}`.", + std::any::type_name::() + )) + })?; + Ok(Self::new( + ReflectReference::new_allocated(inner, allocator).into(), + )) + } +} + +impl Unproxy for ReflectRefProxy +where + P: AsRef, + T: Reflect, +{ + type Output<'o> = &'o T where Self: 'o; + + fn collect_accesses<'w>( + &self, + guard: &WorldAccessGuard<'w>, + accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, + ) -> ScriptResult<()> { + let reflect_ref: &ReflectReference = self.0.as_ref(); + let access = reflect_ref.base.base_id.get_reflect_access_id(); + let access = guard + .get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL) + .ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Could not unproxy type: `{}`. Aliasing access.", + std::any::type_name::() + )) + })?; + accesses.push(access); + Ok(()) + } + + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + let reflect_ref: &ReflectReference = self.0.as_ref(); + let access = accesses.last().ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "No required access collected when unproxying type: `{}`.", + std::any::type_name::() + )) + })?; + + let out = reflect_ref.reflect( + guard.as_unsafe_world_cell(), + access, + type_registry, + Some(allocator), + )?; + let out = out.try_downcast_ref().ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Could not downcast value from reflect reference to type: `{}`.", + std::any::type_name::() + )) + })?; + Ok(out) + } + + fn accesses_len(&self) -> usize { + 1 + } +} + +impl Unproxy for ReflectRefMutProxy +where + P: AsRef, + T: Reflect, +{ + type Output<'o> = &'o mut T where Self: 'o; + + fn collect_accesses<'w>( + &self, + guard: &WorldAccessGuard<'w>, + accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, + ) -> ScriptResult<()> { + let reflect_ref: &ReflectReference = self.0.as_ref(); + let access = reflect_ref.base.base_id.get_reflect_access_id(); + let access = guard + .get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL) + .ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Could not unproxy type: `{}`. Aliasing access.", + std::any::type_name::() + )) + })?; + accesses.push(access); + Ok(()) + } + + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + let reflect_ref: &ReflectReference = self.0.as_ref(); + accesses + .last() + .ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "No required access collected when unproxying type: `{}`.", + std::any::type_name::() + )) + }) + .and_then(|access| { + reflect_ref.expect_write_access( + access, + type_registry, + Some(allocator), + guard.as_unsafe_world_cell(), + ) + })?; + + // Safety: + // - we verified and we have the right access + // - the caller promises not to alias it from the root access + let out = unsafe { + reflect_ref.reflect_mut_unsafe( + guard.as_unsafe_world_cell(), + type_registry, + Some(allocator), + )? + }; + let out = out.try_downcast_mut().ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Could not downcast value from reflect reference to type: `{}`.", + std::any::type_name::() + )) + })?; + Ok(out) + } + + fn accesses_len(&self) -> usize { + 1 + } +} + +macro_rules! impl_unproxy_via_vec { + ($type:ty, $out_type:ty, ($($generics:tt)*)) => { + impl<'c, $($generics)*> Unproxy for $type { + type Output<'o> = $out_type where Self: 'o; + + fn collect_accesses<'w>( + &self, + guard: &WorldAccessGuard<'w>, + accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, + ) -> ScriptResult<()> { + for item in self { + item.collect_accesses(guard, accesses)?; + } + Ok(()) + } + + fn accesses_len(&self) -> usize { + self.iter().map(|item| item.accesses_len()).sum() + } + + fn unproxy(&mut self) -> ScriptResult> { + let mut out = Vec::with_capacity(self.len()); + for item in self { + let unproxied = item.unproxy()?; + out.push(unproxied); + } + Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) + } + + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + let mut out = Vec::with_capacity(self.len()); + let mut offset = 0; + for item in self.iter_mut() { + let width = item.accesses_len(); + let unproxied = item.unproxy_with_world( + guard, + &accesses[offset..offset + width], + type_registry, + allocator, + )?; + out.push(unproxied); + offset += width; + } + Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) + } + } + }; +} + +macro_rules! impl_proxy_via_vec { + ($type:ty, $item_type:ty, $in_type:ty, ($($generics:tt)*)) => { + impl<$($generics)*> Proxy for $type { + type Input<'i> = $in_type; + + fn proxy(input: Self::Input<'_>) -> ScriptResult { + let mut out = Vec::with_capacity(input.len()); + for item in input { + out.push(<$item_type as Proxy>::proxy(item)?); + } + Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) + } + + fn proxy_with_allocator( + input: Self::Input<'_>, + _allocator: &mut ReflectAllocator, + ) -> ScriptResult { + let mut out = Vec::with_capacity(input.len()); + for item in input { + out.push(<$item_type as Proxy>::proxy_with_allocator(item, _allocator)?); + } + Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) + } + } + }; +} + +impl_unproxy_via_vec!(Vec, Vec>, (T: Unproxy)); +impl_proxy_via_vec!(Vec, T, Vec>, (T: Proxy)); +impl_unproxy_via_vec!([T; C], [T::Output<'o>; C], (T: Unproxy, const C: usize)); +impl_proxy_via_vec!([T; C],T,[T::Input<'i>; C], (T: Proxy, const C: usize)); +impl_unproxy_via_vec!(SmallVec<[T; C]>, SmallVec<[T::Output<'o>; C]>, (T: Unproxy, const C: usize)); +impl_proxy_via_vec!(SmallVec<[T; C]>, T, SmallVec<[T::Input<'i>; C]>, (T: Proxy, const C: usize)); + +// impl_proxy_unproxy_via_vec!(T, SmallVec, SmallVec<[T; C]>); +// impl<'c, T: 'c> Unproxy for &'c T { +// type Output<'o> = &'c T where Self: 'o; + +// fn unproxy(&mut self) -> ScriptResult> { +// Ok(self) +// } +// } + +// impl<'s, T> Proxy for &'s T { +// type Input<'b> = &'s T; + +// fn proxy(input: Self::Input<'_>) -> ScriptResult { +// Ok(input) +// } + +// fn proxy_with_allocator( +// input: Self::Input<'_>, +// _allocator: &mut ReflectAllocator, +// ) -> ScriptResult { +// Ok(input) +// } +// } + +// impl Unproxy for &mut T { +// type Output<'o> = &'o mut T where Self: 'o; + +// fn unproxy(&mut self) -> ScriptResult> { +// Ok(self) +// } +// } + +// impl<'s, T> Proxy for &'s mut T { +// type Input<'a> = &'s mut T; + +// fn proxy(input: Self::Input<'_>) -> ScriptResult { +// Ok(input) +// } + +// fn proxy_with_allocator( +// input: Self::Input<'_>, +// _allocator: &mut ReflectAllocator, +// ) -> ScriptResult { +// Ok(input) +// } +// } + +impl Unproxy for Option { + type Output<'o> = Option> where Self: 'o; + + fn unproxy(&mut self) -> ScriptResult> { + if let Some(s) = self { + let inner = s.unproxy()?; + Ok(Some(inner)) + } else { + Ok(None) + } + } + + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + if let Some(s) = self { + let inner = s.unproxy_with_world(guard, accesses, type_registry, allocator)?; + Ok(Some(inner)) + } else { + Ok(None) + } + } + + fn collect_accesses<'w>( + &self, + guard: &WorldAccessGuard<'w>, + accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, + ) -> ScriptResult<()> { + self.as_ref() + .map(|s| s.collect_accesses(guard, accesses)) + .unwrap_or_else(|| Ok(())) + } + + fn accesses_len(&self) -> usize { + self.as_ref().map_or(0, |s| s.accesses_len()) + } +} + +impl Proxy for Option { + type Input<'a> = Option>; + + fn proxy(input: Self::Input<'_>) -> ScriptResult { + input.map(T::proxy).transpose() + } + + fn proxy_with_allocator( + input: Self::Input<'_>, + _allocator: &mut ReflectAllocator, + ) -> ScriptResult { + input + .map(|i| T::proxy_with_allocator(i, _allocator)) + .transpose() + } +} + +impl Proxy for Result { + type Input<'a> = Result, E>; + + fn proxy(input: Self::Input<'_>) -> ScriptResult { + match input { + Ok(i) => Ok(Ok(T::proxy(i)?)), + Err(e) => Ok(Err(e)), + } + } + + fn proxy_with_allocator( + input: Self::Input<'_>, + _allocator: &mut ReflectAllocator, + ) -> ScriptResult { + match input { + Ok(i) => Ok(Ok(T::proxy_with_allocator(i, _allocator)?)), + Err(e) => Ok(Err(e)), + } + } +} + +impl Unproxy for Result { + type Output<'o> = Result, E::Output<'o>> where Self: 'o; + + fn unproxy(&mut self) -> ScriptResult> { + match self { + Ok(s) => Ok(Ok(s.unproxy()?)), + Err(e) => Ok(Err(e.unproxy()?)), + } + } + + unsafe fn unproxy_with_world<'w, 'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + match self { + Ok(s) => Ok(Ok(s.unproxy_with_world( + guard, + accesses, + type_registry, + allocator, + )?)), + Err(e) => Ok(Err(e.unproxy()?)), + } + } + + fn collect_accesses<'w>( + &self, + guard: &WorldAccessGuard<'w>, + accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, + ) -> ScriptResult<()> { + match self { + Ok(s) => s.collect_accesses(guard, accesses), + Err(_) => Ok(()), + } + } + + fn accesses_len(&self) -> usize { + match self { + Ok(s) => s.accesses_len(), + Err(_) => 0, + } + } +} + +macro_rules! impl_unproxy_by_move { + ($($ty:ty),*) => { + $( + impl Unproxy for $ty { + type Output<'o> = $ty; + + fn unproxy( + &mut self + ) -> ScriptResult> { + Ok(*self) + } + } + + impl Unproxy for &$ty { + type Output<'o> = &'o $ty where Self : 'o; + + fn unproxy( + &mut self + ) -> ScriptResult> { + Ok(self) + } + } + + impl Unproxy for &mut $ty { + type Output<'o> = &'o mut $ty where Self : 'o; + + fn unproxy( + &mut self + ) -> ScriptResult> { + Ok(self) + } + } + )* + }; +} + +macro_rules! impl_proxy_by_move { + ($($ty:ident),*) => { + $( + impl Proxy for $ty { + type Input<'a> = Self; + + fn proxy(input: Self::Input<'_>) -> ScriptResult { + Ok(input) + } + } + + impl <'l>Proxy for &'l $ty { + type Input<'a> = Self; + + fn proxy(input: Self::Input<'_>) -> ScriptResult { + Ok(input) + } + } + + impl <'l>Proxy for &'l mut $ty { + type Input<'a> = Self; + + fn proxy(input: Self::Input<'_>) -> ScriptResult { + Ok(input) + } + } + )* + } +} + +impl_proxy_by_move!( + usize, + u8, + u16, + u32, + u64, + u128, + isize, + i8, + i16, + i32, + i64, + i128, + f32, + f64, + bool, + NonZeroUsize, + NonZeroU8, + NonZeroU16, + NonZeroU32, + NonZeroU64, + NonZeroU128 +); + +impl_unproxy_by_move!( + usize, + u8, + u16, + u32, + u64, + u128, + isize, + i8, + i16, + i32, + i64, + i128, + f32, + f64, + bool, + NonZeroUsize, + NonZeroU8, + NonZeroU16, + NonZeroU32, + NonZeroU64, + NonZeroU128 +); + +macro_rules! impl_unproxy_by_clone { + ($($ty:ty),*) => { + $(impl Unproxy for $ty { + type Output<'o> = $ty; + + fn unproxy(&mut self) -> ScriptResult> { + Ok(self.clone()) + } + })* + }; +} + +impl_unproxy_by_clone!(String); +impl_proxy_by_move!(String); + +macro_rules! impl_tuple_unproxy_proxy { + ($(($ty:ident, $idx:tt)),*) => { + impl <$($ty : Proxy,)*> Proxy for ($($ty,)*) + { + type Input<'a> = ($($ty::Input<'a>,)*); + + #[allow(clippy::unused_unit)] + fn proxy(_input: Self::Input<'_>) -> ScriptResult { + Ok(($($ty::proxy(_input.$idx)?,)*)) + } + + fn proxy_with_allocator(_input: Self::Input<'_>, _allocator: &mut ReflectAllocator) -> ScriptResult { + Ok(($($ty::proxy_with_allocator(_input.$idx, _allocator)?,)*)) + } + } + + impl<$($ty: Unproxy),*> Unproxy for ($($ty,)*) { + type Output<'o> = ($($ty::Output<'o>,)*) where Self: 'o; + + fn collect_accesses<'w>( + &self, + _guard: &WorldAccessGuard<'w>, + _accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, + ) -> ScriptResult<()> { + $(self.$idx.collect_accesses(_guard, _accesses)?;)* + Ok(()) + } + + fn accesses_len(&self) -> usize { + let mut _len = 0; + $(_len += self.$idx.accesses_len();)* + _len + } + + fn unproxy(&mut self) -> ScriptResult> { + Ok(($( + self.$idx.unproxy()? + ,)*)) + } + + #[allow(unused_assignments)] + unsafe fn unproxy_with_world<'w,'o>( + &'o mut self, + _guard: &WorldAccessGuard<'w>, + _accesses: &'o [WorldAccessUnit<'w>], + _type_registry: &TypeRegistry, + _allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + let mut _offset = 0; + + Ok(($( + { + let width = self.$idx.accesses_len(); + let elem = self.$idx.unproxy_with_world(_guard, &_accesses[_offset.._offset+width], _type_registry, _allocator)?; + + _offset += width; + elem + } + ,)*)) + + } + } + }; +} + +impl_tuple_unproxy_proxy!(); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13), (O, 14)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13), (O, 14), (P, 15)); +#[rustfmt::skip] +impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13), (O, 14), (P, 15), (Q, 16)); + +#[cfg(test)] +mod test { + + use bevy::ecs::{component::Component, world::World}; + + use crate::bindings::{ReflectBase, ReflectBaseType}; + + use super::*; + + #[derive(Reflect, Component, PartialEq, Eq, Debug, Clone)] + struct Test(pub &'static str); + + #[derive(Debug, Clone, PartialEq, Eq)] + struct ValTestProxy(Test); + + impl From for ValTestProxy { + fn from(value: Test) -> Self { + Self(value) + } + } + + impl<'a> From<&'a ValTestProxy> for Test { + fn from(value: &'a ValTestProxy) -> Self { + value.0.clone() + } + } + + #[derive(Debug, Clone, PartialEq, Eq)] + struct TestProxy(ReflectReference); + + impl From for TestProxy { + fn from(value: ReflectReference) -> Self { + TestProxy(value) + } + } + + impl AsRef for TestProxy { + fn as_ref(&self) -> &ReflectReference { + &self.0 + } + } + + macro_rules! assert_proxy_invertible { + ($original:expr, $($proxy_ty:tt)*) => { + let mut world = World::new(); + let mut accesses = SmallVec::new(); + let world = WorldAccessGuard::new(&mut world); + let type_registry = TypeRegistry::default(); + let mut allocator = ReflectAllocator::default(); + + // test with world version + let mut proxy = <$($proxy_ty)* as Proxy>::proxy_with_allocator($original, &mut allocator).unwrap(); + proxy.collect_accesses(&world, &mut accesses).unwrap(); + + let unproxied = unsafe { + proxy + .unproxy_with_world(&world, &mut accesses, &type_registry, &allocator) + .unwrap() + }; + assert_eq!( + unproxied, $original, + "Proxy and unproxy does not yield original type, expected {:?}, got {:?}", + $original, unproxied + ); + + let mut proxy = <$($proxy_ty)* as Proxy>::proxy($original).unwrap(); + + let unproxied_without_world = proxy.unproxy().unwrap(); + assert_eq!( + unproxied_without_world, $original, + "Proxy and unproxy does not yield original type, expected {:?}, got {:?}", + $original, unproxied_without_world + ); + + }; + } + + #[test] + pub fn test_non_reflect_val_proxy() { + assert_proxy_invertible!(Test("test"), ValProxy::); + } + + #[test] + pub fn test_complex_types_proxy_is_inverse_of_unproxy() { + assert_proxy_invertible!([32; 4], [usize; 4]); + assert_proxy_invertible!( + core::array::from_fn::<_, 4, _>(|_| vec![Test("test")]), + [Vec::>; 4] + ); + assert_proxy_invertible!(Vec::::default(), Vec::); + assert_proxy_invertible!(Some(Test("test")), Option::>); + assert_proxy_invertible!(None::, Option::>); + assert_proxy_invertible!( + Some(Some(Test("test"))), + Option::>> + ); + assert_proxy_invertible!( + vec![Some(Test("test")), None, Some(Test("test"))], + Vec::>> + ); + assert_proxy_invertible!(vec![&1, &2, &3], Vec::<&usize>); + // assert_proxy_invertible!(vec![&(1, 2)], Vec::<&(usize, usize)>); + assert_proxy_invertible!(vec![vec![1, 2], vec![1, 2, 3]], Vec::>); + assert_proxy_invertible!( + vec![vec![(1, 2), (3, 4)], vec![(1, 2), (3, 4)]], + Vec::> + ); + assert_proxy_invertible!(Some(1), Option::); + assert_proxy_invertible!(Some(Some(1)), Option::>); + assert_proxy_invertible!(None::, Option::); + assert_proxy_invertible!(None::>, Option::>); + assert_proxy_invertible!(vec![Some(1), None, Some(2)], Vec::>); + assert_proxy_invertible!( + vec![Some(vec![1, 2, 3]), None, Some(vec![1, 4])], + Vec::>> + ); + } + + #[test] + pub fn test_val_proxy() { + let mut allocator = ReflectAllocator::default(); + let (alloc_id, _) = allocator.allocate(Test("test")); + + let mut proxy = ReflectValProxy::::new(TestProxy(ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Owned(alloc_id), + }, + reflect_path: vec![], + })); + let mut world = World::new(); + let mut accesses = SmallVec::new(); + let world = WorldAccessGuard::new(&mut world); + let type_registry = TypeRegistry::default(); + + proxy.collect_accesses(&world, &mut accesses).unwrap(); + let unproxied = unsafe { + proxy + .unproxy_with_world(&world, &accesses, &type_registry, &allocator) + .unwrap() + }; + assert_eq!(unproxied.0, "test"); + } + + #[test] + pub fn test_proxy_ref() { + let mut allocator = ReflectAllocator::default(); + let (alloc_id, _) = allocator.allocate(Test("test")); + + let mut proxy = ReflectRefProxy::::new(TestProxy(ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Owned(alloc_id), + }, + reflect_path: vec![], + })); + let mut world = World::new(); + let mut accesses = SmallVec::new(); + let world = WorldAccessGuard::new(&mut world); + let type_registry = TypeRegistry::default(); + + proxy.collect_accesses(&world, &mut accesses).unwrap(); + let unproxied = unsafe { + proxy + .unproxy_with_world(&world, &accesses, &type_registry, &allocator) + .unwrap() + }; + assert_eq!(unproxied.0, "test"); + } + + #[test] + pub fn test_proxy_ref_mut() { + let mut allocator = ReflectAllocator::default(); + let (alloc_id, _) = allocator.allocate(Test("test")); + + let mut proxy = ReflectRefMutProxy::::new(TestProxy(ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Owned(alloc_id), + }, + reflect_path: vec![], + })); + let mut world = World::new(); + let mut accesses = SmallVec::new(); + let world = WorldAccessGuard::new(&mut world); + let type_registry = TypeRegistry::default(); + + proxy.collect_accesses(&world, &mut accesses).unwrap(); + let unproxied = unsafe { + proxy + .unproxy_with_world(&world, &accesses, &type_registry, &allocator) + .unwrap() + }; + assert_eq!(unproxied.0, "test"); + } + + #[test] + pub fn test_vec_proxy_ref_mut() { + let mut allocator = ReflectAllocator::default(); + let (alloc_id, _) = allocator.allocate(Test("test")); + + let mut proxy = vec![Some(ReflectRefMutProxy::::new(TestProxy( + ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Owned(alloc_id), + }, + reflect_path: vec![], + }, + )))]; + let mut world = World::new(); + let mut accesses = SmallVec::new(); + let world = WorldAccessGuard::new(&mut world); + let type_registry = TypeRegistry::default(); + + proxy.collect_accesses(&world, &mut accesses).unwrap(); + let unproxied = unsafe { + proxy + .unproxy_with_world(&world, &accesses, &type_registry, &allocator) + .unwrap() + }; + assert_eq!(unproxied[0].as_ref().unwrap().0, "test"); + } + + #[test] + pub fn test_invalid_access() { + let mut allocator = ReflectAllocator::default(); + + let (allocation_id, _) = allocator.allocate(Test("test")); + + let reflect_ref = ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Owned(allocation_id), + }, + reflect_path: vec![], + }; + + // mutable access to the same allocation + let proxy = vec![ + ReflectRefMutProxy::::new(TestProxy(reflect_ref.clone())), + ReflectRefMutProxy::::new(TestProxy(reflect_ref)), + ]; + + let mut world = World::new(); + let mut accesses = SmallVec::new(); + let world = WorldAccessGuard::new(&mut world); + + let result = proxy.collect_accesses(&world, &mut accesses); + assert!(matches!(result, Err(..))); + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs new file mode 100644 index 0000000000..5a7db18a45 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -0,0 +1,114 @@ +use std::{any::TypeId, ops::Deref, sync::Arc}; + +use bevy::{ecs::entity::Entity, reflect::TypeRegistration}; + +use super::{ReflectReference, WorldCallbackAccess, STALE_WORLD_MSG}; +use crate::prelude::{ScriptError, ScriptResult}; + +/// A wrapper around a `TypeRegistration` that provides additional information about the type. +/// +/// This is used as a hook to a rust type from a scripting language. We should be able to easily convert between a type name and a [`ScriptTypeRegistration`]. +#[derive(Clone)] +pub struct ScriptTypeRegistration(pub(crate) Arc); + +impl ScriptTypeRegistration { + pub fn new(arc: Arc) -> Self { + Self(arc) + } + + #[inline(always)] + pub fn short_name(&self) -> &str { + self.0.type_info().type_path_table().short_path() + } + + #[inline(always)] + pub fn type_name(&self) -> &'static str { + self.0.type_info().type_path_table().path() + } + + #[inline(always)] + pub fn type_id(&self) -> TypeId { + self.0.type_info().type_id() + } +} + +impl std::fmt::Debug for ScriptTypeRegistration { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_tuple("ScriptTypeRegistration") + .field(&self.0.type_info().type_path()) + .finish() + } +} + +impl std::fmt::Display for ScriptTypeRegistration { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(self.0.type_info().type_path()) + } +} + +impl Deref for ScriptTypeRegistration { + type Target = Arc; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +#[derive(Clone)] +pub struct ScriptQueryBuilder { + world: WorldCallbackAccess, + components: Vec, + with: Vec, + without: Vec, +} + +impl ScriptQueryBuilder { + pub fn new(world: WorldCallbackAccess) -> Self { + Self { + world, + components: vec![], + with: vec![], + without: vec![], + } + } + + pub fn components(&mut self, components: Vec) -> &mut Self { + self.components.extend(components); + self + } + + pub fn with(&mut self, with: Vec) -> &mut Self { + self.with.extend(with); + self + } + + pub fn without(&mut self, without: Vec) -> &mut Self { + self.without.extend(without); + self + } + + pub fn build(&mut self) -> ScriptResult> { + self.world.query( + std::mem::take(&mut self.components), + std::mem::take(&mut self.with), + std::mem::take(&mut self.without), + ) + } +} + +#[derive(Clone)] +pub struct ScriptQueryResult(pub Entity, pub Vec); + +impl WorldCallbackAccess { + pub fn query( + &mut self, + components: Vec, + with: Vec, + without: Vec, + ) -> ScriptResult> { + // for c in components { + + // } + todo!() + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs new file mode 100644 index 0000000000..b89d146d06 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -0,0 +1,500 @@ +//! # Motivation +//! +//! Traits and structs needed to support the creation of bindings for scripting languages. +//! reflection gives us access to `dyn PartialReflect` objects via their type name, +//! Scripting languages only really support `Clone` objects so if we want to support references, +//! we need wrapper types which have owned and ref variants. +use lockable::LockableHashMap; + +use std::{ + any::TypeId, + cell::UnsafeCell, + error::Error, + fmt::Debug, + marker::PhantomData, + ops::Index, + sync::{Arc, Weak}, + time::Duration, +}; + +use bevy::{ + ecs::{ + change_detection::MutUntyped, + component::{Component, ComponentId}, + entity::Entity, + reflect::AppTypeRegistry, + system::Resource, + world::{unsafe_world_cell::UnsafeWorldCell, Mut, World}, + }, + ptr::Ptr, + reflect::{ + Access, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, TypeInfo, TypeRegistry + }, +}; +use smallvec::SmallVec; + +use crate::{ + bindings::{ReflectAllocation, ReflectAllocationId}, + prelude::{ReflectAllocator, ScriptError, ScriptResult}, +}; + +use super::{ + proxy::{Proxy, Unproxy}, + ReflectAccessId, ReflectAccessKind, WorldAccessGuard, WorldAccessWrite, DEFAULT_INTERVAL, + DEFAULT_TIMEOUT, +}; + +/// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path +/// safe to build but to reflect on the value inside you need to ensure aliasing rules are upheld +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ReflectReference { + pub base: ReflectBaseType, + // TODO: experiment with Fixed capacity vec, boxed array etc, compromise between heap allocation and runtime cost + // needs benchmarks first though + /// The path from the top level type to the actual value we want to access + pub reflect_path: Vec, +} + +// just a dummy standin for unregistered types +struct UnregisteredType; + +impl ReflectReference { + + pub fn new_allocated( + value: T, + allocator: &mut ReflectAllocator, + ) -> ReflectReference { + let (id, _) = allocator.allocate(value); + ReflectReference { + base: ReflectBaseType { + type_id: TypeId::of::(), + base_id: ReflectBase::Owned(id), + }, + reflect_path: Vec::default(), + } + } + + /// Indexes into the reflect path inside this reference. + /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. + pub fn index_path>(&mut self, index: T) { + self.reflect_path.push(index.into()); + } + + /// A form of [`Self::reflect`] which does the access checks for you. + /// Panics if it waits for access too long to prevent deadlocks. + pub fn with_reflect O>( + &self, + world: &WorldAccessGuard, + type_registry: &TypeRegistry, + allocator: Option<&ReflectAllocator>, + f: F, + ) -> O { + let access = world + .get_access_timeout( + self.base.base_id.get_reflect_access_id(), + DEFAULT_TIMEOUT, + DEFAULT_INTERVAL, + ) + .unwrap_or_else(|| panic!("Timeout when waiting for access for: `{:?}`", self)); + + let reflect = self + .reflect( + world.as_unsafe_world_cell(), + &access, + type_registry, + allocator, + ) + .unwrap(); + let o = f(reflect); + world.release_access(access); + o + } + + pub fn with_reflect_mut O>( + &self, + world: &WorldAccessGuard, + type_registry: &TypeRegistry, + allocator: Option<&ReflectAllocator>, + f: F, + ) -> O { + let mut access = world + .get_access_timeout( + self.base.base_id.get_reflect_access_id(), + DEFAULT_TIMEOUT, + DEFAULT_INTERVAL, + ) + .unwrap_or_else(|| panic!("Timeout when waiting for access for: `{:?}`", self)); + + let reflect = self + .reflect_mut( + world.as_unsafe_world_cell(), + &mut access, + type_registry, + allocator, + ) + .unwrap(); + let o = f(reflect); + world.release_access(access); + o + } + + /// Returns `Ok(())` if the given access is sufficient to read the value or an appropriate error otherwise + pub fn expect_read_access<'w>( + &self, + access: &WorldAccessWrite<'w>, + type_registry: &TypeRegistry, + allocator: Option<&ReflectAllocator>, + world: UnsafeWorldCell<'w>, + ) -> ScriptResult<()> { + if !access.can_read(self.base.base_id.get_reflect_access_id()) { + Err(ScriptError::new_reflection_error(format!( + "Invalid access when trying to read: `{}`, instead got access to `{}`", + self.base.display_with_type_name(type_registry), + access.to_enriched_str(type_registry, allocator, world) + ))) + } else { + Ok(()) + } + } + + /// Returns `Ok(())` if the given access is sufficient to write to the value or an appropriate error otherwise + /// Note that this is not sufficient for write access, you also need to ensure the [`WorldAccessWrite`] won't be used to access the same value mutably elsewhere, + /// if you have a `&mut WorldAccessWrite` you can guarantee this statically. This function just checks that the access itself is for the right base with write access + pub fn expect_write_access<'w>( + &self, + access: &WorldAccessWrite<'w>, + type_registry: &TypeRegistry, + allocator: Option<&ReflectAllocator>, + world: UnsafeWorldCell<'w>, + ) -> ScriptResult<()> { + if !access.can_read(self.base.base_id.get_reflect_access_id()) { + Err(ScriptError::new_reflection_error(format!( + "Invalid access when trying to write: `{}`, instead got access to `{}`", + self.base.display_with_type_name(type_registry), + access.to_enriched_str(type_registry, allocator, world) + ))) + } else { + Ok(()) + } + } + + /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell. + /// If the underlying componentId is not the same as the one we have access to, an error is returned. + pub fn reflect<'w, 'c>( + &self, + world: UnsafeWorldCell<'w>, + access: &'c WorldAccessWrite<'w>, + type_registry: &TypeRegistry, + allocator: Option<&'c ReflectAllocator>, + ) -> ScriptResult<&'c dyn PartialReflect> { + self.expect_read_access(access, type_registry, allocator, world)?; + // Safety: since we have read access to the underlying componentId we can safely access the component + // and we can return a reference tied to its lifetime, which will prevent invalid aliasing + return unsafe { self.reflect_unsafe(world, type_registry, allocator) }; + } + + /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell. + /// If the underlying componentId is not the same as the one we have access to, an error is returned. + /// + /// If we are accessing a component or resource, it's marked as changed + pub fn reflect_mut<'w, 'c>( + &self, + world: UnsafeWorldCell<'w>, + access: &'c mut WorldAccessWrite<'w>, + type_registry: &TypeRegistry, + allocator: Option<&'c ReflectAllocator>, + ) -> ScriptResult<&'c mut dyn PartialReflect> { + self.expect_write_access(access, type_registry, allocator, world)?; + // Safety: since we have write access to the underlying reflect access id we can safely access the component + // and we can return a reference tied to its lifetime, which will prevent invalid aliasing + return unsafe { self.reflect_mut_unsafe(world, type_registry, allocator) }; + } + + /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell + /// # Safety + /// - The caller must ensure the cell has permission to access the underlying value + /// - The caller must ensure no aliasing mut references to the same value exist at all at the same time + pub unsafe fn reflect_unsafe<'w>( + &self, + world: UnsafeWorldCell<'w>, + type_registry: &TypeRegistry, + allocator: Option<&'w ReflectAllocator>, + ) -> ScriptResult<&'w dyn PartialReflect> { + if let ReflectBase::Owned(id) = &self.base.base_id { + let allocator = + allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; + let arc = allocator + .get(*id) + .ok_or_else(|| ScriptError::new_reflection_error("Missing allocation"))?; + + // safety: caller promises it's fine :) + return self.walk_path(unsafe { &*arc.get_ptr() }); + }; + // all Reflect types should have this derived + let from_ptr_data: &ReflectFromPtr = type_registry + .get_type_data(self.base.type_id) + .expect("FromPtr is not registered for this type, cannot retrieve reflect reference"); + + let ptr = self + .base + .base_id + .clone() + .into_ptr(world) + .ok_or_else(|| + ScriptError::new_reflection_error( + format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_type_name(type_registry))))?; + + // (Ptr) Safety: we use the same type_id to both + // 1) retrieve the ptr + // 2) retrieve the ReflectFromPtr type data + // (UnsafeWorldCell) Safety: + // we already have access to &world so no &mut world exists + debug_assert_eq!( + from_ptr_data.type_id(), + self.base.type_id, + "Invariant violated" + ); + let base = unsafe { from_ptr_data.as_reflect(ptr) }; + self.walk_path(base.as_partial_reflect()) + } + + /// Retrieves mutable reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell + /// # Safety + /// - The caller must ensure the cell has permission to access the underlying value + /// - The caller must ensure no other references to the same value exist at all at the same time (even if you have the correct access) + pub unsafe fn reflect_mut_unsafe<'w>( + &self, + world: UnsafeWorldCell<'w>, + type_registry: &TypeRegistry, + allocator: Option<&'w ReflectAllocator>, + ) -> ScriptResult<&'w mut dyn PartialReflect> { + if let ReflectBase::Owned(id) = &self.base.base_id { + let allocator = allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; + + let arc = allocator + .get_mut(*id) + .ok_or_else(|| ScriptError::new_reflection_error("Missing allocation"))?; + + // Safety: caller promises this is fine :) + return self.walk_path_mut(unsafe { &mut *arc.get_ptr() }); + }; + + // all Reflect types should have this derived + let from_ptr_data: &ReflectFromPtr = type_registry + .get_type_data(self.base.type_id) + .expect("FromPtr is not registered for this type, cannot retrieve reflect reference"); + + let ptr = self + .base + .base_id + .clone() + .into_ptr_mut(world) + .ok_or_else(|| + ScriptError::new_reflection_error( + format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_type_name(type_registry))))? + .into_inner(); + + // (Ptr) Safety: we use the same type_id to both + // 1) retrieve the ptr + // 2) retrieve the ReflectFromPtr type data + // (UnsafeWorldCell) Safety: + // we already have access to &world so no &mut world exists + debug_assert_eq!( + from_ptr_data.type_id(), + self.base.type_id, + "Invariant violated" + ); + let base = unsafe { from_ptr_data.as_reflect_mut(ptr) }; + self.walk_path_mut(base.as_partial_reflect_mut()) + } + + fn walk_path<'a>(&self, root: &'a dyn PartialReflect) -> ScriptResult<&'a dyn PartialReflect> { + let mut current = root; + for elem in self.reflect_path.iter() { + current = elem + .reflect_element(current) + .map_err(|e| ScriptError::new_reflection_error(e.to_string()))?; + } + Ok(current) + } + + fn walk_path_mut<'a>(&self, root: &'a mut dyn PartialReflect) -> ScriptResult<&'a mut dyn PartialReflect> { + let mut current = root; + for elem in self.reflect_path.iter() { + current = elem + .reflect_element_mut(current) + .map_err(|e| ScriptError::new_reflection_error(e.to_string()))?; + } + Ok(current) + } +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct ReflectBaseType { + pub type_id: TypeId, + pub base_id: ReflectBase, +} + +impl ReflectBaseType { + pub fn type_name(type_id: TypeId, type_registry: &TypeRegistry) -> &'static str { + type_registry + .get_type_info(type_id) + .map(TypeInfo::type_path) + .unwrap_or("") + } + + pub fn display_with_type_name(&self, type_registry: &TypeRegistry) -> String { + format!( + "ReflectBase({}, {:?})", + Self::type_name(self.type_id, type_registry), + self.base_id + ) + } +} + +/// The Id of the kind of reflection base being pointed to +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum ReflectBase { + Component(Entity, ComponentId), + Resource(ComponentId), + Owned(ReflectAllocationId), +} + +impl ReflectBase { + /// Retrieves the pointer to the underlying `dyn PartialReflect` object valid for the 'w lifteime of the world cell + /// + /// # Safety + /// - The caller must ensure the cell has permission to access the underlying value + /// - The caller must ensure no aliasing mutable references to the same value exist at the same time + pub unsafe fn into_ptr(self, world: UnsafeWorldCell<'_>) -> Option> { + match self { + ReflectBase::Component(entity, component_id) => { + // Safety: the caller ensures invariants hold + world.get_entity(entity)?.get_by_id(component_id) + } + ReflectBase::Resource(component_id) => { + // Safety: the caller ensures invariants hold + world.get_resource_by_id(component_id) + } + _ => None, + } + } + + /// Retrieves the pointer to the underlying `dyn PartialReflect` object valid for the 'w lifteime of the world cell + /// + /// # Safety + /// - The caller must ensure the cell has permission to access the underlying value + /// - The caller must ensure no aliasing references to the same value exist at all at the same time + pub unsafe fn into_ptr_mut(self, world: UnsafeWorldCell<'_>) -> Option> { + match self { + ReflectBase::Component(entity, component_id) => { + // Safety: the caller ensures invariants hold + world.get_entity(entity)?.get_mut_by_id(component_id) + } + ReflectBase::Resource(component_id) => { + // Safety: the caller ensures invariants hold + world.get_resource_mut_by_id(component_id) + } + _ => None, + } + } + + pub fn get_reflect_access_id(&self) -> ReflectAccessId { + match self { + ReflectBase::Component(_, cid) | ReflectBase::Resource(cid) => (*cid).into(), + ReflectBase::Owned(id) => (*id).into(), + } + } +} + +/// An element in the reflection path, the base reference included +#[derive(Clone, PartialEq, Eq, Debug)] +pub enum ReflectionPathElem { + /// A standard reflection path, i.e. `.field_name[vec_index]`, pre-parsed since we construct once potentially use many times + Reflection(ParsedPath), + /// a deferred reflection + DeferredReflection(DeferredReflection), +} + +impl ReflectionPathElem { + pub fn new_reflection>(path: I) -> Self { + Self::Reflection(path.into()) + } + + pub fn new_deferred>(defref: I) -> Self { + Self::DeferredReflection(defref.into()) + } +} + +impl From<(A, B)> for DeferredReflection +where + A: Fn(&dyn PartialReflect) -> Result<&dyn PartialReflect, ReflectPathError<'static>> + Send + Sync, + B: Fn(&mut dyn PartialReflect) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> + Send + Sync, +{ + fn from((get, get_mut): (A, B)) -> Self { + Self { + get: Arc::new(get), + get_mut: Arc::new(get_mut), + } + } +} + +impl> From for ReflectionPathElem { + fn from(value: T) -> Self { + Self::DeferredReflection(value.into()) + } +} + +impl From for ReflectionPathElem { + fn from(value: ParsedPath) -> Self { + Self::Reflection(value) + } +} + +impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { + fn reflect_element<'r>( + self, + root: &'r dyn PartialReflect, + ) -> Result<&'r dyn PartialReflect, ReflectPathError<'a>> { + match self { + ReflectionPathElem::Reflection(path) => path.reflect_element(root), + ReflectionPathElem::DeferredReflection(f) => (f.get)(root), + } + } + + fn reflect_element_mut<'r>( + self, + root: &'r mut dyn PartialReflect, + ) -> Result<&'r mut dyn PartialReflect, ReflectPathError<'a>> { + match self { + ReflectionPathElem::Reflection(path) => path.reflect_element_mut(root), + ReflectionPathElem::DeferredReflection(defref) => (defref.get_mut)(root), + } + } +} + +/// A ReflectPath which can perform arbitrary operations on the root object to produce a sub-reference +#[derive(Clone)] +pub struct DeferredReflection { + pub get: + Arc Result<&dyn PartialReflect, ReflectPathError<'static>> + Send + Sync>, + pub get_mut: Arc< + dyn Fn(&mut dyn PartialReflect) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> + + Send + + Sync, + >, +} + +impl Debug for DeferredReflection { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str("DeferredReflection") + } +} + +impl PartialEq for DeferredReflection { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.get, &other.get) && Arc::ptr_eq(&self.get_mut, &other.get_mut) + } +} + +impl Eq for DeferredReflection {} diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs new file mode 100644 index 0000000000..0e60d2478a --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -0,0 +1,1888 @@ +//! # Motivation +//! +//! Traits and structs needed to support the creation of bindings for scripting languages. +//! reflection gives us access to `dyn PartialReflect` objects via their type name, +//! Scripting languages only really support `Clone` objects so if we want to support references, +//! we need wrapper types which have owned and ref variants. +use lockable::LockableHashMap; + +use std::{ + any::TypeId, + cell::UnsafeCell, + error::Error, + fmt::Debug, + marker::PhantomData, + ops::Index, + sync::{ + atomic::{AtomicBool, AtomicUsize, Ordering}, + Arc, Weak, + }, + time::Duration, +}; + +use bevy::{ + ecs::{ + change_detection::MutUntyped, + component::{Component, ComponentId}, + entity::Entity, + reflect::{AppTypeRegistry, ReflectComponent, ReflectFromWorld, ReflectResource}, + system::{Commands, Resource}, + world::{unsafe_world_cell::UnsafeWorldCell, CommandQueue, Mut, World}, + }, + hierarchy::{BuildChildren, Children, DespawnRecursiveExt, Parent}, + ptr::Ptr, + reflect::{ + std_traits::ReflectDefault, Access, ParsedPath, Reflect, ReflectFromPtr, ReflectPath, + ReflectPathError, TypeInfo, TypePath, TypeRegistration, TypeRegistry, + }, +}; + +use smallvec::SmallVec; + +use crate::{ + bindings::{ReflectAllocation, ReflectAllocationId}, + prelude::{ReflectAllocator, ScriptError, ScriptResult}, +}; + +use super::{ + proxy::{Proxy, Unproxy}, + ReflectBase, ReflectBaseType, ReflectReference, ScriptTypeRegistration, +}; + +/// Describes kinds of base value we are accessing via reflection +#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] +pub enum ReflectAccessKind { + ComponentOrResource, + Allocation, +} + +/// Describes the id pointing to the base value we are accessing via reflection, for components and resources this is the ComponentId +/// for script owned values this is an allocationId, this is used to ensure we have permission to access the value. +#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] +pub struct ReflectAccessId { + kind: ReflectAccessKind, + id: usize, +} + +impl From for ReflectAccessId { + fn from(value: ComponentId) -> Self { + Self { + kind: ReflectAccessKind::ComponentOrResource, + id: value.index(), + } + } +} + +impl From for ReflectAccessId { + fn from(value: ReflectAllocationId) -> Self { + Self { + kind: ReflectAccessKind::Allocation, + id: value.id(), + } + } +} + +/// While [`WorldAccessGuard`] prevents aliasing at runtime and also makes sure world exists at least as long as the guard itself, +/// borrows sadly do not persist the script-host boundary :(. That is to be expected, but instead we can make an abstraction which removes the lifetime parameter, making the outer type 'static, +/// while making sure the lifetime is still satisfied! +#[derive(Clone, Debug)] +pub struct WorldCallbackAccess(Weak>); + +impl WorldCallbackAccess { + /// Wraps a callback which requires access to the world in a 'static way via [`WorldCallbackAccess`]. + pub fn with_callback_access( + world: &mut World, + callback: impl FnOnce(&WorldCallbackAccess) -> T, + ) -> T { + // - the world cannot be dropped before the world drops since we have mutable reference to it in this entire function + // - nothing can alias inappropriately WorldAccessGuard since it's only instance is behind the raw Arc + let world_guard = Arc::new(WorldAccessGuard::new(world)); + let world_guard = unsafe { WorldCallbackAccess::new(Arc::downgrade(&world_guard)) }; + + callback(&world_guard) + } + + /// Creates a new [`WorldCallbackAccess`] with an erased lifetime. + /// + /// # Safety + /// - The caller must ensure the [`WorldAccessGuard`] must not outlive the 'w lifetime + /// - In practice this means that between the moment the original Arc is dropped, the lifetime 'w must be valid + /// - I.e. you *must* drop the original [`Arc`] before the original 'w scope ends + pub unsafe fn new<'w>(world: Weak>) -> Self { + // Safety: the caller ensures `WorldAccessGuard` does not outlive the original lifetime 'w + + let world = unsafe { + std::mem::transmute::>, Weak>>( + world, + ) + }; + + Self(world) + } + + /// Attempts to read the world access guard, if it still exists + pub fn read(&self) -> Option>> { + self.0.upgrade() + } +} + +pub(crate) const STALE_WORLD_MSG: &str = "Tried to access world via stale reference"; +pub(crate) const CONCURRENT_WORLD_ACCESS_MSG: &str = + "Something else is accessing the world right now!"; +pub(crate) const CONCURRENT_ACCESS_MSG: &str = + "Something else is accessing the resource/component/allocation right now!"; + +/// common world methods, see: +/// - [`crate::bindings::query`] for query related functionality +impl WorldCallbackAccess { + pub fn get_type_by_name(&self, type_name: &str) -> Option { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + world.with_resource(|_, registry: Mut| { + let registry = registry.read(); + registry + .get_with_short_type_path(type_name) + .or_else(|| registry.get_with_type_path(type_name)) + .map(|registration| ScriptTypeRegistration::new(Arc::new(registration.clone()))) + }) + } + + pub fn add_default_component( + &self, + entity: Entity, + registration: ScriptTypeRegistration, + ) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + "Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", + registration.type_info().type_path() + )))?; + + // we look for ReflectDefault or ReflectFromWorld data then a ReflectComponent data + let instance = if let Some(default_td) = registration.data::() { + default_td.default() + } else if let Some(from_world_td) = registration.data::() { + if let Some(world) = world.get_whole_world_access() { + from_world_td.from_world(world) + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + } else { + return Err(ScriptError::new_runtime_error(format!( + "Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", + registration.type_info().type_path() + ))); + }; + + // TODO: this shouldn't need entire world access it feels + if let Some(world) = world.get_whole_world_access() { + let app_registry = world + .remove_resource::() + .unwrap_or_else(|| panic!("Missing type registry")); + + let mut entity = world.get_entity_mut(entity).map_err(|e| { + ScriptError::new_runtime_error(format!( + "Could not access entity: {:?}. {e}", + entity + )) + })?; + { + let registry = app_registry.read(); + component_data.insert(&mut entity, instance.as_partial_reflect(), ®istry); + } + world.insert_resource(app_registry); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn get_component( + &self, + entity: Entity, + component_id: ComponentId, + ) -> ScriptResult> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let entity = world.cell.get_entity(entity).ok_or_else(|| { + ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) + })?; + + let component_info = world + .cell + .components() + .get_info(component_id) + .ok_or_else(|| { + ScriptError::new_runtime_error(format!( + "Component does not exist: {:?}", + component_id + )) + })?; + + if entity.contains_id(component_id) { + Ok(Some(ReflectReference { + base: ReflectBaseType { + type_id: component_info + .type_id() + .expect("Component does not have type id"), + base_id: ReflectBase::Component(entity.id(), component_id), + }, + reflect_path: Default::default(), + })) + } else { + Ok(None) + } + } + + pub fn has_component(&self, entity: Entity, component_id: ComponentId) -> ScriptResult { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let entity = world.cell.get_entity(entity).ok_or_else(|| { + ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) + })?; + + Ok(entity.contains_id(component_id)) + } + + pub fn remove_component( + &self, + entity: Entity, + registration: ScriptTypeRegistration, + ) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + "Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", + registration.type_info().type_path() + )))?; + + // TODO: this shouldn't need entire world access it feels + if let Some(world) = world.get_whole_world_access() { + let mut entity = world.get_entity_mut(entity).map_err(|e| { + ScriptError::new_runtime_error(format!( + "Could not retrieve entity: {:?}. {e}", + entity + )) + })?; + + component_data.remove(&mut entity); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + Ok(()) + } + + pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let component_info = world + .cell + .components() + .get_info(resource_id) + .ok_or_else(|| { + ScriptError::new_runtime_error(format!( + "Resource does not exist: {:?}", + resource_id + )) + })?; + + Ok(ReflectReference { + base: ReflectBaseType { + type_id: component_info + .type_id() + .expect("Resource does not have type id"), + base_id: ReflectBase::Resource(resource_id), + }, + reflect_path: Default::default(), + }) + } + + pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + "Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", + registration.type_info().type_path() + )))?; + + // TODO: this shouldn't need entire world access it feels + if let Some(world) = world.get_whole_world_access() { + component_data.remove(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + Ok(()) + } + + pub fn has_resource(&self, resource_id: ComponentId) -> bool { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + world.cell.components().get_info(resource_id).is_some() + } + + pub fn get_children(&self, entity: Entity) -> ScriptResult> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let access = world + .get_component_access_typed::() + .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); + + Ok(world + .get_component::(&access, entity)? + .map(|c| c.to_vec()) + .unwrap_or_default()) + } + + pub fn get_parent(&self, entity: Entity) -> ScriptResult> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + let access = world + .get_component_access_typed::() + .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); + + Ok(world + .get_component::(&access, entity)? + .map(|c| c.get())) + } + + pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + if let Some(world) = world.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(parent).add_children(children); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + if let Some(world) = world.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(parent).remove_children(children); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn insert_children( + &self, + parent: Entity, + index: usize, + children: &[Entity], + ) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + if let Some(world) = world.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(parent).insert_children(index, children); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn despawn_recursive(&self, entity: Entity) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + if let Some(world) = world.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(entity).despawn_recursive(); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn despawn(&self, entity: Entity) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + if let Some(world) = world.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(entity).despawn(); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn despawn_descendants(&self, entity: Entity) -> ScriptResult<()> { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + + if let Some(world) = world.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(entity).despawn_descendants(); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } +} + +/// Unit of world access +pub type WorldAccessUnit<'w> = WorldAccessWrite<'w>; + +pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5); +pub const DEFAULT_INTERVAL: Duration = Duration::from_millis(10); + +/// Provides safe access to the world via [`WorldAccess`] permissions, which enforce aliasing rules at runtime in multi-thread environments +#[derive(Clone)] +pub struct WorldAccessGuard<'w> { + cell: UnsafeWorldCell<'w>, + // TODO: this is fairly hefty, explore other ways to hand out locks on WorldAccess + accesses: Arc>>>, + /// true if anybody has any access to the world + accesses_count: Arc, + // TODO can we track code/stack locations of things holding onto theese locks for debugging? +} + +impl<'w> WorldAccessGuard<'w> { + /// Creates a new [`WorldAccessGuard`] for the given mutable borrow of the world + pub fn new(world: &'w mut World) -> Self { + Self { + cell: world.as_unsafe_world_cell(), + accesses: Default::default(), + accesses_count: Arc::new(AtomicUsize::new(0)), + } + } + + /// Retrieves the underlying unsafe world cell, with no additional guarantees of safety + /// proceed with caution and only use this if you understand what you're doing + pub fn as_unsafe_world_cell(&self) -> UnsafeWorldCell<'w> { + self.cell + } + + /// Retrieves the underlying read only unsafe world cell, with no additional guarantees of safety + /// proceed with caution and only use this if you understand what you're doing + pub fn as_unsafe_world_cell_readonly(&self) -> UnsafeWorldCell<'w> { + self.cell + } + + /// Checks nobody else is currently accessing the world, and if so locks access to it until + /// [`release_whole_world_access`] is called. + pub fn get_whole_world_access(&self) -> Option<&mut World> { + if self.accesses_count.load(Ordering::Relaxed) == 0 { + Some(unsafe { self.cell.world_mut() }) + } else { + None + } + } + + /// Releases whole world access. Allowing others to access it. + pub fn release_whole_world_access(&self, _world: &mut World) { + // we do not need ot use the world reference, it's there as proof that the caller has claimed access before + assert_eq!(self.accesses_count.load(Ordering::Relaxed), 1); + self.accesses_count.fetch_sub(1, Ordering::Relaxed); + } + + /// Tries to get access to the given reflect access id, if it's already given out returns `None`. If you want to wait for access, use [`WorldAccessGuard::get_access_timeout`] instead. + /// Remember to release this access once done with [`WorldAccessGuard::release_access`] or nobody else will be able to access this id!. + /// + /// Although forgetting to release access is safe, it's frankly quite rude and can lead to deadlocks. + pub fn get_access(&self, raid: ReflectAccessId) -> Option> { + let mut guard = self + .accesses + .blocking_lock(raid, lockable::SyncLimit::no_limit()) + .unwrap(); + let guard = guard.value_or_insert_with(|| { + Some(WorldAccessWrite { + raid, + _ph: PhantomData, + }) + }); + + if guard.is_some() { + self.accesses_count.fetch_add(1, Ordering::Relaxed); + guard.take() + } else { + // somebody has access to this already, we cannot access at the moment + None + } + } + + /// Blocking version of [`WorldAccessGuard::get_access`], waits for access to the given reflect access id. Will busy wait at the given intervals, untill the timeout is reached. + /// If interval is zero this is equivalent to busy waiting. + /// + /// # Panic + /// Will panic once access was not available after the timeout was reached + pub fn get_access_timeout( + &self, + raid: ReflectAccessId, + timeout: Duration, + interval: Duration, + ) -> Option> { + let mut access = self.get_access(raid); + let start = std::time::Instant::now(); + + while access.is_none() { + std::thread::sleep(interval); + access = self.get_access(raid); + if start.elapsed() > timeout { + return None; + } + } + access + } + + /// Releases access to the given reflect access id + pub fn release_access(&self, access: WorldAccessUnit<'w>) { + let mut guard = self + .accesses + .blocking_lock(access.raid, lockable::SyncLimit::no_limit()) + .unwrap(); + + let guard = guard + .value_mut() + .expect("Invariant violated, access should exist"); + + // should not be possible, we are the only ones who can instantiate WorldAccessUnit + assert!( + guard.is_none(), + "Invariant violated, an access has been released by someone else already who shouldn't have been able to do so" + ); + + self.accesses_count.fetch_sub(1, Ordering::Relaxed); + *guard = Some(access); + } + + /// Get access to the given component_id, this is the only way to access a component/resource safely (in the context of the world access guard) + /// since you can only access this component_id through a RwLock, there is no way to break aliasing rules. + /// Additionally the 'w lifetime prevents you from storing this access outside the lifetime of the underlying cell + pub fn get_component_access(&self, cid: ComponentId) -> Option> { + let access_id = ReflectAccessId { + kind: ReflectAccessKind::ComponentOrResource, + id: cid.index(), + }; + self.get_access(access_id) + } + + /// Similar to [`Self::get_component_access`] but typed, additionally panics if the component is not registered + pub fn get_component_access_typed(&self) -> Option> { + self.get_component_access( + self.cell + .components() + .component_id::() + .unwrap_or_else(|| { + panic!("Component not registered: `{}`", std::any::type_name::()) + }), + ) + } + + /// Get access to the given component_id, this is the only way to access a component/resource safely (in the context of the world access guard) + /// since you can only access this component_id through a RwLock, there is no way to break aliasing rules. + /// Additionally the 'w lifetime prevents you from storing this access outside the lifetime of the underlying cell + pub fn get_resource_access(&self, cid: ComponentId) -> Option> { + self.get_component_access(cid) + } + + /// Similar to [`Self::get_resource_access`] but typed, additionally panics if the resource is not registered + pub fn get_resource_access_typed(&self) -> Option> { + self.get_resource_access( + self.cell + .components() + .resource_id::() + .unwrap_or_else(|| { + panic!("Resource not registered: `{}`", std::any::type_name::()) + }), + ) + } + + /// Get access to the given allocation_id, this is the only way to access a script owned value safely (in the context of the world access guard) + pub fn get_allocation_access(&self, id: ReflectAllocationId) -> Option> { + let access_id = ReflectAccessId { + kind: ReflectAccessKind::Allocation, + id: id.id(), + }; + self.get_access(access_id) + } + + /// Provides access to a resource via callback. Panics if the resource does not exist or if waiting for access times out. + pub fn with_resource) -> O>(&self, f: F) -> O { + let cid = self + .cell + .components() + .resource_id::() + .unwrap_or_else(|| panic!("Resource not registered: `{}`", std::any::type_name::())); + + let mut access = self + .get_access_timeout(cid.into(), DEFAULT_TIMEOUT, DEFAULT_INTERVAL) + .unwrap_or_else(|| { + panic!( + "Timed out while waiting for access to resource: `{}`", + std::any::type_name::() + ) + }); + + let resource = self + .get_resource_mut::(&mut access) + .expect("invariant") + .expect("invariant"); + let out = f(self, resource); + self.release_access(access); + out + } + + /// Call a function on a type which can be proxied, first by unproxying the input with world access, + /// then calling the function and finally proxying the output with the allocator. + pub fn proxy_call<'i, O: Proxy, T: Unproxy, F: Fn(T::Output<'_>) -> O::Input<'i>>( + &self, + mut proxied_input: T, + f: F, + ) -> ScriptResult { + self.with_resource(|world, type_registry: Mut| { + world.with_resource(|_, mut allocator: Mut| { + let type_registry = type_registry.read(); + let mut world_acceses = SmallVec::default(); + + proxied_input.collect_accesses(self, &mut world_acceses)?; + let input = unsafe { + proxied_input.unproxy_with_world( + self, + &world_acceses, + &type_registry, + &allocator, + )? + }; + let out = f(input); + + O::proxy_with_allocator(out, &mut allocator) + }) + }) + } + + /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) + pub fn get_component( + &self, + access: &WorldAccessWrite, + entity: Entity, + ) -> ScriptResult> { + let component_id = match self.cell.components().component_id::() { + Some(id) => id, + None => return Ok(None), + }; + + if access.can_read(ReflectAccessId { + kind: ReflectAccessKind::ComponentOrResource, + id: component_id.index(), + }) { + // Safety: we have the correct access id + return unsafe { Ok(self.cell.get_entity(entity).and_then(|e| e.get::())) }; + } else { + Err(ScriptError::new_reflection_error( + "Cannot read component, received invalid access".to_string(), + )) + } + } + + /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) + pub fn get_component_mut( + &self, + access: &mut WorldAccessWrite, + entity: Entity, + ) -> ScriptResult>> { + let component_id = match self.cell.components().component_id::() { + Some(id) => id, + None => return Ok(None), + }; + + if access.can_write(ReflectAccessId { + kind: ReflectAccessKind::ComponentOrResource, + id: component_id.index(), + }) { + // Safety: we have the correct access id + return unsafe { Ok(self.cell.get_entity(entity).and_then(|e| e.get_mut::())) }; + } else { + Err(ScriptError::new_reflection_error( + "Cannot write component, received invalid access".to_string(), + )) + } + } + + /// Get access to the given resource + pub fn get_resource(&self, access: &WorldAccessWrite) -> ScriptResult> { + let resource_id = match self.cell.components().resource_id::() { + Some(id) => id, + None => return Ok(None), + }; + + if access.can_read(ReflectAccessId { + kind: ReflectAccessKind::ComponentOrResource, + id: resource_id.index(), + }) { + // Safety: we have the correct access id + return unsafe { Ok(self.cell.get_resource::()) }; + } else { + Err(ScriptError::new_reflection_error( + "Cannot read resource, received invalid access".to_string(), + )) + } + } + + /// Get access to the given resource, this is the only way to access a component/resource safely (in the context of the world access guard) + pub fn get_resource_mut( + &self, + access: &mut WorldAccessWrite, + ) -> ScriptResult>> { + let resource_id = match self.cell.components().resource_id::() { + Some(id) => id, + None => return Ok(None), + }; + + if access.can_write(ReflectAccessId { + kind: ReflectAccessKind::ComponentOrResource, + id: resource_id.index(), + }) { + // Safety: we have the correct access id + return unsafe { Ok(self.cell.get_resource_mut::()) }; + } else { + Err(ScriptError::new_reflection_error( + "Cannot write resource, received invalid access".to_string(), + )) + } + } +} + +/// Impl block for higher level world methods +impl<'w> WorldAccessGuard<'w> { + pub fn get_type_by_name(&self, type_name: &str) -> Option { + self.with_resource(|_, registry: Mut| { + let registry = registry.read(); + registry + .get_with_short_type_path(type_name) + .or_else(|| registry.get_with_type_path(type_name)) + .map(|registration| ScriptTypeRegistration::new(Arc::new(registration.clone()))) + }) + } + + pub fn add_default_component( + &self, + entity: Entity, + registration: ScriptTypeRegistration, + ) -> ScriptResult<()> { + let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + "Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", + registration.type_info().type_path() + )))?; + + // we look for ReflectDefault or ReflectFromWorld data then a ReflectComponent data + let instance = if let Some(default_td) = registration.data::() { + default_td.default() + } else if let Some(from_world_td) = registration.data::() { + if let Some(world) = self.get_whole_world_access() { + from_world_td.from_world(world) + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + } else { + return Err(ScriptError::new_runtime_error(format!( + "Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", + registration.type_info().type_path() + ))); + }; + + // TODO: this shouldn't need entire world access it feels + if let Some(world) = self.get_whole_world_access() { + let app_registry = world + .remove_resource::() + .unwrap_or_else(|| panic!("Missing type registry")); + + let mut entity = world.get_entity_mut(entity).map_err(|e| { + ScriptError::new_runtime_error(format!( + "Could not retrieve entity: {:?}. {e}", + entity + )) + })?; + { + let registry = app_registry.read(); + component_data.insert(&mut entity, instance.as_partial_reflect(), ®istry); + } + world.insert_resource(app_registry); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } +} + +/// Having this is permission to access the contained [`ReflectAccessId`], there is no way to access anything safely through a [`WorldAccessGuard`] +/// without having a [`WorldAccess`] instance for that particular [`ReflectAccessId`]. +/// +/// If you do own a [`WorldAccess`] for some [`ReflectAccessId`], you can read and write to it safely. +/// If you only have an immutable borrow of [`WorldAccess`] you can only read it safely. +/// If you have a mutable borrow of [`WorldAccess`] you can read and write to it safely. +#[derive(Debug)] +pub struct WorldAccessWrite<'a> { + pub raid: ReflectAccessId, + pub(self) _ph: PhantomData<&'a usize>, +} + +impl<'w> WorldAccessWrite<'w> { + pub fn can_read(&self, raid: ReflectAccessId) -> bool { + self.raid == raid + } + + #[inline] + pub fn can_write(&self, raid: ReflectAccessId) -> bool { + self.can_read(raid) + } + + /// Prints the type of access this [`WorldAccessWrite`] entails, enriched with type information from the registry + pub fn to_enriched_str( + &self, + registry: &TypeRegistry, + allocator: Option<&ReflectAllocator>, + cell: UnsafeWorldCell, + ) -> String { + let (base_type, type_id) = match self.raid.kind { + ReflectAccessKind::ComponentOrResource => { + let type_id = cell + .components() + .get_info(ComponentId::new(self.raid.id)) + .and_then(|info| info.type_id()); + + ("Component/Resource", type_id) + } + ReflectAccessKind::Allocation => { + let type_id = allocator + .and_then(|allocator| allocator.get_type_id(ReflectAllocationId(self.raid.id))); + ("Allocation", type_id) + } + }; + + type_id + .and_then(|type_id| registry.get_type_info(type_id)) + .map(|info| format!("{base_type}<{}>", info.type_path())) + .unwrap_or(format!("{:?}", self.raid)) + } +} + +// pub struct + +#[cfg(test)] +mod test { + + use std::{any::Any, cell::UnsafeCell, convert::identity, sync::RwLock}; + + use crate::{ + bindings::{ + DeferredReflection, ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, + }, + bindings::{ReflectAllocation, ReflectAllocator}, + }; + + use super::*; + use bevy::{ + ecs::{component::Component, reflect::ReflectResource, system::Resource, world::World}, + reflect::TypeRegistryArc, + }; + + #[derive(Component, Reflect, PartialEq, Eq, Debug)] + #[reflect(Component)] + pub(crate) struct TestComponent { + pub strings: Vec, + } + + #[derive(Resource, Reflect, Default, PartialEq, Eq, Debug)] + #[reflect(Resource)] + pub(crate) struct TestResource { + pub bytes: Vec, + } + + pub(crate) fn setup_world( + init: F, + ) -> (World, ComponentId, ComponentId) { + let mut world = World::default(); + let allocator = ReflectAllocator::default(); + + let component_id = world.register_component::(); + let resource_id = world.init_resource::(); + + let mut type_registry = TypeRegistry::new(); + type_registry.register::(); + type_registry.register::(); + + init(&mut world, &mut type_registry); + + world.insert_resource(allocator); + + world.insert_resource(AppTypeRegistry(TypeRegistryArc { + internal: Arc::new(RwLock::new(type_registry)), + })); + + (world, component_id, resource_id) + } + + /// Tests that the given ref_ can be accessed and the value is as expected and access is released correctly (not for allocated values) + fn assert_access_yields< + O: Reflect + PartialEq + Debug, + F: FnOnce(&mut World, ComponentId, ComponentId) -> ReflectReference, + G: FnOnce(&WorldAccessGuard, ComponentId, ComponentId), + >( + init: F, + post_check: G, + expected: O, + ) { + let (mut world, component_id, resource_id) = setup_world(|_, _| {}); + let ref_ = init(&mut world, component_id, resource_id); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let world = world.read().unwrap(); + + // test read + world.with_resource(|world, allocator: Mut| { + world.with_resource(|world, type_registry: Mut| { + let type_registry = type_registry.read(); + ref_.with_reflect(world, &type_registry, Some(&allocator), |reflect| { + let orig = reflect.try_downcast_ref::(); + + let orig = match orig { + Some(v) => v, + None => { + panic!( + "Could not downcast value {reflect:?} to {}", + std::any::type_name::() + ) + } + }; + + assert_eq!(orig, &expected); + }) + }) + }); + + assert!( + world.get_component_access(component_id).is_some(), + "access to component was not release correctly" + ); + + assert!( + world.get_resource_access(resource_id).is_some(), + "access to component was not release correctly" + ); + + post_check(&world, component_id, resource_id); + }); + } + + /// Tests that setting to the expected value works as well as follow up reads give the expected value + fn assert_set_then_get_yields< + O: Reflect + PartialEq + Debug + Clone, + F: FnOnce(&mut World, ComponentId, ComponentId) -> ReflectReference, + G: FnOnce(&WorldAccessGuard, ComponentId, ComponentId), + >( + init: F, + post_check: G, + expected: O, + ) { + let (mut world, component_id, resource_id) = setup_world(|_, _| {}); + let ref_ = init(&mut world, component_id, resource_id); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let world = world.read().unwrap(); + // test set + world.with_resource(|world, allocator: Mut| { + world.with_resource(|world, type_registry: Mut| { + let type_registry = type_registry.read(); + ref_.with_reflect_mut(world, &type_registry, Some(&allocator), |reflect| { + let orig = reflect.try_downcast_mut::(); + + let orig = match orig { + Some(v) => v, + None => { + panic!( + "Could not downcast value {reflect:?} to {}", + std::any::type_name::() + ) + } + }; + + *orig = expected.clone(); + }) + }) + }); + + // test read + world.with_resource(|world, allocator: Mut| { + world.with_resource(|world, type_registry: Mut| { + let type_registry = type_registry.read(); + ref_.with_reflect(world, &type_registry, Some(&allocator), |reflect| { + let orig = reflect.try_downcast_ref::(); + + let orig = match orig { + Some(v) => v, + None => { + panic!( + "Could not downcast value {reflect:?} to {}", + std::any::type_name::() + ) + } + }; + + assert_eq!(orig, &expected); + }) + }) + }); + post_check(&world, component_id, resource_id); + }); + } + + #[test] + fn test_component_access() { + let init = |world: &mut World, component_id, _| { + let entity = world + .spawn(TestComponent { + strings: vec![String::from("initial")], + }) + .id(); + + ReflectReference { + base: ReflectBaseType { + base_id: ReflectBase::Component(entity, component_id), + type_id: TypeId::of::(), + }, + reflect_path: vec![ + ReflectionPathElem::Reflection(ParsedPath::parse_static(".strings").unwrap()), + ReflectionPathElem::DeferredReflection(DeferredReflection { + get: Arc::new(|root| { + let strings = root.try_downcast_ref::>().unwrap(); + Ok(strings.first().unwrap()) + }), + get_mut: Arc::new(|root| { + let strings = root.try_downcast_mut::>().unwrap(); + Ok(strings.first_mut().unwrap()) + }), + }), + ], + } + }; + + assert_access_yields(init, |_, _, _| {}, String::from("initial")); + assert_set_then_get_yields(init, |_, _, _| {}, String::from("set")); + } + + #[test] + fn test_resource_access() { + let init = |world: &mut World, _, resource_id| { + world.insert_resource(TestResource { bytes: vec![42u8] }); + + ReflectReference { + base: ReflectBaseType { + base_id: ReflectBase::Resource(resource_id), + type_id: TypeId::of::(), + }, + reflect_path: vec![ + ReflectionPathElem::Reflection(ParsedPath::parse_static(".bytes").unwrap()), + ReflectionPathElem::DeferredReflection(DeferredReflection { + get: Arc::new(|root| { + let strings = root.try_downcast_ref::>().unwrap(); + Ok(strings.first().unwrap()) + }), + get_mut: Arc::new(|root| { + let strings = root.try_downcast_mut::>().unwrap(); + Ok(strings.first_mut().unwrap()) + }), + }), + ], + } + }; + assert_access_yields(init, |_, _, _| {}, 42u8); + assert_set_then_get_yields(init, |_, _, _| {}, 69u8); + } + + #[test] + fn test_script_alloc_access() { + let init = |world: &mut World, _, _| { + let mut script_allocator = ReflectAllocator::default(); + let mut ref_ = ReflectReference::new_allocated( + TestComponent { + strings: vec![String::from("initial")], + }, + &mut script_allocator, + ); + ref_.index_path(ParsedPath::parse_static(".strings").unwrap()); + ref_.index_path(DeferredReflection { + get: Arc::new(|root| { + let strings = root.try_downcast_ref::>().unwrap(); + Ok(strings.first().unwrap()) + }), + get_mut: Arc::new(|root| { + let strings = root.try_downcast_mut::>().unwrap(); + Ok(strings.first_mut().unwrap()) + }), + }); + world.insert_resource(script_allocator); + ref_ + }; + let post_check = |world: &WorldAccessGuard, _, _| { + assert!( + world + .get_allocation_access(ReflectAllocationId(0)) + .is_some(), + "allocation access was not released correctly" + ); + }; + assert_access_yields(init, post_check, String::from("initial")); + assert_set_then_get_yields(init, post_check, String::from("set")); + } + + #[test] + #[allow(clippy::drop_non_drop)] + fn test_invalid_runtime_access() { + let mut world = World::new(); + let world = WorldAccessGuard::new(&mut world); + let access = world.get_component_access(ComponentId::new(0)); + assert!( + world.get_component_access(ComponentId::new(0)).is_none(), + "access was allowed to alias" + ); + drop(access); + } + + #[test] + #[should_panic] + fn test_double_release_panics() { + let mut world = World::new(); + let world = WorldAccessGuard::new(&mut world); + let access = world.get_component_access(ComponentId::new(0)).unwrap(); + world.release_access(access); + // This won't be possible in client code + world.release_access(WorldAccessWrite { + raid: ReflectAccessId { + kind: ReflectAccessKind::ComponentOrResource, + id: 0, + }, + _ph: PhantomData, + }); + } + + #[test] + fn test_count_updated_correctly() { + let mut world = World::new(); + let guard = WorldAccessGuard::new(&mut world); + let access = guard.get_access(ComponentId::new(0).into()).unwrap(); + assert_eq!(1, guard.accesses_count.load(Ordering::Relaxed)); + guard.release_access(access); + assert_eq!(0, guard.accesses_count.load(Ordering::Relaxed)); + } +} + +#[cfg(test)] +mod test_api { + use bevy::ecs::system::Commands; + use bevy::ecs::world::FromWorld; + use bevy::hierarchy::BuildChildren; + + use crate::bindings::ScriptTypeRegistration; + use crate::prelude::{ScriptErrorInner, ScriptErrorKind}; + + use super::test::{setup_world, TestComponent, TestResource}; + + use super::*; + + fn get_reg(world: &WorldCallbackAccess, name: &str) -> ScriptTypeRegistration { + world.get_type_by_name(name).expect("Type not found") + } + + fn test_comp_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { + world + .get_type_by_name("TestComponent") + .expect("Component not found") + } + + fn test_resource_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { + world + .get_type_by_name("TestResource") + .expect("Resource not found") + } + + #[test] + fn test_get_type_by_name() { + let (mut world, _, _) = setup_world(|_, _| {}); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_reg = world.get_type_by_name("TestComponent").unwrap(); + let resource_reg = world.get_type_by_name("TestResource").unwrap(); + + assert_eq!( + comp_reg.type_info().type_id(), + std::any::TypeId::of::() + ); + assert_eq!( + resource_reg.type_info().type_id(), + std::any::TypeId::of::() + ); + }); + } + + #[test] + fn test_get_type_by_name_invalid() { + let (mut world, _, _) = setup_world(|_, _| {}); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_reg = world.get_type_by_name("x"); + let resource_reg = world.get_type_by_name("z"); + + assert!(comp_reg.is_none()); + assert!(resource_reg.is_none()); + }); + } + + #[test] + fn test_add_default_component_from_world() { + #[derive(Reflect, Component, PartialEq, Debug)] + #[reflect(FromWorld, Component)] + struct CompWithFromWorld(pub String); + impl FromWorld for CompWithFromWorld { + fn from_world(_: &mut World) -> Self { + Self(String::from("FromWorld")) + } + } + + let (mut world, _, _) = setup_world(|w, r| { + w.register_component::(); + r.register::(); + }); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_reg = get_reg(world, "CompWithFromWorld"); + world.add_default_component(entity, comp_reg).unwrap() + }); + + assert_eq!( + world.get_entity(entity).unwrap().get::(), + Some(&CompWithFromWorld(String::from("FromWorld"))) + ); + } + + #[test] + fn test_add_default_component_default() { + #[derive(Reflect, Component, PartialEq, Debug)] + #[reflect(Default, Component)] + struct CompWithFromWorld(pub String); + + impl Default for CompWithFromWorld { + fn default() -> Self { + Self(String::from("Default")) + } + } + + let (mut world, _, _) = setup_world(|w, r| { + w.register_component::(); + r.register::(); + }); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_reg = get_reg(world, "CompWithFromWorld"); + world.add_default_component(entity, comp_reg).unwrap() + }); + + assert_eq!( + world.get_entity(entity).unwrap().get::(), + Some(&CompWithFromWorld(String::from("Default"))) + ); + } + + #[test] + fn test_add_default_component_missing_from_world_and_default() { + #[derive(Reflect, Component, PartialEq, Debug)] + #[reflect(Component)] + struct CompWithFromWorld(pub String); + + let (mut world, _, _) = setup_world(|w, r| { + w.register_component::(); + r.register::(); + }); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_reg = get_reg(world, "CompWithFromWorld"); + match world.add_default_component(entity, comp_reg.clone()) { + Ok(_) => { + panic!("Expected error") + } + Err(ScriptError(inner)) => { + assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); + assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", comp_reg.type_info().type_path())); + } + } + }); + } + + #[test] + fn test_add_default_component_missing_component_data() { + #[derive(Reflect, Component, PartialEq, Debug)] + #[reflect(Default)] + struct CompWithFromWorld(pub String); + + impl Default for CompWithFromWorld { + fn default() -> Self { + Self(String::from("Default")) + } + } + + let (mut world, _, _) = setup_world(|w, r| { + w.register_component::(); + r.register::(); + }); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_reg = get_reg(world, "CompWithFromWorld"); + match world.add_default_component(entity, comp_reg.clone()) { + Ok(_) => { + panic!("Expected error") + } + Err(ScriptError(inner)) => { + assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); + assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", comp_reg.type_info().type_path())); + } + } + }); + } + + #[test] + fn test_get_component_existing() { + let (mut world, comp_id, _) = setup_world(|_, _| {}); + let entity = world.spawn(TestComponent { strings: vec![] }).id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_ref = world.get_component(entity, comp_id).unwrap().unwrap(); + assert_eq!( + comp_ref, + ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Component(entity, comp_id), + }, + reflect_path: Default::default(), + } + ); + }); + } + + #[test] + fn test_get_component_missing() { + let (mut world, comp_id, _) = setup_world(|_, _| {}); + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_ref = world.get_component(entity, comp_id).unwrap(); + assert_eq!(comp_ref, None); + }); + } + + #[test] + fn test_get_component_missing_entity() { + let (mut world, comp_id, _) = setup_world(|_, _| {}); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_ref = world.get_component(Entity::from_raw(0), comp_id); + match comp_ref { + Ok(_) => { + panic!("Expected error") + } + Err(e) => { + assert_eq!(e.kind, ScriptErrorKind::RuntimeError); + assert_eq!(e.reason.to_string(), "Entity does not exist: 0v1"); + } + } + }); + } + + #[test] + fn test_get_component_unregistered_component() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let entity = world.spawn_empty().id(); + let fake_id = ComponentId::new(999); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_ref = world.get_component(entity, fake_id); + match comp_ref { + Ok(_) => { + panic!("Expected error") + } + Err(e) => { + assert_eq!(e.kind, ScriptErrorKind::RuntimeError); + assert_eq!( + e.reason.to_string(), + format!("Component does not exist: {fake_id:?}"), + ); + } + } + }); + } + + #[test] + fn test_remove_component() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let entity = world + .spawn(TestComponent { + strings: vec![String::from("strings")], + }) + .id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world + .remove_component(entity, test_comp_reg(world)) + .unwrap(); + }); + + assert_eq!( + world.get_entity(entity).unwrap().get::(), + None + ); + } + + #[test] + fn test_remove_component_empty_idempotent() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world + .remove_component(entity, test_comp_reg(world)) + .unwrap(); + }); + + assert_eq!( + world.get_entity(entity).unwrap().get::(), + None + ); + } + + #[test] + fn test_remove_component_missing_comp_registration() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let result = world.remove_component(entity, test_resource_reg(world)); + match result { + Ok(_) => { + panic!("Expected error") + } + Err(e) => { + assert_eq!(e.kind, ScriptErrorKind::RuntimeError); + assert_eq!(e.reason.to_string(), format!("Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", test_resource_reg(world).type_info().type_path())); + } + } + }); + + assert_eq!( + world.get_entity(entity).unwrap().get::(), + None + ); + } + + #[test] + fn test_remove_component_missing_entity() { + let (mut world, _, _) = setup_world(|_, _| {}); + let fake_entity = Entity::from_raw(0); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let result = world.remove_component(fake_entity, test_comp_reg(world)); + match result { + Ok(_) => { + panic!("Expected error") + } + Err(e) => { + assert_eq!(e.kind, ScriptErrorKind::RuntimeError); + assert_eq!(e.reason.to_string(), "Entity does not exist: 0v1"); + } + } + }); + } + + #[test] + fn test_get_resource_existing() { + let (mut world, _, resource_id) = setup_world(|_, _| {}); + world.insert_resource(TestResource { bytes: vec![1] }); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_ref = world.get_resource(resource_id).unwrap(); + assert_eq!( + comp_ref, + ReflectReference { + base: ReflectBaseType { + type_id: std::any::TypeId::of::(), + base_id: ReflectBase::Resource(resource_id), + }, + reflect_path: Default::default(), + } + ); + }); + } + + #[test] + fn test_get_resource_non_existing() { + let (mut world, _, _) = setup_world(|_, _| {}); + let fake_comp = ComponentId::new(999); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let comp_ref = world.get_resource(fake_comp); + match comp_ref { + Ok(_) => panic!("Expected error"), + Err(e) => { + assert_eq!(e.kind, ScriptErrorKind::RuntimeError); + assert_eq!( + e.reason.to_string(), + format!("Resource does not exist: {fake_comp:?}") + ) + } + } + }); + } + + #[test] + fn test_remove_resource() { + let (mut world, _, _) = setup_world(|_, _| {}); + + world.insert_resource(TestResource { bytes: vec![1] }); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.remove_resource(test_resource_reg(world)).unwrap(); + }); + + assert_eq!(world.get_resource::(), None); + } + + #[test] + fn test_remove_resource_missing_idempotent() { + let (mut world, _, _) = setup_world(|_, _| {}); + + world.remove_resource::(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.remove_resource(test_resource_reg(world)).unwrap(); + }); + + assert_eq!(world.get_resource::(), None); + } + + #[test] + fn test_remove_resource_missing_resource_registration() { + let (mut world, _, _) = setup_world(|_, _| {}); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + match world.remove_resource(test_comp_reg(world)) { + Ok(_) => panic!("Expected error"), + Err(e) => { + assert_eq!(e.kind, ScriptErrorKind::RuntimeError); + assert_eq!(e.reason.to_string(), format!("Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", test_comp_reg(world).type_info().type_path())); + } + } + }); + } + + #[test] + fn test_has_resource_existing() { + let (mut world, _, res_reg) = setup_world(|_, _| {}); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + assert!(world.has_resource(res_reg)); + }); + } + + #[test] + fn test_has_resource_missing() { + let (mut world, _, res_reg) = setup_world(|_, _| {}); + + world.remove_resource::(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + assert!(world.has_resource(res_reg)); + }); + } + + #[test] + fn test_get_children_1_child() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child]); + cmnds.apply(&mut world); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let children = world.get_children(parent).unwrap(); + assert_eq!(children.len(), 1); + assert_eq!(children[0], child); + }); + } + + #[test] + #[should_panic( + expected = "Component not registered: `bevy_hierarchy::components::children::Children`" + )] + fn test_get_children_children_component_unregistered() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.get_children(parent).unwrap(); + }); + } + + #[test] + fn test_get_children_no_children() { + let (mut world, _, _) = setup_world(|_, _| {}); + + world.register_component::(); + let parent = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let children = world.get_children(parent).unwrap(); + assert_eq!(children.len(), 0); + }); + } + + #[test] + fn test_get_parent_1_parent() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child]); + cmnds.apply(&mut world); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let found_parent = world.get_parent(child).unwrap(); + assert_eq!(found_parent, Some(parent)); + }); + } + + #[test] + fn test_get_parent_no_parent() { + let (mut world, _, _) = setup_world(|_, _| {}); + world.register_component::(); + + let child = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + let found_parent = world.get_parent(child).unwrap(); + assert_eq!(found_parent, None); + }); + } + + #[test] + #[should_panic( + expected = "Component not registered: `bevy_hierarchy::components::parent::Parent`" + )] + fn test_get_parent_parent_component_unregistered() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let child = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.get_parent(child).unwrap(); + }); + } + + #[test] + fn test_push_children_empty_entity() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.push_children(parent, &[child]).unwrap(); + }); + + let children = world.get::(parent).unwrap(); + assert_eq!(children.len(), 1); + assert_eq!(children[0], child); + } + + #[test] + fn test_push_children_entity_with_1_child() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child]); + cmnds.apply(&mut world); + + let child_2 = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.push_children(parent, &[child_2]).unwrap(); + }); + + let children = world.get::(parent).unwrap(); + assert_eq!(children.len(), 2); + assert_eq!(children[0], child); + assert_eq!(children[1], child_2); + } + + #[test] + fn test_remove_children_entity_with_1_child() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child]); + cmnds.apply(&mut world); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.remove_children(parent, &[child]).unwrap(); + }); + + let children = world.get::(parent); + assert!(children.is_none()); + } + + #[test] + fn test_remove_children_remove_half_children() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let child_2 = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child, child_2]); + cmnds.apply(&mut world); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.remove_children(parent, &[child]).unwrap(); + }); + + let children = world.get::(parent).unwrap(); + assert_eq!(children.len(), 1); + assert_eq!(children[0], child_2); + } + + #[test] + fn test_insert_children_empty() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.insert_children(parent, 0, &[child]).unwrap(); + }); + + let children = world.get::(parent).unwrap(); + assert_eq!(children.len(), 1); + assert_eq!(children[0], child); + } + + #[test] + fn test_insert_children_middle() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let child_2 = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child, child_2]); + cmnds.apply(&mut world); + + let child_to_insert = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world + .insert_children(parent, 1, &[child_to_insert]) + .unwrap(); + }); + + let children = world.get::(parent).unwrap(); + assert_eq!(children.len(), 3); + assert_eq!(children[0], child); + assert_eq!(children[1], child_to_insert); + assert_eq!(children[2], child_2); + } + + #[test] + fn test_despawn_entity() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let entity = world.spawn_empty().id(); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.despawn(entity).unwrap(); + }); + + assert!(world.get_entity(entity).is_err()); + } + + #[test] + fn test_despawn_recursive() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child]); + cmnds.apply(&mut world); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.despawn_recursive(parent).unwrap(); + }); + + assert!(world.get_entity(parent).is_err()); + assert!(world.get_entity(child).is_err()); + } + + #[test] + fn test_despawn_descendants() { + let (mut world, _, _) = setup_world(|_, _| {}); + + let parent = world.spawn_empty().id(); + let child = world.spawn_empty().id(); + let mut cmnds = CommandQueue::default(); + let mut cmnd = Commands::new(&mut cmnds, &world); + cmnd.entity(parent).add_children(&[child]); + cmnds.apply(&mut world); + + WorldCallbackAccess::with_callback_access(&mut world, |world| { + world.despawn_descendants(parent).unwrap(); + }); + + assert!(world.get_entity(parent).is_ok()); + assert!(world.get_entity(child).is_err()); + } +} diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs new file mode 100644 index 0000000000..d2b3618445 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -0,0 +1,142 @@ +use std::marker::PhantomData; + +use bevy::{asset::Handle, ecs::world::Mut, log::debug, prelude::Command}; + +use crate::{ + asset::ScriptAsset, + context::{Context, ContextLoadingSettings, ScriptContexts}, + prelude::{Runtime, RuntimeContainer}, + script::{Script, ScriptId, Scripts}, +}; + +pub struct DeleteScript { + pub id: ScriptId, + // hack to make this Send, C does not need to be Send since it is not stored in the command + pub _ph: PhantomData, +} + +impl DeleteScript { + pub fn new(id: ScriptId) -> Self { + Self { + id, + _ph: PhantomData, + } + } +} + +impl Command for DeleteScript { + fn apply(self, world: &mut bevy::prelude::World) { + let settings = world + .get_resource::>() + .expect("No ScriptLoadingSettings resource found") + .clone(); + + world.resource_scope(|world, mut scripts: Mut| { + if let Some(script) = scripts.scripts.remove(&self.id) { + debug!("Deleting script with id: {}", self.id); + let mut ctxts = world.get_non_send_resource_mut::>(); + let ctxts = ctxts.as_deref_mut().unwrap(); + let assigner = settings + .assigner + .as_ref() + .expect("Could not find context assigner in settings"); + debug!("Removing script with id: {}", self.id); + (assigner.remove)(script.context_id, &script, ctxts) + } else { + bevy::log::error!( + "Attempted to delete script with id: {} but it does not exist, doing nothing!", + self.id + ); + } + }); + + world.insert_resource(settings); + } +} + +/// Creates new script with the given ID, if a script with the given ID already exists, this is treated as an update +/// +/// If script comes from an asset, expects it to be loaded, otherwise this command will fail to process the script. +pub struct CreateOrUpdateScript { + id: ScriptId, + content: Box<[u8]>, + asset: Option>, + // Hack to make this Send, C does not need to be Send since it is not stored in the command + _ph: std::marker::PhantomData, +} + +impl CreateOrUpdateScript { + pub fn new(id: ScriptId, content: Box<[u8]>, asset: Option>) -> Self { + Self { + id, + content, + asset, + _ph: std::marker::PhantomData, + } + } +} + +impl Command for CreateOrUpdateScript { + fn apply(self, world: &mut bevy::prelude::World) { + let settings = world + .get_resource::>() + .unwrap() + .clone(); + let mut contexts = world + .remove_non_send_resource::>() + .unwrap(); + let mut runtime = world + .remove_non_send_resource::>() + .unwrap(); + // assign context + let assigner = settings.assigner.clone().expect("No context assigner set"); + let builder = settings.loader.clone().expect("No context loader set"); + + world.resource_scope(|world, mut scripts: Mut| { + + // check if script already exists + + let mut script = scripts.scripts.get_mut(&self.id); + let previous_context_id = script.as_ref().map(|s| s.context_id); + debug!( + "CreateOrUpdateScript command applying with to (script_id: {}, previous_context_id: {:?})", + self.id, previous_context_id + ); + + // If None assign new context ID, otherwise assign the old one + // If re-loading and different from the previous one, the old one will be removed + let current_context_id = (assigner.assign)(script.as_deref(), &self.id, &self.content, &mut contexts); + let current_context_id = if let Some(id) = current_context_id { + id + } else { + let ctxt = (builder.load)(&self.id, &self.content, &settings.context_initializers, &settings.context_pre_handling_initializers, world, runtime.runtime.as_mut().unwrap()).unwrap(); + contexts.insert(ctxt) + }; + + if let Some(previous) = previous_context_id { + if previous != current_context_id { + debug!( + "Script is being moved to a new context with id: {}, removing up old context.", + current_context_id + ); + script.as_deref_mut().unwrap().context_id = current_context_id; + (assigner.remove)(previous, script.unwrap(), &mut contexts); + } + } + + + // now we can insert the actual script + scripts.scripts.insert( + self.id.clone(), + Script { + id: self.id, + asset: self.asset, + context_id: current_context_id, + }, + ); + }); + world.insert_resource(settings); + world.insert_non_send_resource(runtime); + world.insert_non_send_resource(contexts); + } +} diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs new file mode 100644 index 0000000000..169cd831da --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -0,0 +1,152 @@ +use std::{collections::HashMap, sync::atomic::AtomicU32}; + +use bevy::ecs::{entity::Entity, system::Resource, world::World}; + +use crate::{ + prelude::{Runtime, ScriptError}, + script::{Script, ScriptId}, +}; + +pub trait Context: 'static {} +impl Context for T {} + +pub type ContextId = u32; + +#[derive(Resource)] +pub struct ScriptContexts { + pub(crate) contexts: HashMap, +} + +impl Default for ScriptContexts { + fn default() -> Self { + Self { + contexts: Default::default(), + } + } +} + +static CONTEXT_ID_COUNTER: AtomicU32 = AtomicU32::new(0); +impl ScriptContexts { + pub fn new() -> Self { + Self { + contexts: HashMap::new(), + } + } + + /// Allocates a new ContextId and inserts the context into the map + pub fn insert(&mut self, ctxt: T) -> ContextId { + let id = CONTEXT_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + self.contexts.insert(id, ctxt); + id + } + + /// Allocate new context id without inserting a context + pub fn allocate_id(&self) -> ContextId { + CONTEXT_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed) + } + + pub fn remove(&mut self, id: ContextId) -> Option { + self.contexts.remove(&id) + } +} + +/// Initializer run once after creating a context but before executing it for the first time +pub type ContextInitializer = fn(&ScriptId, &mut C) -> Result<(), ScriptError>; +/// Initializer run every time before executing or loading a script +pub type ContextPreHandlingInitializer = + fn(&ScriptId, Entity, &mut C) -> Result<(), ScriptError>; + +#[derive(Resource)] +pub struct ContextLoadingSettings { + pub loader: Option>, + pub assigner: Option>, + pub context_initializers: Vec>, + pub context_pre_handling_initializers: Vec>, +} + +impl Default for ContextLoadingSettings { + fn default() -> Self { + Self { + loader: None, + assigner: None, + context_initializers: Default::default(), + context_pre_handling_initializers: Default::default(), + } + } +} + +impl Clone for ContextLoadingSettings { + fn clone(&self) -> Self { + Self { + loader: self.loader.clone(), + assigner: self.assigner.clone(), + context_initializers: self.context_initializers.clone(), + context_pre_handling_initializers: self.context_pre_handling_initializers.clone(), + } + } +} + +/// A strategy for loading and reloading contexts +pub struct ContextBuilder { + pub load: fn( + script: &ScriptId, + content: &[u8], + &[ContextInitializer], + &[ContextPreHandlingInitializer], + &mut World, + runtime: &mut R, + ) -> Result, + pub reload: fn( + script: &ScriptId, + new_content: &[u8], + context: &mut C, + &[ContextInitializer], + &[ContextPreHandlingInitializer], + &mut World, + &mut R, + ) -> Result<(), ScriptError>, +} + +impl Clone for ContextBuilder { + fn clone(&self) -> Self { + Self { + load: self.load, + reload: self.reload, + } + } +} + +/// A strategy for assigning contexts to new and existing but re-loaded scripts as well as for managing old contexts +pub struct ContextAssigner { + /// Assign a context to the script, if script is `None`, this is a new script, otherwise it is an existing script with a context inside `contexts`. + /// Returning None means the script should be assigned a new context + pub assign: fn( + old_script: Option<&Script>, + script_id: &ScriptId, + new_content: &[u8], + contexts: &ScriptContexts, + ) -> Option, + + /// Handle the removal of the script, if any clean up in contexts is necessary perform it here. + /// This will also be called, when a script is assigned a contextId on reload different from the previous one + /// the context_id in that case will be the old context_id and the one stored in the script will be the old one + pub remove: fn(context_id: ContextId, script: &Script, contexts: &mut ScriptContexts), +} + +impl Default for ContextAssigner { + fn default() -> Self { + Self { + assign: |_, _, _, c| Some(c.allocate_id()), + remove: |id, _, c| _ = c.remove(id), + } + } +} + +impl Clone for ContextAssigner { + fn clone(&self) -> Self { + Self { + assign: self.assign, + remove: self.remove, + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/docs.rs b/crates/bevy_mod_scripting_core/src/docs.rs index 8a2a2dfd3d..d186bcfe96 100644 --- a/crates/bevy_mod_scripting_core/src/docs.rs +++ b/crates/bevy_mod_scripting_core/src/docs.rs @@ -1,10 +1,24 @@ -use crate::error::ScriptError; +use bevy::ecs::system::Resource; -/// A documentation piece exported by an `APIProvider` -pub trait DocFragment: 'static { +/// A documentation piece which can be used to make a piece of documentation, most often a module. +pub trait DocumentationFragment: 'static + Sized { + /// Merges two documentation fragments into one, retaining the title of the first fragment. fn merge(self, o: Self) -> Self; - fn gen_docs(self) -> Result<(), ScriptError>; + fn gen_docs(self) -> Result<(), Box>; /// Retrieves the name of the documentation fragment, most likely the name of your game! fn name(&self) -> &'static str; } + +#[derive(Resource)] +pub struct Documentation { + pub fragments: Vec, +} + +impl Default for Documentation { + fn default() -> Self { + Self { + fragments: Default::default(), + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 3f0dd2be2b..ad1113489a 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -1,30 +1,181 @@ +use std::{ + ops::{Deref, DerefMut}, + sync::Arc, +}; + +use bevy::reflect::Reflect; use thiserror::Error; -#[derive(Error, Debug, Clone)] -pub enum ScriptError { - #[error("Runtime error in script `{script}` {msg}")] - RuntimeError { script: String, msg: String }, - #[error("Failed to load script asset for `{script}` {msg}")] - FailedToLoad { script: String, msg: String }, - #[error("Syntax error for script `{script}` {msg}")] - SyntaxError { script: String, msg: String }, - #[error("Callback method `{callback}` invalid for script `{script}` {msg}")] - InvalidCallback { - script: String, - callback: String, - msg: String, - }, - #[error("Failed to attach API for script `{script}` {msg}")] - FailedToAttachAPI { script: String, msg: String }, - #[error("Failed to generate documentation `{0}`")] - DocGenError(String), - #[error("{0}")] - Other(String), +use crate::{bindings::ReflectAllocationId, bindings::ReflectReference}; + +pub type ScriptResult = Result; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum ScriptErrorKind { + /// Any other error, default for script errors generated via Into conversions + Other, + /// Errors specifically to do with reflecting & reading/writing stuff from the world + ReflectionError, + /// Erorrs to do with invalid script API usage, invalid arguments etc. + RuntimeError, + /// Errors to do with the script lifecycle, loading, unloading etc. + Lifecycle, +} + +impl std::fmt::Display for ScriptErrorKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ScriptErrorKind::ReflectionError => f.write_str("Reflection Error"), + ScriptErrorKind::Lifecycle => f.write_str("Script Lifecycle Error"), + ScriptErrorKind::Other => f.write_str("Error"), + ScriptErrorKind::RuntimeError => f.write_str("Runtime Error"), + }; + Ok(()) + } +} + +#[derive(Error, Debug)] +pub struct ScriptErrorWrapper(ScriptError); + +impl std::fmt::Display for ScriptErrorWrapper { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +impl From for Box { + fn from(val: ScriptError) -> Self { + ScriptErrorWrapper(val).into() + } +} +/// An error with an optional script Context +#[derive(Debug, Clone)] +pub struct ScriptError(pub Arc); + +impl Deref for ScriptError { + type Target = ScriptErrorInner; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +/// The innards are separated to reduce the size of this error +#[derive(Debug)] +pub struct ScriptErrorInner { + pub script: Option, + pub kind: ScriptErrorKind, + pub context: String, + pub reason: Arc, } impl ScriptError { - /// Create new `ScriptError::Other` from another error - pub fn new_other(other: T) -> Self { - Self::Other(other.to_string()) + pub fn new_reflection_error>>( + reason: E, + ) -> Self { + Self(Arc::new(ScriptErrorInner { + script: None, + kind: ScriptErrorKind::ReflectionError, + reason: Arc::from(reason.into()), + context: Default::default(), + })) + } + + pub fn new_generic_error>>(reason: E) -> Self { + Self(Arc::new(ScriptErrorInner { + script: None, + kind: ScriptErrorKind::Other, + reason: Arc::from(reason.into()), + context: Default::default(), + })) + } + + pub fn new_lifecycle_error>>( + reason: E, + ) -> Self { + Self(Arc::new(ScriptErrorInner { + script: None, + kind: ScriptErrorKind::Lifecycle, + reason: Arc::from(reason.into()), + context: Default::default(), + })) + } + + pub fn new_runtime_error>>(reason: E) -> Self { + Self(Arc::new(ScriptErrorInner { + script: None, + kind: ScriptErrorKind::RuntimeError, + reason: Arc::from(reason.into()), + context: Default::default(), + })) + } + + pub fn with_context(self, context: S) -> Self { + Self(Arc::new(ScriptErrorInner { + script: self.0.script.clone(), + kind: self.0.kind.clone(), + context: context.to_string(), + reason: self.0.reason.clone(), + })) } } + +impl From for ScriptError { + fn from(value: T) -> Self { + Self::new_generic_error(value) + } +} + +impl std::fmt::Display for ScriptError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + if let Some(script) = &self.0.script { + write!( + f, + "Encountered {} error in script `{}`: {}", + self.0.kind, script, self.0.reason + ) + } else { + write!( + f, + "Encountered {} error in a script: {}", + self.0.kind, self.0.reason + ) + } + } +} + +// #[derive(Error, Debug, Clone)] +// pub enum ReflectionError { +// #[error("Base reference `{base}` is invalid. {reason}")] +// InvalidBaseReference { base: String, reason: String }, +// #[error("Cannot safely access `{base}`. {reason}")] +// InsufficientAccess { base: String, reason: String }, +// #[error("Tried to access `{base:?}` with insufficient provenance. {reason}")] +// InsufficientProvenance { +// base: ReflectReference, +// reason: String, +// }, +// #[error("Cannot downcast reference: {reference:?} to: {to}")] +// CannotDowncast { +// reference: ReflectReference, +// to: String, +// }, +// #[error("Could not assign `{rhs}` to `{lhs:?}`. {reason}")] +// InvalidAssignment { +// lhs: ReflectReference, +// rhs: String, +// reason: String, +// }, +// #[error("Failed to build concrete type from &Reflect type: `{ref_}`. Does this type have a FromReflect type data?")] +// FromReflectFailure { ref_: String }, +// #[error("Could not dereference script allocation with ID: {id}. {reason}")] +// AllocationError { +// id: ReflectAllocationId, +// reason: String, +// }, +// #[error("Attempted to access world via stale world reference. Did you store a reference to a world across a frame boundary?")] +// StaleWorldAccess, + +// #[error("{0}")] +// Other(String), +// } diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index 7ba3470709..2921d19c58 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -1,6 +1,6 @@ -use bevy::prelude::Event; +use bevy::{ecs::entity::Entity, prelude::Event}; -use crate::{error::ScriptError, hosts::Recipients}; +use crate::{error::ScriptError, handler::Args, script::ScriptId}; /// An error coming from a script #[derive(Debug, Event)] @@ -8,15 +8,235 @@ pub struct ScriptErrorEvent { pub error: ScriptError, } -/// An event emitted when a script was loaded or re-loaded (with a hot-reload), -/// guaranteed to be sent for every script at least once and immediately after it's loaded. -#[derive(Clone, Debug, Event)] -pub struct ScriptLoaded { - pub sid: u32, +/// A string which disallows common invalid characters in callback labels, +/// particularly at the start of the string +/// +/// a valid callback label starts with a letter or underscore, and contains only ascii characters, as well as disallows some common keywords +#[derive(Clone, PartialEq, Eq, Hash, Debug)] +pub struct CallbackLabel(String); + +impl CallbackLabel { + fn filter_invalid(s: &str) -> String { + let mut out = String::with_capacity(s.len()); + let mut first = true; + for char in s.chars() { + if char == '_' + || ((!first && char.is_ascii_alphanumeric()) || char.is_ascii_alphabetic()) + { + out.push(char); + first = false; + } else { + continue; + } + } + if FORBIDDEN_KEYWORDS.contains(&s) { + String::default() + } else { + out + } + } + + pub fn new_lossy(label: &str) -> Self { + Self(Self::filter_invalid(label)) + } + + pub fn new(label: &str) -> Option { + let new_lossy = Self::new_lossy(label); + if new_lossy.0.len() != label.len() { + None + } else { + Some(new_lossy) + } + } +} + +pub trait IntoCallbackLabel { + fn into_callback_label() -> CallbackLabel; +} + +impl From<&str> for CallbackLabel { + fn from(s: &str) -> Self { + Self::new_lossy(s) + } +} +impl From for CallbackLabel { + fn from(s: String) -> Self { + Self::from(s.as_str()) + } +} + +impl AsRef for CallbackLabel { + fn as_ref(&self) -> &str { + &self.0 + } +} + +impl std::fmt::Display for CallbackLabel { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.as_ref()) + } } -/// A trait for events to be handled by scripts -pub trait ScriptEvent: Send + Sync + Clone + Event + 'static { - /// Retrieves the recipient scripts for this event - fn recipients(&self) -> &Recipients; +/// Describes the designated recipients of a script event +#[derive(Clone, Debug)] +pub enum Recipients { + /// The event needs to be handled by all scripts + All, + /// The event is to be handled by a specific script + Script(ScriptId), + /// The event is to be handled by all the scripts on the specified entity + Entity(Entity), +} + +/// A callback event meant to trigger a callback in a subset/set of scripts in the world with the given arguments +#[derive(Clone, Event, Debug)] +pub struct ScriptCallbackEvent { + pub label: CallbackLabel, + pub recipients: Recipients, + pub args: A, +} + +impl ScriptCallbackEvent { + pub fn new>(label: L, args: A, recipients: Recipients) -> Self { + Self { + label: label.into(), + args, + recipients, + } + } + + pub fn new_for_all>(label: L, args: A) -> Self { + Self::new(label, args, Recipients::All) + } +} + +static FORBIDDEN_KEYWORDS: [&str; 82] = [ + // Lua + "and", + "break", + "do", + "else", + "elseif", + "end", + "false", + "for", + "function", + "if", + "in", + "local", + "nil", + "not", + "or", + "repeat", + "return", + "then", + "true", + "until", + "while", + // Rhai + "true", + "false", + "let", + "const", + "is_shared", + "if", + "else", + "switch", + "do", + "while", + "loop", + "until", + "for", + "in", + "continue", + "break", + "fn", + "private", + "is_def_fn", + "this", + "return", + "throw", + "try", + "catch", + "import", + "export", + "as", + "global", + "Fn", + "call", + "curry", + "type_of", + "print", + "debug", + "eval", + "is_def_var", + "var", + "static", + "is", + "goto", + "match", + "case", + "public", + "protected", + "new", + "use", + "with", + "module", + "package", + "super", + "spawn", + "thread", + "go", + "sync", + "async", + "await", + "yield", + "default", + "void", + "null", + "nil", +]; + +#[cfg(test)] +mod test { + use super::FORBIDDEN_KEYWORDS; + + #[test] + fn test_invalid_strings() { + FORBIDDEN_KEYWORDS.iter().for_each(|keyword| { + assert_eq!(super::CallbackLabel::new(keyword), None); + }); + } + + #[test] + fn test_bad_chars() { + let bad_chars = [ + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+', '=', '{', '}', '[', ']', + '|', '\\', ':', ';', '"', '\'', '<', '>', ',', '.', '?', '/', '`', '~', + ]; + bad_chars.iter().for_each(|char| { + assert_eq!(super::CallbackLabel::new(&format!("bad{}", char)), None); + }); + } + + #[test] + fn bad_first_letter() { + let bad_chars = [ + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '@', '#', '$', '%', '^', '&', '*', + '(', ')', '-', '+', '=', '{', '}', '[', ']', '|', '\\', ':', ';', '"', '\'', '<', '>', + ',', '.', '?', '/', '`', '~', + ]; + bad_chars.iter().for_each(|char| { + assert_eq!(super::CallbackLabel::new(&format!("{}bad", char)), None); + }); + } + + #[test] + fn test_valid_idents() { + let valid = ["h", "_v", "hello", "_2d", "heloo_2", "_1231412"]; + valid.iter().for_each(|ident| { + assert!(super::CallbackLabel::new(ident).is_some()); + assert_eq!(super::CallbackLabel::new_lossy(ident).as_ref(), *ident); + }); + } } diff --git a/crates/bevy_mod_scripting_core/src/handler.rs b/crates/bevy_mod_scripting_core/src/handler.rs new file mode 100644 index 0000000000..63bc1e0819 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/handler.rs @@ -0,0 +1,37 @@ +use bevy::ecs::{entity::Entity, system::Resource, world::World}; + +use crate::{ + context::{Context, ContextPreHandlingInitializer}, + event::CallbackLabel, + prelude::ScriptError, + runtime::Runtime, + script::ScriptId, +}; + +pub trait Args: Clone + Send + Sync + 'static {} +impl Args for T {} + +pub type HandlerFn = fn( + args: A, + entity: Entity, + script_id: &ScriptId, + callback: &CallbackLabel, + context: &mut C, + pre_handling_initializers: &[ContextPreHandlingInitializer], + runtime: &mut R, + world: &mut World, +) -> Result<(), ScriptError>; + +/// A resource that holds the settings for the callback handler for a specific combination of type parameters +#[derive(Resource)] +pub struct CallbackSettings { + pub callback_handler: Option>, +} + +impl Default for CallbackSettings { + fn default() -> Self { + Self { + callback_handler: None, + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 2022dad31b..92ed2a219f 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -1,211 +1,182 @@ -use crate::{ - event::ScriptErrorEvent, - hosts::{APIProvider, APIProviders, ScriptHost}, +#![allow(clippy::arc_with_non_send_sync)] + +use crate::event::ScriptErrorEvent; +use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; +use bevy::prelude::*; +use bindings::ReflectAllocator; +use context::{ + Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, + ContextPreHandlingInitializer, ScriptContexts, }; -use bevy::{ecs::schedule::ScheduleLabel, prelude::*}; -use event::ScriptLoaded; -use systems::script_event_handler; +use handler::{Args, CallbackSettings, HandlerFn}; +use prelude::{ + initialize_runtime, + runtime::{RuntimeInitializer, RuntimeSettings}, + sync_script_data, Documentation, DocumentationFragment, ScriptCallbackEvent, +}; +use runtime::{Runtime, RuntimeContainer}; +use script::Scripts; +use systems::garbage_collector; pub mod asset; +pub mod bindings; +pub mod commands; +pub mod context; pub mod docs; pub mod error; pub mod event; -pub mod hosts; +pub mod handler; +pub mod runtime; +pub mod script; pub mod systems; pub mod world; pub mod prelude { - // general - pub use { - crate::asset::CodeAsset, - crate::docs::DocFragment, - crate::error::ScriptError, - crate::event::{ScriptErrorEvent, ScriptEvent}, - crate::hosts::{ - APIProvider, APIProviders, Recipients, Script, ScriptCollection, ScriptContexts, - ScriptData, ScriptHost, - }, - crate::systems::script_event_handler, - crate::{ - AddScriptApiProvider, AddScriptHost, AddScriptHostHandler, GenDocumentation, - ScriptingPlugin, - }, - bevy_event_priority::{ - AddPriorityEvent, PriorityEvent, PriorityEventReader, PriorityEventWriter, - PriorityEvents, PriorityIterator, - }, - }; + pub use {crate::docs::*, crate::error::*, crate::event::*, crate::systems::*, crate::*}; } -pub use bevy_event_priority as events; #[derive(Default)] -/// Bevy plugin enabling run-time scripting -pub struct ScriptingPlugin; +/// Bevy plugin enabling scripting within the bevy mod scripting framework +pub struct ScriptingPlugin { + /// Callback for initiating the runtime + pub runtime_builder: Option R>, + /// The handler used for executing callbacks in scripts + pub callback_handler: Option>, + /// The context builder for loading contexts + pub context_builder: Option>, + /// The context assigner for assigning contexts to scripts, if not provided default strategy of keeping each script in its own context is used + pub context_assigner: Option>, +} -impl Plugin for ScriptingPlugin { +impl Plugin for ScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { - app.add_event::(); + app.add_event::() + .add_event::>() + .init_resource::() + .init_resource::() + .init_resource::() + .init_asset::() + .register_asset_loader(ScriptAssetLoader { + language: "<>".into(), + extensions: &[], + preprocessor: None, + }) + // not every script host will have a runtime, for convenience we add a dummy runtime + .insert_non_send_resource::>(RuntimeContainer { + runtime: self.runtime_builder.map(|f| f()), + }) + .init_non_send_resource::>() + .init_non_send_resource::>() + .insert_resource::>(CallbackSettings { + callback_handler: self.callback_handler, + }) + .insert_resource::>(ContextLoadingSettings { + loader: self.context_builder.clone(), + assigner: Some(self.context_assigner.clone().unwrap_or_default()), + context_initializers: vec![], + context_pre_handling_initializers: vec![], + }) + .add_systems(PostUpdate, (garbage_collector, sync_script_data::)) + .add_systems(PostStartup, initialize_runtime::); } } -pub trait GenDocumentation { - fn update_documentation(&mut self) -> &mut Self; +pub trait AddRuntimeInitializer { + fn add_runtime_initializer(&mut self, initializer: RuntimeInitializer) -> &mut Self; } -impl GenDocumentation for App { - /// Updates/Generates documentation and any other artifacts required for script API's. Disabled in optimized builds unless `doc_always` feature is enabled. - fn update_documentation(&mut self) -> &mut Self { - #[cfg(any(debug_assertions, feature = "doc_always"))] - { - info!("Generating documentation"); - let w = &mut self.world_mut(); - let providers: &APIProviders = w.resource(); - if let Err(e) = providers.gen_all() { - error!("{}", e); - } - info!("Documentation generated"); - } - +impl AddRuntimeInitializer for App { + fn add_runtime_initializer(&mut self, initializer: RuntimeInitializer) -> &mut Self { + self.world_mut().init_resource::>(); + self.world_mut() + .resource_mut::>() + .as_mut() + .initializers + .push(initializer); self } } -/// Trait for app builder notation -pub trait AddScriptHost { - /// registers the given script host with your app, - /// the given system set will contain systems handling script loading, re-loading, removal etc. - /// This system set will also send events related to the script lifecycle. - /// - /// Note: any systems which need to run the same frame a script is loaded must run after this set. - fn add_script_host(&mut self, schedule: impl ScheduleLabel) -> &mut Self; - - /// Similar to `add_script_host` but allows you to specify a system set to add the script host to. - fn add_script_host_to_set( +pub trait AddContextInitializer { + fn add_context_initializer( &mut self, - schedule: impl ScheduleLabel, - set: impl SystemSet, + initializer: ContextInitializer, ) -> &mut Self; } -impl AddScriptHost for App { - fn add_script_host_to_set( +impl AddContextInitializer for App { + fn add_context_initializer( &mut self, - schedule: impl ScheduleLabel, - set: impl SystemSet, - ) -> &mut Self - where - T: ScriptHost, - { - T::register_with_app_in_set(self, schedule, set); - self.init_resource::(); - self.add_event::(); - self - } - - fn add_script_host(&mut self, schedule: impl ScheduleLabel) -> &mut Self - where - T: ScriptHost, - { - T::register_with_app(self, schedule); - self.init_resource::(); - self.add_event::(); + initializer: ContextInitializer, + ) -> &mut Self { + self.world_mut() + .init_resource::>(); + self.world_mut() + .resource_mut::>() + .as_mut() + .context_initializers + .push(initializer); self } } -pub trait AddScriptApiProvider { - fn add_api_provider( +pub trait AddContextPreHandlingInitializer { + fn add_context_pre_handling_initializer( &mut self, - provider: Box< - dyn APIProvider< - APITarget = T::APITarget, - DocTarget = T::DocTarget, - ScriptContext = T::ScriptContext, - >, - >, + initializer: ContextPreHandlingInitializer, ) -> &mut Self; } -impl AddScriptApiProvider for App { - fn add_api_provider( +impl AddContextPreHandlingInitializer for App { + fn add_context_pre_handling_initializer( &mut self, - provider: Box< - dyn APIProvider< - APITarget = T::APITarget, - DocTarget = T::DocTarget, - ScriptContext = T::ScriptContext, - >, - >, + initializer: ContextPreHandlingInitializer, ) -> &mut Self { - provider.register_with_app(self); - let w = &mut self.world_mut(); - let providers: &mut APIProviders = &mut w.resource_mut(); - providers.providers.push(provider); + self.world_mut() + .resource_mut::>() + .as_mut() + .context_pre_handling_initializers + .push(initializer); self } } -pub trait AddScriptHostHandler { - /// Enables this script host to handle events with priorities in the range [0,min_prio] (inclusive), - /// during from within the given set. - /// - /// Note: this is identical to adding the script_event_handler system manually, so if you require more complex setup, you can use the following: - /// ```rust,ignore - /// self.add_systems( - /// MySchedule, - /// script_event_handler:: - /// ); - /// ``` - /// - /// Think of event handler systems as event sinks, which collect and "unpack" the instructions in each event every frame. - /// Because events are also prioritised, you can enforce a particular order of execution for your events (within each frame) - /// regardless of where they were fired from. - /// - /// A good example of this is Unity [game loop's](https://docs.unity3d.com/Manual/ExecutionOrder.html) `onUpdate` and `onFixedUpdate`. - /// FixedUpdate runs *before* any physics while Update runs after physics and input events. - /// - /// In this crate you can achieve this by using a separate system set before and after your physics, - /// then assigning event priorities such that your events are forced to run at the points you want them to, for example: - /// - /// PrePhysics priority range [0,1] - /// PostPhysics priority range [2,4] - /// - /// | Priority | Handler | Event | - /// | -------- | ----------- | ------------ | - /// | 0 | PrePhysics | Start 0 | - /// | 1 | PrePhysics | FixedUpdate 1 | - /// | 2 | PostPhysics | OnCollision 2 | - /// | 3 | PostPhysics | OnMouse 3 | - /// | 4 | PostPhysics | Update 4 | - /// - /// Note: in this example, if your FixedUpdate event is fired *after* the handler system set has run, it will be discarded (since other handlers discard events of higher priority). - fn add_script_handler( - &mut self, - schedule: impl ScheduleLabel, - ) -> &mut Self; - - /// The same as `add_script_handler` but allows you to specify a system set to add the handler to. - fn add_script_handler_to_set( - &mut self, - schedule: impl ScheduleLabel, - set: impl SystemSet, - ) -> &mut Self; +pub trait StoreDocumentation { + /// Adds a documentation fragment to the documentation store. + fn add_documentation_fragment(&mut self, fragment: D) -> &mut Self; + /// Consumes all the stored documentation fragments, and merges them into one, then generates the documentation. + fn generate_docs(&mut self) -> Result<(), Box>; } -impl AddScriptHostHandler for App { - fn add_script_handler_to_set( - &mut self, - schedule: impl ScheduleLabel, - set: impl SystemSet, - ) -> &mut Self { - self.add_systems(schedule, script_event_handler::.in_set(set)); +impl StoreDocumentation for App { + fn add_documentation_fragment(&mut self, fragment: D) -> &mut Self { + self.world_mut() + .init_non_send_resource::>(); + self.world_mut() + .non_send_resource_mut::>() + .as_mut() + .fragments + .push(fragment); self } - fn add_script_handler( - &mut self, - schedule: impl ScheduleLabel, - ) -> &mut Self { - self.add_systems(schedule, script_event_handler::); - self + fn generate_docs(&mut self) -> Result<(), Box> { + let mut docs = match self + .world_mut() + .remove_non_send_resource::>() + { + Some(docs) => docs, + None => return Ok(()), + }; + + let mut top_fragment = match docs.fragments.pop() { + Some(fragment) => fragment, + None => return Ok(()), + }; + + for fragment in docs.fragments.into_iter() { + top_fragment = top_fragment.merge(fragment); + } + + top_fragment.gen_docs() } } diff --git a/crates/bevy_mod_scripting_core/src/runtime.rs b/crates/bevy_mod_scripting_core/src/runtime.rs new file mode 100644 index 0000000000..6530829904 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/runtime.rs @@ -0,0 +1,36 @@ +//! "Runtime" here refers to the execution evironment of scripts. This might be the VM executing bytecode or the interpreter executing source code. +//! The important thing is that there is only one runtime which is used to execute all scripts of a particular type or `context`. + +use bevy::ecs::system::Resource; + +pub trait Runtime: 'static {} +impl Runtime for T {} + +pub type RuntimeInitializer = fn(&mut R); + +#[derive(Clone, Resource)] +pub struct RuntimeSettings { + pub initializers: Vec>, +} + +impl Default for RuntimeSettings { + fn default() -> Self { + Self { + initializers: Default::default(), + } + } +} + +/// Stores a particular runtime. +#[derive(Resource)] +pub struct RuntimeContainer { + pub runtime: Option, +} + +impl Default for RuntimeContainer { + fn default() -> Self { + Self { + runtime: Default::default(), + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/script.rs b/crates/bevy_mod_scripting_core/src/script.rs new file mode 100644 index 0000000000..4d39427b29 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/script.rs @@ -0,0 +1,42 @@ +//! Everything to do with the way scripts and their contexts are stored and handled. + +use std::{borrow::Cow, collections::HashMap, ops::Deref}; + +use bevy::{asset::Handle, ecs::system::Resource, reflect::Reflect}; + +use crate::{asset::ScriptAsset, context::ContextId}; + +pub type ScriptId = Cow<'static, str>; + +#[derive(bevy::ecs::component::Component, Reflect)] +pub struct ScriptComponent(pub Vec); + +impl Deref for ScriptComponent { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl ScriptComponent { + pub fn new(components: Vec) -> Self { + Self(components) + } +} + +/// All the scripts which are currently loaded or loading and their mapping to contexts +#[derive(Resource, Default, Clone)] +pub struct Scripts { + pub(crate) scripts: HashMap, +} + +/// A script +#[derive(Clone)] +pub struct Script { + pub id: ScriptId, + /// the asset holding the content of the script if it comes from an asset + pub asset: Option>, + /// The id of the context this script is currently assigned to + pub context_id: ContextId, +} diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index d7512a4174..78ea221327 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -1,233 +1,428 @@ -use std::collections::HashSet; - use bevy::{ecs::system::SystemState, prelude::*}; -use bevy_event_priority::PriorityEventReader; +use std::any::type_name; use crate::{ - event::ScriptLoaded, - prelude::{APIProviders, Script, ScriptCollection, ScriptContexts, ScriptData, ScriptHost}, - ScriptErrorEvent, + asset::{ScriptAsset, ScriptAssetSettings}, + bindings::ReflectAllocator, + commands::{CreateOrUpdateScript, DeleteScript}, + context::{Context, ContextLoadingSettings, ScriptContexts}, + event::{IntoCallbackLabel, ScriptCallbackEvent, ScriptErrorEvent}, + handler::{Args, CallbackSettings}, + prelude::RuntimeSettings, + runtime::{Runtime, RuntimeContainer}, + script::{ScriptComponent, Scripts}, }; -/// Labels for scripting related systems -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, SystemSet)] -pub enum ScriptSystemSet { - /// event handling systems are always marked with this label - EventHandling, +/// Cleans up dangling script allocations +pub fn garbage_collector(mut allocator: ResMut) { + allocator.clean_garbage_allocations() } -/// Handles creating contexts for new/modified scripts -/// Scripts are likely not loaded instantly at this point, so most of the time -/// this system simply inserts an empty context -pub fn script_add_synchronizer( - query: Query< - ( - Entity, - &ScriptCollection, - Ref>, - ), - Changed>, - >, - mut host: ResMut, - mut providers: ResMut>, - script_assets: Res>, - mut contexts: ResMut>, - mut event_writer: EventWriter, - mut error_writer: EventWriter, +pub fn initialize_runtime( + mut runtime: NonSendMut>, + settings: Res>, ) { - debug!("Handling addition/modification of scripts"); - - query.iter().for_each(|(entity, new_scripts, tracker)| { - if tracker.is_added() { - new_scripts.scripts.iter().for_each(|new_script| { - Script::::insert_new_script_context::( - &mut host, - new_script, - entity, - &script_assets, - &mut providers, - &mut contexts, - &mut event_writer, - &mut error_writer, - ) - }) - } else { - // changed but structure already exists in contexts - // find out what's changed - // we only care about added or removed scripts here - // if the script asset gets changed we deal with that elsewhere - - let context_ids = contexts - .context_entities - .iter() - .filter_map(|(sid, (e, _, _))| if *e == entity { Some(sid) } else { None }) - .cloned() - .collect::>(); - let script_ids = new_scripts - .scripts - .iter() - .map(|s| s.id()) - .collect::>(); + if let Some(r) = runtime.runtime.as_mut() { + for initializer in settings.initializers.iter() { + (initializer)(r); + } + }; +} - let removed_scripts = context_ids.difference(&script_ids); - let added_scripts = script_ids.difference(&context_ids); +/// Processes and reacts appropriately to script asset events, and queues commands to update the internal script state +pub fn sync_script_data( + mut events: EventReader>, + script_assets: Res>, + asset_settings: Res, + mut commands: Commands, +) { + for event in events.read() { + debug!("Responding to script asset event: {:?}", event); + let (id, remove) = match event { + // emitted when a new script asset is loaded for the first time + AssetEvent::Added { id } => (id, false), + AssetEvent::Modified { id } => (id, false), + AssetEvent::Removed { id } | AssetEvent::Unused { id } => (id, true), + _ => continue, + }; + // get the path + let asset = script_assets.get(*id); + let asset = asset.as_ref().expect("Asset was expected to be loaded!"); - for r in removed_scripts { - contexts.remove_context(*r); - } + let path = &asset.asset_path; + // convert it to script id + let converter = asset_settings.script_id_mapper.map; + let script_id = converter(path); - for a in added_scripts { - let script = new_scripts.scripts.iter().find(|e| &e.id() == a).unwrap(); - Script::::insert_new_script_context::( - &mut host, - script, - entity, - &script_assets, - &mut providers, - &mut contexts, - &mut event_writer, - &mut error_writer, - ) - } + if !remove { + commands.queue(CreateOrUpdateScript::::new( + script_id, + asset.content.clone(), + Some(script_assets.reserve_handle()), + )); + } else { + commands.queue(DeleteScript::::new(script_id)); } - }) + } } -/// Handles the removal of script components and their contexts -pub fn script_remove_synchronizer( - mut query: RemovedComponents>, - mut contexts: ResMut>, -) { - for v in query.read() { - // we know that this entity used to have a script component - // ergo a script context must exist in ctxts, remove all scripts on the entity - let script_ids = contexts - .context_entities - .iter() - .filter_map(|(script_id, (entity, ..))| { - (entity.index() == v.index()).then_some(*script_id) - }) - .collect::>(); - for script_id in script_ids { - contexts.remove_context(script_id); +macro_rules! push_err_and_continue { + ($errors:ident, $expr:expr) => { + match $expr { + Ok(v) => v, + Err(e) => { + $errors.push(e); + continue; + } } - } + }; } -/// Reloads hot-reloaded scripts, or loads missing contexts for scripts which were added but not loaded -pub fn script_hot_reload_handler( - mut events: EventReader>, - mut host: ResMut, - scripts: Query<&ScriptCollection>, - script_assets: Res>, - mut providers: ResMut>, - mut contexts: ResMut>, - mut event_writer: EventWriter, - mut error_writer: EventWriter, +/// Passes events with the specified label to the script callback with the same name and runs the callback +pub fn event_handler( + world: &mut World, + params: &mut SystemState<( + EventReader>, + Res>, + Res>, + Res, + Query<(Entity, Ref)>, + )>, ) { - for e in events.read() { - let (handle, created) = match e { - AssetEvent::Modified { id } => (id, false), - AssetEvent::Added { id } => (id, true), - _ => continue, - }; + debug!("Handling events with label `{}`", L::into_callback_label()); + + let mut runtime_container = world + .remove_non_send_resource::>() + .unwrap_or_else(|| { + panic!( + "No runtime container for runtime {} found", + type_name::() + ) + }); + let runtime = runtime_container.runtime.as_mut().unwrap_or_else(|| { + panic!( + "No valid runtime in runtime container for runtime {}", + type_name::() + ) + }); + let mut script_contexts = world + .remove_non_send_resource::>() + .unwrap_or_else(|| panic!("No script contexts found for context {}", type_name::())); - // find script using this handle by handle id - // whether this script was modified or created - // if a script exists with this handle, we should reload it to load in a new context - // which at this point will be either None or Some(outdated context) - // both ways are fine - for scripts in scripts.iter() { - for script in &scripts.scripts { - // the script could have well loaded in the same frame that it was added - // in that case it will have a context attached and we do not want to reload it - if script.handle().id() == *handle - && !(contexts.has_context(script.id()) && created) - { - Script::::reload_script::( - &mut host, - script, - &script_assets, - &mut providers, - &mut contexts, - &mut event_writer, - &mut error_writer, - ); + let (mut script_events, callback_settings, context_settings, scripts, entities) = + params.get_mut(world); + + let handler = *callback_settings + .callback_handler + .as_ref() + .unwrap_or_else(|| { + panic!( + "No handler registered for - Runtime: {}, Context: {}, Args: {}", + type_name::(), + type_name::(), + type_name::() + ) + }); + let pre_handling_initializers = context_settings.context_pre_handling_initializers.clone(); + let scripts = scripts.clone(); + let mut errors = Vec::default(); + + let events = script_events.read().cloned().collect::>(); + let entity_scripts = entities + .iter() + .map(|(e, s)| (e, s.0.clone())) + .collect::>(); + + for event in events + .into_iter() + .filter(|e| e.label == L::into_callback_label()) + { + for (entity, entity_scripts) in entity_scripts.iter() { + for script_id in entity_scripts.iter() { + match &event.recipients { + crate::event::Recipients::Script(target_script_id) + if target_script_id != script_id => + { + continue + } + crate::event::Recipients::Entity(target_entity) if target_entity != entity => { + continue + } + _ => (), } + debug!( + "Handling event for script {} on entity {:?}", + script_id, entity + ); + let script = match scripts.scripts.get(script_id) { + Some(s) => s, + None => { + info!( + "Script `{}` on entity `{:?}` is either still loading or doesn't exist, ignoring.", + script_id, entity + ); + continue; + } + }; + let ctxt = script_contexts + .contexts + .get_mut(&script.context_id) + .unwrap(); + + let handler_result = (handler)( + event.args.clone(), + *entity, + &script.id, + &L::into_callback_label(), + ctxt, + &pre_handling_initializers, + runtime, + world, + ); + + push_err_and_continue!(errors, handler_result) } } } + + world.insert_non_send_resource(runtime_container); + world.insert_non_send_resource(script_contexts); + + for error in errors { + let mut error_events = world + .get_resource_mut::>() + .expect("Missing events resource"); + + bevy::log::error!( + "Encountered error in event handling for - Runtime {}, Context: {}, Args: {}. {}", + type_name::(), + type_name::(), + type_name::(), + error.to_string() + ); + error_events.send(ScriptErrorEvent { error }); + } } -/// Lets the script host handle all script events -pub fn script_event_handler(world: &mut World) { - // we need to collect the events to drop the borrow of the world - let mut state: CachedScriptState = world.remove_resource().unwrap(); +#[cfg(test)] +mod test { + use std::{borrow::Cow, collections::HashMap}; - let events = state - .event_state - .get_mut(world) - .0 - .iter_prio_range(MAX, MIN) - .collect::>(); + use crate::{ + event::CallbackLabel, + handler::HandlerFn, + script::{Script, ScriptId}, + }; - world.insert_resource(state); + use super::*; + struct OnTestCallback; - // should help a lot with performance on frames where no events are fired - if events.is_empty() { - return; + impl IntoCallbackLabel for OnTestCallback { + fn into_callback_label() -> CallbackLabel { + "OnTest".into() + } } - let mut ctxts: ScriptContexts = world.remove_resource().unwrap(); - - let mut host: H = world.remove_resource().unwrap(); - let mut providers: APIProviders = world.remove_resource().unwrap(); - - // we need a resource scope to be able to simultaneously access the contexts as well - // as provide world access to scripts - // afaik there is not really a better way to do this in bevy just now - let ctx_iter = ctxts - .context_entities - .iter_mut() - .filter_map(|(sid, (entity, o, name))| { - let ctx = match o { - Some(v) => v, - None => return None, - }; - - Some(( - ScriptData { - sid: *sid, - entity: *entity, - name, - }, - ctx, - )) + struct TestRuntime { + pub invocations: Vec<(Entity, ScriptId)>, + } + + struct TestContext { + pub invocations: Vec, + } + + fn setup_app( + handler_fn: HandlerFn, + runtime: R, + contexts: HashMap, + scripts: HashMap, + ) -> App { + let mut app = App::new(); + + app.add_event::>(); + app.add_event::(); + app.insert_resource::>(CallbackSettings { + callback_handler: Some(handler_fn), + }); + app.add_systems(Update, event_handler::); + app.insert_resource::(Scripts { scripts }); + app.insert_non_send_resource::>(RuntimeContainer { + runtime: Some(runtime), }); + app.insert_non_send_resource::>(ScriptContexts { contexts }); + app + } - // safety: we have unique access to world, future accesses are protected - // by the lock in the pointer - host.handle_events(world, &events, ctx_iter, &mut providers); + #[test] + fn test_handler_called_with_right_args() { + let test_script_id = Cow::Borrowed("test_script"); + let test_ctxt_id = 0; + let test_script = Script { + id: test_script_id.clone(), + asset: None, + context_id: test_ctxt_id, + }; + let scripts = HashMap::from_iter(vec![(test_script_id.clone(), test_script.clone())]); + let contexts = HashMap::from_iter(vec![( + test_ctxt_id, + TestContext { + invocations: vec![], + }, + )]); + let runtime = TestRuntime { + invocations: vec![], + }; + let mut app = setup_app::( + |args, entity, script, _, ctxt, _, runtime, _| { + ctxt.invocations.push(args); + runtime.invocations.push((entity, script.clone())); + Ok(()) + }, + runtime, + contexts, + scripts, + ); + let test_entity_id = app + .world_mut() + .spawn(ScriptComponent(vec![test_script_id.clone()])) + .id(); - world.insert_resource(ctxts); - world.insert_resource(host); - world.insert_resource(providers); -} + app.world_mut() + .send_event(ScriptCallbackEvent::::new_for_all( + OnTestCallback::into_callback_label(), + "test_args".to_owned(), + )); + app.update(); -#[derive(Resource)] -/// system state for exclusive systems dealing with script events -pub struct CachedScriptState { - pub event_state: SystemState<( - PriorityEventReader<'static, 'static, H::ScriptEvent>, - EventWriter<'static, ScriptErrorEvent>, - EventReader<'static, 'static, ScriptLoaded>, - )>, -} + let test_context = app + .world() + .get_non_send_resource::>() + .unwrap(); + let test_runtime = app + .world() + .get_non_send_resource::>() + .unwrap(); -impl FromWorld for CachedScriptState { - fn from_world(world: &mut World) -> Self { - Self { - event_state: SystemState::new(world), - } + assert_eq!( + test_context + .contexts + .get(&test_ctxt_id) + .unwrap() + .invocations, + vec!["test_args"] + ); + + assert_eq!( + test_runtime + .runtime + .as_ref() + .unwrap() + .invocations + .iter() + .map(|(e, s)| (*e, s.clone())) + .collect::>(), + vec![(test_entity_id, test_script_id.clone())] + ); + } + + #[test] + fn test_handler_called_on_right_recipients() { + let test_script_id = Cow::Borrowed("test_script"); + let test_ctxt_id = 0; + let test_script = Script { + id: test_script_id.clone(), + asset: None, + context_id: test_ctxt_id, + }; + let scripts = HashMap::from_iter(vec![ + (test_script_id.clone(), test_script.clone()), + ( + "wrong".into(), + Script { + id: "wrong".into(), + asset: None, + context_id: 1, + }, + ), + ]); + let contexts = HashMap::from_iter(vec![ + ( + test_ctxt_id, + TestContext { + invocations: vec![], + }, + ), + ( + 1, + TestContext { + invocations: vec![], + }, + ), + ]); + let runtime = TestRuntime { + invocations: vec![], + }; + let mut app = setup_app::( + |args, entity, script, _, ctxt, _, runtime, _| { + ctxt.invocations.push(args); + runtime.invocations.push((entity, script.clone())); + Ok(()) + }, + runtime, + contexts, + scripts, + ); + let test_entity_id = app + .world_mut() + .spawn(ScriptComponent(vec![test_script_id.clone()])) + .id(); + + app.world_mut() + .send_event(ScriptCallbackEvent::::new( + OnTestCallback::into_callback_label(), + "test_args_script".to_owned(), + crate::event::Recipients::Script(test_script_id.clone()), + )); + + app.world_mut() + .send_event(ScriptCallbackEvent::::new( + OnTestCallback::into_callback_label(), + "test_args_entity".to_owned(), + crate::event::Recipients::Entity(test_entity_id), + )); + app.update(); + + let test_context = app + .world() + .get_non_send_resource::>() + .unwrap(); + let test_runtime = app + .world() + .get_non_send_resource::>() + .unwrap(); + + assert_eq!( + test_context + .contexts + .get(&test_ctxt_id) + .unwrap() + .invocations, + vec!["test_args_script", "test_args_entity"] + ); + + assert_eq!( + test_runtime + .runtime + .as_ref() + .unwrap() + .invocations + .iter() + .map(|(e, s)| (*e, s.clone())) + .collect::>(), + vec![ + (test_entity_id, test_script_id.clone()), + (test_entity_id, test_script_id.clone()) + ] + ); } } From 1eb98b44664d7e50480e84f6775722c6676f653f Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 10 Nov 2024 17:47:47 +0000 Subject: [PATCH 008/217] bring over bevy api gen work --- crates/bevy_api_gen/Cargo.bootstrap.toml | 2 +- crates/bevy_api_gen/Cargo.toml | 7 +- crates/bevy_api_gen/readme.md | 14 +- crates/bevy_api_gen/src/args.rs | 7 +- crates/bevy_api_gen/src/bin/main.rs | 1 + crates/bevy_api_gen/src/callback.rs | 1 + crates/bevy_api_gen/src/context.rs | 16 +- crates/bevy_api_gen/src/import_path.rs | 2 +- crates/bevy_api_gen/src/lib.rs | 5 +- crates/bevy_api_gen/src/meta.rs | 24 +- .../bevy_api_gen/src/modifying_file_loader.rs | 10 +- .../bevy_api_gen/src/passes/cache_traits.rs | 11 +- crates/bevy_api_gen/src/passes/codegen.rs | 1 + .../src/passes/find_methods_and_fields.rs | 23 +- .../src/passes/find_reflect_types.rs | 3 +- .../src/passes/find_trait_impls.rs | 1 + .../src/passes/populate_template_data.rs | 344 +- crates/bevy_api_gen/src/plugin.rs | 4 +- crates/bevy_api_gen/src/template.rs | 9 +- crates/bevy_api_gen/templates/field.tera | 6 +- crates/bevy_api_gen/templates/footer.tera | 81 +- crates/bevy_api_gen/templates/function.tera | 24 +- crates/bevy_api_gen/templates/header.tera | 11 +- crates/bevy_api_gen/templates/item.tera | 20 +- crates/bevy_api_gen/templates/macros.tera | 56 +- crates/bevy_api_gen/templates/mod.tera | 62 +- .../src/bindings/mod.rs | 3 + .../src/bindings/providers/bevy_a11y.rs | 69 + .../src/bindings/providers/bevy_core.rs | 95 + .../src/bindings/providers/bevy_ecs.rs | 547 + .../src/bindings/providers/bevy_hierarchy.rs | 161 + .../src/bindings/providers/bevy_input.rs | 1846 ++ .../src/bindings/providers/bevy_math.rs | 5532 ++++ .../src/bindings/providers/bevy_reflect.rs | 22743 ++++++++++++++++ .../src/bindings/providers/bevy_time.rs | 736 + .../src/bindings/providers/bevy_transform.rs | 819 + .../src/bindings/providers/bevy_window.rs | 1879 ++ .../src/bindings/providers/mod.rs | 88 + .../bevy_mod_scripting_lua/src/lib.rs | 390 +- makefile | 6 +- 40 files changed, 35200 insertions(+), 459 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs diff --git a/crates/bevy_api_gen/Cargo.bootstrap.toml b/crates/bevy_api_gen/Cargo.bootstrap.toml index 74afa48681..b7557099fc 100644 --- a/crates/bevy_api_gen/Cargo.bootstrap.toml +++ b/crates/bevy_api_gen/Cargo.bootstrap.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] mlua = { version = "0.9.2", features = ["lua54", "vendored", "send", "macros"] } -bevy_reflect = { version = "0.14", features = [ +bevy_reflect = { version = "0.15.0-rc.3", features = [ "bevy", "glam", "petgraph", diff --git a/crates/bevy_api_gen/Cargo.toml b/crates/bevy_api_gen/Cargo.toml index 501fca03d5..9e4ecd7c98 100644 --- a/crates/bevy_api_gen/Cargo.toml +++ b/crates/bevy_api_gen/Cargo.toml @@ -36,15 +36,12 @@ source = "discover" [package.metadata.rust-analyzer] rustc_private = true -[rust-analyzer.check] -overrideCommand = ["cargo", "+nightly-2024-11-05", "a", "--message-format=json"] - [dependencies] -log = "0.4" -env_logger = "0.11" rustc_plugin = { git = "https://github.com/makspll/rustc_plugin", branch = "feature/rust-1.82.0" } indexmap = "2" +log = "0.4" +env_logger = "0.11" tempdir = "0.3" cargo_metadata = "0.18" serde_json = "1" diff --git a/crates/bevy_api_gen/readme.md b/crates/bevy_api_gen/readme.md index 93f556bb94..0831b6fc9b 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-11-05 install bevy_api_gen +cargo +nightly-2024-01-24 install bevy_api_gen ``` # Usage @@ -18,17 +18,17 @@ cargo +nightly-2024-11-05 install bevy_api_gen To run the main codegen process, use the following command: ```bash -cargo +nightly-2024-11-05 bevy-api-gen generate +cargo +nightly-2024-01-24 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-11-05/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-01-24/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-11-05 bevy-api-gen collect +cargo +nightly-2024-01-24 bevy-api-gen collect ``` ## List Types @@ -36,7 +36,7 @@ cargo +nightly-2024-11-05 bevy-api-gen collect To see a list of all `Reflect` implementing types in your workspace run: ```bash -cargo +nightly-2024-11-05 bevy-api-gen list-types > all_types.txt +cargo +nightly-2024-01-24 bevy-api-gen list-types > all_types.txt ``` ## List Templates @@ -44,7 +44,7 @@ cargo +nightly-2024-11-05 bevy-api-gen list-types > all_types.txt To see the list of all templates which you can override use: ```bash -cargo +nightly-2024-11-05 bevy-api-gen list-templates +cargo +nightly-2024-01-24 bevy-api-gen list-templates ``` ## Print Template @@ -52,5 +52,5 @@ cargo +nightly-2024-11-05 bevy-api-gen list-templates You can also print any of the templates to stdout: ```bash -cargo +nightly-2024-11-05 bevy-api-gen print item.tera +cargo +nightly-2024-01-24 bevy-api-gen print item.tera ``` \ No newline at end of file diff --git a/crates/bevy_api_gen/src/args.rs b/crates/bevy_api_gen/src/args.rs index 848d0a9335..63898dc098 100644 --- a/crates/bevy_api_gen/src/args.rs +++ b/crates/bevy_api_gen/src/args.rs @@ -189,7 +189,12 @@ pub enum Command { /// The name of the API, this will be passed to the `collect.rs` template, which by default will be used as the APIProvider name and the /// title of the documentation. - #[arg(short, long, value_name = "NAME", default_value = "LuaBevyAPIProvider")] + #[arg( + short, + long, + value_name = "NAME", + default_value = "LuaBevyScriptingPlugin" + )] api_name: String, }, } diff --git a/crates/bevy_api_gen/src/bin/main.rs b/crates/bevy_api_gen/src/bin/main.rs index 658afed6a0..56ced9d33e 100644 --- a/crates/bevy_api_gen/src/bin/main.rs +++ b/crates/bevy_api_gen/src/bin/main.rs @@ -1,4 +1,5 @@ #![feature(rustc_private)] + use std::{ collections::HashMap, env, diff --git a/crates/bevy_api_gen/src/callback.rs b/crates/bevy_api_gen/src/callback.rs index a762ed766d..71f0a9f91a 100644 --- a/crates/bevy_api_gen/src/callback.rs +++ b/crates/bevy_api_gen/src/callback.rs @@ -87,6 +87,7 @@ impl rustc_driver::Callbacks for BevyAnalyzerCallbacks { if !continue_ { break; } + trace!("Finished pass, continuing"); } }); rustc_driver::Compilation::Continue diff --git a/crates/bevy_api_gen/src/context.rs b/crates/bevy_api_gen/src/context.rs index 498a958c42..83ed871bbb 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)] @@ -152,7 +152,7 @@ pub(crate) struct FunctionContext { pub(crate) def_id: DefId, pub(crate) has_self: bool, pub(crate) is_unsafe: bool, - pub(crate) trait_did: Option, + pub(crate) trait_and_impl_did: Option<(DefId, DefId)>, /// strategies for input and output (last element is the output) pub(crate) reflection_strategies: Vec, } diff --git a/crates/bevy_api_gen/src/import_path.rs b/crates/bevy_api_gen/src/import_path.rs index 2f26fd1276..c8f5522685 100644 --- a/crates/bevy_api_gen/src/import_path.rs +++ b/crates/bevy_api_gen/src/import_path.rs @@ -27,7 +27,7 @@ impl std::fmt::Debug for ImportPathElement { /// Because we do not need ALL the items in the crate, we start searching from the item itself and traverse up the tree. /// Caches results for already found items. pub(crate) struct ImportPathFinder<'tcx> { - tcx: TyCtxt<'tcx>, + pub(crate) tcx: TyCtxt<'tcx>, pub(crate) cache: IndexMap>>, pub(crate) include_private_paths: bool, pub(crate) import_path_processor: Option String>>, diff --git a/crates/bevy_api_gen/src/lib.rs b/crates/bevy_api_gen/src/lib.rs index 23d294032e..3388d68b0b 100644 --- a/crates/bevy_api_gen/src/lib.rs +++ b/crates/bevy_api_gen/src/lib.rs @@ -1,13 +1,16 @@ #![feature(rustc_private, let_chains)] #![deny(rustc::internal)] - extern crate rustc_ast; +extern crate rustc_const_eval; 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 a9861da384..029c438cb3 100644 --- a/crates/bevy_api_gen/src/meta.rs +++ b/crates/bevy_api_gen/src/meta.rs @@ -66,6 +66,28 @@ impl MetaLoader { self.meta_for_retry(crate_name, 3) } + /// Searches the given meta sources in order for the provided DefPathHash, once a meta file containing this hash is found + /// the search stops and returns true, if no meta file is found containing the hash, false is returned + /// + /// if a curr_source argument is provided, the search will skip this source as it is assumed that the current crate is still being compiled and not meta file for it exists yet + pub fn one_of_meta_files_contains( + &self, + meta_sources: &[&str], + curr_source: Option<&str>, + target_def_path_hash: DefPathHash, + ) -> bool { + let meta = match meta_sources + .iter() + .filter(|s| curr_source.is_none() || curr_source.is_some_and(|cs| cs == **s)) + .find_map(|s| self.meta_for(s)) + { + Some(meta) => meta, + None => return false, // TODO: is it possible we get false negatives here ? perhaps due to parallel compilation ? or possibly because of dependency order + }; + + meta.contains_def_path_hash(target_def_path_hash) + } + fn meta_for_retry(&self, crate_name: &str, _try_attempts: usize) -> Option { let meta = self .meta_dirs @@ -94,7 +116,7 @@ impl MetaLoader { let cache = self.cache.borrow(); if cache.contains_key(crate_name) { trace!("Loading meta from cache for: {}", crate_name); - cache.get(crate_name).cloned() + return 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 7fab22dd3b..5458080dd1 100644 --- a/crates/bevy_api_gen/src/modifying_file_loader.rs +++ b/crates/bevy_api_gen/src/modifying_file_loader.rs @@ -1,11 +1,12 @@ use std::{ io, - sync::atomic::{AtomicBool, Ordering}, + sync::{ + atomic::{AtomicBool, Ordering}, + Arc, + }, }; use log::trace; -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) @@ -41,7 +42,6 @@ impl FileLoader for ModifyingFileLoader { } } } - f }) } else { @@ -49,7 +49,7 @@ impl FileLoader for ModifyingFileLoader { } } - fn read_binary_file(&self, path: &std::path::Path) -> io::Result> { + fn read_binary_file(&self, path: &std::path::Path) -> io::Result> { RealFileLoader.read_binary_file(path) } } diff --git a/crates/bevy_api_gen/src/passes/cache_traits.rs b/crates/bevy_api_gen/src/passes/cache_traits.rs index 12e2972bfe..bdbd956815 100644 --- a/crates/bevy_api_gen/src/passes/cache_traits.rs +++ b/crates/bevy_api_gen/src/passes/cache_traits.rs @@ -66,12 +66,11 @@ pub(crate) fn cache_traits(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> bool { .join(", ") ); - // 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) - // ) + 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/codegen.rs b/crates/bevy_api_gen/src/passes/codegen.rs index 6a2a1a6812..cd2e9ccdc5 100644 --- a/crates/bevy_api_gen/src/passes/codegen.rs +++ b/crates/bevy_api_gen/src/passes/codegen.rs @@ -37,6 +37,7 @@ pub(crate) fn codegen(ctxt: &mut BevyCtxt<'_>, args: &Args) -> bool { .expect("Failed to render crate artifact"); file.flush().unwrap(); + log::trace!("Written files"); 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 8034681a41..170744c7a1 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 @@ -206,7 +206,7 @@ pub(crate) fn find_methods_and_fields(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> is_unsafe, def_id: fn_did, has_self, - trait_did, + trait_and_impl_did: trait_did.map(|td| (td, *impl_did)), reflection_strategies, }) }) @@ -332,6 +332,7 @@ fn type_is_adt_and_reflectable<'tcx>( ty.ty_adt_def().is_some_and(|adt_def| { let did = adt_def.did(); + // even though our meta might already be written at this point, we use this as a quick out if reflect_types.contains_key(&did) { // local types are easy to check return true; @@ -344,24 +345,18 @@ fn type_is_adt_and_reflectable<'tcx>( // so search for these metas! let crate_name = tcx.crate_name(did.krate).to_ident_string(); - let meta_sources = if tcx.crate_name(LOCAL_CRATE).as_str() == "bevy_reflect" { - // otherwise meta loader might expect the meta to exist - vec![crate_name] - } else { - vec![crate_name, "bevy_reflect".to_string()] - }; - - let meta = match meta_sources.iter().find_map(|s| meta_loader.meta_for(s)) { - Some(meta) => meta, - None => return false, // TODO: is it possible we get false negatives here ? perhaps due to parallel compilation ? or possibly because of dependency order - }; + let contains_hash = meta_loader.one_of_meta_files_contains( + &[&crate_name, "bevy_reflect"], + Some(&tcx.crate_name(LOCAL_CRATE).to_ident_string()), + tcx.def_path_hash(did), + ); - let contains_hash = meta.contains_def_path_hash(tcx.def_path_hash(did)); log::trace!( "Meta for type: `{}`, contained in meta `{}`", tcx.item_name(did), contains_hash ); + contains_hash }) } @@ -391,7 +386,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_none_or(|rn| rn.as_str() != "'static") { + if !region.get_name().is_some_and(|rn| rn.as_str() == "'static") { return false; } } diff --git a/crates/bevy_api_gen/src/passes/find_reflect_types.rs b/crates/bevy_api_gen/src/passes/find_reflect_types.rs index f808922c94..22096759ef 100644 --- a/crates/bevy_api_gen/src/passes/find_reflect_types.rs +++ b/crates/bevy_api_gen/src/passes/find_reflect_types.rs @@ -45,8 +45,7 @@ pub(crate) fn find_reflect_types(ctxt: &mut BevyCtxt<'_>, args: &Args) -> bool { generics.count() == 0 && self_ty.def().is_some_and(|did| { let short_form = format!("{}::{}",ctxt.tcx.crate_name(LOCAL_CRATE),ctxt.tcx.item_name(did)); - if ignored_types.contains(&short_form) || ignored_types.contains(&tcx.def_path_str(did)) { - info!("Ignoring type: {:?}", tcx.def_path_str(did)); + if ignored_types.contains(&short_form) || ignored_types.contains(&tcx.def_path_str(did)) { info!("Ignoring type: {:?}", tcx.def_path_str(did)); return false; }; let adt_generics = tcx.generics_of(did); 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 9541869012..ba542ab9e4 100644 --- a/crates/bevy_api_gen/src/passes/find_trait_impls.rs +++ b/crates/bevy_api_gen/src/passes/find_trait_impls.rs @@ -136,6 +136,7 @@ fn impl_matches<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>, impl_def_id: DefId) let ocx = ObligationCtxt::new(infcx); let param_env = tcx.param_env_reveal_all_normalized(impl_def_id); let impl_args = infcx.fresh_args_for_item(DUMMY_SP, impl_def_id); + let impl_trait_ref = tcx .impl_trait_ref(impl_def_id) .expect("Expected defid to be an impl for a trait") diff --git a/crates/bevy_api_gen/src/passes/populate_template_data.rs b/crates/bevy_api_gen/src/passes/populate_template_data.rs index e5aff8e684..0254ee73b7 100644 --- a/crates/bevy_api_gen/src/passes/populate_template_data.rs +++ b/crates/bevy_api_gen/src/passes/populate_template_data.rs @@ -1,9 +1,12 @@ -use std::fmt::Write; +use std::{any::Any, borrow::Cow, convert::identity}; -use log::trace; +use log::{trace, warn}; use rustc_ast::Attribute; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; -use rustc_middle::ty::{FieldDef, ParamTy, Ty, TyKind, TypeFoldable}; +use rustc_middle::ty::{ + print::Print, AdtDef, FieldDef, GenericArg, GenericParamDefKind, ParamTy, TraitRef, Ty, TyKind, + TypeFoldable, +}; use rustc_span::Symbol; use crate::{ @@ -126,7 +129,7 @@ pub(crate) fn process_fields<'f, I: Iterator>( .map(|field| Field { docstrings: docstrings(ctxt.tcx.get_attrs_unchecked(field.did)), ident: field.name.to_ident_string(), - ty: ty_to_string(ctxt, ctxt.tcx.type_of(field.did).skip_binder()), + ty: ty_to_string(ctxt, ctxt.tcx.type_of(field.did).skip_binder(), false), reflection_strategy: *ty_ctxt .get_field_reflection_strat(field.did) .unwrap_or_else(|| panic!("{ty_ctxt:#?}")), @@ -145,52 +148,25 @@ pub(crate) fn process_functions(ctxt: &BevyCtxt, fns: &[FunctionContext]) -> Vec .zip(fn_sig.inputs()) .enumerate() .map(|(idx, (ident, ty))| { - let (ident, ty) = if fn_ctxt.has_self && idx == 0 { - // self argument, we want to map to something like `&self` instead of `&Component` - // we do that by renaming every adt inside to "self" - // this is a bit hacky but it works, might not work if we decide to support generics in the future - // TODO: fix to work with generics - let ty = ty.fold_with(&mut rustc_middle::ty::fold::BottomUpFolder { - tcx: ctxt.tcx, - ty_op: |ty| { - if ty.is_adt() { - ctxt.tcx.mk_ty_from_kind(TyKind::Param(ParamTy::new( - 0, - Symbol::intern("self"), - ))) - } else { - ty - } - }, - lt_op: |lt| lt, - ct_op: |ct| ct, - }); - (None, ty) - } else { - (ident.to_string().into(), *ty) - }; - // remove projections like `::AssocType` - let ty = ty_to_string( - ctxt, - ctxt.tcx - .normalize_erasing_regions(ctxt.tcx.param_env(fn_ctxt.def_id), ty), - ); + let normalized_ty = ctxt + .tcx + .normalize_erasing_regions(ctxt.tcx.param_env(fn_ctxt.def_id), *ty); Arg { - ident, - ty, + ident: ident.to_string(), + ty: ty_to_string(ctxt, normalized_ty, false), + proxy_ty: ty_to_string(ctxt, normalized_ty, true), reflection_strategy: fn_ctxt.reflection_strategies[idx], } }) .collect(); - let ty = ty_to_string( - ctxt, - ctxt.tcx - .normalize_erasing_regions(ctxt.tcx.param_env(fn_ctxt.def_id), fn_sig.output()), - ); + let out_ty = ctxt + .tcx + .normalize_erasing_regions(ctxt.tcx.param_env(fn_ctxt.def_id), fn_sig.output()); let output = Output { - ty, + ty: ty_to_string(ctxt, out_ty, false), + proxy_ty: ty_to_string(ctxt, out_ty, true), reflection_strategy: *fn_ctxt.reflection_strategies.last().unwrap(), }; @@ -203,9 +179,11 @@ pub(crate) fn process_functions(ctxt: &BevyCtxt, fns: &[FunctionContext]) -> Vec output, has_self: fn_ctxt.has_self, docstrings: docstrings(ctxt.tcx.get_attrs_unchecked(fn_ctxt.def_id)), - from_trait_path: fn_ctxt - .trait_did - .map(|trait_did| import_path(ctxt, trait_did)), + from_trait_path: fn_ctxt.trait_and_impl_did.map(|(_, impl_did)| { + let trait_ref = ctxt.tcx.impl_trait_ref(impl_did).unwrap().skip_binder(); + + trait_ref_to_string(ctxt, trait_ref) + }), } }) .collect() @@ -236,51 +214,271 @@ pub(crate) fn import_path(ctxt: &BevyCtxt, def_id: DefId) -> String { } /// Normalizes type import paths in types before printing them -fn ty_to_string<'tcx>(ctxt: &BevyCtxt<'tcx>, ty: Ty<'tcx>) -> String { +fn ty_to_string<'tcx>(ctxt: &BevyCtxt<'tcx>, ty: Ty<'tcx>, proxy_types: bool) -> String { // walk through the type and replace all paths with their standardised import paths - TyPrinter::new().print(&ctxt.path_finder, ty) + TyPrinter::new( + Box::new(|ty| { + ty.ty_adt_def() + .map(|def| { + let def_id = def.did(); + let def_path_hash = ctxt.tcx.def_path_hash(def_id); + let meta_sources = [ + &ctxt.tcx.crate_name(def_id.krate).to_ident_string(), + "bevy_reflect", + ]; + + ctxt.meta_loader.one_of_meta_files_contains( + &meta_sources, + Some(&ctxt.tcx.crate_name(LOCAL_CRATE).to_ident_string()), + def_path_hash, + ) + }) + .is_some_and(identity) + }), + Box::new(|did| Cow::Owned(import_path(ctxt, did))), + proxy_types, + ) + .print(ty) } -struct TyPrinter { +/// Converts a specific trait instantiation (in the context of an impl) into a string taking into account correctly the +/// import transformations and generics +/// TODO: this doesn't explicitly print out associated types, because I don't think it's necessary yet and annoying to do (idk how to do it) +fn trait_ref_to_string<'tcx>(ctxt: &BevyCtxt<'tcx>, trait_ref: TraitRef<'tcx>) -> String { + let generics_def = ctxt.tcx.generics_of(trait_ref.def_id); + + let generic_args = trait_ref + .args + .iter() + .enumerate() + .skip(if generics_def.has_self { 1 } else { 0 }) + .map(|(idx, a)| (a, generics_def.param_at(idx, ctxt.tcx))) + // filter out non const | type generics and the compiler generated ones + .filter(|(_, arg_def)| match arg_def.kind { + GenericParamDefKind::Lifetime => false, + GenericParamDefKind::Const { synthetic, .. } => !synthetic, + _ => true, + }) + .map(|(arg, arg_def)| { + log::trace!("Printing for trait: `{trait_ref}` arg: `{arg}`, with def: `{arg_def:#?}`"); + + let arg_ty = if let Some(ty) = arg.as_type() { + ty + } else if arg.as_const().is_some() { + arg.as_type().unwrap() + } else { + unreachable!("should be filtered") + }; + + ty_to_string(ctxt, arg_ty, false) + }) + .collect::>(); + + let trait_path = import_path(ctxt, trait_ref.def_id); + + if generic_args.is_empty() { + trait_path + } else { + format!("{trait_path}::<{}>", generic_args.join(", ")) + } +} + +#[derive(Clone, Copy)] +pub(crate) enum ProxyType { + Ref, + RefMut, + Val, + NonReflectVal, +} + +impl ProxyType { + pub fn to_ident_str(self) -> &'static str { + match self { + ProxyType::Ref => "LuaReflectRefProxy", + ProxyType::RefMut => "LuaReflectRefMutProxy", + ProxyType::Val => "LuaReflectValProxy", + ProxyType::NonReflectVal => "LuaValProxy", + } + } +} +/// Pretty prints types fully using the given import path finder or ADT's +struct TyPrinter<'a> { buffer: String, + path_finder: Box Cow<'static, str> + 'a>, + is_proxied_check: Box) -> bool + 'a>, + /// If true will wrap types in appropriate proxies instead of directly pringting the type + proxy_types: bool, } -impl TyPrinter { - pub fn new() -> Self { +impl<'a> TyPrinter<'a> { + pub fn new( + is_proxied_check: Box) -> bool + 'a>, + path_finder: Box Cow<'static, str> + 'a>, + proxy_types: bool, + ) -> Self { TyPrinter { buffer: String::new(), + is_proxied_check, + proxy_types, + path_finder, } } - pub fn print(mut self, path_finder: &ImportPathFinder, ty: Ty<'_>) -> String { - self.build_str(path_finder, ty); + + pub fn print(mut self, ty: Ty<'_>) -> String { + log::trace!("Printing type: {:#?}", ty); + self.print_ty(ty); self.buffer } - fn build_str(&mut self, path_finder: &ImportPathFinder, ty: Ty<'_>) { + fn print_args<'tcx, I: Iterator>>(&mut self, mut args: I) { + let mut next = args.next(); + if next.is_some() { + self.buffer.push('<'); + while let Some(arg) = next { + let ty = if let Some(ty) = arg.as_type() { + ty + } else if arg.as_const().is_some() { + arg.as_type().unwrap() + } else { + next = args.next(); + continue; + }; + self.print_ty(ty); + + next = args.next(); + if next.is_some() { + self.buffer.push_str(", "); + } + } + + self.buffer.push('>'); + } + } + + fn print_adt<'tcx, I: Iterator>>(&mut self, ty: AdtDef<'tcx>, args: I) { + log::trace!("Printing ADT: {:#?}", ty); + let did = ty.did(); + let import_path = (self.path_finder)(did); + self.buffer.push_str(&import_path); + self.print_args(args); + } + + fn print_ty(&mut self, ty: Ty<'_>) { + log::trace!("Printing type: {:#?}", ty); + match ty.kind() { - TyKind::Adt(adt_def, args) => { - let did = adt_def.did(); - let import_path = path_finder - .find_import_paths(did) - .first() - .unwrap() - .to_owned(); - self.buffer.push_str(&import_path); - if args.len() > 0 { - self.buffer.push('<'); - for (idx, a) in args.iter().enumerate() { - match a.as_type() { - Some(ty) => self.build_str(path_finder, ty), - None => _ = self.buffer.write_str(&a.to_string()), - } - if idx != args.len() - 1 { - self.buffer.push_str(", "); - } + TyKind::Bool => self.print_literal("bool"), + TyKind::Char => self.print_literal("char"), + TyKind::Str => self.print_literal("str"), + TyKind::Int(ty) => self.print_literal(ty.name_str()), + TyKind::Uint(ty) => self.print_literal(ty.name_str()), + TyKind::Float(ty) => self.print_literal(ty.name_str()), + TyKind::Adt(adt_ty, args) => { + if self.proxy_types { + self.print_proxied_ty(ty, ProxyType::Val); + } else { + self.print_adt(*adt_ty, args.iter()); + } + } + TyKind::Array(ty, const_) => { + self.buffer.push('['); + self.print_ty(*ty); + self.buffer.push(';'); + // shortcut, we won't encounter ADT's here just use native printer + self.buffer.push_str(&const_.to_string()); + self.buffer.push(']'); + } + TyKind::Slice(ty) => { + self.buffer.push('['); + self.print_ty(*ty); + self.buffer.push(']'); + } + TyKind::RawPtr(ptr, mutability) => { + self.buffer.push('*'); + if mutability.is_mut() { + self.buffer.push_str("mut "); + } + self.print_ty(*ptr); + } + TyKind::Ref(_, ty, mut_) => { + if self.proxy_types { + let proxy_type = if mut_.is_mut() { + ProxyType::RefMut + } else { + ProxyType::Ref + }; + self.print_proxied_ty(*ty, proxy_type); + } else { + self.buffer.push('&'); + if mut_.is_mut() { + self.buffer.push_str("mut "); + } + self.print_ty(*ty); + } + } + TyKind::Tuple(tys) => { + self.buffer.push('('); + for (idx, ty) in tys.iter().enumerate() { + self.print_ty(ty); + if idx != tys.len() - 1 { + self.buffer.push(','); } - self.buffer.push('>'); } + self.buffer.push(')'); + } + TyKind::Alias(_, ty) => { + self.buffer.push_str(&(self.path_finder)(ty.def_id)); + self.print_args(ty.args.iter()); + } + // self is one I think + TyKind::Param(param) => self.print_literal(param.name.as_str()), + _ => { + warn!( + "Type outside the scope of the TyPrinter being printed: pretty=`{}` kind=`{:?}`", + ty, ty.kind() + ); + self.buffer.push_str(&ty.to_string()) } - _ => self.buffer.push_str(&ty.to_string()), } } + + /// prints a type but without making further proxies at this level + /// i.e. a &T will be printed as RefProxy instead of RefProxy> since the T will not be printed via print_ty but directly here + /// But only for ADT's, other types are printed as normal + fn print_proxied_ty(&mut self, ty: Ty<'_>, proxy_type: ProxyType) { + match ty.kind() { + TyKind::Adt(adt_ty, args) => { + if (self.is_proxied_check)(ty) { + self.print_literal_surround_content( + proxy_type.to_ident_str(), + '<', + '>', + |self_| { + self_.print_adt(*adt_ty, args.iter()); + }, + ); + } else { + self.print_adt(*adt_ty, args.iter()) + } + } + _ => self.print_ty(ty), + } + } + + fn print_literal_surround_content( + &mut self, + literal: &str, + start: char, + end: char, + f: F, + ) { + self.buffer.push_str(literal); + self.buffer.push(start); + f(self); + self.buffer.push(end); + } + + fn print_literal(&mut self, literal: &str) { + self.buffer.push_str(literal); + } } diff --git a/crates/bevy_api_gen/src/plugin.rs b/crates/bevy_api_gen/src/plugin.rs index b365458ee9..1e0d73a245 100644 --- a/crates/bevy_api_gen/src/plugin.rs +++ b/crates/bevy_api_gen/src/plugin.rs @@ -53,7 +53,9 @@ impl RustcPlugin for BevyAnalyzer { let mut callbacks = BevyAnalyzerCallbacks::new(plugin_args); let mut compiler = rustc_driver::RunCompiler::new(&compiler_args, &mut callbacks); compiler.set_file_loader(Some(Box::new(ModifyingFileLoader))); - compiler.run() + let out = compiler.run(); + log::trace!("Finished compiling with plugin"); + out } fn modify_cargo(&self, cmd: &mut std::process::Command, args: &Self::Args) { diff --git a/crates/bevy_api_gen/src/template.rs b/crates/bevy_api_gen/src/template.rs index e9219d0013..ddb9d02960 100644 --- a/crates/bevy_api_gen/src/template.rs +++ b/crates/bevy_api_gen/src/template.rs @@ -111,17 +111,21 @@ pub(crate) struct Function { pub(crate) struct Arg { /// the name of the argument as in source code /// None if this is a receiver, in which case ty contains the ident - pub(crate) ident: Option, + pub(crate) ident: String, /// the type of argument /// i.e. `&Vec` pub(crate) ty: String, + /// The proxied type of argument for use in Unproxy and Proxy targetted code + /// i.e. AppropriateRefProxy instead of &MyTy for a reference + pub(crate) proxy_ty: String, pub(crate) reflection_strategy: ReflectionStrategy, } #[derive(Serialize)] pub(crate) struct Output { pub(crate) ty: String, + pub(crate) proxy_ty: String, pub(crate) reflection_strategy: ReflectionStrategy, } @@ -195,8 +199,9 @@ 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())) - .inspect_err(|_| { + .map_err(|e| { log::error!("prettyplease error on input: ```\n{}\n```", str); + e })?; let out = prettyplease::unparse(&file); diff --git a/crates/bevy_api_gen/templates/field.tera b/crates/bevy_api_gen/templates/field.tera index bf9baae508..ea5fb1450a 100644 --- a/crates/bevy_api_gen/templates/field.tera +++ b/crates/bevy_api_gen/templates/field.tera @@ -1,6 +1,4 @@ -{%- if field.reflection_strategy == "Proxy" -%} - #[lua(output(proxy))] -{%- elif field.reflection_strategy == "Filtered" -%} +{%- if field.reflection_strategy == "Filtered" -%} #[lua(skip)] {%- endif -%} @@ -10,6 +8,6 @@ {% if field.reflection_strategy != "Reflection" -%} {{- field.ty -}} {%- else -%} -ReflectedValue +ReflectReference {%- endif -%} , diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index b14a4794a1..87a76308e2 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -1,70 +1,53 @@ +{% if args.self_is_bms_lua %} +{% set bms_lua_path="crate" %} +{% else %} +{% set bms_lua_path="bevy_mod_scripting::lua"%} +{% endif %} + #[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>>( +impl {{bms_lua_path}}::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: {{bms_lua_path}}::tealr::mlu::InstanceCollector<'lua>>( self, instances: &mut T, - ) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<()> { + ) -> {{bms_lua_path}}::tealr::mlu::mlua::Result<()> { {% for item in items %} {% if item.has_static_methods %} instances.add_instance("{{ item.ident }}", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::<{{item.ident | prefix_lua}}>::new)?; + {{bms_lua_path}}::tealr::mlu::UserDataProxy::<{{item.ident | prefix_lua}}>::new)?; {% endif %} {% endfor %} Ok(()) } } -pub struct {{ "A P I Provider" | prefix_cratename | convert_case(case="upper_camel")}}; - -impl bevy_mod_scripting_core::hosts::APIProvider for {{ "A P I Provider" | prefix_cratename | convert_case(case="upper_camel") }} { - 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("{{ "A P I" | prefix_cratename | convert_case(case="upper_camel") }}", |tw| { - tw - .document_global_instance::().expect("Something went wrong documenting globals") - {% for item in items %} - .process_type::<{{ item.ident | prefix_lua }}>() - {% if item.has_static_methods %} - .process_type::>() - {% endif %} - {% endfor %} - } - )) - } - 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 {{ "ContextInitializer" | prefix_cratename | convert_case(case="snake") }} (_: &bevy_mod_scripting_core::script::ScriptId, ctx: &mut {{bms_lua_path}}::prelude::Lua) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + {{bms_lua_path}}::tealr::mlu::set_global_env(Globals, ctx)?; + 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(()) - } +pub struct {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}}; - fn register_with_app(&self, app: &mut bevy::app::App) { +impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}} { + fn build(&self, app: &mut bevy::prelude::App) { {% for item in items %} - app.register_foreign_lua_type::<{{ item.import_path }}>(); + app.register_proxy::<{{ item.import_path }}>(); {% endfor %} + app.add_context_initializer::<()>({{ "ContextInitializer" | prefix_cratename | convert_case(case="snake") }}); + app.add_documentation_fragment( + {{bms_lua_path}}::docs::LuaDocumentationFragment::new("{{ "A P I" | prefix_cratename | convert_case(case="upper_camel") }}", |tw| { + tw + .document_global_instance::().expect("Something went wrong documenting globals") + {% for item in items %} + .process_type::<{{ item.ident | prefix_lua }}>() + {% if item.has_static_methods %} + .process_type::<{{bms_lua_path}}::tealr::mlu::UserDataProxy<{{ item.ident | prefix_lua }}>>() + {% endif %} + {% endfor %} + } + ) + ); } } \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/function.tera b/crates/bevy_api_gen/templates/function.tera index a525af9bd4..970eebdfcc 100644 --- a/crates/bevy_api_gen/templates/function.tera +++ b/crates/bevy_api_gen/templates/function.tera @@ -13,6 +13,11 @@ r#" as_trait="{{ function.from_trait_path }}", {%- endif -%} +{% if is_op %} +composite="{{ function.ident }}", +{% endif %} + +{# {% if function.has_self and not is_op %} kind="{% if function.args.0.ty is starting_with("&mut") %}Mutating{% endif %}Method", {% elif is_op %} @@ -25,9 +30,7 @@ kind="Function", output(proxy), {%- endif -%} -{% if is_op %} -composite="{{ function.ident }}", -{% endif %} + {% if function.from_trait_path == "std::ops::Neg" %} metamethod="Unm", @@ -44,23 +47,22 @@ metamethod="Mod", {% elif function.from_trait_path == "std::cmp::PartialEq" %} metamethod="Eq", {% endif %} - +#} )] {% if function.is_unsafe %}unsafe {% endif -%}fn {{ function.ident }} ( {%- filter separated(delimeter=", ", split_at="---", ignore_first=true) -%} {%- for arg in function.args -%} --- - {%- if arg.ident and arg.reflection_strategy == "Proxy" -%} - #[proxy] - {%- endif -%} - {%- if arg.ident -%} - {{- arg.ident }} : {# -#} + {%- if arg.ident != "self" -%} + {{- arg.ident -}} + {%- else -%} + _{{- arg.ident -}} {%- endif -%} - {{- arg.ty -}} + : {{- arg.proxy_ty -}} {%- endfor -%} {%- endfilter -%} -) -> {{ function.output.ty -}}; +) -> {{ function.output.proxy_ty -}}; {%- endfilter %} "# \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index e40a725a12..2cdbb5745e 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -8,8 +8,11 @@ use super::{{crate}}::*; {% endif %} {% endfor %} -{% if args.self_is_bevy_script_api %} -extern crate self as bevy_script_api; -{% endif %} -use bevy_script_api::{lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld}; \ No newline at end of file +use bevy_mod_scripting_core::{AddContextInitializer, StoreDocumentation, bindings::ReflectReference}; + +{% if args.self_is_bms_lua %} +use crate::{bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,IdentityProxy},RegisterLuaProxy, tealr::mlu::mlua::IntoLua}; +{% else %} +use bevy_mod_scripting::{lua::bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,IdentityProxy}, RegisterLuaProxy, tealr::mlu::mlua::IntoLua}; +{% endif %} \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/item.tera b/crates/bevy_api_gen/templates/item.tera index 3a8a8bfacb..43bb345ec7 100644 --- a/crates/bevy_api_gen/templates/item.tera +++ b/crates/bevy_api_gen/templates/item.tera @@ -3,14 +3,20 @@ {# for now #} {% endfor %} +{% if args.self_is_bms_lua %} +{% set bms_core_path="bevy_mod_scripting_core" %} +{% set bms_lua_path="crate" %} +{% else %} +{% set bms_core_path="bevy_mod_scripting::core" %} +{% set bms_lua_path="bevy_mod_scripting::lua" %} +{% endif %} + #[derive(bevy_mod_scripting_lua_derive::LuaProxy)] #[proxy( -derive( - {%- if item.impls_clone -%} - clone, - {%- endif -%} -), remote="{{ item.import_path }}", +bms_core_path="{{bms_core_path}}", +bms_lua_path="{{bms_lua_path}}", + functions[ {%- filter separated(delimeter=",\n\t\t\t", split_at="---", ignore_first=true) -%} {%- for function in item.functions -%} @@ -61,7 +67,7 @@ functions[ r#" {%- set mat_type = item.import_path | split(pat="::") | last -%} {%- set col_type = mat_type | replace(from="Mat", to="Vec")-%} - {{- macros::matrix_index(col_type=col_type,mat_type=mat_type)-}} + {{- macros::matrix_index(col_type=col_type,mat_type=mat_type,bms_core_path=bms_core_path)-}} "# {% endif %} {%- endfilter -%} @@ -76,7 +82,7 @@ functions[ {% set close_item = "}" %} {% endif %} -struct {{ item.ident -}} {{ open_item }} +pub struct {{ item.ident -}} {{ open_item }} {% if not item.is_enum %} {% for field in item.variants[0].fields %} {% if field.reflection_strategy != "Filtered" %} diff --git a/crates/bevy_api_gen/templates/macros.tera b/crates/bevy_api_gen/templates/macros.tera index 4e75fc50bd..ef5b578334 100644 --- a/crates/bevy_api_gen/templates/macros.tera +++ b/crates/bevy_api_gen/templates/macros.tera @@ -1,51 +1,47 @@ {% macro vector_index(num_type) %} -#[lua(kind="MetaMethod", raw , metamethod="Index")] -fn index(&self, lua: &Lua, idx: crate::lua::util::LuaIndex) -> Result<{{ num_type }},_> { - Ok(self.inner()?[*idx]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> IdentityProxy<{{ num_type }}> { + _self[idx - 1] } {% endmacro vector_index %} {% macro vector_newindex(num_type) %} -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: {{ num_type }}) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: {{ num_type }}) -> () { + _self[idx - 1] = val } {% endmacro vector_newindex %} -{% macro matrix_index(col_type, mat_type) %} -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result<{{ col_type | prefix_lua }},_> { - Ok({{ col_type | prefix_lua }}::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +{% macro matrix_index(col_type, mat_type, bms_core_path) %} +#[lua(metamethod="Index")] +fn index(_self: IdentityProxy, idx: usize) -> IdentityProxy<{{ col_type | prefix_lua }}> { + let mut curr_ref = _self.0.clone(); + let def_ref = {{bms_core_path}}::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push({{bms_core_path}}::bindings::ReflectionPathElem::new_deferred(def_ref)); + {{ col_type | prefix_lua }}(curr_ref) } {% endmacro matrix_index %} {% macro debug_as_to_string() %} -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } {% endmacro debug_as_to_string %} {% macro display_as_to_string() %} -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{}", _self) } diff --git a/crates/bevy_api_gen/templates/mod.tera b/crates/bevy_api_gen/templates/mod.tera index 186b98ace2..44530bb555 100644 --- a/crates/bevy_api_gen/templates/mod.tera +++ b/crates/bevy_api_gen/templates/mod.tera @@ -4,69 +4,17 @@ #![cfg_attr(rustfmt, rustfmt_skip)] {% filter prettyplease %} {%- for crate in crates %} - pub mod {{ crate.name }}; + pub(crate) mod {{ crate.name }}; {% endfor -%} -{% if args.self_is_bevy_script_api %} -extern crate self as bevy_script_api; -{% endif %} - -use bevy_mod_scripting_core::docs::DocFragment; - - pub struct {{ api_name }}; -impl bevy_mod_scripting_core::hosts::APIProvider for {{ api_name }} { - 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> { +impl bevy::app::Plugin for {{ api_name }} { + fn build(&self, app: &mut bevy::prelude::App) { {% for crate in crates %} - {% set crate_name = crate.name %} - {{ crate_name }}::{{ "A P I Provider" | prefix(val=crate_name) | convert_case(case="upper_camel")}}.attach_api(ctx)?; - {% endfor %} - Ok(()) - } - - fn get_doc_fragment(&self) -> Option { - [ - {% for crate in crates %} - {% set crate_name = crate.name %} - {{ crate_name }}::{{ "A P I Provider" | prefix(val=crate_name) | convert_case(case="upper_camel")}}.get_doc_fragment(), - {% endfor %} - ] - .into_iter() - .filter_map(|a: Option<_>| a) - .fold(None, |a, b| match a { - Some(a) => Some(a.merge(b)), - None => Some(b), - }) - } - - 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) { - {% for crate in crates %} - {% set crate_name = crate.name %} - {{ crate_name }}::{{ "A P I Provider" | prefix(val=crate_name) | convert_case(case="upper_camel")}}.register_with_app(app); + {% set crate_name = crate.name %} + {{ crate_name }}::{{ "ScriptingPlugin" | prefix(val=crate_name) | convert_case(case="upper_camel")}}.build(app); {% endfor %} } } - {% endfilter %} \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs new file mode 100644 index 0000000000..384af4032b --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs @@ -0,0 +1,3 @@ +use bevy_mod_scripting_core::bindings::WorldCallbackAccess; + +pub mod providers; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs new file mode 100644 index 0000000000..b6ef3788e4 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs new file mode 100644 index 0000000000..f205ff73bd --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs @@ -0,0 +1,95 @@ +// @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(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &name::Name) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{}", _self) +} +"#] +)] +struct Name {} +#[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 BevyCoreAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyCoreAPIProvider { + 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( + "BevyCoreAPI", + |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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs new file mode 100644 index 0000000000..8f3b5d4e27 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs @@ -0,0 +1,547 @@ +// @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_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(clone), + remote = "bevy::ecs::entity::Entity", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::entity::Entity; + +"#, + r#" +/// Creates a new entity ID with the specified `index` and a generation of 1. +/// # Note +/// Spawning a specific `entity` value is __rarely the right choice__. Most apps should favor +/// [`Commands::spawn`](crate::system::Commands::spawn). This method should generally +/// only be used for sharing entities across apps, and only when they have a scheme +/// worked out to share an index space (which doesn't happen by default). +/// In general, one should not try to synchronize the ECS by attempting to ensure that +/// `Entity` lines up between instances, but instead insert a secondary identifier as +/// a component. + + #[lua(kind = "Function", output(proxy))] + fn from_raw(index: u32) -> bevy::ecs::entity::Entity; + +"#, + r#" +/// Convert to a form convenient for passing outside of rust. +/// Only useful for identifying entities within the same instance of an application. Do not use +/// for serialization between runs. +/// No particular structure is guaranteed for the returned bits. + + #[lua(kind = "Method")] + fn to_bits(self) -> u64; + +"#, + r#" +/// Reconstruct an `Entity` previously destructured with [`Entity::to_bits`]. +/// Only useful when applied to results from `to_bits` in the same instance of an application. +/// # Panics +/// This method will likely panic if given `u64` values that did not come from [`Entity::to_bits`]. + + #[lua(kind = "Function", output(proxy))] + fn from_bits(bits: u64) -> bevy::ecs::entity::Entity; + +"#, + r#" +/// Return a transiently unique identifier. +/// No two simultaneously-live entities share the same index, but dead entities' indices may collide +/// with both live and dead entities. Useful for compactly representing entities within a +/// specific snapshot of the world, such as when serializing. + + #[lua(kind = "Method")] + fn index(self) -> u32; + +"#, + r#" +/// Returns the generation of this Entity's index. The generation is incremented each time an +/// entity with a given index is despawned. This serves as a "count" of the number of times a +/// given index has been reused (index, generation) pairs uniquely identify a given Entity. + + #[lua(kind = "Method")] + fn generation(self) -> u32; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &entity::Entity) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Entity {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[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[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[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#" + + #[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. + + #[lua(kind = "Function", output(proxy))] + fn new(index: usize) -> bevy::ecs::component::ComponentId; + +"#, + r#" +/// Returns the index of the current component. + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ComponentId(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::ecs::component::Tick", + 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: &component::Tick) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::component::Tick; + +"#, + r#" +/// Creates a new [`Tick`] wrapping the given value. + + #[lua(kind = "Function", output(proxy))] + fn new(tick: u32) -> bevy::ecs::component::Tick; + +"#, + r#" +/// Gets the value of this change tick. + + #[lua(kind = "Method")] + fn get(self) -> u32; + +"#, + r#" +/// Sets the value of this change tick. + + #[lua(kind = "MutatingMethod")] + fn set(&mut self, tick: u32) -> (); + +"#, + r#" +/// Returns `true` if this `Tick` occurred since the system's `last_run`. +/// `this_run` is the current tick of the system, used as a reference to help deal with wraparound. + + #[lua(kind = "Method")] + fn is_newer_than( + self, + #[proxy] + last_run: bevy::ecs::component::Tick, + #[proxy] + this_run: bevy::ecs::component::Tick, + ) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Tick {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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). + + #[lua(kind = "Method")] + fn is_added( + &self, + #[proxy] + last_run: bevy::ecs::component::Tick, + #[proxy] + this_run: bevy::ecs::component::Tick, + ) -> bool; + +"#, + r#" +/// Returns `true` if the component or resource was added or mutably dereferenced after the system last ran +/// (or the system is running for the first time). + + #[lua(kind = "Method")] + fn is_changed( + &self, + #[proxy] + last_run: bevy::ecs::component::Tick, + #[proxy] + this_run: bevy::ecs::component::Tick, + ) -> bool; + +"#, + r#" +/// Returns the tick recording the time this component or resource was most recently 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; + +"#, + r#" +/// Manually sets the change tick. +/// This is normally done automatically via the [`DerefMut`](std::ops::DerefMut) implementation +/// on [`Mut`](crate::change_detection::Mut), [`ResMut`](crate::change_detection::ResMut), etc. +/// However, components and resources that make use of interior mutability might require manual updates. +/// # Example +/// ```no_run +/// # use bevy_ecs::{world::World, component::ComponentTicks}; +/// let world: World = unimplemented!(); +/// let component_ticks: ComponentTicks = unimplemented!(); +/// component_ticks.set_changed(world.read_change_tick()); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn set_changed(&mut self, #[proxy] change_tick: bevy::ecs::component::Tick) -> (); + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ComponentTicks {} +#[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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &identifier::Identifier) -> bool; + +"#, + r#" +/// Returns the value of the low segment of the [`Identifier`]. + + #[lua(kind = "Method")] + fn low(self) -> u32; + +"#, + r#" +/// Returns the masked value of the high segment of the [`Identifier`]. +/// Does not include the flag bits. + + #[lua(kind = "Method")] + fn masked_high(self) -> u32; + +"#, + r#" +/// Convert the [`Identifier`] into a `u64`. + + #[lua(kind = "Method")] + fn to_bits(self) -> u64; + +"#, + r#" +/// Convert a `u64` into an [`Identifier`]. +/// # Panics +/// This method will likely panic if given `u64` values that did not come from [`Identifier::to_bits`]. + + #[lua(kind = "Function", output(proxy))] + fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Identifier {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::ecs::entity::EntityHash", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::ecs::entity::EntityHash; + +"#] +)] +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 { + 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( + "Entity", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "ComponentId", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Tick", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Identifier", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + Ok(()) + } +} +pub struct BevyEcsAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { + 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( + "BevyEcsAPI", + |tw| { + 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::() + .process_type::() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaComponentId, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaIdentifier, + >, + >() + .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::(); + app.register_foreign_lua_type::< + bevy::ecs::removal_detection::RemovedComponentEntity, + >(); + app.register_foreign_lua_type::(); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs new file mode 100644 index 0000000000..2cb1efa99e --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs @@ -0,0 +1,161 @@ +// @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::*; +use super::bevy_core::*; +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::hierarchy::prelude::Children", + functions[r#" +/// Swaps the child at `a_index` with the child at `b_index`. + + #[lua(kind = "MutatingMethod")] + fn swap(&mut self, a_index: usize, b_index: usize) -> (); + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Children(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(), + 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", + 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(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#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &events::HierarchyEvent) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::hierarchy::HierarchyEvent; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct HierarchyEvent {} +#[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 BevyHierarchyAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider { + 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( + "BevyHierarchyAPI", + |tw| { + tw.document_global_instance::() + .expect("Something went wrong documenting globals") + .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::(); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs new file mode 100644 index 0000000000..f13ae2f8ef --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs @@ -0,0 +1,1846 @@ +// @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::*; +use super::bevy_core::*; +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(), + remote = "bevy::input::gamepad::Gamepad", + functions[r#" +/// Returns the left stick as a [`Vec2`] + + #[lua(kind = "Method", output(proxy))] + fn left_stick(&self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the right stick as a [`Vec2`] + + #[lua(kind = "Method", output(proxy))] + fn right_stick(&self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the directional pad as a [`Vec2`] + + #[lua(kind = "Method", output(proxy))] + fn dpad(&self) -> bevy::math::Vec2; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +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::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadAxis; + +"#, + 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 GamepadAxis {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::GamepadButton", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButton; + +"#, + 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::GamepadButton) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadButton {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::GamepadSettings", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadSettings; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +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), + 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; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::keyboard::KeyCode; + +"#, + 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 KeyCode {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &mouse::MouseButton) -> 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 MouseButton {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::touch::TouchInput", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::touch::TouchInput; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &touch::TouchInput) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct TouchInput { + #[lua(output(proxy))] + phase: bevy::input::touch::TouchPhase, + #[lua(output(proxy))] + position: bevy::math::Vec2, + #[lua(output(proxy))] + window: bevy::ecs::entity::Entity, + force: ReflectedValue, + id: u64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::keyboard::KeyboardFocusLost", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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#" + + #[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 KeyboardFocusLost {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::keyboard::KeyboardInput", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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#" + + #[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 KeyboardInput { + #[lua(output(proxy))] + key_code: bevy::input::keyboard::KeyCode, + #[lua(output(proxy))] + 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::AccumulatedMouseMotion", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +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::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::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: &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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct MouseButtonInput { + #[lua(output(proxy))] + button: bevy::input::mouse::MouseButton, + #[lua(output(proxy))] + state: bevy::input::ButtonState, + #[lua(output(proxy))] + window: bevy::ecs::entity::Entity, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::mouse::MouseMotion", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &mouse::MouseMotion) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseMotion; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct MouseMotion { + #[lua(output(proxy))] + delta: bevy::math::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::mouse::MouseWheel", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::mouse::MouseWheel; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &mouse::MouseWheel) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct MouseWheel { + #[lua(output(proxy))] + unit: bevy::input::mouse::MouseScrollUnit, + x: f32, + y: f32, + #[lua(output(proxy))] + window: bevy::ecs::entity::Entity, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + 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#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadAxisChangedEvent { + #[lua(output(proxy))] + entity: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + axis: bevy::input::gamepad::GamepadAxis, + value: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new( + #[proxy] + entity: bevy::ecs::entity::Entity, + #[proxy] + button: bevy::input::gamepad::GamepadButton, + #[proxy] + state: bevy::input::ButtonState, + value: f32, + ) -> bevy::input::gamepad::GamepadButtonChangedEvent; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadButtonChangedEvent { + #[lua(output(proxy))] + entity: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + button: bevy::input::gamepad::GamepadButton, + #[lua(output(proxy))] + state: bevy::input::ButtonState, + value: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::GamepadButtonStateChangedEvent", + functions[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; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; + +"#, + 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::GamepadButtonStateChangedEvent) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadButtonStateChangedEvent { + #[lua(output(proxy))] + entity: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + button: bevy::input::gamepad::GamepadButton, + #[lua(output(proxy))] + state: bevy::input::ButtonState, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::GamepadConnection", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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#" + + #[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))] + fn new( + #[proxy] + gamepad: bevy::ecs::entity::Entity, + #[proxy] + connection: bevy::input::gamepad::GamepadConnection, + ) -> bevy::input::gamepad::GamepadConnectionEvent; + +"#, + r#" +/// Is the gamepad connected? + + #[lua(kind = "Method")] + fn connected(&self) -> bool; + +"#, + r#" +/// Is the gamepad disconnected? + + #[lua(kind = "Method")] + fn disconnected(&self) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GamepadConnectionEvent { + #[lua(output(proxy))] + gamepad: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + connection: bevy::input::gamepad::GamepadConnection, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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::GamepadInput", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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#" + + #[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 GamepadInput {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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`]. + + #[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 RawGamepadAxisChangedEvent { + #[lua(output(proxy))] + gamepad: bevy::ecs::entity::Entity, + #[lua(output(proxy))] + 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#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::RawGamepadButtonChangedEvent) -> bool; + +"#, + 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(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RawGamepadButtonChangedEvent { + #[lua(output(proxy))] + 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::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RawGamepadEvent {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gestures::PinchGesture", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct PinchGesture(f32); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gestures::RotationGesture", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RotationGesture(f32); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gestures::DoubleTapGesture", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct DoubleTapGesture {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gestures::PanGesture) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::ButtonState", + functions[r#" + + #[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#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ButtonState {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::ButtonSettings", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::ButtonSettings) -> bool; + +"#, + 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. + + #[lua(kind = "Method")] + fn is_pressed(&self, value: f32) -> bool; + +"#, + r#" +/// Returns `true` if the button is released. +/// A button is considered released if the `value` passed is lower than or equal to the release threshold. + + #[lua(kind = "Method")] + fn is_released(&self, value: f32) -> bool; + +"#, + r#" +/// Get the button input threshold above which the button is considered pressed. + + #[lua(kind = "Method")] + fn press_threshold(&self) -> f32; + +"#, + r#" +/// Try to set the button input threshold above which the button is considered pressed. +/// If the value passed is outside the range [release threshold..=1.0], the value will not be changed. +/// Returns the new value of the press threshold. + + #[lua(kind = "MutatingMethod")] + fn set_press_threshold(&mut self, value: f32) -> f32; + +"#, + r#" +/// Get the button input threshold below which the button is considered released. + + #[lua(kind = "Method")] + fn release_threshold(&self) -> f32; + +"#, + r#" +/// Try to set the button input threshold below which the button is considered released. If the +/// value passed is outside the range [0.0..=press threshold], the value will not be changed. +/// Returns the new value of the release threshold. + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ButtonSettings {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::AxisSettings", + functions[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. + + #[lua(kind = "Method")] + fn livezone_upperbound(&self) -> f32; + +"#, + r#" +/// Try to set the value above which inputs will be rounded up to 1.0. +/// If the value passed is negative or less than `deadzone_upperbound`, +/// the value will not be changed. +/// Returns the new value of `livezone_upperbound`. + + #[lua(kind = "MutatingMethod")] + fn set_livezone_upperbound(&mut self, value: f32) -> f32; + +"#, + r#" +/// Get the value below which positive inputs will be rounded down to 0.0. + + #[lua(kind = "Method")] + fn deadzone_upperbound(&self) -> f32; + +"#, + r#" +/// Try to set the value below which positive inputs will be rounded down to 0.0. +/// If the value passed is negative or greater than `livezone_upperbound`, +/// the value will not be changed. +/// Returns the new value of `deadzone_upperbound`. + + #[lua(kind = "MutatingMethod")] + fn set_deadzone_upperbound(&mut self, value: f32) -> f32; + +"#, + r#" +/// Get the value below which negative inputs will be rounded down to -1.0. + + #[lua(kind = "Method")] + fn livezone_lowerbound(&self) -> f32; + +"#, + r#" +/// Try to set the value below which negative inputs will be rounded down to -1.0. +/// If the value passed is positive or greater than `deadzone_lowerbound`, +/// the value will not be changed. +/// Returns the new value of `livezone_lowerbound`. + + #[lua(kind = "MutatingMethod")] + fn set_livezone_lowerbound(&mut self, value: f32) -> f32; + +"#, + r#" +/// Get the value above which inputs will be rounded up to 0.0. + + #[lua(kind = "Method")] + fn deadzone_lowerbound(&self) -> f32; + +"#, + r#" +/// Try to set the value above which inputs will be rounded up to 0.0. +/// If the value passed is less than -1.0 or less than `livezone_lowerbound`, +/// the value will not be changed. +/// Returns the new value of `deadzone_lowerbound`. + + #[lua(kind = "MutatingMethod")] + fn set_deadzone_lowerbound(&mut self, value: f32) -> f32; + +"#, + r#" +/// Get the minimum value by which input must change before the change is registered. + + #[lua(kind = "Method")] + fn threshold(&self) -> f32; + +"#, + r#" +/// Try to set the minimum value by which input must change before the changes will be applied. +/// If the value passed is not within [0.0..=2.0], the value will not be changed. +/// Returns the new value of threshold. + + #[lua(kind = "MutatingMethod")] + fn set_threshold(&mut self, value: f32) -> f32; + +"#, + r#" +/// Clamps the `raw_value` according to the `AxisSettings`. + + #[lua(kind = "Method")] + fn clamp(&self, new_value: f32) -> f32; + +"#, + r#" +/// Filters the `new_value` based on the `old_value`, according to the [`AxisSettings`]. +/// Returns the clamped `new_value` if the change exceeds the settings threshold, +/// and `None` otherwise. + + #[lua(kind = "Method")] + fn filter( + &self, + new_value: f32, + old_value: std::option::Option, + ) -> std::option::Option; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AxisSettings {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::input::gamepad::ButtonAxisSettings", + functions[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. + + #[lua(kind = "Method")] + fn filter( + &self, + new_value: f32, + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ButtonAxisSettings { + high: f32, + low: f32, + threshold: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &gamepad::GamepadRumbleIntensity) -> bool; + +"#, + 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; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &keyboard::Key) -> 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 Key {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &keyboard::NativeKeyCode) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct NativeKeyCode {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + r#" + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct NativeKey {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &mouse::MouseScrollUnit) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct MouseScrollUnit {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::input::touch::TouchPhase; + +"#, + 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 TouchPhase {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &touch::ForceTouch) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ForceTouch {} +#[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( + "GamepadAxisChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadAxisChangedEvent, + >::new, + )?; + instances + .add_instance( + "GamepadButtonChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadButtonChangedEvent, + >::new, + )?; + instances + .add_instance( + "GamepadButtonStateChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadButtonStateChangedEvent, + >::new, + )?; + instances + .add_instance( + "GamepadConnectionEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadConnectionEvent, + >::new, + )?; + instances + .add_instance( + "RawGamepadAxisChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaRawGamepadAxisChangedEvent, + >::new, + )?; + instances + .add_instance( + "RawGamepadButtonChangedEvent", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaRawGamepadButtonChangedEvent, + >::new, + )?; + instances + .add_instance( + "GamepadRumbleIntensity", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGamepadRumbleIntensity, + >::new, + )?; + Ok(()) + } +} +pub struct BevyInputAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { + 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( + "BevyInputAPI", + |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::() + .process_type::() + .process_type::() + .process_type::() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaGamepadAxisChangedEvent, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaGamepadButtonChangedEvent, + >, + >() + .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< + LuaGamepadConnectionEvent, + >, + >() + .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::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaGamepadRumbleIntensity, + >, + >() + .process_type::() + .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::(); + 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::GamepadButtonChangedEvent, + >(); + 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::< + 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::(); + app.register_foreign_lua_type::(); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs new file mode 100644 index 0000000000..822cdb30a3 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs @@ -0,0 +1,5532 @@ +// @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_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(clone), + 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; + +"#, + 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(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::AspectRatio; + +"#, + 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", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::CompassOctant; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct CompassOctant {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::CompassQuadrant", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &compass::CompassQuadrant) -> bool; + +"#, + r#" + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct CompassQuadrant {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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::Isometry2d) -> bevy::math::Isometry2d; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Isometry2d; + +"#, + r#" +/// Create a two-dimensional isometry from a rotation and a translation. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + translation: bevy::math::prelude::Vec2, + #[proxy] + rotation: bevy::math::Rot2, + ) -> bevy::math::Isometry2d; + +"#, + r#" +/// Create a two-dimensional isometry from a rotation. + + #[lua(kind = "Function", output(proxy))] + 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::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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +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::Isometry3d", + functions[r#" +/// Create a three-dimensional isometry from a rotation. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation( + #[proxy] + rotation: bevy::math::prelude::Quat, + ) -> bevy::math::Isometry3d; + +"#, + r#" +/// 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 inverse(&self) -> bevy::math::Isometry3d; + +"#, + 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::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#" + + #[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::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::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; + +"#, + 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")] +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::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))] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Ray2d { + #[lua(output(proxy))] + origin: bevy::math::prelude::Vec2, + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Ray3d", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::Ray3d; + +"#, + r#" +/// Create a new `Ray3d` from a given origin and direction + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + origin: bevy::math::prelude::Vec3, + #[proxy] + direction: bevy::math::prelude::Dir3, + ) -> bevy::math::Ray3d; + +"#, + 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::Vec3; + +"#, + 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::Vec3, + #[proxy] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Ray3d { + #[lua(output(proxy))] + origin: bevy::math::prelude::Vec3, + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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`]. + + #[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::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. +/// # 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; + +"#, + 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. +/// The rotation is only valid if `sin * sin + cos * cos == 1.0`. +/// # Panics +/// Panics if `sin * sin + cos * cos != 1.0` when the `glam_assert` feature is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_sin_cos(sin: f32, cos: f32) -> bevy::math::Rot2; + +"#, + r#" +/// Returns the rotation in radians in the `(-pi, pi]` range. + + #[lua(kind = "Method")] + fn as_radians(self) -> f32; + +"#, + r#" +/// Returns the rotation in degrees in the `(-180, 180]` range. + + #[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. + + #[lua(kind = "Method")] + fn sin_cos(self) -> (f32, f32); + +"#, + r#" +/// Computes the length or norm of the complex number used to represent the rotation. +/// The length is typically expected to be `1.0`. Unexpectedly denormalized rotations +/// can be a result of incorrect construction or floating point error caused by +/// successive operations. + + #[lua(kind = "Method")] + fn length(self) -> f32; + +"#, + r#" +/// Computes the squared length or norm of the complex number used to represent the rotation. +/// This is generally faster than [`Rot2::length()`], as it avoids a square +/// root operation. +/// The length is typically expected to be `1.0`. Unexpectedly denormalized rotations +/// can be a result of incorrect construction or floating point error caused by +/// successive operations. + + #[lua(kind = "Method")] + fn length_squared(self) -> f32; + +"#, + r#" +/// Computes `1.0 / self.length()`. +/// For valid results, `self` must _not_ have a length of zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f32; + +"#, + r#" +/// Returns `self` with a length of `1.0`. +/// Note that [`Rot2`] should typically already be normalized by design. +/// Manual normalization is only needed when successive operations result in +/// accumulated floating point error, or if the rotation was constructed +/// with invalid values. +/// # Panics +/// Panics if `self` has a length of zero, NaN, or infinity when debug assertions are enabled. + + #[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. + + #[lua(kind = "Method")] + fn is_finite(self) -> bool; + +"#, + r#" +/// Returns `true` if the rotation is NaN. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + r#" +/// Returns whether `self` has a length of `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns `true` if the rotation is near [`Rot2::IDENTITY`]. + + #[lua(kind = "Method")] + fn is_near_identity(self) -> bool; + +"#, + r#" +/// Returns the angle in radians needed to make `self` and `other` coincide. + + #[lua(kind = "Method")] + fn angle_between(self, #[proxy] other: bevy::math::Rot2) -> f32; + +"#, + r#" +/// Returns the inverse of the rotation. This is also the conjugate +/// of the unit complex number representing the rotation. + + #[lua(kind = "Method", output(proxy))] + fn inverse(self) -> bevy::math::Rot2; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` based on +/// the value `s`, and normalizes the rotation afterwards. +/// When `s == 0.0`, the result will be equal to `self`. +/// When `s == 1.0`, the result will be equal to `rhs`. +/// This is slightly more efficient than [`slerp`](Self::slerp), and produces a similar result +/// when the difference between the two rotations is small. At larger differences, +/// the result resembles a kind of ease-in-out effect. +/// If you would like the angular velocity to remain constant, consider using [`slerp`](Self::slerp) instead. +/// # Details +/// `nlerp` corresponds to computing an angle for a point at position `s` on a line drawn +/// between the endpoints of the arc formed by `self` and `rhs` on a unit circle, +/// and normalizing the result afterwards. +/// Note that if the angles are opposite like 0 and π, the line will pass through the origin, +/// and the resulting angle will always be either `self` or `rhs` depending on `s`. +/// If `s` happens to be `0.5` in this case, a valid rotation cannot be computed, and `self` +/// will be returned as a fallback. +/// # Example +/// ``` +/// # use bevy_math::Rot2; +/// # +/// let rot1 = Rot2::IDENTITY; +/// let rot2 = Rot2::degrees(135.0); +/// let result1 = rot1.nlerp(rot2, 1.0 / 3.0); +/// assert_eq!(result1.as_degrees(), 28.675055); +/// let result2 = rot1.nlerp(rot2, 0.5); +/// assert_eq!(result2.as_degrees(), 67.5); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn nlerp(self, #[proxy] end: bevy::math::Rot2, s: f32) -> bevy::math::Rot2; + +"#, + r#" +/// Performs a spherical linear interpolation between `self` and `end` +/// based on the value `s`. +/// This corresponds to interpolating between the two angles at a constant angular velocity. +/// When `s == 0.0`, the result will be equal to `self`. +/// When `s == 1.0`, the result will be equal to `rhs`. +/// If you would like the rotation to have a kind of ease-in-out effect, consider +/// using the slightly more efficient [`nlerp`](Self::nlerp) instead. +/// # Example +/// ``` +/// # use bevy_math::Rot2; +/// # +/// let rot1 = Rot2::IDENTITY; +/// let rot2 = Rot2::degrees(135.0); +/// let result1 = rot1.slerp(rot2, 1.0 / 3.0); +/// assert_eq!(result1.as_degrees(), 45.0); +/// let result2 = rot1.slerp(rot2, 0.5); +/// assert_eq!(result2.as_degrees(), 67.5); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn slerp(self, #[proxy] end: bevy::math::Rot2, s: f32) -> bevy::math::Rot2; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Rot2 { + cos: f32, + sin: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::prelude::Dir2", + functions[r#" +/// Create a [`Dir2`] from a [`Vec2`] that is already normalized. +/// # Warning +/// `value` must be normalized, i.e its length must be `1.0`. + + #[lua(kind = "Function", output(proxy))] + fn new_unchecked( + #[proxy] + 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`] + + #[lua(kind = "Method", output(proxy))] + fn as_vec2(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Performs a spherical linear interpolation between `self` and `rhs` +/// based on the value `s`. +/// This corresponds to interpolating between the two directions at a constant angular velocity. +/// When `s == 0.0`, the result will be equal to `self`. +/// When `s == 1.0`, the result will be equal to `rhs`. +/// # Example +/// ``` +/// # use bevy_math::Dir2; +/// # use approx::{assert_relative_eq, RelativeEq}; +/// # +/// let dir1 = Dir2::X; +/// let dir2 = Dir2::Y; +/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); +/// assert_relative_eq!(result1, Dir2::from_xy(0.75_f32.sqrt(), 0.5).unwrap()); +/// let result2 = dir1.slerp(dir2, 0.5); +/// assert_relative_eq!(result2, Dir2::from_xy(0.5_f32.sqrt(), 0.5_f32.sqrt()).unwrap()); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn slerp( + self, + #[proxy] + rhs: bevy::math::prelude::Dir2, + s: f32, + ) -> bevy::math::prelude::Dir2; + +"#, + r#" +/// Get the rotation that rotates this direction to `other`. + + #[lua(kind = "Method", output(proxy))] + fn rotation_to(self, #[proxy] other: bevy::math::prelude::Dir2) -> bevy::math::Rot2; + +"#, + r#" +/// Get the rotation that rotates `other` to this direction. + + #[lua(kind = "Method", output(proxy))] + fn rotation_from( + self, + #[proxy] + other: bevy::math::prelude::Dir2, + ) -> bevy::math::Rot2; + +"#, + r#" +/// Get the rotation that rotates the X-axis to this direction. + + #[lua(kind = "Method", output(proxy))] + fn rotation_from_x(self) -> bevy::math::Rot2; + +"#, + r#" +/// Get the rotation that rotates this direction to the X-axis. + + #[lua(kind = "Method", output(proxy))] + fn rotation_to_x(self) -> bevy::math::Rot2; + +"#, + r#" +/// Get the rotation that rotates the Y-axis to this direction. + + #[lua(kind = "Method", output(proxy))] + fn rotation_from_y(self) -> bevy::math::Rot2; + +"#, + r#" +/// Get the rotation that rotates this direction to the Y-axis. + + #[lua(kind = "Method", output(proxy))] + fn rotation_to_y(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`] for an example of when such error accumulation might occur. + + #[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#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::prelude::Vec2; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Dir2(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + 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::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. +/// # Warning +/// `value` must be normalized, i.e its length must be `1.0`. + + #[lua(kind = "Function", output(proxy))] + fn new_unchecked( + #[proxy] + 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`] + + #[lua(kind = "Method", output(proxy))] + fn as_vec3(&self) -> bevy::math::prelude::Vec3; + +"#, + r#" +/// Performs a spherical linear interpolation between `self` and `rhs` +/// based on the value `s`. +/// This corresponds to interpolating between the two directions at a constant angular velocity. +/// When `s == 0.0`, the result will be equal to `self`. +/// When `s == 1.0`, the result will be equal to `rhs`. +/// # Example +/// ``` +/// # use bevy_math::Dir3; +/// # use approx::{assert_relative_eq, RelativeEq}; +/// # +/// let dir1 = Dir3::X; +/// let dir2 = Dir3::Y; +/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); +/// assert_relative_eq!( +/// result1, +/// Dir3::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), +/// epsilon = 0.000001 +/// ); +/// let result2 = dir1.slerp(dir2, 0.5); +/// assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn slerp( + self, + #[proxy] + rhs: bevy::math::prelude::Dir3, + s: f32, + ) -> bevy::math::prelude::Dir3; + +"#, + 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(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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Dir3(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::prelude::Dir3A", + functions[r#" +/// Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. +/// # Warning +/// `value` must be normalized, i.e its length must be `1.0`. + + #[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`] + + #[lua(kind = "Method", output(proxy))] + fn as_vec3a(&self) -> bevy::math::Vec3A; + +"#, + r#" +/// Performs a spherical linear interpolation between `self` and `rhs` +/// based on the value `s`. +/// This corresponds to interpolating between the two directions at a constant angular velocity. +/// When `s == 0.0`, the result will be equal to `self`. +/// When `s == 1.0`, the result will be equal to `rhs`. +/// # Example +/// ``` +/// # use bevy_math::Dir3A; +/// # use approx::{assert_relative_eq, RelativeEq}; +/// # +/// let dir1 = Dir3A::X; +/// let dir2 = Dir3A::Y; +/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); +/// assert_relative_eq!( +/// result1, +/// Dir3A::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), +/// epsilon = 0.000001 +/// ); +/// let result2 = dir1.slerp(dir2, 0.5); +/// assert_relative_eq!(result2, Dir3A::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn slerp( + self, + #[proxy] + rhs: bevy::math::prelude::Dir3A, + 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::clone::Clone", kind = "Method", output(proxy))] + fn clone(&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; + +"#, + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Dir3A(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::prelude::IRect", + functions[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. +/// # Examples +/// ``` +/// # use bevy_math::IRect; +/// let r = IRect::new(0, 4, 10, 6); // w=10 h=2 +/// let r = IRect::new(2, 3, 5, -1); // w=3 h=4 +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn new(x0: i32, y0: i32, x1: i32, y1: i32) -> 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. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// // Unit rect from [0,0] to [1,1] +/// let r = IRect::from_corners(IVec2::ZERO, IVec2::ONE); // w=1 h=1 +/// // Same; the points do not need to be ordered +/// let r = IRect::from_corners(IVec2::ONE, IVec2::ZERO); // w=1 h=1 +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_corners( + #[proxy] + p0: bevy::math::prelude::IVec2, + #[proxy] + p1: bevy::math::prelude::IVec2, + ) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Create a new rectangle from its center and size. +/// # 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. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::from_center_size(IVec2::ZERO, IVec2::new(3, 2)); // w=2 h=2 +/// assert_eq!(r.min, IVec2::splat(-1)); +/// assert_eq!(r.max, IVec2::splat(1)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_center_size( + #[proxy] + origin: bevy::math::prelude::IVec2, + #[proxy] + size: bevy::math::prelude::IVec2, + ) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Create a new rectangle from its center and half-size. +/// # Panics +/// This method panics if any of the components of the half-size is negative. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::from_center_half_size(IVec2::ZERO, IVec2::ONE); // w=2 h=2 +/// assert_eq!(r.min, IVec2::splat(-1)); +/// assert_eq!(r.max, IVec2::splat(1)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_center_half_size( + #[proxy] + origin: bevy::math::prelude::IVec2, + #[proxy] + half_size: bevy::math::prelude::IVec2, + ) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Check if the rectangle is empty. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::from_corners(IVec2::ZERO, IVec2::new(0, 1)); // w=0 h=1 +/// assert!(r.is_empty()); +/// ``` + + #[lua(kind = "Method")] + fn is_empty(&self) -> bool; + +"#, + r#" +/// Rectangle width (max.x - min.x). +/// # Examples +/// ``` +/// # use bevy_math::IRect; +/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// assert_eq!(r.width(), 5); +/// ``` + + #[lua(kind = "Method")] + fn width(&self) -> i32; + +"#, + r#" +/// Rectangle height (max.y - min.y). +/// # Examples +/// ``` +/// # use bevy_math::IRect; +/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// assert_eq!(r.height(), 1); +/// ``` + + #[lua(kind = "Method")] + fn height(&self) -> i32; + +"#, + r#" +/// Rectangle size. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// assert_eq!(r.size(), IVec2::new(5, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn size(&self) -> bevy::math::prelude::IVec2; + +"#, + r#" +/// Rectangle half-size. +/// # 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 +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::new(0, 0, 4, 3); // w=4 h=3 +/// assert_eq!(r.half_size(), IVec2::new(2, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn half_size(&self) -> bevy::math::prelude::IVec2; + +"#, + r#" +/// The center point of the rectangle. +/// # Rounding Behavior +/// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::new(0, 0, 5, 2); // w=5 h=2 +/// assert_eq!(r.center(), IVec2::new(2, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn center(&self) -> bevy::math::prelude::IVec2; + +"#, + r#" +/// Check if a point lies within this rectangle, inclusive of its edges. +/// # Examples +/// ``` +/// # use bevy_math::IRect; +/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// assert!(r.contains(r.center())); +/// assert!(r.contains(r.min)); +/// assert!(r.contains(r.max)); +/// ``` + + #[lua(kind = "Method")] + fn contains(&self, #[proxy] point: bevy::math::prelude::IVec2) -> bool; + +"#, + r#" +/// Build a new rectangle formed of the union of this rectangle and another rectangle. +/// The union is the smallest rectangle enclosing both rectangles. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 +/// let r = r1.union(r2); +/// assert_eq!(r.min, IVec2::new(0, -1)); +/// assert_eq!(r.max, IVec2::new(5, 3)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn union( + &self, + #[proxy] + other: bevy::math::prelude::IRect, + ) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Build a new rectangle formed of the union of this rectangle and a point. +/// The union is the smallest rectangle enclosing both the rectangle and the point. If the +/// point is already inside the rectangle, this method returns a copy of the rectangle. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// let u = r.union_point(IVec2::new(3, 6)); +/// assert_eq!(u.min, IVec2::ZERO); +/// assert_eq!(u.max, IVec2::new(5, 6)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn union_point( + &self, + #[proxy] + other: bevy::math::prelude::IVec2, + ) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. +/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection +/// is empty, this method returns an empty rectangle ([`IRect::is_empty()`] returns `true`), but +/// the actual values of [`IRect::min`] and [`IRect::max`] are implementation-dependent. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 +/// let r = r1.intersect(r2); +/// assert_eq!(r.min, IVec2::new(1, 0)); +/// assert_eq!(r.max, IVec2::new(3, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn intersect( + &self, + #[proxy] + other: bevy::math::prelude::IRect, + ) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Create a new rectangle by expanding it evenly on all sides. +/// A positive expansion value produces a larger rectangle, +/// while a negative expansion value produces a smaller rectangle. +/// If this would result in zero or negative width or height, [`IRect::EMPTY`] is returned instead. +/// # Examples +/// ``` +/// # use bevy_math::{IRect, IVec2}; +/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 +/// let r2 = r.inflate(3); // w=11 h=7 +/// assert_eq!(r2.min, IVec2::splat(-3)); +/// assert_eq!(r2.max, IVec2::new(8, 4)); +/// let r = IRect::new(0, -1, 4, 3); // w=4 h=4 +/// let r2 = r.inflate(-1); // w=2 h=2 +/// assert_eq!(r2.min, IVec2::new(1, 0)); +/// assert_eq!(r2.max, IVec2::new(3, 2)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn inflate(&self, expansion: i32) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Returns self as [`Rect`] (f32) + + #[lua(kind = "Method", output(proxy))] + fn as_rect(&self) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Returns self as [`URect`] (u32) + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct IRect { + #[lua(output(proxy))] + min: bevy::math::prelude::IVec2, + #[lua(output(proxy))] + max: bevy::math::prelude::IVec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::prelude::Rect", + functions[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. +/// # Examples +/// ``` +/// # use bevy_math::Rect; +/// let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 +/// let r = Rect::new(2., 3., 5., -1.); // w=3 h=4 +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> 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. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// // Unit rect from [0,0] to [1,1] +/// let r = Rect::from_corners(Vec2::ZERO, Vec2::ONE); // w=1 h=1 +/// // Same; the points do not need to be ordered +/// let r = Rect::from_corners(Vec2::ONE, Vec2::ZERO); // w=1 h=1 +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_corners( + #[proxy] + p0: bevy::math::prelude::Vec2, + #[proxy] + p1: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Create a new rectangle from its center and size. +/// # Panics +/// This method panics if any of the components of the size is negative. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::from_center_size(Vec2::ZERO, Vec2::ONE); // w=1 h=1 +/// assert!(r.min.abs_diff_eq(Vec2::splat(-0.5), 1e-5)); +/// assert!(r.max.abs_diff_eq(Vec2::splat(0.5), 1e-5)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_center_size( + #[proxy] + origin: bevy::math::prelude::Vec2, + #[proxy] + size: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Create a new rectangle from its center and half-size. +/// # Panics +/// This method panics if any of the components of the half-size is negative. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::from_center_half_size(Vec2::ZERO, Vec2::ONE); // w=2 h=2 +/// assert!(r.min.abs_diff_eq(Vec2::splat(-1.), 1e-5)); +/// assert!(r.max.abs_diff_eq(Vec2::splat(1.), 1e-5)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_center_half_size( + #[proxy] + origin: bevy::math::prelude::Vec2, + #[proxy] + half_size: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Check if the rectangle is empty. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 +/// assert!(r.is_empty()); +/// ``` + + #[lua(kind = "Method")] + fn is_empty(&self) -> bool; + +"#, + r#" +/// Rectangle width (max.x - min.x). +/// # Examples +/// ``` +/// # use bevy_math::Rect; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// assert!((r.width() - 5.).abs() <= 1e-5); +/// ``` + + #[lua(kind = "Method")] + fn width(&self) -> f32; + +"#, + r#" +/// Rectangle height (max.y - min.y). +/// # Examples +/// ``` +/// # use bevy_math::Rect; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// assert!((r.height() - 1.).abs() <= 1e-5); +/// ``` + + #[lua(kind = "Method")] + fn height(&self) -> f32; + +"#, + r#" +/// Rectangle size. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// assert!(r.size().abs_diff_eq(Vec2::new(5., 1.), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn size(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Rectangle half-size. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// assert!(r.half_size().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn half_size(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// The center point of the rectangle. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// assert!(r.center().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn center(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Check if a point lies within this rectangle, inclusive of its edges. +/// # Examples +/// ``` +/// # use bevy_math::Rect; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// assert!(r.contains(r.center())); +/// assert!(r.contains(r.min)); +/// assert!(r.contains(r.max)); +/// ``` + + #[lua(kind = "Method")] + fn contains(&self, #[proxy] point: bevy::math::prelude::Vec2) -> bool; + +"#, + r#" +/// Build a new rectangle formed of the union of this rectangle and another rectangle. +/// The union is the smallest rectangle enclosing both rectangles. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 +/// let r = r1.union(r2); +/// assert!(r.min.abs_diff_eq(Vec2::new(0., -1.), 1e-5)); +/// assert!(r.max.abs_diff_eq(Vec2::new(5., 3.), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn union( + &self, + #[proxy] + other: bevy::math::prelude::Rect, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Build a new rectangle formed of the union of this rectangle and a point. +/// The union is the smallest rectangle enclosing both the rectangle and the point. If the +/// point is already inside the rectangle, this method returns a copy of the rectangle. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// let u = r.union_point(Vec2::new(3., 6.)); +/// assert!(u.min.abs_diff_eq(Vec2::ZERO, 1e-5)); +/// assert!(u.max.abs_diff_eq(Vec2::new(5., 6.), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn union_point( + &self, + #[proxy] + other: bevy::math::prelude::Vec2, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. +/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection +/// is empty, this method returns an empty rectangle ([`Rect::is_empty()`] returns `true`), but +/// the actual values of [`Rect::min`] and [`Rect::max`] are implementation-dependent. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 +/// let r = r1.intersect(r2); +/// assert!(r.min.abs_diff_eq(Vec2::new(1., 0.), 1e-5)); +/// assert!(r.max.abs_diff_eq(Vec2::new(3., 1.), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn intersect( + &self, + #[proxy] + other: bevy::math::prelude::Rect, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Create a new rectangle by expanding it evenly on all sides. +/// A positive expansion value produces a larger rectangle, +/// while a negative expansion value produces a smaller rectangle. +/// If this would result in zero or negative width or height, [`Rect::EMPTY`] is returned instead. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 +/// let r2 = r.inflate(3.); // w=11 h=7 +/// assert!(r2.min.abs_diff_eq(Vec2::splat(-3.), 1e-5)); +/// assert!(r2.max.abs_diff_eq(Vec2::new(8., 4.), 1e-5)); +/// let r = Rect::new(0., -1., 6., 7.); // w=6 h=8 +/// let r2 = r.inflate(-2.); // w=11 h=7 +/// assert!(r2.min.abs_diff_eq(Vec2::new(2., 1.), 1e-5)); +/// assert!(r2.max.abs_diff_eq(Vec2::new(4., 5.), 1e-5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn inflate(&self, expansion: f32) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Build a new rectangle from this one with its coordinates expressed +/// relative to `other` in a normalized ([0..1] x [0..1]) coordinate system. +/// # Examples +/// ``` +/// # use bevy_math::{Rect, Vec2}; +/// let r = Rect::new(2., 3., 4., 6.); +/// let s = Rect::new(0., 0., 10., 10.); +/// let n = r.normalize(s); +/// assert_eq!(n.min.x, 0.2); +/// assert_eq!(n.min.y, 0.3); +/// assert_eq!(n.max.x, 0.4); +/// assert_eq!(n.max.y, 0.6); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn normalize( + &self, + #[proxy] + other: bevy::math::prelude::Rect, + ) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Returns self as [`IRect`] (i32) + + #[lua(kind = "Method", output(proxy))] + fn as_irect(&self) -> bevy::math::prelude::IRect; + +"#, + r#" +/// Returns self as [`URect`] (u32) + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Rect { + #[lua(output(proxy))] + min: bevy::math::prelude::Vec2, + #[lua(output(proxy))] + max: bevy::math::prelude::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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. +/// # Examples +/// ``` +/// # use bevy_math::URect; +/// let r = URect::new(0, 4, 10, 6); // w=10 h=2 +/// let r = URect::new(2, 4, 5, 0); // w=3 h=4 +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn new(x0: u32, y0: u32, x1: u32, y1: u32) -> bevy::math::prelude::URect; + +"#, + 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. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// // Unit rect from [0,0] to [1,1] +/// let r = URect::from_corners(UVec2::ZERO, UVec2::ONE); // w=1 h=1 +/// // Same; the points do not need to be ordered +/// let r = URect::from_corners(UVec2::ONE, UVec2::ZERO); // w=1 h=1 +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_corners( + #[proxy] + p0: bevy::math::prelude::UVec2, + #[proxy] + p1: bevy::math::prelude::UVec2, + ) -> bevy::math::prelude::URect; + +"#, + r#" +/// Create a new rectangle from its center and size. +/// # 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. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::from_center_size(UVec2::ONE, UVec2::splat(2)); // w=2 h=2 +/// assert_eq!(r.min, UVec2::splat(0)); +/// assert_eq!(r.max, UVec2::splat(2)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_center_size( + #[proxy] + origin: bevy::math::prelude::UVec2, + #[proxy] + size: bevy::math::prelude::UVec2, + ) -> bevy::math::prelude::URect; + +"#, + r#" +/// Create a new rectangle from its center and half-size. +/// # Panics +/// This method panics if any of the components of the half-size is negative or if `origin - half_size` results in any negatives. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::from_center_half_size(UVec2::ONE, UVec2::ONE); // w=2 h=2 +/// assert_eq!(r.min, UVec2::splat(0)); +/// assert_eq!(r.max, UVec2::splat(2)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_center_half_size( + #[proxy] + origin: bevy::math::prelude::UVec2, + #[proxy] + half_size: bevy::math::prelude::UVec2, + ) -> bevy::math::prelude::URect; + +"#, + r#" +/// Check if the rectangle is empty. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::from_corners(UVec2::ZERO, UVec2::new(0, 1)); // w=0 h=1 +/// assert!(r.is_empty()); +/// ``` + + #[lua(kind = "Method")] + fn is_empty(&self) -> bool; + +"#, + r#" +/// Rectangle width (max.x - min.x). +/// # Examples +/// ``` +/// # use bevy_math::URect; +/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 +/// assert_eq!(r.width(), 5); +/// ``` + + #[lua(kind = "Method")] + fn width(&self) -> u32; + +"#, + r#" +/// Rectangle height (max.y - min.y). +/// # Examples +/// ``` +/// # use bevy_math::URect; +/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 +/// assert_eq!(r.height(), 1); +/// ``` + + #[lua(kind = "Method")] + fn height(&self) -> u32; + +"#, + r#" +/// Rectangle size. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 +/// assert_eq!(r.size(), UVec2::new(5, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn size(&self) -> bevy::math::prelude::UVec2; + +"#, + r#" +/// Rectangle half-size. +/// # 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 +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::new(0, 0, 4, 2); // w=4 h=2 +/// assert_eq!(r.half_size(), UVec2::new(2, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn half_size(&self) -> bevy::math::prelude::UVec2; + +"#, + r#" +/// The center point of the rectangle. +/// # Rounding Behavior +/// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::new(0, 0, 4, 2); // w=4 h=2 +/// assert_eq!(r.center(), UVec2::new(2, 1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn center(&self) -> bevy::math::prelude::UVec2; + +"#, + r#" +/// Check if a point lies within this rectangle, inclusive of its edges. +/// # Examples +/// ``` +/// # use bevy_math::URect; +/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 +/// assert!(r.contains(r.center())); +/// assert!(r.contains(r.min)); +/// assert!(r.contains(r.max)); +/// ``` + + #[lua(kind = "Method")] + fn contains(&self, #[proxy] point: bevy::math::prelude::UVec2) -> bool; + +"#, + r#" +/// Build a new rectangle formed of the union of this rectangle and another rectangle. +/// The union is the smallest rectangle enclosing both rectangles. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r1 = URect::new(0, 0, 5, 1); // w=5 h=1 +/// let r2 = URect::new(1, 0, 3, 8); // w=2 h=4 +/// let r = r1.union(r2); +/// assert_eq!(r.min, UVec2::new(0, 0)); +/// assert_eq!(r.max, UVec2::new(5, 8)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn union( + &self, + #[proxy] + other: bevy::math::prelude::URect, + ) -> bevy::math::prelude::URect; + +"#, + r#" +/// Build a new rectangle formed of the union of this rectangle and a point. +/// The union is the smallest rectangle enclosing both the rectangle and the point. If the +/// point is already inside the rectangle, this method returns a copy of the rectangle. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 +/// let u = r.union_point(UVec2::new(3, 6)); +/// assert_eq!(u.min, UVec2::ZERO); +/// assert_eq!(u.max, UVec2::new(5, 6)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn union_point( + &self, + #[proxy] + other: bevy::math::prelude::UVec2, + ) -> bevy::math::prelude::URect; + +"#, + r#" +/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. +/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection +/// is empty, this method returns an empty rectangle ([`URect::is_empty()`] returns `true`), but +/// the actual values of [`URect::min`] and [`URect::max`] are implementation-dependent. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r1 = URect::new(0, 0, 2, 2); // w=2 h=2 +/// let r2 = URect::new(1, 1, 3, 3); // w=2 h=2 +/// let r = r1.intersect(r2); +/// assert_eq!(r.min, UVec2::new(1, 1)); +/// assert_eq!(r.max, UVec2::new(2, 2)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn intersect( + &self, + #[proxy] + other: bevy::math::prelude::URect, + ) -> bevy::math::prelude::URect; + +"#, + r#" +/// Create a new rectangle by expanding it evenly on all sides. +/// A positive expansion value produces a larger rectangle, +/// while a negative expansion value produces a smaller rectangle. +/// If this would result in zero width or height, [`URect::EMPTY`] is returned instead. +/// # Examples +/// ``` +/// # use bevy_math::{URect, UVec2}; +/// let r = URect::new(4, 4, 6, 6); // w=2 h=2 +/// let r2 = r.inflate(1); // w=4 h=4 +/// assert_eq!(r2.min, UVec2::splat(3)); +/// assert_eq!(r2.max, UVec2::splat(7)); +/// let r = URect::new(4, 4, 8, 8); // w=4 h=4 +/// let r2 = r.inflate(-1); // w=2 h=2 +/// assert_eq!(r2.min, UVec2::splat(5)); +/// assert_eq!(r2.max, UVec2::splat(7)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn inflate(&self, expansion: i32) -> bevy::math::prelude::URect; + +"#, + r#" +/// Returns self as [`Rect`] (f32) + + #[lua(kind = "Method", output(proxy))] + fn as_rect(&self) -> bevy::math::prelude::Rect; + +"#, + r#" +/// Returns self as [`IRect`] (i32) + + #[lua(kind = "Method", output(proxy))] + fn as_irect(&self) -> bevy::math::prelude::IRect; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct URect { + #[lua(output(proxy))] + min: bevy::math::prelude::UVec2, + #[lua(output(proxy))] + max: bevy::math::prelude::UVec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy(derive(), remote = "bevy::math::Affine3", functions[])] +struct Affine3 { + #[lua(output(proxy))] + matrix3: bevy::math::prelude::Mat3, + #[lua(output(proxy))] + translation: bevy::math::prelude::Vec3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new( + #[proxy] + center: bevy::math::prelude::Vec2, + #[proxy] + half_size: bevy::math::prelude::Vec2, + ) -> bevy::math::bounding::Aabb2d; + +"#, + r#" +/// Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. + + #[lua(kind = "Method", output(proxy))] + fn bounding_circle(&self) -> bevy::math::bounding::BoundingCircle; + +"#, + r#" +/// Finds the point on the AABB that is closest to the given `point`. +/// If the point is outside the AABB, the returned point will be on the perimeter of the AABB. +/// Otherwise, it will be inside the AABB 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 Aabb2d { + #[lua(output(proxy))] + min: bevy::math::prelude::Vec2, + #[lua(output(proxy))] + max: bevy::math::prelude::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::bounding::BoundingCircle", + functions[r#" +/// Constructs a bounding circle from its center and radius. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + center: bevy::math::prelude::Vec2, + radius: f32, + ) -> bevy::math::bounding::BoundingCircle; + +"#, + r#" +/// Get the radius of the bounding circle + + #[lua(kind = "Method")] + fn radius(&self) -> f32; + +"#, + r#" +/// Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. + + #[lua(kind = "Method", output(proxy))] + fn aabb_2d(&self) -> bevy::math::bounding::Aabb2d; + +"#, + r#" +/// Finds the point on the bounding circle that is closest to the given `point`. +/// If the point is outside the circle, the returned point will be on the perimeter of the circle. +/// Otherwise, it will be inside the circle 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(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::BoundingCircle; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct BoundingCircle { + #[lua(output(proxy))] + center: bevy::math::prelude::Vec2, + #[lua(output(proxy))] + circle: bevy::math::primitives::Circle, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Circle", + functions[r#" +/// Create a new [`Circle`] from a `radius` + + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32) -> bevy::math::primitives::Circle; + +"#, + r#" +/// Get the diameter of the circle + + #[lua(kind = "Method")] + fn diameter(&self) -> f32; + +"#, + r#" +/// Finds the point on the circle that is closest to the given `point`. +/// If the point is outside the circle, the returned point will be on the perimeter of the circle. +/// Otherwise, it will be inside the circle 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(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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Circle { + radius: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Annulus) -> bool; + +"#, + 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#" +/// 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; + +"#, + r#" +/// Create a new [`Arc2d`] from a `radius` and an `angle` in radians + + #[lua(kind = "Function", output(proxy))] + fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::Arc2d; + +"#, + r#" +/// Create a new [`Arc2d`] from a `radius` and an `angle` in degrees. + + #[lua(kind = "Function", output(proxy))] + fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::Arc2d; + +"#, + r#" +/// Create a new [`Arc2d`] from a `radius` and a `fraction` of a single turn. +/// For instance, `0.5` turns is a semicircle. + + #[lua(kind = "Function", output(proxy))] + fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::Arc2d; + +"#, + r#" +/// Get the angle of the arc + + #[lua(kind = "Method")] + fn angle(&self) -> f32; + +"#, + r#" +/// Get the length of the arc + + #[lua(kind = "Method")] + fn length(&self) -> f32; + +"#, + r#" +/// Get the right-hand end point of the arc + + #[lua(kind = "Method", output(proxy))] + fn right_endpoint(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the left-hand end point of the arc + + #[lua(kind = "Method", output(proxy))] + fn left_endpoint(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the midpoint of the arc + + #[lua(kind = "Method", output(proxy))] + fn midpoint(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get half the distance between the endpoints (half the length of the chord) + + #[lua(kind = "Method")] + fn half_chord_length(&self) -> f32; + +"#, + r#" +/// Get the distance between the endpoints (the length of the chord) + + #[lua(kind = "Method")] + fn chord_length(&self) -> f32; + +"#, + r#" +/// Get the midpoint of the two endpoints (the midpoint of the chord) + + #[lua(kind = "Method", output(proxy))] + fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the length of the apothem of this arc, that is, +/// the distance from the center of the circle to the midpoint of the chord, in the direction of the midpoint of the arc. +/// Equivalently, the [`radius`](Self::radius) minus the [`sagitta`](Self::sagitta). +/// Note that for a [`major`](Self::is_major) arc, the apothem will be negative. + + #[lua(kind = "Method")] + fn apothem(&self) -> f32; + +"#, + r#" +/// Get the length of the sagitta of this arc, that is, +/// the length of the line between the midpoints of the arc and its chord. +/// Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc. +/// The sagitta is also the sum of the [`radius`](Self::radius) and the [`apothem`](Self::apothem). + + #[lua(kind = "Method")] + fn sagitta(&self) -> f32; + +"#, + r#" +/// Produces true if the arc is at most half a circle. +/// **Note:** This is not the negation of [`is_major`](Self::is_major): an exact semicircle is both major and minor. + + #[lua(kind = "Method")] + fn is_minor(&self) -> bool; + +"#, + r#" +/// Produces true if the arc is at least half a circle. +/// **Note:** This is not the negation of [`is_minor`](Self::is_minor): an exact semicircle is both major and minor. + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Arc2d { + radius: f32, + half_angle: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule2d; + +"#, + r#" +/// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Capsule2d { + radius: f32, + half_length: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::CircularSector", + functions[r#" +/// Create a new [`CircularSector`] from a `radius` and an `angle` + + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; + +"#, + r#" +/// Create a new [`CircularSector`] from a `radius` and an `angle` in radians. + + #[lua(kind = "Function", output(proxy))] + fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; + +"#, + r#" +/// Create a new [`CircularSector`] from a `radius` and an `angle` in degrees. + + #[lua(kind = "Function", output(proxy))] + fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; + +"#, + r#" +/// Create a new [`CircularSector`] from a `radius` and a number of `turns` of a circle. +/// For instance, `0.5` turns is a semicircle. + + #[lua(kind = "Function", output(proxy))] + fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::CircularSector; + +"#, + r#" +/// Get half the angle of the sector + + #[lua(kind = "Method")] + fn half_angle(&self) -> f32; + +"#, + r#" +/// Get the angle of the sector + + #[lua(kind = "Method")] + fn angle(&self) -> f32; + +"#, + r#" +/// Get the radius of the sector + + #[lua(kind = "Method")] + fn radius(&self) -> f32; + +"#, + r#" +/// Get the length of the arc defining the sector + + #[lua(kind = "Method")] + fn arc_length(&self) -> f32; + +"#, + r#" +/// Get half the length of the chord defined by the sector +/// See [`Arc2d::half_chord_length`] + + #[lua(kind = "Method")] + fn half_chord_length(&self) -> f32; + +"#, + r#" +/// Get the length of the chord defined by the sector +/// See [`Arc2d::chord_length`] + + #[lua(kind = "Method")] + fn chord_length(&self) -> f32; + +"#, + r#" +/// Get the midpoint of the chord defined by the sector +/// See [`Arc2d::chord_midpoint`] + + #[lua(kind = "Method", output(proxy))] + fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the length of the apothem of this sector +/// See [`Arc2d::apothem`] + + #[lua(kind = "Method")] + fn apothem(&self) -> f32; + +"#, + r#" +/// Get the length of the sagitta of this sector +/// See [`Arc2d::sagitta`] + + #[lua(kind = "Method")] + fn sagitta(&self) -> f32; + +"#, + 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#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +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#" +/// Create a new [`CircularSegment`] from a `radius`, and an `angle` + + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; + +"#, + r#" +/// Create a new [`CircularSegment`] from a `radius` and an `angle` in radians. + + #[lua(kind = "Function", output(proxy))] + fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; + +"#, + r#" +/// Create a new [`CircularSegment`] from a `radius` and an `angle` in degrees. + + #[lua(kind = "Function", output(proxy))] + fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; + +"#, + r#" +/// Create a new [`CircularSegment`] from a `radius` and a number of `turns` of a circle. +/// For instance, `0.5` turns is a semicircle. + + #[lua(kind = "Function", output(proxy))] + fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::CircularSegment; + +"#, + r#" +/// Get the half-angle of the segment + + #[lua(kind = "Method")] + fn half_angle(&self) -> f32; + +"#, + r#" +/// Get the angle of the segment + + #[lua(kind = "Method")] + fn angle(&self) -> f32; + +"#, + r#" +/// Get the radius of the segment + + #[lua(kind = "Method")] + fn radius(&self) -> f32; + +"#, + r#" +/// Get the length of the arc defining the segment + + #[lua(kind = "Method")] + fn arc_length(&self) -> f32; + +"#, + r#" +/// Get half the length of the segment's base, also known as its chord + + #[lua(kind = "Method")] + fn half_chord_length(&self) -> f32; + +"#, + r#" +/// Get the length of the segment's base, also known as its chord + + #[lua(kind = "Method")] + fn chord_length(&self) -> f32; + +"#, + r#" +/// Get the midpoint of the segment's base, also known as its chord + + #[lua(kind = "Method", output(proxy))] + fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the length of the apothem of this segment, +/// which is the signed distance between the segment and the center of its circle +/// See [`Arc2d::apothem`] + + #[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(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct CircularSegment { + #[lua(output(proxy))] + arc: bevy::math::primitives::Arc2d, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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. + + #[lua(kind = "Function", output(proxy))] + fn new(half_width: f32, half_height: f32) -> bevy::math::primitives::Ellipse; + +"#, + r#" +/// Create a new `Ellipse` from a given full size. +/// `size.x` is the diameter along the X axis, and `size.y` is the diameter along the Y axis. + + #[lua(kind = "Function", output(proxy))] + fn from_size( + #[proxy] + size: bevy::math::prelude::Vec2, + ) -> bevy::math::primitives::Ellipse; + +"#, + r#" +/// Returns the [eccentricity](https://en.wikipedia.org/wiki/Eccentricity_(mathematics)) of the ellipse. +/// It can be thought of as a measure of how "stretched" or elongated the ellipse is. +/// The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola. + + #[lua(kind = "Method")] + fn eccentricity(&self) -> f32; + +"#, + r#" +/// Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse. +/// The focal length of an ellipse is related to its eccentricity by `eccentricity = focal_length / semi_major` + + #[lua(kind = "Method")] + fn focal_length(&self) -> f32; + +"#, + r#" +/// Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse. + + #[lua(kind = "Method")] + fn semi_major(&self) -> f32; + +"#, + r#" +/// Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse. + + #[lua(kind = "Method")] + fn semi_minor(&self) -> f32; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Ellipse { + #[lua(output(proxy))] + half_size: bevy::math::prelude::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim2::Line2d) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Line2d { + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Plane2d", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Plane2d; + +"#, + 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; + +"#, + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Plane2d { + #[lua(output(proxy))] + normal: bevy::math::prelude::Dir2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new(width: f32, height: f32) -> bevy::math::primitives::Rectangle; + +"#, + r#" +/// Create a new `Rectangle` from a given full size + + #[lua(kind = "Function", output(proxy))] + fn from_size( + #[proxy] + size: bevy::math::prelude::Vec2, + ) -> bevy::math::primitives::Rectangle; + +"#, + r#" +/// Create a new `Rectangle` from two corner points + + #[lua(kind = "Function", output(proxy))] + fn from_corners( + #[proxy] + point1: bevy::math::prelude::Vec2, + #[proxy] + point2: bevy::math::prelude::Vec2, + ) -> bevy::math::primitives::Rectangle; + +"#, + r#" +/// Create a `Rectangle` from a single length. +/// The resulting `Rectangle` will be the same size in every direction. + + #[lua(kind = "Function", output(proxy))] + fn from_length(length: f32) -> bevy::math::primitives::Rectangle; + +"#, + r#" +/// Get the size of the rectangle + + #[lua(kind = "Method", output(proxy))] + fn size(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Finds the point on the rectangle that is closest to the given `point`. +/// If the point is outside the rectangle, the returned point will be on the perimeter of the rectangle. +/// Otherwise, it will be inside the rectangle 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 Rectangle { + #[lua(output(proxy))] + half_size: bevy::math::prelude::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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 +/// Panics if `circumradius` is negative + + #[lua(kind = "Function", output(proxy))] + fn new(circumradius: f32, sides: u32) -> bevy::math::primitives::RegularPolygon; + +"#, + r#" +/// Get the radius of the circumcircle on which all vertices +/// of the regular polygon lie + + #[lua(kind = "Method")] + fn circumradius(&self) -> f32; + +"#, + r#" +/// Get the inradius or apothem of the regular polygon. +/// This is the radius of the largest circle that can +/// be drawn within the polygon + + #[lua(kind = "Method")] + fn inradius(&self) -> f32; + +"#, + r#" +/// Get the length of one side of the regular polygon + + #[lua(kind = "Method")] + fn side_length(&self) -> f32; + +"#, + r#" +/// Get the internal angle of the regular polygon in degrees. +/// This is the angle formed by two adjacent sides with points +/// within the angle being in the interior of the polygon + + #[lua(kind = "Method")] + fn internal_angle_degrees(&self) -> f32; + +"#, + r#" +/// Get the internal angle of the regular polygon in radians. +/// This is the angle formed by two adjacent sides with points +/// within the angle being in the interior of the polygon + + #[lua(kind = "Method")] + fn internal_angle_radians(&self) -> f32; + +"#, + r#" +/// Get the external angle of the regular polygon in degrees. +/// This is the angle formed by two adjacent sides with points +/// within the angle being in the exterior of the polygon + + #[lua(kind = "Method")] + fn external_angle_degrees(&self) -> f32; + +"#, + r#" +/// Get the external angle of the regular polygon in radians. +/// This is the angle formed by two adjacent sides with points +/// within the angle being in the exterior of the polygon + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RegularPolygon { + #[lua(output(proxy))] + circumcircle: bevy::math::primitives::Circle, + sides: u32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new( + horizontal_diagonal: f32, + vertical_diagonal: f32, + ) -> bevy::math::primitives::Rhombus; + +"#, + r#" +/// Create a new `Rhombus` from a side length with all inner angles equal. + + #[lua(kind = "Function", output(proxy))] + fn from_side(side: f32) -> bevy::math::primitives::Rhombus; + +"#, + r#" +/// Create a new `Rhombus` from a given inradius with all inner angles equal. + + #[lua(kind = "Function", output(proxy))] + fn from_inradius(inradius: f32) -> bevy::math::primitives::Rhombus; + +"#, + r#" +/// Get the length of each side of the rhombus + + #[lua(kind = "Method")] + fn side(&self) -> f32; + +"#, + r#" +/// Get the radius of the circumcircle on which all vertices +/// of the rhombus lie + + #[lua(kind = "Method")] + fn circumradius(&self) -> f32; + +"#, + r#" +/// Get the radius of the largest circle that can +/// be drawn within the rhombus + + #[lua(kind = "Method")] + fn inradius(&self) -> f32; + +"#, + r#" +/// Finds the point on the rhombus that is closest to the given `point`. +/// If the point is outside the rhombus, the returned point will be on the perimeter of the rhombus. +/// Otherwise, it will be inside the rhombus 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 Rhombus { + #[lua(output(proxy))] + half_diagonals: bevy::math::prelude::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Segment2d", + functions[r#" +/// Create a new `Segment2d` from a direction and full length of the segment + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + direction: bevy::math::prelude::Dir2, + length: f32, + ) -> bevy::math::primitives::Segment2d; + +"#, + r#" +/// Get the position of the first point on the line segment + + #[lua(kind = "Method", output(proxy))] + fn point1(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the position of the second point on the line segment + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Segment2d { + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir2, + half_length: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new( + #[proxy] + a: bevy::math::prelude::Vec2, + #[proxy] + b: bevy::math::prelude::Vec2, + #[proxy] + c: bevy::math::prelude::Vec2, + ) -> bevy::math::primitives::Triangle2d; + +"#, + r#" +/// Checks if the triangle is degenerate, meaning it has zero area. +/// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. +/// This indicates that the three vertices are collinear or nearly collinear. + + #[lua(kind = "Method")] + fn is_degenerate(&self) -> bool; + +"#, + r#" +/// Checks if the triangle is acute, meaning all angles are less than 90 degrees + + #[lua(kind = "Method")] + fn is_acute(&self) -> bool; + +"#, + r#" +/// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees + + #[lua(kind = "Method")] + fn is_obtuse(&self) -> bool; + +"#, + r#" +/// Reverse the [`WindingOrder`] of the triangle +/// by swapping the first and last vertices. + + #[lua(kind = "MutatingMethod")] + fn reverse(&mut self) -> (); + +"#, + r#" +/// This triangle but reversed. + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Triangle2d { + vertices: ReflectedValue, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::bounding::Aabb3d", + functions[r#" +/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. + + #[lua(kind = "Method", output(proxy))] + fn bounding_sphere(&self) -> bevy::math::bounding::BoundingSphere; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::Aabb3d; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Aabb3d { + #[lua(output(proxy))] + min: bevy::math::Vec3A, + #[lua(output(proxy))] + max: bevy::math::Vec3A, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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")] + fn radius(&self) -> f32; + +"#, + r#" +/// Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. + + #[lua(kind = "Method", output(proxy))] + fn aabb_3d(&self) -> bevy::math::bounding::Aabb3d; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct BoundingSphere { + #[lua(output(proxy))] + center: bevy::math::Vec3A, + #[lua(output(proxy))] + sphere: bevy::math::primitives::Sphere, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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#" + + #[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` + + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32) -> bevy::math::primitives::Sphere; + +"#, + r#" +/// Get the diameter of the sphere + + #[lua(kind = "Method")] + fn diameter(&self) -> f32; + +"#, + r#" +/// Finds the point on the sphere that is closest to the given `point`. +/// If the point is outside the sphere, the returned point will be on the surface of the sphere. +/// Otherwise, it will be inside the sphere and returned as is. + + #[lua(kind = "Method", output(proxy))] + fn closest_point( + &self, + #[proxy] + point: bevy::math::prelude::Vec3, + ) -> bevy::math::prelude::Vec3; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Sphere { + radius: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Cuboid", + functions[r#" +/// Create a new `Cuboid` from a full x, y, and z length + + #[lua(kind = "Function", output(proxy))] + fn new( + x_length: f32, + y_length: f32, + z_length: f32, + ) -> bevy::math::primitives::Cuboid; + +"#, + r#" +/// Create a new `Cuboid` from a given full size + + #[lua(kind = "Function", output(proxy))] + fn from_size( + #[proxy] + size: bevy::math::prelude::Vec3, + ) -> bevy::math::primitives::Cuboid; + +"#, + r#" +/// Create a new `Cuboid` from two corner points + + #[lua(kind = "Function", output(proxy))] + fn from_corners( + #[proxy] + point1: bevy::math::prelude::Vec3, + #[proxy] + point2: bevy::math::prelude::Vec3, + ) -> bevy::math::primitives::Cuboid; + +"#, + r#" +/// Create a `Cuboid` from a single length. +/// The resulting `Cuboid` will be the same size in every direction. + + #[lua(kind = "Function", output(proxy))] + fn from_length(length: f32) -> bevy::math::primitives::Cuboid; + +"#, + r#" +/// Get the size of the cuboid + + #[lua(kind = "Method", output(proxy))] + fn size(&self) -> bevy::math::prelude::Vec3; + +"#, + r#" +/// Finds the point on the cuboid that is closest to the given `point`. +/// If the point is outside the cuboid, the returned point will be on the surface of the cuboid. +/// Otherwise, it will be inside the cuboid and returned as is. + + #[lua(kind = "Method", output(proxy))] + fn closest_point( + &self, + #[proxy] + 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::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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Cuboid { + #[lua(output(proxy))] + half_size: bevy::math::prelude::Vec3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Cylinder", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Cylinder; + +"#, + r#" +/// Create a new `Cylinder` from a radius and full height + + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32, height: f32) -> bevy::math::primitives::Cylinder; + +"#, + r#" +/// Get the base of the cylinder as a [`Circle`] + + #[lua(kind = "Method", output(proxy))] + fn base(&self) -> bevy::math::primitives::Circle; + +"#, + r#" +/// Get the surface area of the side of the cylinder, +/// also known as the lateral area + + #[lua(kind = "Method")] + fn lateral_area(&self) -> f32; + +"#, + r#" +/// Get the surface area of one base of the cylinder + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Cylinder { + radius: f32, + half_height: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule3d; + +"#, + r#" +/// Get the part connecting the hemispherical ends +/// of the capsule as a [`Cylinder`] + + #[lua(kind = "Method", output(proxy))] + fn to_cylinder(&self) -> bevy::math::primitives::Cylinder; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Capsule3d; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Capsule3d { + radius: f32, + half_length: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Cone", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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. + + #[lua(kind = "Function", output(proxy))] + fn new(radius: f32, height: f32) -> bevy::math::primitives::Cone; + +"#, + r#" +/// Get the base of the cone as a [`Circle`] + + #[lua(kind = "Method", output(proxy))] + fn base(&self) -> bevy::math::primitives::Circle; + +"#, + r#" +/// Get the slant height of the cone, the length of the line segment +/// connecting a point on the base to the apex + + #[lua(kind = "Method")] + fn slant_height(&self) -> f32; + +"#, + r#" +/// Get the surface area of the side of the cone, +/// also known as the lateral area + + #[lua(kind = "Method")] + fn lateral_area(&self) -> f32; + +"#, + r#" +/// Get the surface area of the base of the cone + + #[lua(kind = "Method")] + fn base_area(&self) -> f32; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Cone { + radius: f32, + height: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::ConicalFrustum) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct ConicalFrustum { + radius_top: f32, + radius_bottom: f32, + height: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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 +/// * 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::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &primitives::dim3::InfinitePlane3d) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct InfinitePlane3d { + #[lua(output(proxy))] + normal: bevy::math::prelude::Dir3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Line3d", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Line3d { + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + r#" +/// Create a new `Segment3d` from a direction and full length of the segment + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + direction: bevy::math::prelude::Dir3, + length: f32, + ) -> bevy::math::primitives::Segment3d; + +"#, + r#" +/// Get the position of the first point on the line segment + + #[lua(kind = "Method", output(proxy))] + fn point1(&self) -> bevy::math::prelude::Vec3; + +"#, + r#" +/// Get the position of the second point on the line segment + + #[lua(kind = "Method", output(proxy))] + fn point2(&self) -> bevy::math::prelude::Vec3; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Segment3d { + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir3, + half_length: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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 + + #[lua(kind = "Function", output(proxy))] + fn new(inner_radius: f32, outer_radius: f32) -> bevy::math::primitives::Torus; + +"#, + r#" +/// Get the inner radius of the torus. +/// For a ring torus, this corresponds to the radius of the hole, +/// or `major_radius - minor_radius` + + #[lua(kind = "Method")] + fn inner_radius(&self) -> f32; + +"#, + r#" +/// Get the outer radius of the torus. +/// This corresponds to the overall radius of the entire object, +/// or `major_radius + minor_radius` + + #[lua(kind = "Method")] + fn outer_radius(&self) -> f32; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Torus { + minor_radius: f32, + major_radius: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::primitives::Triangle3d", + functions[r#" +/// Create a new [`Triangle3d`] from points `a`, `b`, and `c`. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + a: bevy::math::prelude::Vec3, + #[proxy] + b: bevy::math::prelude::Vec3, + #[proxy] + c: bevy::math::prelude::Vec3, + ) -> bevy::math::primitives::Triangle3d; + +"#, + r#" +/// Checks if the triangle is degenerate, meaning it has zero area. +/// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. +/// This indicates that the three vertices are collinear or nearly collinear. + + #[lua(kind = "Method")] + fn is_degenerate(&self) -> bool; + +"#, + r#" +/// Checks if the triangle is acute, meaning all angles are less than 90 degrees + + #[lua(kind = "Method")] + fn is_acute(&self) -> bool; + +"#, + r#" +/// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees + + #[lua(kind = "Method")] + fn is_obtuse(&self) -> bool; + +"#, + r#" +/// Reverse the triangle by swapping the first and last vertices. + + #[lua(kind = "MutatingMethod")] + fn reverse(&mut self) -> (); + +"#, + r#" +/// This triangle but reversed. + + #[lua(kind = "Method", output(proxy))] + fn reversed(self) -> bevy::math::primitives::Triangle3d; + +"#, + r#" +/// Get the centroid of the triangle. +/// This function finds the geometric center of the triangle by averaging the vertices: +/// `centroid = (a + b + c) / 3`. + + #[lua(kind = "Method", output(proxy))] + fn centroid(&self) -> bevy::math::prelude::Vec3; + +"#, + r#" +/// Get the circumcenter of the triangle. + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Triangle3d { + vertices: ReflectedValue, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::bounding::RayCast2d", + functions[r#" +/// Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + origin: bevy::math::prelude::Vec2, + #[proxy] + direction: bevy::math::prelude::Dir2, + max: f32, + ) -> bevy::math::bounding::RayCast2d; + +"#, + r#" +/// Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. + + #[lua(kind = "Function", output(proxy))] + fn from_ray( + #[proxy] + ray: bevy::math::Ray2d, + max: f32, + ) -> bevy::math::bounding::RayCast2d; + +"#, + r#" +/// Get the cached multiplicative inverse of the direction of the ray. + + #[lua(kind = "Method", output(proxy))] + fn direction_recip(&self) -> bevy::math::prelude::Vec2; + +"#, + r#" +/// Get the distance of an intersection with an [`Aabb2d`], if any. + + #[lua(kind = "Method")] + fn aabb_intersection_at( + &self, + #[proxy] + aabb: &bounding::bounded2d::Aabb2d, + ) -> std::option::Option; + +"#, + r#" +/// Get the distance of an intersection with a [`BoundingCircle`], if any. + + #[lua(kind = "Method")] + fn circle_intersection_at( + &self, + #[proxy] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RayCast2d { + #[lua(output(proxy))] + ray: bevy::math::Ray2d, + max: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::bounding::AabbCast2d", + functions[r#" +/// Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + aabb: bevy::math::bounding::Aabb2d, + #[proxy] + origin: bevy::math::prelude::Vec2, + #[proxy] + direction: bevy::math::prelude::Dir2, + max: f32, + ) -> bevy::math::bounding::AabbCast2d; + +"#, + r#" +/// Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. + + #[lua(kind = "Function", output(proxy))] + fn from_ray( + #[proxy] + aabb: bevy::math::bounding::Aabb2d, + #[proxy] + ray: bevy::math::Ray2d, + max: f32, + ) -> bevy::math::bounding::AabbCast2d; + +"#, + r#" +/// Get the distance at which the [`Aabb2d`]s collide, if at all. + + #[lua(kind = "Method")] + fn aabb_collision_at( + &self, + #[proxy] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AabbCast2d { + #[lua(output(proxy))] + ray: bevy::math::bounding::RayCast2d, + #[lua(output(proxy))] + aabb: bevy::math::bounding::Aabb2d, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new( + #[proxy] + circle: bevy::math::bounding::BoundingCircle, + #[proxy] + origin: bevy::math::prelude::Vec2, + #[proxy] + direction: bevy::math::prelude::Dir2, + max: f32, + ) -> bevy::math::bounding::BoundingCircleCast; + +"#, + r#" +/// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. + + #[lua(kind = "Function", output(proxy))] + fn from_ray( + #[proxy] + circle: bevy::math::bounding::BoundingCircle, + #[proxy] + ray: bevy::math::Ray2d, + max: f32, + ) -> bevy::math::bounding::BoundingCircleCast; + +"#, + r#" +/// Get the distance at which the [`BoundingCircle`]s collide, if at all. + + #[lua(kind = "Method")] + fn circle_collision_at( + &self, + #[proxy] + circle: bevy::math::bounding::BoundingCircle, + ) -> std::option::Option; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct BoundingCircleCast { + #[lua(output(proxy))] + ray: bevy::math::bounding::RayCast2d, + #[lua(output(proxy))] + circle: bevy::math::bounding::BoundingCircle, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn from_ray( + #[proxy] + ray: bevy::math::Ray3d, + max: f32, + ) -> bevy::math::bounding::RayCast3d; + +"#, + r#" +/// Get the cached multiplicative inverse of the direction of the ray. + + #[lua(kind = "Method", output(proxy))] + fn direction_recip(&self) -> bevy::math::Vec3A; + +"#, + r#" +/// Get the distance of an intersection with an [`Aabb3d`], if any. + + #[lua(kind = "Method")] + fn aabb_intersection_at( + &self, + #[proxy] + aabb: &bounding::bounded3d::Aabb3d, + ) -> std::option::Option; + +"#, + r#" +/// Get the distance of an intersection with a [`BoundingSphere`], if any. + + #[lua(kind = "Method")] + fn sphere_intersection_at( + &self, + #[proxy] + sphere: &bounding::bounded3d::BoundingSphere, + ) -> std::option::Option; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct RayCast3d { + #[lua(output(proxy))] + origin: bevy::math::Vec3A, + #[lua(output(proxy))] + direction: bevy::math::prelude::Dir3A, + max: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn from_ray( + #[proxy] + aabb: bevy::math::bounding::Aabb3d, + #[proxy] + ray: bevy::math::Ray3d, + max: f32, + ) -> bevy::math::bounding::AabbCast3d; + +"#, + r#" +/// Get the distance at which the [`Aabb3d`]s collide, if at all. + + #[lua(kind = "Method")] + fn aabb_collision_at( + &self, + #[proxy] + aabb: bevy::math::bounding::Aabb3d, + ) -> std::option::Option; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct AabbCast3d { + #[lua(output(proxy))] + ray: bevy::math::bounding::RayCast3d, + #[lua(output(proxy))] + aabb: bevy::math::bounding::Aabb3d, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::bounding::BoundingSphereCast", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::bounding::BoundingSphereCast; + +"#, + r#" +/// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. + + #[lua(kind = "Function", output(proxy))] + fn from_ray( + #[proxy] + sphere: bevy::math::bounding::BoundingSphere, + #[proxy] + ray: bevy::math::Ray3d, + max: f32, + ) -> bevy::math::bounding::BoundingSphereCast; + +"#, + r#" +/// Get the distance at which the [`BoundingSphere`]s collide, if at all. + + #[lua(kind = "Method")] + fn sphere_collision_at( + &self, + #[proxy] + sphere: bevy::math::bounding::BoundingSphere, + ) -> std::option::Option; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct BoundingSphereCast { + #[lua(output(proxy))] + ray: bevy::math::bounding::RayCast3d, + #[lua(output(proxy))] + sphere: bevy::math::bounding::BoundingSphere, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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")] + fn start(self) -> f32; + +"#, + r#" +/// Get the end of this interval. + + #[lua(kind = "Method")] + fn end(self) -> f32; + +"#, + r#" +/// Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). + + #[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(kind = "Method")] + fn is_bounded(self) -> bool; + +"#, + r#" +/// Returns `true` if this interval has a finite start. + + #[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::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::curve::interval::Interval; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Interval {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::FloatOrd; + +"#, + r#" + + #[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 lt(&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; + +"#, + r#" + + #[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 ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct FloatOrd(f32); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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. + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + normal: bevy::math::prelude::Vec3, + #[proxy] + half_size: bevy::math::prelude::Vec2, + ) -> bevy::math::primitives::Plane3d; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::math::primitives::Plane3d; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Plane3d { + #[lua(output(proxy))] + normal: bevy::math::prelude::Dir3, + #[lua(output(proxy))] + half_size: bevy::math::prelude::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn new( + #[proxy] + a: bevy::math::prelude::Vec3, + #[proxy] + b: bevy::math::prelude::Vec3, + #[proxy] + c: bevy::math::prelude::Vec3, + #[proxy] + d: bevy::math::prelude::Vec3, + ) -> bevy::math::primitives::Tetrahedron; + +"#, + r#" +/// Get the signed volume of the tetrahedron. +/// If it's negative, the normal vector of the face defined by +/// the first three points using the right-hand rule points +/// away from the fourth vertex. + + #[lua(kind = "Method")] + fn signed_volume(&self) -> f32; + +"#, + r#" +/// Get the centroid of the tetrahedron. +/// This function finds the geometric center of the tetrahedron +/// by averaging the vertices: `centroid = (a + b + c + d) / 4`. + + #[lua(kind = "Method", output(proxy))] + fn centroid(&self) -> bevy::math::prelude::Vec3; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +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 { + 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( + "Isometry2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Isometry3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Ray2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Ray3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Rot2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Dir2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Dir3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Dir3A", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "IRect", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Rect", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "URect", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Aabb2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BoundingCircle", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaBoundingCircle, + >::new, + )?; + instances + .add_instance( + "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", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Capsule2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "CircularSector", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaCircularSector, + >::new, + )?; + instances + .add_instance( + "CircularSegment", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaCircularSegment, + >::new, + )?; + instances + .add_instance( + "Ellipse", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Plane2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Rectangle", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "RegularPolygon", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaRegularPolygon, + >::new, + )?; + instances + .add_instance( + "Rhombus", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Segment2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Triangle2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Sphere", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Cuboid", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Cylinder", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "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", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Torus", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Triangle3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "RayCast2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AabbCast2d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BoundingCircleCast", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaBoundingCircleCast, + >::new, + )?; + instances + .add_instance( + "RayCast3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "AabbCast3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BoundingSphereCast", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaBoundingSphereCast, + >::new, + )?; + instances + .add_instance( + "Plane3d", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Tetrahedron", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + Ok(()) + } +} +pub struct BevyMathAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { + 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( + "BevyMathAPI", + |tw| { + tw.document_global_instance::() + .expect("Something went wrong documenting globals") + .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< + LuaIsometry3d, + >, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaBoundingCircle, + >, + >() + .process_type::() + .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, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaCapsule2d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaCircularSector, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaCircularSegment, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaRectangle, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaRegularPolygon, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaSegment2d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaTriangle2d, + >, + >() + .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, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaCylinder, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaCapsule3d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaSegment3d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaTriangle3d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaRayCast2d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAabbCast2d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaBoundingCircleCast, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaRayCast3d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAabbCast3d, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + 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< + LuaTetrahedron, + >, + >() + .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::(); + 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::(); + 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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs new file mode 100644 index 0000000000..9c6497b6a5 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -0,0 +1,22743 @@ +// @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)] +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 = "std::sync::atomic::AtomicBool", + functions[r#" +/// Creates a new `AtomicBool`. +/// # Examples +/// ``` +/// use std::sync::atomic::AtomicBool; +/// let atomic_true = AtomicBool::new(true); +/// let atomic_false = AtomicBool::new(false); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicI16; +///let atomic_forty_two = AtomicI16::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicI32; +///let atomic_forty_two = AtomicI32::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicI64; +///let atomic_forty_two = AtomicI64::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicI8; +///let atomic_forty_two = AtomicI8::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicIsize; +///let atomic_forty_two = AtomicIsize::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicU16; +///let atomic_forty_two = AtomicU16::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicU32; +///let atomic_forty_two = AtomicU32::new(42); +/// ``` + + #[lua(kind = "Function", output(proxy))] + 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 { + 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::sync::atomic::AtomicU64; +///let atomic_forty_two = AtomicU64::new(42); +/// ``` + + #[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#" +#[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 +/// ``` +///use std::sync::atomic::AtomicU8; +///let atomic_forty_two = AtomicU8::new(42); +/// ``` + + #[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#" +#[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::sync::atomic::AtomicUsize; +///let atomic_forty_two = AtomicUsize::new(42); +/// ``` + + #[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#" +#[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)] +/// use std::time::Duration; +/// assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); +/// assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn saturating_mul(self, rhs: u32) -> bevy::utils::Duration; + +"#, + r#" +/// Returns the number of seconds contained by this `Duration` as `f64`. +/// The returned value includes the fractional (nanosecond) part of the duration. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur = Duration::new(2, 700_000_000); +/// assert_eq!(dur.as_secs_f64(), 2.7); +/// ``` + + #[lua(kind = "Method")] + fn as_secs_f64(&self) -> f64; + +"#, + r#" +/// Returns the number of seconds contained by this `Duration` as `f32`. +/// The returned value includes the fractional (nanosecond) part of the duration. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur = Duration::new(2, 700_000_000); +/// assert_eq!(dur.as_secs_f32(), 2.7); +/// ``` + + #[lua(kind = "Method")] + fn as_secs_f32(&self) -> f32; + +"#, + r#" +/// Creates a new `Duration` from the specified number of seconds represented +/// as `f64`. +/// # Panics +/// This constructor will panic if `secs` is negative, overflows `Duration` or not finite. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let res = Duration::from_secs_f64(0.0); +/// assert_eq!(res, Duration::new(0, 0)); +/// let res = Duration::from_secs_f64(1e-20); +/// assert_eq!(res, Duration::new(0, 0)); +/// let res = Duration::from_secs_f64(4.2e-7); +/// assert_eq!(res, Duration::new(0, 420)); +/// let res = Duration::from_secs_f64(2.7); +/// assert_eq!(res, Duration::new(2, 700_000_000)); +/// let res = Duration::from_secs_f64(3e10); +/// assert_eq!(res, Duration::new(30_000_000_000, 0)); +/// // subnormal float +/// let res = Duration::from_secs_f64(f64::from_bits(1)); +/// assert_eq!(res, Duration::new(0, 0)); +/// // conversion uses rounding +/// let res = Duration::from_secs_f64(0.999e-9); +/// assert_eq!(res, Duration::new(0, 1)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_secs_f64(secs: f64) -> bevy::utils::Duration; + +"#, + r#" +/// Creates a new `Duration` from the specified number of seconds represented +/// as `f32`. +/// # Panics +/// This constructor will panic if `secs` is negative, overflows `Duration` or not finite. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let res = Duration::from_secs_f32(0.0); +/// assert_eq!(res, Duration::new(0, 0)); +/// let res = Duration::from_secs_f32(1e-20); +/// assert_eq!(res, Duration::new(0, 0)); +/// let res = Duration::from_secs_f32(4.2e-7); +/// assert_eq!(res, Duration::new(0, 420)); +/// let res = Duration::from_secs_f32(2.7); +/// assert_eq!(res, Duration::new(2, 700_000_048)); +/// let res = Duration::from_secs_f32(3e10); +/// assert_eq!(res, Duration::new(30_000_001_024, 0)); +/// // subnormal float +/// let res = Duration::from_secs_f32(f32::from_bits(1)); +/// assert_eq!(res, Duration::new(0, 0)); +/// // conversion uses rounding +/// let res = Duration::from_secs_f32(0.999e-9); +/// assert_eq!(res, Duration::new(0, 1)); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_secs_f32(secs: f32) -> bevy::utils::Duration; + +"#, + r#" +/// Multiplies `Duration` by `f64`. +/// # Panics +/// This method will panic if result is negative, overflows `Duration` or not finite. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur = Duration::new(2, 700_000_000); +/// assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000)); +/// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn mul_f64(self, rhs: f64) -> bevy::utils::Duration; + +"#, + r#" +/// Multiplies `Duration` by `f32`. +/// # Panics +/// This method will panic if result is negative, overflows `Duration` or not finite. +/// # Examples +/// ``` +/// 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(847_800, 0)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn mul_f32(self, rhs: f32) -> bevy::utils::Duration; + +"#, + r#" +/// Divides `Duration` by `f64`. +/// # Panics +/// This method will panic if result is negative, overflows `Duration` or not finite. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur = Duration::new(2, 700_000_000); +/// assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611)); +/// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn div_f64(self, rhs: f64) -> bevy::utils::Duration; + +"#, + r#" +/// Divides `Duration` by `f32`. +/// # Panics +/// This method will panic if result is negative, overflows `Duration` or not finite. +/// # Examples +/// ``` +/// use std::time::Duration; +/// let dur = Duration::new(2, 700_000_000); +/// // note that due to rounding errors result is slightly +/// // different from 0.859_872_611 +/// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_580)); +/// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn div_f32(self, rhs: f32) -> bevy::utils::Duration; + +"#, + 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(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(kind = "Method")] + fn div_duration_f32(self, #[proxy] rhs: bevy::utils::Duration) -> f32; + +"#, + 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; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: u32) -> bevy::utils::Duration; + +"#, + 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) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &bevy_utils::Instant) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::utils::Instant; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; + +"#, + 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 + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] other: bevy::utils::Instant) -> bevy::utils::Duration; + +"#, + r#" +/// Returns an instant corresponding to "now". +/// # Examples +/// ``` +/// use std::time::Instant; +/// let now = Instant::now(); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn now() -> bevy::utils::Instant; + +"#, + 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 `earlier` was later than `self`. Currently this +/// method saturates. Future versions may reintroduce the panic in some circumstances. +/// See [Monotonicity]. +/// [Monotonicity]: Instant#monotonicity +/// # Examples +/// ```no_run +/// use std::time::{Duration, Instant}; +/// use std::thread::sleep; +/// let now = Instant::now(); +/// sleep(Duration::new(1, 0)); +/// let new_now = Instant::now(); +/// println!("{:?}", new_now.duration_since(now)); +/// println!("{:?}", now.duration_since(new_now)); // 0ns +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn duration_since( + &self, + #[proxy] + earlier: bevy::utils::Instant, + ) -> bevy::utils::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. +/// # Examples +/// ```no_run +/// use std::time::{Duration, Instant}; +/// use std::thread::sleep; +/// let now = Instant::now(); +/// sleep(Duration::new(1, 0)); +/// let new_now = Instant::now(); +/// println!("{:?}", new_now.saturating_duration_since(now)); +/// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn saturating_duration_since( + &self, + #[proxy] + earlier: bevy::utils::Instant, + ) -> bevy::utils::Duration; + +"#, + r#" +/// Returns the amount of time elapsed since this instant. +/// # Panics +/// Previous Rust versions panicked when the current time was earlier than self. Currently this +/// method returns a Duration of zero in that case. Future versions may reintroduce the panic. +/// See [Monotonicity]. +/// [Monotonicity]: Instant#monotonicity +/// # Examples +/// ```no_run +/// use std::thread::sleep; +/// use std::time::{Duration, Instant}; +/// let instant = Instant::now(); +/// let three_secs = Duration::from_secs(3); +/// sleep(three_secs); +/// assert!(instant.elapsed() >= three_secs); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn elapsed(&self) -> bevy::utils::Duration; + +"#, + r#" +/// # 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. + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Instant(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "std::path::PathBuf", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &std::path::PathBuf) -> bool; + +"#, + r#" +/// Allocates an empty `PathBuf`. +/// # Examples +/// ``` +/// use std::path::PathBuf; +/// let path = PathBuf::new(); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn new() -> std::path::PathBuf; + +"#, + r#" +/// Creates a new `PathBuf` with a given capacity used to create the +/// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`]. +/// # Examples +/// ``` +/// use std::path::PathBuf; +/// let mut path = PathBuf::with_capacity(10); +/// let capacity = path.capacity(); +/// // This push is done without reallocating +/// path.push(r"C:\"); +/// assert_eq!(capacity, path.capacity()); +/// ``` +/// [`with_capacity`]: OsString::with_capacity + + #[lua(kind = "Function", output(proxy))] + fn with_capacity(capacity: usize) -> std::path::PathBuf; + +"#, + r#" +/// Truncates `self` to [`self.parent`]. +/// Returns `false` and does nothing if [`self.parent`] is [`None`]. +/// Otherwise, returns `true`. +/// [`self.parent`]: Path::parent +/// # Examples +/// ``` +/// use std::path::{Path, PathBuf}; +/// let mut p = PathBuf::from("/spirited/away.rs"); +/// p.pop(); +/// assert_eq!(Path::new("/spirited"), p); +/// p.pop(); +/// assert_eq!(Path::new("/"), p); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn pop(&mut self) -> bool; + +"#, + r#" +/// Invokes [`capacity`] on the underlying instance of [`OsString`]. +/// [`capacity`]: OsString::capacity + + #[lua(kind = "Method")] + fn capacity(&self) -> usize; + +"#, + r#" +/// Invokes [`clear`] on the underlying instance of [`OsString`]. +/// [`clear`]: OsString::clear + + #[lua(kind = "MutatingMethod")] + fn clear(&mut self) -> (); + +"#, + r#" +/// Invokes [`reserve`] on the underlying instance of [`OsString`]. +/// [`reserve`]: OsString::reserve + + #[lua(kind = "MutatingMethod")] + fn reserve(&mut self, additional: usize) -> (); + +"#, + r#" +/// Invokes [`reserve_exact`] on the underlying instance of [`OsString`]. +/// [`reserve_exact`]: OsString::reserve_exact + + #[lua(kind = "MutatingMethod")] + fn reserve_exact(&mut self, additional: usize) -> (); + +"#, + r#" +/// Invokes [`shrink_to_fit`] on the underlying instance of [`OsString`]. +/// [`shrink_to_fit`]: OsString::shrink_to_fit + + #[lua(kind = "MutatingMethod")] + fn shrink_to_fit(&mut self) -> (); + +"#, + r#" +/// Invokes [`shrink_to`] on the underlying instance of [`OsString`]. +/// [`shrink_to`]: OsString::shrink_to + + #[lua(kind = "MutatingMethod")] + fn shrink_to(&mut self, min_capacity: usize) -> (); + +"#, + 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", + )] + fn clone_from(&mut self, #[proxy] source: &std::path::PathBuf) -> (); + +"#, + 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> std::ops::RangeFull; + +"#, + 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#" +#[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#" + + #[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` 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#" +/// 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#" +/// Creates a new rotation quaternion. +/// This should generally not be called manually unless you know what you are doing. +/// Use one of the other constructors instead such as `identity` or `from_axis_angle`. +/// `from_xyzw` is mostly used by unit tests and `serde` deserialization. +/// # Preconditions +/// This function does not check if the input is normalized, it is up to the user to +/// provide normalized input or to normalized the resulting quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_xyzw(x: f32, y: f32, z: f32, w: f32) -> bevy::math::Quat; + +"#, + r#" +/// Creates a rotation quaternion from an array. +/// # Preconditions +/// This function does not check if the input is normalized, it is up to the user to +/// provide normalized input or to normalized the resulting quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f32; 4]) -> bevy::math::Quat; + +"#, + r#" +/// Creates a new rotation quaternion from a 4D vector. +/// # Preconditions +/// This function does not check if the input is normalized, it is up to the user to +/// provide normalized input or to normalized the resulting quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_vec4(#[proxy] v: bevy::math::Vec4) -> bevy::math::Quat; + +"#, + r#" +/// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). +/// The axis must be a unit vector. +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Quat; + +"#, + r#" +/// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. +/// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_scaled_axis(#[proxy] v: bevy::math::Vec3) -> bevy::math::Quat; + +"#, + r#" +/// Creates a quaternion from the `angle` (in radians) around the x axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f32) -> bevy::math::Quat; + +"#, + r#" +/// Creates a quaternion from the `angle` (in radians) around the y axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f32) -> bevy::math::Quat; + +"#, + r#" +/// Creates a quaternion from the `angle` (in radians) around the z axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f32) -> bevy::math::Quat; + +"#, + r#" +/// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + euler: bevy::math::EulerRot, + a: f32, + b: f32, + c: f32, + ) -> bevy::math::Quat; + +"#, + 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; + +"#, + 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 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; + +"#, + r#" +/// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the +/// plane spanned by the two vectors. Will rotate at most 180 degrees. +/// The inputs must be unit vectors. +/// `from_rotation_arc(from, to) * from ≈ to`. +/// For near-singular cases (from≈to and from≈-to) the current implementation +/// is only accurate to about 0.001 (for `f32`). +/// # Panics +/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_arc( + #[proxy] + from: bevy::math::Vec3, + #[proxy] + to: bevy::math::Vec3, + ) -> bevy::math::Quat; + +"#, + r#" +/// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means +/// that the resulting quaternion will rotate `from` so that it is colinear with `to`. +/// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 +/// degrees. +/// The inputs must be unit vectors. +/// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. +/// # Panics +/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_arc_colinear( + #[proxy] + from: bevy::math::Vec3, + #[proxy] + to: bevy::math::Vec3, + ) -> bevy::math::Quat; + +"#, + r#" +/// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is +/// around the z axis. Will rotate at most 180 degrees. +/// The inputs must be unit vectors. +/// `from_rotation_arc_2d(from, to) * from ≈ to`. +/// For near-singular cases (from≈to and from≈-to) the current implementation +/// is only accurate to about 0.001 (for `f32`). +/// # Panics +/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_arc_2d( + #[proxy] + from: bevy::math::Vec2, + #[proxy] + to: bevy::math::Vec2, + ) -> bevy::math::Quat; + +"#, + r#" +/// Returns the rotation axis scaled by the rotation in radians. + + #[lua(kind = "Method", output(proxy))] + fn to_scaled_axis(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the rotation angles for the given euler rotation sequence. + + #[lua(kind = "Method")] + fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f32; 4]; + +"#, + r#" +/// Returns the vector part of the quaternion. + + #[lua(kind = "Method", output(proxy))] + fn xyz(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the quaternion conjugate of `self`. For a unit quaternion the +/// conjugate is also the inverse. + + #[lua(kind = "Method", output(proxy))] + fn conjugate(self) -> bevy::math::Quat; + +"#, + r#" +/// Returns the inverse of a normalized quaternion. +/// Typically quaternion inverse returns the conjugate of a normalized quaternion. +/// Because `self` is assumed to already be unit length this method *does not* normalize +/// before returning the conjugate. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(self) -> bevy::math::Quat; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. The dot product is +/// equal to the cosine of the angle between two quaternion rotations. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::Quat) -> f32; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f32; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is generally faster than `length()` as it avoids a square +/// root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f32; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f32; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// For valid results, `self` must _not_ be of length zero. +/// Panics +/// Will panic if `self` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::Quat; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NAN`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + r#" +/// Returns whether `self` of length `1.0` or not. +/// Uses a precision threshold of `1e-6`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" + + #[lua(kind = "Method")] + fn is_near_identity(self) -> bool; + +"#, + r#" +/// Returns the angle (in radians) for the minimal rotation +/// for transforming this quaternion into another. +/// Both quaternions must be normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[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` +/// is less than or equal to `max_abs_diff`. +/// This can be used to compare if two quaternions 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::Quat, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. +/// # Panics +/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] end: bevy::math::Quat, s: f32) -> bevy::math::Quat; + +"#, + r#" +/// 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::Quat, s: f32) -> bevy::math::Quat; + +"#, + 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::Vec3) -> 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(kind = "Method", output(proxy))] + fn mul_quat(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; + +"#, + 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. + + #[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#" +/// 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::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")] +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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + 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. + + #[lua(kind = "Function", output(proxy))] + fn new(x: f32, y: f32, z: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: f32) -> bevy::math::Vec3; + +"#, + 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::Vec3, + #[proxy] + if_false: bevy::math::Vec3, + ) -> bevy::math::Vec3; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f32; 3]) -> bevy::math::Vec3; + +"#, + r#" +/// `[x, y, z]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f32; 3]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::Vec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::Vec3) -> f32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::Vec3, + #[proxy] + max: bevy::math::Vec3, + ) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec3; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f32; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f32; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f32; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::Vec3) -> f32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::Vec3) -> f32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::Vec3; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::Vec3, s: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::Vec3, d: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + 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 vectors 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::Vec3, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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; + +"#, + 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. + + #[lua(kind = "Method", output(proxy))] + fn mul_add( + self, + #[proxy] + a: bevy::math::Vec3, + #[proxy] + b: bevy::math::Vec3, + ) -> bevy::math::Vec3; + +"#, + 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::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")] + fn angle_between(self, #[proxy] rhs: bevy::math::Vec3) -> 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::Vec3; + +"#, + 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::Vec3; + +"#, + 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, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> 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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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, rhs: f32) -> 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( + 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 = "add", + metamethod = "Add", + )] + 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#" + + #[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(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 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::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))] + fn new(x: i32, y: i32) -> bevy::math::IVec2; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: i32) -> bevy::math::IVec2; + +"#, + 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::BVec2, + #[proxy] + if_true: bevy::math::IVec2, + #[proxy] + if_false: bevy::math::IVec2, + ) -> bevy::math::IVec2; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [i32; 2]) -> bevy::math::IVec2; + +"#, + r#" +/// `[x, y]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [i32; 2]; + +"#, + r#" +/// Creates a 3D vector from `self` and the given `z` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, z: i32) -> bevy::math::IVec3; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: i32) -> bevy::math::IVec2; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: i32) -> bevy::math::IVec2; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::IVec2) -> i32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Component-wise clamping of values, similar to [`i32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::IVec2, + #[proxy] + max: bevy::math::IVec2, + ) -> bevy::math::IVec2; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> i32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> i32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> i32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> i32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `0` if the number is zero +/// - `1` if the number is positive +/// - `-1` if the number is negative + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> i32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::IVec2) -> i32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. +/// [Euclidean division]: i32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector that is equal to `self` rotated by 90 degrees. + + #[lua(kind = "Method", output(proxy))] + fn perp(self) -> bevy::math::IVec2; + +"#, + r#" +/// The perpendicular dot product of `self` and `rhs`. +/// Also known as the wedge product, 2D cross product, and determinant. + + #[lua(kind = "Method")] + fn perp_dot(self, #[proxy] rhs: bevy::math::IVec2) -> i32; + +"#, + r#" +/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, +/// then this just rotation. This is what you usually want. Otherwise, +/// it will be like a rotation with a multiplication by `self`'s length. + + #[lua(kind = "Method", output(proxy))] + fn rotate(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec2(&self) -> bevy::math::Vec2; + +"#, + 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 `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#" +/// Casts all elements of `self` to `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec2(&self) -> bevy::math::U64Vec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + 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::IVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::IVec2; + +"#, + r#" +/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_unsigned( + self, + #[proxy] + rhs: bevy::math::UVec2, + ) -> bevy::math::IVec2; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::UVec2, + ) -> 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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> 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::Add", + kind = "MetaFunction", + output(proxy), + 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; + +"#, + 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::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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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: &glam::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, 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::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i32) -> 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::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", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + 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#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::IVec3) -> bool; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + 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#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: i32) -> 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::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; + +"#, + 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::IVec3, + #[proxy] + if_false: bevy::math::IVec3, + ) -> bevy::math::IVec3; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [i32; 3]) -> bevy::math::IVec3; + +"#, + r#" +/// `[x, y, z]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [i32; 3]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::IVec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: i32) -> bevy::math::IVec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: i32) -> bevy::math::IVec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: i32) -> bevy::math::IVec3; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::IVec3) -> i32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Component-wise clamping of values, similar to [`i32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::IVec3, + #[proxy] + max: bevy::math::IVec3, + ) -> bevy::math::IVec3; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> i32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> i32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> i32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> i32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `0` if the number is zero +/// - `1` if the number is positive +/// - `-1` if the number is negative + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> i32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::IVec3) -> i32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. +/// [Euclidean division]: i32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec3(&self) -> bevy::math::Vec3; + +"#, + 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 `f64`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec3(&self) -> bevy::math::DVec3; + +"#, + 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#" +/// 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + 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::IVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::IVec3; + +"#, + r#" +/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_unsigned( + self, + #[proxy] + rhs: bevy::math::UVec3, + ) -> bevy::math::IVec3; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::UVec3, + ) -> 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 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", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(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: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + 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::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::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: i32) -> 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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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, 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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + 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#" +/// 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#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [i32; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`IVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::IVec3; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `w`. + + #[lua(kind = "Method", output(proxy))] + fn with_w(self, w: i32) -> bevy::math::IVec4; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::IVec4) -> i32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Component-wise clamping of values, similar to [`i32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::IVec4, + #[proxy] + max: bevy::math::IVec4, + ) -> bevy::math::IVec4; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> i32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> i32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> i32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> i32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `0` if the number is zero +/// - `1` if the number is positive +/// - `-1` if the number is negative + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> i32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::IVec4) -> i32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. +/// [Euclidean division]: i32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + 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 `f64`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec4(&self) -> bevy::math::DVec4; + +"#, + 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#" +/// 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + 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::IVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::IVec4; + +"#, + r#" +/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_unsigned( + self, + #[proxy] + rhs: bevy::math::UVec4, + ) -> bevy::math::IVec4; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::UVec4, + ) -> 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#" + + #[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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::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::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::IVec4) -> 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 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))] + fn new(x: i64, y: i64) -> bevy::math::I64Vec2; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: i64) -> bevy::math::I64Vec2; + +"#, + 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::BVec2, + #[proxy] + if_true: bevy::math::I64Vec2, + #[proxy] + if_false: bevy::math::I64Vec2, + ) -> bevy::math::I64Vec2; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [i64; 2]) -> bevy::math::I64Vec2; + +"#, + r#" +/// `[x, y]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [i64; 2]; + +"#, + r#" +/// Creates a 3D vector from `self` and the given `z` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, z: i64) -> bevy::math::I64Vec3; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: i64) -> bevy::math::I64Vec2; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: i64) -> bevy::math::I64Vec2; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Component-wise clamping of values, similar to [`i64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::I64Vec2, + #[proxy] + max: bevy::math::I64Vec2, + ) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> i64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> i64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> i64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> i64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `0` if the number is zero +/// - `1` if the number is positive +/// - `-1` if the number is negative + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> i64; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. +/// [Euclidean division]: i64::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector that is equal to `self` rotated by 90 degrees. + + #[lua(kind = "Method", output(proxy))] + fn perp(self) -> bevy::math::I64Vec2; + +"#, + r#" +/// The perpendicular dot product of `self` and `rhs`. +/// Also known as the wedge product, 2D cross product, and determinant. + + #[lua(kind = "Method")] + fn perp_dot(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; + +"#, + r#" +/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, +/// then this just rotation. This is what you usually want. Otherwise, +/// it will be like a rotation with a multiplication by `self`'s length. + + #[lua(kind = "Method", output(proxy))] + fn rotate(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec2(&self) -> bevy::math::Vec2; + +"#, + 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 `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec2(&self) -> bevy::math::U64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec2, + ) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec2, + ) -> bevy::math::I64Vec2; + +"#, + r#" +/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec2, + ) -> bevy::math::I64Vec2; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec2, + ) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(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: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + 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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: i64) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i64) -> 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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> 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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::I64Vec2) -> 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::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> 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 = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::I64Vec2) -> 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: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: i64) -> 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::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::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + 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))] + fn new(x: i64, y: i64, z: i64) -> bevy::math::I64Vec3; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: i64) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3, + #[proxy] + if_false: bevy::math::I64Vec3, + ) -> bevy::math::I64Vec3; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [i64; 3]) -> bevy::math::I64Vec3; + +"#, + r#" +/// `[x, y, z]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [i64; 3]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: i64) -> bevy::math::I64Vec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::I64Vec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: i64) -> bevy::math::I64Vec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: i64) -> bevy::math::I64Vec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: i64) -> bevy::math::I64Vec3; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::I64Vec3) -> i64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Component-wise clamping of values, similar to [`i64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::I64Vec3, + #[proxy] + max: bevy::math::I64Vec3, + ) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> i64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> i64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> i64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> i64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `0` if the number is zero +/// - `1` if the number is positive +/// - `-1` if the number is negative + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> i64; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec3) -> i64; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. +/// [Euclidean division]: i64::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec3(&self) -> bevy::math::Vec3; + +"#, + 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 `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 `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec3(&self) -> bevy::math::U64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec3, + ) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec3, + ) -> bevy::math::I64Vec3; + +"#, + r#" +/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec3, + ) -> bevy::math::I64Vec3; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec3, + ) -> 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#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::I64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::I64Vec3; + +"#, + 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::I64Vec3) -> bool; + +"#, + 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::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::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#" + + #[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; + +"#, + 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::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#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: i64, y: i64, z: i64, w: i64) -> bevy::math::I64Vec4; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: i64) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4, + #[proxy] + if_false: bevy::math::I64Vec4, + ) -> bevy::math::I64Vec4; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [i64; 4]) -> bevy::math::I64Vec4; + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [i64; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`I64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::I64Vec3; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: i64) -> bevy::math::I64Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: i64) -> bevy::math::I64Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: i64) -> bevy::math::I64Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `w`. + + #[lua(kind = "Method", output(proxy))] + fn with_w(self, w: i64) -> bevy::math::I64Vec4; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::I64Vec4) -> i64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" +/// Component-wise clamping of values, similar to [`i64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::I64Vec4, + #[proxy] + max: bevy::math::I64Vec4, + ) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> i64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> i64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> i64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> i64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `0` if the number is zero +/// - `1` if the number is positive +/// - `-1` if the number is negative + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> i64; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec4) -> i64; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// # Panics +/// This function will panic if any `rhs` element is 0 or the division results in overflow. +/// [Euclidean division]: i64::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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 `f64`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec4(&self) -> bevy::math::DVec4; + +"#, + 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 `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec4(&self) -> bevy::math::U64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_add_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec4, + ) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_sub_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec4, + ) -> bevy::math::I64Vec4; + +"#, + r#" +/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_unsigned( + self, + #[proxy] + rhs: bevy::math::U64Vec4, + ) -> bevy::math::I64Vec4; + +"#, + r#" +/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. +/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_sub_unsigned( + self, + #[proxy] + 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", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + 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::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(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, rhs: i64) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: i64) -> bevy::math::I64Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(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, rhs: i64) -> 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#" + + #[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#" +#[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", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + 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#" + + #[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::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#" + + #[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::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; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: u32, y: u32) -> bevy::math::UVec2; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: u32) -> bevy::math::UVec2; + +"#, + 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::BVec2, + #[proxy] + if_true: bevy::math::UVec2, + #[proxy] + if_false: bevy::math::UVec2, + ) -> bevy::math::UVec2; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [u32; 2]) -> bevy::math::UVec2; + +"#, + r#" +/// `[x, y]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [u32; 2]; + +"#, + r#" +/// Creates a 3D vector from `self` and the given `z` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, z: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: u32) -> bevy::math::UVec2; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: u32) -> bevy::math::UVec2; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::UVec2) -> u32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + +"#, + r#" +/// Component-wise clamping of values, similar to [`u32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::UVec2, + #[proxy] + max: bevy::math::UVec2, + ) -> bevy::math::UVec2; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> u32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> u32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> u32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> u32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> u32; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec2(&self) -> bevy::math::Vec2; + +"#, + 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 `i64`. + + #[lua(kind = "Method", output(proxy))] + fn as_i64vec2(&self) -> bevy::math::I64Vec2; + +"#, + r#" +/// Casts all elements of `self` to `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec2(&self) -> bevy::math::U64Vec2; + +"#, + 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::UVec2) -> bevy::math::UVec2; + +"#, + 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::UVec2) -> bevy::math::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), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn wrapping_mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + +"#, + 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::UVec2) -> bevy::math::UVec2; + +"#, + 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::UVec2) -> bevy::math::UVec2; + +"#, + 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::UVec2) -> bevy::math::UVec2; + +"#, + 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::UVec2) -> bevy::math::UVec2; + +"#, + 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::UVec2) -> bevy::math::UVec2; + +"#, + 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::IVec2) -> bevy::math::UVec2; + +"#, + 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::IVec2) -> bevy::math::UVec2; + +"#, + 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", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u32) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + 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; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u32) -> bevy::math::UVec2; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + 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#" +#[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: u32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct UVec2 { + x: u32, + y: u32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::UVec3) -> bevy::math::UVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(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::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::UVec3) -> 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; + +"#, + 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::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> bevy::math::UVec3; + +"#, + r#" + + #[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]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: u32) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::UVec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: u32) -> bevy::math::UVec3; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::UVec3) -> u32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + r#" +/// Component-wise clamping of values, similar to [`u32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::UVec3, + #[proxy] + max: bevy::math::UVec3, + ) -> bevy::math::UVec3; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> u32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> u32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> u32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> u32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> u32; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec3(&self) -> bevy::math::Vec3; + +"#, + 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 `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 `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#" +/// 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::UVec3) -> bevy::math::UVec3; + +"#, + 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::UVec3) -> bevy::math::UVec3; + +"#, + 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::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::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: bevy::math::UVec3) -> bevy::math::UVec3; + +"#, + 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::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#" + + #[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 = "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: u32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct UVec3 { + x: u32, + y: u32, + z: u32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::UVec4", + functions[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::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::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) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: u32, y: u32, z: u32, w: u32) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: u32) -> bevy::math::UVec4; + +"#, + 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::UVec4, + #[proxy] + if_false: bevy::math::UVec4, + ) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [u32; 4]) -> bevy::math::UVec4; + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [u32; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`UVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::UVec3; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: u32) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: u32) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: u32) -> bevy::math::UVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `w`. + + #[lua(kind = "Method", output(proxy))] + fn with_w(self, w: u32) -> bevy::math::UVec4; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::UVec4) -> u32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" +/// Component-wise clamping of values, similar to [`u32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::UVec4, + #[proxy] + max: bevy::math::UVec4, + ) -> bevy::math::UVec4; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> u32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> u32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> u32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> u32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> u32; + +"#, + 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 `f64`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec4(&self) -> bevy::math::DVec4; + +"#, + 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 `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#" +/// 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::UVec4) -> bevy::math::UVec4; + +"#, + 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::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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u32) -> 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::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, rhs: u32) -> 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, rhs: u32) -> 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::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u32) -> 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(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: u32) -> Result<(),_> { + self.val_mut(|s| Ok(s[*idx] = val))? +} +"#] +)] +struct UVec4 { + x: u32, + y: u32, + z: u32, + w: u32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::U64Vec2", + functions[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::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: u64, y: u64) -> bevy::math::U64Vec2; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: u64) -> bevy::math::U64Vec2; + +"#, + 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::BVec2, + #[proxy] + if_true: bevy::math::U64Vec2, + #[proxy] + if_false: bevy::math::U64Vec2, + ) -> bevy::math::U64Vec2; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [u64; 2]) -> bevy::math::U64Vec2; + +"#, + r#" +/// `[x, y]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [u64; 2]; + +"#, + r#" +/// Creates a 3D vector from `self` and the given `z` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, z: u64) -> bevy::math::U64Vec3; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: u64) -> bevy::math::U64Vec2; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: u64) -> bevy::math::U64Vec2; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::U64Vec2) -> u64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + +"#, + r#" +/// Component-wise clamping of values, similar to [`u64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::U64Vec2, + #[proxy] + max: bevy::math::U64Vec2, + ) -> bevy::math::U64Vec2; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> u64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> u64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> u64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> u64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> u64; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec2(&self) -> bevy::math::Vec2; + +"#, + 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; + +"#, + 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 = "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::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; + +"#, + 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> 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(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, 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( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: u64) -> 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::U64Vec3) -> 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; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: u64) -> bevy::math::U64Vec3; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: u64, y: u64, z: u64) -> bevy::math::U64Vec3; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: u64) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3, + #[proxy] + if_false: bevy::math::U64Vec3, + ) -> bevy::math::U64Vec3; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [u64; 3]) -> bevy::math::U64Vec3; + +"#, + r#" +/// `[x, y, z]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [u64; 3]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::U64Vec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: u64) -> bevy::math::U64Vec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: u64) -> bevy::math::U64Vec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: u64) -> bevy::math::U64Vec3; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::U64Vec3) -> u64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + +"#, + r#" +/// Component-wise clamping of values, similar to [`u64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::U64Vec3, + #[proxy] + max: bevy::math::U64Vec3, + ) -> bevy::math::U64Vec3; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> u64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> u64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> u64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> u64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> u64; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec3(&self) -> bevy::math::Vec3; + +"#, + 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 `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#" +/// 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::U64Vec3) -> bevy::math::U64Vec3; + +"#, + 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::I64Vec3, + ) -> bevy::math::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), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn saturating_add_signed( + self, + #[proxy] + 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#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + 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; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Rem", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, #[proxy] rhs: &glam::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#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::U64Vec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: bevy::math::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", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: u64) -> 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, 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: &glam::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::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; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `w`. + + #[lua(kind = "Method", output(proxy))] + fn with_w(self, w: u64) -> bevy::math::U64Vec4; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::U64Vec4) -> u64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + +"#, + r#" +/// Component-wise clamping of values, similar to [`u64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::U64Vec4, + #[proxy] + max: bevy::math::U64Vec4, + ) -> bevy::math::U64Vec4; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> u64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> u64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> u64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> u64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + +"#, + r#" +/// Computes the squared length of `self`. + + #[lua(kind = "Method")] + fn length_squared(self) -> u64; + +"#, + 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 `f64`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec4(&self) -> bevy::math::DVec4; + +"#, + 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#" +/// 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::U64Vec4) -> bevy::math::U64Vec4; + +"#, + 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::I64Vec4, + ) -> bevy::math::U64Vec4; + +"#, + 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::I64Vec4, + ) -> 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 = "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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + 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#" + + #[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::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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(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::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::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; + +"#, + 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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(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, 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: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: f32, y: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: f32) -> bevy::math::Vec2; + +"#, + 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::BVec2, + #[proxy] + if_true: bevy::math::Vec2, + #[proxy] + if_false: bevy::math::Vec2, + ) -> bevy::math::Vec2; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f32; 2]) -> bevy::math::Vec2; + +"#, + r#" +/// `[x, y]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f32; 2]; + +"#, + r#" +/// Creates a 3D vector from `self` and the given `z` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, z: f32) -> bevy::math::Vec3; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::Vec2, + #[proxy] + max: bevy::math::Vec2, + ) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec2; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f32; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f32; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f32; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::Vec2; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::Vec2, s: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::Vec2, d: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + 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 vectors 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::Vec2, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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; + +"#, + 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. + + #[lua(kind = "Method", output(proxy))] + fn mul_add( + self, + #[proxy] + a: bevy::math::Vec2, + #[proxy] + 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 +/// conjunction with the [`rotate()`][Self::rotate()] method, e.g. +/// `Vec2::from_angle(PI).rotate(Vec2::Y)` will create the vector `[-1, 0]` +/// and rotate [`Vec2::Y`] around it returning `-Vec2::Y`. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f32) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the angle (in radians) of this vector in the range `[-π, +π]`. +/// The input does not need to be a unit vector however it must be non-zero. + + #[lua(kind = "Method")] + fn to_angle(self) -> f32; + +"#, + r#" + + #[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. + + #[lua(kind = "Method", output(proxy))] + fn perp(self) -> bevy::math::Vec2; + +"#, + r#" +/// The perpendicular dot product of `self` and `rhs`. +/// Also known as the wedge product, 2D cross product, and determinant. + + #[lua(kind = "Method")] + fn perp_dot(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + +"#, + r#" +/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, +/// then this just rotation. This is what you usually want. Otherwise, +/// it will be like a rotation with a multiplication by `self`'s length. + + #[lua(kind = "Method", output(proxy))] + fn rotate(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + 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::Vec2, + max_angle: f32, + ) -> bevy::math::Vec2; + +"#, + 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#" +/// Casts all elements of `self` to `u64`. + + #[lua(kind = "Method", output(proxy))] + fn as_u64vec2(&self) -> bevy::math::U64Vec2; + +"#, + 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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> 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 = "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#" +#[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 Vec2 { + x: f32, + y: f32, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Vec3A", + functions[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::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", + )] + 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, + #[proxy] + if_true: bevy::math::Vec3A, + #[proxy] + if_false: bevy::math::Vec3A, + ) -> bevy::math::Vec3A; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f32; 3]) -> bevy::math::Vec3A; + +"#, + r#" +/// `[x, y, z]` + + #[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. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::Vec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::Vec3A, + #[proxy] + max: bevy::math::Vec3A, + ) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec3A; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f32; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f32; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f32; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized( + self, + #[proxy] + rhs: bevy::math::Vec3A, + ) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized( + self, + #[proxy] + rhs: bevy::math::Vec3A, + ) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::Vec3A; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::Vec3A, s: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::Vec3A, d: f32) -> bevy::math::Vec3A; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + 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 vectors 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::Vec3A, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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; + +"#, + 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. + + #[lua(kind = "Method", output(proxy))] + fn mul_add( + self, + #[proxy] + a: bevy::math::Vec3A, + #[proxy] + b: bevy::math::Vec3A, + ) -> bevy::math::Vec3A; + +"#, + 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::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(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", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, rhs: f32) -> 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; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> 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, #[proxy] rhs: &glam::Vec4) -> 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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + 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: &glam::Vec4) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; + +"#, + 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", + kind = "MetaFunction", + output(proxy), + composite = "rem", + metamethod = "Mod", + )] + fn rem(self, rhs: f32) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> bevy::math::Vec4; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::Vec4) -> 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#" +/// Creates a new vector. + + #[lua(kind = "Function", output(proxy))] + fn new(x: f32, y: f32, z: f32, w: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: f32) -> bevy::math::Vec4; + +"#, + 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::BVec4A, + #[proxy] + if_true: bevy::math::Vec4, + #[proxy] + if_false: bevy::math::Vec4, + ) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f32; 4]) -> bevy::math::Vec4; + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f32; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. +/// To truncate to [`Vec3A`] use [`Vec3A::from()`]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::Vec3; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `w`. + + #[lua(kind = "Method", output(proxy))] + fn with_w(self, w: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::Vec4) -> f32; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f32::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::Vec4, + #[proxy] + max: bevy::math::Vec4, + ) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f32; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f32; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f32; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f32; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec4A; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f32; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f32; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f32; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::Vec4) -> f32; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::Vec4) -> f32; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f32::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::Vec4; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::Vec4, s: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::Vec4, d: f32) -> bevy::math::Vec4; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + 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 vectors 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::Vec4, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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; + +"#, + 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. + + #[lua(kind = "Method", output(proxy))] + fn mul_add( + self, + #[proxy] + a: bevy::math::Vec4, + #[proxy] + 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`. + + #[lua(kind = "Method", output(proxy))] + fn as_dvec4(&self) -> bevy::math::DVec4; + +"#, + 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::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(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, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + 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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + 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 = "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) -> (); + +"#, + r#" +/// Creates a new vector mask. + + #[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(kind = "Function", output(proxy))] + fn splat(v: bool) -> bevy::math::BVec2; + +"#, + r#" +/// Creates a new vector mask from a bool array. + + #[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(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 1. + + #[lua(kind = "Method")] + fn test(&self, index: usize) -> bool; + +"#, + r#" +/// Sets the element at `index`. +/// Panics if `index` is greater than 1. + + #[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(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#" +/// 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(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::BVec3; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct BVec3 { + x: bool, + y: bool, + z: bool, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &glam::BVec4) -> bool; + +"#, + r#" +/// Creates a new vector mask. + + #[lua(kind = "Function", output(proxy))] + fn new(x: bool, y: bool, z: bool, w: bool) -> bevy::math::BVec4; + +"#, + r#" +/// Creates a vector mask with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: bool) -> bevy::math::BVec4; + +"#, + r#" +/// Creates a new vector mask from a bool array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [bool; 4]) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a bitmask with the lowest 4 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 3. + + #[lua(kind = "Method")] + fn test(&self, index: usize) -> bool; + +"#, + r#" +/// Sets the element at `index`. +/// Panics if `index` is greater than 3. + + #[lua(kind = "MutatingMethod")] + fn set(&mut self, index: usize, value: bool) -> (); + +"#, + 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) +} +"#] +)] +struct BVec4 { + x: bool, + y: bool, + z: bool, + w: bool, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DVec2", + functions[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::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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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: &glam::DVec2) -> 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::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::Div", + kind = "MetaFunction", + output(proxy), + composite = "div", + metamethod = "Div", + )] + fn div(self, #[proxy] rhs: &glam::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#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, rhs: f64) -> 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; + +"#, + 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::BVec2, + #[proxy] + if_true: bevy::math::DVec2, + #[proxy] + if_false: bevy::math::DVec2, + ) -> bevy::math::DVec2; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f64; 2]) -> bevy::math::DVec2; + +"#, + r#" +/// `[x, y]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f64; 2]; + +"#, + r#" +/// Creates a 3D vector from `self` and the given `z` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, z: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f64) -> bevy::math::DVec2; + +"#, + r#" +/// Creates a 2D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f64) -> bevy::math::DVec2; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::DVec2, + #[proxy] + max: bevy::math::DVec2, + ) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec2; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f64; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f64; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f64; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f64::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized( + self, + #[proxy] + rhs: bevy::math::DVec2, + ) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized( + self, + #[proxy] + rhs: bevy::math::DVec2, + ) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f64) -> bevy::math::DVec2; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::DVec2; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::DVec2, s: f64) -> bevy::math::DVec2; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::DVec2, d: f64) -> bevy::math::DVec2; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + 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 vectors 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::DVec2, max_abs_diff: f64) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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; + +"#, + 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. + + #[lua(kind = "Method", output(proxy))] + 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#" +/// Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in +/// conjunction with the [`rotate()`][Self::rotate()] method, e.g. +/// `DVec2::from_angle(PI).rotate(DVec2::Y)` will create the vector `[-1, 0]` +/// and rotate [`DVec2::Y`] around it returning `-DVec2::Y`. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f64) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the angle (in radians) of this vector in the range `[-π, +π]`. +/// The input does not need to be a unit vector however it must be non-zero. + + #[lua(kind = "Method")] + fn to_angle(self) -> f64; + +"#, + r#" + + #[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. + + #[lua(kind = "Method", output(proxy))] + fn perp(self) -> bevy::math::DVec2; + +"#, + r#" +/// The perpendicular dot product of `self` and `rhs`. +/// Also known as the wedge product, 2D cross product, and determinant. + + #[lua(kind = "Method")] + fn perp_dot(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + +"#, + r#" +/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, +/// then this just rotation. This is what you usually want. Otherwise, +/// it will be like a rotation with a multiplication by `self`'s length. + + #[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`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec2(&self) -> bevy::math::Vec2; + +"#, + 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#" +/// Casts all elements of `self` to `u64`. + + #[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#" + + #[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 = "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#" +#[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 DVec2 { + x: f64, + y: f64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DVec3", + functions[r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(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: &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: &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#" + + #[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( + 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( + 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> 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::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#" +/// `[x, y, z]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f64; 3]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua(kind = "Method", output(proxy))] + fn extend(self, w: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::DVec2; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Computes the cross product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn cross(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::DVec3, + #[proxy] + max: bevy::math::DVec3, + ) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec3; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f64; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f64; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f64; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f64::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized( + self, + #[proxy] + rhs: bevy::math::DVec3, + ) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized( + self, + #[proxy] + rhs: bevy::math::DVec3, + ) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::DVec3; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::DVec3, s: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::DVec3, d: f64) -> bevy::math::DVec3; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + 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 vectors 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::DVec3, max_abs_diff: f64) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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; + +"#, + 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. + + #[lua(kind = "Method", output(proxy))] + fn mul_add( + self, + #[proxy] + a: bevy::math::DVec3, + #[proxy] + b: bevy::math::DVec3, + ) -> bevy::math::DVec3; + +"#, + 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::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")] + fn angle_between(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + +"#, + 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::DVec3; + +"#, + 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::DVec3; + +"#, + r#" +/// Casts all elements of `self` to `f32`. + + #[lua(kind = "Method", output(proxy))] + fn as_vec3(&self) -> bevy::math::Vec3; + +"#, + 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#" + + #[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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f64) -> bevy::math::DVec4; + +"#, + 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::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; + +"#, + 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::DVec4, + #[proxy] + if_false: bevy::math::DVec4, + ) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f64; 4]) -> bevy::math::DVec4; + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f64; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`DVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. + + #[lua(kind = "Method", output(proxy))] + fn truncate(self) -> bevy::math::DVec3; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua(kind = "Method", output(proxy))] + fn with_x(self, x: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua(kind = "Method", output(proxy))] + fn with_y(self, y: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `z`. + + #[lua(kind = "Method", output(proxy))] + fn with_z(self, z: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `w`. + + #[lua(kind = "Method", output(proxy))] + fn with_w(self, w: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::DVec4) -> f64; + +"#, + r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn min(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the maximum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. + + #[lua(kind = "Method", output(proxy))] + fn max(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Component-wise clamping of values, similar to [`f64::clamp`]. +/// Each element in `min` must be less-or-equal to the corresponding element in `max`. +/// # Panics +/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn clamp( + self, + #[proxy] + min: bevy::math::DVec4, + #[proxy] + max: bevy::math::DVec4, + ) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the horizontal minimum of `self`. +/// In other words this computes `min(x, y, ..)`. + + #[lua(kind = "Method")] + fn min_element(self) -> f64; + +"#, + r#" +/// Returns the horizontal maximum of `self`. +/// In other words this computes `max(x, y, ..)`. + + #[lua(kind = "Method")] + fn max_element(self) -> f64; + +"#, + r#" +/// Returns the sum of all elements of `self`. +/// In other words, this computes `self.x + self.y + ..`. + + #[lua(kind = "Method")] + fn element_sum(self) -> f64; + +"#, + r#" +/// Returns the product of all elements of `self`. +/// In other words, this computes `self.x * self.y * ..`. + + #[lua(kind = "Method")] + fn element_product(self) -> f64; + +"#, + r#" +/// Returns a vector mask containing the result of a `==` comparison for each element of +/// `self` and `rhs`. +/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpeq(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `!=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpne(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpge(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `>` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmpgt(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<=` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmple(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector mask containing the result of a `<` comparison for each element of +/// `self` and `rhs`. +/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all +/// elements. + + #[lua(kind = "Method", output(proxy))] + fn cmplt(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + +"#, + r#" +/// Returns a vector containing the absolute value of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn abs(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector with elements representing the sign of `self`. +/// - `1.0` if the number is positive, `+0.0` or `INFINITY` +/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` +/// - `NAN` if the number is `NAN` + + #[lua(kind = "Method", output(proxy))] + fn signum(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector with signs of `rhs` and the magnitudes of `self`. + + #[lua(kind = "Method", output(proxy))] + fn copysign(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. +/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes +/// into the first lowest bit, element `y` into the second, etc. + + #[lua(kind = "Method")] + fn is_negative_bitmask(self) -> u32; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. If any element is either +/// `NaN`, positive or negative infinity, this will return `false`. + + #[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`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + 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(), ...]`. + + #[lua(kind = "Method", output(proxy))] + fn is_nan_mask(self) -> bevy::math::BVec4; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f64; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is faster than `length()` as it avoids a square root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f64; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f64; + +"#, + r#" +/// Computes the Euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance(self, #[proxy] rhs: bevy::math::DVec4) -> f64; + +"#, + r#" +/// Compute the squared euclidean distance between two points in space. + + #[lua(kind = "Method")] + fn distance_squared(self, #[proxy] rhs: bevy::math::DVec4) -> f64; + +"#, + r#" +/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn div_euclid(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. +/// [Euclidean division]: f64::rem_euclid + + #[lua(kind = "Method", output(proxy))] + fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns a +/// fallback value. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be the fallback value. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or(self, #[proxy] fallback: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns `self` normalized to length 1.0 if possible, else returns zero. +/// In particular, if the input is zero (or very close to zero), or non-finite, +/// the result of this operation will be zero. +/// See also [`Self::try_normalize()`]. + + #[lua(kind = "Method", output(proxy))] + fn normalize_or_zero(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns whether `self` is length `1.0` or not. +/// Uses a precision threshold of approximately `1e-4`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be of non-zero length. +/// # Panics +/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the vector projection of `self` onto `rhs`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn project_onto_normalized( + self, + #[proxy] + rhs: bevy::math::DVec4, + ) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the vector rejection of `self` from `rhs`. +/// The vector rejection is the vector perpendicular to the projection of `self` onto +/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. +/// `rhs` must be normalized. +/// # Panics +/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn reject_from_normalized( + self, + #[proxy] + rhs: bevy::math::DVec4, + ) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the nearest integer to a number for each element of `self`. +/// Round half-way cases away from 0.0. + + #[lua(kind = "Method", output(proxy))] + fn round(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the largest integer less than or equal to a number for each +/// element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn floor(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the smallest integer greater than or equal to a number for +/// each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn ceil(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the integer part each element of `self`. This means numbers are +/// always truncated towards zero. + + #[lua(kind = "Method", output(proxy))] + fn trunc(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. +/// Note that this differs from the GLSL implementation of `fract` which returns +/// `self - self.floor()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. +/// Note that this differs from the Rust implementation of `fract` which returns +/// `self - self.trunc()`. +/// Note that this is fast but not precise for large numbers. + + #[lua(kind = "Method", output(proxy))] + fn fract_gl(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing `e^self` (the exponential function) for each element of +/// `self`. + + #[lua(kind = "Method", output(proxy))] + fn exp(self) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing each element of `self` raised to the power of `n`. + + #[lua(kind = "Method", output(proxy))] + fn powf(self, n: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. + + #[lua(kind = "Method", output(proxy))] + fn recip(self) -> bevy::math::DVec4; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly +/// extrapolated. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] rhs: bevy::math::DVec4, s: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Moves towards `rhs` based on the value `d`. +/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to +/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. + + #[lua(kind = "Method", output(proxy))] + fn move_towards(&self, #[proxy] rhs: bevy::math::DVec4, d: f64) -> bevy::math::DVec4; + +"#, + r#" +/// Calculates the midpoint between `self` and `rhs`. +/// The midpoint is the average of, or halfway point between, two vectors. +/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` +/// while being slightly cheaper to compute. + + #[lua(kind = "Method", output(proxy))] + fn midpoint(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + 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 vectors 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::DVec4, max_abs_diff: f64) -> bool; + +"#, + r#" +/// Returns a vector with a length no less than `min` and no more than `max`. +/// # Panics +/// 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`. +/// # 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`. +/// # 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. + + #[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::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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + 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 DVec4 { + x: f64, + y: f64, + z: f64, + w: f64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Mat2", + functions[r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> 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). + + #[lua(kind = "Function", output(proxy))] + fn from_scale_angle( + #[proxy] + scale: bevy::math::Vec2, + angle: f32, + ) -> bevy::math::Mat2; + +"#, + r#" +/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f32) -> bevy::math::Mat2; + +"#, + r#" +/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. + + #[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. + + #[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`. +/// # Panics +/// Panics if `index` is greater than 1. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::Vec2; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 1. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::Vec2; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::Mat2; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f32; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::Mat2; + +"#, + r#" +/// Transforms a 2D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Multiplies two 2x2 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; + +"#, + r#" +/// Adds two 2x2 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; + +"#, + r#" +/// Subtracts two 2x2 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; + +"#, + r#" +/// Multiplies a 2x2 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat2; + +"#, + r#" +/// Divides a 2x2 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f32) -> bevy::math::Mat2; + +"#, + 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/). + + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat2, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Takes the absolute value of each element in `self` + + #[lua(kind = "Method", output(proxy))] + fn abs(&self) -> bevy::math::Mat2; + +"#, + r#" + + #[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#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaVec2::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct Mat2(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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))] + fn from_cols( + #[proxy] + x_axis: bevy::math::Vec3, + #[proxy] + y_axis: bevy::math::Vec3, + #[proxy] + z_axis: bevy::math::Vec3, + ) -> bevy::math::Mat3; + +"#, + r#" +/// Creates a `[f32; 9]` 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; 9]; + +"#, + r#" +/// Creates a `[[f32; 3]; 3]` 3D 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; 3]; 3]; + +"#, + r#" +/// Creates a 3x3 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::Vec3) -> bevy::math::Mat3; + +"#, + r#" +/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. + + #[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. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat3; + +"#, + r#" +/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in +/// radians). +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat3; + +"#, + r#" +/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in +/// radians). + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + order: bevy::math::EulerRot, + a: f32, + b: f32, + 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. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f32) -> bevy::math::Mat3; + +"#, + r#" +/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f32) -> bevy::math::Mat3; + +"#, + r#" +/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f32) -> bevy::math::Mat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D `translation`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Mat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D rotation `angle` (in +/// radians). +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f32) -> bevy::math::Mat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in +/// radians) and `translation`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_scale_angle_translation( + #[proxy] + scale: bevy::math::Vec2, + angle: f32, + #[proxy] + translation: bevy::math::Vec2, + ) -> bevy::math::Mat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. +/// # Panics +/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Mat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2x2 matrix. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_mat2(#[proxy] m: bevy::math::Mat2) -> bevy::math::Mat3; + +"#, + r#" +/// Returns the matrix column for the given `index`. +/// # Panics +/// Panics if `index` is greater than 2. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::Vec3; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 2. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::Vec3; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::Mat3; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f32; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::Mat3; + +"#, + r#" +/// Transforms the given 2D vector as a point. +/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Rotates the given 2D vector. +/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Transforms a 3D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Transforms a [`Vec3A`]. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Multiplies two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; + +"#, + r#" +/// Adds two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; + +"#, + r#" +/// Subtracts two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; + +"#, + r#" +/// Multiplies a 3x3 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat3; + +"#, + r#" +/// Divides a 3x3 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f32) -> bevy::math::Mat3; + +"#, + 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/). + + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat3, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Takes the absolute value of each element in `self` + + #[lua(kind = "Method", output(proxy))] + fn abs(&self) -> bevy::math::Mat3; + +"#, + r#" + + #[lua(kind = "Method", output(proxy))] + fn as_dmat3(&self) -> 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::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; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Mat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + 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; + +"#, + 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#" + + #[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(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaVec3::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct Mat3 { + #[lua(output(proxy))] + x_axis: bevy::math::Vec3, + #[lua(output(proxy))] + y_axis: bevy::math::Vec3, + #[lua(output(proxy))] + z_axis: bevy::math::Vec3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Mat3A", + functions[r#" +/// Creates a 3x3 matrix from three column vectors. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::Vec3A, + #[proxy] + y_axis: bevy::math::Vec3A, + #[proxy] + z_axis: bevy::math::Vec3A, + ) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates a `[f32; 9]` 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; 9]; + +"#, + r#" +/// Creates a `[[f32; 3]; 3]` 3D 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; 3]; 3]; + +"#, + r#" +/// Creates a 3x3 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::Vec3) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. + + #[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. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in +/// radians). +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in +/// radians). + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + order: bevy::math::EulerRot, + a: f32, + b: f32, + 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. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f32) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f32) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f32) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D `translation`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D rotation `angle` (in +/// radians). +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f32) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in +/// radians) and `translation`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_scale_angle_translation( + #[proxy] + scale: bevy::math::Vec2, + angle: f32, + #[proxy] + translation: bevy::math::Vec2, + ) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. +/// # Panics +/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Mat3A; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2x2 matrix. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_mat2(#[proxy] m: bevy::math::Mat2) -> bevy::math::Mat3A; + +"#, + r#" +/// Returns the matrix column for the given `index`. +/// # Panics +/// Panics if `index` is greater than 2. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 2. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::Mat3A; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f32; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::Mat3A; + +"#, + r#" +/// Transforms the given 2D vector as a point. +/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Rotates the given 2D vector. +/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Transforms a 3D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Transforms a [`Vec3A`]. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Multiplies two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" +/// Adds two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" +/// Subtracts two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; + +"#, + r#" +/// Multiplies a 3x3 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat3A; + +"#, + r#" +/// Divides a 3x3 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f32) -> bevy::math::Mat3A; + +"#, + 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/). + + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat3A, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Takes the absolute value of each element in `self` + + #[lua(kind = "Method", output(proxy))] + fn abs(&self) -> bevy::math::Mat3A; + +"#, + r#" + + #[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::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::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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + 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#" + + #[lua( + as_trait = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + 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#" + + #[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::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) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaVec3A::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct Mat3A { + #[lua(output(proxy))] + x_axis: bevy::math::Vec3A, + #[lua(output(proxy))] + y_axis: bevy::math::Vec3A, + #[lua(output(proxy))] + z_axis: bevy::math::Vec3A, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Mat4", + functions[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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::Mat4) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a 4x4 matrix from four column vectors. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::Vec4, + #[proxy] + y_axis: bevy::math::Vec4, + #[proxy] + z_axis: bevy::math::Vec4, + #[proxy] + w_axis: bevy::math::Vec4, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a `[f32; 16]` 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; 16]; + +"#, + r#" +/// Creates a `[[f32; 4]; 4]` 4D 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; 4]; 4]; + +"#, + r#" +/// Creates a 4x4 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::Vec4) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3D `scale`, `rotation` and +/// `translation`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale_rotation_translation( + #[proxy] + scale: bevy::math::Vec3, + #[proxy] + rotation: bevy::math::Quat, + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3D `translation`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_translation( + #[proxy] + rotation: bevy::math::Quat, + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given `rotation` quaternion. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3x3 linear transformation +/// matrix. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3x3 linear transformation +/// matrix. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3D `translation`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::Vec3) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix containing a 3D rotation around a normalized +/// rotation `axis` of `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a affine transformation matrix containing a rotation from the given euler +/// rotation sequence and angles (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + order: bevy::math::EulerRot, + a: f32, + b: f32, + 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 +/// `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f32) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix containing a 3D rotation around the y axis of +/// `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f32) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix containing a 3D rotation around the z axis of +/// `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f32) -> bevy::math::Mat4; + +"#, + r#" +/// Creates an affine transformation matrix containing the given 3D non-uniform `scale`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::Vec3) -> bevy::math::Mat4; + +"#, + r#" +/// Returns the matrix column for the given `index`. +/// # Panics +/// Panics if `index` is greater than 3. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::Vec4; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 3. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::Vec4; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::Mat4; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f32; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a left-handed view matrix using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_lh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + dir: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a right-handed view matrix using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_rh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + dir: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a left-handed view matrix using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_lh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + center: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a right-handed view matrix using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_rh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + center: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Mat4; + +"#, + r#" +/// 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 + + #[lua(kind = "Function", output(proxy))] + fn perspective_rh_gl( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + z_far: f32, + ) -> bevy::math::Mat4; + +"#, + 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. + + #[lua(kind = "Function", output(proxy))] + fn perspective_lh( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + z_far: f32, + ) -> bevy::math::Mat4; + +"#, + 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. + + #[lua(kind = "Function", output(proxy))] + fn perspective_rh( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + z_far: f32, + ) -> bevy::math::Mat4; + +"#, + 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` or `z_far` are less than or equal to zero when `glam_assert` is +/// enabled. + + #[lua(kind = "Function", output(proxy))] + fn perspective_infinite_lh( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + ) -> bevy::math::Mat4; + +"#, + r#" +/// 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. + + #[lua(kind = "Function", output(proxy))] + fn perspective_infinite_reverse_lh( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + ) -> bevy::math::Mat4; + +"#, + r#" +/// 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( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + ) -> bevy::math::Mat4; + +"#, + r#" +/// 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( + fov_y_radians: f32, + aspect_ratio: f32, + z_near: f32, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Creates a right-handed orthographic projection matrix with `[-1,1]` depth +/// 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( + left: f32, + right: f32, + bottom: f32, + top: f32, + near: f32, + far: f32, + ) -> bevy::math::Mat4; + +"#, + 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( + left: f32, + right: f32, + bottom: f32, + top: f32, + near: f32, + far: f32, + ) -> bevy::math::Mat4; + +"#, + 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( + left: f32, + right: f32, + bottom: f32, + top: f32, + near: f32, + far: f32, + ) -> bevy::math::Mat4; + +"#, + r#" +/// Transforms the given 3D vector as a point, applying perspective correction. +/// This is the equivalent of multiplying the 3D vector 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_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Transforms the given 3D vector as a point. +/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is +/// `1.0`. +/// This method assumes that `self` contains a valid affine transform. It does not perform +/// a perspective divide, if `self` contains a perspective transform, or if you are unsure, +/// the [`Self::project_point3()`] method should be used instead. +/// # Panics +/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Transforms the give 3D vector as a direction. +/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is +/// `0.0`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. + + #[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. +/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `1.0`. + + #[lua(kind = "Method", output(proxy))] + fn transform_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Transforms the give [`Vec3A`] as 3D vector. +/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `0.0`. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Transforms a 4D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec4(&self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + +"#, + r#" +/// Multiplies two 4x4 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; + +"#, + r#" +/// Adds two 4x4 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; + +"#, + r#" +/// Subtracts two 4x4 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; + +"#, + r#" +/// Multiplies a 4x4 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat4; + +"#, + r#" +/// Divides a 4x4 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f32) -> bevy::math::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/). + + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat4, max_abs_diff: f32) -> bool; + +"#, + r#" +/// Takes the absolute value of each element in `self` + + #[lua(kind = "Method", output(proxy))] + fn abs(&self) -> bevy::math::Mat4; + +"#, + r#" + + #[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#" + + #[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::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, rhs: f32) -> bevy::math::Mat4; + +"#, + 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::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#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaVec4::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct Mat4 { + #[lua(output(proxy))] + x_axis: bevy::math::Vec4, + #[lua(output(proxy))] + y_axis: bevy::math::Vec4, + #[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::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))] + fn from_cols( + #[proxy] + x_axis: bevy::math::DVec2, + #[proxy] + y_axis: bevy::math::DVec2, + ) -> bevy::math::DMat2; + +"#, + r#" +/// Creates a `[f64; 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) -> [f64; 4]; + +"#, + r#" +/// Creates a `[[f64; 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) -> [[f64; 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::DVec2) -> bevy::math::DMat2; + +"#, + r#" +/// 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( + #[proxy] + scale: bevy::math::DVec2, + angle: f64, + ) -> bevy::math::DMat2; + +"#, + r#" +/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f64) -> bevy::math::DMat2; + +"#, + r#" +/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. + + #[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`. +/// # Panics +/// Panics if `index` is greater than 1. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::DVec2; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 1. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::DVec2; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::DMat2; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f64; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::DMat2; + +"#, + r#" +/// Transforms a 2D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Multiplies two 2x2 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; + +"#, + r#" +/// Adds two 2x2 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; + +"#, + r#" +/// Subtracts two 2x2 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; + +"#, + r#" +/// Multiplies a 2x2 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat2; + +"#, + r#" +/// Divides a 2x2 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f64) -> bevy::math::DMat2; + +"#, + 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/). + + #[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::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(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::DMat2) -> bevy::math::DMat2; + +"#, + r#" + + #[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="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaDVec2::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct DMat2 { + #[lua(output(proxy))] + x_axis: bevy::math::DVec2, + #[lua(output(proxy))] + y_axis: bevy::math::DVec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DMat3", + functions[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::DMat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Sub", + kind = "MetaFunction", + output(proxy), + composite = "sub", + metamethod = "Sub", + )] + fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Add", + kind = "MetaFunction", + output(proxy), + composite = "add", + metamethod = "Add", + )] + fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + +"#, + r#" + + #[lua( + 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::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, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Neg", + kind = "MetaFunction", + output(proxy), + composite = "neg", + metamethod = "Unm", + )] + fn neg(self) -> 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#" +/// Creates a 3x3 matrix from three column vectors. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::DVec3, + #[proxy] + y_axis: bevy::math::DVec3, + #[proxy] + z_axis: bevy::math::DVec3, + ) -> bevy::math::DMat3; + +"#, + r#" +/// Creates a `[f64; 9]` 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) -> [f64; 9]; + +"#, + r#" +/// Creates a `[[f64; 3]; 3]` 3D 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) -> [[f64; 3]; 3]; + +"#, + r#" +/// Creates a 3x3 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::DVec3) -> bevy::math::DMat3; + +"#, + r#" +/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. + + #[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. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DMat3; + +"#, + r#" +/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in +/// radians). +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle( + #[proxy] + axis: bevy::math::DVec3, + angle: f64, + ) -> bevy::math::DMat3; + +"#, + r#" +/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in +/// radians). + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + order: bevy::math::EulerRot, + a: f64, + b: f64, + 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. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f64) -> bevy::math::DMat3; + +"#, + r#" +/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f64) -> bevy::math::DMat3; + +"#, + r#" +/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f64) -> bevy::math::DMat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D `translation`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::DVec2) -> bevy::math::DMat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D rotation `angle` (in +/// radians). +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f64) -> bevy::math::DMat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in +/// radians) and `translation`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_scale_angle_translation( + #[proxy] + scale: bevy::math::DVec2, + angle: f64, + #[proxy] + translation: bevy::math::DVec2, + ) -> bevy::math::DMat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. +/// # Panics +/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::DVec2) -> bevy::math::DMat3; + +"#, + r#" +/// Creates an affine transformation matrix from the given 2x2 matrix. +/// The resulting matrix can be used to transform 2D points and vectors. See +/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_mat2(#[proxy] m: bevy::math::DMat2) -> bevy::math::DMat3; + +"#, + r#" +/// Returns the matrix column for the given `index`. +/// # Panics +/// Panics if `index` is greater than 2. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 2. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::DVec3; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::DMat3; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f64; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::DMat3; + +"#, + r#" +/// Transforms the given 2D vector as a point. +/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_point2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Rotates the given 2D vector. +/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Transforms a 3D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Multiplies two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; + +"#, + r#" +/// Adds two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; + +"#, + r#" +/// Subtracts two 3x3 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; + +"#, + r#" +/// Multiplies a 3x3 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat3; + +"#, + r#" +/// Divides a 3x3 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f64) -> bevy::math::DMat3; + +"#, + 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/). + + #[lua(kind = "Method")] + fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DMat3, 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::DMat3; + +"#, + r#" + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaDVec3::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct DMat3 { + #[lua(output(proxy))] + x_axis: bevy::math::DVec3, + #[lua(output(proxy))] + y_axis: bevy::math::DVec3, + #[lua(output(proxy))] + z_axis: bevy::math::DVec3, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::DMat4", + functions[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#" +/// Creates a 4x4 matrix from four column vectors. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::DVec4, + #[proxy] + y_axis: bevy::math::DVec4, + #[proxy] + z_axis: bevy::math::DVec4, + #[proxy] + w_axis: bevy::math::DVec4, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a `[f64; 16]` 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) -> [f64; 16]; + +"#, + r#" +/// Creates a `[[f64; 4]; 4]` 4D 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) -> [[f64; 4]; 4]; + +"#, + r#" +/// Creates a 4x4 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::DVec4) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3D `scale`, `rotation` and +/// `translation`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale_rotation_translation( + #[proxy] + scale: bevy::math::DVec3, + #[proxy] + rotation: bevy::math::DQuat, + #[proxy] + translation: bevy::math::DVec3, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3D `translation`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_translation( + #[proxy] + rotation: bevy::math::DQuat, + #[proxy] + translation: bevy::math::DVec3, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given `rotation` quaternion. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3x3 linear transformation +/// matrix. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix from the given 3D `translation`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::DVec3) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix containing a 3D rotation around a normalized +/// rotation `axis` of `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle( + #[proxy] + axis: bevy::math::DVec3, + angle: f64, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a affine transformation matrix containing a rotation from the given euler +/// rotation sequence and angles (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + order: bevy::math::EulerRot, + a: f64, + b: f64, + 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 +/// `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f64) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix containing a 3D rotation around the y axis of +/// `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f64) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix containing a 3D rotation around the z axis of +/// `angle` (in radians). +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f64) -> bevy::math::DMat4; + +"#, + r#" +/// Creates an affine transformation matrix containing the given 3D non-uniform `scale`. +/// The resulting matrix can be used to transform 3D points and vectors. See +/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. +/// # Panics +/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::DVec3) -> bevy::math::DMat4; + +"#, + r#" +/// Returns the matrix column for the given `index`. +/// # Panics +/// Panics if `index` is greater than 3. + + #[lua(kind = "Method", output(proxy))] + fn col(&self, index: usize) -> bevy::math::DVec4; + +"#, + r#" +/// Returns the matrix row for the given `index`. +/// # Panics +/// Panics if `index` is greater than 3. + + #[lua(kind = "Method", output(proxy))] + fn row(&self, index: usize) -> bevy::math::DVec4; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + r#" +/// Returns the transpose of `self`. + + #[lua(kind = "Method", output(proxy))] + fn transpose(&self) -> bevy::math::DMat4; + +"#, + r#" +/// Returns the determinant of `self`. + + #[lua(kind = "Method")] + fn determinant(&self) -> f64; + +"#, + r#" +/// Returns the inverse of `self`. +/// If the matrix is not invertible the returned matrix will be invalid. +/// # Panics +/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(&self) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a left-handed view matrix using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_lh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + dir: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a right-handed view matrix using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_rh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + dir: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a left-handed view matrix using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_lh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + center: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a right-handed view matrix using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_rh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + center: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DMat4; + +"#, + r#" +/// 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 + + #[lua(kind = "Function", output(proxy))] + fn perspective_rh_gl( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + z_far: f64, + ) -> bevy::math::DMat4; + +"#, + 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. + + #[lua(kind = "Function", output(proxy))] + fn perspective_lh( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + z_far: f64, + ) -> bevy::math::DMat4; + +"#, + 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. + + #[lua(kind = "Function", output(proxy))] + fn perspective_rh( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + z_far: f64, + ) -> bevy::math::DMat4; + +"#, + 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` or `z_far` are less than or equal to zero when `glam_assert` is +/// enabled. + + #[lua(kind = "Function", output(proxy))] + fn perspective_infinite_lh( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + ) -> bevy::math::DMat4; + +"#, + r#" +/// 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. + + #[lua(kind = "Function", output(proxy))] + fn perspective_infinite_reverse_lh( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + ) -> bevy::math::DMat4; + +"#, + r#" +/// 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( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + ) -> bevy::math::DMat4; + +"#, + r#" +/// 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( + fov_y_radians: f64, + aspect_ratio: f64, + z_near: f64, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Creates a right-handed orthographic projection matrix with `[-1,1]` depth +/// 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( + left: f64, + right: f64, + bottom: f64, + top: f64, + near: f64, + far: f64, + ) -> bevy::math::DMat4; + +"#, + 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( + left: f64, + right: f64, + bottom: f64, + top: f64, + near: f64, + far: f64, + ) -> bevy::math::DMat4; + +"#, + 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( + left: f64, + right: f64, + bottom: f64, + top: f64, + near: f64, + far: f64, + ) -> bevy::math::DMat4; + +"#, + r#" +/// Transforms the given 3D vector as a point, applying perspective correction. +/// This is the equivalent of multiplying the 3D vector 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_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Transforms the given 3D vector as a point. +/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is +/// `1.0`. +/// This method assumes that `self` contains a valid affine transform. It does not perform +/// a perspective divide, if `self` contains a perspective transform, or if you are unsure, +/// the [`Self::project_point3()`] method should be used instead. +/// # Panics +/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Transforms the give 3D vector as a direction. +/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is +/// `0.0`. +/// This method assumes that `self` contains a valid affine transform. +/// # Panics +/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Transforms a 4D vector. + + #[lua(kind = "Method", output(proxy))] + fn mul_vec4(&self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +/// Multiplies two 4x4 matrices. + + #[lua(kind = "Method", output(proxy))] + fn mul_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; + +"#, + r#" +/// Adds two 4x4 matrices. + + #[lua(kind = "Method", output(proxy))] + fn add_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; + +"#, + r#" +/// Subtracts two 4x4 matrices. + + #[lua(kind = "Method", output(proxy))] + fn sub_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; + +"#, + r#" +/// Multiplies a 4x4 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat4; + +"#, + r#" +/// Divides a 4x4 matrix by a scalar. + + #[lua(kind = "Method", output(proxy))] + fn div_scalar(&self, rhs: f64) -> bevy::math::DMat4; + +"#, + 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/). + + #[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; + +"#, + 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::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::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 = "std::ops::Mul", + kind = "MetaFunction", + output(proxy), + composite = "mul", + metamethod = "Mul", + )] + fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(kind = "MetaMethod", raw, metamethod="Index")] +fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { + Ok(LuaDVec4::new_ref( + self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ + label:"col", + get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ + path: "".to_owned(), + msg: "Cannot get column of matrix with immutable reference".to_owned() + })), + get_mut: std::sync::Arc::new(move |ref_| { + if ref_.is::(){ + Ok(ref_.downcast_mut::() + .unwrap() + .col_mut(*idx)) + } else { + Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) + } + }) + }) + ) + ) +} +"#] +)] +struct DMat4 { + #[lua(output(proxy))] + x_axis: bevy::math::DVec4, + #[lua(output(proxy))] + y_axis: bevy::math::DVec4, + #[lua(output(proxy))] + z_axis: bevy::math::DVec4, + #[lua(output(proxy))] + w_axis: bevy::math::DVec4, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Affine2", + functions[r#" +/// Creates an affine transform from three column vectors. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::Vec2, + #[proxy] + y_axis: bevy::math::Vec2, + #[proxy] + z_axis: bevy::math::Vec2, + ) -> bevy::math::Affine2; + +"#, + r#" +/// Creates a `[f32; 6]` array storing data in column major order. + + #[lua(kind = "Method")] + fn to_cols_array(&self) -> [f32; 6]; + +"#, + r#" +/// Creates a `[[f32; 2]; 3]` 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]; 3]; + +"#, + r#" +/// Creates an affine transform that changes scale. +/// Note that if any scale is zero the transform will be non-invertible. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Affine2; + +"#, + r#" +/// Creates an affine transform from the given rotation `angle`. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f32) -> bevy::math::Affine2; + +"#, + r#" +/// Creates an affine transformation from the given 2D `translation`. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Affine2; + +"#, + r#" +/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) + + #[lua(kind = "Function", output(proxy))] + fn from_mat2(#[proxy] matrix2: bevy::math::Mat2) -> bevy::math::Affine2; + +"#, + r#" +/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a +/// translation vector. +/// Equivalent to +/// `Affine2::from_translation(translation) * Affine2::from_mat2(mat2)` + + #[lua(kind = "Function", output(proxy))] + fn from_mat2_translation( + #[proxy] + matrix2: bevy::math::Mat2, + #[proxy] + translation: bevy::math::Vec2, + ) -> bevy::math::Affine2; + +"#, + r#" +/// Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and +/// `translation`. +/// Equivalent to `Affine2::from_translation(translation) * +/// Affine2::from_angle(angle) * Affine2::from_scale(scale)` + + #[lua(kind = "Function", output(proxy))] + fn from_scale_angle_translation( + #[proxy] + scale: bevy::math::Vec2, + angle: f32, + #[proxy] + translation: bevy::math::Vec2, + ) -> bevy::math::Affine2; + +"#, + r#" +/// Creates an affine transform from the given 2D rotation `angle` (in radians) and +/// `translation`. +/// Equivalent to `Affine2::from_translation(translation) * Affine2::from_angle(angle)` + + #[lua(kind = "Function", output(proxy))] + fn from_angle_translation( + angle: f32, + #[proxy] + translation: bevy::math::Vec2, + ) -> bevy::math::Affine2; + +"#, + r#" +/// The given `Mat3` must be an affine transform, + + #[lua(kind = "Function", output(proxy))] + fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Affine2; + +"#, + r#" +/// The given [`Mat3A`] must be an affine transform, + + #[lua(kind = "Function", output(proxy))] + fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Affine2; + +"#, + r#" +/// Transforms the given 2D point, applying shear, scale, rotation and translation. + + #[lua(kind = "Method", output(proxy))] + fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Transforms the given 2D vector, applying shear, scale and rotation (but NOT +/// translation). +/// To also apply translation, use [`Self::transform_point2()`] instead. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return +/// `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + 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 3x4 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::Affine2, max_abs_diff: f32) -> 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::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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Affine2 { + #[lua(output(proxy))] + matrix2: bevy::math::Mat2, + #[lua(output(proxy))] + translation: bevy::math::Vec2, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::Affine3A", + functions[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#" + + #[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::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. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::Vec3A, + #[proxy] + y_axis: bevy::math::Vec3A, + #[proxy] + z_axis: bevy::math::Vec3A, + #[proxy] + w_axis: bevy::math::Vec3A, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates a `[f32; 12]` array storing data in column major order. + + #[lua(kind = "Method")] + fn to_cols_array(&self) -> [f32; 12]; + +"#, + r#" +/// Creates a `[[f32; 3]; 4]` 3D 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; 3]; 4]; + +"#, + r#" +/// Creates an affine transform that changes scale. +/// Note that if any scale is zero the transform will be non-invertible. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::Vec3) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform from the given `rotation` quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around a normalized +/// rotation `axis` of `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle( + #[proxy] + axis: bevy::math::Vec3, + angle: f32, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around the x axis of +/// `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f32) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around the y axis of +/// `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f32) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around the z axis of +/// `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f32) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transformation from the given 3D `translation`. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::Vec3) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and +/// rotation) + + #[lua(kind = "Function", output(proxy))] + fn from_mat3(#[proxy] mat3: bevy::math::Mat3) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) +/// and a translation vector. +/// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_mat3(mat3)` + + #[lua(kind = "Function", output(proxy))] + fn from_mat3_translation( + #[proxy] + mat3: bevy::math::Mat3, + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform from the given 3D `scale`, `rotation` and +/// `translation`. +/// Equivalent to `Affine3A::from_translation(translation) * +/// Affine3A::from_quat(rotation) * Affine3A::from_scale(scale)` + + #[lua(kind = "Function", output(proxy))] + fn from_scale_rotation_translation( + #[proxy] + scale: bevy::math::Vec3, + #[proxy] + rotation: bevy::math::Quat, + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates an affine transform from the given 3D `rotation` and `translation`. +/// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_quat(rotation)` + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_translation( + #[proxy] + rotation: bevy::math::Quat, + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// The given `Mat4` must be an affine transform, +/// i.e. contain no perspective transform. + + #[lua(kind = "Function", output(proxy))] + fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates a left-handed view transform using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_lh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + dir: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates a right-handed view transform using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_rh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + dir: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates a left-handed view transform using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_lh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + center: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Creates a right-handed view transform using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_rh( + #[proxy] + eye: bevy::math::Vec3, + #[proxy] + center: bevy::math::Vec3, + #[proxy] + up: bevy::math::Vec3, + ) -> bevy::math::Affine3A; + +"#, + r#" +/// Transforms the given 3D points, applying shear, scale, rotation and translation. + + #[lua(kind = "Method", output(proxy))] + fn transform_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Transforms the given 3D vector, applying shear, scale and rotation (but NOT +/// translation). +/// To also apply translation, use [`Self::transform_point3()`] instead. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + +"#, + r#" +/// Transforms the given [`Vec3A`], applying shear, scale, rotation and translation. + + #[lua(kind = "Method", output(proxy))] + fn transform_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Transforms the given [`Vec3A`], applying shear, scale and rotation (but NOT +/// translation). +/// To also apply translation, use [`Self::transform_point3a()`] instead. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return +/// `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + 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 3x4 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::Affine3A, max_abs_diff: f32) -> 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::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")] +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", + 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, #[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. + + #[lua(kind = "Function", output(proxy))] + fn from_cols( + #[proxy] + x_axis: bevy::math::DVec2, + #[proxy] + y_axis: bevy::math::DVec2, + #[proxy] + z_axis: bevy::math::DVec2, + ) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates a `[f64; 6]` array storing data in column major order. + + #[lua(kind = "Method")] + fn to_cols_array(&self) -> [f64; 6]; + +"#, + r#" +/// Creates a `[[f64; 2]; 3]` 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) -> [[f64; 2]; 3]; + +"#, + r#" +/// Creates an affine transform that changes scale. +/// Note that if any scale is zero the transform will be non-invertible. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::DVec2) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates an affine transform from the given rotation `angle`. + + #[lua(kind = "Function", output(proxy))] + fn from_angle(angle: f64) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates an affine transformation from the given 2D `translation`. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::DVec2) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) + + #[lua(kind = "Function", output(proxy))] + fn from_mat2(#[proxy] matrix2: bevy::math::DMat2) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a +/// translation vector. +/// Equivalent to +/// `DAffine2::from_translation(translation) * DAffine2::from_mat2(mat2)` + + #[lua(kind = "Function", output(proxy))] + fn from_mat2_translation( + #[proxy] + matrix2: bevy::math::DMat2, + #[proxy] + translation: bevy::math::DVec2, + ) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and +/// `translation`. +/// Equivalent to `DAffine2::from_translation(translation) * +/// DAffine2::from_angle(angle) * DAffine2::from_scale(scale)` + + #[lua(kind = "Function", output(proxy))] + fn from_scale_angle_translation( + #[proxy] + scale: bevy::math::DVec2, + angle: f64, + #[proxy] + translation: bevy::math::DVec2, + ) -> bevy::math::DAffine2; + +"#, + r#" +/// Creates an affine transform from the given 2D rotation `angle` (in radians) and +/// `translation`. +/// Equivalent to `DAffine2::from_translation(translation) * DAffine2::from_angle(angle)` + + #[lua(kind = "Function", output(proxy))] + fn from_angle_translation( + angle: f64, + #[proxy] + translation: bevy::math::DVec2, + ) -> bevy::math::DAffine2; + +"#, + r#" +/// The given `DMat3` must be an affine transform, + + #[lua(kind = "Function", output(proxy))] + fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DAffine2; + +"#, + r#" +/// Transforms the given 2D point, applying shear, scale, rotation and translation. + + #[lua(kind = "Method", output(proxy))] + fn transform_point2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Transforms the given 2D vector, applying shear, scale and rotation (but NOT +/// translation). +/// To also apply translation, use [`Self::transform_point2()`] instead. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return +/// `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + 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 3x4 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::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(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))] + fn from_cols( + #[proxy] + x_axis: bevy::math::DVec3, + #[proxy] + y_axis: bevy::math::DVec3, + #[proxy] + z_axis: bevy::math::DVec3, + #[proxy] + w_axis: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates a `[f64; 12]` array storing data in column major order. + + #[lua(kind = "Method")] + fn to_cols_array(&self) -> [f64; 12]; + +"#, + r#" +/// Creates a `[[f64; 3]; 4]` 3D 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) -> [[f64; 3]; 4]; + +"#, + r#" +/// Creates an affine transform that changes scale. +/// Note that if any scale is zero the transform will be non-invertible. + + #[lua(kind = "Function", output(proxy))] + fn from_scale(#[proxy] scale: bevy::math::DVec3) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform from the given `rotation` quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around a normalized +/// rotation `axis` of `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle( + #[proxy] + axis: bevy::math::DVec3, + angle: f64, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around the x axis of +/// `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f64) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around the y axis of +/// `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f64) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform containing a 3D rotation around the z axis of +/// `angle` (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f64) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transformation from the given 3D `translation`. + + #[lua(kind = "Function", output(proxy))] + fn from_translation(#[proxy] translation: bevy::math::DVec3) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and +/// rotation) + + #[lua(kind = "Function", output(proxy))] + fn from_mat3(#[proxy] mat3: bevy::math::DMat3) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) +/// and a translation vector. +/// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_mat3(mat3)` + + #[lua(kind = "Function", output(proxy))] + fn from_mat3_translation( + #[proxy] + mat3: bevy::math::DMat3, + #[proxy] + translation: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform from the given 3D `scale`, `rotation` and +/// `translation`. +/// Equivalent to `DAffine3::from_translation(translation) * +/// DAffine3::from_quat(rotation) * DAffine3::from_scale(scale)` + + #[lua(kind = "Function", output(proxy))] + fn from_scale_rotation_translation( + #[proxy] + scale: bevy::math::DVec3, + #[proxy] + rotation: bevy::math::DQuat, + #[proxy] + translation: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates an affine transform from the given 3D `rotation` and `translation`. +/// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_quat(rotation)` + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_translation( + #[proxy] + rotation: bevy::math::DQuat, + #[proxy] + translation: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// The given `DMat4` must be an affine transform, +/// i.e. contain no perspective transform. + + #[lua(kind = "Function", output(proxy))] + fn from_mat4(#[proxy] m: bevy::math::DMat4) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates a left-handed view transform using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_lh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + dir: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates a right-handed view transform using a camera position, an up direction, and a facing +/// direction. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. + + #[lua(kind = "Function", output(proxy))] + fn look_to_rh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + dir: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates a left-handed view transform using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_lh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + center: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Creates a right-handed view transform using a camera position, an up direction, and a focal +/// point. +/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. +/// # Panics +/// Will panic if `up` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn look_at_rh( + #[proxy] + eye: bevy::math::DVec3, + #[proxy] + center: bevy::math::DVec3, + #[proxy] + up: bevy::math::DVec3, + ) -> bevy::math::DAffine3; + +"#, + r#" +/// Transforms the given 3D points, applying shear, scale, rotation and translation. + + #[lua(kind = "Method", output(proxy))] + fn transform_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Transforms the given 3D vector, applying shear, scale and rotation (but NOT +/// translation). +/// To also apply translation, use [`Self::transform_point3()`] instead. + + #[lua(kind = "Method", output(proxy))] + fn transform_vector3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return +/// `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NaN`. + + #[lua(kind = "Method")] + fn is_nan(&self) -> bool; + +"#, + 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 3x4 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::DAffine3, 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::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")] +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#" +/// 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 +/// 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; + +"#, + 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( + 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; + +"#, + 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#" + + #[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. +/// This should generally not be called manually unless you know what you are doing. +/// Use one of the other constructors instead such as `identity` or `from_axis_angle`. +/// `from_xyzw` is mostly used by unit tests and `serde` deserialization. +/// # Preconditions +/// This function does not check if the input is normalized, it is up to the user to +/// provide normalized input or to normalized the resulting quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_xyzw(x: f64, y: f64, z: f64, w: f64) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a rotation quaternion from an array. +/// # Preconditions +/// This function does not check if the input is normalized, it is up to the user to +/// provide normalized input or to normalized the resulting quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [f64; 4]) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a new rotation quaternion from a 4D vector. +/// # Preconditions +/// This function does not check if the input is normalized, it is up to the user to +/// provide normalized input or to normalized the resulting quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_vec4(#[proxy] v: bevy::math::DVec4) -> bevy::math::DQuat; + +"#, + r#" +/// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). +/// The axis must be a unit vector. +/// # Panics +/// Will panic if `axis` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_axis_angle( + #[proxy] + axis: bevy::math::DVec3, + angle: f64, + ) -> bevy::math::DQuat; + +"#, + r#" +/// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. +/// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. + + #[lua(kind = "Function", output(proxy))] + fn from_scaled_axis(#[proxy] v: bevy::math::DVec3) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a quaternion from the `angle` (in radians) around the x axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_x(angle: f64) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a quaternion from the `angle` (in radians) around the y axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_y(angle: f64) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a quaternion from the `angle` (in radians) around the z axis. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_z(angle: f64) -> bevy::math::DQuat; + +"#, + r#" +/// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). + + #[lua(kind = "Function", output(proxy))] + fn from_euler( + #[proxy] + euler: bevy::math::EulerRot, + a: f64, + b: f64, + c: f64, + ) -> bevy::math::DQuat; + +"#, + 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 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; + +"#, + r#" +/// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the +/// plane spanned by the two vectors. Will rotate at most 180 degrees. +/// The inputs must be unit vectors. +/// `from_rotation_arc(from, to) * from ≈ to`. +/// For near-singular cases (from≈to and from≈-to) the current implementation +/// is only accurate to about 0.001 (for `f32`). +/// # Panics +/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_arc( + #[proxy] + from: bevy::math::DVec3, + #[proxy] + to: bevy::math::DVec3, + ) -> bevy::math::DQuat; + +"#, + r#" +/// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means +/// that the resulting quaternion will rotate `from` so that it is colinear with `to`. +/// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 +/// degrees. +/// The inputs must be unit vectors. +/// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. +/// # Panics +/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_arc_colinear( + #[proxy] + from: bevy::math::DVec3, + #[proxy] + to: bevy::math::DVec3, + ) -> bevy::math::DQuat; + +"#, + r#" +/// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is +/// around the z axis. Will rotate at most 180 degrees. +/// The inputs must be unit vectors. +/// `from_rotation_arc_2d(from, to) * from ≈ to`. +/// For near-singular cases (from≈to and from≈-to) the current implementation +/// is only accurate to about 0.001 (for `f32`). +/// # Panics +/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation_arc_2d( + #[proxy] + from: bevy::math::DVec2, + #[proxy] + to: bevy::math::DVec2, + ) -> bevy::math::DQuat; + +"#, + r#" +/// Returns the rotation axis scaled by the rotation in radians. + + #[lua(kind = "Method", output(proxy))] + fn to_scaled_axis(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the rotation angles for the given euler rotation sequence. + + #[lua(kind = "Method")] + fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f64, f64, f64); + +"#, + r#" +/// `[x, y, z, w]` + + #[lua(kind = "Method")] + fn to_array(&self) -> [f64; 4]; + +"#, + r#" +/// Returns the vector part of the quaternion. + + #[lua(kind = "Method", output(proxy))] + fn xyz(self) -> bevy::math::DVec3; + +"#, + r#" +/// Returns the quaternion conjugate of `self`. For a unit quaternion the +/// conjugate is also the inverse. + + #[lua(kind = "Method", output(proxy))] + fn conjugate(self) -> bevy::math::DQuat; + +"#, + r#" +/// Returns the inverse of a normalized quaternion. +/// Typically quaternion inverse returns the conjugate of a normalized quaternion. +/// Because `self` is assumed to already be unit length this method *does not* normalize +/// before returning the conjugate. +/// # Panics +/// Will panic if `self` is not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn inverse(self) -> bevy::math::DQuat; + +"#, + r#" +/// Computes the dot product of `self` and `rhs`. The dot product is +/// equal to the cosine of the angle between two quaternion rotations. + + #[lua(kind = "Method")] + fn dot(self, #[proxy] rhs: bevy::math::DQuat) -> f64; + +"#, + r#" +/// Computes the length of `self`. + + #[lua(kind = "Method")] + fn length(self) -> f64; + +"#, + r#" +/// Computes the squared length of `self`. +/// This is generally faster than `length()` as it avoids a square +/// root operation. + + #[lua(kind = "Method")] + fn length_squared(self) -> f64; + +"#, + r#" +/// Computes `1.0 / length()`. +/// For valid results, `self` must _not_ be of length zero. + + #[lua(kind = "Method")] + fn length_recip(self) -> f64; + +"#, + r#" +/// Returns `self` normalized to length 1.0. +/// For valid results, `self` must _not_ be of length zero. +/// Panics +/// Will panic if `self` is zero length when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn normalize(self) -> bevy::math::DQuat; + +"#, + r#" +/// Returns `true` if, and only if, all elements are finite. +/// If any element is either `NaN`, positive or negative infinity, this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(self) -> bool; + +"#, + r#" +/// Returns `true` if any elements are `NAN`. + + #[lua(kind = "Method")] + fn is_nan(self) -> bool; + +"#, + r#" +/// Returns whether `self` of length `1.0` or not. +/// Uses a precision threshold of `1e-6`. + + #[lua(kind = "Method")] + fn is_normalized(self) -> bool; + +"#, + r#" + + #[lua(kind = "Method")] + fn is_near_identity(self) -> bool; + +"#, + r#" +/// Returns the angle (in radians) for the minimal rotation +/// for transforming this quaternion into another. +/// Both quaternions must be normalized. +/// # Panics +/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. + + #[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` +/// is less than or equal to `max_abs_diff`. +/// This can be used to compare if two quaternions 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::DQuat, max_abs_diff: f64) -> bool; + +"#, + r#" +/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. +/// # Panics +/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. + + #[lua(kind = "Method", output(proxy))] + fn lerp(self, #[proxy] end: bevy::math::DQuat, s: f64) -> bevy::math::DQuat; + +"#, + r#" +/// 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. +/// 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(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct DQuat { + x: f64, + y: f64, + z: f64, + w: f64, +} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::EulerRot", + functions[r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::EulerRot; + +"#, + 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::EulerRot) -> bool; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct EulerRot {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::BVec3A", + functions[r#" +/// Creates a new vector mask. + + #[lua(kind = "Function", output(proxy))] + fn new(x: bool, y: bool, z: bool) -> bevy::math::BVec3A; + +"#, + r#" +/// Creates a vector mask with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: bool) -> bevy::math::BVec3A; + +"#, + r#" +/// Creates a new vector mask from a bool array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [bool; 3]) -> bevy::math::BVec3A; + +"#, + 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] rhs: &glam::BVec3A) -> bool; + +"#, + r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::BVec3A; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct BVec3A(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::math::BVec4A", + functions[r#" + + #[lua( + as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", + kind = "Method", + output(proxy), + )] + fn clone(&self) -> bevy::math::BVec4A; + +"#, + r#" +/// Creates a new vector mask. + + #[lua(kind = "Function", output(proxy))] + fn new(x: bool, y: bool, z: bool, w: bool) -> bevy::math::BVec4A; + +"#, + r#" +/// Creates a vector mask with all elements set to `v`. + + #[lua(kind = "Function", output(proxy))] + fn splat(v: bool) -> bevy::math::BVec4A; + +"#, + r#" +/// Creates a new vector mask from a bool array. + + #[lua(kind = "Function", output(proxy))] + fn from_array(a: [bool; 4]) -> bevy::math::BVec4A; + +"#, + r#" +/// Returns a bitmask with the lowest 4 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 3. + + #[lua(kind = "Method")] + fn test(&self, index: usize) -> bool; + +"#, + r#" +/// Sets the element at `index`. +/// Panics if `index` is greater than 3. + + #[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) +} +"#] +)] +struct BVec4A(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + output(proxy), + )] + fn clone(&self) -> smol_str::SmolStr; + +"#, + 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(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#" +/// 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(kind = "Function", output(proxy))] + fn new_v4() -> 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#" +/// 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()); +/// ``` + + #[lua(kind = "Method")] + fn into_bytes(self) -> [u8; 16]; + +"#, + 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]; + +"#, + r#" +/// Tests if the UUID is nil (all zeros). + + #[lua(kind = "Method")] + fn is_nil(&self) -> bool; + +"#, + r#" +/// 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 +/// ``` +/// # 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]; + +"#, + 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#" +/// 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Uuid(); +#[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( + "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", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Instant", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "PathBuf", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Quat", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Vec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "IVec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "IVec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "IVec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "I64Vec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "I64Vec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "I64Vec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "UVec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "UVec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "UVec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "U64Vec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "U64Vec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "U64Vec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Vec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Vec3A", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Vec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BVec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BVec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BVec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DVec2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DVec3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DVec4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Mat2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Mat3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Mat3A", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Mat4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DMat2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DMat3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DMat4", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Affine2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Affine3A", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DAffine2", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DAffine3", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "DQuat", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BVec3A", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "BVec4A", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Uuid", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + Ok(()) + } +} +pub struct BevyReflectAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyReflectAPIProvider { + 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( + "BevyReflectAPI", + |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< + LuaDuration, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .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, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaAffine3A, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaDAffine2, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaDAffine3, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + }, + ), + ) + } + 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::(); + 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::(); + 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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs new file mode 100644 index 0000000000..8910927aea --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs @@ -0,0 +1,736 @@ +// @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(clone), + remote = "bevy::time::prelude::Fixed", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::prelude::Fixed; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Fixed {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::time::prelude::Real", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::prelude::Real; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Real {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::time::prelude::Timer", + functions[r#" + + #[lua(as_trait = "std::cmp::Eq", kind = "Method")] + fn assert_receiver_is_total_eq(&self) -> (); + +"#, + r#" +/// Creates a new timer with a given duration. +/// See also [`Timer::from_seconds`](Timer::from_seconds). + + #[lua(kind = "Function", output(proxy))] + fn new( + #[proxy] + duration: bevy::utils::Duration, + #[proxy] + mode: bevy::time::prelude::TimerMode, + ) -> bevy::time::prelude::Timer; + +"#, + r#" +/// Creates a new timer with a given duration in seconds. +/// # Example +/// ``` +/// # use bevy_time::*; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn from_seconds( + duration: f32, + #[proxy] + mode: bevy::time::prelude::TimerMode, + ) -> bevy::time::prelude::Timer; + +"#, + r#" +/// Returns `true` if the timer has reached its duration. +/// For repeating timers, this method behaves identically to [`Timer::just_finished`]. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer_once = Timer::from_seconds(1.0, TimerMode::Once); +/// timer_once.tick(Duration::from_secs_f32(1.5)); +/// assert!(timer_once.finished()); +/// timer_once.tick(Duration::from_secs_f32(0.5)); +/// assert!(timer_once.finished()); +/// let mut timer_repeating = Timer::from_seconds(1.0, TimerMode::Repeating); +/// timer_repeating.tick(Duration::from_secs_f32(1.1)); +/// assert!(timer_repeating.finished()); +/// timer_repeating.tick(Duration::from_secs_f32(0.8)); +/// assert!(!timer_repeating.finished()); +/// timer_repeating.tick(Duration::from_secs_f32(0.6)); +/// assert!(timer_repeating.finished()); +/// ``` + + #[lua(kind = "Method")] + fn finished(&self) -> bool; + +"#, + r#" +/// Returns `true` only on the tick the timer reached its duration. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(1.5)); +/// assert!(timer.just_finished()); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert!(!timer.just_finished()); +/// ``` + + #[lua(kind = "Method")] + fn just_finished(&self) -> bool; + +"#, + r#" +/// Returns the time elapsed on the timer. Guaranteed to be between 0.0 and `duration`. +/// Will only equal `duration` when the timer is finished and non repeating. +/// See also [`Stopwatch::elapsed`](Stopwatch::elapsed). +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.elapsed(), Duration::from_secs_f32(0.5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn elapsed(&self) -> bevy::utils::Duration; + +"#, + r#" +/// Returns the time elapsed on the timer as an `f32`. +/// See also [`Timer::elapsed`](Timer::elapsed). + + #[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. +/// See also [`Stopwatch::set`](Stopwatch::set). +/// # +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// timer.set_elapsed(Duration::from_secs(2)); +/// assert_eq!(timer.elapsed(), Duration::from_secs(2)); +/// // the timer is not finished even if the elapsed time is greater than the duration. +/// assert!(!timer.finished()); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn set_elapsed(&mut self, #[proxy] time: bevy::utils::Duration) -> (); + +"#, + r#" +/// Returns the duration of the timer. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let timer = Timer::new(Duration::from_secs(1), TimerMode::Once); +/// assert_eq!(timer.duration(), Duration::from_secs(1)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn duration(&self) -> bevy::utils::Duration; + +"#, + r#" +/// Sets the duration of the timer. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.5, TimerMode::Once); +/// timer.set_duration(Duration::from_secs(1)); +/// assert_eq!(timer.duration(), Duration::from_secs(1)); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn set_duration(&mut self, #[proxy] duration: bevy::utils::Duration) -> (); + +"#, + r#" +/// Returns the mode of the timer. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); +/// assert_eq!(timer.mode(), TimerMode::Repeating); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn mode(&self) -> bevy::time::prelude::TimerMode; + +"#, + r#" +/// Sets the mode of the timer. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); +/// timer.set_mode(TimerMode::Once); +/// assert_eq!(timer.mode(), TimerMode::Once); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn set_mode(&mut self, #[proxy] mode: bevy::time::prelude::TimerMode) -> (); + +"#, + r#" +/// Pauses the Timer. Disables the ticking of the timer. +/// See also [`Stopwatch::pause`](Stopwatch::pause). +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// timer.pause(); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.elapsed_secs(), 0.0); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn pause(&mut self) -> (); + +"#, + r#" +/// Unpauses the Timer. Resumes the ticking of the timer. +/// See also [`Stopwatch::unpause()`](Stopwatch::unpause). +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// timer.pause(); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// timer.unpause(); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.elapsed_secs(), 0.5); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn unpause(&mut self) -> (); + +"#, + r#" +/// Returns `true` if the timer is paused. +/// See also [`Stopwatch::is_paused`](Stopwatch::is_paused). +/// # Examples +/// ``` +/// # use bevy_time::*; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// assert!(!timer.paused()); +/// timer.pause(); +/// assert!(timer.paused()); +/// timer.unpause(); +/// assert!(!timer.paused()); +/// ``` + + #[lua(kind = "Method")] + fn paused(&self) -> bool; + +"#, + r#" +/// Resets the timer. The reset doesn't affect the `paused` state of the timer. +/// See also [`Stopwatch::reset`](Stopwatch::reset). +/// Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(1.5)); +/// timer.reset(); +/// assert!(!timer.finished()); +/// assert!(!timer.just_finished()); +/// assert_eq!(timer.elapsed_secs(), 0.0); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn reset(&mut self) -> (); + +"#, + r#" +/// Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0). +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.fraction(), 0.25); +/// ``` + + #[lua(kind = "Method")] + fn fraction(&self) -> f32; + +"#, + r#" +/// Returns the fraction of the timer remaining time (goes from 1.0 to 0.0). +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.fraction_remaining(), 0.75); +/// ``` + + #[lua(kind = "Method")] + fn fraction_remaining(&self) -> f32; + +"#, + r#" +/// Returns the remaining time in seconds +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::cmp::Ordering; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// let result = timer.remaining_secs().total_cmp(&1.5); +/// assert_eq!(Ordering::Equal, result); +/// ``` + + #[lua(kind = "Method")] + fn remaining_secs(&self) -> f32; + +"#, + r#" +/// Returns the remaining time using Duration +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5)); +/// ``` + + #[lua(kind = "Method", output(proxy))] + fn remaining(&self) -> bevy::utils::Duration; + +"#, + r#" +/// Returns the number of times a repeating timer +/// finished during the last [`tick`](Timer::tick) call. +/// For non repeating-timers, this method will only ever +/// return 0 or 1. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); +/// timer.tick(Duration::from_secs_f32(6.0)); +/// assert_eq!(timer.times_finished_this_tick(), 6); +/// timer.tick(Duration::from_secs_f32(2.0)); +/// assert_eq!(timer.times_finished_this_tick(), 2); +/// timer.tick(Duration::from_secs_f32(0.5)); +/// assert_eq!(timer.times_finished_this_tick(), 0); +/// ``` + + #[lua(kind = "Method")] + fn times_finished_this_tick(&self) -> u32; + +"#, + 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; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Timer {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &timer::TimerMode) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::prelude::TimerMode; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct TimerMode {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::time::prelude::Virtual", + functions[r#" + + #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] + fn clone(&self) -> bevy::time::prelude::Virtual; + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Virtual {} +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + 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", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &stopwatch::Stopwatch) -> bool; + +"#, + r#" +/// Create a new unpaused `Stopwatch` with no elapsed time. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// let stopwatch = Stopwatch::new(); +/// assert_eq!(stopwatch.elapsed_secs(), 0.0); +/// assert_eq!(stopwatch.is_paused(), false); +/// ``` + + #[lua(kind = "Function", output(proxy))] + fn new() -> bevy::time::Stopwatch; + +"#, + r#" +/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) +/// of the stopwatch. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut stopwatch = Stopwatch::new(); +/// stopwatch.tick(Duration::from_secs(1)); +/// assert_eq!(stopwatch.elapsed(), Duration::from_secs(1)); +/// ``` +/// # See Also +/// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` value is desirable instead. +/// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. + + #[lua(kind = "Method", output(proxy))] + fn elapsed(&self) -> bevy::utils::Duration; + +"#, + r#" +/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) +/// of the stopwatch, in seconds. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut stopwatch = Stopwatch::new(); +/// stopwatch.tick(Duration::from_secs(1)); +/// assert_eq!(stopwatch.elapsed_secs(), 1.0); +/// ``` +/// # See Also +/// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. +/// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. + + #[lua(kind = "Method")] + fn elapsed_secs(&self) -> f32; + +"#, + r#" +/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) +/// of the stopwatch, in seconds, as f64. +/// # See Also +/// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. +/// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` is desirable instead. + + #[lua(kind = "Method")] + fn elapsed_secs_f64(&self) -> f64; + +"#, + r#" +/// Sets the elapsed time of the stopwatch. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut stopwatch = Stopwatch::new(); +/// stopwatch.set_elapsed(Duration::from_secs_f32(1.0)); +/// assert_eq!(stopwatch.elapsed_secs(), 1.0); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn set_elapsed(&mut self, #[proxy] time: bevy::utils::Duration) -> (); + +"#, + r#" +/// Pauses the stopwatch. Any call to [`tick`](Stopwatch::tick) while +/// paused will not have any effect on the elapsed time. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut stopwatch = Stopwatch::new(); +/// stopwatch.pause(); +/// stopwatch.tick(Duration::from_secs_f32(1.5)); +/// assert!(stopwatch.is_paused()); +/// assert_eq!(stopwatch.elapsed_secs(), 0.0); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn pause(&mut self) -> (); + +"#, + r#" +/// Unpauses the stopwatch. Resume the effect of ticking on elapsed time. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut stopwatch = Stopwatch::new(); +/// stopwatch.pause(); +/// stopwatch.tick(Duration::from_secs_f32(1.0)); +/// stopwatch.unpause(); +/// stopwatch.tick(Duration::from_secs_f32(1.0)); +/// assert!(!stopwatch.is_paused()); +/// assert_eq!(stopwatch.elapsed_secs(), 1.0); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn unpause(&mut self) -> (); + +"#, + r#" +/// Returns `true` if the stopwatch is paused. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// let mut stopwatch = Stopwatch::new(); +/// assert!(!stopwatch.is_paused()); +/// stopwatch.pause(); +/// assert!(stopwatch.is_paused()); +/// stopwatch.unpause(); +/// assert!(!stopwatch.is_paused()); +/// ``` + + #[lua(kind = "Method")] + fn is_paused(&self) -> bool; + +"#, + r#" +/// Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch. +/// # Examples +/// ``` +/// # use bevy_time::*; +/// use std::time::Duration; +/// let mut stopwatch = Stopwatch::new(); +/// stopwatch.tick(Duration::from_secs_f32(1.5)); +/// stopwatch.reset(); +/// assert_eq!(stopwatch.elapsed_secs(), 0.0); +/// ``` + + #[lua(kind = "MutatingMethod")] + fn reset(&mut self) -> (); + +"#, + r#" +#[lua(kind="MetaMethod", metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Stopwatch {} +#[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( + "Timer", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + instances + .add_instance( + "Stopwatch", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + Ok(()) + } +} +pub struct BevyTimeAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyTimeAPIProvider { + 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( + "BevyTimeAPI", + |tw| { + tw.document_global_instance::() + .expect("Something went wrong documenting globals") + .process_type::() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, + >() + .process_type::() + .process_type::() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaStopwatch, + >, + >() + }, + ), + ) + } + 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::(); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs new file mode 100644 index 0000000000..d6e093de4a --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs @@ -0,0 +1,819 @@ +// @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::*; +use super::bevy_core::*; +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, +}; +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + derive(clone), + remote = "bevy::transform::components::GlobalTransform", + functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq", + kind = "MetaFunction", + composite = "eq", + metamethod = "Eq", + )] + fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; + +"#, + 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::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#" + + #[lua(kind = "Function", output(proxy))] + fn from_xyz(x: f32, y: f32, z: f32) -> bevy::transform::components::GlobalTransform; + +"#, + r#" + + #[lua(kind = "Function", output(proxy))] + fn from_translation( + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::transform::components::GlobalTransform; + +"#, + r#" + + #[lua(kind = "Function", output(proxy))] + fn from_rotation( + #[proxy] + rotation: bevy::math::Quat, + ) -> bevy::transform::components::GlobalTransform; + +"#, + r#" + + #[lua(kind = "Function", output(proxy))] + fn from_scale( + #[proxy] + 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`]. + + #[lua(kind = "Method", output(proxy))] + fn compute_matrix(&self) -> bevy::math::Mat4; + +"#, + r#" +/// Returns the 3d affine transformation matrix as an [`Affine3A`]. + + #[lua(kind = "Method", output(proxy))] + fn affine(&self) -> bevy::math::Affine3A; + +"#, + r#" +/// Returns the transformation as a [`Transform`]. +/// The transform is expected to be non-degenerate and without shearing, or the output +/// will be invalid. + + #[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 +/// with the `parent` [`GlobalTransform`]. +/// This is useful if you want to "reparent" an [`Entity`](bevy_ecs::entity::Entity). +/// Say you have an entity `e1` that you want to turn into a child of `e2`, +/// but you want `e1` to keep the same global transform, even after re-parenting. You would use: +/// ``` +/// # use bevy_transform::prelude::{GlobalTransform, Transform}; +/// # use bevy_ecs::prelude::{Entity, Query, Component, Commands}; +/// # use bevy_hierarchy::{prelude::Parent, BuildChildren}; +/// #[derive(Component)] +/// struct ToReparent { +/// new_parent: Entity, +/// } +/// fn reparent_system( +/// mut commands: Commands, +/// mut targets: Query<(&mut Transform, Entity, &GlobalTransform, &ToReparent)>, +/// transforms: Query<&GlobalTransform>, +/// ) { +/// for (mut transform, entity, initial, to_reparent) in targets.iter_mut() { +/// if let Ok(parent_transform) = transforms.get(to_reparent.new_parent) { +/// *transform = initial.reparented_to(parent_transform); +/// commands.entity(entity) +/// .remove::() +/// .set_parent(to_reparent.new_parent); +/// } +/// } +/// } +/// ``` +/// The transform is expected to be non-degenerate and without shearing, or the output +/// will be invalid. + + #[lua(kind = "Method", output(proxy))] + fn reparented_to( + &self, + #[proxy] + parent: &components::global_transform::GlobalTransform, + ) -> bevy::transform::components::Transform; + +"#, + r#" +///Return the local right vector (X). + + #[lua(kind = "Method", output(proxy))] + fn right(&self) -> bevy::math::Dir3; + +"#, + r#" +///Return the local left vector (-X). + + #[lua(kind = "Method", output(proxy))] + fn left(&self) -> bevy::math::Dir3; + +"#, + r#" +///Return the local up vector (Y). + + #[lua(kind = "Method", output(proxy))] + fn up(&self) -> bevy::math::Dir3; + +"#, + r#" +///Return the local down vector (-Y). + + #[lua(kind = "Method", output(proxy))] + fn down(&self) -> bevy::math::Dir3; + +"#, + r#" +///Return the local back vector (Z). + + #[lua(kind = "Method", output(proxy))] + fn back(&self) -> bevy::math::Dir3; + +"#, + r#" +///Return the local forward vector (-Z). + + #[lua(kind = "Method", output(proxy))] + fn forward(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Get the translation as a [`Vec3`]. + + #[lua(kind = "Method", output(proxy))] + fn translation(&self) -> bevy::math::Vec3; + +"#, + r#" +/// Get the translation as a [`Vec3A`]. + + #[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`. + + #[lua(kind = "Method")] + fn radius_vec3a(&self, #[proxy] extents: bevy::math::Vec3A) -> f32; + +"#, + r#" +/// 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; + +"#, + r#" +/// Multiplies `self` with `transform` component by component, returning the +/// resulting [`GlobalTransform`] + + #[lua(kind = "Method", output(proxy))] + fn mul_transform( + &self, + #[proxy] + 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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct GlobalTransform(); +#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[proxy( + 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. + + #[lua(kind = "Function", output(proxy))] + fn from_xyz(x: f32, y: f32, z: f32) -> bevy::transform::components::Transform; + +"#, + r#" +/// Extracts the translation, rotation, and scale from `matrix`. It must be a 3d affine +/// transformation matrix. + + #[lua(kind = "Function", output(proxy))] + fn from_matrix( + #[proxy] + world_from_local: bevy::math::Mat4, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Creates a new [`Transform`], with `translation`. Rotation will be 0 and scale 1 on +/// all axes. + + #[lua(kind = "Function", output(proxy))] + fn from_translation( + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Creates a new [`Transform`], with `rotation`. Translation will be 0 and scale 1 on +/// all axes. + + #[lua(kind = "Function", output(proxy))] + fn from_rotation( + #[proxy] + rotation: bevy::math::Quat, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Creates a new [`Transform`], with `scale`. Translation will be 0 and rotation 0 on +/// all axes. + + #[lua(kind = "Function", output(proxy))] + fn from_scale( + #[proxy] + 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. + + #[lua(kind = "Method", output(proxy))] + fn with_translation( + self, + #[proxy] + translation: bevy::math::Vec3, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Returns this [`Transform`] with a new rotation. + + #[lua(kind = "Method", output(proxy))] + fn with_rotation( + self, + #[proxy] + rotation: bevy::math::Quat, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Returns this [`Transform`] with a new scale. + + #[lua(kind = "Method", output(proxy))] + fn with_scale( + self, + #[proxy] + scale: bevy::math::Vec3, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Returns the 3d affine transformation matrix from this transforms translation, +/// rotation, and scale. + + #[lua(kind = "Method", output(proxy))] + fn compute_matrix(&self) -> bevy::math::Mat4; + +"#, + r#" +/// Returns the 3d affine transformation matrix from this transforms translation, +/// rotation, and scale. + + #[lua(kind = "Method", output(proxy))] + fn compute_affine(&self) -> bevy::math::Affine3A; + +"#, + r#" +/// Get the unit vector in the local `X` direction. + + #[lua(kind = "Method", output(proxy))] + fn local_x(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Equivalent to [`-local_x()`][Transform::local_x()] + + #[lua(kind = "Method", output(proxy))] + fn left(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Equivalent to [`local_x()`][Transform::local_x()] + + #[lua(kind = "Method", output(proxy))] + fn right(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Get the unit vector in the local `Y` direction. + + #[lua(kind = "Method", output(proxy))] + fn local_y(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Equivalent to [`local_y()`][Transform::local_y] + + #[lua(kind = "Method", output(proxy))] + fn up(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Equivalent to [`-local_y()`][Transform::local_y] + + #[lua(kind = "Method", output(proxy))] + fn down(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Get the unit vector in the local `Z` direction. + + #[lua(kind = "Method", output(proxy))] + fn local_z(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Equivalent to [`-local_z()`][Transform::local_z] + + #[lua(kind = "Method", output(proxy))] + fn forward(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Equivalent to [`local_z()`][Transform::local_z] + + #[lua(kind = "Method", output(proxy))] + fn back(&self) -> bevy::math::Dir3; + +"#, + r#" +/// Rotates this [`Transform`] by the given rotation. +/// If this [`Transform`] has a parent, the `rotation` is relative to the rotation of the parent. +/// # Examples +/// - [`3d_rotation`] +/// [`3d_rotation`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/3d_rotation.rs + + #[lua(kind = "MutatingMethod")] + fn rotate(&mut self, #[proxy] rotation: bevy::math::Quat) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around the given `axis` by `angle` (in radians). +/// If this [`Transform`] has a parent, the `axis` is relative to the rotation of the parent. + + #[lua(kind = "MutatingMethod")] + fn rotate_axis(&mut self, #[proxy] axis: bevy::math::Dir3, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around the `X` axis by `angle` (in radians). +/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. + + #[lua(kind = "MutatingMethod")] + fn rotate_x(&mut self, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around the `Y` axis by `angle` (in radians). +/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. + + #[lua(kind = "MutatingMethod")] + fn rotate_y(&mut self, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around the `Z` axis by `angle` (in radians). +/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. + + #[lua(kind = "MutatingMethod")] + fn rotate_z(&mut self, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] by the given `rotation`. +/// The `rotation` is relative to this [`Transform`]'s current rotation. + + #[lua(kind = "MutatingMethod")] + fn rotate_local(&mut self, #[proxy] rotation: bevy::math::Quat) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around its local `axis` by `angle` (in radians). + + #[lua(kind = "MutatingMethod")] + fn rotate_local_axis(&mut self, #[proxy] axis: bevy::math::Dir3, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around its local `X` axis by `angle` (in radians). + + #[lua(kind = "MutatingMethod")] + fn rotate_local_x(&mut self, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around its local `Y` axis by `angle` (in radians). + + #[lua(kind = "MutatingMethod")] + fn rotate_local_y(&mut self, angle: f32) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around its local `Z` axis by `angle` (in radians). + + #[lua(kind = "MutatingMethod")] + fn rotate_local_z(&mut self, angle: f32) -> (); + +"#, + r#" +/// Translates this [`Transform`] around a `point` in space. +/// If this [`Transform`] has a parent, the `point` is relative to the [`Transform`] of the parent. + + #[lua(kind = "MutatingMethod")] + fn translate_around( + &mut self, + #[proxy] + point: bevy::math::Vec3, + #[proxy] + rotation: bevy::math::Quat, + ) -> (); + +"#, + r#" +/// Rotates this [`Transform`] around a `point` in space. +/// If this [`Transform`] has a parent, the `point` is relative to the [`Transform`] of the parent. + + #[lua(kind = "MutatingMethod")] + fn rotate_around( + &mut self, + #[proxy] + point: bevy::math::Vec3, + #[proxy] + rotation: bevy::math::Quat, + ) -> (); + +"#, + r#" +/// Multiplies `self` with `transform` component by component, returning the +/// resulting [`Transform`] + + #[lua(kind = "Method", output(proxy))] + fn mul_transform( + &self, + #[proxy] + transform: bevy::transform::components::Transform, + ) -> bevy::transform::components::Transform; + +"#, + r#" +/// Transforms the given `point`, applying scale, rotation and translation. +/// 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; + +"#, + r#" +/// Returns `true` if, and only if, translation, rotation and scale all are +/// finite. If any of them contains a `NaN`, positive or negative infinity, +/// this will return `false`. + + #[lua(kind = "Method")] + fn is_finite(&self) -> bool; + +"#, + r#" +/// Get the [isometry] defined by this transform's rotation and translation, ignoring scale. +/// [isometry]: Isometry3d + + #[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")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +struct Transform { + #[lua(output(proxy))] + translation: bevy::math::Vec3, + #[lua(output(proxy))] + rotation: bevy::math::Quat, + #[lua(output(proxy))] + scale: bevy::math::Vec3, +} +#[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( + "GlobalTransform", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< + LuaGlobalTransform, + >::new, + )?; + instances + .add_instance( + "Transform", + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + )?; + Ok(()) + } +} +pub struct BevyTransformAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for BevyTransformAPIProvider { + 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( + "BevyTransformAPI", + |tw| { + tw.document_global_instance::() + .expect("Something went wrong documenting globals") + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaGlobalTransform, + >, + >() + .process_type::() + .process_type::< + bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< + LuaTransform, + >, + >() + }, + ), + ) + } + 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::(); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs new file mode 100644 index 0000000000..75ee99eaa8 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs @@ -0,0 +1,1879 @@ +// @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/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs new file mode 100644 index 0000000000..b0ca5e66d0 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs @@ -0,0 +1,88 @@ +// @generated by cargo bevy-api-gen collect, modify the templates not this file +#![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; +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; +pub struct LuaBevyAPIProvider; +impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { + 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> { + bevy_a11y::BevyA11YAPIProvider.attach_api(ctx)?; + bevy_ecs::BevyEcsAPIProvider.attach_api(ctx)?; + bevy_transform::BevyTransformAPIProvider.attach_api(ctx)?; + bevy_math::BevyMathAPIProvider.attach_api(ctx)?; + bevy_input::BevyInputAPIProvider.attach_api(ctx)?; + 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(), + bevy_input::BevyInputAPIProvider.get_doc_fragment(), + 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() + .filter_map(|a: Option<_>| a) + .fold( + None, + |a, b| match a { + Some(a) => Some(a.merge(b)), + None => Some(b), + }, + ) + } + 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) { + 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); + bevy_input::BevyInputAPIProvider.register_with_app(app); + 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/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index d356fade06..7a5dc2990b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -1,197 +1,255 @@ -use crate::{ - assets::{LuaFile, LuaLoader}, - docs::LuaDocFragment, -}; -use bevy::{ecs::schedule::ScheduleLabel, prelude::*}; -use bevy_mod_scripting_core::{prelude::*, systems::*, world::WorldPointerGuard}; - -use std::fmt; -use std::marker::PhantomData; -use std::sync::Mutex; -use tealr::mlu::mlua::{prelude::*, Function}; - pub mod assets; pub mod docs; pub mod util; +use bevy::{ + app::{App, Plugin}, + ecs::{entity::Entity, world::World}, + reflect::{FromType, GetTypeRegistration, Reflect, TypePath}, +}; +use bevy_mod_scripting_core::{ + bindings::{ReflectReference, WorldCallbackAccess}, + context::{ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, + error::ScriptError, + event::CallbackLabel, + handler::Args, + script::ScriptId, + ScriptingPlugin, +}; +use bindings::{proxy::LuaProxied, world::LuaWorld}; pub use tealr; +pub mod bindings; +use tealr::mlu::mlua::{FromLua, Function, IntoLua, IntoLuaMulti, Lua, Value}; + pub mod prelude { - pub use crate::{ - assets::{LuaFile, LuaLoader}, - docs::{LuaDocFragment, TypeWalkerBuilder}, - tealr::{ - self, - mlu::{ - mlua::{self, prelude::*, Value}, - TealData, - }, + pub use crate::tealr::{ + self, + mlu::{ + mlua::{self, prelude::*, Value}, + TealData, }, - LuaEvent, LuaScriptHost, }; } -pub trait LuaArg: for<'lua> IntoLuaMulti<'lua> + Clone + Sync + Send + 'static {} - -impl IntoLuaMulti<'lua> + Clone + Sync + Send + 'static> LuaArg for T {} +pub trait LuaEventArg: Args + for<'l> IntoLuaMulti<'l> {} +impl IntoLuaMulti<'l>> LuaEventArg for T {} -#[derive(Clone, Event)] -/// A Lua Hook. The result of creating this event will be -/// a call to the lua script with the hook_name and the given arguments -pub struct LuaEvent { - pub hook_name: String, - pub args: A, - pub recipients: Recipients, +pub struct LuaScriptingPlugin IntoLuaMulti<'l>> { + pub scripting_plugin: ScriptingPlugin, } -impl fmt::Debug for LuaEvent { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("LuaEvent") - .field("hook_name", &self.hook_name) - .field("recipients", &self.recipients) - .finish() +impl Default for LuaScriptingPlugin { + fn default() -> Self { + LuaScriptingPlugin { + scripting_plugin: ScriptingPlugin { + context_assigner: None, + runtime_builder: None, + callback_handler: Some(lua_handler::), + context_builder: Some(ContextBuilder:: { + load: lua_context_load, + reload: lua_context_reload, + }), + }, + } } } -impl ScriptEvent for LuaEvent { - fn recipients(&self) -> &crate::Recipients { - &self.recipients +impl Plugin for LuaScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + self.scripting_plugin.build(app); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); } } -#[derive(Resource)] -/// Lua script host, enables Lua scripting. -pub struct LuaScriptHost { - _ph: PhantomData, +pub fn lua_context_load( + script_id: &ScriptId, + content: &[u8], + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], + world: &mut World, + _: &mut (), +) -> Result { + #[cfg(feature = "unsafe_lua_modules")] + let context = unsafe { Lua::unsafe_new() }; + #[cfg(not(feature = "unsafe_lua_modules"))] + let mut context = Lua::new(); + + with_world(world, &mut context, |context| { + initializers + .iter() + .try_for_each(|init| init(script_id, context))?; + + pre_handling_initializers + .iter() + .try_for_each(|init| init(script_id, Entity::from_raw(0), context))?; + + context.load(content).exec()?; + Ok(()) + })?; + + Ok(context) } -impl Default for LuaScriptHost { - fn default() -> Self { - Self { - _ph: Default::default(), - } - } +pub fn lua_context_reload( + script: &ScriptId, + content: &[u8], + old_ctxt: &mut Lua, + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], + world: &mut World, + _: &mut (), +) -> Result<(), ScriptError> { + *old_ctxt = lua_context_load( + script, + content, + initializers, + pre_handling_initializers, + world, + &mut (), + )?; + Ok(()) } -impl ScriptHost for LuaScriptHost { - type ScriptContext = Mutex; - type APITarget = Mutex; - type ScriptEvent = LuaEvent; - type ScriptAsset = LuaFile; - type DocTarget = LuaDocFragment; - - fn register_with_app_in_set(app: &mut App, schedule: impl ScheduleLabel, set: impl SystemSet) { - app.add_priority_event::() - .init_asset::() - .init_asset_loader::() - .init_resource::>() - .init_resource::>() - .init_resource::>() - .register_type::>() - .register_type::>() - .register_type::>() - // handle script insertions removal first - // then update their contexts later on script asset changes - .add_systems( - schedule, - ( - script_add_synchronizer::, - script_remove_synchronizer::, - script_hot_reload_handler::, - ) - .chain() - .in_set(set), - ); - } +#[allow(clippy::too_many_arguments)] +pub fn lua_handler IntoLuaMulti<'l>>( + args: A, + entity: bevy::ecs::entity::Entity, + script_id: &ScriptId, + callback_label: &CallbackLabel, + context: &mut Lua, + pre_handling_initializers: &[ContextPreHandlingInitializer], + _: &mut (), + world: &mut bevy::ecs::world::World, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + with_world(world, context, |context| { + pre_handling_initializers + .iter() + .try_for_each(|init| init(script_id, entity, context))?; + + let handler: Function = match context.globals().raw_get(callback_label.as_ref()) { + Ok(handler) => handler, + // not subscribed to this event type + Err(_) => return Ok(()), + }; + + handler.call::<_, ()>(args)?; + Ok(()) + }) +} + +/// Safely scopes world access for a lua context to the given closure's scope +pub fn with_world Result<(), ScriptError>>( + world: &mut World, + context: &mut Lua, + f: F, +) -> Result<(), ScriptError> { + WorldCallbackAccess::with_callback_access(world, |guard| { + context.globals().set("world", LuaWorld(guard.clone()))?; + // TODO set entity + script id as well + f(context) + }) +} - fn load_script( +/// Registers a lua proxy object via the reflection system +pub trait RegisterLua { + fn register_lua_proxy( &mut self, - script: &[u8], - script_data: &ScriptData, - providers: &mut APIProviders, - ) -> Result { - #[cfg(feature = "unsafe_lua_modules")] - let lua = unsafe { Lua::unsafe_new() }; - #[cfg(not(feature = "unsafe_lua_modules"))] - let lua = Lua::new(); - - // init lua api before loading script - let mut lua = Mutex::new(lua); - providers.attach_all(&mut lua)?; - - lua.get_mut() - .map_err(|e| ScriptError::FailedToLoad { - script: script_data.name.to_owned(), - msg: e.to_string(), - })? - .load(script) - .set_name(script_data.name) - .exec() - .map_err(|e| ScriptError::FailedToLoad { - script: script_data.name.to_owned(), - msg: e.to_string(), - })?; - - Ok(lua) - } + ) -> &mut Self + where + T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T::Proxy: From + AsRef; - fn setup_script( + fn register_lua_value( &mut self, - script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - providers: &mut APIProviders, - ) -> Result<(), ScriptError> { - providers.setup_all(script_data, ctx) + ) -> &mut Self + where + T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>; +} + +impl RegisterLua for App { + fn register_lua_proxy( + &mut self, + ) -> &mut Self + where + T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T::Proxy: From + AsRef, + { + self.register_type::(); + self.register_type_data::() } - fn handle_events<'a>( + fn register_lua_value( &mut self, - world: &mut World, - events: &[Self::ScriptEvent], - ctxs: impl Iterator, &'a mut Self::ScriptContext)>, - providers: &mut APIProviders, - ) { - // safety: - // - we have &mut World access - // - we do not use the original reference again anywhere in this function - let world = unsafe { WorldPointerGuard::new(world) }; - - ctxs.for_each(|(script_data, ctx)| { - providers - .setup_runtime_all(world.clone(), &script_data, ctx) - .expect("Could not setup script runtime"); - - let ctx = ctx.get_mut().expect("Poison error in context"); - - // event order is preserved, but scripts can't rely on any temporal - // guarantees when it comes to other scripts callbacks, - // at least for now. - let globals = ctx.globals(); - for event in events { - // check if this script should handle this event - if !event.recipients().is_recipient(&script_data) { - continue; - } - - let f: Function = match globals.raw_get(event.hook_name.clone()) { - Ok(f) => f, - Err(_) => continue, // not subscribed to this event - }; - - if let Err(error) = f.call::<_, ()>(event.args.clone()) { - let mut world = world.write(); - let mut state: CachedScriptState = world.remove_resource().unwrap(); - - let (_, mut error_wrt, _) = state.event_state.get_mut(&mut world); - - let error = ScriptError::RuntimeError { - script: script_data.name.to_owned(), - msg: error.to_string(), - }; - - error!("{}", error); - error_wrt.send(ScriptErrorEvent { error }); - world.insert_resource(state); - } - } - }); + ) -> &mut Self + where + T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + { + self.register_type::(); + self.register_type_data::() + } +} + +/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented in lua via proxies which store +/// a reference to the actual value. +/// This is used for types which are represented in lua with pass by reference semantics +#[derive(Clone)] +pub struct ReflectLuaProxied { + pub into_proxy: + for<'l> fn(ReflectReference, &'l Lua) -> Result, tealr::mlu::mlua::Error>, + pub from_proxy: + for<'l> fn(Value<'l>, &'l Lua) -> Result, +} + +impl FromType for ReflectLuaProxied +where + T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T::Proxy: From + AsRef, +{ + fn from_type() -> Self { + Self { + into_proxy: |p, l| T::Proxy::from(p).into_lua(l), + from_proxy: |v, l| T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone()), + } + } +} + +/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented directly in lua with +/// pass by value semantics, These need to implement [`Clone`] +#[derive(Clone)] +pub struct ReflectLuaValue { + pub into_value: for<'l> fn(&dyn Reflect, &'l Lua) -> Result, tealr::mlu::mlua::Error>, + pub set_value: + for<'l> fn(&mut dyn Reflect, Value<'l>, &'l Lua) -> Result<(), tealr::mlu::mlua::Error>, + pub from_value: + for<'l> fn(Value<'l>, &'l Lua) -> Result, tealr::mlu::mlua::Error>, +} + +impl IntoLua<'l> + for<'l> FromLua<'l>> FromType + for ReflectLuaValue +{ + fn from_type() -> Self { + Self { + into_value: |v, l| v.downcast_ref::().unwrap().clone().into_lua(l), + set_value: |t, v, l| { + let mut t = t.downcast_mut::().unwrap(); + *t = T::from_lua(v, l)?; + Ok(()) + }, + from_value: |v, l| T::from_lua(v, l).map(|v| Box::new(v) as Box), + } } } diff --git a/makefile b/makefile index fdd2efe86c..a381dd3221 100644 --- a/makefile +++ b/makefile @@ -28,7 +28,7 @@ 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 +GENERATED_SRC_PATH=./crates/languages/bevy_mod_scripting_lua/src/bindings/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 build_test_in_package: @@ -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} -vv + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen generate --output ${OUTPUT_PATH} --template-args '{ "self_is_bms_lua": 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}' -vv + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen collect --output ${OUTPUT_PATH} --template-args '{ "self_is_bms_lua": true}' -vv deletion_confirmation: @echo -n "This action will delete ALL files in directories: '${GENERATED_SRC_PATH}' amd ${OUTPUT_PATH} (y/N) " From 44f66c3e39dc9aa4fe4b38c3bfb8015aa43ee33a Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 10 Nov 2024 19:02:27 +0000 Subject: [PATCH 009/217] don't check for all std traits being present --- .../bevy_api_gen/src/passes/cache_traits.rs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/bevy_api_gen/src/passes/cache_traits.rs b/crates/bevy_api_gen/src/passes/cache_traits.rs index bdbd956815..c0c36b058b 100644 --- a/crates/bevy_api_gen/src/passes/cache_traits.rs +++ b/crates/bevy_api_gen/src/passes/cache_traits.rs @@ -57,21 +57,21 @@ pub(crate) fn cache_traits(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> bool { log::trace!("has_std: {}", has_std); - if has_std && !ctxt.cached_traits.has_all_std_source_traits() { - log::debug!( - "all traits: {}", - tcx.all_traits() - .map(|t| tcx.def_path_str(t).to_string()) - .collect::>() - .join(", ") - ); + // if has_std && !ctxt.cached_traits.has_all_std_source_traits() { + // log::debug!( + // "all traits: {}", + // tcx.all_traits() + // .map(|t| tcx.def_path_str(t).to_string()) + // .collect::>() + // .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) - ) - } + // 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 } From 1a783f30ec18c8db04100181761f0798f3777819 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 10 Nov 2024 23:12:37 +0000 Subject: [PATCH 010/217] bring in bms_lua changes --- crates/bevy_api_gen/src/args.rs | 1 + crates/bevy_api_gen/src/context.rs | 3 +- crates/bevy_api_gen/templates/footer.tera | 2 +- crates/bevy_api_gen/templates/header.tera | 4 +- crates/bevy_api_gen/templates/item.tera | 2 +- crates/bevy_api_gen/templates/macros.tera | 10 +- crates/bevy_mod_scripting_derive/Cargo.toml | 31 + crates/bevy_mod_scripting_derive/readme.md | 3 + crates/bevy_mod_scripting_derive/src/input.rs | 115 + crates/bevy_mod_scripting_derive/src/lib.rs | 531 + crates/bevy_mod_scripting_derive/src/utils.rs | 59 + .../bevy_mod_scripting_lua/Cargo.toml | 4 + .../bevy_mod_scripting_lua/src/assets.rs | 284 +- .../src/bindings/mod.rs | 5 + .../src/bindings/providers/bevy_a11y.rs | 85 +- .../src/bindings/providers/bevy_core.rs | 98 +- .../src/bindings/providers/bevy_ecs.rs | 431 +- .../src/bindings/providers/bevy_hierarchy.rs | 156 +- .../src/bindings/providers/bevy_input.rs | 1573 +- .../src/bindings/providers/bevy_math.rs | 4439 ++-- .../src/bindings/providers/bevy_reflect.rs | 17909 ++++++++-------- .../src/bindings/providers/bevy_time.rs | 463 +- .../src/bindings/providers/bevy_transform.rs | 751 +- .../src/bindings/providers/bevy_window.rs | 1564 +- .../src/bindings/providers/mod.rs | 105 +- .../src/bindings/proxy.rs | 189 + .../src/bindings/reference.rs | 428 + .../src/bindings/std.rs | 39 + .../src/bindings/type_registration.rs | 27 + .../src/bindings/world.rs | 131 + .../bevy_mod_scripting_lua/src/docs.rs | 113 +- .../bevy_mod_scripting_lua/src/lib.rs | 32 +- .../bevy_mod_scripting_lua/src/util.rs | 45 + 33 files changed, 15203 insertions(+), 14429 deletions(-) create mode 100644 crates/bevy_mod_scripting_derive/Cargo.toml create mode 100644 crates/bevy_mod_scripting_derive/readme.md create mode 100644 crates/bevy_mod_scripting_derive/src/input.rs create mode 100644 crates/bevy_mod_scripting_derive/src/lib.rs create mode 100644 crates/bevy_mod_scripting_derive/src/utils.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs diff --git a/crates/bevy_api_gen/src/args.rs b/crates/bevy_api_gen/src/args.rs index 63898dc098..69ff5294fe 100644 --- a/crates/bevy_api_gen/src/args.rs +++ b/crates/bevy_api_gen/src/args.rs @@ -112,6 +112,7 @@ fn default_ignored_types() -> String { "bevy_reflect::DynamicTuple", "bevy_reflect::DynamicTupleStruct", "bevy_reflect::DynamicEnum", + "bevy_reflect::DynamicSet", "bevy_reflect::OsString", // TODO: once macros allow Vecs for primitives as args remove this from ignored types ] .join(",") diff --git a/crates/bevy_api_gen/src/context.rs b/crates/bevy_api_gen/src/context.rs index 83ed871bbb..baa33448a1 100644 --- a/crates/bevy_api_gen/src/context.rs +++ b/crates/bevy_api_gen/src/context.rs @@ -83,7 +83,8 @@ impl ReflectType<'_> { pub(crate) const DEF_PATHS_FROM_LUA: [&str; 2] = ["value::FromLuaMulti", "mlua::FromLuaMulti"]; pub(crate) const DEF_PATHS_INTO_LUA: [&str; 2] = ["value::IntoLuaMulti", "mlua::IntoLuaMulti"]; -pub(crate) const DEF_PATHS_REFLECT: [&str; 2] = ["bevy_reflect::Reflect", "reflect::Reflect"]; +pub(crate) const DEF_PATHS_REFLECT: [&str; 2] = + ["bevy_reflect::PartialReflect", "reflect::PartialReflect"]; pub(crate) const DEF_PATHS_GET_TYPE_REGISTRATION: [&str; 2] = [ "bevy_reflect::GetTypeRegistration", "reflect::GetTypeRegistration", diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 87a76308e2..0009ff8855 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -33,7 +33,7 @@ pub struct {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_ca impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}} { fn build(&self, app: &mut bevy::prelude::App) { {% for item in items %} - app.register_proxy::<{{ item.import_path }}>(); + app.register_lua_proxy::<{{ item.import_path }}>(); {% endfor %} app.add_context_initializer::<()>({{ "ContextInitializer" | prefix_cratename | convert_case(case="snake") }}); app.add_documentation_fragment( diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index 2cdbb5745e..5404318ea2 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -12,7 +12,7 @@ use super::{{crate}}::*; use bevy_mod_scripting_core::{AddContextInitializer, StoreDocumentation, bindings::ReflectReference}; {% if args.self_is_bms_lua %} -use crate::{bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,IdentityProxy},RegisterLuaProxy, tealr::mlu::mlua::IntoLua}; +use crate::{bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy},RegisterLua, tealr::mlu::mlua::IntoLua}; {% else %} -use bevy_mod_scripting::{lua::bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,IdentityProxy}, RegisterLuaProxy, tealr::mlu::mlua::IntoLua}; +use bevy_mod_scripting::{lua::bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy}, RegisterLua, tealr::mlu::mlua::IntoLua}; {% endif %} \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/item.tera b/crates/bevy_api_gen/templates/item.tera index 43bb345ec7..969b932438 100644 --- a/crates/bevy_api_gen/templates/item.tera +++ b/crates/bevy_api_gen/templates/item.tera @@ -11,7 +11,7 @@ {% set bms_lua_path="bevy_mod_scripting::lua" %} {% endif %} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( remote="{{ item.import_path }}", bms_core_path="{{bms_core_path}}", diff --git a/crates/bevy_api_gen/templates/macros.tera b/crates/bevy_api_gen/templates/macros.tera index ef5b578334..ec421a0605 100644 --- a/crates/bevy_api_gen/templates/macros.tera +++ b/crates/bevy_api_gen/templates/macros.tera @@ -1,6 +1,6 @@ {% macro vector_index(num_type) %} #[lua(metamethod="Index")] -fn index(self, idx: usize) -> IdentityProxy<{{ num_type }}> { +fn index(self, idx: usize) -> LuaIdentityProxy<{{ num_type }}> { _self[idx - 1] } {% endmacro vector_index %} @@ -14,15 +14,13 @@ fn index(&mut self, idx: usize, val: {{ num_type }}) -> () { {% macro matrix_index(col_type, mat_type, bms_core_path) %} #[lua(metamethod="Index")] -fn index(_self: IdentityProxy, idx: usize) -> IdentityProxy<{{ col_type | prefix_lua }}> { +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy<{{ col_type | prefix_lua }}> { let mut curr_ref = _self.0.clone(); let def_ref = {{bms_core_path}}::bindings::DeferredReflection{ get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(idx - 1)) + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) } else { Err(bevy::reflect::ReflectPathError::InvalidDowncast) } diff --git a/crates/bevy_mod_scripting_derive/Cargo.toml b/crates/bevy_mod_scripting_derive/Cargo.toml new file mode 100644 index 0000000000..4540176a35 --- /dev/null +++ b/crates/bevy_mod_scripting_derive/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "bevy_mod_scripting_derive" +version = "0.6.0" +authors = ["Maksymilian Mozolewski "] +edition = "2021" +license = "MIT OR Apache-2.0" +description = "Necessary functionality for Lua support with bevy_mod_scripting" +repository = "https://github.com/makspll/bevy_mod_scripting" +homepage = "https://github.com/makspll/bevy_mod_scripting" +keywords = ["bevy", "gamedev", "scripting", "rhai"] +categories = ["game-development"] +readme = "readme.md" + +[lib] +name = "bevy_mod_scripting_derive" +path = "src/lib.rs" +proc-macro = true + +[dependencies] +paste = "1.0.7" +darling = "0.20.3" +syn = { version = "2.0.38", features = ["full", "fold", "extra-traits"] } +quote = "1.0.8" +proc-macro2 = "1.0" +convert_case = "0.5.0" +rustdoc-types = "0.11.0" +serde = { version = "1.0", features = ["derive"] } +serde_derive = "1.0.137" +indexmap = { version = "1.9.1", features = ["serde"] } +strum = { version = "0.24.1", features = ["derive"] } +vec1 = "1.10.1" diff --git a/crates/bevy_mod_scripting_derive/readme.md b/crates/bevy_mod_scripting_derive/readme.md new file mode 100644 index 0000000000..e058ed4f00 --- /dev/null +++ b/crates/bevy_mod_scripting_derive/readme.md @@ -0,0 +1,3 @@ +# bevy_mod_scripting_lua_derive + +This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/bevy_mod_scripting_derive/src/input.rs b/crates/bevy_mod_scripting_derive/src/input.rs new file mode 100644 index 0000000000..4fc68695f6 --- /dev/null +++ b/crates/bevy_mod_scripting_derive/src/input.rs @@ -0,0 +1,115 @@ +use darling::{util::Flag, FromDeriveInput, FromMeta}; +use proc_macro2::Ident; +use std::ops::{Deref, DerefMut}; +use syn::{spanned::Spanned, visit_mut::VisitMut, Attribute, Field, TraitItemFn, Variant}; + +#[derive(FromMeta)] +pub struct BMSCorePath(pub syn::Path); + +impl Default for BMSCorePath { + fn default() -> Self { + Self(syn::parse_quote!(bevy_mod_scripting::core)) + } +} + +#[derive(FromMeta)] +pub struct BMSLuaPath(pub syn::Path); + +impl Default for BMSLuaPath { + fn default() -> Self { + Self(syn::parse_quote!(bevy_mod_scripting::lua)) + } +} + +#[derive(FromDeriveInput)] +#[darling(attributes(proxy), forward_attrs(allow, doc, cfg))] +pub struct ProxyInput { + /// The name of the type for which we are generating a proxy (target type) + pub ident: syn::Ident, + /// The visibility of the target type + pub vis: syn::Visibility, + /// The generics on the target type + pub generics: syn::Generics, + /// The attributes on the target type + pub attrs: Vec, + + /// The path to the type for which we are generating a proxy if it's a foreign type + pub remote: Option, + + /// if provided will call the function at this path to get the world callback access. Normally this is retrieved using a global variable. + pub get_world_callback_access_fn: Option, + + /// If set will use the given path as the type for the proxy instead of generating a new one + /// Only used for the special world proxies, probably not useful for anything else, the macro assumes we have an inner ReflectReference in the wrapper + pub proxy_as_type: Option, + + /// The path to the bevy_mod_scripting_core crate + #[darling(default)] + pub bms_core_path: BMSCorePath, + /// The path to the bevy_mod_scripting_lua crate + #[darling(default)] + pub bms_lua_path: BMSLuaPath, + + /// The name to use for the proxy type, if not provided the language derive macro + /// will generate one using a standard prefix. + #[darling(rename = "name")] + pub proxy_name: Option, + + /// The body of the type for which we are generating a proxy + pub data: darling::ast::Data, + + /// A list of multi-lang function definitions to be generated on the proxy type + #[darling(default)] + pub functions: TraitItemFnsWrapper, +} + +#[derive(Default)] +pub struct TraitItemFnsWrapper(pub Vec); + +impl FromMeta for TraitItemFnsWrapper { + fn from_string(value: &str) -> darling::Result { + let token_stream: proc_macro2::TokenStream = value.parse().map_err(syn::Error::from)?; + let trait_items_vec = vec![syn::parse2(token_stream)?]; + Ok(TraitItemFnsWrapper(trait_items_vec)) + } + + fn from_list(items: &[darling::ast::NestedMeta]) -> darling::Result { + Ok(TraitItemFnsWrapper( + items + .iter() + .map(Self::from_nested_meta) + .collect::, _>>()? + .into_iter() + .flat_map(|v| v.0.into_iter()) + .collect::>(), + )) + } +} + +impl Deref for TraitItemFnsWrapper { + type Target = Vec; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl DerefMut for TraitItemFnsWrapper { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +/// Replaces every occurence of an identifier with +/// the given string while preserving the original span +pub struct IdentifierRenamingVisitor<'a> { + pub target: &'a str, + pub replacement: &'a str, +} + +impl VisitMut for IdentifierRenamingVisitor<'_> { + fn visit_ident_mut(&mut self, i: &mut Ident) { + if *i == self.target { + *i = Ident::new(self.replacement, i.span()); + } + } +} diff --git a/crates/bevy_mod_scripting_derive/src/lib.rs b/crates/bevy_mod_scripting_derive/src/lib.rs new file mode 100644 index 0000000000..6c932ffc43 --- /dev/null +++ b/crates/bevy_mod_scripting_derive/src/lib.rs @@ -0,0 +1,531 @@ +mod input; +mod utils; + +use crate::{input::*, utils::doc_attribute_to_string_lit}; + +use std::collections::HashMap; +use darling::util::Flag; +use syn::{ + spanned::Spanned, Path, Token, TraitItemFn, parse_quote, + parse_macro_input, parse_quote_spanned, DeriveInput, ExprClosure, FnArg, + punctuated::Punctuated +}; + +use darling::{FromAttributes, FromDeriveInput}; +use proc_macro::TokenStream; +use proc_macro2::*; +use quote::*; + + +const SELF_ALIAS: &str = "_self"; +const CTXT_ALIAS: &str = "lua"; +const PROXY_PREFIX: &str = "Lua"; + +/// Convert receiver to a standardised form, for example: +/// - instead o a `&self` receiver we have a `_self: LuaRefProxy` +/// - instead of a `&mut self` receiver we have a `_self: LuaRefMutProxy` +/// - instead of a `self` receiver we have a `_self: ValLuaProxy` +/// Returns true if the receiver was changed +fn standardise_receiver(receiver: &mut FnArg, target_type: &Path, bms_lua_path: &Path, proxy_as_type: Option<&Path>) -> bool { + let replacement = if let FnArg::Receiver(receiver) = receiver { + let ref_ = &receiver.reference.as_ref().map(|(amp, lifetime)| { + quote_spanned! {receiver.span()=> + #amp #lifetime + } + }); + + let self_ident = syn::Ident::new(SELF_ALIAS, receiver.span()); + let self_ident_type = match proxy_as_type{ + Some(target_type) => { + quote_spanned! {receiver.span()=> + #target_type + } + }, + None => { + let unproxy_container_name = match (ref_.is_some(), receiver.mutability.is_some()) { + (true, true) => "LuaReflectRefMutProxy", + (true, false) => "LuaReflectRefProxy", + (false, _) => "LuaReflectValProxy", + }; + let unproxy_ident = syn::Ident::new(unproxy_container_name, receiver.span()); + + quote_spanned! {receiver.span()=> + #bms_lua_path::bindings::proxy::#unproxy_ident::<#target_type> + } + } + }; + + Some(syn::FnArg::Typed(parse_quote_spanned! {receiver.span()=> + #self_ident: #self_ident_type + })) + } else { + None + }; + if let Some(replacement) = replacement { + *receiver = replacement; + true + } else { + false + } +} + +/// Collect all arguments into a tuple, for example: +/// - `fn foo(a: i32, b: f32)` becomes `(name: (i32, f32))` +fn collect_args_in_tuple<'a, I: Iterator>( + args: I, + name: &Ident, + outer_mut: bool, +) -> FnArg { + let (_, arg_types) = args + .map(|arg| { + if let FnArg::Typed(arg) = arg { + (arg.pat.clone(), arg.ty.clone()) + } else { + panic!("Function arguments must be typed") + } + }) + .unzip::<_, _, Vec<_>, Vec<_>>(); + + let outer_mut = if outer_mut { + Some(Token![mut](name.span())) + } else { + None + }; + + parse_quote!( #outer_mut #name : (#(#arg_types),*) ) +} + +/// Convert a function definition to a closure, for example: +/// - `fn foo(a: i32, b: f32) -> f32 { a + b }` becomes `|a: i32, b: f32| { a + b} ` +fn convert_function_def_to_closure(f: &TraitItemFn) -> ExprClosure { + let span = f.span(); + let sig = &f.sig.inputs; + let body = f + .default + .as_ref() + .unwrap_or_else(|| panic!("Function {} must have a body", f.sig.ident)); + parse_quote_spanned! {span => + |#sig| #body + } +} + +/// Processes the function def to wrap it in the necessary proxying logic +/// Will convert the function signature to take in two arguments: +/// - a context argument +/// - a tuple of all arguments passed to the underlying function +fn proxy_wrap_function_def( + f: &mut TraitItemFn, + target_type: &Path, + bms_core: &Path, + bms_lua: &Path, + get_world_callback_access_fn: Option<&Path>, + proxy_as_type: Option<&Path>, + mlua: &Path, + attrs: &FunctionAttrs, +) { + + // collect all args into tuple and add lua context arg + let ctxt_alias = syn::Ident::new(CTXT_ALIAS, f.sig.inputs.span()); + + let ctxt_arg = if attrs.with_context.is_present() { + f.sig + .inputs + .pop() + .expect("Expected at least one argument for the context") + .into_value() + } else { + parse_quote_spanned! {f.span()=> + #ctxt_alias: &#mlua::Lua + } + }; + + let ctxt_arg_ident = match &ctxt_arg { + FnArg::Typed(arg) => arg.pat.clone(), + _ => panic!("Expected a typed argument, not a receiver for the context argument"), + }; + + let mut has_receiver = false; + if let Some(first_arg) = f.sig.inputs.first_mut() { + has_receiver = standardise_receiver(first_arg, target_type, bms_lua, proxy_as_type); + }; + + let func_name = &f.sig.ident; + let (mut original_arg_idents, _) = f + .sig + .inputs + .iter() + .map(|arg| { + if let FnArg::Typed(arg) = arg { + (arg.pat.clone(), arg.ty.clone()) + } else { + panic!("Function arguments must be typed") + } + }) + .unzip::<_, _, Vec<_>, Vec<_>>(); + + let span = f.span(); + let args_ident = format_ident!("args", span = f.sig.inputs.span()); + let args_tail_ident = format_ident!("args_tail", span = f.sig.inputs.span()); + let args_head_ident = format_ident!("args_head", span = f.sig.inputs.span()); + let args_split = if get_world_callback_access_fn.is_some() { + let tail = (1..original_arg_idents.len()).map(|i| { + let i = syn::Index::from(i); + quote_spanned!(span=> #args_ident.#i) + }); + quote_spanned!(span=> + let #args_head_ident = #args_ident.0; + let #args_tail_ident = (#(#tail),*); + ) + } else { + Default::default() + }; + + + + // change signature to take in a single args tuple instead of multiple arguments (on top of a context arg) + f.sig.inputs = Punctuated::from_iter(vec![ + ctxt_arg, + collect_args_in_tuple(f.sig.inputs.iter(), &args_ident, true), + ]); + + let args_var_to_use = if get_world_callback_access_fn.is_some() { + original_arg_idents.remove(0); + args_tail_ident + } else { + args_ident + }; + + let out_type = match &f.sig.output { + syn::ReturnType::Default => quote_spanned! {f.span()=> + () + }, + syn::ReturnType::Type(_, ty) => ty.to_token_stream(), + }; + + + // wrap function body in our unwrapping and wrapping logic, ignore pre-existing body + let mut fn_call = std::panic::catch_unwind(|| { + match (&f.default, &attrs.as_trait, get_world_callback_access_fn.is_some()) { + (_, _, true) => quote_spanned!(span=> + world.#func_name(#(#original_arg_idents),*) + ), + (Some(body), _, _) => quote_spanned!(span=> + (||{ #body })() + ), + (_, None, _) => quote_spanned!(span=> + #target_type::#func_name(#(#original_arg_idents),*) + ), + (_, Some(trait_path), _) => { + let trait_path = quote_spanned!(span=> #trait_path); + quote_spanned!(span=> + <#target_type as #trait_path>::#func_name(#(#original_arg_idents),*) + ) + } + } + }) + .unwrap(); // todo: handle the error nicer + + if f.sig.unsafety.is_some() { + fn_call = quote_spanned!(span=> + unsafe { #fn_call } + ); + } + + if attrs.no_proxy.is_present() { + f.default = Some(parse_quote_spanned! {span=> + { + #fn_call + } + }); + } else { + let world = if let Some(world_getter_fn_path) = get_world_callback_access_fn { + quote_spanned!(span=> + let mut world: #bms_core::bindings::WorldCallbackAccess = #world_getter_fn_path(#args_head_ident); + let mut world = world.read().ok_or_else(|| #mlua::Error::external("World no longer exists"))?; + ) + } else { + quote_spanned!(span=> + let mut world: #bms_lua::bindings::proxy::LuaValProxy<#bms_core::bindings::WorldCallbackAccess> = #ctxt_arg_ident.globals().get("world")?; + let mut world = <#bms_lua::bindings::proxy::LuaValProxy<#bms_core::bindings::WorldCallbackAccess> as #bms_core::bindings::Unproxy>::unproxy(&mut world).map_err(#mlua::Error::external)?; + let mut world = world.read().ok_or_else(|| #mlua::Error::external("World no longer exists"))?; + ) + }; + + + f.default = Some(parse_quote_spanned! {span=> + { + #args_split + #world + let out: #out_type = world.proxy_call(#args_var_to_use, |(#(#original_arg_idents),*)| { + #fn_call + }).map_err(|e| #mlua::Error::external(e))?; + Ok(out) + } + }); + } +} + +fn generate_methods_registration( + attrs: &FunctionAttrs, + span: Span, + name: proc_macro2::TokenStream, + closure: ExprClosure, +) -> proc_macro2::TokenStream { + let registration_method = if attrs.metamethod.is_some() { + quote_spanned!(span=>add_meta_function) + } else { + quote_spanned!(span=>add_function) + }; + let docs = attrs.doc.iter().map(|doc| { + quote_spanned! {span=> + methods.document(#doc); + } + }); + quote_spanned! {span=> + #(#docs)* + methods.#registration_method(#name, #closure); + } +} + +#[derive(FromAttributes, Clone)] +#[darling(attributes(lua))] +struct FunctionAttrs { + #[darling(multiple)] + pub doc: Vec, + + /// Marks the function as a composite with the given ID, at least one another function with the same composite + /// ID must exist resulting in a combined function being generated. The actual function to dispatch to will be decided based on + /// the types of arguments. If the signature is invalid (i.e. doesn't allow us to dispatch) an error will be thrown + #[darling(default)] + pub composite: Option, + + /// Marks this to be ignored, only used for fields as functions are opt-in + pub skip: Flag, + + /// If passed will generate statement before calling the method + /// on the type + pub as_trait: Option, + + /// If passed will generate a metamethod call instead of using the function name + pub metamethod: Option, + + /// If true will pass in the context as the last argument, + /// i.e. will remove that argument from the function signature and use it's name as the context alias + pub with_context: Flag, + + /// Skips the unproxying & proxying call, useful for functions that don't need to access the world + pub no_proxy: Flag, +} + +#[proc_macro_derive(LuaProxy, attributes(lua, proxy))] +pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { + let derive_input = parse_macro_input!(input as DeriveInput); + + let mut meta: ProxyInput = match ProxyInput::from_derive_input(&derive_input) { + Ok(v) => v, + Err(e) => return darling::Error::write_errors(e).into(), + }; + if meta.proxy_name.is_some() { + // throw error + return syn::Error::new( + derive_input.span(), + "The `name` attribute is not supported for lua proxies", + ) + .to_compile_error() + .into(); + } + + let target_type = meta.remote.unwrap_or(meta.ident.clone().into()); + let target_type_str = target_type.segments.last().unwrap().ident.to_string(); + let proxy_type_ident = match meta.proxy_as_type.as_ref() { + Some(proxy_as_type) => proxy_as_type.clone(), + None => meta.proxy_name.unwrap_or_else(|| format_ident!("{PROXY_PREFIX}{}", &target_type_str, span = meta.ident.span())).into(), + }; + + + let bms_core = meta.bms_core_path.0; + let bms_lua = meta.bms_lua_path.0; + let tealr: Path = parse_quote_spanned!(bms_lua.span()=> + #bms_lua::tealr + ); + let mlua: Path = parse_quote_spanned!(bms_core.span()=> + #tealr::mlu::mlua + ); + + // generate type level tealr documentation calls + let type_level_document_calls = meta + .attrs + .iter() + .filter(|&a| a.meta.path().is_ident("doc")) + .map(doc_attribute_to_string_lit) + .map(|tkns| { + quote_spanned!(meta.ident.span()=> + methods.document_type(#tkns); + ) + }); + + // extract composites first + let mut composites: HashMap> = HashMap::new(); + meta.functions.0.retain(|f| { + let attrs = FunctionAttrs::from_attributes(&f.attrs).unwrap(); + if let Some(composite_id) = &attrs.composite { + composites + .entry(composite_id.to_owned()) + .or_default() + .push((f.clone(), attrs)); + false + } else { + true + } + }); + + let add_composite_function_stmts = composites.into_values().map(|functions| { + let (first_function, first_function_attrs) = functions + .first() + .cloned() + .expect("At least one function must be a composite for this code to be reached"); + + let name = match &first_function_attrs.metamethod { + Some(metamethod) => quote_spanned!(metamethod.span()=> + #mlua::MetaMethod::#metamethod + ), + None => first_function.sig.ident.to_string().to_token_stream(), + }; + + let value_arg_types = (0..first_function.sig.inputs.len()) + .map(|_| { + quote_spanned!(first_function.span()=> + #mlua::Value + ) + }) + .collect::>(); + + let value_arg_names = (0..first_function.sig.inputs.len()).map(|i| { + format_ident!("arg{}", i, span = first_function.span()) + }).collect::>(); + + let closures = functions + .into_iter() + .map(|(mut f, attrs)| { + proxy_wrap_function_def(&mut f, &target_type, &bms_core, &bms_lua, meta.get_world_callback_access_fn.as_ref() ,meta.proxy_as_type.as_ref(), &mlua, &attrs); + convert_function_def_to_closure(&f) + }) + .collect::>(); + + let closure_args_types = closures.iter().map(|closure| { + let last = closure.inputs.last().unwrap(); + if let syn::Pat::Type(pat_type) = last { + &pat_type.ty + } else { + panic!("Closure must have a single argument tuple as its last argument") + } + }); + + let closure = parse_quote_spanned! {first_function.span()=> + |ctxt, (#(#value_arg_names,)*): (#(#value_arg_types,)*)| { + let args = #mlua::MultiValue::from_vec(vec![#(#value_arg_names,)*]); + #( + if let Ok(args) = <#closure_args_types as #mlua::FromLuaMulti>::from_lua_multi(args.clone(), ctxt) { + let out : Result<_, #mlua::Error> = (#closures)(ctxt, args); + return out?.into_lua(ctxt) + } + )* + Err(#mlua::Error::external("Invalid arguments for composite function")) + } + }; + + generate_methods_registration(&first_function_attrs, first_function.span(), name, closure) + }); + + let add_function_stmts = meta.functions.0.into_iter().filter_map(|mut f| { + let attrs = FunctionAttrs::from_attributes(&f.attrs).unwrap(); + + if attrs.skip.is_present() { + return None; + } + + proxy_wrap_function_def(&mut f, &target_type, &bms_core, &bms_lua, meta.get_world_callback_access_fn.as_ref(), meta.proxy_as_type.as_ref(), &mlua, &attrs); + + let name = match &attrs.metamethod { + Some(metamethod) => quote_spanned!(metamethod.span()=> + #mlua::MetaMethod::#metamethod + ), + None => f.sig.ident.to_string().to_token_stream(), + }; + let span = f.span(); + + let closure = convert_function_def_to_closure(&f); + + Some(generate_methods_registration(&attrs, span, name, closure)) + }); + + let vis = &meta.vis; + + let definition = if let Some(proxy_as_type) = meta.proxy_as_type.as_ref() { + Default::default() + } else { + quote_spanned!(derive_input.span()=> + #[derive(Clone, Debug, #tealr::mlu::UserData, #tealr::ToTypename)] + #vis struct #proxy_type_ident (pub #bms_core::bindings::ReflectReference); + ) + }; + + let conversions = if let Some(proxy_as_type) = meta.proxy_as_type.as_ref() { + Default::default() + } else { + quote_spanned!(derive_input.span()=> + impl AsRef<#bms_core::bindings::ReflectReference> for #proxy_type_ident { + fn as_ref(&self) -> &#bms_core::bindings::ReflectReference { + &self.0 + } + } + + impl From<#bms_core::bindings::ReflectReference> for #proxy_type_ident { + fn from(r: #bms_core::bindings::ReflectReference) -> Self { + Self(r) + } + } + ) + }; + + + quote_spanned! {meta.ident.span()=> + + #definition + + impl #bms_lua::bindings::proxy::LuaProxied for #target_type { + type Proxy = #proxy_type_ident; + } + + impl #tealr::mlu::TealData for #proxy_type_ident { + fn add_methods<'lua, M: #tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut M) { + #(#type_level_document_calls)* + #(#add_composite_function_stmts)* + #(#add_function_stmts)* + } + } + + + impl<'lua> #tealr::mlu::mlua::FromLua<'lua> for #proxy_type_ident { + fn from_lua( + value: #tealr::mlu::mlua::Value<'lua>, + _lua: &#tealr::mlu::mlua::Lua, + ) -> Result { + match value { + tealr::mlu::mlua::Value::UserData(ud) => Ok(ud.borrow::()?.clone()), + _ => { + return Err(#tealr::mlu::mlua::Error::FromLuaConversionError { + from: value.type_name(), + to: stringify!(#proxy_type_ident), + message: None, + }) + } + } + } + } + + #conversions + } + .into() +} + diff --git a/crates/bevy_mod_scripting_derive/src/utils.rs b/crates/bevy_mod_scripting_derive/src/utils.rs new file mode 100644 index 0000000000..d8df6bb792 --- /dev/null +++ b/crates/bevy_mod_scripting_derive/src/utils.rs @@ -0,0 +1,59 @@ +use proc_macro2::{Ident, TokenStream}; +use quote::ToTokens; +use syn::{ + parse::{Parse, ParseStream}, + Attribute, Path, PathArguments, PathSegment, Type, TypePath, +}; + +pub fn doc_attribute_to_string_lit(attrs: &Attribute) -> Option { + attrs + .meta + .require_name_value() + .map(|v| v.value.to_token_stream()) + .ok() +} + +pub fn ident_to_type_path(ident: Ident) -> TypePath { + TypePath { + qself: None, + path: Path { + leading_colon: None, + segments: [PathSegment { + ident, + arguments: PathArguments::None, + }] + .into_iter() + .collect(), + }, + } +} +/// Converts the given ToTokens into token stream, stringifies it and removes whitespace +pub fn stringify_token_group(t: &T) -> String { + let mut k = t.into_token_stream().to_string(); + k.retain(|c| !c.is_whitespace()); + k +} + +/// Converts simple type to base string (i.e. one which has a single type identifier) +pub fn type_base_string(t: &Type) -> Option { + match t { + Type::Paren(v) => type_base_string(&v.elem), + Type::Path(p) => Some(p.path.segments.last()?.ident.to_string()), + Type::Ptr(p) => type_base_string(&p.elem), + Type::Reference(r) => type_base_string(&r.elem), + Type::Slice(v) => type_base_string(&v.elem), + _ => None, + } +} + +#[derive(Default, Debug, Clone)] +pub struct EmptyToken; + +impl Parse for EmptyToken { + fn parse(_: ParseStream) -> Result { + Ok(Self) + } +} +impl ToTokens for EmptyToken { + fn to_tokens(&self, _: &mut TokenStream) {} +} diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index f8288805d8..d483005013 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -41,6 +41,7 @@ path = "src/lib.rs" [dependencies] bevy = { workspace = true, default-features = false } bevy_mod_scripting_core = { workspace = true } +bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } tealr = { version = "0.9", features = [ "mlua_vendored", "mlua_send", @@ -49,3 +50,6 @@ tealr = { version = "0.9", features = [ parking_lot = "0.12.1" serde_json = "1.0.81" anyhow = "1.0.75" +uuid = "1.1" +smol_str = "0.2.2" +smallvec = "1.13" diff --git a/crates/languages/bevy_mod_scripting_lua/src/assets.rs b/crates/languages/bevy_mod_scripting_lua/src/assets.rs index 7e3e50d74b..b7d54e0c7a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/assets.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/assets.rs @@ -1,157 +1,157 @@ -use bevy::{ - asset::{io::Reader, Asset, AssetLoader}, - reflect::TypePath, - utils::BoxedFuture, -}; -use bevy_mod_scripting_core::asset::CodeAsset; +// use bevy::{ +// asset::{io::Reader, Asset, AssetLoader}, +// reflect::TypePath, +// utils::BoxedFuture, +// }; +// use bevy_mod_scripting_core::asset::CodeAsset; -use anyhow::Error; +// use anyhow::Error; -#[derive(Asset, TypePath, Debug)] -/// A lua code file in bytes -pub struct LuaFile { - pub bytes: Vec, -} +// #[derive(Asset, TypePath, Debug)] +// /// A lua code file in bytes +// pub struct LuaFile { +// pub bytes: Vec, +// } -impl CodeAsset for LuaFile { - fn bytes(&self) -> &[u8] { - self.bytes.as_slice() - } -} +// impl CodeAsset for LuaFile { +// fn bytes(&self) -> &[u8] { +// self.bytes.as_slice() +// } +// } -#[derive(Default)] -/// Asset loader for lua scripts -pub struct LuaLoader; +// #[derive(Default)] +// /// Asset loader for lua scripts +// pub struct LuaLoader; -fn old_lua_load<'a>( - bytes: &'a [u8], - load_context: &'a mut bevy::asset::LoadContext, -) -> BoxedFuture<'a, Result, Error>> { - match load_context.path().extension().map(|s| s.to_str().unwrap()) { - #[cfg(all(feature = "teal", debug_assertions))] - Some("tl") => { - use bevy::asset::io::file::FileAssetReader; - use std::fs; - use std::path::PathBuf; - use std::process::Command; +// fn old_lua_load<'a>( +// bytes: &'a [u8], +// load_context: &'a mut bevy::asset::LoadContext, +// ) -> BoxedFuture<'a, Result, Error>> { +// match load_context.path().extension().map(|s| s.to_str().unwrap()) { +// #[cfg(all(feature = "teal", debug_assertions))] +// Some("tl") => { +// use bevy::asset::io::file::FileAssetReader; +// use std::fs; +// use std::path::PathBuf; +// use std::process::Command; - let scripts_dir = &FileAssetReader::get_base_path() - .join("assets") - .join("scripts"); +// let scripts_dir = &FileAssetReader::get_base_path() +// .join("assets") +// .join("scripts"); - let temp_file_path = &std::env::temp_dir().join("bevy_mod_scripting.temp.lua"); - bevy::prelude::info!("tl file path {}", scripts_dir.to_str().unwrap()); - // optionally put the output in the /build folder - let build_dir_path: Option = - if load_context.path().starts_with("scripts/build/") { - Some( - load_context - .path() - .strip_prefix("scripts/") - .unwrap() - .to_owned(), - ) - } else if load_context.path().starts_with("scripts/") { - Some( - PathBuf::from("build/") - .join(load_context.path().strip_prefix("scripts/").unwrap()), - ) - } else { - None - }; +// let temp_file_path = &std::env::temp_dir().join("bevy_mod_scripting.temp.lua"); +// bevy::prelude::info!("tl file path {}", scripts_dir.to_str().unwrap()); +// // optionally put the output in the /build folder +// let build_dir_path: Option = +// if load_context.path().starts_with("scripts/build/") { +// Some( +// load_context +// .path() +// .strip_prefix("scripts/") +// .unwrap() +// .to_owned(), +// ) +// } else if load_context.path().starts_with("scripts/") { +// Some( +// PathBuf::from("build/") +// .join(load_context.path().strip_prefix("scripts/").unwrap()), +// ) +// } else { +// None +// }; - let full_path = &FileAssetReader::get_base_path() - .join("assets") - .join(load_context.path()); - bevy::log::info!( - "tl check {} : {}", - full_path.to_str().unwrap(), - scripts_dir.to_str().unwrap() - ); - if let Ok(e) = Command::new("tl") - .args(["check", full_path.to_str().unwrap()]) - .current_dir(scripts_dir) - .status() - { - if !e.success() { - return Box::pin(async move { - Err(Error::msg(format!( - "Teal file `{}` has errors", - load_context.path().to_str().unwrap() - ))) - }); - } - } else { - fs::remove_file(temp_file_path).expect("Something went wrong running `tl check`"); - panic!("Something went wrong running `tl check`"); - } +// let full_path = &FileAssetReader::get_base_path() +// .join("assets") +// .join(load_context.path()); +// bevy::log::info!( +// "tl check {} : {}", +// full_path.to_str().unwrap(), +// scripts_dir.to_str().unwrap() +// ); +// if let Ok(e) = Command::new("tl") +// .args(["check", full_path.to_str().unwrap()]) +// .current_dir(scripts_dir) +// .status() +// { +// if !e.success() { +// return Box::pin(async move { +// Err(Error::msg(format!( +// "Teal file `{}` has errors", +// load_context.path().to_str().unwrap() +// ))) +// }); +// } +// } else { +// fs::remove_file(temp_file_path).expect("Something went wrong running `tl check`"); +// panic!("Something went wrong running `tl check`"); +// } - if let Ok(e) = Command::new("tl") - .args([ - "gen", - full_path.to_str().unwrap(), - "-o", - temp_file_path.to_str().unwrap(), - ]) - .current_dir(scripts_dir) - .status() - { - if !e.success() { - return Box::pin(async move { - Err(Error::msg(format!( - "Teal file `{}` could not be compiled!", - load_context.path().to_str().unwrap() - ))) - }); - } - } else { - fs::remove_file(temp_file_path).expect("Something went wrong running `tl gen`"); - panic!("Something went wrong running `tl gen`") - } +// if let Ok(e) = Command::new("tl") +// .args([ +// "gen", +// full_path.to_str().unwrap(), +// "-o", +// temp_file_path.to_str().unwrap(), +// ]) +// .current_dir(scripts_dir) +// .status() +// { +// if !e.success() { +// return Box::pin(async move { +// Err(Error::msg(format!( +// "Teal file `{}` could not be compiled!", +// load_context.path().to_str().unwrap() +// ))) +// }); +// } +// } else { +// fs::remove_file(temp_file_path).expect("Something went wrong running `tl gen`"); +// panic!("Something went wrong running `tl gen`") +// } - if let Some(mut build_dir_path) = build_dir_path { - build_dir_path = scripts_dir.join(build_dir_path); - let _ = fs::create_dir_all(build_dir_path.parent().unwrap()); - let _ = fs::copy(temp_file_path, build_dir_path.with_extension("lua")); - } +// if let Some(mut build_dir_path) = build_dir_path { +// build_dir_path = scripts_dir.join(build_dir_path); +// let _ = fs::create_dir_all(build_dir_path.parent().unwrap()); +// let _ = fs::copy(temp_file_path, build_dir_path.with_extension("lua")); +// } - let lua_code = - fs::read_to_string(temp_file_path).expect("Could not find output lua file"); - fs::remove_file(temp_file_path).unwrap(); +// let lua_code = +// fs::read_to_string(temp_file_path).expect("Could not find output lua file"); +// fs::remove_file(temp_file_path).unwrap(); - Box::pin(async move { Ok(lua_code.as_bytes().into()) }) - } +// Box::pin(async move { Ok(lua_code.as_bytes().into()) }) +// } - _ => Box::pin(async move { Ok(bytes.into()) }), - } -} -impl AssetLoader for LuaLoader { - type Asset = LuaFile; - type Settings = (); - type Error = Error; +// _ => Box::pin(async move { Ok(bytes.into()) }), +// } +// } +// impl AssetLoader for LuaLoader { +// type Asset = LuaFile; +// type Settings = (); +// type Error = 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()); - 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 }) - } +// 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()); +// 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")] - fn extensions(&self) -> &[&str] { - &["lua", "tl"] - } - #[cfg(not(feature = "teal"))] - fn extensions(&self) -> &[&str] { - &["lua"] - } -} +// #[cfg(feature = "teal")] +// fn extensions(&self) -> &[&str] { +// &["lua", "tl"] +// } +// #[cfg(not(feature = "teal"))] +// fn extensions(&self) -> &[&str] { +// &["lua"] +// } +// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs index 384af4032b..5a278b6306 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs @@ -1,3 +1,8 @@ use bevy_mod_scripting_core::bindings::WorldCallbackAccess; pub mod providers; +pub mod proxy; +pub mod reference; +pub mod std; +pub mod type_registration; +pub mod world; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs index b6ef3788e4..991607f1cb 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs @@ -4,41 +4,48 @@ #![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, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::a11y::Focus", functions[])] -struct Focus(ReflectedValue); +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::a11y::Focus", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[] +)] +pub struct Focus(ReflectReference); #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::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( +fn bevy_a_11_y_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyA11YScriptingPlugin; +impl bevy::app::Plugin for BevyA11YScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_a_11_y_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyA11YAPI", |tw| { tw.document_global_instance::() @@ -46,24 +53,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyA11YAPIProvider { .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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs index f205ff73bd..050cbea514 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs @@ -4,67 +4,73 @@ #![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, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::core::prelude::Name", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::core::prelude::Name; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &name::Name) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{}", _self) } "#] )] -struct Name {} +pub struct Name {} #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { Ok(()) } } -pub struct BevyCoreAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyCoreAPIProvider { - 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( +fn bevy_core_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyCoreScriptingPlugin; +impl bevy::app::Plugin for BevyCoreScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_core_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyCoreAPI", |tw| { tw.document_global_instance::() @@ -72,24 +78,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyCoreAPIProvider { .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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs index 8f3b5d4e27..bbda61844f 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs @@ -3,18 +3,27 @@ #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] use super::bevy_reflect::*; -extern crate self as bevy_script_api; -use bevy_script_api::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::entity::Entity", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::entity::Entity; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -28,8 +37,8 @@ use bevy_script_api::{ /// `Entity` lines up between instances, but instead insert a secondary identifier as /// a component. - #[lua(kind = "Function", output(proxy))] - fn from_raw(index: u32) -> bevy::ecs::entity::Entity; + #[lua()] + fn from_raw(index: u32) -> LuaReflectValProxy; "#, r#" @@ -38,8 +47,8 @@ use bevy_script_api::{ /// for serialization between runs. /// No particular structure is guaranteed for the returned bits. - #[lua(kind = "Method")] - fn to_bits(self) -> u64; + #[lua()] + fn to_bits(_self: LuaReflectValProxy) -> u64; "#, r#" @@ -48,8 +57,8 @@ use bevy_script_api::{ /// # Panics /// This method will likely panic if given `u64` values that did not come from [`Entity::to_bits`]. - #[lua(kind = "Function", output(proxy))] - fn from_bits(bits: u64) -> bevy::ecs::entity::Entity; + #[lua()] + fn from_bits(bits: u64) -> LuaReflectValProxy; "#, r#" @@ -58,8 +67,8 @@ use bevy_script_api::{ /// with both live and dead entities. Useful for compactly representing entities within a /// specific snapshot of the world, such as when serializing. - #[lua(kind = "Method")] - fn index(self) -> u32; + #[lua()] + fn index(_self: LuaReflectValProxy) -> u32; "#, r#" @@ -67,90 +76,97 @@ use bevy_script_api::{ /// entity with a given index is despawned. This serves as a "count" of the number of times a /// given index has been reused (index, generation) pairs uniquely identify a given Entity. - #[lua(kind = "Method")] - fn generation(self) -> u32; + #[lua()] + fn generation(_self: LuaReflectValProxy) -> u32; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &entity::Entity) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Entity {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Entity {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::ecs::world::OnAdd", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct OnAdd {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct OnAdd {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::ecs::world::OnInsert", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct OnInsert {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct OnInsert {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::ecs::world::OnRemove", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct OnRemove {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct OnRemove {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::ecs::world::OnReplace", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct OnReplace {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct OnReplace {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::component::ComponentId", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &component::ComponentId) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -158,128 +174,137 @@ struct OnReplace {} /// 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()] + fn new(index: usize) -> LuaReflectValProxy; "#, r#" /// Returns the index of the current component. - #[lua(kind = "Method")] - fn index(self) -> usize; + #[lua()] + fn index(_self: LuaReflectValProxy) -> usize; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::ComponentId; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ComponentId(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct ComponentId(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::component::Tick", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &component::Tick) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::Tick; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new [`Tick`] wrapping the given value. - #[lua(kind = "Function", output(proxy))] - fn new(tick: u32) -> bevy::ecs::component::Tick; + #[lua()] + fn new(tick: u32) -> LuaReflectValProxy; "#, r#" /// Gets the value of this change tick. - #[lua(kind = "Method")] - fn get(self) -> u32; + #[lua()] + fn get(_self: LuaReflectValProxy) -> u32; "#, r#" /// Sets the value of this change tick. - #[lua(kind = "MutatingMethod")] - fn set(&mut self, tick: u32) -> (); + #[lua()] + fn set(_self: LuaReflectRefMutProxy, tick: u32) -> (); "#, r#" /// Returns `true` if this `Tick` occurred since the system's `last_run`. /// `this_run` is the current tick of the system, used as a reference to help deal with wraparound. - #[lua(kind = "Method")] + #[lua()] fn is_newer_than( - self, - #[proxy] - last_run: bevy::ecs::component::Tick, - #[proxy] - this_run: bevy::ecs::component::Tick, + _self: LuaReflectValProxy, + last_run: LuaReflectValProxy, + this_run: LuaReflectValProxy, ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Tick {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Tick {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::component::ComponentTicks", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::ComponentTicks; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if the component or resource was added after the system last ran /// (or the system is running for the first time). - #[lua(kind = "Method")] + #[lua()] fn is_added( - &self, - #[proxy] - last_run: bevy::ecs::component::Tick, - #[proxy] - this_run: bevy::ecs::component::Tick, + _self: LuaReflectRefProxy, + last_run: LuaReflectValProxy, + this_run: LuaReflectValProxy, ) -> bool; "#, @@ -287,28 +312,30 @@ struct Tick {} /// Returns `true` if the component or resource was added or mutably dereferenced after the system last ran /// (or the system is running for the first time). - #[lua(kind = "Method")] + #[lua()] fn is_changed( - &self, - #[proxy] - last_run: bevy::ecs::component::Tick, - #[proxy] - this_run: bevy::ecs::component::Tick, + _self: LuaReflectRefProxy, + last_run: LuaReflectValProxy, + this_run: LuaReflectValProxy, ) -> bool; "#, r#" /// Returns the tick recording the time this component or resource was most recently changed. - #[lua(kind = "Method", output(proxy))] - fn last_changed_tick(&self) -> bevy::ecs::component::Tick; + #[lua()] + fn last_changed_tick( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn added_tick( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -324,59 +351,66 @@ struct Tick {} /// component_ticks.set_changed(world.read_change_tick()); /// ``` - #[lua(kind = "MutatingMethod")] - fn set_changed(&mut self, #[proxy] change_tick: bevy::ecs::component::Tick) -> (); + #[lua()] + fn set_changed( + _self: LuaReflectRefMutProxy, + change_tick: LuaReflectValProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ComponentTicks {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct ComponentTicks {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::identifier::Identifier", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::identifier::Identifier; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &identifier::Identifier) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Returns the value of the low segment of the [`Identifier`]. - #[lua(kind = "Method")] - fn low(self) -> u32; + #[lua()] + fn low(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the masked value of the high segment of the [`Identifier`]. /// Does not include the flag bits. - #[lua(kind = "Method")] - fn masked_high(self) -> u32; + #[lua()] + fn masked_high(_self: LuaReflectValProxy) -> u32; "#, r#" /// Convert the [`Identifier`] into a `u64`. - #[lua(kind = "Method")] - fn to_bits(self) -> u64; + #[lua()] + fn to_bits(_self: LuaReflectValProxy) -> u64; "#, r#" @@ -384,164 +418,137 @@ struct ComponentTicks {} /// # Panics /// This method will likely panic if given `u64` values that did not come from [`Identifier::to_bits`]. - #[lua(kind = "Function", output(proxy))] - fn from_bits(value: u64) -> bevy::ecs::identifier::Identifier; + #[lua()] + fn from_bits(value: u64) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Identifier {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Identifier {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::entity::EntityHash", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::entity::EntityHash; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#] )] -struct EntityHash {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct EntityHash {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::ecs::removal_detection::RemovedComponentEntity", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::removal_detection::RemovedComponentEntity; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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 {} +pub struct RemovedComponentEntity(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::ecs::system::SystemIdMarker", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[] +)] +pub struct SystemIdMarker {} #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances - .add_instance( - "Entity", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Entity", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "ComponentId", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Tick", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Tick", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Identifier", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; Ok(()) } } -pub struct BevyEcsAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { - 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( +fn bevy_ecs_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyEcsScriptingPlugin; +impl bevy::app::Plugin for BevyEcsScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_ecs_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyEcsAPI", |tw| { 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::() .process_type::() .process_type::() .process_type::() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaComponentId, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaIdentifier, - >, + crate::tealr::mlu::UserDataProxy, >() .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::(); - app.register_foreign_lua_type::< - bevy::ecs::removal_detection::RemovedComponentEntity, - >(); - app.register_foreign_lua_type::(); + ); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs index 2cb1efa99e..5db574d547 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs @@ -5,128 +5,140 @@ use super::bevy_ecs::*; use super::bevy_reflect::*; use super::bevy_core::*; -extern crate self as bevy_script_api; -use bevy_script_api::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::hierarchy::prelude::Children", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Swaps the child at `a_index` with the child at `b_index`. - #[lua(kind = "MutatingMethod")] - fn swap(&mut self, a_index: usize, b_index: usize) -> (); + #[lua()] + fn swap( + _self: LuaReflectRefMutProxy, + a_index: usize, + b_index: usize, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Children(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Children(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::hierarchy::prelude::Parent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Parent(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Parent(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::hierarchy::HierarchyEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &events::HierarchyEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::hierarchy::HierarchyEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct HierarchyEvent {} +pub struct HierarchyEvent {} #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { Ok(()) } } -pub struct BevyHierarchyAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider { - 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( +fn bevy_hierarchy_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyHierarchyScriptingPlugin; +impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_hierarchy_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyHierarchyAPI", |tw| { tw.document_global_instance::() @@ -136,26 +148,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider { .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::(); + ); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs index f13ae2f8ef..6fb241e53a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs @@ -6,1157 +6,1171 @@ 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::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "bevy::input::gamepad::Gamepad", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Returns the left stick as a [`Vec2`] - - #[lua(kind = "Method", output(proxy))] - fn left_stick(&self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the right stick as a [`Vec2`] - - #[lua(kind = "Method", output(proxy))] - fn right_stick(&self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the directional pad as a [`Vec2`] - - #[lua(kind = "Method", output(proxy))] - fn dpad(&self) -> bevy::math::Vec2; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Gamepad { +pub struct Gamepad { vendor_id: std::option::Option, product_id: std::option::Option, - digital: ReflectedValue, - analog: ReflectedValue, + digital: ReflectReference, + analog: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadAxis", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadAxis; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadAxis {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GamepadAxis {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadButton", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButton; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButton) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadButton {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GamepadButton {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadSettings", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadSettings; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadSettings { - #[lua(output(proxy))] +pub struct GamepadSettings { 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, + button_settings: ReflectReference, + axis_settings: ReflectReference, + button_axis_settings: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::keyboard::KeyCode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyCode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct KeyCode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct KeyCode {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::MouseButton", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseButton; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::MouseButton) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct MouseButton {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct MouseButton {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::touch::TouchInput", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::touch::TouchInput; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &touch::TouchInput) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct TouchInput { - #[lua(output(proxy))] +pub struct TouchInput { phase: bevy::input::touch::TouchPhase, - #[lua(output(proxy))] - position: bevy::math::Vec2, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - force: ReflectedValue, + position: ReflectReference, + window: ReflectReference, + force: ReflectReference, id: u64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::keyboard::KeyboardFocusLost", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &keyboard::KeyboardFocusLost) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyboardFocusLost; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct KeyboardFocusLost {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct KeyboardFocusLost {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::keyboard::KeyboardInput", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &keyboard::KeyboardInput) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::KeyboardInput; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct KeyboardInput { - #[lua(output(proxy))] +pub struct KeyboardInput { key_code: bevy::input::keyboard::KeyCode, - #[lua(output(proxy))] logical_key: bevy::input::keyboard::Key, - #[lua(output(proxy))] state: bevy::input::ButtonState, repeat: bool, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::AccumulatedMouseMotion", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::AccumulatedMouseMotion) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::AccumulatedMouseMotion; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AccumulatedMouseMotion { - #[lua(output(proxy))] - delta: bevy::math::Vec2, +pub struct AccumulatedMouseMotion { + delta: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::AccumulatedMouseScroll", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::AccumulatedMouseScroll; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::AccumulatedMouseScroll) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AccumulatedMouseScroll { - #[lua(output(proxy))] +pub struct AccumulatedMouseScroll { unit: bevy::input::mouse::MouseScrollUnit, - #[lua(output(proxy))] - delta: bevy::math::Vec2, + delta: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::MouseButtonInput", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::MouseButtonInput) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseButtonInput; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct MouseButtonInput { - #[lua(output(proxy))] +pub struct MouseButtonInput { button: bevy::input::mouse::MouseButton, - #[lua(output(proxy))] state: bevy::input::ButtonState, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::MouseMotion", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::MouseMotion) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseMotion; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct MouseMotion { - #[lua(output(proxy))] - delta: bevy::math::Vec2, +pub struct MouseMotion { + delta: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::MouseWheel", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseWheel; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::MouseWheel) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct MouseWheel { - #[lua(output(proxy))] +pub struct MouseWheel { unit: bevy::input::mouse::MouseScrollUnit, x: f32, y: f32, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadAxisChangedEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadAxisChangedEvent { - #[lua(output(proxy))] - entity: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct GamepadAxisChangedEvent { + entity: ReflectReference, axis: bevy::input::gamepad::GamepadAxis, value: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadButtonChangedEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButtonChangedEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> 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))] - fn new( - #[proxy] - entity: bevy::ecs::entity::Entity, - #[proxy] - button: bevy::input::gamepad::GamepadButton, - #[proxy] - state: bevy::input::ButtonState, - value: f32, - ) -> bevy::input::gamepad::GamepadButtonChangedEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadButtonChangedEvent { - #[lua(output(proxy))] - entity: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct GamepadButtonChangedEvent { + entity: ReflectReference, button: bevy::input::gamepad::GamepadButton, - #[lua(output(proxy))] state: bevy::input::ButtonState, value: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadButtonStateChangedEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadButtonStateChangedEvent; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadButtonStateChangedEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadButtonStateChangedEvent { - #[lua(output(proxy))] - entity: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct GamepadButtonStateChangedEvent { + entity: ReflectReference, button: bevy::input::gamepad::GamepadButton, - #[lua(output(proxy))] state: bevy::input::ButtonState, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadConnection", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadConnection) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadConnection; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadConnection {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GamepadConnection {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadConnectionEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadConnectionEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadConnectionEvent) -> bool; - -"#, - r#" -/// Creates a [`GamepadConnectionEvent`]. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - gamepad: bevy::ecs::entity::Entity, - #[proxy] - connection: bevy::input::gamepad::GamepadConnection, - ) -> bevy::input::gamepad::GamepadConnectionEvent; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Is the gamepad connected? - #[lua(kind = "Method")] - fn connected(&self) -> bool; + #[lua()] + fn connected( + _self: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Is the gamepad disconnected? - #[lua(kind = "Method")] - fn disconnected(&self) -> bool; + #[lua()] + fn disconnected( + _self: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadConnectionEvent { - #[lua(output(proxy))] - gamepad: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct GamepadConnectionEvent { + gamepad: ReflectReference, connection: bevy::input::gamepad::GamepadConnection, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadEvent {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GamepadEvent {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadInput", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadInput) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadInput; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadInput {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GamepadInput {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadRumbleRequest", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#] )] -struct GamepadRumbleRequest {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GamepadRumbleRequest {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::RawGamepadAxisChangedEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::RawGamepadAxisChangedEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadAxisChangedEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RawGamepadAxisChangedEvent { - #[lua(output(proxy))] - gamepad: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct RawGamepadAxisChangedEvent { + gamepad: ReflectReference, axis: bevy::input::gamepad::GamepadAxis, value: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::RawGamepadButtonChangedEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::RawGamepadButtonChangedEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RawGamepadButtonChangedEvent { - #[lua(output(proxy))] - gamepad: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct RawGamepadButtonChangedEvent { + gamepad: ReflectReference, button: bevy::input::gamepad::GamepadButton, value: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::RawGamepadEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::RawGamepadEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RawGamepadEvent {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct RawGamepadEvent {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gestures::PinchGesture", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gestures::PinchGesture) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::PinchGesture; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct PinchGesture(f32); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct PinchGesture(f32); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gestures::RotationGesture", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gestures::RotationGesture) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::RotationGesture; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RotationGesture(f32); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct RotationGesture(f32); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gestures::DoubleTapGesture", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gestures::DoubleTapGesture) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::DoubleTapGesture; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct DoubleTapGesture {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct DoubleTapGesture {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gestures::PanGesture", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gestures::PanGesture; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gestures::PanGesture) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct PanGesture(ReflectReference); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::ButtonState", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" /// Is this button pressed? - #[lua(kind = "Method")] - fn is_pressed(&self) -> bool; + #[lua()] + fn is_pressed(_self: LuaReflectRefProxy) -> bool; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &ButtonState) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::ButtonState; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ButtonState {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct ButtonState {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::ButtonSettings", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::ButtonSettings) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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. - #[lua(kind = "Method")] - fn is_pressed(&self, value: f32) -> bool; + #[lua()] + fn is_pressed( + _self: LuaReflectRefProxy, + value: f32, + ) -> bool; "#, r#" /// Returns `true` if the button is released. /// A button is considered released if the `value` passed is lower than or equal to the release threshold. - #[lua(kind = "Method")] - fn is_released(&self, value: f32) -> bool; + #[lua()] + fn is_released( + _self: LuaReflectRefProxy, + value: f32, + ) -> bool; "#, r#" /// Get the button input threshold above which the button is considered pressed. - #[lua(kind = "Method")] - fn press_threshold(&self) -> f32; + #[lua()] + fn press_threshold( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -1164,15 +1178,20 @@ struct ButtonState {} /// If the value passed is outside the range [release threshold..=1.0], the value will not be changed. /// Returns the new value of the press threshold. - #[lua(kind = "MutatingMethod")] - fn set_press_threshold(&mut self, value: f32) -> f32; + #[lua()] + fn set_press_threshold( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" /// Get the button input threshold below which the button is considered released. - #[lua(kind = "Method")] - fn release_threshold(&self) -> f32; + #[lua()] + fn release_threshold( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -1180,39 +1199,49 @@ struct ButtonState {} /// value passed is outside the range [0.0..=press threshold], the value will not be changed. /// Returns the new value of the release threshold. - #[lua(kind = "MutatingMethod")] - fn set_release_threshold(&mut self, value: f32) -> f32; + #[lua()] + fn set_release_threshold( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonSettings; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ButtonSettings {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct ButtonSettings {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::AxisSettings", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::AxisSettings; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the value above which inputs will be rounded up to 1.0. - #[lua(kind = "Method")] - fn livezone_upperbound(&self) -> f32; + #[lua()] + fn livezone_upperbound( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -1221,15 +1250,20 @@ struct ButtonSettings {} /// the value will not be changed. /// Returns the new value of `livezone_upperbound`. - #[lua(kind = "MutatingMethod")] - fn set_livezone_upperbound(&mut self, value: f32) -> f32; + #[lua()] + fn set_livezone_upperbound( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" /// Get the value below which positive inputs will be rounded down to 0.0. - #[lua(kind = "Method")] - fn deadzone_upperbound(&self) -> f32; + #[lua()] + fn deadzone_upperbound( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -1238,15 +1272,20 @@ struct ButtonSettings {} /// the value will not be changed. /// Returns the new value of `deadzone_upperbound`. - #[lua(kind = "MutatingMethod")] - fn set_deadzone_upperbound(&mut self, value: f32) -> f32; + #[lua()] + fn set_deadzone_upperbound( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" /// Get the value below which negative inputs will be rounded down to -1.0. - #[lua(kind = "Method")] - fn livezone_lowerbound(&self) -> f32; + #[lua()] + fn livezone_lowerbound( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -1255,15 +1294,20 @@ struct ButtonSettings {} /// the value will not be changed. /// Returns the new value of `livezone_lowerbound`. - #[lua(kind = "MutatingMethod")] - fn set_livezone_lowerbound(&mut self, value: f32) -> f32; + #[lua()] + fn set_livezone_lowerbound( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" /// Get the value above which inputs will be rounded up to 0.0. - #[lua(kind = "Method")] - fn deadzone_lowerbound(&self) -> f32; + #[lua()] + fn deadzone_lowerbound( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -1272,15 +1316,18 @@ struct ButtonSettings {} /// the value will not be changed. /// Returns the new value of `deadzone_lowerbound`. - #[lua(kind = "MutatingMethod")] - fn set_deadzone_lowerbound(&mut self, value: f32) -> f32; + #[lua()] + fn set_deadzone_lowerbound( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" /// Get the minimum value by which input must change before the change is registered. - #[lua(kind = "Method")] - fn threshold(&self) -> f32; + #[lua()] + fn threshold(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -1288,15 +1335,21 @@ struct ButtonSettings {} /// If the value passed is not within [0.0..=2.0], the value will not be changed. /// Returns the new value of threshold. - #[lua(kind = "MutatingMethod")] - fn set_threshold(&mut self, value: f32) -> f32; + #[lua()] + fn set_threshold( + _self: LuaReflectRefMutProxy, + value: f32, + ) -> f32; "#, r#" /// Clamps the `raw_value` according to the `AxisSettings`. - #[lua(kind = "Method")] - fn clamp(&self, new_value: f32) -> f32; + #[lua()] + fn clamp( + _self: LuaReflectRefProxy, + new_value: f32, + ) -> f32; "#, r#" @@ -1304,9 +1357,9 @@ struct ButtonSettings {} /// Returns the clamped `new_value` if the change exceeds the settings threshold, /// and `None` otherwise. - #[lua(kind = "Method")] + #[lua()] fn filter( - &self, + _self: LuaReflectRefProxy, new_value: f32, old_value: std::option::Option, ) -> std::option::Option; @@ -1315,34 +1368,36 @@ struct ButtonSettings {} r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::AxisSettings) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AxisSettings {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AxisSettings {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::ButtonAxisSettings", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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. - #[lua(kind = "Method")] + #[lua()] fn filter( - &self, + _self: LuaReflectRefProxy, new_value: f32, old_value: std::option::Option, ) -> std::option::Option; @@ -1350,351 +1405,386 @@ struct AxisSettings {} "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::ButtonAxisSettings; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ButtonAxisSettings { +pub struct ButtonAxisSettings { high: f32, low: f32, threshold: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::gamepad::GamepadRumbleIntensity", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadRumbleIntensity; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &gamepad::GamepadRumbleIntensity) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua()] + fn weak_motor( + intensity: f32, + ) -> LuaReflectValProxy; "#, 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()] + fn strong_motor( + intensity: f32, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GamepadRumbleIntensity { +pub struct GamepadRumbleIntensity { strong_motor: f32, weak_motor: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::keyboard::Key", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::Key; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &keyboard::Key) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Key {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Key {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::keyboard::NativeKeyCode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::NativeKeyCode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &keyboard::NativeKeyCode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct NativeKeyCode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct NativeKeyCode {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::keyboard::NativeKey", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &keyboard::NativeKey) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::NativeKey; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct NativeKey {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct NativeKey {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::mouse::MouseScrollUnit", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseScrollUnit; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &mouse::MouseScrollUnit) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct MouseScrollUnit {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct MouseScrollUnit {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::touch::TouchPhase", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::touch::TouchPhase; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct TouchPhase {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct TouchPhase {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::input::touch::ForceTouch", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::touch::ForceTouch; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &touch::ForceTouch) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ForceTouch {} +pub struct ForceTouch {} #[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( - "GamepadAxisChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadAxisChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadButtonChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadButtonChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadButtonStateChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadButtonStateChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadConnectionEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadConnectionEvent, - >::new, - )?; - instances - .add_instance( - "RawGamepadAxisChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaRawGamepadAxisChangedEvent, - >::new, - )?; - instances - .add_instance( - "RawGamepadButtonChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaRawGamepadButtonChangedEvent, - >::new, - )?; +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances .add_instance( "GamepadRumbleIntensity", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadRumbleIntensity, - >::new, + crate::tealr::mlu::UserDataProxy::::new, )?; Ok(()) } } -pub struct BevyInputAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { - 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( +fn bevy_input_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyInputScriptingPlugin; +impl bevy::app::Plugin for BevyInputScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_input_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyInputAPI", |tw| { tw.document_global_instance::() @@ -1714,45 +1804,15 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { .process_type::() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadAxisChangedEvent, - >, - >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadButtonChangedEvent, - >, - >() .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< - LuaGamepadConnectionEvent, - >, - >() .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::() @@ -1764,9 +1824,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { .process_type::() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadRumbleIntensity, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() .process_type::() @@ -1776,71 +1834,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { .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::(); - 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::GamepadButtonChangedEvent, - >(); - 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::< - 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::(); - app.register_foreign_lua_type::(); + ); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs index 822cdb30a3..67c56c306b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs @@ -3,207 +3,210 @@ #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] use super::bevy_reflect::*; -extern crate self as bevy_script_api; -use bevy_script_api::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::AspectRatio", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Returns the aspect ratio as a f32 value. - #[lua(kind = "Method")] - fn ratio(&self) -> f32; + #[lua()] + fn ratio(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Returns the inverse of this aspect ratio (height/width). - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::AspectRatio; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns true if the aspect ratio represents a landscape orientation. - #[lua(kind = "Method")] - fn is_landscape(&self) -> bool; + #[lua()] + fn is_landscape(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns true if the aspect ratio represents a portrait orientation. - #[lua(kind = "Method")] - fn is_portrait(&self) -> bool; + #[lua()] + fn is_portrait(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns true if the aspect ratio is exactly square. - #[lua(kind = "Method")] - fn is_square(&self) -> bool; + #[lua()] + fn is_square(_self: LuaReflectRefProxy) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::AspectRatio; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AspectRatio(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AspectRatio(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::CompassOctant", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::CompassOctant; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &compass::CompassOctant) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CompassOctant {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct CompassOctant {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::CompassQuadrant", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &compass::CompassQuadrant) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::CompassQuadrant; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CompassQuadrant {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct CompassQuadrant {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Isometry2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Isometry2d; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Create a two-dimensional isometry from a rotation and a translation. - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - translation: bevy::math::prelude::Vec2, - #[proxy] - rotation: bevy::math::Rot2, - ) -> bevy::math::Isometry2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Create a two-dimensional isometry from a rotation. - #[lua(kind = "Function", output(proxy))] - 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; + #[lua()] + fn from_rotation( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn from_xy(x: f32, y: f32) -> LuaReflectValProxy; "#, r#" /// The inverse isometry that undoes this one. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Isometry2d; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -211,113 +214,61 @@ struct CompassQuadrant {} /// 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))] + #[lua()] fn inverse_mul( - &self, - #[proxy] - rhs: bevy::math::Isometry2d, - ) -> bevy::math::Isometry2d; + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Isometry2d { - #[lua(output(proxy))] +pub struct Isometry2d { rotation: bevy::math::Rot2, - #[lua(output(proxy))] - translation: bevy::math::prelude::Vec2, + translation: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Isometry3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Create a three-dimensional isometry from a rotation. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation( - #[proxy] - rotation: bevy::math::prelude::Quat, - ) -> bevy::math::Isometry3d; - -"#, - r#" /// 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; + #[lua()] + fn from_xyz(x: f32, y: f32, z: f32) -> LuaReflectValProxy; "#, r#" /// The inverse isometry that undoes this one. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Isometry3d; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -325,274 +276,155 @@ struct Isometry2d { /// 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))] + #[lua()] fn inverse_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::prelude::Vec3) -> bevy::math::prelude::Vec3; + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Isometry3d; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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, +pub struct Isometry3d { + rotation: ReflectReference, + translation: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Ray2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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))] - 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; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Ray2d { - #[lua(output(proxy))] - origin: bevy::math::prelude::Vec2, - #[lua(output(proxy))] +pub struct Ray2d { + origin: ReflectReference, direction: bevy::math::prelude::Dir2, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Ray3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Ray3d; - -"#, - r#" -/// Create a new `Ray3d` from a given origin and direction - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - origin: bevy::math::prelude::Vec3, - #[proxy] - direction: bevy::math::prelude::Dir3, - ) -> bevy::math::Ray3d; - -"#, - 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::Vec3; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::Vec3, - #[proxy] - 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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Ray3d { - #[lua(output(proxy))] - origin: bevy::math::prelude::Vec3, - #[lua(output(proxy))] +pub struct Ray3d { + origin: ReflectReference, direction: bevy::math::prelude::Dir3, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Rot2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Rot2; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::Rot2) -> bevy::math::Rot2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Rotates the [`Dir2`] using a [`Rot2`]. - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( - self, - #[proxy] - direction: bevy::math::prelude::Dir2, - ) -> bevy::math::prelude::Dir2; + _self: LuaReflectValProxy, + direction: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -611,8 +443,8 @@ struct Ray3d { /// assert_relative_eq!(rot1 * rot1, rot3); /// ``` - #[lua(kind = "Function", output(proxy))] - fn radians(radians: f32) -> bevy::math::Rot2; + #[lua()] + fn radians(radians: f32) -> LuaReflectValProxy; "#, r#" @@ -630,8 +462,8 @@ struct Ray3d { /// assert_relative_eq!(rot1 * rot1, rot3); /// ``` - #[lua(kind = "Function", output(proxy))] - fn degrees(degrees: f32) -> bevy::math::Rot2; + #[lua()] + fn degrees(degrees: f32) -> LuaReflectValProxy; "#, r#" @@ -649,8 +481,8 @@ struct Ray3d { /// assert_relative_eq!(rot1 * rot1, rot3); /// ``` - #[lua(kind = "Function", output(proxy))] - fn turn_fraction(fraction: f32) -> bevy::math::Rot2; + #[lua()] + fn turn_fraction(fraction: f32) -> LuaReflectValProxy; "#, r#" @@ -659,36 +491,36 @@ struct Ray3d { /// # Panics /// Panics if `sin * sin + cos * cos != 1.0` when the `glam_assert` feature is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_sin_cos(sin: f32, cos: f32) -> bevy::math::Rot2; + #[lua()] + fn from_sin_cos(sin: f32, cos: f32) -> LuaReflectValProxy; "#, r#" /// Returns the rotation in radians in the `(-pi, pi]` range. - #[lua(kind = "Method")] - fn as_radians(self) -> f32; + #[lua()] + fn as_radians(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the rotation in degrees in the `(-180, 180]` range. - #[lua(kind = "Method")] - fn as_degrees(self) -> f32; + #[lua()] + fn as_degrees(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the rotation as a fraction of a full 360 degree turn. - #[lua(kind = "Method")] - fn as_turn_fraction(self) -> f32; + #[lua()] + fn as_turn_fraction(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the sine and cosine of the rotation angle in radians. - #[lua(kind = "Method")] - fn sin_cos(self) -> (f32, f32); + #[lua()] + fn sin_cos(_self: LuaReflectValProxy) -> (f32, f32); "#, r#" @@ -697,8 +529,8 @@ struct Ray3d { /// can be a result of incorrect construction or floating point error caused by /// successive operations. - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -709,16 +541,16 @@ struct Ray3d { /// can be a result of incorrect construction or floating point error caused by /// successive operations. - #[lua(kind = "Method")] - fn length_squared(self) -> f32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes `1.0 / self.length()`. /// For valid results, `self` must _not_ have a length of zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f32; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -730,8 +562,10 @@ struct Ray3d { /// # Panics /// Panics if `self` has a length of zero, NaN, or infinity when debug assertions are enabled. - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Rot2; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -739,52 +573,59 @@ struct Ray3d { /// 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; + #[lua()] + fn fast_renormalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if the rotation is neither infinite nor NaN. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns `true` if the rotation is NaN. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns whether `self` has a length of `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns `true` if the rotation is near [`Rot2::IDENTITY`]. - #[lua(kind = "Method")] - fn is_near_identity(self) -> bool; + #[lua()] + fn is_near_identity(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns the angle in radians needed to make `self` and `other` coincide. - #[lua(kind = "Method")] - fn angle_between(self, #[proxy] other: bevy::math::Rot2) -> f32; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns the inverse of the rotation. This is also the conjugate /// of the unit complex number representing the rotation. - #[lua(kind = "Method", output(proxy))] - fn inverse(self) -> bevy::math::Rot2; + #[lua()] + fn inverse( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -816,8 +657,12 @@ struct Ray3d { /// assert_eq!(result2.as_degrees(), 67.5); /// ``` - #[lua(kind = "Method", output(proxy))] - fn nlerp(self, #[proxy] end: bevy::math::Rot2, s: f32) -> bevy::math::Rot2; + #[lua()] + fn nlerp( + _self: LuaReflectValProxy, + end: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -840,62 +685,49 @@ struct Ray3d { /// assert_eq!(result2.as_degrees(), 67.5); /// ``` - #[lua(kind = "Method", output(proxy))] - fn slerp(self, #[proxy] end: bevy::math::Rot2, s: f32) -> bevy::math::Rot2; + #[lua()] + fn slerp( + _self: LuaReflectValProxy, + end: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &rotation2d::Rot2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Rot2 { +pub struct Rot2 { cos: f32, sin: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::prelude::Dir2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Create a [`Dir2`] from a [`Vec2`] that is already normalized. -/// # Warning -/// `value` must be normalized, i.e its length must be `1.0`. - - #[lua(kind = "Function", output(proxy))] - fn new_unchecked( - #[proxy] - 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`] - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn from_xy_unchecked( + x: f32, + y: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -917,59 +749,68 @@ struct Rot2 { /// assert_relative_eq!(result2, Dir2::from_xy(0.5_f32.sqrt(), 0.5_f32.sqrt()).unwrap()); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn slerp( - self, - #[proxy] - rhs: bevy::math::prelude::Dir2, + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, s: f32, - ) -> bevy::math::prelude::Dir2; + ) -> LuaReflectValProxy; "#, r#" /// Get the rotation that rotates this direction to `other`. - #[lua(kind = "Method", output(proxy))] - fn rotation_to(self, #[proxy] other: bevy::math::prelude::Dir2) -> bevy::math::Rot2; + #[lua()] + fn rotation_to( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the rotation that rotates `other` to this direction. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn rotation_from( - self, - #[proxy] - other: bevy::math::prelude::Dir2, - ) -> bevy::math::Rot2; + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the rotation that rotates the X-axis to this direction. - #[lua(kind = "Method", output(proxy))] - fn rotation_from_x(self) -> bevy::math::Rot2; + #[lua()] + fn rotation_from_x( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the rotation that rotates this direction to the X-axis. - #[lua(kind = "Method", output(proxy))] - fn rotation_to_x(self) -> bevy::math::Rot2; + #[lua()] + fn rotation_to_x( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the rotation that rotates the Y-axis to this direction. - #[lua(kind = "Method", output(proxy))] - fn rotation_from_y(self) -> bevy::math::Rot2; + #[lua()] + fn rotation_from_y( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the rotation that rotates this direction to the Y-axis. - #[lua(kind = "Method", output(proxy))] - fn rotation_to_y(self) -> bevy::math::Rot2; + #[lua()] + fn rotation_to_y( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -977,108 +818,71 @@ struct Rot2 { /// 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::Dir2; + #[lua()] + fn fast_renormalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::prelude::Dir2; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::prelude::Vec2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Dir2(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Dir2(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::prelude::Dir3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &direction::Dir3) -> bool; - -"#, - 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::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::prelude::Dir3; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -/// Create a [`Dir3`] from a [`Vec3`] that is already normalized. -/// # Warning -/// `value` must be normalized, i.e its length must be `1.0`. - #[lua(kind = "Function", output(proxy))] - fn new_unchecked( - #[proxy] - value: bevy::math::prelude::Vec3, - ) -> bevy::math::prelude::Dir3; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1086,15 +890,12 @@ struct Dir2(); /// # 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`] - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::prelude::Vec3; + #[lua()] + fn from_xyz_unchecked( + x: f32, + y: f32, + z: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -1120,13 +921,12 @@ struct Dir2(); /// assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn slerp( - self, - #[proxy] - rhs: bevy::math::prelude::Dir3, + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, s: f32, - ) -> bevy::math::prelude::Dir3; + ) -> LuaReflectValProxy; "#, r#" @@ -1156,51 +956,44 @@ struct Dir2(); /// } /// ``` - #[lua(kind = "Method", output(proxy))] - fn fast_renormalize(self) -> bevy::math::prelude::Dir3; + #[lua()] + fn fast_renormalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Dir3(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Dir3(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::prelude::Dir3A", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. -/// # Warning -/// `value` must be normalized, i.e its length must be `1.0`. - - #[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`] - - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; + #[lua()] + fn from_xyz_unchecked( + x: f32, + y: f32, + z: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -1226,13 +1019,12 @@ struct Dir3(); /// assert_relative_eq!(result2, Dir3A::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn slerp( - self, - #[proxy] - rhs: bevy::math::prelude::Dir3A, + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, s: f32, - ) -> bevy::math::prelude::Dir3A; + ) -> LuaReflectValProxy; "#, r#" @@ -1240,63 +1032,53 @@ struct Dir3(); /// 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; + #[lua()] + fn fast_renormalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3A; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - 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; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Dir3A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Dir3A(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::prelude::IRect", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Create a new rectangle from two corner points. /// The two points do not need to be the minimum and/or maximum corners. @@ -1308,74 +1090,13 @@ struct Dir3A(); /// let r = IRect::new(2, 3, 5, -1); // w=3 h=4 /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(x0: i32, y0: i32, x1: i32, y1: i32) -> 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. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// // Unit rect from [0,0] to [1,1] -/// let r = IRect::from_corners(IVec2::ZERO, IVec2::ONE); // w=1 h=1 -/// // Same; the points do not need to be ordered -/// let r = IRect::from_corners(IVec2::ONE, IVec2::ZERO); // w=1 h=1 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - p0: bevy::math::prelude::IVec2, - #[proxy] - p1: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Create a new rectangle from its center and size. -/// # 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. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::from_center_size(IVec2::ZERO, IVec2::new(3, 2)); // w=2 h=2 -/// assert_eq!(r.min, IVec2::splat(-1)); -/// assert_eq!(r.max, IVec2::splat(1)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_size( - #[proxy] - origin: bevy::math::prelude::IVec2, - #[proxy] - size: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Create a new rectangle from its center and half-size. -/// # Panics -/// This method panics if any of the components of the half-size is negative. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::from_center_half_size(IVec2::ZERO, IVec2::ONE); // w=2 h=2 -/// assert_eq!(r.min, IVec2::splat(-1)); -/// assert_eq!(r.max, IVec2::splat(1)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_half_size( - #[proxy] - origin: bevy::math::prelude::IVec2, - #[proxy] - half_size: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; + #[lua()] + fn new( + x0: i32, + y0: i32, + x1: i32, + y1: i32, + ) -> LuaReflectValProxy; "#, r#" @@ -1387,8 +1108,8 @@ struct Dir3A(); /// assert!(r.is_empty()); /// ``` - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; + #[lua()] + fn is_empty(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -1400,8 +1121,8 @@ struct Dir3A(); /// assert_eq!(r.width(), 5); /// ``` - #[lua(kind = "Method")] - fn width(&self) -> i32; + #[lua()] + fn width(_self: LuaReflectRefProxy) -> i32; "#, r#" @@ -1413,66 +1134,8 @@ struct Dir3A(); /// assert_eq!(r.height(), 1); /// ``` - #[lua(kind = "Method")] - fn height(&self) -> i32; - -"#, - r#" -/// Rectangle size. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.size(), IVec2::new(5, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::IVec2; - -"#, - r#" -/// Rectangle half-size. -/// # 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 -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 4, 3); // w=4 h=3 -/// assert_eq!(r.half_size(), IVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn half_size(&self) -> bevy::math::prelude::IVec2; - -"#, - r#" -/// The center point of the rectangle. -/// # Rounding Behavior -/// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 2); // w=5 h=2 -/// assert_eq!(r.center(), IVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn center(&self) -> bevy::math::prelude::IVec2; - -"#, - r#" -/// Check if a point lies within this rectangle, inclusive of its edges. -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert!(r.contains(r.center())); -/// assert!(r.contains(r.min)); -/// assert!(r.contains(r.max)); -/// ``` - - #[lua(kind = "Method")] - fn contains(&self, #[proxy] point: bevy::math::prelude::IVec2) -> bool; + #[lua()] + fn height(_self: LuaReflectRefProxy) -> i32; "#, r#" @@ -1488,33 +1151,11 @@ struct Dir3A(); /// assert_eq!(r.max, IVec2::new(5, 3)); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn union( - &self, - #[proxy] - other: bevy::math::prelude::IRect, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and a point. -/// The union is the smallest rectangle enclosing both the rectangle and the point. If the -/// point is already inside the rectangle, this method returns a copy of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let u = r.union_point(IVec2::new(3, 6)); -/// assert_eq!(u.min, IVec2::ZERO); -/// assert_eq!(u.max, IVec2::new(5, 6)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union_point( - &self, - #[proxy] - other: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1532,12 +1173,11 @@ struct Dir3A(); /// assert_eq!(r.max, IVec2::new(3, 1)); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn intersect( - &self, - #[proxy] - other: bevy::math::prelude::IRect, - ) -> bevy::math::prelude::IRect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1558,234 +1198,132 @@ struct Dir3A(); /// assert_eq!(r2.max, IVec2::new(3, 2)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn inflate(&self, expansion: i32) -> bevy::math::prelude::IRect; + #[lua()] + fn inflate( + _self: LuaReflectRefProxy, + expansion: i32, + ) -> LuaReflectValProxy; "#, r#" /// Returns self as [`Rect`] (f32) - #[lua(kind = "Method", output(proxy))] - fn as_rect(&self) -> bevy::math::prelude::Rect; + #[lua()] + fn as_rect( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns self as [`URect`] (u32) - #[lua(kind = "Method", output(proxy))] - fn as_urect(&self) -> bevy::math::prelude::URect; + #[lua()] + fn as_urect( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; -"#, - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct IRect { - #[lua(output(proxy))] - min: bevy::math::prelude::IVec2, - #[lua(output(proxy))] - max: bevy::math::prelude::IVec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::prelude::Rect", - functions[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. -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 -/// let r = Rect::new(2., 3., 5., -1.); // w=3 h=4 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> 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. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// // Unit rect from [0,0] to [1,1] -/// let r = Rect::from_corners(Vec2::ZERO, Vec2::ONE); // w=1 h=1 -/// // Same; the points do not need to be ordered -/// let r = Rect::from_corners(Vec2::ONE, Vec2::ZERO); // w=1 h=1 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - p0: bevy::math::prelude::Vec2, - #[proxy] - p1: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Create a new rectangle from its center and size. -/// # Panics -/// This method panics if any of the components of the size is negative. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_center_size(Vec2::ZERO, Vec2::ONE); // w=1 h=1 -/// assert!(r.min.abs_diff_eq(Vec2::splat(-0.5), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::splat(0.5), 1e-5)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_size( - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - size: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Create a new rectangle from its center and half-size. -/// # Panics -/// This method panics if any of the components of the half-size is negative. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_center_half_size(Vec2::ZERO, Vec2::ONE); // w=2 h=2 -/// assert!(r.min.abs_diff_eq(Vec2::splat(-1.), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::splat(1.), 1e-5)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_half_size( - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - half_size: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!((r.width() - 5.).abs() <= 1e-5); -/// ``` +"#, + r#" - #[lua(kind = "Method")] - fn width(&self) -> f32; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!((r.height() - 1.).abs() <= 1e-5); -/// ``` - #[lua(kind = "Method")] - fn height(&self) -> f32; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Rectangle size. +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +pub struct IRect { + min: ReflectReference, + max: ReflectReference, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::prelude::Rect", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[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. /// # Examples /// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.size().abs_diff_eq(Vec2::new(5., 1.), 1e-5)); +/// # use bevy_math::Rect; +/// let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 +/// let r = Rect::new(2., 3., 5., -1.); // w=3 h=4 /// ``` - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn new( + x0: f32, + y0: f32, + x1: f32, + y1: f32, + ) -> LuaReflectValProxy; "#, r#" -/// Rectangle half-size. +/// Check if the rectangle is empty. /// # Examples /// ``` /// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.half_size().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); +/// let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 +/// assert!(r.is_empty()); /// ``` - #[lua(kind = "Method", output(proxy))] - fn half_size(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn is_empty(_self: LuaReflectRefProxy) -> bool; "#, r#" -/// The center point of the rectangle. +/// Rectangle width (max.x - min.x). /// # Examples /// ``` -/// # use bevy_math::{Rect, Vec2}; +/// # use bevy_math::Rect; /// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.center().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); +/// assert!((r.width() - 5.).abs() <= 1e-5); /// ``` - #[lua(kind = "Method", output(proxy))] - fn center(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn width(_self: LuaReflectRefProxy) -> f32; "#, r#" -/// Check if a point lies within this rectangle, inclusive of its edges. +/// Rectangle height (max.y - min.y). /// # Examples /// ``` /// # use bevy_math::Rect; /// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.contains(r.center())); -/// assert!(r.contains(r.min)); -/// assert!(r.contains(r.max)); +/// assert!((r.height() - 1.).abs() <= 1e-5); /// ``` - #[lua(kind = "Method")] - fn contains(&self, #[proxy] point: bevy::math::prelude::Vec2) -> bool; + #[lua()] + fn height(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -1801,33 +1339,11 @@ struct IRect { /// assert!(r.max.abs_diff_eq(Vec2::new(5., 3.), 1e-5)); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn union( - &self, - #[proxy] - other: bevy::math::prelude::Rect, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and a point. -/// The union is the smallest rectangle enclosing both the rectangle and the point. If the -/// point is already inside the rectangle, this method returns a copy of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let u = r.union_point(Vec2::new(3., 6.)); -/// assert!(u.min.abs_diff_eq(Vec2::ZERO, 1e-5)); -/// assert!(u.max.abs_diff_eq(Vec2::new(5., 6.), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union_point( - &self, - #[proxy] - other: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1845,12 +1361,11 @@ struct IRect { /// assert!(r.max.abs_diff_eq(Vec2::new(3., 1.), 1e-5)); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn intersect( - &self, - #[proxy] - other: bevy::math::prelude::Rect, - ) -> bevy::math::prelude::Rect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1871,8 +1386,11 @@ struct IRect { /// assert!(r2.max.abs_diff_eq(Vec2::new(4., 5.), 1e-5)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn inflate(&self, expansion: f32) -> bevy::math::prelude::Rect; + #[lua()] + fn inflate( + _self: LuaReflectRefProxy, + expansion: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -1890,83 +1408,93 @@ struct IRect { /// assert_eq!(n.max.y, 0.6); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn normalize( - &self, - #[proxy] - other: bevy::math::prelude::Rect, - ) -> bevy::math::prelude::Rect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns self as [`IRect`] (i32) - #[lua(kind = "Method", output(proxy))] - fn as_irect(&self) -> bevy::math::prelude::IRect; + #[lua()] + fn as_irect( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns self as [`URect`] (u32) - #[lua(kind = "Method", output(proxy))] - fn as_urect(&self) -> bevy::math::prelude::URect; + #[lua()] + fn as_urect( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &rects::rect::Rect) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Rect; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Rect { - #[lua(output(proxy))] - min: bevy::math::prelude::Vec2, - #[lua(output(proxy))] - max: bevy::math::prelude::Vec2, +pub struct Rect { + min: ReflectReference, + max: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::prelude::URect", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::URect; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &rects::urect::URect) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" @@ -1980,74 +1508,13 @@ struct Rect { /// let r = URect::new(2, 4, 5, 0); // w=3 h=4 /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(x0: u32, y0: u32, x1: u32, y1: u32) -> bevy::math::prelude::URect; - -"#, - 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. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// // Unit rect from [0,0] to [1,1] -/// let r = URect::from_corners(UVec2::ZERO, UVec2::ONE); // w=1 h=1 -/// // Same; the points do not need to be ordered -/// let r = URect::from_corners(UVec2::ONE, UVec2::ZERO); // w=1 h=1 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - p0: bevy::math::prelude::UVec2, - #[proxy] - p1: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Create a new rectangle from its center and size. -/// # 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. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::from_center_size(UVec2::ONE, UVec2::splat(2)); // w=2 h=2 -/// assert_eq!(r.min, UVec2::splat(0)); -/// assert_eq!(r.max, UVec2::splat(2)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_size( - #[proxy] - origin: bevy::math::prelude::UVec2, - #[proxy] - size: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Create a new rectangle from its center and half-size. -/// # Panics -/// This method panics if any of the components of the half-size is negative or if `origin - half_size` results in any negatives. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::from_center_half_size(UVec2::ONE, UVec2::ONE); // w=2 h=2 -/// assert_eq!(r.min, UVec2::splat(0)); -/// assert_eq!(r.max, UVec2::splat(2)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_half_size( - #[proxy] - origin: bevy::math::prelude::UVec2, - #[proxy] - half_size: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; + #[lua()] + fn new( + x0: u32, + y0: u32, + x1: u32, + y1: u32, + ) -> LuaReflectValProxy; "#, r#" @@ -2059,8 +1526,8 @@ struct Rect { /// assert!(r.is_empty()); /// ``` - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; + #[lua()] + fn is_empty(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -2072,8 +1539,8 @@ struct Rect { /// assert_eq!(r.width(), 5); /// ``` - #[lua(kind = "Method")] - fn width(&self) -> u32; + #[lua()] + fn width(_self: LuaReflectRefProxy) -> u32; "#, r#" @@ -2085,66 +1552,8 @@ struct Rect { /// assert_eq!(r.height(), 1); /// ``` - #[lua(kind = "Method")] - fn height(&self) -> u32; - -"#, - r#" -/// Rectangle size. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.size(), UVec2::new(5, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::UVec2; - -"#, - r#" -/// Rectangle half-size. -/// # 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 -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 4, 2); // w=4 h=2 -/// assert_eq!(r.half_size(), UVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn half_size(&self) -> bevy::math::prelude::UVec2; - -"#, - r#" -/// The center point of the rectangle. -/// # Rounding Behavior -/// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 4, 2); // w=4 h=2 -/// assert_eq!(r.center(), UVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn center(&self) -> bevy::math::prelude::UVec2; - -"#, - r#" -/// Check if a point lies within this rectangle, inclusive of its edges. -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert!(r.contains(r.center())); -/// assert!(r.contains(r.min)); -/// assert!(r.contains(r.max)); -/// ``` - - #[lua(kind = "Method")] - fn contains(&self, #[proxy] point: bevy::math::prelude::UVec2) -> bool; + #[lua()] + fn height(_self: LuaReflectRefProxy) -> u32; "#, r#" @@ -2160,33 +1569,11 @@ struct Rect { /// assert_eq!(r.max, UVec2::new(5, 8)); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn union( - &self, - #[proxy] - other: bevy::math::prelude::URect, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and a point. -/// The union is the smallest rectangle enclosing both the rectangle and the point. If the -/// point is already inside the rectangle, this method returns a copy of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// let u = r.union_point(UVec2::new(3, 6)); -/// assert_eq!(u.min, UVec2::ZERO); -/// assert_eq!(u.max, UVec2::new(5, 6)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union_point( - &self, - #[proxy] - other: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2204,12 +1591,11 @@ struct Rect { /// assert_eq!(r.max, UVec2::new(2, 2)); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn intersect( - &self, - #[proxy] - other: bevy::math::prelude::URect, - ) -> bevy::math::prelude::URect; + _self: LuaReflectRefProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2230,375 +1616,309 @@ struct Rect { /// assert_eq!(r2.max, UVec2::splat(7)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn inflate(&self, expansion: i32) -> bevy::math::prelude::URect; + #[lua()] + fn inflate( + _self: LuaReflectRefProxy, + expansion: i32, + ) -> LuaReflectValProxy; "#, r#" /// Returns self as [`Rect`] (f32) - #[lua(kind = "Method", output(proxy))] - fn as_rect(&self) -> bevy::math::prelude::Rect; + #[lua()] + fn as_rect( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns self as [`IRect`] (i32) - #[lua(kind = "Method", output(proxy))] - fn as_irect(&self) -> bevy::math::prelude::IRect; + #[lua()] + fn as_irect( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct URect { - #[lua(output(proxy))] - min: bevy::math::prelude::UVec2, - #[lua(output(proxy))] - max: bevy::math::prelude::UVec2, +pub struct URect { + min: ReflectReference, + max: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::math::Affine3", functions[])] -struct Affine3 { - #[lua(output(proxy))] - matrix3: bevy::math::prelude::Mat3, - #[lua(output(proxy))] - translation: bevy::math::prelude::Vec3, +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::Affine3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[] +)] +pub struct Affine3 { + matrix3: ReflectReference, + translation: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::Aabb2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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))] - fn new( - #[proxy] - center: bevy::math::prelude::Vec2, - #[proxy] - half_size: bevy::math::prelude::Vec2, - ) -> bevy::math::bounding::Aabb2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. - #[lua(kind = "Method", output(proxy))] - fn bounding_circle(&self) -> bevy::math::bounding::BoundingCircle; + #[lua()] + fn bounding_circle( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Finds the point on the AABB that is closest to the given `point`. -/// If the point is outside the AABB, the returned point will be on the perimeter of the AABB. -/// Otherwise, it will be inside the AABB 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")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Aabb2d { - #[lua(output(proxy))] - min: bevy::math::prelude::Vec2, - #[lua(output(proxy))] - max: bevy::math::prelude::Vec2, +pub struct Aabb2d { + min: ReflectReference, + max: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::BoundingCircle", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Constructs a bounding circle from its center and radius. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - center: bevy::math::prelude::Vec2, - radius: f32, - ) -> bevy::math::bounding::BoundingCircle; - -"#, - r#" /// Get the radius of the bounding circle - #[lua(kind = "Method")] - fn radius(&self) -> f32; + #[lua()] + fn radius(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. - #[lua(kind = "Method", output(proxy))] - fn aabb_2d(&self) -> bevy::math::bounding::Aabb2d; - -"#, - r#" -/// Finds the point on the bounding circle that is closest to the given `point`. -/// If the point is outside the circle, the returned point will be on the perimeter of the circle. -/// Otherwise, it will be inside the circle and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Vec2; + #[lua()] + fn aabb_2d( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingCircle; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BoundingCircle { - #[lua(output(proxy))] - center: bevy::math::prelude::Vec2, - #[lua(output(proxy))] +pub struct BoundingCircle { + center: ReflectReference, circle: bevy::math::primitives::Circle, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Circle", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Create a new [`Circle`] from a `radius` - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32) -> bevy::math::primitives::Circle; + #[lua()] + fn new(radius: f32) -> LuaReflectValProxy; "#, r#" /// Get the diameter of the circle - #[lua(kind = "Method")] - fn diameter(&self) -> f32; - -"#, - r#" -/// Finds the point on the circle that is closest to the given `point`. -/// If the point is outside the circle, the returned point will be on the perimeter of the circle. -/// Otherwise, it will be inside the circle and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Vec2; + #[lua()] + fn diameter(_self: LuaReflectRefProxy) -> f32; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Circle; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Circle) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Circle { +pub struct Circle { radius: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Annulus", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Annulus; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Annulus) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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()] + fn new( + inner_radius: f32, + outer_radius: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the diameter of the annulus - #[lua(kind = "Method")] - fn diameter(&self) -> f32; + #[lua()] + fn diameter(_self: LuaReflectRefProxy) -> 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; + #[lua()] + fn thickness(_self: LuaReflectRefProxy) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Annulus { - #[lua(output(proxy))] +pub struct Annulus { inner_circle: bevy::math::primitives::Circle, - #[lua(output(proxy))] outer_circle: bevy::math::primitives::Circle, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Arc2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// 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; + #[lua()] + fn new( + radius: f32, + half_angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`Arc2d`] from a `radius` and an `angle` in radians - #[lua(kind = "Function", output(proxy))] - fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::Arc2d; + #[lua()] + fn from_radians( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`Arc2d`] from a `radius` and an `angle` in degrees. - #[lua(kind = "Function", output(proxy))] - fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::Arc2d; + #[lua()] + fn from_degrees( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`Arc2d`] from a `radius` and a `fraction` of a single turn. /// For instance, `0.5` turns is a semicircle. - #[lua(kind = "Function", output(proxy))] - fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::Arc2d; + #[lua()] + fn from_turns( + radius: f32, + fraction: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the angle of the arc - #[lua(kind = "Method")] - fn angle(&self) -> f32; + #[lua()] + fn angle(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the length of the arc - #[lua(kind = "Method")] - fn length(&self) -> f32; - -"#, - r#" -/// Get the right-hand end point of the arc - - #[lua(kind = "Method", output(proxy))] - fn right_endpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the left-hand end point of the arc - - #[lua(kind = "Method", output(proxy))] - fn left_endpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the midpoint of the arc - - #[lua(kind = "Method", output(proxy))] - fn midpoint(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn length(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get half the distance between the endpoints (half the length of the chord) - #[lua(kind = "Method")] - fn half_chord_length(&self) -> f32; + #[lua()] + fn half_chord_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the distance between the endpoints (the length of the chord) - #[lua(kind = "Method")] - fn chord_length(&self) -> f32; - -"#, - r#" -/// Get the midpoint of the two endpoints (the midpoint of the chord) - - #[lua(kind = "Method", output(proxy))] - fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn chord_length(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -2607,8 +1927,8 @@ struct Annulus { /// Equivalently, the [`radius`](Self::radius) minus the [`sagitta`](Self::sagitta). /// Note that for a [`major`](Self::is_major) arc, the apothem will be negative. - #[lua(kind = "Method")] - fn apothem(&self) -> f32; + #[lua()] + fn apothem(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -2617,326 +1937,370 @@ struct Annulus { /// Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc. /// The sagitta is also the sum of the [`radius`](Self::radius) and the [`apothem`](Self::apothem). - #[lua(kind = "Method")] - fn sagitta(&self) -> f32; + #[lua()] + fn sagitta(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Produces true if the arc is at most half a circle. /// **Note:** This is not the negation of [`is_major`](Self::is_major): an exact semicircle is both major and minor. - #[lua(kind = "Method")] - fn is_minor(&self) -> bool; + #[lua()] + fn is_minor(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Produces true if the arc is at least half a circle. /// **Note:** This is not the negation of [`is_minor`](Self::is_minor): an exact semicircle is both major and minor. - #[lua(kind = "Method")] - fn is_major(&self) -> bool; + #[lua()] + fn is_major(_self: LuaReflectRefProxy) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Arc2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Arc2d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Arc2d { +pub struct Arc2d { radius: f32, half_angle: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Capsule2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Capsule2d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Create a new `Capsule2d` from a radius and length - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule2d; + #[lua()] + fn new( + radius: f32, + length: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] - #[lua(kind = "Method", output(proxy))] - fn to_inner_rectangle(&self) -> bevy::math::primitives::Rectangle; + #[lua()] + fn to_inner_rectangle( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Capsule2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Capsule2d { +pub struct Capsule2d { radius: f32, half_length: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::CircularSector", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Create a new [`CircularSector`] from a `radius` and an `angle` - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; + #[lua()] + fn new( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`CircularSector`] from a `radius` and an `angle` in radians. - #[lua(kind = "Function", output(proxy))] - fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; + #[lua()] + fn from_radians( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`CircularSector`] from a `radius` and an `angle` in degrees. - #[lua(kind = "Function", output(proxy))] - fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; + #[lua()] + fn from_degrees( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`CircularSector`] from a `radius` and a number of `turns` of a circle. /// For instance, `0.5` turns is a semicircle. - #[lua(kind = "Function", output(proxy))] - fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::CircularSector; + #[lua()] + fn from_turns( + radius: f32, + fraction: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get half the angle of the sector - #[lua(kind = "Method")] - fn half_angle(&self) -> f32; + #[lua()] + fn half_angle( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the angle of the sector - #[lua(kind = "Method")] - fn angle(&self) -> f32; + #[lua()] + fn angle(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the radius of the sector - #[lua(kind = "Method")] - fn radius(&self) -> f32; + #[lua()] + fn radius(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the length of the arc defining the sector - #[lua(kind = "Method")] - fn arc_length(&self) -> f32; + #[lua()] + fn arc_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get half the length of the chord defined by the sector /// See [`Arc2d::half_chord_length`] - #[lua(kind = "Method")] - fn half_chord_length(&self) -> f32; + #[lua()] + fn half_chord_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the length of the chord defined by the sector /// See [`Arc2d::chord_length`] - #[lua(kind = "Method")] - fn chord_length(&self) -> f32; - -"#, - r#" -/// Get the midpoint of the chord defined by the sector -/// See [`Arc2d::chord_midpoint`] - - #[lua(kind = "Method", output(proxy))] - fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn chord_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the length of the apothem of this sector /// See [`Arc2d::apothem`] - #[lua(kind = "Method")] - fn apothem(&self) -> f32; + #[lua()] + fn apothem(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the length of the sagitta of this sector /// See [`Arc2d::sagitta`] - #[lua(kind = "Method")] - fn sagitta(&self) -> f32; + #[lua()] + fn sagitta(_self: LuaReflectRefProxy) -> f32; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSector; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::CircularSector) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CircularSector { - #[lua(output(proxy))] +pub struct CircularSector { arc: bevy::math::primitives::Arc2d, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::CircularSegment", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSegment; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::CircularSegment) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Create a new [`CircularSegment`] from a `radius`, and an `angle` - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; + #[lua()] + fn new( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`CircularSegment`] from a `radius` and an `angle` in radians. - #[lua(kind = "Function", output(proxy))] - fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; + #[lua()] + fn from_radians( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`CircularSegment`] from a `radius` and an `angle` in degrees. - #[lua(kind = "Function", output(proxy))] - fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; + #[lua()] + fn from_degrees( + radius: f32, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`CircularSegment`] from a `radius` and a number of `turns` of a circle. /// For instance, `0.5` turns is a semicircle. - #[lua(kind = "Function", output(proxy))] - fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::CircularSegment; + #[lua()] + fn from_turns( + radius: f32, + fraction: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the half-angle of the segment - #[lua(kind = "Method")] - fn half_angle(&self) -> f32; + #[lua()] + fn half_angle( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the angle of the segment - #[lua(kind = "Method")] - fn angle(&self) -> f32; + #[lua()] + fn angle(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the radius of the segment - #[lua(kind = "Method")] - fn radius(&self) -> f32; + #[lua()] + fn radius(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the length of the arc defining the segment - #[lua(kind = "Method")] - fn arc_length(&self) -> f32; + #[lua()] + fn arc_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get half the length of the segment's base, also known as its chord - #[lua(kind = "Method")] - fn half_chord_length(&self) -> f32; + #[lua()] + fn half_chord_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the length of the segment's base, also known as its chord - #[lua(kind = "Method")] - fn chord_length(&self) -> f32; - -"#, - r#" -/// Get the midpoint of the segment's base, also known as its chord - - #[lua(kind = "Method", output(proxy))] - fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn chord_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -2944,67 +2308,66 @@ 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()] + fn apothem( + _self: LuaReflectRefProxy, + ) -> 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; + #[lua()] + fn sagitta( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CircularSegment { - #[lua(output(proxy))] +pub struct CircularSegment { arc: bevy::math::primitives::Arc2d, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Ellipse", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Ellipse) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Ellipse; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Create a new `Ellipse` from half of its width and height. /// This corresponds to the two perpendicular radii defining the ellipse. - #[lua(kind = "Function", output(proxy))] - fn new(half_width: f32, half_height: f32) -> bevy::math::primitives::Ellipse; - -"#, - r#" -/// Create a new `Ellipse` from a given full size. -/// `size.x` is the diameter along the X axis, and `size.y` is the diameter along the Y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_size( - #[proxy] - size: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Ellipse; + #[lua()] + fn new( + half_width: f32, + half_height: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -3012,216 +2375,176 @@ struct CircularSegment { /// It can be thought of as a measure of how "stretched" or elongated the ellipse is. /// The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola. - #[lua(kind = "Method")] - fn eccentricity(&self) -> f32; + #[lua()] + fn eccentricity(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse. /// The focal length of an ellipse is related to its eccentricity by `eccentricity = focal_length / semi_major` - #[lua(kind = "Method")] - fn focal_length(&self) -> f32; + #[lua()] + fn focal_length(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse. - #[lua(kind = "Method")] - fn semi_major(&self) -> f32; + #[lua()] + fn semi_major(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse. - #[lua(kind = "Method")] - fn semi_minor(&self) -> f32; + #[lua()] + fn semi_minor(_self: LuaReflectRefProxy) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Ellipse { - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec2, +pub struct Ellipse { + half_size: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Line2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Line2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Line2d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Line2d { - #[lua(output(proxy))] +pub struct Line2d { direction: bevy::math::prelude::Dir2, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Plane2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Plane2d; - -"#, - 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")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Plane2d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Plane2d { - #[lua(output(proxy))] +pub struct Plane2d { normal: bevy::math::prelude::Dir2, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Rectangle", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rectangle; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Rectangle) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Create a new `Rectangle` from a full width and height - #[lua(kind = "Function", output(proxy))] - fn new(width: f32, height: f32) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Create a new `Rectangle` from a given full size - - #[lua(kind = "Function", output(proxy))] - fn from_size( - #[proxy] - size: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Create a new `Rectangle` from two corner points - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - point1: bevy::math::prelude::Vec2, - #[proxy] - point2: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Rectangle; + #[lua()] + fn new( + width: f32, + height: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a `Rectangle` from a single length. /// The resulting `Rectangle` will be the same size in every direction. - #[lua(kind = "Function", output(proxy))] - fn from_length(length: f32) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Get the size of the rectangle - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Finds the point on the rectangle that is closest to the given `point`. -/// If the point is outside the rectangle, the returned point will be on the perimeter of the rectangle. -/// Otherwise, it will be inside the rectangle and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Vec2; + #[lua()] + fn from_length(length: f32) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Rectangle { - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec2, +pub struct Rectangle { + half_size: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::RegularPolygon", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::RegularPolygon; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3230,16 +2553,21 @@ struct Rectangle { /// # Panics /// Panics if `circumradius` is negative - #[lua(kind = "Function", output(proxy))] - fn new(circumradius: f32, sides: u32) -> bevy::math::primitives::RegularPolygon; + #[lua()] + fn new( + circumradius: f32, + sides: u32, + ) -> LuaReflectValProxy; "#, r#" /// Get the radius of the circumcircle on which all vertices /// of the regular polygon lie - #[lua(kind = "Method")] - fn circumradius(&self) -> f32; + #[lua()] + fn circumradius( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -3247,15 +2575,19 @@ struct Rectangle { /// This is the radius of the largest circle that can /// be drawn within the polygon - #[lua(kind = "Method")] - fn inradius(&self) -> f32; + #[lua()] + fn inradius( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" /// Get the length of one side of the regular polygon - #[lua(kind = "Method")] - fn side_length(&self) -> f32; + #[lua()] + fn side_length( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -3263,8 +2595,10 @@ struct Rectangle { /// This is the angle formed by two adjacent sides with points /// within the angle being in the interior of the polygon - #[lua(kind = "Method")] - fn internal_angle_degrees(&self) -> f32; + #[lua()] + fn internal_angle_degrees( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -3272,8 +2606,10 @@ struct Rectangle { /// This is the angle formed by two adjacent sides with points /// within the angle being in the interior of the polygon - #[lua(kind = "Method")] - fn internal_angle_radians(&self) -> f32; + #[lua()] + fn internal_angle_radians( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -3281,8 +2617,10 @@ struct Rectangle { /// This is the angle formed by two adjacent sides with points /// within the angle being in the exterior of the polygon - #[lua(kind = "Method")] - fn external_angle_degrees(&self) -> f32; + #[lua()] + fn external_angle_degrees( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" @@ -3290,210 +2628,180 @@ struct Rectangle { /// This is the angle formed by two adjacent sides with points /// within the angle being in the exterior of the polygon - #[lua(kind = "Method")] - fn external_angle_radians(&self) -> f32; + #[lua()] + fn external_angle_radians( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::RegularPolygon) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RegularPolygon { - #[lua(output(proxy))] +pub struct RegularPolygon { circumcircle: bevy::math::primitives::Circle, sides: u32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Rhombus", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rhombus; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Rhombus) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn new( horizontal_diagonal: f32, vertical_diagonal: f32, - ) -> bevy::math::primitives::Rhombus; + ) -> LuaReflectValProxy; "#, r#" /// Create a new `Rhombus` from a side length with all inner angles equal. - #[lua(kind = "Function", output(proxy))] - fn from_side(side: f32) -> bevy::math::primitives::Rhombus; + #[lua()] + fn from_side(side: f32) -> LuaReflectValProxy; "#, r#" /// Create a new `Rhombus` from a given inradius with all inner angles equal. - #[lua(kind = "Function", output(proxy))] - fn from_inradius(inradius: f32) -> bevy::math::primitives::Rhombus; + #[lua()] + fn from_inradius( + inradius: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the length of each side of the rhombus - #[lua(kind = "Method")] - fn side(&self) -> f32; + #[lua()] + fn side(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the radius of the circumcircle on which all vertices /// of the rhombus lie - #[lua(kind = "Method")] - fn circumradius(&self) -> f32; + #[lua()] + fn circumradius(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the radius of the largest circle that can /// be drawn within the rhombus - #[lua(kind = "Method")] - fn inradius(&self) -> f32; - -"#, - r#" -/// Finds the point on the rhombus that is closest to the given `point`. -/// If the point is outside the rhombus, the returned point will be on the perimeter of the rhombus. -/// Otherwise, it will be inside the rhombus and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Vec2; + #[lua()] + fn inradius(_self: LuaReflectRefProxy) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Rhombus { - #[lua(output(proxy))] - half_diagonals: bevy::math::prelude::Vec2, +pub struct Rhombus { + half_diagonals: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Segment2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Create a new `Segment2d` from a direction and full length of the segment - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - direction: bevy::math::prelude::Dir2, - length: f32, - ) -> bevy::math::primitives::Segment2d; - -"#, - r#" -/// Get the position of the first point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point1(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the position of the second point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point2(&self) -> bevy::math::prelude::Vec2; + #[lua()] + fn new( + direction: LuaReflectValProxy, + length: f32, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim2::Segment2d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Segment2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Segment2d { - #[lua(output(proxy))] +pub struct Segment2d { direction: bevy::math::prelude::Dir2, half_length: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Triangle2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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))] - fn new( - #[proxy] - a: bevy::math::prelude::Vec2, - #[proxy] - b: bevy::math::prelude::Vec2, - #[proxy] - c: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Triangle2d; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -3501,680 +2809,614 @@ struct Segment2d { /// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. /// This indicates that the three vertices are collinear or nearly collinear. - #[lua(kind = "Method")] - fn is_degenerate(&self) -> bool; + #[lua()] + fn is_degenerate( + _self: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Checks if the triangle is acute, meaning all angles are less than 90 degrees - #[lua(kind = "Method")] - fn is_acute(&self) -> bool; + #[lua()] + fn is_acute(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees - #[lua(kind = "Method")] - fn is_obtuse(&self) -> bool; + #[lua()] + fn is_obtuse(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Reverse the [`WindingOrder`] of the triangle /// by swapping the first and last vertices. - #[lua(kind = "MutatingMethod")] - fn reverse(&mut self) -> (); + #[lua()] + fn reverse(_self: LuaReflectRefMutProxy) -> (); "#, r#" /// This triangle but reversed. - #[lua(kind = "Method", output(proxy))] - fn reversed(self) -> bevy::math::primitives::Triangle2d; + #[lua()] + fn reversed( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Triangle2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Triangle2d { - vertices: ReflectedValue, +pub struct Triangle2d { + vertices: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::Aabb3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - #[lua(kind = "Method", output(proxy))] - fn bounding_sphere(&self) -> bevy::math::bounding::BoundingSphere; + #[lua()] + fn bounding_sphere( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::Aabb3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Aabb3d { - #[lua(output(proxy))] - min: bevy::math::Vec3A, - #[lua(output(proxy))] - max: bevy::math::Vec3A, +pub struct Aabb3d { + min: ReflectReference, + max: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::BoundingSphere", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingSphere; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the radius of the bounding sphere - #[lua(kind = "Method")] - fn radius(&self) -> f32; + #[lua()] + fn radius(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. - #[lua(kind = "Method", output(proxy))] - fn aabb_3d(&self) -> bevy::math::bounding::Aabb3d; + #[lua()] + fn aabb_3d( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BoundingSphere { - #[lua(output(proxy))] - center: bevy::math::Vec3A, - #[lua(output(proxy))] +pub struct BoundingSphere { + center: ReflectReference, sphere: bevy::math::primitives::Sphere, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Sphere", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Sphere; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Sphere) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Create a new [`Sphere`] from a `radius` - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32) -> bevy::math::primitives::Sphere; + #[lua()] + fn new(radius: f32) -> LuaReflectValProxy; "#, r#" /// Get the diameter of the sphere - #[lua(kind = "Method")] - fn diameter(&self) -> f32; - -"#, - r#" -/// Finds the point on the sphere that is closest to the given `point`. -/// If the point is outside the sphere, the returned point will be on the surface of the sphere. -/// Otherwise, it will be inside the sphere and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec3, - ) -> bevy::math::prelude::Vec3; + #[lua()] + fn diameter(_self: LuaReflectRefProxy) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Sphere { +pub struct Sphere { radius: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Cuboid", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Create a new `Cuboid` from a full x, y, and z length - #[lua(kind = "Function", output(proxy))] + #[lua()] fn new( x_length: f32, y_length: f32, z_length: f32, - ) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Create a new `Cuboid` from a given full size - - #[lua(kind = "Function", output(proxy))] - fn from_size( - #[proxy] - size: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Create a new `Cuboid` from two corner points - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - point1: bevy::math::prelude::Vec3, - #[proxy] - point2: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Cuboid; + ) -> LuaReflectValProxy; "#, r#" /// Create a `Cuboid` from a single length. /// The resulting `Cuboid` will be the same size in every direction. - #[lua(kind = "Function", output(proxy))] - fn from_length(length: f32) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Get the size of the cuboid - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -/// Finds the point on the cuboid that is closest to the given `point`. -/// If the point is outside the cuboid, the returned point will be on the surface of the cuboid. -/// Otherwise, it will be inside the cuboid and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - point: bevy::math::prelude::Vec3, - ) -> bevy::math::prelude::Vec3; + #[lua()] + fn from_length(length: f32) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Cuboid) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cuboid; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Cuboid { - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec3, +pub struct Cuboid { + half_size: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Cylinder", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cylinder; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Create a new `Cylinder` from a radius and full height - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, height: f32) -> bevy::math::primitives::Cylinder; + #[lua()] + fn new( + radius: f32, + height: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the base of the cylinder as a [`Circle`] - #[lua(kind = "Method", output(proxy))] - fn base(&self) -> bevy::math::primitives::Circle; + #[lua()] + fn base( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the surface area of the side of the cylinder, /// also known as the lateral area - #[lua(kind = "Method")] - fn lateral_area(&self) -> f32; + #[lua()] + fn lateral_area(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the surface area of one base of the cylinder - #[lua(kind = "Method")] - fn base_area(&self) -> f32; + #[lua()] + fn base_area(_self: LuaReflectRefProxy) -> f32; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Cylinder) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Cylinder { +pub struct Cylinder { radius: f32, half_height: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Capsule3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Capsule3d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Create a new `Capsule3d` from a radius and length - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule3d; + #[lua()] + fn new( + radius: f32, + length: f32, + ) -> LuaReflectValProxy; "#, r#" /// Get the part connecting the hemispherical ends /// of the capsule as a [`Cylinder`] - #[lua(kind = "Method", output(proxy))] - fn to_cylinder(&self) -> bevy::math::primitives::Cylinder; + #[lua()] + fn to_cylinder( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Capsule3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Capsule3d { +pub struct Capsule3d { radius: f32, half_length: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Cone", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Cone) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Cone; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Create a new [`Cone`] from a radius and height. - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, height: f32) -> bevy::math::primitives::Cone; + #[lua()] + fn new(radius: f32, height: f32) -> LuaReflectValProxy; "#, r#" /// Get the base of the cone as a [`Circle`] - #[lua(kind = "Method", output(proxy))] - fn base(&self) -> bevy::math::primitives::Circle; + #[lua()] + fn base( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Get the slant height of the cone, the length of the line segment /// connecting a point on the base to the apex - #[lua(kind = "Method")] - fn slant_height(&self) -> f32; + #[lua()] + fn slant_height(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the surface area of the side of the cone, /// also known as the lateral area - #[lua(kind = "Method")] - fn lateral_area(&self) -> f32; + #[lua()] + fn lateral_area(_self: LuaReflectRefProxy) -> f32; "#, r#" /// Get the surface area of the base of the cone - #[lua(kind = "Method")] - fn base_area(&self) -> f32; + #[lua()] + fn base_area(_self: LuaReflectRefProxy) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Cone { +pub struct Cone { radius: f32, height: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::ConicalFrustum", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::ConicalFrustum; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::ConicalFrustum) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct ConicalFrustum { +pub struct ConicalFrustum { radius_top: f32, radius_bottom: f32, height: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::InfinitePlane3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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 -/// * 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; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::InfinitePlane3d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct InfinitePlane3d { - #[lua(output(proxy))] +pub struct InfinitePlane3d { normal: bevy::math::prelude::Dir3, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Line3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Line3d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Line3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Line3d { - #[lua(output(proxy))] +pub struct Line3d { direction: bevy::math::prelude::Dir3, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Segment3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Segment3d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Segment3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Create a new `Segment3d` from a direction and full length of the segment - #[lua(kind = "Function", output(proxy))] + #[lua()] fn new( - #[proxy] - direction: bevy::math::prelude::Dir3, + direction: LuaReflectValProxy, length: f32, - ) -> bevy::math::primitives::Segment3d; - -"#, - r#" -/// Get the position of the first point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point1(&self) -> bevy::math::prelude::Vec3; + ) -> LuaReflectValProxy; "#, r#" -/// Get the position of the second point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point2(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Segment3d { - #[lua(output(proxy))] +pub struct Segment3d { direction: bevy::math::prelude::Dir3, half_length: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Torus", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Torus) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Torus; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4182,8 +3424,11 @@ struct Segment3d { /// The inner radius is the radius of the hole, and the outer radius /// is the radius of the entire object - #[lua(kind = "Function", output(proxy))] - fn new(inner_radius: f32, outer_radius: f32) -> bevy::math::primitives::Torus; + #[lua()] + fn new( + inner_radius: f32, + outer_radius: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -4191,8 +3436,8 @@ struct Segment3d { /// For a ring torus, this corresponds to the radius of the hole, /// or `major_radius - minor_radius` - #[lua(kind = "Method")] - fn inner_radius(&self) -> f32; + #[lua()] + fn inner_radius(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -4200,722 +3445,632 @@ struct Segment3d { /// This corresponds to the overall radius of the entire object, /// or `major_radius + minor_radius` - #[lua(kind = "Method")] - fn outer_radius(&self) -> f32; + #[lua()] + fn outer_radius(_self: LuaReflectRefProxy) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Torus { +pub struct Torus { minor_radius: f32, major_radius: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Triangle3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Create a new [`Triangle3d`] from points `a`, `b`, and `c`. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - a: bevy::math::prelude::Vec3, - #[proxy] - b: bevy::math::prelude::Vec3, - #[proxy] - c: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Triangle3d; - -"#, - r#" /// Checks if the triangle is degenerate, meaning it has zero area. /// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. /// This indicates that the three vertices are collinear or nearly collinear. - #[lua(kind = "Method")] - fn is_degenerate(&self) -> bool; + #[lua()] + fn is_degenerate( + _self: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Checks if the triangle is acute, meaning all angles are less than 90 degrees - #[lua(kind = "Method")] - fn is_acute(&self) -> bool; + #[lua()] + fn is_acute(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees - #[lua(kind = "Method")] - fn is_obtuse(&self) -> bool; + #[lua()] + fn is_obtuse(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Reverse the triangle by swapping the first and last vertices. - #[lua(kind = "MutatingMethod")] - fn reverse(&mut self) -> (); + #[lua()] + fn reverse(_self: LuaReflectRefMutProxy) -> (); "#, r#" /// This triangle but reversed. - #[lua(kind = "Method", output(proxy))] - fn reversed(self) -> bevy::math::primitives::Triangle3d; - -"#, - r#" -/// Get the centroid of the triangle. -/// This function finds the geometric center of the triangle by averaging the vertices: -/// `centroid = (a + b + c) / 3`. - - #[lua(kind = "Method", output(proxy))] - fn centroid(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -/// Get the circumcenter of the triangle. - - #[lua(kind = "Method", output(proxy))] - fn circumcenter(&self) -> bevy::math::prelude::Vec3; + #[lua()] + fn reversed( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &primitives::dim3::Triangle3d) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Triangle3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Triangle3d { - vertices: ReflectedValue, +pub struct Triangle3d { + vertices: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::RayCast2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Construct a [`RayCast2d`] from an origin, [`Dir2`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - direction: bevy::math::prelude::Dir2, - max: f32, - ) -> bevy::math::bounding::RayCast2d; - -"#, - r#" /// Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_ray( - #[proxy] - ray: bevy::math::Ray2d, + ray: LuaReflectValProxy, max: f32, - ) -> bevy::math::bounding::RayCast2d; - -"#, - r#" -/// Get the cached multiplicative inverse of the direction of the ray. - - #[lua(kind = "Method", output(proxy))] - fn direction_recip(&self) -> bevy::math::prelude::Vec2; + ) -> LuaReflectValProxy; "#, r#" /// Get the distance of an intersection with an [`Aabb2d`], if any. - #[lua(kind = "Method")] + #[lua()] fn aabb_intersection_at( - &self, - #[proxy] - aabb: &bounding::bounded2d::Aabb2d, + _self: LuaReflectRefProxy, + aabb: LuaReflectRefProxy, ) -> std::option::Option; "#, r#" /// Get the distance of an intersection with a [`BoundingCircle`], if any. - #[lua(kind = "Method")] + #[lua()] fn circle_intersection_at( - &self, - #[proxy] - circle: &bounding::bounded2d::BoundingCircle, + _self: LuaReflectRefProxy, + circle: LuaReflectRefProxy, ) -> std::option::Option; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::RayCast2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RayCast2d { - #[lua(output(proxy))] +pub struct RayCast2d { ray: bevy::math::Ray2d, max: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::AabbCast2d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" -/// Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - aabb: bevy::math::bounding::Aabb2d, - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - direction: bevy::math::prelude::Dir2, - max: f32, - ) -> bevy::math::bounding::AabbCast2d; - -"#, - r#" /// Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_ray( - #[proxy] - aabb: bevy::math::bounding::Aabb2d, - #[proxy] - ray: bevy::math::Ray2d, + aabb: LuaReflectValProxy, + ray: LuaReflectValProxy, max: f32, - ) -> bevy::math::bounding::AabbCast2d; + ) -> LuaReflectValProxy; "#, r#" /// Get the distance at which the [`Aabb2d`]s collide, if at all. - #[lua(kind = "Method")] + #[lua()] fn aabb_collision_at( - &self, - #[proxy] - aabb: bevy::math::bounding::Aabb2d, + _self: LuaReflectRefProxy, + aabb: LuaReflectValProxy, ) -> std::option::Option; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::AabbCast2d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AabbCast2d { - #[lua(output(proxy))] +pub struct AabbCast2d { ray: bevy::math::bounding::RayCast2d, - #[lua(output(proxy))] aabb: bevy::math::bounding::Aabb2d, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::BoundingCircleCast", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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))] - fn new( - #[proxy] - circle: bevy::math::bounding::BoundingCircle, - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - direction: bevy::math::prelude::Dir2, - max: f32, - ) -> bevy::math::bounding::BoundingCircleCast; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_ray( - #[proxy] - circle: bevy::math::bounding::BoundingCircle, - #[proxy] - ray: bevy::math::Ray2d, + circle: LuaReflectValProxy, + ray: LuaReflectValProxy, max: f32, - ) -> bevy::math::bounding::BoundingCircleCast; + ) -> LuaReflectValProxy; "#, r#" /// Get the distance at which the [`BoundingCircle`]s collide, if at all. - #[lua(kind = "Method")] + #[lua()] fn circle_collision_at( - &self, - #[proxy] - circle: bevy::math::bounding::BoundingCircle, + _self: LuaReflectRefProxy, + circle: LuaReflectValProxy, ) -> std::option::Option; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BoundingCircleCast { - #[lua(output(proxy))] +pub struct BoundingCircleCast { ray: bevy::math::bounding::RayCast2d, - #[lua(output(proxy))] circle: bevy::math::bounding::BoundingCircle, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::RayCast3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::RayCast3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_ray( - #[proxy] - ray: bevy::math::Ray3d, + ray: LuaReflectValProxy, max: f32, - ) -> bevy::math::bounding::RayCast3d; - -"#, - r#" -/// Get the cached multiplicative inverse of the direction of the ray. - - #[lua(kind = "Method", output(proxy))] - fn direction_recip(&self) -> bevy::math::Vec3A; + ) -> LuaReflectValProxy; "#, r#" /// Get the distance of an intersection with an [`Aabb3d`], if any. - #[lua(kind = "Method")] + #[lua()] fn aabb_intersection_at( - &self, - #[proxy] - aabb: &bounding::bounded3d::Aabb3d, + _self: LuaReflectRefProxy, + aabb: LuaReflectRefProxy, ) -> std::option::Option; "#, r#" /// Get the distance of an intersection with a [`BoundingSphere`], if any. - #[lua(kind = "Method")] + #[lua()] fn sphere_intersection_at( - &self, - #[proxy] - sphere: &bounding::bounded3d::BoundingSphere, + _self: LuaReflectRefProxy, + sphere: LuaReflectRefProxy, ) -> std::option::Option; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RayCast3d { - #[lua(output(proxy))] - origin: bevy::math::Vec3A, - #[lua(output(proxy))] +pub struct RayCast3d { + origin: ReflectReference, direction: bevy::math::prelude::Dir3A, max: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::AabbCast3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::AabbCast3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_ray( - #[proxy] - aabb: bevy::math::bounding::Aabb3d, - #[proxy] - ray: bevy::math::Ray3d, + aabb: LuaReflectValProxy, + ray: LuaReflectValProxy, max: f32, - ) -> bevy::math::bounding::AabbCast3d; + ) -> LuaReflectValProxy; "#, r#" /// Get the distance at which the [`Aabb3d`]s collide, if at all. - #[lua(kind = "Method")] + #[lua()] fn aabb_collision_at( - &self, - #[proxy] - aabb: bevy::math::bounding::Aabb3d, + _self: LuaReflectRefProxy, + aabb: LuaReflectValProxy, ) -> std::option::Option; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AabbCast3d { - #[lua(output(proxy))] +pub struct AabbCast3d { ray: bevy::math::bounding::RayCast3d, - #[lua(output(proxy))] aabb: bevy::math::bounding::Aabb3d, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::bounding::BoundingSphereCast", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingSphereCast; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_ray( - #[proxy] - sphere: bevy::math::bounding::BoundingSphere, - #[proxy] - ray: bevy::math::Ray3d, + sphere: LuaReflectValProxy, + ray: LuaReflectValProxy, max: f32, - ) -> bevy::math::bounding::BoundingSphereCast; + ) -> LuaReflectValProxy; "#, r#" /// Get the distance at which the [`BoundingSphere`]s collide, if at all. - #[lua(kind = "Method")] + #[lua()] fn sphere_collision_at( - &self, - #[proxy] - sphere: bevy::math::bounding::BoundingSphere, + _self: LuaReflectRefProxy, + sphere: LuaReflectValProxy, ) -> std::option::Option; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BoundingSphereCast { - #[lua(output(proxy))] +pub struct BoundingSphereCast { ray: bevy::math::bounding::RayCast3d, - #[lua(output(proxy))] sphere: bevy::math::bounding::BoundingSphere, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::curve::interval::Interval", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &curve::interval::Interval) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Get the start of this interval. - #[lua(kind = "Method")] - fn start(self) -> f32; + #[lua()] + fn start(_self: LuaReflectValProxy) -> f32; "#, r#" /// Get the end of this interval. - #[lua(kind = "Method")] - fn end(self) -> f32; + #[lua()] + fn end(_self: LuaReflectValProxy) -> f32; "#, r#" /// Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> 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(kind = "Method")] - fn is_bounded(self) -> bool; + #[lua()] + fn is_bounded( + _self: LuaReflectValProxy, + ) -> bool; "#, r#" /// Returns `true` if this interval has a finite start. - #[lua(kind = "Method")] - fn has_finite_start(self) -> bool; + #[lua()] + fn has_finite_start( + _self: LuaReflectValProxy, + ) -> bool; "#, r#" /// Returns `true` if this interval has a finite end. - #[lua(kind = "Method")] - fn has_finite_end(self) -> bool; + #[lua()] + fn has_finite_end( + _self: LuaReflectValProxy, + ) -> bool; "#, r#" /// Returns `true` if `item` is contained in this interval. - #[lua(kind = "Method")] - fn contains(self, item: f32) -> bool; + #[lua()] + fn contains( + _self: LuaReflectValProxy, + 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")] + #[lua()] fn contains_interval( - self, - #[proxy] - other: bevy::math::curve::interval::Interval, + _self: LuaReflectValProxy, + other: LuaReflectValProxy, ) -> bool; "#, r#" /// Clamp the given `value` to lie within this interval. - #[lua(kind = "Method")] - fn clamp(self, value: f32) -> f32; + #[lua()] + fn clamp( + _self: LuaReflectValProxy, + value: f32, + ) -> f32; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::curve::interval::Interval; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Interval {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Interval {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::FloatOrd", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::FloatOrd; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn lt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::cmp::PartialOrd::")] + fn lt( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn le(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::cmp::PartialOrd::")] + fn le( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn gt(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::cmp::PartialOrd::")] + fn gt( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn ge(&self, #[proxy] other: &float_ord::FloatOrd) -> bool; + #[lua(as_trait = "std::cmp::PartialOrd::")] + fn ge( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct FloatOrd(f32); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct FloatOrd(f32); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Plane3d", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - normal: bevy::math::prelude::Vec3, - #[proxy] - half_size: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Plane3d; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Plane3d; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Plane3d { - #[lua(output(proxy))] +pub struct Plane3d { normal: bevy::math::prelude::Dir3, - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec2, + half_size: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::primitives::Tetrahedron", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -/// Create a new [`Tetrahedron`] from points `a`, `b`, `c` and `d`. - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - a: bevy::math::prelude::Vec3, - #[proxy] - b: bevy::math::prelude::Vec3, - #[proxy] - c: bevy::math::prelude::Vec3, - #[proxy] - d: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Tetrahedron; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4924,308 +4079,259 @@ struct Plane3d { /// the first three points using the right-hand rule points /// away from the fourth vertex. - #[lua(kind = "Method")] - fn signed_volume(&self) -> f32; - -"#, - r#" -/// Get the centroid of the tetrahedron. -/// This function finds the geometric center of the tetrahedron -/// by averaging the vertices: `centroid = (a + b + c + d) / 4`. - - #[lua(kind = "Method", output(proxy))] - fn centroid(&self) -> bevy::math::prelude::Vec3; + #[lua()] + fn signed_volume( + _self: LuaReflectRefProxy, + ) -> f32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Tetrahedron { - vertices: ReflectedValue, +pub struct Tetrahedron { + vertices: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::curve::easing::EaseFunction", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &curve::easing::EaseFunction) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::curve::easing::EaseFunction; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct EaseFunction {} +pub struct EaseFunction {} #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances .add_instance( "Isometry2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Isometry3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Ray2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Ray3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Rot2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Dir2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Dir3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Rot2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Dir3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Dir2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "IRect", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Dir3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Rect", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Dir3A", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "URect", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("IRect", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Aabb2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Rect", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "BoundingCircle", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaBoundingCircle, - >::new, - )?; + .add_instance("URect", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Circle", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Circle", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Annulus", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Arc2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Arc2d", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Capsule2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "CircularSector", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaCircularSector, - >::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "CircularSegment", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaCircularSegment, - >::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Ellipse", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Plane2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Rectangle", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "RegularPolygon", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaRegularPolygon, - >::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Rhombus", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Segment2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Triangle2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Sphere", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Sphere", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Cuboid", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Cuboid", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Cylinder", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Capsule3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Cone", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Cone", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Segment3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Torus", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Triangle3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Torus", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "RayCast2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AabbCast2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "BoundingCircleCast", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaBoundingCircleCast, - >::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "RayCast3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AabbCast3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "BoundingSphereCast", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaBoundingSphereCast, - >::new, - )?; - instances - .add_instance( - "Plane3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Tetrahedron", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; Ok(()) } } -pub struct BevyMathAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { - 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( +fn bevy_math_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyMathScriptingPlugin; +impl bevy::app::Plugin for BevyMathScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_math_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyMathAPI", |tw| { tw.document_global_instance::() @@ -5235,298 +4341,109 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { .process_type::() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaIsometry2d, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaIsometry3d, - >, + crate::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, - >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .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< - LuaBoundingCircle, - >, - >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCapsule2d, - >, - >() + .process_type::>() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCircularSector, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCircularSegment, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .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< - LuaRectangle, - >, - >() + .process_type::>() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRegularPolygon, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaSegment2d, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaTriangle2d, - >, - >() .process_type::() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCylinder, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCapsule3d, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() .process_type::() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaSegment3d, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaTriangle3d, - >, - >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRayCast2d, - >, - >() + .process_type::>() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAabbCast2d, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaBoundingCircleCast, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRayCast3d, - >, - >() + .process_type::>() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAabbCast3d, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaBoundingSphereCast, - >, + crate::tealr::mlu::UserDataProxy, >() .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< - LuaTetrahedron, - >, - >() .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::(); - 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::(); - 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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs index 9c6497b6a5..1659fd0a00 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -2,14 +2,21 @@ #![allow(clippy::all)] #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] -extern crate self as bevy_script_api; -use bevy_script_api::{ - lua::RegisterForeignLuaType, ReflectedValue, common::bevy::GetWorld, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicBool", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new `AtomicBool`. /// # Examples @@ -19,8 +26,8 @@ use bevy_script_api::{ /// let atomic_false = AtomicBool::new(false); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: bool) -> std::sync::atomic::AtomicBool; + #[lua()] + fn new(v: bool) -> LuaReflectValProxy; "#, r#" @@ -34,22 +41,23 @@ use bevy_script_api::{ /// assert_eq!(some_bool.into_inner(), true); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> bool; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicBool {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicBool {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicI16", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -58,8 +66,8 @@ struct AtomicBool {} ///let atomic_forty_two = AtomicI16::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: i16) -> std::sync::atomic::AtomicI16; + #[lua()] + fn new(v: i16) -> LuaReflectValProxy; "#, r#" @@ -73,22 +81,23 @@ struct AtomicBool {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i16; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> i16; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicI16 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicI16 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicI32", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -97,8 +106,8 @@ struct AtomicI16 {} ///let atomic_forty_two = AtomicI32::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: i32) -> std::sync::atomic::AtomicI32; + #[lua()] + fn new(v: i32) -> LuaReflectValProxy; "#, r#" @@ -112,22 +121,23 @@ struct AtomicI16 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i32; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> i32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicI32 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicI32 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicI64", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -136,8 +146,8 @@ struct AtomicI32 {} ///let atomic_forty_two = AtomicI64::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: i64) -> std::sync::atomic::AtomicI64; + #[lua()] + fn new(v: i64) -> LuaReflectValProxy; "#, r#" @@ -151,22 +161,23 @@ struct AtomicI32 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i64; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> i64; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicI64 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicI64 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicI8", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -175,8 +186,8 @@ struct AtomicI64 {} ///let atomic_forty_two = AtomicI8::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: i8) -> std::sync::atomic::AtomicI8; + #[lua()] + fn new(v: i8) -> LuaReflectValProxy; "#, r#" @@ -190,22 +201,23 @@ struct AtomicI64 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> i8; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> i8; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicI8 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicI8 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicIsize", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -214,8 +226,8 @@ struct AtomicI8 {} ///let atomic_forty_two = AtomicIsize::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: isize) -> std::sync::atomic::AtomicIsize; + #[lua()] + fn new(v: isize) -> LuaReflectValProxy; "#, r#" @@ -229,22 +241,23 @@ struct AtomicI8 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> isize; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> isize; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicIsize {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicIsize {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicU16", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -253,8 +266,8 @@ struct AtomicIsize {} ///let atomic_forty_two = AtomicU16::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: u16) -> std::sync::atomic::AtomicU16; + #[lua()] + fn new(v: u16) -> LuaReflectValProxy; "#, r#" @@ -268,22 +281,23 @@ struct AtomicIsize {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u16; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> u16; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicU16 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicU16 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicU32", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -292,8 +306,8 @@ struct AtomicU16 {} ///let atomic_forty_two = AtomicU32::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: u32) -> std::sync::atomic::AtomicU32; + #[lua()] + fn new(v: u32) -> LuaReflectValProxy; "#, r#" @@ -307,22 +321,23 @@ struct AtomicU16 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u32; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> u32; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicU32 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicU32 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicU64", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -331,8 +346,8 @@ struct AtomicU32 {} ///let atomic_forty_two = AtomicU64::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: u64) -> std::sync::atomic::AtomicU64; + #[lua()] + fn new(v: u64) -> LuaReflectValProxy; "#, r#" @@ -346,22 +361,23 @@ struct AtomicU32 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u64; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> u64; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicU64 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicU64 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicU8", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -370,8 +386,8 @@ struct AtomicU64 {} ///let atomic_forty_two = AtomicU8::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: u8) -> std::sync::atomic::AtomicU8; + #[lua()] + fn new(v: u8) -> LuaReflectValProxy; "#, r#" @@ -385,22 +401,23 @@ struct AtomicU64 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> u8; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> u8; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicU8 {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicU8 {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(), remote = "std::sync::atomic::AtomicUsize", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new atomic integer. /// # Examples @@ -409,8 +426,8 @@ struct AtomicU8 {} ///let atomic_forty_two = AtomicUsize::new(42); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(v: usize) -> std::sync::atomic::AtomicUsize; + #[lua()] + fn new(v: usize) -> LuaReflectValProxy; "#, r#" @@ -424,71 +441,64 @@ struct AtomicU8 {} /// assert_eq!(some_var.into_inner(), 5); /// ``` - #[lua(kind = "Method")] - fn into_inner(self) -> usize; + #[lua()] + fn into_inner(_self: LuaReflectValProxy) -> usize; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AtomicUsize {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AtomicUsize {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::utils::Duration", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u32) -> bevy::utils::Duration; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::utils::Duration; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &bevy_utils::Duration) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -505,8 +515,8 @@ struct AtomicUsize {} /// let five_seconds = Duration::new(5, 0); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new(secs: u64, nanos: u32) -> bevy::utils::Duration; + #[lua()] + fn new(secs: u64, nanos: u32) -> LuaReflectValProxy; "#, r#" @@ -519,8 +529,8 @@ struct AtomicUsize {} /// assert_eq!(0, duration.subsec_nanos()); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_secs(secs: u64) -> bevy::utils::Duration; + #[lua()] + fn from_secs(secs: u64) -> LuaReflectValProxy; "#, r#" @@ -533,8 +543,8 @@ struct AtomicUsize {} /// assert_eq!(569_000_000, duration.subsec_nanos()); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_millis(millis: u64) -> bevy::utils::Duration; + #[lua()] + fn from_millis(millis: u64) -> LuaReflectValProxy; "#, r#" @@ -547,8 +557,8 @@ struct AtomicUsize {} /// assert_eq!(2_000, duration.subsec_nanos()); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_micros(micros: u64) -> bevy::utils::Duration; + #[lua()] + fn from_micros(micros: u64) -> LuaReflectValProxy; "#, r#" @@ -565,8 +575,8 @@ struct AtomicUsize {} /// assert_eq!(123, duration.subsec_nanos()); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_nanos(nanos: u64) -> bevy::utils::Duration; + #[lua()] + fn from_nanos(nanos: u64) -> LuaReflectValProxy; "#, r#" @@ -583,8 +593,8 @@ struct AtomicUsize {} /// assert!(!Duration::from_secs(1).is_zero()); /// ``` - #[lua(kind = "Method")] - fn is_zero(&self) -> bool; + #[lua()] + fn is_zero(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -603,8 +613,8 @@ struct AtomicUsize {} /// [`as_secs_f32`]: Duration::as_secs_f32 /// [`subsec_nanos`]: Duration::subsec_nanos - #[lua(kind = "Method")] - fn as_secs(&self) -> u64; + #[lua()] + fn as_secs(_self: LuaReflectRefProxy) -> u64; "#, r#" @@ -620,8 +630,8 @@ struct AtomicUsize {} /// assert_eq!(duration.subsec_millis(), 432); /// ``` - #[lua(kind = "Method")] - fn subsec_millis(&self) -> u32; + #[lua()] + fn subsec_millis(_self: LuaReflectRefProxy) -> u32; "#, r#" @@ -637,8 +647,8 @@ struct AtomicUsize {} /// assert_eq!(duration.subsec_micros(), 234_567); /// ``` - #[lua(kind = "Method")] - fn subsec_micros(&self) -> u32; + #[lua()] + fn subsec_micros(_self: LuaReflectRefProxy) -> u32; "#, r#" @@ -654,8 +664,8 @@ struct AtomicUsize {} /// assert_eq!(duration.subsec_nanos(), 10_000_000); /// ``` - #[lua(kind = "Method")] - fn subsec_nanos(&self) -> u32; + #[lua()] + fn subsec_nanos(_self: LuaReflectRefProxy) -> u32; "#, r#" @@ -667,8 +677,8 @@ struct AtomicUsize {} /// assert_eq!(duration.as_millis(), 5_730); /// ``` - #[lua(kind = "Method")] - fn as_millis(&self) -> u128; + #[lua()] + fn as_millis(_self: LuaReflectRefProxy) -> u128; "#, r#" @@ -680,8 +690,8 @@ struct AtomicUsize {} /// assert_eq!(duration.as_micros(), 5_730_023); /// ``` - #[lua(kind = "Method")] - fn as_micros(&self) -> u128; + #[lua()] + fn as_micros(_self: LuaReflectRefProxy) -> u128; "#, r#" @@ -693,8 +703,8 @@ struct AtomicUsize {} /// assert_eq!(duration.as_nanos(), 5_730_023_852); /// ``` - #[lua(kind = "Method")] - fn as_nanos(&self) -> u128; + #[lua()] + fn as_nanos(_self: LuaReflectRefProxy) -> u128; "#, r#" @@ -706,8 +716,11 @@ struct AtomicUsize {} /// 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; + #[lua()] + fn abs_diff( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -721,12 +734,11 @@ struct AtomicUsize {} /// assert_eq!(Duration::new(1, 0).saturating_add(Duration::new(u64::MAX, 0)), Duration::MAX); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add( - self, - #[proxy] - rhs: bevy::utils::Duration, - ) -> bevy::utils::Duration; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -739,12 +751,11 @@ struct AtomicUsize {} /// assert_eq!(Duration::new(0, 0).saturating_sub(Duration::new(0, 1)), Duration::ZERO); /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub( - self, - #[proxy] - rhs: bevy::utils::Duration, - ) -> bevy::utils::Duration; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -758,8 +769,11 @@ struct AtomicUsize {} /// assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX); /// ``` - #[lua(kind = "Method", output(proxy))] - fn saturating_mul(self, rhs: u32) -> bevy::utils::Duration; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" @@ -772,8 +786,8 @@ struct AtomicUsize {} /// assert_eq!(dur.as_secs_f64(), 2.7); /// ``` - #[lua(kind = "Method")] - fn as_secs_f64(&self) -> f64; + #[lua()] + fn as_secs_f64(_self: LuaReflectRefProxy) -> f64; "#, r#" @@ -786,8 +800,8 @@ struct AtomicUsize {} /// assert_eq!(dur.as_secs_f32(), 2.7); /// ``` - #[lua(kind = "Method")] - fn as_secs_f32(&self) -> f32; + #[lua()] + fn as_secs_f32(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -816,8 +830,8 @@ struct AtomicUsize {} /// assert_eq!(res, Duration::new(0, 1)); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_secs_f64(secs: f64) -> bevy::utils::Duration; + #[lua()] + fn from_secs_f64(secs: f64) -> LuaReflectValProxy; "#, r#" @@ -846,8 +860,8 @@ struct AtomicUsize {} /// assert_eq!(res, Duration::new(0, 1)); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_secs_f32(secs: f32) -> bevy::utils::Duration; + #[lua()] + fn from_secs_f32(secs: f32) -> LuaReflectValProxy; "#, r#" @@ -862,8 +876,11 @@ struct AtomicUsize {} /// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn mul_f64(self, rhs: f64) -> bevy::utils::Duration; + #[lua()] + fn mul_f64( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -878,8 +895,11 @@ struct AtomicUsize {} /// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847_800, 0)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn mul_f32(self, rhs: f32) -> bevy::utils::Duration; + #[lua()] + fn mul_f32( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -894,8 +914,11 @@ struct AtomicUsize {} /// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn div_f64(self, rhs: f64) -> bevy::utils::Duration; + #[lua()] + fn div_f64( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -912,8 +935,11 @@ struct AtomicUsize {} /// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599)); /// ``` - #[lua(kind = "Method", output(proxy))] - fn div_f32(self, rhs: f32) -> bevy::utils::Duration; + #[lua()] + fn div_f32( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -926,8 +952,11 @@ struct AtomicUsize {} /// assert_eq!(dur1.div_duration_f64(dur2), 0.5); /// ``` - #[lua(kind = "Method")] - fn div_duration_f64(self, #[proxy] rhs: bevy::utils::Duration) -> f64; + #[lua()] + fn div_duration_f64( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" @@ -940,83 +969,76 @@ struct AtomicUsize {} /// assert_eq!(dur1.div_duration_f32(dur2), 0.5); /// ``` - #[lua(kind = "Method")] - fn div_duration_f32(self, #[proxy] rhs: bevy::utils::Duration) -> f32; + #[lua()] + fn div_duration_f32( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, 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(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::utils::Duration; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Duration {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Duration {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::utils::Instant", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &bevy_utils::Instant) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::utils::Instant; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1028,14 +1050,11 @@ struct Duration {} /// See [Monotonicity]. /// [Monotonicity]: Instant#monotonicity - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] other: bevy::utils::Instant) -> bevy::utils::Duration; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1046,8 +1065,8 @@ struct Duration {} /// let now = Instant::now(); /// ``` - #[lua(kind = "Function", output(proxy))] - fn now() -> bevy::utils::Instant; + #[lua()] + fn now() -> LuaReflectValProxy; "#, r#" @@ -1069,12 +1088,11 @@ struct Duration {} /// println!("{:?}", now.duration_since(new_now)); // 0ns /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn duration_since( - &self, - #[proxy] - earlier: bevy::utils::Instant, - ) -> bevy::utils::Duration; + _self: LuaReflectRefProxy, + earlier: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1091,12 +1109,11 @@ struct Duration {} /// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns /// ``` - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_duration_since( - &self, - #[proxy] - earlier: bevy::utils::Instant, - ) -> bevy::utils::Duration; + _self: LuaReflectRefProxy, + earlier: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1116,8 +1133,10 @@ struct Duration {} /// assert!(instant.elapsed() >= three_secs); /// ``` - #[lua(kind = "Method", output(proxy))] - fn elapsed(&self) -> bevy::utils::Duration; + #[lua()] + fn elapsed( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1125,37 +1144,33 @@ struct Duration {} /// 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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Instant(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Instant(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "std::path::PathBuf", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &std::path::PathBuf) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1166,8 +1181,8 @@ struct Instant(); /// let path = PathBuf::new(); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new() -> std::path::PathBuf; + #[lua()] + fn new() -> LuaReflectValProxy; "#, r#" @@ -1184,8 +1199,8 @@ struct Instant(); /// ``` /// [`with_capacity`]: OsString::with_capacity - #[lua(kind = "Function", output(proxy))] - fn with_capacity(capacity: usize) -> std::path::PathBuf; + #[lua()] + fn with_capacity(capacity: usize) -> LuaReflectValProxy; "#, r#" @@ -1203,66 +1218,73 @@ struct Instant(); /// assert_eq!(Path::new("/"), p); /// ``` - #[lua(kind = "MutatingMethod")] - fn pop(&mut self) -> bool; + #[lua()] + fn pop(_self: LuaReflectRefMutProxy) -> bool; "#, r#" /// Invokes [`capacity`] on the underlying instance of [`OsString`]. /// [`capacity`]: OsString::capacity - #[lua(kind = "Method")] - fn capacity(&self) -> usize; + #[lua()] + fn capacity(_self: LuaReflectRefProxy) -> usize; "#, r#" /// Invokes [`clear`] on the underlying instance of [`OsString`]. /// [`clear`]: OsString::clear - #[lua(kind = "MutatingMethod")] - fn clear(&mut self) -> (); + #[lua()] + fn clear(_self: LuaReflectRefMutProxy) -> (); "#, r#" /// Invokes [`reserve`] on the underlying instance of [`OsString`]. /// [`reserve`]: OsString::reserve - #[lua(kind = "MutatingMethod")] - fn reserve(&mut self, additional: usize) -> (); + #[lua()] + fn reserve( + _self: LuaReflectRefMutProxy, + additional: usize, + ) -> (); "#, r#" /// Invokes [`reserve_exact`] on the underlying instance of [`OsString`]. /// [`reserve_exact`]: OsString::reserve_exact - #[lua(kind = "MutatingMethod")] - fn reserve_exact(&mut self, additional: usize) -> (); + #[lua()] + fn reserve_exact( + _self: LuaReflectRefMutProxy, + additional: usize, + ) -> (); "#, r#" /// Invokes [`shrink_to_fit`] on the underlying instance of [`OsString`]. /// [`shrink_to_fit`]: OsString::shrink_to_fit - #[lua(kind = "MutatingMethod")] - fn shrink_to_fit(&mut self) -> (); + #[lua()] + fn shrink_to_fit(_self: LuaReflectRefMutProxy) -> (); "#, r#" /// Invokes [`shrink_to`] on the underlying instance of [`OsString`]. /// [`shrink_to`]: OsString::shrink_to - #[lua(kind = "MutatingMethod")] - fn shrink_to(&mut self, min_capacity: usize) -> (); + #[lua()] + fn shrink_to( + _self: LuaReflectRefMutProxy, + min_capacity: usize, + ) -> (); "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> std::path::PathBuf; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1270,123 +1292,107 @@ struct Instant(); /// 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", - )] - fn clone_from(&mut self, #[proxy] source: &std::path::PathBuf) -> (); + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone_from( + _self: LuaReflectRefMutProxy, + source: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct PathBuf {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct PathBuf {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "std::ops::RangeFull", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> std::ops::RangeFull; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &std::ops::RangeFull) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RangeFull {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct RangeFull {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Quat", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Quat; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Quat) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Quat; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1397,28 +1403,22 @@ struct RangeFull {} /// # 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1427,14 +1427,11 @@ struct RangeFull {} /// 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::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1446,8 +1443,8 @@ struct RangeFull {} /// This function does not check if the input is normalized, it is up to the user to /// provide normalized input or to normalized the resulting quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_xyzw(x: f32, y: f32, z: f32, w: f32) -> bevy::math::Quat; + #[lua()] + fn from_xyzw(x: f32, y: f32, z: f32, w: f32) -> LuaReflectValProxy; "#, r#" @@ -1456,8 +1453,8 @@ struct RangeFull {} /// This function does not check if the input is normalized, it is up to the user to /// provide normalized input or to normalized the resulting quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 4]) -> bevy::math::Quat; + #[lua()] + fn from_array(a: [f32; 4]) -> LuaReflectValProxy; "#, r#" @@ -1466,8 +1463,10 @@ struct RangeFull {} /// This function does not check if the input is normalized, it is up to the user to /// provide normalized input or to normalized the resulting quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_vec4(#[proxy] v: bevy::math::Vec4) -> bevy::math::Quat; + #[lua()] + fn from_vec4( + v: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1476,50 +1475,54 @@ struct RangeFull {} /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Quat; + #[lua()] + fn from_axis_angle( + axis: LuaReflectValProxy, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. /// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_scaled_axis(#[proxy] v: bevy::math::Vec3) -> bevy::math::Quat; + #[lua()] + fn from_scaled_axis( + v: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the `angle` (in radians) around the x axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Quat; + #[lua()] + fn from_rotation_x(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the `angle` (in radians) around the y axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Quat; + #[lua()] + fn from_rotation_y(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the `angle` (in radians) around the z axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Quat; + #[lua()] + fn from_rotation_z(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - euler: bevy::math::EulerRot, + euler: LuaReflectValProxy, a: f32, b: f32, c: f32, - ) -> bevy::math::Quat; + ) -> LuaReflectValProxy; "#, r#" @@ -1529,8 +1532,10 @@ struct RangeFull {} /// # 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; + #[lua()] + fn from_mat3( + mat: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1540,8 +1545,10 @@ struct RangeFull {} /// # 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; + #[lua()] + fn from_mat3a( + mat: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1552,8 +1559,10 @@ struct RangeFull {} /// 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; + #[lua()] + fn from_mat4( + mat: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1566,13 +1575,11 @@ struct RangeFull {} /// # Panics /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_arc( - #[proxy] - from: bevy::math::Vec3, - #[proxy] - to: bevy::math::Vec3, - ) -> bevy::math::Quat; + from: LuaReflectValProxy, + to: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1585,13 +1592,11 @@ struct RangeFull {} /// # Panics /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_arc_colinear( - #[proxy] - from: bevy::math::Vec3, - #[proxy] - to: bevy::math::Vec3, - ) -> bevy::math::Quat; + from: LuaReflectValProxy, + to: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1604,49 +1609,56 @@ struct RangeFull {} /// # Panics /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_arc_2d( - #[proxy] - from: bevy::math::Vec2, - #[proxy] - to: bevy::math::Vec2, - ) -> bevy::math::Quat; + from: LuaReflectValProxy, + to: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the rotation axis scaled by the rotation in radians. - #[lua(kind = "Method", output(proxy))] - fn to_scaled_axis(self) -> bevy::math::Vec3; + #[lua()] + fn to_scaled_axis( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the rotation angles for the given euler rotation sequence. - #[lua(kind = "Method")] - fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); + #[lua()] + fn to_euler( + _self: LuaReflectValProxy, + order: LuaReflectValProxy, + ) -> (f32, f32, f32); "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f32; 4]; "#, r#" /// Returns the vector part of the quaternion. - #[lua(kind = "Method", output(proxy))] - fn xyz(self) -> bevy::math::Vec3; + #[lua()] + fn xyz( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the quaternion conjugate of `self`. For a unit quaternion the /// conjugate is also the inverse. - #[lua(kind = "Method", output(proxy))] - fn conjugate(self) -> bevy::math::Quat; + #[lua()] + fn conjugate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1657,23 +1669,28 @@ struct RangeFull {} /// # Panics /// Will panic if `self` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(self) -> bevy::math::Quat; + #[lua()] + fn inverse( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. The dot product is /// equal to the cosine of the angle between two quaternion rotations. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Quat) -> f32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -1681,16 +1698,16 @@ struct RangeFull {} /// This is generally faster than `length()` as it avoids a square /// root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f32; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -1699,37 +1716,39 @@ struct RangeFull {} /// Panics /// Will panic if `self` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Quat; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NAN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns whether `self` of length `1.0` or not. /// Uses a precision threshold of `1e-6`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" - #[lua(kind = "Method")] - fn is_near_identity(self) -> bool; + #[lua()] + fn is_near_identity(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -1739,8 +1758,11 @@ struct RangeFull {} /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method")] - fn angle_between(self, #[proxy] rhs: bevy::math::Quat) -> f32; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" @@ -1752,13 +1774,12 @@ struct RangeFull {} /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn rotate_towards( - &self, - #[proxy] - rhs: bevy::math::Quat, + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, max_angle: f32, - ) -> bevy::math::Quat; + ) -> LuaReflectValProxy; "#, r#" @@ -1770,8 +1791,12 @@ struct RangeFull {} /// 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::Quat, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" @@ -1782,8 +1807,12 @@ struct RangeFull {} /// # Panics /// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] end: bevy::math::Quat, s: f32) -> bevy::math::Quat; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + end: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -1794,8 +1823,12 @@ struct RangeFull {} /// # 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::Quat, s: f32) -> bevy::math::Quat; + #[lua()] + fn slerp( + _self: LuaReflectValProxy, + end: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -1803,8 +1836,11 @@ struct RangeFull {} /// # 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::Vec3) -> bevy::math::Vec3; + #[lua()] + fn mul_vec3( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1814,8 +1850,11 @@ struct RangeFull {} /// # 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::Quat) -> bevy::math::Quat; + #[lua()] + fn mul_quat( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1826,21 +1865,28 @@ struct RangeFull {} /// 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; + #[lua()] + fn from_affine3( + a: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// 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; + #[lua()] + fn mul_vec3a( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_dquat(self) -> bevy::math::DQuat; + #[lua()] + fn as_dquat( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -1848,124 +1894,101 @@ struct RangeFull {} /// # 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Quat(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Quat(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Vec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32, z: f32) -> bevy::math::Vec3; + #[lua()] + fn new(x: f32, y: f32, z: f32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec3; + #[lua()] + fn splat(v: f32) -> LuaReflectValProxy; "#, r#" @@ -1974,102 +1997,128 @@ struct Quat(); /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::Vec3, - #[proxy] - if_false: bevy::math::Vec3, - ) -> bevy::math::Vec3; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 3]) -> bevy::math::Vec3; + #[lua()] + fn from_array(a: [f32; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f32; 3]; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: f32) -> bevy::math::Vec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::Vec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec3; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec3; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f32) -> bevy::math::Vec3; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: f32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec3) -> f32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2078,46 +2127,44 @@ struct Quat(); /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::Vec3, - #[proxy] - max: bevy::math::Vec3, - ) -> bevy::math::Vec3; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -2126,8 +2173,11 @@ struct Quat(); /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2136,8 +2186,11 @@ struct Quat(); /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2146,8 +2199,11 @@ struct Quat(); /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2156,8 +2212,11 @@ struct Quat(); /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2166,8 +2225,11 @@ struct Quat(); /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2176,15 +2238,20 @@ struct Quat(); /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec3; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2193,15 +2260,20 @@ struct Quat(); /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec3; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2209,91 +2281,107 @@ struct Quat(); /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec3; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f32; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec3) -> f32; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec3) -> f32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2303,8 +2391,10 @@ struct Quat(); /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2314,8 +2404,11 @@ struct Quat(); /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2324,16 +2417,18 @@ struct Quat(); /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec3; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -2342,8 +2437,11 @@ struct Quat(); /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2354,8 +2452,11 @@ struct Quat(); /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2364,8 +2465,11 @@ struct Quat(); /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn project_onto_normalized( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2376,40 +2480,51 @@ struct Quat(); /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn reject_from_normalized( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec3; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec3; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec3; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec3; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2418,8 +2533,10 @@ struct Quat(); /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec3; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2428,30 +2545,39 @@ struct Quat(); /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec3; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec3; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec3; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f32, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec3; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2460,8 +2586,12 @@ struct Quat(); /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec3, s: f32) -> bevy::math::Vec3; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -2469,8 +2599,12 @@ struct Quat(); /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec3, d: f32) -> bevy::math::Vec3; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -2479,8 +2613,11 @@ struct Quat(); /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2492,8 +2629,12 @@ struct Quat(); /// 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::Vec3, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" @@ -2501,8 +2642,12 @@ struct Quat(); /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f32, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -2510,8 +2655,11 @@ struct Quat(); /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -2519,8 +2667,11 @@ struct Quat(); /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -2531,14 +2682,12 @@ struct Quat(); /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::Vec3, - #[proxy] - b: bevy::math::Vec3, - ) -> bevy::math::Vec3; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2548,8 +2697,11 @@ struct Quat(); /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2560,16 +2712,23 @@ struct Quat(); /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f32, + ) -> LuaReflectValProxy; "#, 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::Vec3) -> f32; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" @@ -2578,8 +2737,10 @@ struct Quat(); /// 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::Vec3; + #[lua()] + fn any_orthogonal_vector( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2588,238 +2749,213 @@ struct Quat(); /// # 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::Vec3; + #[lua()] + fn any_orthonormal_vector( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua()] + fn as_dvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua()] + fn as_ivec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua()] + fn as_uvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua()] + fn as_i64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua()] + fn as_u64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::Vec3) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::Vec3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f32) -> () { + _self[idx - 1] = val } "#] )] -struct Vec3 { +pub struct Vec3 { x: f32, y: f32, z: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::IVec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i32) -> bevy::math::IVec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i32, y: i32) -> bevy::math::IVec2; + #[lua()] + fn new(x: i32, y: i32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i32) -> bevy::math::IVec2; + #[lua()] + fn splat(v: i32) -> LuaReflectValProxy; "#, r#" @@ -2828,80 +2964,98 @@ struct Vec3 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec2, - #[proxy] - if_true: bevy::math::IVec2, - #[proxy] - if_false: bevy::math::IVec2, - ) -> bevy::math::IVec2; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i32; 2]) -> bevy::math::IVec2; + #[lua()] + fn from_array(a: [i32; 2]) -> LuaReflectValProxy; "#, r#" /// `[x, y]` - #[lua(kind = "Method")] - fn to_array(&self) -> [i32; 2]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i32; 2]; "#, r#" /// Creates a 3D vector from `self` and the given `z` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: i32) -> bevy::math::IVec3; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + z: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i32) -> bevy::math::IVec2; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i32) -> bevy::math::IVec2; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::IVec2) -> i32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2910,46 +3064,44 @@ struct Vec3 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::IVec2, - #[proxy] - max: bevy::math::IVec2, - ) -> bevy::math::IVec2; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> i32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> i32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> i32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> i32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> i32; "#, r#" @@ -2958,8 +3110,11 @@ struct Vec3 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2968,8 +3123,11 @@ struct Vec3 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2978,8 +3136,11 @@ struct Vec3 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2988,8 +3149,11 @@ struct Vec3 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -2998,8 +3162,11 @@ struct Vec3 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3008,15 +3175,20 @@ struct Vec3 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::IVec2; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3025,8 +3197,10 @@ struct Vec3 { /// - `1` if the number is positive /// - `-1` if the number is negative - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::IVec2; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3034,22 +3208,25 @@ struct Vec3 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> i32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> i32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::IVec2) -> i32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" @@ -3057,8 +3234,11 @@ struct Vec3 { /// # Panics /// This function will panic if any `rhs` element is 0 or the division results in overflow. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3067,23 +3247,31 @@ struct Vec3 { /// This function will panic if any `rhs` element is 0 or the division results in overflow. /// [Euclidean division]: i32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector that is equal to `self` rotated by 90 degrees. - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::IVec2; + #[lua()] + fn perp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The perpendicular dot product of `self` and `rhs`. /// Also known as the wedge product, 2D cross product, and determinant. - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::IVec2) -> i32; + #[lua()] + fn perp_dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" @@ -3091,613 +3279,552 @@ struct Vec3 { /// then this just rotation. This is what you usually want. Otherwise, /// it will be like a rotation with a multiplication by `self`'s length. - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; + #[lua()] + fn rotate( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; + #[lua()] + fn as_vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; + #[lua()] + fn as_dvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; + #[lua()] + fn as_uvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; + #[lua()] + fn as_i64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; + #[lua()] + fn as_u64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::IVec2; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::IVec2; + #[lua()] + fn wrapping_add_unsigned( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::IVec2; + #[lua()] + fn wrapping_sub_unsigned( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec2, - ) -> bevy::math::IVec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec2, - ) -> bevy::math::IVec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i32) -> bevy::math::IVec2; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::IVec2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::IVec2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i32) -> bevy::math::IVec2; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i32) -> bevy::math::IVec2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: i32) -> () { + _self[idx - 1] = val } "#] )] -struct IVec2 { +pub struct IVec2 { x: i32, y: i32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::IVec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i32) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i32) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::IVec3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i32) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i32) -> bevy::math::IVec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i32, y: i32, z: i32) -> bevy::math::IVec3; + #[lua()] + fn new(x: i32, y: i32, z: i32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i32) -> bevy::math::IVec3; + #[lua()] + fn splat(v: i32) -> LuaReflectValProxy; "#, r#" @@ -3706,102 +3833,128 @@ struct IVec2 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::IVec3, - #[proxy] - if_false: bevy::math::IVec3, - ) -> bevy::math::IVec3; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i32; 3]) -> bevy::math::IVec3; + #[lua()] + fn from_array(a: [i32; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [i32; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i32; 3]; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: i32) -> bevy::math::IVec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::IVec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i32) -> bevy::math::IVec3; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i32) -> bevy::math::IVec3; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i32) -> bevy::math::IVec3; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: i32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::IVec3) -> i32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3810,46 +3963,44 @@ struct IVec2 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::IVec3, - #[proxy] - max: bevy::math::IVec3, - ) -> bevy::math::IVec3; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> i32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> i32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> i32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> i32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> i32; "#, r#" @@ -3858,8 +4009,11 @@ struct IVec2 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3868,8 +4022,11 @@ struct IVec2 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3878,8 +4035,11 @@ struct IVec2 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3888,8 +4048,11 @@ struct IVec2 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3898,8 +4061,11 @@ struct IVec2 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3908,15 +4074,20 @@ struct IVec2 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::IVec3; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3925,8 +4096,10 @@ struct IVec2 { /// - `1` if the number is positive /// - `-1` if the number is negative - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::IVec3; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3934,22 +4107,25 @@ struct IVec2 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> i32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> i32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::IVec3) -> i32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" @@ -3957,8 +4133,11 @@ struct IVec2 { /// # Panics /// This function will panic if any `rhs` element is 0 or the division results in overflow. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -3967,342 +4146,351 @@ struct IVec2 { /// This function will panic if any `rhs` element is 0 or the division results in overflow. /// [Euclidean division]: i32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; + #[lua()] + fn as_vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; + #[lua()] + fn as_vec3a( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua()] + fn as_dvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua()] + fn as_uvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua()] + fn as_i64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua()] + fn as_u64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec3) -> bevy::math::IVec3; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::IVec3; + #[lua()] + fn wrapping_add_unsigned( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::IVec3; + #[lua()] + fn wrapping_sub_unsigned( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec3, - ) -> bevy::math::IVec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec3, - ) -> bevy::math::IVec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: i32) -> () { + _self[idx - 1] = val } "#] )] -struct IVec3 { +pub struct IVec3 { x: i32, y: i32, z: i32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::IVec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i32) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i32) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::IVec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i32) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i32) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::IVec4) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::IVec4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i32, y: i32, z: i32, w: i32) -> bevy::math::IVec4; + #[lua()] + fn new(x: i32, y: i32, z: i32, w: i32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i32) -> bevy::math::IVec4; + #[lua()] + fn splat(v: i32) -> LuaReflectValProxy; "#, r#" @@ -4311,95 +4499,118 @@ struct IVec3 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::IVec4, - #[proxy] - if_false: bevy::math::IVec4, - ) -> bevy::math::IVec4; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i32; 4]) -> bevy::math::IVec4; + #[lua()] + fn from_array(a: [i32; 4]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [i32; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i32; 4]; "#, r#" /// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. /// Truncation to [`IVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::IVec3; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i32) -> bevy::math::IVec4; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i32) -> bevy::math::IVec4; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i32) -> bevy::math::IVec4; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: i32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `w`. - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: i32) -> bevy::math::IVec4; + #[lua()] + fn with_w( + _self: LuaReflectValProxy, + w: i32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::IVec4) -> i32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4408,46 +4619,44 @@ struct IVec3 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::IVec4, - #[proxy] - max: bevy::math::IVec4, - ) -> bevy::math::IVec4; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> i32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> i32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> i32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> i32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> i32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> i32; "#, r#" @@ -4456,8 +4665,11 @@ struct IVec3 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4466,8 +4678,11 @@ struct IVec3 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4476,8 +4691,11 @@ struct IVec3 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4486,8 +4704,11 @@ struct IVec3 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4496,8 +4717,11 @@ struct IVec3 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4506,15 +4730,20 @@ struct IVec3 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::IVec4; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4523,8 +4752,10 @@ struct IVec3 { /// - `1` if the number is positive /// - `-1` if the number is negative - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::IVec4; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4532,22 +4763,25 @@ struct IVec3 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> i32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> i32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::IVec4) -> i32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i32; "#, r#" @@ -4555,8 +4789,11 @@ struct IVec3 { /// # Panics /// This function will panic if any `rhs` element is 0 or the division results in overflow. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4565,261 +4802,285 @@ struct IVec3 { /// This function will panic if any `rhs` element is 0 or the division results in overflow. /// [Euclidean division]: i32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec4(&self) -> bevy::math::Vec4; + #[lua()] + fn as_vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; + #[lua()] + fn as_dvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec4(&self) -> bevy::math::UVec4; + #[lua()] + fn as_uvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec4(&self) -> bevy::math::I64Vec4; + #[lua()] + fn as_i64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; + #[lua()] + fn as_u64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::IVec4; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::IVec4; + #[lua()] + fn wrapping_add_unsigned( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::IVec4; + #[lua()] + fn wrapping_sub_unsigned( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec4, - ) -> bevy::math::IVec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec4, - ) -> bevy::math::IVec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: i32) -> () { + _self[idx - 1] = val } "#] )] -struct IVec4 { +pub struct IVec4 { x: i32, y: i32, z: i32, w: i32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::I64Vec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i64, y: i64) -> bevy::math::I64Vec2; + #[lua()] + fn new(x: i64, y: i64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i64) -> bevy::math::I64Vec2; + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; "#, r#" @@ -4828,80 +5089,98 @@ struct IVec4 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec2, - #[proxy] - if_true: bevy::math::I64Vec2, - #[proxy] - if_false: bevy::math::I64Vec2, - ) -> bevy::math::I64Vec2; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i64; 2]) -> bevy::math::I64Vec2; + #[lua()] + fn from_array(a: [i64; 2]) -> LuaReflectValProxy; "#, r#" /// `[x, y]` - #[lua(kind = "Method")] - fn to_array(&self) -> [i64; 2]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 2]; "#, r#" /// Creates a 3D vector from `self` and the given `z` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: i64) -> bevy::math::I64Vec3; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + z: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i64) -> bevy::math::I64Vec2; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i64) -> bevy::math::I64Vec2; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4910,46 +5189,44 @@ struct IVec4 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::I64Vec2, - #[proxy] - max: bevy::math::I64Vec2, - ) -> bevy::math::I64Vec2; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> i64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> i64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> i64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> i64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> i64; "#, r#" @@ -4958,8 +5235,11 @@ struct IVec4 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4968,8 +5248,11 @@ struct IVec4 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4978,8 +5261,11 @@ struct IVec4 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4988,8 +5274,11 @@ struct IVec4 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -4998,8 +5287,11 @@ struct IVec4 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5008,15 +5300,20 @@ struct IVec4 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::I64Vec2; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5025,8 +5322,10 @@ struct IVec4 { /// - `1` if the number is positive /// - `-1` if the number is negative - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::I64Vec2; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5034,22 +5333,25 @@ struct IVec4 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> i64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> i64; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" @@ -5057,8 +5359,11 @@ struct IVec4 { /// # Panics /// This function will panic if any `rhs` element is 0 or the division results in overflow. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5067,23 +5372,31 @@ struct IVec4 { /// This function will panic if any `rhs` element is 0 or the division results in overflow. /// [Euclidean division]: i64::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector that is equal to `self` rotated by 90 degrees. - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::I64Vec2; + #[lua()] + fn perp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The perpendicular dot product of `self` and `rhs`. /// Also known as the wedge product, 2D cross product, and determinant. - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; + #[lua()] + fn perp_dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" @@ -5091,402 +5404,383 @@ struct IVec4 { /// then this just rotation. This is what you usually want. Otherwise, /// it will be like a rotation with a multiplication by `self`'s length. - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn rotate( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; + #[lua()] + fn as_vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; + #[lua()] + fn as_dvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; + #[lua()] + fn as_ivec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; + #[lua()] + fn as_uvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; + #[lua()] + fn as_u64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec2) -> bevy::math::I64Vec2; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn wrapping_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn wrapping_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::I64Vec2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i64) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::I64Vec2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::I64Vec2) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec2; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct I64Vec2 { +pub struct I64Vec2 { x: i64, y: i64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::I64Vec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i64, y: i64, z: i64) -> bevy::math::I64Vec3; + #[lua()] + fn new(x: i64, y: i64, z: i64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i64) -> bevy::math::I64Vec3; + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; "#, r#" @@ -5495,102 +5789,128 @@ struct I64Vec2 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::I64Vec3, - #[proxy] - if_false: bevy::math::I64Vec3, - ) -> bevy::math::I64Vec3; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i64; 3]) -> bevy::math::I64Vec3; + #[lua()] + fn from_array(a: [i64; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [i64; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 3]; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: i64) -> bevy::math::I64Vec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::I64Vec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i64) -> bevy::math::I64Vec3; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i64) -> bevy::math::I64Vec3; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i64) -> bevy::math::I64Vec3; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: i64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::I64Vec3) -> i64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5599,46 +5919,44 @@ struct I64Vec2 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::I64Vec3, - #[proxy] - max: bevy::math::I64Vec3, - ) -> bevy::math::I64Vec3; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> i64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> i64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> i64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> i64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> i64; "#, r#" @@ -5647,8 +5965,11 @@ struct I64Vec2 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5657,8 +5978,11 @@ struct I64Vec2 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5667,8 +5991,11 @@ struct I64Vec2 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5677,8 +6004,11 @@ struct I64Vec2 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5687,8 +6017,11 @@ struct I64Vec2 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5697,15 +6030,20 @@ struct I64Vec2 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::I64Vec3; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5714,8 +6052,10 @@ struct I64Vec2 { /// - `1` if the number is positive /// - `-1` if the number is negative - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::I64Vec3; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5723,22 +6063,25 @@ struct I64Vec2 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> i64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> i64; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec3) -> i64; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" @@ -5746,8 +6089,11 @@ struct I64Vec2 { /// # Panics /// This function will panic if any `rhs` element is 0 or the division results in overflow. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5756,479 +6102,446 @@ struct I64Vec2 { /// This function will panic if any `rhs` element is 0 or the division results in overflow. /// [Euclidean division]: i64::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; + #[lua()] + fn as_vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; + #[lua()] + fn as_vec3a( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua()] + fn as_dvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua()] + fn as_ivec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua()] + fn as_uvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua()] + fn as_u64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec3) -> bevy::math::I64Vec3; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn wrapping_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn wrapping_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i64) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::I64Vec3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::I64Vec3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i64) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec3; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct I64Vec3 { +pub struct I64Vec3 { x: i64, y: i64, z: i64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::I64Vec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i64) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::I64Vec4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::I64Vec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: i64, y: i64, z: i64, w: i64) -> bevy::math::I64Vec4; + #[lua()] + fn new(x: i64, y: i64, z: i64, w: i64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: i64) -> bevy::math::I64Vec4; + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; "#, r#" @@ -6237,95 +6550,118 @@ struct I64Vec3 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::I64Vec4, - #[proxy] - if_false: bevy::math::I64Vec4, - ) -> bevy::math::I64Vec4; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i64; 4]) -> bevy::math::I64Vec4; + #[lua()] + fn from_array(a: [i64; 4]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [i64; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 4]; "#, r#" /// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. /// Truncation to [`I64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::I64Vec3; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i64) -> bevy::math::I64Vec4; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i64) -> bevy::math::I64Vec4; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i64) -> bevy::math::I64Vec4; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: i64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `w`. - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: i64) -> bevy::math::I64Vec4; + #[lua()] + fn with_w( + _self: LuaReflectValProxy, + w: i64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::I64Vec4) -> i64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6334,46 +6670,44 @@ struct I64Vec3 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::I64Vec4, - #[proxy] - max: bevy::math::I64Vec4, - ) -> bevy::math::I64Vec4; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> i64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> i64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> i64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> i64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> i64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> i64; "#, r#" @@ -6382,8 +6716,11 @@ struct I64Vec3 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6392,8 +6729,11 @@ struct I64Vec3 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6402,8 +6742,11 @@ struct I64Vec3 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6412,8 +6755,11 @@ struct I64Vec3 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6422,8 +6768,11 @@ struct I64Vec3 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6432,15 +6781,20 @@ struct I64Vec3 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::I64Vec4; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6449,8 +6803,10 @@ struct I64Vec3 { /// - `1` if the number is positive /// - `-1` if the number is negative - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::I64Vec4; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6458,22 +6814,25 @@ struct I64Vec3 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> i64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> i64; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec4) -> i64; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> i64; "#, r#" @@ -6481,8 +6840,11 @@ struct I64Vec3 { /// # Panics /// This function will panic if any `rhs` element is 0 or the division results in overflow. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -6491,459 +6853,427 @@ struct I64Vec3 { /// This function will panic if any `rhs` element is 0 or the division results in overflow. /// [Euclidean division]: i64::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec4(&self) -> bevy::math::Vec4; + #[lua()] + fn as_vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; + #[lua()] + fn as_dvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec4(&self) -> bevy::math::IVec4; + #[lua()] + fn as_ivec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec4(&self) -> bevy::math::UVec4; + #[lua()] + fn as_uvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; + #[lua()] + fn as_u64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::I64Vec4) -> bevy::math::I64Vec4; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn wrapping_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn wrapping_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. /// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i64) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i64) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i64) -> bevy::math::I64Vec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct I64Vec4 { +pub struct I64Vec4 { x: i64, y: i64, z: i64, w: i64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::UVec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::UVec2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u32) -> bevy::math::UVec2; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u32, y: u32) -> bevy::math::UVec2; + #[lua()] + fn new(x: u32, y: u32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u32) -> bevy::math::UVec2; + #[lua()] + fn splat(v: u32) -> LuaReflectValProxy; "#, r#" @@ -6952,80 +7282,98 @@ struct I64Vec4 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec2, - #[proxy] - if_true: bevy::math::UVec2, - #[proxy] - if_false: bevy::math::UVec2, - ) -> bevy::math::UVec2; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u32; 2]) -> bevy::math::UVec2; + #[lua()] + fn from_array(a: [u32; 2]) -> LuaReflectValProxy; "#, r#" /// `[x, y]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u32; 2]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [u32; 2]; "#, r#" /// Creates a 3D vector from `self` and the given `z` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: u32) -> bevy::math::UVec3; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + z: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u32) -> bevy::math::UVec2; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u32) -> bevy::math::UVec2; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: u32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::UVec2) -> u32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> u32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7034,46 +7382,44 @@ struct I64Vec4 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::UVec2, - #[proxy] - max: bevy::math::UVec2, - ) -> bevy::math::UVec2; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> u32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> u32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> u32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> u32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> u32; "#, r#" @@ -7082,8 +7428,11 @@ struct I64Vec4 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7092,8 +7441,11 @@ struct I64Vec4 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7102,8 +7454,11 @@ struct I64Vec4 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7112,8 +7467,11 @@ struct I64Vec4 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7122,8 +7480,11 @@ struct I64Vec4 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7132,383 +7493,376 @@ struct I64Vec4 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> u32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> u32; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; + #[lua()] + fn as_vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; + #[lua()] + fn as_dvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; + #[lua()] + fn as_ivec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; + #[lua()] + fn as_i64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; + #[lua()] + fn as_u64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec2) -> bevy::math::UVec2; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::UVec2; + #[lua()] + fn wrapping_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec2) -> bevy::math::UVec2; + #[lua()] + fn saturating_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u32) -> bevy::math::UVec2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::math::UVec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> bevy::math::UVec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: u32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: u32) -> () { + _self[idx - 1] = val } "#] )] -struct UVec2 { +pub struct UVec2 { x: u32, y: u32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::UVec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Rem::<&bevy::math::UVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::UVec3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u32) -> bevy::math::UVec3; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u32) -> bevy::math::UVec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> bevy::math::UVec3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u32, y: u32, z: u32) -> bevy::math::UVec3; + #[lua()] + fn new(x: u32, y: u32, z: u32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u32) -> bevy::math::UVec3; + #[lua()] + fn splat(v: u32) -> LuaReflectValProxy; "#, r#" @@ -7517,102 +7871,128 @@ struct UVec2 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::UVec3, - #[proxy] - if_false: bevy::math::UVec3, - ) -> bevy::math::UVec3; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u32; 3]) -> bevy::math::UVec3; + #[lua()] + fn from_array(a: [u32; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u32; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [u32; 3]; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: u32) -> bevy::math::UVec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::UVec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u32) -> bevy::math::UVec3; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u32) -> bevy::math::UVec3; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u32) -> bevy::math::UVec3; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: u32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::UVec3) -> u32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> u32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7621,46 +8001,44 @@ struct UVec2 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::UVec3, - #[proxy] - max: bevy::math::UVec3, - ) -> bevy::math::UVec3; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> u32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> u32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> u32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> u32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> u32; "#, r#" @@ -7669,8 +8047,11 @@ struct UVec2 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7679,8 +8060,11 @@ struct UVec2 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7689,8 +8073,11 @@ struct UVec2 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7699,8 +8086,11 @@ struct UVec2 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7709,8 +8099,11 @@ struct UVec2 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7719,335 +8112,345 @@ struct UVec2 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> u32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> u32; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; + #[lua()] + fn as_vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; + #[lua()] + fn as_vec3a( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua()] + fn as_dvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua()] + fn as_ivec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua()] + fn as_i64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua()] + fn as_u64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::UVec3) -> bevy::math::UVec3; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec3) -> bevy::math::UVec3; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec3) -> bevy::math::UVec3; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn wrapping_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn saturating_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::math::UVec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> bevy::math::UVec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: u32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: u32) -> () { + _self[idx - 1] = val } "#] )] -struct UVec3 { +pub struct UVec3 { x: u32, y: u32, z: u32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::UVec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u32, y: u32, z: u32, w: u32) -> bevy::math::UVec4; + #[lua()] + fn new(x: u32, y: u32, z: u32, w: u32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u32) -> bevy::math::UVec4; + #[lua()] + fn splat(v: u32) -> LuaReflectValProxy; "#, r#" @@ -8056,95 +8459,118 @@ struct UVec3 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::UVec4, - #[proxy] - if_false: bevy::math::UVec4, - ) -> bevy::math::UVec4; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u32; 4]) -> bevy::math::UVec4; + #[lua()] + fn from_array(a: [u32; 4]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u32; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [u32; 4]; "#, r#" /// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. /// Truncation to [`UVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::UVec3; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u32) -> bevy::math::UVec4; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u32) -> bevy::math::UVec4; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u32) -> bevy::math::UVec4; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: u32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `w`. - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: u32) -> bevy::math::UVec4; + #[lua()] + fn with_w( + _self: LuaReflectValProxy, + w: u32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::UVec4) -> u32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> u32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8153,46 +8579,44 @@ struct UVec3 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::UVec4, - #[proxy] - max: bevy::math::UVec4, - ) -> bevy::math::UVec4; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> u32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> u32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> u32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> u32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> u32; "#, r#" @@ -8201,8 +8625,11 @@ struct UVec3 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8211,8 +8638,11 @@ struct UVec3 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8221,8 +8651,11 @@ struct UVec3 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8231,8 +8664,11 @@ struct UVec3 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8241,8 +8677,11 @@ struct UVec3 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8251,320 +8690,330 @@ struct UVec3 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> u32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> u32; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec4(&self) -> bevy::math::Vec4; + #[lua()] + fn as_vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; + #[lua()] + fn as_dvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec4(&self) -> bevy::math::IVec4; + #[lua()] + fn as_ivec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec4(&self) -> bevy::math::I64Vec4; + #[lua()] + fn as_i64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; + #[lua()] + fn as_u64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::UVec4) -> bevy::math::UVec4; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::IVec4) -> bevy::math::UVec4; + #[lua()] + fn wrapping_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] + fn saturating_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::UVec4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u32) -> bevy::math::UVec4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, r#" -#[lua(kind="MutatingMetaMethod", raw, metamethod="NewIndex")] -fn index(&mut self, lua: &Lua, idx: crate::lua::util::LuaIndex, val: u32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: u32) -> () { + _self[idx - 1] = val } "#] )] -struct UVec4 { +pub struct UVec4 { x: u32, y: u32, z: u32, w: u32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::U64Vec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u64, y: u64) -> bevy::math::U64Vec2; + #[lua()] + fn new(x: u64, y: u64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u64) -> bevy::math::U64Vec2; + #[lua()] + fn splat(v: u64) -> LuaReflectValProxy; "#, r#" @@ -8573,80 +9022,98 @@ struct UVec4 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec2, - #[proxy] - if_true: bevy::math::U64Vec2, - #[proxy] - if_false: bevy::math::U64Vec2, - ) -> bevy::math::U64Vec2; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u64; 2]) -> bevy::math::U64Vec2; + #[lua()] + fn from_array(a: [u64; 2]) -> LuaReflectValProxy; "#, r#" /// `[x, y]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u64; 2]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [u64; 2]; "#, r#" /// Creates a 3D vector from `self` and the given `z` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: u64) -> bevy::math::U64Vec3; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + z: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u64) -> bevy::math::U64Vec2; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u64) -> bevy::math::U64Vec2; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: u64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::U64Vec2) -> u64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> u64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8655,46 +9122,44 @@ struct UVec4 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::U64Vec2, - #[proxy] - max: bevy::math::U64Vec2, - ) -> bevy::math::U64Vec2; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> u64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> u64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> u64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> u64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> u64; "#, r#" @@ -8703,8 +9168,11 @@ struct UVec4 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8713,8 +9181,11 @@ struct UVec4 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8723,8 +9194,11 @@ struct UVec4 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8733,8 +9207,11 @@ struct UVec4 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8743,8 +9220,11 @@ struct UVec4 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8753,440 +9233,409 @@ struct UVec4 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> u64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> u64; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; + #[lua()] + fn as_vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; + #[lua()] + fn as_dvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; + #[lua()] + fn as_ivec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; + #[lua()] + fn as_uvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; + #[lua()] + fn as_i64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn wrapping_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec2, - ) -> bevy::math::U64Vec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn saturating_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec2, - ) -> bevy::math::U64Vec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::U64Vec2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec2; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct U64Vec2 { +pub struct U64Vec2 { x: u64, y: u64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::U64Vec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[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(as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" - #[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(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u64, y: u64, z: u64) -> bevy::math::U64Vec3; + #[lua()] + fn new(x: u64, y: u64, z: u64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u64) -> bevy::math::U64Vec3; + #[lua()] + fn splat(v: u64) -> LuaReflectValProxy; "#, r#" @@ -9195,102 +9644,128 @@ struct U64Vec2 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::U64Vec3, - #[proxy] - if_false: bevy::math::U64Vec3, - ) -> bevy::math::U64Vec3; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u64; 3]) -> bevy::math::U64Vec3; + #[lua()] + fn from_array(a: [u64; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u64; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [u64; 3]; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: u64) -> bevy::math::U64Vec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::U64Vec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u64) -> bevy::math::U64Vec3; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u64) -> bevy::math::U64Vec3; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u64) -> bevy::math::U64Vec3; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: u64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::U64Vec3) -> u64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> u64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9299,46 +9774,44 @@ struct U64Vec2 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::U64Vec3, - #[proxy] - max: bevy::math::U64Vec3, - ) -> bevy::math::U64Vec3; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> u64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> u64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> u64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> u64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> u64; "#, r#" @@ -9347,8 +9820,11 @@ struct U64Vec2 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9357,8 +9833,11 @@ struct U64Vec2 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9367,8 +9846,11 @@ struct U64Vec2 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9377,8 +9859,11 @@ struct U64Vec2 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9387,8 +9872,11 @@ struct U64Vec2 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9397,469 +9885,439 @@ struct U64Vec2 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> u64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> u64; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; + #[lua()] + fn as_vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; + #[lua()] + fn as_vec3a( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua()] + fn as_dvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua()] + fn as_ivec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua()] + fn as_uvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua()] + fn as_i64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec3) -> bevy::math::U64Vec3; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn wrapping_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec3, - ) -> bevy::math::U64Vec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn saturating_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec3, - ) -> bevy::math::U64Vec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u64) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::U64Vec3) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::U64Vec3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct U64Vec3 { +pub struct U64Vec3 { x: u64, y: u64, z: u64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::U64Vec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u64) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u64) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::U64Vec4) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::U64Vec4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: u64, y: u64, z: u64, w: u64) -> bevy::math::U64Vec4; + #[lua()] + fn new(x: u64, y: u64, z: u64, w: u64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: u64) -> bevy::math::U64Vec4; + #[lua()] + fn splat(v: u64) -> LuaReflectValProxy; "#, r#" @@ -9868,95 +10326,118 @@ struct U64Vec3 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::U64Vec4, - #[proxy] - if_false: bevy::math::U64Vec4, - ) -> bevy::math::U64Vec4; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u64; 4]) -> bevy::math::U64Vec4; + #[lua()] + fn from_array(a: [u64; 4]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [u64; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [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; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u64) -> bevy::math::U64Vec4; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u64) -> bevy::math::U64Vec4; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u64) -> bevy::math::U64Vec4; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: u64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `w`. - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: u64) -> bevy::math::U64Vec4; + #[lua()] + fn with_w( + _self: LuaReflectValProxy, + w: u64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::U64Vec4) -> u64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> u64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9965,46 +10446,44 @@ struct U64Vec3 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::U64Vec4, - #[proxy] - max: bevy::math::U64Vec4, - ) -> bevy::math::U64Vec4; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> u64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> u64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> u64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> u64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> u64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> u64; "#, r#" @@ -10013,8 +10492,11 @@ struct U64Vec3 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10023,8 +10505,11 @@ struct U64Vec3 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10033,8 +10518,11 @@ struct U64Vec3 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10043,8 +10531,11 @@ struct U64Vec3 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10053,8 +10544,11 @@ struct U64Vec3 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10063,336 +10557,331 @@ struct U64Vec3 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the squared length of `self`. - #[lua(kind = "Method")] - fn length_squared(self) -> u64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> u64; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec4(&self) -> bevy::math::Vec4; + #[lua()] + fn as_vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; + #[lua()] + fn as_dvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec4(&self) -> bevy::math::IVec4; + #[lua()] + fn as_ivec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec4(&self) -> bevy::math::UVec4; + #[lua()] + fn as_uvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec4(&self) -> bevy::math::I64Vec4; + #[lua()] + fn as_i64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn wrapping_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn wrapping_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn wrapping_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn wrapping_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn saturating_add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn saturating_sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn saturating_mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::U64Vec4) -> bevy::math::U64Vec4; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn wrapping_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec4, - ) -> bevy::math::U64Vec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn saturating_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec4, - ) -> bevy::math::U64Vec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u64) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u64) -> bevy::math::U64Vec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct U64Vec4 { +pub struct U64Vec4 { x: u64, y: u64, z: u64, w: u64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Vec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::Vec2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: &glam::Vec2) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32) -> bevy::math::Vec2; + #[lua()] + fn new(x: f32, y: f32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec2; + #[lua()] + fn splat(v: f32) -> LuaReflectValProxy; "#, r#" @@ -10401,80 +10890,98 @@ struct U64Vec4 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec2, - #[proxy] - if_true: bevy::math::Vec2, - #[proxy] - if_false: bevy::math::Vec2, - ) -> bevy::math::Vec2; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 2]) -> bevy::math::Vec2; + #[lua()] + fn from_array(a: [f32; 2]) -> LuaReflectValProxy; "#, r#" /// `[x, y]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 2]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f32; 2]; "#, r#" /// Creates a 3D vector from `self` and the given `z` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: f32) -> bevy::math::Vec3; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + z: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec2; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec2; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10483,46 +10990,44 @@ struct U64Vec4 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::Vec2, - #[proxy] - max: bevy::math::Vec2, - ) -> bevy::math::Vec2; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -10531,8 +11036,11 @@ struct U64Vec4 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10541,8 +11049,11 @@ struct U64Vec4 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10551,8 +11062,11 @@ struct U64Vec4 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10561,8 +11075,11 @@ struct U64Vec4 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10571,8 +11088,11 @@ struct U64Vec4 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10581,15 +11101,20 @@ struct U64Vec4 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec2; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10598,15 +11123,20 @@ struct U64Vec4 { /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec2; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10614,91 +11144,107 @@ struct U64Vec4 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec2; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f32; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10708,8 +11254,10 @@ struct U64Vec4 { /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10719,8 +11267,11 @@ struct U64Vec4 { /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10729,16 +11280,18 @@ struct U64Vec4 { /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec2; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -10747,8 +11300,11 @@ struct U64Vec4 { /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10759,8 +11315,11 @@ struct U64Vec4 { /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10769,8 +11328,11 @@ struct U64Vec4 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn project_onto_normalized( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10781,40 +11343,51 @@ struct U64Vec4 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn reject_from_normalized( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec2; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec2; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec2; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec2; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10823,8 +11396,10 @@ struct U64Vec4 { /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec2; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10833,30 +11408,39 @@ struct U64Vec4 { /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec2; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec2; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec2; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f32, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec2; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10865,8 +11449,12 @@ struct U64Vec4 { /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec2, s: f32) -> bevy::math::Vec2; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -10874,8 +11462,12 @@ struct U64Vec4 { /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec2, d: f32) -> bevy::math::Vec2; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -10884,8 +11476,11 @@ struct U64Vec4 { /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10897,8 +11492,12 @@ struct U64Vec4 { /// 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::Vec2, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" @@ -10906,8 +11505,12 @@ struct U64Vec4 { /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f32, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -10915,8 +11518,11 @@ struct U64Vec4 { /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -10924,8 +11530,11 @@ struct U64Vec4 { /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -10936,14 +11545,12 @@ struct U64Vec4 { /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::Vec2, - #[proxy] - b: bevy::math::Vec2, - ) -> bevy::math::Vec2; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10953,8 +11560,11 @@ struct U64Vec4 { /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -10965,8 +11575,12 @@ struct U64Vec4 { /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -10975,45 +11589,56 @@ struct U64Vec4 { /// `Vec2::from_angle(PI).rotate(Vec2::Y)` will create the vector `[-1, 0]` /// and rotate [`Vec2::Y`] around it returning `-Vec2::Y`. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Vec2; + #[lua()] + fn from_angle(angle: f32) -> LuaReflectValProxy; "#, r#" /// Returns the angle (in radians) of this vector in the range `[-π, +π]`. /// The input does not need to be a unit vector however it must be non-zero. - #[lua(kind = "Method")] - fn to_angle(self) -> f32; + #[lua()] + fn to_angle(_self: LuaReflectValProxy) -> f32; "#, r#" - #[lua(kind = "Method")] - fn angle_between(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> 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; + #[lua()] + fn angle_to( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns a vector that is equal to `self` rotated by 90 degrees. - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::Vec2; + #[lua()] + fn perp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The perpendicular dot product of `self` and `rhs`. /// Also known as the wedge product, 2D cross product, and determinant. - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::Vec2) -> f32; + #[lua()] + fn perp_dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" @@ -11021,8 +11646,11 @@ struct U64Vec4 { /// then this just rotation. This is what you usually want. Otherwise, /// it will be like a rotation with a multiplication by `self`'s length. - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn rotate( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11031,384 +11659,320 @@ struct U64Vec4 { /// `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))] + #[lua()] fn rotate_towards( - &self, - #[proxy] - rhs: bevy::math::Vec2, + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, max_angle: f32, - ) -> bevy::math::Vec2; + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec2(&self) -> bevy::math::DVec2; + #[lua()] + fn as_dvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; + #[lua()] + fn as_ivec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; + #[lua()] + fn as_uvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; + #[lua()] + fn as_i64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; + #[lua()] + fn as_u64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f32) -> () { + _self[idx - 1] = val } "#] )] -struct Vec2 { +pub struct Vec2 { x: f32, y: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Vec3A", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec3A; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3A>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3A>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3A>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3A>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Vec3A) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec3A; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32, z: f32) -> bevy::math::Vec3A; + #[lua()] + fn new(x: f32, y: f32, z: f32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec3A; + #[lua()] + fn splat(v: f32) -> LuaReflectValProxy; "#, r#" @@ -11417,110 +11981,138 @@ struct Vec2 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3A, - #[proxy] - if_true: bevy::math::Vec3A, - #[proxy] - if_false: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 3]) -> bevy::math::Vec3A; + #[lua()] + fn from_array(a: [f32; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [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; + #[lua()] + fn from_vec4( + v: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: f32) -> bevy::math::Vec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::Vec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec3A; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec3A; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f32) -> bevy::math::Vec3A; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: f32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11529,46 +12121,44 @@ struct Vec2 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::Vec3A, - #[proxy] - max: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -11577,8 +12167,11 @@ struct Vec2 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11587,8 +12180,11 @@ struct Vec2 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11597,8 +12193,11 @@ struct Vec2 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11607,8 +12206,11 @@ struct Vec2 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11617,8 +12219,11 @@ struct Vec2 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11627,15 +12232,20 @@ struct Vec2 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec3A; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11644,15 +12254,20 @@ struct Vec2 { /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec3A; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11660,91 +12275,107 @@ struct Vec2 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec3A; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f32; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11754,8 +12385,10 @@ struct Vec2 { /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11765,8 +12398,11 @@ struct Vec2 { /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11775,16 +12411,18 @@ struct Vec2 { /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec3A; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -11793,8 +12431,11 @@ struct Vec2 { /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11805,8 +12446,11 @@ struct Vec2 { /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11815,12 +12459,11 @@ struct Vec2 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11831,44 +12474,51 @@ struct Vec2 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec3A; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec3A; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec3A; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec3A; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11877,8 +12527,10 @@ struct Vec2 { /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec3A; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11887,30 +12539,39 @@ struct Vec2 { /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec3A; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec3A; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec3A; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f32, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec3A; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11919,8 +12580,12 @@ struct Vec2 { /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec3A, s: f32) -> bevy::math::Vec3A; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -11928,8 +12593,12 @@ struct Vec2 { /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec3A, d: f32) -> bevy::math::Vec3A; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -11938,8 +12607,11 @@ struct Vec2 { /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -11951,8 +12623,12 @@ struct Vec2 { /// 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::Vec3A, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" @@ -11960,8 +12636,12 @@ struct Vec2 { /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f32, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -11969,8 +12649,11 @@ struct Vec2 { /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -11978,8 +12661,11 @@ struct Vec2 { /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -11990,14 +12676,12 @@ struct Vec2 { /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::Vec3A, - #[proxy] - b: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12007,8 +12691,11 @@ struct Vec2 { /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12019,16 +12706,23 @@ struct Vec2 { /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" @@ -12037,8 +12731,10 @@ struct Vec2 { /// 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()] + fn any_orthogonal_vector( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12047,246 +12743,218 @@ struct Vec2 { /// # 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()] + fn any_orthonormal_vector( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; + #[lua()] + fn as_dvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua()] + fn as_ivec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua()] + fn as_uvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua()] + fn as_i64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua()] + fn as_u64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f32) -> () { + _self[idx - 1] = val } "#] )] -struct Vec3A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Vec3A(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Vec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Vec4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[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(as_trait = "std::ops::Mul::<&bevy::math::Vec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f32) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32, z: f32, w: f32) -> bevy::math::Vec4; + #[lua()] + fn new(x: f32, y: f32, z: f32, w: f32) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec4; + #[lua()] + fn splat(v: f32) -> LuaReflectValProxy; "#, r#" @@ -12295,29 +12963,26 @@ struct Vec3A(); /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec4A, - #[proxy] - if_true: bevy::math::Vec4, - #[proxy] - if_false: bevy::math::Vec4, - ) -> bevy::math::Vec4; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 4]) -> bevy::math::Vec4; + #[lua()] + fn from_array(a: [f32; 4]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f32; 4]; "#, r#" @@ -12325,66 +12990,92 @@ struct Vec3A(); /// Truncation to [`Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. /// To truncate to [`Vec3A`] use [`Vec3A::from()`]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::Vec3; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec4; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec4; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f32) -> bevy::math::Vec4; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `w`. - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: f32) -> bevy::math::Vec4; + #[lua()] + fn with_w( + _self: LuaReflectValProxy, + w: f32, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec4) -> f32; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12393,46 +13084,44 @@ struct Vec3A(); /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::Vec4, - #[proxy] - max: bevy::math::Vec4, - ) -> bevy::math::Vec4; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f32; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f32; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f32; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f32; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f32; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f32; "#, r#" @@ -12441,8 +13130,11 @@ struct Vec3A(); /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12451,8 +13143,11 @@ struct Vec3A(); /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12461,8 +13156,11 @@ struct Vec3A(); /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12471,8 +13169,11 @@ struct Vec3A(); /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12481,8 +13182,11 @@ struct Vec3A(); /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12491,15 +13195,20 @@ struct Vec3A(); /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec4; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12508,15 +13217,20 @@ struct Vec3A(); /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec4; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12524,91 +13238,107 @@ struct Vec3A(); /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec4A; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f32; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f32; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f32; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f32; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec4) -> f32; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec4) -> f32; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f32; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f32::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12618,8 +13348,10 @@ struct Vec3A(); /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12629,8 +13361,11 @@ struct Vec3A(); /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12639,16 +13374,18 @@ struct Vec3A(); /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec4; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -12657,8 +13394,11 @@ struct Vec3A(); /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12669,8 +13409,11 @@ struct Vec3A(); /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12679,8 +13422,11 @@ struct Vec3A(); /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn project_onto_normalized( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12691,40 +13437,51 @@ struct Vec3A(); /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn reject_from_normalized( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec4; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec4; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec4; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec4; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12733,8 +13490,10 @@ struct Vec3A(); /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec4; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12743,30 +13502,39 @@ struct Vec3A(); /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec4; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec4; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec4; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f32, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec4; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12775,8 +13543,12 @@ struct Vec3A(); /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec4, s: f32) -> bevy::math::Vec4; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -12784,8 +13556,12 @@ struct Vec3A(); /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec4, d: f32) -> bevy::math::Vec4; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -12794,8 +13570,11 @@ struct Vec3A(); /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12807,8 +13586,12 @@ struct Vec3A(); /// 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::Vec4, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" @@ -12816,8 +13599,12 @@ struct Vec3A(); /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f32, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -12825,8 +13612,11 @@ struct Vec3A(); /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -12834,8 +13624,11 @@ struct Vec3A(); /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -12846,14 +13639,12 @@ struct Vec3A(); /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::Vec4, - #[proxy] - b: bevy::math::Vec4, - ) -> bevy::math::Vec4; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12863,8 +13654,11 @@ struct Vec3A(); /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -12875,152 +13669,153 @@ struct Vec3A(); /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f32, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f64`. - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; + #[lua()] + fn as_dvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec4(&self) -> bevy::math::IVec4; + #[lua()] + fn as_ivec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec4(&self) -> bevy::math::UVec4; + #[lua()] + fn as_uvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec4(&self) -> bevy::math::I64Vec4; + #[lua()] + fn as_i64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; + #[lua()] + fn as_u64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f32) -> () { + _self[idx - 1] = val } "#] )] -struct Vec4(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Vec4(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::BVec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" /// Creates a new vector mask. - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool) -> bevy::math::BVec2; + #[lua()] + fn new(x: bool, y: bool) -> LuaReflectValProxy; "#, r#" /// Creates a vector mask with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec2; + #[lua()] + fn splat(v: bool) -> LuaReflectValProxy; "#, r#" /// Creates a new vector mask from a bool array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 2]) -> bevy::math::BVec2; + #[lua()] + fn from_array(a: [bool; 2]) -> LuaReflectValProxy; "#, r#" @@ -13028,85 +13823,88 @@ struct Vec4(); /// 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; + #[lua()] + fn bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns true if any of the elements are true, false otherwise. - #[lua(kind = "Method")] - fn any(self) -> bool; + #[lua()] + fn any(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns true if all the elements are true, false otherwise. - #[lua(kind = "Method")] - fn all(self) -> bool; + #[lua()] + fn all(_self: LuaReflectValProxy) -> bool; "#, r#" /// Tests the value at `index`. /// Panics if `index` is greater than 1. - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; + #[lua()] + fn test(_self: LuaReflectRefProxy, index: usize) -> bool; "#, r#" /// Sets the element at `index`. /// Panics if `index` is greater than 1. - #[lua(kind = "MutatingMethod")] - fn set(&mut self, index: usize, value: bool) -> (); + #[lua()] + fn set( + _self: LuaReflectRefMutProxy, + 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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BVec2 { +pub struct BVec2 { x: bool, y: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::BVec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new vector mask. - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool) -> bevy::math::BVec3; + #[lua()] + fn new(x: bool, y: bool, z: bool) -> LuaReflectValProxy; "#, r#" /// Creates a vector mask with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec3; + #[lua()] + fn splat(v: bool) -> LuaReflectValProxy; "#, r#" /// Creates a new vector mask from a bool array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 3]) -> bevy::math::BVec3; + #[lua()] + fn from_array(a: [bool; 3]) -> LuaReflectValProxy; "#, r#" @@ -13114,119 +13912,118 @@ struct BVec2 { /// 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; + #[lua()] + fn bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns true if any of the elements are true, false otherwise. - #[lua(kind = "Method")] - fn any(self) -> bool; + #[lua()] + fn any(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns true if all the elements are true, false otherwise. - #[lua(kind = "Method")] - fn all(self) -> bool; + #[lua()] + fn all(_self: LuaReflectValProxy) -> bool; "#, r#" /// Tests the value at `index`. /// Panics if `index` is greater than 2. - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; + #[lua()] + fn test(_self: LuaReflectRefProxy, 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) -> (); + #[lua()] + fn set( + _self: LuaReflectRefMutProxy, + 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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BVec3 { +pub struct BVec3 { x: bool, y: bool, z: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::BVec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::BVec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Creates a new vector mask. - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool, w: bool) -> bevy::math::BVec4; + #[lua()] + fn new(x: bool, y: bool, z: bool, w: bool) -> LuaReflectValProxy; "#, r#" /// Creates a vector mask with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec4; + #[lua()] + fn splat(v: bool) -> LuaReflectValProxy; "#, r#" /// Creates a new vector mask from a bool array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 4]) -> bevy::math::BVec4; + #[lua()] + fn from_array(a: [bool; 4]) -> LuaReflectValProxy; "#, r#" @@ -13234,187 +14031,162 @@ struct BVec3 { /// 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; + #[lua()] + fn bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns true if any of the elements are true, false otherwise. - #[lua(kind = "Method")] - fn any(self) -> bool; + #[lua()] + fn any(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns true if all the elements are true, false otherwise. - #[lua(kind = "Method")] - fn all(self) -> bool; + #[lua()] + fn all(_self: LuaReflectValProxy) -> bool; "#, r#" /// Tests the value at `index`. /// Panics if `index` is greater than 3. - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; + #[lua()] + fn test(_self: LuaReflectRefProxy, index: usize) -> bool; "#, r#" /// Sets the element at `index`. /// Panics if `index` is greater than 3. - #[lua(kind = "MutatingMethod")] - fn set(&mut self, index: usize, value: bool) -> (); + #[lua()] + fn set( + _self: LuaReflectRefMutProxy, + index: usize, + value: bool, + ) -> (); "#, 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BVec4 { +pub struct BVec4 { x: bool, y: bool, z: bool, w: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DVec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f64) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f64, y: f64) -> bevy::math::DVec2; + #[lua()] + fn new(x: f64, y: f64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f64) -> bevy::math::DVec2; + #[lua()] + fn splat(v: f64) -> LuaReflectValProxy; "#, r#" @@ -13423,80 +14195,98 @@ struct BVec4 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec2, - #[proxy] - if_true: bevy::math::DVec2, - #[proxy] - if_false: bevy::math::DVec2, - ) -> bevy::math::DVec2; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 2]) -> bevy::math::DVec2; + #[lua()] + fn from_array(a: [f64; 2]) -> LuaReflectValProxy; "#, r#" /// `[x, y]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 2]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f64; 2]; "#, r#" /// Creates a 3D vector from `self` and the given `z` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: f64) -> bevy::math::DVec3; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + z: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f64) -> bevy::math::DVec2; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f64) -> bevy::math::DVec2; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13505,46 +14295,44 @@ struct BVec4 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::DVec2, - #[proxy] - max: bevy::math::DVec2, - ) -> bevy::math::DVec2; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f64; "#, r#" @@ -13553,8 +14341,11 @@ struct BVec4 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13563,8 +14354,11 @@ struct BVec4 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13573,8 +14367,11 @@ struct BVec4 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13583,8 +14380,11 @@ struct BVec4 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13593,8 +14393,11 @@ struct BVec4 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13603,15 +14406,20 @@ struct BVec4 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::DVec2; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13620,15 +14428,20 @@ struct BVec4 { /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::DVec2; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13636,91 +14449,107 @@ struct BVec4 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec2; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f64; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f64; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f64::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13730,8 +14559,10 @@ struct BVec4 { /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13741,8 +14572,11 @@ struct BVec4 { /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13751,16 +14585,18 @@ struct BVec4 { /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::DVec2; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -13769,8 +14605,11 @@ struct BVec4 { /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13781,8 +14620,11 @@ struct BVec4 { /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13791,12 +14633,11 @@ struct BVec4 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::DVec2, - ) -> bevy::math::DVec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13807,44 +14648,51 @@ struct BVec4 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::DVec2, - ) -> bevy::math::DVec2; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::DVec2; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::DVec2; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::DVec2; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::DVec2; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13853,8 +14701,10 @@ struct BVec4 { /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::DVec2; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13863,30 +14713,39 @@ struct BVec4 { /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::DVec2; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::DVec2; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f64) -> bevy::math::DVec2; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f64, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::DVec2; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13895,8 +14754,12 @@ struct BVec4 { /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::DVec2, s: f64) -> bevy::math::DVec2; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -13904,8 +14767,12 @@ struct BVec4 { /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::DVec2, d: f64) -> bevy::math::DVec2; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -13914,8 +14781,11 @@ struct BVec4 { /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13927,8 +14797,12 @@ struct BVec4 { /// 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::DVec2, max_abs_diff: f64) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f64, + ) -> bool; "#, r#" @@ -13936,8 +14810,12 @@ struct BVec4 { /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f64, + max: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -13945,8 +14823,11 @@ struct BVec4 { /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -13954,8 +14835,11 @@ struct BVec4 { /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -13966,14 +14850,12 @@ struct BVec4 { /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::DVec2, - #[proxy] - b: bevy::math::DVec2, - ) -> bevy::math::DVec2; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13983,8 +14865,11 @@ struct BVec4 { /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -13995,8 +14880,12 @@ struct BVec4 { /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -14005,45 +14894,56 @@ struct BVec4 { /// `DVec2::from_angle(PI).rotate(DVec2::Y)` will create the vector `[-1, 0]` /// and rotate [`DVec2::Y`] around it returning `-DVec2::Y`. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DVec2; + #[lua()] + fn from_angle(angle: f64) -> LuaReflectValProxy; "#, r#" /// Returns the angle (in radians) of this vector in the range `[-π, +π]`. /// The input does not need to be a unit vector however it must be non-zero. - #[lua(kind = "Method")] - fn to_angle(self) -> f64; + #[lua()] + fn to_angle(_self: LuaReflectValProxy) -> f64; "#, r#" - #[lua(kind = "Method")] - fn angle_between(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> 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; + #[lua()] + fn angle_to( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns a vector that is equal to `self` rotated by 90 degrees. - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::DVec2; + #[lua()] + fn perp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The perpendicular dot product of `self` and `rhs`. /// Also known as the wedge product, 2D cross product, and determinant. - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::DVec2) -> f64; + #[lua()] + fn perp_dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" @@ -14051,8 +14951,11 @@ struct BVec4 { /// then this just rotation. This is what you usually want. Otherwise, /// it will be like a rotation with a multiplication by `self`'s length. - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn rotate( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14061,347 +14964,294 @@ struct BVec4 { /// `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))] + #[lua()] fn rotate_towards( - &self, - #[proxy] - rhs: bevy::math::DVec2, + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, max_angle: f64, - ) -> bevy::math::DVec2; + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; + #[lua()] + fn as_vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec2(&self) -> bevy::math::IVec2; + #[lua()] + fn as_ivec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec2(&self) -> bevy::math::UVec2; + #[lua()] + fn as_uvec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; + #[lua()] + fn as_i64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; + #[lua()] + fn as_u64vec2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f64) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DVec2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec2; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f64) -> () { + _self[idx - 1] = val } "#] )] -struct DVec2 { +pub struct DVec2 { x: f64, y: f64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DVec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::DVec3) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DVec3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f64) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f64) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f64, y: f64, z: f64) -> bevy::math::DVec3; + #[lua()] + fn new(x: f64, y: f64, z: f64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f64) -> bevy::math::DVec3; + #[lua()] + fn splat(v: f64) -> LuaReflectValProxy; "#, r#" @@ -14410,102 +15260,128 @@ struct DVec2 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec3, - #[proxy] - if_true: bevy::math::DVec3, - #[proxy] - if_false: bevy::math::DVec3, - ) -> bevy::math::DVec3; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 3]) -> bevy::math::DVec3; + #[lua()] + fn from_array(a: [f64; 3]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 3]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f64; 3]; "#, r#" /// Creates a 4D vector from `self` and the given `w` value. - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: f64) -> bevy::math::DVec4; + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. /// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::DVec2; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f64) -> bevy::math::DVec3; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f64) -> bevy::math::DVec3; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f64) -> bevy::math::DVec3; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: f64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the cross product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn cross( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14514,46 +15390,44 @@ struct DVec2 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::DVec3, - #[proxy] - max: bevy::math::DVec3, - ) -> bevy::math::DVec3; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f64; "#, r#" @@ -14562,8 +15436,11 @@ struct DVec2 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14572,8 +15449,11 @@ struct DVec2 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14582,8 +15462,11 @@ struct DVec2 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14592,8 +15475,11 @@ struct DVec2 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14602,8 +15488,11 @@ struct DVec2 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14612,15 +15501,20 @@ struct DVec2 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::DVec3; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14629,15 +15523,20 @@ struct DVec2 { /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::DVec3; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14645,91 +15544,107 @@ struct DVec2 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec3; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f64; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f64; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::DVec3) -> f64; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f64::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14739,8 +15654,10 @@ struct DVec2 { /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14750,8 +15667,11 @@ struct DVec2 { /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14760,16 +15680,18 @@ struct DVec2 { /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::DVec3; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -14778,8 +15700,11 @@ struct DVec2 { /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14790,8 +15715,11 @@ struct DVec2 { /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14800,12 +15728,11 @@ struct DVec2 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::DVec3, - ) -> bevy::math::DVec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14816,44 +15743,51 @@ struct DVec2 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::DVec3, - ) -> bevy::math::DVec3; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::DVec3; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::DVec3; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::DVec3; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::DVec3; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14862,8 +15796,10 @@ struct DVec2 { /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::DVec3; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14872,30 +15808,39 @@ struct DVec2 { /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::DVec3; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::DVec3; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f64) -> bevy::math::DVec3; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f64, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::DVec3; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14904,8 +15849,12 @@ struct DVec2 { /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::DVec3, s: f64) -> bevy::math::DVec3; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -14913,8 +15862,12 @@ struct DVec2 { /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::DVec3, d: f64) -> bevy::math::DVec3; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -14923,8 +15876,11 @@ struct DVec2 { /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14936,8 +15892,12 @@ struct DVec2 { /// 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::DVec3, max_abs_diff: f64) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f64, + ) -> bool; "#, r#" @@ -14945,8 +15905,12 @@ struct DVec2 { /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f64, + max: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -14954,8 +15918,11 @@ struct DVec2 { /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -14963,8 +15930,11 @@ struct DVec2 { /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -14975,14 +15945,12 @@ struct DVec2 { /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::DVec3, - #[proxy] - b: bevy::math::DVec3, - ) -> bevy::math::DVec3; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14992,8 +15960,11 @@ struct DVec2 { /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15004,16 +15975,23 @@ struct DVec2 { /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f64, + ) -> LuaReflectValProxy; "#, 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::DVec3) -> f64; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" @@ -15022,8 +16000,10 @@ struct DVec2 { /// 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::DVec3; + #[lua()] + fn any_orthogonal_vector( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15032,329 +16012,285 @@ struct DVec2 { /// # 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::DVec3; + #[lua()] + fn any_orthonormal_vector( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; + #[lua()] + fn as_vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; + #[lua()] + fn as_vec3a( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec3(&self) -> bevy::math::IVec3; + #[lua()] + fn as_ivec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec3(&self) -> bevy::math::UVec3; + #[lua()] + fn as_uvec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec3(&self) -> bevy::math::I64Vec3; + #[lua()] + fn as_i64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; + #[lua()] + fn as_u64vec3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f64) -> () { + _self[idx - 1] = val } "#] )] -struct DVec3 { +pub struct DVec3 { x: f64, y: f64, z: f64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DVec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DVec4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f64) -> bevy::math::DVec4; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: f64) -> bevy::math::DVec4; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DVec4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DVec4; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::DVec4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector. - #[lua(kind = "Function", output(proxy))] - fn new(x: f64, y: f64, z: f64, w: f64) -> bevy::math::DVec4; + #[lua()] + fn new(x: f64, y: f64, z: f64, w: f64) -> LuaReflectValProxy; "#, r#" /// Creates a vector with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: f64) -> bevy::math::DVec4; + #[lua()] + fn splat(v: f64) -> LuaReflectValProxy; "#, r#" @@ -15363,95 +16299,118 @@ struct DVec3 { /// 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()] fn select( - #[proxy] - mask: bevy::math::BVec4, - #[proxy] - if_true: bevy::math::DVec4, - #[proxy] - if_false: bevy::math::DVec4, - ) -> bevy::math::DVec4; + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector from an array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 4]) -> bevy::math::DVec4; + #[lua()] + fn from_array(a: [f64; 4]) -> LuaReflectValProxy; "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f64; 4]; "#, r#" /// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. /// Truncation to [`DVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::DVec3; + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `x`. - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f64) -> bevy::math::DVec4; + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `y`. - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f64) -> bevy::math::DVec4; + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `z`. - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f64) -> bevy::math::DVec4; + #[lua()] + fn with_z( + _self: LuaReflectValProxy, + z: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4D vector from `self` with the given value of `w`. - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: f64) -> bevy::math::DVec4; + #[lua()] + fn with_w( + _self: LuaReflectValProxy, + w: f64, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DVec4) -> f64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn dot_into_vec( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the minimum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn min( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the maximum values for each element of `self` and `rhs`. /// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn max( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15460,46 +16419,44 @@ struct DVec3 { /// # Panics /// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn clamp( - self, - #[proxy] - min: bevy::math::DVec4, - #[proxy] - max: bevy::math::DVec4, - ) -> bevy::math::DVec4; + _self: LuaReflectValProxy, + min: LuaReflectValProxy, + max: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the horizontal minimum of `self`. /// In other words this computes `min(x, y, ..)`. - #[lua(kind = "Method")] - fn min_element(self) -> f64; + #[lua()] + fn min_element(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the horizontal maximum of `self`. /// In other words this computes `max(x, y, ..)`. - #[lua(kind = "Method")] - fn max_element(self) -> f64; + #[lua()] + fn max_element(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the sum of all elements of `self`. /// In other words, this computes `self.x + self.y + ..`. - #[lua(kind = "Method")] - fn element_sum(self) -> f64; + #[lua()] + fn element_sum(_self: LuaReflectValProxy) -> f64; "#, r#" /// Returns the product of all elements of `self`. /// In other words, this computes `self.x * self.y * ..`. - #[lua(kind = "Method")] - fn element_product(self) -> f64; + #[lua()] + fn element_product(_self: LuaReflectValProxy) -> f64; "#, r#" @@ -15508,8 +16465,11 @@ struct DVec3 { /// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpeq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15518,8 +16478,11 @@ struct DVec3 { /// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpne( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15528,8 +16491,11 @@ struct DVec3 { /// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpge( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15538,8 +16504,11 @@ struct DVec3 { /// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + #[lua()] + fn cmpgt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15548,8 +16517,11 @@ struct DVec3 { /// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + #[lua()] + fn cmple( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15558,15 +16530,20 @@ struct DVec3 { /// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all /// elements. - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; + #[lua()] + fn cmplt( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the absolute value of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::DVec4; + #[lua()] + fn abs( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15575,15 +16552,20 @@ struct DVec3 { /// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` /// - `NAN` if the number is `NAN` - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::DVec4; + #[lua()] + fn signum( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector with signs of `rhs` and the magnitudes of `self`. - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn copysign( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15591,91 +16573,107 @@ struct DVec3 { /// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes /// into the first lowest bit, element `y` into the second, etc. - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; + #[lua()] + fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns `true` if, and only if, all elements are finite. If any element is either /// `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> 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; + #[lua()] + fn is_finite_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, 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(), ...]`. - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec4; + #[lua()] + fn is_nan_mask( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f64; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes the squared length of `self`. /// This is faster than `length()` as it avoids a square root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f64; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes the Euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::DVec4) -> f64; + #[lua()] + fn distance( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Compute the squared euclidean distance between two points in space. - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::DVec4) -> f64; + #[lua()] + fn distance_squared( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn div_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. /// [Euclidean division]: f64::rem_euclid - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn rem_euclid( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15685,8 +16683,10 @@ struct DVec3 { /// Panics /// 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; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15696,8 +16696,11 @@ struct DVec3 { /// the result of this operation will be the fallback value. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn normalize_or( + _self: LuaReflectValProxy, + fallback: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15706,16 +16709,18 @@ struct DVec3 { /// the result of this operation will be zero. /// See also [`Self::try_normalize()`]. - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::DVec4; + #[lua()] + fn normalize_or_zero( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns whether `self` is length `1.0` or not. /// Uses a precision threshold of approximately `1e-4`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -15724,8 +16729,11 @@ struct DVec3 { /// # Panics /// Will panic if `rhs` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn project_onto( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15736,8 +16744,11 @@ struct DVec3 { /// # Panics /// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn reject_from( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15746,12 +16757,11 @@ struct DVec3 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::DVec4, - ) -> bevy::math::DVec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15762,44 +16772,51 @@ struct DVec3 { /// # Panics /// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::DVec4, - ) -> bevy::math::DVec4; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the nearest integer to a number for each element of `self`. /// Round half-way cases away from 0.0. - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::DVec4; + #[lua()] + fn round( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the largest integer less than or equal to a number for each /// element of `self`. - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::DVec4; + #[lua()] + fn floor( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the smallest integer greater than or equal to a number for /// each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::DVec4; + #[lua()] + fn ceil( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the integer part each element of `self`. This means numbers are /// always truncated towards zero. - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::DVec4; + #[lua()] + fn trunc( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15808,8 +16825,10 @@ struct DVec3 { /// `self - self.floor()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::DVec4; + #[lua()] + fn fract( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15818,30 +16837,39 @@ struct DVec3 { /// `self - self.trunc()`. /// Note that this is fast but not precise for large numbers. - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::DVec4; + #[lua()] + fn fract_gl( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing `e^self` (the exponential function) for each element of /// `self`. - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::DVec4; + #[lua()] + fn exp( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing each element of `self` raised to the power of `n`. - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f64) -> bevy::math::DVec4; + #[lua()] + fn powf( + _self: LuaReflectValProxy, + n: f64, + ) -> LuaReflectValProxy; "#, r#" /// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::DVec4; + #[lua()] + fn recip( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15850,8 +16878,12 @@ struct DVec3 { /// will be equal to `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly /// extrapolated. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::DVec4, s: f64) -> bevy::math::DVec4; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + s: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -15859,8 +16891,12 @@ struct DVec3 { /// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to /// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::DVec4, d: f64) -> bevy::math::DVec4; + #[lua()] + fn move_towards( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + d: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -15869,8 +16905,11 @@ struct DVec3 { /// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` /// while being slightly cheaper to compute. - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn midpoint( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15882,8 +16921,12 @@ struct DVec3 { /// 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::DVec4, max_abs_diff: f64) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f64, + ) -> bool; "#, r#" @@ -15891,8 +16934,12 @@ struct DVec3 { /// # Panics /// 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; + #[lua()] + fn clamp_length( + _self: LuaReflectValProxy, + min: f64, + max: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -15900,8 +16947,11 @@ struct DVec3 { /// # 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; + #[lua()] + fn clamp_length_max( + _self: LuaReflectValProxy, + max: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -15909,8 +16959,11 @@ struct DVec3 { /// # 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; + #[lua()] + fn clamp_length_min( + _self: LuaReflectValProxy, + min: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -15921,14 +16974,12 @@ struct DVec3 { /// and will be heavily dependant on designing algorithms with specific target hardware in /// mind. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_add( - self, - #[proxy] - a: bevy::math::DVec4, - #[proxy] - b: bevy::math::DVec4, - ) -> bevy::math::DVec4; + _self: LuaReflectValProxy, + a: LuaReflectValProxy, + b: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15938,8 +16989,11 @@ struct DVec3 { /// # 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; + #[lua()] + fn reflect( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15950,181 +17004,184 @@ struct DVec3 { /// # 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; + #[lua()] + fn refract( + _self: LuaReflectValProxy, + normal: LuaReflectValProxy, + eta: f64, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `f32`. - #[lua(kind = "Method", output(proxy))] - fn as_vec4(&self) -> bevy::math::Vec4; + #[lua()] + fn as_vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i32`. - #[lua(kind = "Method", output(proxy))] - fn as_ivec4(&self) -> bevy::math::IVec4; + #[lua()] + fn as_ivec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u32`. - #[lua(kind = "Method", output(proxy))] - fn as_uvec4(&self) -> bevy::math::UVec4; + #[lua()] + fn as_uvec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `i64`. - #[lua(kind = "Method", output(proxy))] - fn as_i64vec4(&self) -> bevy::math::I64Vec4; + #[lua()] + fn as_i64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Casts all elements of `self` to `u64`. - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; + #[lua()] + fn as_u64vec4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f64) -> bevy::math::DVec4; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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]) +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] } "#, 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))? +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f64) -> () { + _self[idx - 1] = val } "#] )] -struct DVec4 { +pub struct DVec4 { x: f64, y: f64, z: f64, w: f64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Mat2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix from two column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::Vec2, - #[proxy] - y_axis: bevy::math::Vec2, - ) -> bevy::math::Mat2; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [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]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[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; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle( - #[proxy] - scale: bevy::math::Vec2, + scale: LuaReflectValProxy, angle: f32, - ) -> bevy::math::Mat2; + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Mat2; + #[lua()] + fn from_angle(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Mat2; + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16133,20 +17190,21 @@ struct DVec4 { /// # Panics /// Panics if `i` or `j` is greater than 2. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat3_minor( - #[proxy] - m: bevy::math::Mat3, + m: LuaReflectValProxy, i: usize, j: usize, - ) -> bevy::math::Mat2; + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - #[lua(kind = "Function", output(proxy))] - fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Mat2; + #[lua()] + fn from_mat3a( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16155,13 +17213,12 @@ struct DVec4 { /// # Panics /// Panics if `i` or `j` is greater than 2. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat3a_minor( - #[proxy] - m: bevy::math::Mat3A, + m: LuaReflectValProxy, i: usize, j: usize, - ) -> bevy::math::Mat2; + ) -> LuaReflectValProxy; "#, r#" @@ -16169,8 +17226,11 @@ struct DVec4 { /// # Panics /// Panics if `index` is greater than 1. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec2; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -16178,37 +17238,42 @@ struct DVec4 { /// # Panics /// Panics if `index` is greater than 1. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec2; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat2; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f32; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -16217,50 +17282,70 @@ struct DVec4 { /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat2; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 2D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn mul_vec2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 2x2 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; + #[lua()] + fn mul_mat2( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 2x2 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; + #[lua()] + fn add_mat2( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 2x2 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; + #[lua()] + fn sub_mat2( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 2x2 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat2; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 2x2 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat2; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -16272,242 +17357,211 @@ struct DVec4 { /// 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::Mat2, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" /// Takes the absolute value of each element in `self` - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat2; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_dmat2(&self) -> bevy::math::DMat2; + #[lua()] + fn as_dmat2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Mat2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec2::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaVec2(curr_ref) } "#] )] -struct Mat2(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Mat2(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Mat3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat3; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3x3 matrix from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::Vec3, - #[proxy] - y_axis: bevy::math::Vec3, - #[proxy] - z_axis: bevy::math::Vec3, - ) -> bevy::math::Mat3; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f32; 9]` 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; 9]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 9]; "#, r#" /// Creates a `[[f32; 3]; 3]` 3D 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; 3]; 3]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 3]; 3]; "#, r#" /// Creates a 3x3 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::Vec3) -> bevy::math::Mat3; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Mat3; + #[lua()] + fn from_mat4( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16516,13 +17570,12 @@ struct Mat2(); /// # Panics /// Panics if `i` or `j` is greater than 3. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat4_minor( - #[proxy] - m: bevy::math::Mat4, + m: LuaReflectValProxy, i: usize, j: usize, - ) -> bevy::math::Mat3; + ) -> LuaReflectValProxy; "#, r#" @@ -16530,8 +17583,10 @@ struct Mat2(); /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat3; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16540,22 +17595,24 @@ struct Mat2(); /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat3; + #[lua()] + fn from_axis_angle( + axis: LuaReflectValProxy, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in /// radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - order: bevy::math::EulerRot, + order: LuaReflectValProxy, a: f32, b: f32, c: f32, - ) -> bevy::math::Mat3; + ) -> LuaReflectValProxy; "#, r#" @@ -16565,29 +17622,32 @@ struct Mat2(); /// # 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); + #[lua()] + fn to_euler( + _self: LuaReflectRefProxy, + order: LuaReflectValProxy, + ) -> (f32, f32, f32); "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Mat3; + #[lua()] + fn from_rotation_x(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Mat3; + #[lua()] + fn from_rotation_y(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Mat3; + #[lua()] + fn from_rotation_z(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -16595,8 +17655,10 @@ struct Mat2(); /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Mat3; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16605,8 +17667,8 @@ struct Mat2(); /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Mat3; + #[lua()] + fn from_angle(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -16615,14 +17677,12 @@ struct Mat2(); /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::Vec2, + scale: LuaReflectValProxy, angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Mat3; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16632,8 +17692,10 @@ struct Mat2(); /// # Panics /// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Mat3; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16641,8 +17703,10 @@ struct Mat2(); /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] m: bevy::math::Mat2) -> bevy::math::Mat3; + #[lua()] + fn from_mat2( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16650,8 +17714,11 @@ struct Mat2(); /// # Panics /// Panics if `index` is greater than 2. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec3; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -16659,37 +17726,42 @@ struct Mat2(); /// # Panics /// Panics if `index` is greater than 2. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec3; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat3; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f32; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -16698,8 +17770,10 @@ struct Mat2(); /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat3; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16709,8 +17783,11 @@ struct Mat2(); /// # Panics /// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn transform_point2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16720,57 +17797,81 @@ struct Mat2(); /// # Panics /// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn transform_vector2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 3D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn mul_vec3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a [`Vec3A`]. - #[lua(kind = "Method", output(proxy))] - fn mul_vec3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn mul_vec3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; + #[lua()] + fn mul_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; + #[lua()] + fn add_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; + #[lua()] + fn sub_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 3x3 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat3; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 3x3 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat3; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -16782,189 +17883,171 @@ struct Mat2(); /// 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::Mat3, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" /// Takes the absolute value of each element in `self` - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat3; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_dmat3(&self) -> bevy::math::DMat3; + #[lua()] + fn as_dmat3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Mat3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::Mat3) -> bevy::math::Mat3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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::Mat3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec3::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaVec3(curr_ref) } "#] )] -struct Mat3 { - #[lua(output(proxy))] +pub struct Mat3 { x_axis: bevy::math::Vec3, - #[lua(output(proxy))] y_axis: bevy::math::Vec3, - #[lua(output(proxy))] z_axis: bevy::math::Vec3, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Mat3A", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a 3x3 matrix from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::Vec3A, - #[proxy] - y_axis: bevy::math::Vec3A, - #[proxy] - z_axis: bevy::math::Vec3A, - ) -> bevy::math::Mat3A; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f32; 9]` 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; 9]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 9]; "#, r#" /// Creates a `[[f32; 3]; 3]` 3D 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; 3]; 3]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 3]; 3]; "#, r#" /// Creates a 3x3 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::Vec3) -> bevy::math::Mat3A; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Mat3A; + #[lua()] + fn from_mat4( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16973,13 +18056,12 @@ struct Mat3 { /// # Panics /// Panics if `i` or `j` is greater than 3. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat4_minor( - #[proxy] - m: bevy::math::Mat4, + m: LuaReflectValProxy, i: usize, j: usize, - ) -> bevy::math::Mat3A; + ) -> LuaReflectValProxy; "#, r#" @@ -16987,8 +18069,10 @@ struct Mat3 { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat3A; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -16997,22 +18081,24 @@ struct Mat3 { /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat3A; + #[lua()] + fn from_axis_angle( + axis: LuaReflectValProxy, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in /// radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - order: bevy::math::EulerRot, + order: LuaReflectValProxy, a: f32, b: f32, c: f32, - ) -> bevy::math::Mat3A; + ) -> LuaReflectValProxy; "#, r#" @@ -17022,29 +18108,32 @@ struct Mat3 { /// # 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); + #[lua()] + fn to_euler( + _self: LuaReflectRefProxy, + order: LuaReflectValProxy, + ) -> (f32, f32, f32); "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Mat3A; + #[lua()] + fn from_rotation_x(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Mat3A; + #[lua()] + fn from_rotation_y(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Mat3A; + #[lua()] + fn from_rotation_z(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -17052,8 +18141,10 @@ struct Mat3 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Mat3A; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17062,8 +18153,8 @@ struct Mat3 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Mat3A; + #[lua()] + fn from_angle(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -17072,14 +18163,12 @@ struct Mat3 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::Vec2, + scale: LuaReflectValProxy, angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Mat3A; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17089,8 +18178,10 @@ struct Mat3 { /// # Panics /// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Mat3A; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17098,8 +18189,10 @@ struct Mat3 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] m: bevy::math::Mat2) -> bevy::math::Mat3A; + #[lua()] + fn from_mat2( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17107,8 +18200,11 @@ struct Mat3 { /// # Panics /// Panics if `index` is greater than 2. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec3A; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -17116,37 +18212,42 @@ struct Mat3 { /// # Panics /// Panics if `index` is greater than 2. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec3A; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat3A; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f32; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -17155,8 +18256,10 @@ struct Mat3 { /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat3A; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17166,8 +18269,11 @@ struct Mat3 { /// # Panics /// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn transform_point2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17177,57 +18283,81 @@ struct Mat3 { /// # Panics /// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn transform_vector2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 3D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn mul_vec3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a [`Vec3A`]. - #[lua(kind = "Method", output(proxy))] - fn mul_vec3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn mul_vec3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; + #[lua()] + fn mul_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; + #[lua()] + fn add_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; + #[lua()] + fn sub_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 3x3 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat3A; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 3x3 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat3A; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -17239,256 +18369,216 @@ struct Mat3 { /// 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::Mat3A, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" /// Takes the absolute value of each element in `self` - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat3A; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_dmat3(&self) -> bevy::math::DMat3; + #[lua()] + fn as_dmat3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat3A; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat3A) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat3A; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Mat3A; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat3A; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec3A::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaVec3A(curr_ref) } "#] )] -struct Mat3A { - #[lua(output(proxy))] +pub struct Mat3A { x_axis: bevy::math::Vec3A, - #[lua(output(proxy))] y_axis: bevy::math::Vec3A, - #[lua(output(proxy))] z_axis: bevy::math::Vec3A, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Mat4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> bevy::math::Mat4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4x4 matrix from four column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::Vec4, - #[proxy] - y_axis: bevy::math::Vec4, - #[proxy] - z_axis: bevy::math::Vec4, - #[proxy] - w_axis: bevy::math::Vec4, - ) -> bevy::math::Mat4; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + w_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f32; 16]` 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; 16]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 16]; "#, r#" /// Creates a `[[f32; 4]; 4]` 4D 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; 4]; 4]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 4]; 4]; "#, r#" /// Creates a 4x4 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::Vec4) -> bevy::math::Mat4; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17499,15 +18589,12 @@ struct Mat3A { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Mat4; + scale: LuaReflectValProxy, + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17517,13 +18604,11 @@ struct Mat3A { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_translation( - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Mat4; + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17533,8 +18618,10 @@ struct Mat3A { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat4; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17543,8 +18630,10 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Mat4; + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17553,8 +18642,10 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Mat4; + #[lua()] + fn from_mat3a( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17562,8 +18653,10 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec3) -> bevy::math::Mat4; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17574,8 +18667,11 @@ struct Mat3A { /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat4; + #[lua()] + fn from_axis_angle( + axis: LuaReflectValProxy, + angle: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -17584,14 +18680,13 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - order: bevy::math::EulerRot, + order: LuaReflectValProxy, a: f32, b: f32, c: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17602,8 +18697,11 @@ struct Mat3A { /// 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); + #[lua()] + fn to_euler( + _self: LuaReflectRefProxy, + order: LuaReflectValProxy, + ) -> (f32, f32, f32); "#, r#" @@ -17612,8 +18710,8 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Mat4; + #[lua()] + fn from_rotation_x(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -17622,8 +18720,8 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Mat4; + #[lua()] + fn from_rotation_y(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -17632,8 +18730,8 @@ struct Mat3A { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Mat4; + #[lua()] + fn from_rotation_z(angle: f32) -> LuaReflectValProxy; "#, r#" @@ -17643,8 +18741,10 @@ struct Mat3A { /// # Panics /// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec3) -> bevy::math::Mat4; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17652,8 +18752,11 @@ struct Mat3A { /// # Panics /// Panics if `index` is greater than 3. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec4; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -17661,37 +18764,42 @@ struct Mat3A { /// # Panics /// Panics if `index` is greater than 3. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec4; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat4; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f32; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -17700,8 +18808,10 @@ struct Mat3A { /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat4; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17709,15 +18819,12 @@ struct Mat3A { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17725,15 +18832,12 @@ struct Mat3A { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17743,15 +18847,12 @@ struct Mat3A { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17761,15 +18862,12 @@ struct Mat3A { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17778,13 +18876,13 @@ struct Mat3A { /// This is the same as the OpenGL `gluPerspective` function. /// See - #[lua(kind = "Function", output(proxy))] + #[lua()] fn perspective_rh_gl( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17794,13 +18892,13 @@ struct Mat3A { /// 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))] + #[lua()] fn perspective_lh( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17810,13 +18908,13 @@ struct Mat3A { /// 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))] + #[lua()] fn perspective_rh( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17827,12 +18925,12 @@ struct Mat3A { /// 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))] + #[lua()] fn perspective_infinite_lh( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17841,12 +18939,12 @@ struct Mat3A { /// # Panics /// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn perspective_infinite_reverse_lh( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17857,12 +18955,12 @@ struct Mat3A { /// 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))] + #[lua()] fn perspective_infinite_rh( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17871,12 +18969,12 @@ struct Mat3A { /// # Panics /// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn perspective_infinite_reverse_rh( fov_y_radians: f32, aspect_ratio: f32, z_near: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17886,7 +18984,7 @@ struct Mat3A { /// /// Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn orthographic_rh_gl( left: f32, right: f32, @@ -17894,14 +18992,14 @@ struct Mat3A { top: f32, near: f32, far: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn orthographic_lh( left: f32, right: f32, @@ -17909,14 +19007,14 @@ struct Mat3A { top: f32, near: f32, far: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn orthographic_rh( left: f32, right: f32, @@ -17924,7 +19022,7 @@ struct Mat3A { top: f32, near: f32, far: f32, - ) -> bevy::math::Mat4; + ) -> LuaReflectValProxy; "#, r#" @@ -17933,8 +19031,11 @@ struct Mat3A { /// 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_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn project_point3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17947,8 +19048,11 @@ struct Mat3A { /// # Panics /// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn transform_point3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17959,8 +19063,11 @@ struct Mat3A { /// # Panics /// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn transform_vector3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17969,66 +19076,93 @@ struct Mat3A { /// 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; + #[lua()] + fn project_point3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the given [`Vec3A`] as 3D point. /// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `1.0`. - #[lua(kind = "Method", output(proxy))] - fn transform_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn transform_point3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the give [`Vec3A`] as 3D vector. /// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `0.0`. - #[lua(kind = "Method", output(proxy))] - fn transform_vector3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn transform_vector3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 4D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec4(&self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; + #[lua()] + fn mul_vec4( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 4x4 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; + #[lua()] + fn mul_mat4( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 4x4 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; + #[lua()] + fn add_mat4( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 4x4 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; + #[lua()] + fn sub_mat4( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 4x4 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat4; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 4x4 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat4; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -18040,289 +19174,249 @@ struct Mat3A { /// 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::Mat4, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> bool; "#, r#" /// Takes the absolute value of each element in `self` - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat4; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_dmat4(&self) -> bevy::math::DMat4; + #[lua()] + fn as_dmat4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Mat4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Mat4; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec4::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaVec4(curr_ref) } "#] )] -struct Mat4 { - #[lua(output(proxy))] +pub struct Mat4 { x_axis: bevy::math::Vec4, - #[lua(output(proxy))] y_axis: bevy::math::Vec4, - #[lua(output(proxy))] z_axis: bevy::math::Vec4, - #[lua(output(proxy))] w_axis: bevy::math::Vec4, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DMat2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat2; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat2; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Creates a 2x2 matrix from two column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::DVec2, - #[proxy] - y_axis: bevy::math::DVec2, - ) -> bevy::math::DMat2; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f64; 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) -> [f64; 4]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 4]; "#, r#" /// Creates a `[[f64; 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) -> [[f64; 2]; 2]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f64; 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::DVec2) -> bevy::math::DMat2; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle( - #[proxy] - scale: bevy::math::DVec2, + scale: LuaReflectValProxy, angle: f64, - ) -> bevy::math::DMat2; + ) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DMat2; + #[lua()] + fn from_angle(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DMat2; + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18331,13 +19425,12 @@ struct Mat4 { /// # Panics /// Panics if `i` or `j` is greater than 2. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat3_minor( - #[proxy] - m: bevy::math::DMat3, + m: LuaReflectValProxy, i: usize, j: usize, - ) -> bevy::math::DMat2; + ) -> LuaReflectValProxy; "#, r#" @@ -18345,8 +19438,11 @@ struct Mat4 { /// # Panics /// Panics if `index` is greater than 1. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::DVec2; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -18354,37 +19450,42 @@ struct Mat4 { /// # Panics /// Panics if `index` is greater than 1. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::DVec2; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::DMat2; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f64; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f64; "#, r#" @@ -18393,50 +19494,70 @@ struct Mat4 { /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DMat2; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 2D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn mul_vec2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 2x2 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; + #[lua()] + fn mul_mat2( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 2x2 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; + #[lua()] + fn add_mat2( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 2x2 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; + #[lua()] + fn sub_mat2( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 2x2 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat2; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 2x2 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f64) -> bevy::math::DMat2; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -18448,235 +19569,205 @@ struct Mat4 { /// 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; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + 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; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_mat2(&self) -> bevy::math::Mat2; + #[lua()] + fn as_mat2( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DMat2) -> bevy::math::DMat2; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DMat2; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaDVec2::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaDVec2(curr_ref) } "#] )] -struct DMat2 { - #[lua(output(proxy))] +pub struct DMat2 { x_axis: bevy::math::DVec2, - #[lua(output(proxy))] y_axis: bevy::math::DVec2, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DMat3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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::DMat3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat3; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DMat3; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3x3 matrix from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::DVec3, - #[proxy] - y_axis: bevy::math::DVec3, - #[proxy] - z_axis: bevy::math::DVec3, - ) -> bevy::math::DMat3; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f64; 9]` 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) -> [f64; 9]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 9]; "#, r#" /// Creates a `[[f64; 3]; 3]` 3D 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) -> [[f64; 3]; 3]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f64; 3]; 3]; "#, r#" /// Creates a 3x3 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::DVec3) -> bevy::math::DMat3; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::DMat4) -> bevy::math::DMat3; + #[lua()] + fn from_mat4( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18685,13 +19776,12 @@ struct DMat2 { /// # Panics /// Panics if `i` or `j` is greater than 3. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat4_minor( - #[proxy] - m: bevy::math::DMat4, + m: LuaReflectValProxy, i: usize, j: usize, - ) -> bevy::math::DMat3; + ) -> LuaReflectValProxy; "#, r#" @@ -18699,8 +19789,10 @@ struct DMat2 { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DMat3; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18709,26 +19801,24 @@ struct DMat2 { /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, + axis: LuaReflectValProxy, angle: f64, - ) -> bevy::math::DMat3; + ) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in /// radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - order: bevy::math::EulerRot, + order: LuaReflectValProxy, a: f64, b: f64, c: f64, - ) -> bevy::math::DMat3; + ) -> LuaReflectValProxy; "#, r#" @@ -18738,29 +19828,32 @@ struct DMat2 { /// # 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); + #[lua()] + fn to_euler( + _self: LuaReflectRefProxy, + order: LuaReflectValProxy, + ) -> (f64, f64, f64); "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DMat3; + #[lua()] + fn from_rotation_x(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DMat3; + #[lua()] + fn from_rotation_y(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DMat3; + #[lua()] + fn from_rotation_z(angle: f64) -> LuaReflectValProxy; "#, r#" @@ -18768,8 +19861,10 @@ struct DMat2 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec2) -> bevy::math::DMat3; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18778,8 +19873,8 @@ struct DMat2 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DMat3; + #[lua()] + fn from_angle(angle: f64) -> LuaReflectValProxy; "#, r#" @@ -18788,14 +19883,12 @@ struct DMat2 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::DVec2, + scale: LuaReflectValProxy, angle: f64, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DMat3; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18805,8 +19898,10 @@ struct DMat2 { /// # Panics /// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec2) -> bevy::math::DMat3; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18814,8 +19909,10 @@ struct DMat2 { /// The resulting matrix can be used to transform 2D points and vectors. See /// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] m: bevy::math::DMat2) -> bevy::math::DMat3; + #[lua()] + fn from_mat2( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18823,8 +19920,11 @@ struct DMat2 { /// # Panics /// Panics if `index` is greater than 2. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::DVec3; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -18832,37 +19932,42 @@ struct DMat2 { /// # Panics /// Panics if `index` is greater than 2. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::DVec3; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::DMat3; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f64; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f64; "#, r#" @@ -18871,8 +19976,10 @@ struct DMat2 { /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DMat3; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18882,8 +19989,11 @@ struct DMat2 { /// # Panics /// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn transform_point2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -18893,50 +20003,71 @@ struct DMat2 { /// # Panics /// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn transform_vector2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 3D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn mul_vec3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; + #[lua()] + fn mul_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; + #[lua()] + fn add_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 3x3 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; + #[lua()] + fn sub_mat3( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 3x3 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat3; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 3x3 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f64) -> bevy::math::DMat3; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -18948,139 +20079,128 @@ struct DMat2 { /// 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::DMat3, max_abs_diff: f64) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + 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::DMat3; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_mat3(&self) -> bevy::math::Mat3; + #[lua()] + fn as_mat3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat3; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaDVec3::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaDVec3(curr_ref) } "#] )] -struct DMat3 { - #[lua(output(proxy))] +pub struct DMat3 { x_axis: bevy::math::DVec3, - #[lua(output(proxy))] y_axis: bevy::math::DVec3, - #[lua(output(proxy))] z_axis: bevy::math::DVec3, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DMat4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a 4x4 matrix from four column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::DVec4, - #[proxy] - y_axis: bevy::math::DVec4, - #[proxy] - z_axis: bevy::math::DVec4, - #[proxy] - w_axis: bevy::math::DVec4, - ) -> bevy::math::DMat4; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + w_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f64; 16]` 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) -> [f64; 16]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 16]; "#, r#" /// Creates a `[[f64; 4]; 4]` 4D 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) -> [[f64; 4]; 4]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f64; 4]; 4]; "#, r#" /// Creates a 4x4 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::DVec4) -> bevy::math::DMat4; + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19091,15 +20211,12 @@ struct DMat3 { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::DVec3, - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DMat4; + scale: LuaReflectValProxy, + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19109,13 +20226,11 @@ struct DMat3 { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_translation( - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DMat4; + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19125,8 +20240,10 @@ struct DMat3 { /// # Panics /// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DMat4; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19135,8 +20252,10 @@ struct DMat3 { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DMat4; + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19144,8 +20263,10 @@ struct DMat3 { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec3) -> bevy::math::DMat4; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19156,12 +20277,11 @@ struct DMat3 { /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, + axis: LuaReflectValProxy, angle: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19170,14 +20290,13 @@ struct DMat3 { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - order: bevy::math::EulerRot, + order: LuaReflectValProxy, a: f64, b: f64, c: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19188,8 +20307,11 @@ struct DMat3 { /// 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); + #[lua()] + fn to_euler( + _self: LuaReflectRefProxy, + order: LuaReflectValProxy, + ) -> (f64, f64, f64); "#, r#" @@ -19198,8 +20320,8 @@ struct DMat3 { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DMat4; + #[lua()] + fn from_rotation_x(angle: f64) -> LuaReflectValProxy; "#, r#" @@ -19208,8 +20330,8 @@ struct DMat3 { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DMat4; + #[lua()] + fn from_rotation_y(angle: f64) -> LuaReflectValProxy; "#, r#" @@ -19218,8 +20340,8 @@ struct DMat3 { /// The resulting matrix can be used to transform 3D points and vectors. See /// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DMat4; + #[lua()] + fn from_rotation_z(angle: f64) -> LuaReflectValProxy; "#, r#" @@ -19229,8 +20351,10 @@ struct DMat3 { /// # Panics /// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec3) -> bevy::math::DMat4; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19238,8 +20362,11 @@ struct DMat3 { /// # Panics /// Panics if `index` is greater than 3. - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::DVec4; + #[lua()] + fn col( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" @@ -19247,37 +20374,42 @@ struct DMat3 { /// # Panics /// Panics if `index` is greater than 3. - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::DVec4; + #[lua()] + fn row( + _self: LuaReflectRefProxy, + index: usize, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the transpose of `self`. - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::DMat4; + #[lua()] + fn transpose( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the determinant of `self`. - #[lua(kind = "Method")] - fn determinant(&self) -> f64; + #[lua()] + fn determinant(_self: LuaReflectRefProxy) -> f64; "#, r#" @@ -19286,8 +20418,10 @@ struct DMat3 { /// # Panics /// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DMat4; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19295,15 +20429,12 @@ struct DMat3 { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19311,15 +20442,12 @@ struct DMat3 { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19329,15 +20457,12 @@ struct DMat3 { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19347,15 +20472,12 @@ struct DMat3 { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19364,13 +20486,13 @@ struct DMat3 { /// This is the same as the OpenGL `gluPerspective` function. /// See - #[lua(kind = "Function", output(proxy))] + #[lua()] fn perspective_rh_gl( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19380,13 +20502,13 @@ struct DMat3 { /// 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))] + #[lua()] fn perspective_lh( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19396,13 +20518,13 @@ struct DMat3 { /// 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))] + #[lua()] fn perspective_rh( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19413,12 +20535,12 @@ struct DMat3 { /// 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))] + #[lua()] fn perspective_infinite_lh( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19427,12 +20549,12 @@ struct DMat3 { /// # Panics /// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn perspective_infinite_reverse_lh( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19443,12 +20565,12 @@ struct DMat3 { /// 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))] + #[lua()] fn perspective_infinite_rh( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19457,12 +20579,12 @@ struct DMat3 { /// # Panics /// Will panic if `z_near` is less than or equal to zero when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn perspective_infinite_reverse_rh( fov_y_radians: f64, aspect_ratio: f64, z_near: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19472,7 +20594,7 @@ struct DMat3 { /// /// Useful to map a right-handed coordinate system to the normalized device coordinates that OpenGL expects. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn orthographic_rh_gl( left: f64, right: f64, @@ -19480,14 +20602,14 @@ struct DMat3 { top: f64, near: f64, far: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn orthographic_lh( left: f64, right: f64, @@ -19495,14 +20617,14 @@ struct DMat3 { top: f64, near: f64, far: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, 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))] + #[lua()] fn orthographic_rh( left: f64, right: f64, @@ -19510,7 +20632,7 @@ struct DMat3 { top: f64, near: f64, far: f64, - ) -> bevy::math::DMat4; + ) -> LuaReflectValProxy; "#, r#" @@ -19519,8 +20641,11 @@ struct DMat3 { /// 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_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn project_point3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19533,8 +20658,11 @@ struct DMat3 { /// # Panics /// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn transform_point3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19545,50 +20673,71 @@ struct DMat3 { /// # Panics /// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn transform_vector3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms a 4D vector. - #[lua(kind = "Method", output(proxy))] - fn mul_vec4(&self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; + #[lua()] + fn mul_vec4( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies two 4x4 matrices. - #[lua(kind = "Method", output(proxy))] - fn mul_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; + #[lua()] + fn mul_mat4( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Adds two 4x4 matrices. - #[lua(kind = "Method", output(proxy))] - fn add_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; + #[lua()] + fn add_mat4( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Subtracts two 4x4 matrices. - #[lua(kind = "Method", output(proxy))] - fn sub_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; + #[lua()] + fn sub_mat4( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies a 4x4 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat4; + #[lua()] + fn mul_scalar( + _self: LuaReflectRefProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" /// Divides a 4x4 matrix by a scalar. - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f64) -> bevy::math::DMat4; + #[lua()] + fn div_scalar( + _self: LuaReflectRefProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -19600,192 +20749,162 @@ 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; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + 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; + #[lua()] + fn abs( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_mat4(&self) -> bevy::math::Mat4; + #[lua()] + fn as_mat4( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DMat4; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat4; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DMat4; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DMat4) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f64) -> bevy::math::DMat4; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#, r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaDVec4::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) +#[lua(metamethod="Index")] +fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { + let mut curr_ref = _self.0.clone(); + let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ + get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), + get_mut: std::sync::Arc::new(move |ref_| { + if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ + Ok(ret.col_mut(idx - 1)) + } else { + Err(bevy::reflect::ReflectPathError::InvalidDowncast) + } + }) + }; + curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); + LuaDVec4(curr_ref) } "#] )] -struct DMat4 { - #[lua(output(proxy))] +pub struct DMat4 { x_axis: bevy::math::DVec4, - #[lua(output(proxy))] y_axis: bevy::math::DVec4, - #[lua(output(proxy))] z_axis: bevy::math::DVec4, - #[lua(output(proxy))] w_axis: bevy::math::DVec4, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Affine2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates an affine transform from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::Vec2, - #[proxy] - y_axis: bevy::math::Vec2, - #[proxy] - z_axis: bevy::math::Vec2, - ) -> bevy::math::Affine2; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f32; 6]` array storing data in column major order. - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f32; 6]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 6]; "#, r#" @@ -19793,37 +20912,43 @@ struct DMat4 { /// 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]; 3]; + #[lua()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 2]; 3]; "#, r#" /// Creates an affine transform that changes scale. /// Note that if any scale is zero the transform will be non-invertible. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Affine2; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from the given rotation `angle`. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Affine2; + #[lua()] + fn from_angle(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates an affine transformation from the given 2D `translation`. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Affine2; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] matrix2: bevy::math::Mat2) -> bevy::math::Affine2; + #[lua()] + fn from_mat2( + matrix2: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19832,13 +20957,11 @@ struct DMat4 { /// Equivalent to /// `Affine2::from_translation(translation) * Affine2::from_mat2(mat2)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat2_translation( - #[proxy] - matrix2: bevy::math::Mat2, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Affine2; + matrix2: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19847,14 +20970,12 @@ struct DMat4 { /// Equivalent to `Affine2::from_translation(translation) * /// Affine2::from_angle(angle) * Affine2::from_scale(scale)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::Vec2, + scale: LuaReflectValProxy, angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Affine2; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19862,33 +20983,39 @@ struct DMat4 { /// `translation`. /// Equivalent to `Affine2::from_translation(translation) * Affine2::from_angle(angle)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_angle_translation( angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Affine2; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The given `Mat3` must be an affine transform, - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Affine2; + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The given [`Mat3A`] must be an affine transform, - #[lua(kind = "Function", output(proxy))] - fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Affine2; + #[lua()] + fn from_mat3a( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the given 2D point, applying shear, scale, rotation and translation. - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn transform_point2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19896,8 +21023,11 @@ struct DMat4 { /// translation). /// To also apply translation, use [`Self::transform_point2()`] instead. - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; + #[lua()] + fn transform_vector2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19905,15 +21035,15 @@ struct DMat4 { /// If any element is either `NaN`, positive or negative infinity, this will return /// `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -19925,147 +21055,127 @@ struct DMat4 { /// 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::Affine2, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> 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::Affine2; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Affine2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Affine2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Affine2 { - #[lua(output(proxy))] +pub struct Affine2 { matrix2: bevy::math::Mat2, - #[lua(output(proxy))] translation: bevy::math::Vec2, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::Affine3A", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Affine3A; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::Vec3A, - #[proxy] - y_axis: bevy::math::Vec3A, - #[proxy] - z_axis: bevy::math::Vec3A, - #[proxy] - w_axis: bevy::math::Vec3A, - ) -> bevy::math::Affine3A; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + w_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f32; 12]` array storing data in column major order. - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f32; 12]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 12]; "#, r#" @@ -20073,74 +21183,83 @@ struct Affine2 { /// 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; 3]; 4]; + #[lua()] + fn to_cols_array_2d( + _self: LuaReflectRefProxy, + ) -> [[f32; 3]; 4]; "#, r#" /// Creates an affine transform that changes scale. /// Note that if any scale is zero the transform will be non-invertible. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec3) -> bevy::math::Affine3A; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from the given `rotation` quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Affine3A; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around a normalized /// rotation `axis` of `angle` (in radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_axis_angle( - #[proxy] - axis: bevy::math::Vec3, + axis: LuaReflectValProxy, angle: f32, - ) -> bevy::math::Affine3A; + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around the x axis of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Affine3A; + #[lua()] + fn from_rotation_x(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around the y axis of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Affine3A; + #[lua()] + fn from_rotation_y(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around the z axis of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Affine3A; + #[lua()] + fn from_rotation_z(angle: f32) -> LuaReflectValProxy; "#, r#" /// Creates an affine transformation from the given 3D `translation`. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec3) -> bevy::math::Affine3A; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from a 3x3 matrix (expressing scale, shear and /// rotation) - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] mat3: bevy::math::Mat3) -> bevy::math::Affine3A; + #[lua()] + fn from_mat3( + mat3: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20148,13 +21267,11 @@ struct Affine2 { /// and a translation vector. /// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_mat3(mat3)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat3_translation( - #[proxy] - mat3: bevy::math::Mat3, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + mat3: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20163,36 +21280,33 @@ struct Affine2 { /// Equivalent to `Affine3A::from_translation(translation) * /// Affine3A::from_quat(rotation) * Affine3A::from_scale(scale)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + scale: LuaReflectValProxy, + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from the given 3D `rotation` and `translation`. /// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_quat(rotation)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_translation( - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The given `Mat4` must be an affine transform, /// i.e. contain no perspective transform. - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Affine3A; + #[lua()] + fn from_mat4( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20200,15 +21314,12 @@ struct Affine2 { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20216,15 +21327,12 @@ struct Affine2 { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20234,15 +21342,12 @@ struct Affine2 { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20252,22 +21357,22 @@ struct Affine2 { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the given 3D points, applying shear, scale, rotation and translation. - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn transform_point3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20275,15 +21380,21 @@ struct Affine2 { /// translation). /// To also apply translation, use [`Self::transform_point3()`] instead. - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; + #[lua()] + fn transform_vector3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the given [`Vec3A`], applying shear, scale, rotation and translation. - #[lua(kind = "Method", output(proxy))] - fn transform_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn transform_point3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20291,8 +21402,11 @@ struct Affine2 { /// translation). /// To also apply translation, use [`Self::transform_point3a()`] instead. - #[lua(kind = "Method", output(proxy))] - fn transform_vector3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; + #[lua()] + fn transform_vector3a( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20300,15 +21414,15 @@ struct Affine2 { /// If any element is either `NaN`, positive or negative infinity, this will return /// `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -20320,110 +21434,100 @@ struct Affine2 { /// 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::Affine3A, max_abs_diff: f32) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f32, + ) -> 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::Affine3A; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Affine3A) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Affine3A { - #[lua(output(proxy))] +pub struct Affine3A { matrix3: bevy::math::Mat3A, - #[lua(output(proxy))] translation: bevy::math::Vec3A, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DAffine2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DAffine2) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DAffine2; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::DVec2, - #[proxy] - y_axis: bevy::math::DVec2, - #[proxy] - z_axis: bevy::math::DVec2, - ) -> bevy::math::DAffine2; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f64; 6]` array storing data in column major order. - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f64; 6]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 6]; "#, r#" @@ -20431,37 +21535,45 @@ struct Affine3A { /// column major order. /// If you require data in row major order `transpose` the matrix first. - #[lua(kind = "Method")] - fn to_cols_array_2d(&self) -> [[f64; 2]; 3]; + #[lua()] + fn to_cols_array_2d( + _self: LuaReflectRefProxy, + ) -> [[f64; 2]; 3]; "#, r#" /// Creates an affine transform that changes scale. /// Note that if any scale is zero the transform will be non-invertible. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec2) -> bevy::math::DAffine2; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from the given rotation `angle`. - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DAffine2; + #[lua()] + fn from_angle(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates an affine transformation from the given 2D `translation`. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec2) -> bevy::math::DAffine2; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] matrix2: bevy::math::DMat2) -> bevy::math::DAffine2; + #[lua()] + fn from_mat2( + matrix2: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20470,13 +21582,11 @@ struct Affine3A { /// Equivalent to /// `DAffine2::from_translation(translation) * DAffine2::from_mat2(mat2)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat2_translation( - #[proxy] - matrix2: bevy::math::DMat2, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DAffine2; + matrix2: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20485,14 +21595,12 @@ struct Affine3A { /// Equivalent to `DAffine2::from_translation(translation) * /// DAffine2::from_angle(angle) * DAffine2::from_scale(scale)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::DVec2, + scale: LuaReflectValProxy, angle: f64, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DAffine2; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20500,26 +21608,30 @@ struct Affine3A { /// `translation`. /// Equivalent to `DAffine2::from_translation(translation) * DAffine2::from_angle(angle)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_angle_translation( angle: f64, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DAffine2; + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The given `DMat3` must be an affine transform, - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DAffine2; + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the given 2D point, applying shear, scale, rotation and translation. - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn transform_point2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20527,8 +21639,11 @@ struct Affine3A { /// translation). /// To also apply translation, use [`Self::transform_point2()`] instead. - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; + #[lua()] + fn transform_vector2( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20536,15 +21651,15 @@ struct Affine3A { /// If any element is either `NaN`, positive or negative infinity, this will return /// `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -20556,56 +21671,57 @@ 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()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + 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; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct DAffine2 { - #[lua(output(proxy))] +pub struct DAffine2 { matrix2: bevy::math::DMat2, - #[lua(output(proxy))] translation: bevy::math::DVec2, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DAffine3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates an affine transform from three column vectors. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_cols( - #[proxy] - x_axis: bevy::math::DVec3, - #[proxy] - y_axis: bevy::math::DVec3, - #[proxy] - z_axis: bevy::math::DVec3, - #[proxy] - w_axis: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + z_axis: LuaReflectValProxy, + w_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a `[f64; 12]` array storing data in column major order. - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f64; 12]; + #[lua()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 12]; "#, r#" @@ -20613,74 +21729,83 @@ struct DAffine2 { /// column major order. /// If you require data in row major order `transpose` the matrix first. - #[lua(kind = "Method")] - fn to_cols_array_2d(&self) -> [[f64; 3]; 4]; + #[lua()] + fn to_cols_array_2d( + _self: LuaReflectRefProxy, + ) -> [[f64; 3]; 4]; "#, r#" /// Creates an affine transform that changes scale. /// Note that if any scale is zero the transform will be non-invertible. - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec3) -> bevy::math::DAffine3; + #[lua()] + fn from_scale( + scale: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from the given `rotation` quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DAffine3; + #[lua()] + fn from_quat( + rotation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around a normalized /// rotation `axis` of `angle` (in radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, + axis: LuaReflectValProxy, angle: f64, - ) -> bevy::math::DAffine3; + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around the x axis of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DAffine3; + #[lua()] + fn from_rotation_x(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around the y axis of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DAffine3; + #[lua()] + fn from_rotation_y(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform containing a 3D rotation around the z axis of /// `angle` (in radians). - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DAffine3; + #[lua()] + fn from_rotation_z(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates an affine transformation from the given 3D `translation`. - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec3) -> bevy::math::DAffine3; + #[lua()] + fn from_translation( + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from a 3x3 matrix (expressing scale, shear and /// rotation) - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] mat3: bevy::math::DMat3) -> bevy::math::DAffine3; + #[lua()] + fn from_mat3( + mat3: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20688,13 +21813,11 @@ struct DAffine2 { /// and a translation vector. /// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_mat3(mat3)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_mat3_translation( - #[proxy] - mat3: bevy::math::DMat3, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + mat3: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20703,36 +21826,33 @@ struct DAffine2 { /// Equivalent to `DAffine3::from_translation(translation) * /// DAffine3::from_quat(rotation) * DAffine3::from_scale(scale)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::DVec3, - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + scale: LuaReflectValProxy, + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates an affine transform from the given 3D `rotation` and `translation`. /// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_quat(rotation)` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_translation( - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + rotation: LuaReflectValProxy, + translation: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// The given `DMat4` must be an affine transform, /// i.e. contain no perspective transform. - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::DMat4) -> bevy::math::DAffine3; + #[lua()] + fn from_mat4( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20740,15 +21860,12 @@ struct DAffine2 { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20756,15 +21873,12 @@ struct DAffine2 { /// direction. /// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_to_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + eye: LuaReflectValProxy, + dir: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20774,15 +21888,12 @@ struct DAffine2 { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20792,22 +21903,22 @@ struct DAffine2 { /// # Panics /// Will panic if `up` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn look_at_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; + eye: LuaReflectValProxy, + center: LuaReflectValProxy, + up: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Transforms the given 3D points, applying shear, scale, rotation and translation. - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn transform_point3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20815,8 +21926,11 @@ struct DAffine2 { /// translation). /// To also apply translation, use [`Self::transform_point3()`] instead. - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; + #[lua()] + fn transform_vector3( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20824,15 +21938,15 @@ struct DAffine2 { /// If any element is either `NaN`, positive or negative infinity, this will return /// `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NaN`. - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -20844,118 +21958,103 @@ struct DAffine2 { /// 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::DAffine3, max_abs_diff: f64) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, + 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::DAffine3; + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DAffine3) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DAffine3; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct DAffine3 { - #[lua(output(proxy))] +pub struct DAffine3 { matrix3: bevy::math::DMat3, - #[lua(output(proxy))] translation: bevy::math::DVec3, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::DQuat", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DQuat; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -20964,14 +22063,11 @@ struct DAffine3 { /// 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; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20979,38 +22075,30 @@ 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(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DQuat; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -21021,25 +22109,20 @@ struct DAffine3 { /// # 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(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::DQuat) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -21051,8 +22134,13 @@ struct DAffine3 { /// This function does not check if the input is normalized, it is up to the user to /// provide normalized input or to normalized the resulting quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_xyzw(x: f64, y: f64, z: f64, w: f64) -> bevy::math::DQuat; + #[lua()] + fn from_xyzw( + x: f64, + y: f64, + z: f64, + w: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -21061,8 +22149,8 @@ struct DAffine3 { /// This function does not check if the input is normalized, it is up to the user to /// provide normalized input or to normalized the resulting quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 4]) -> bevy::math::DQuat; + #[lua()] + fn from_array(a: [f64; 4]) -> LuaReflectValProxy; "#, r#" @@ -21071,8 +22159,10 @@ struct DAffine3 { /// This function does not check if the input is normalized, it is up to the user to /// provide normalized input or to normalized the resulting quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_vec4(#[proxy] v: bevy::math::DVec4) -> bevy::math::DQuat; + #[lua()] + fn from_vec4( + v: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21081,54 +22171,54 @@ struct DAffine3 { /// # Panics /// Will panic if `axis` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, + axis: LuaReflectValProxy, angle: f64, - ) -> bevy::math::DQuat; + ) -> LuaReflectValProxy; "#, r#" /// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. /// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. - #[lua(kind = "Function", output(proxy))] - fn from_scaled_axis(#[proxy] v: bevy::math::DVec3) -> bevy::math::DQuat; + #[lua()] + fn from_scaled_axis( + v: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the `angle` (in radians) around the x axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DQuat; + #[lua()] + fn from_rotation_x(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the `angle` (in radians) around the y axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DQuat; + #[lua()] + fn from_rotation_y(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the `angle` (in radians) around the z axis. - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DQuat; + #[lua()] + fn from_rotation_z(angle: f64) -> LuaReflectValProxy; "#, r#" /// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_euler( - #[proxy] - euler: bevy::math::EulerRot, + euler: LuaReflectValProxy, a: f64, b: f64, c: f64, - ) -> bevy::math::DQuat; + ) -> LuaReflectValProxy; "#, r#" @@ -21138,8 +22228,10 @@ struct DAffine3 { /// # 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; + #[lua()] + fn from_mat3( + mat: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21150,8 +22242,10 @@ struct DAffine3 { /// 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; + #[lua()] + fn from_mat4( + mat: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21164,13 +22258,11 @@ struct DAffine3 { /// # Panics /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_arc( - #[proxy] - from: bevy::math::DVec3, - #[proxy] - to: bevy::math::DVec3, - ) -> bevy::math::DQuat; + from: LuaReflectValProxy, + to: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21183,13 +22275,11 @@ struct DAffine3 { /// # Panics /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_arc_colinear( - #[proxy] - from: bevy::math::DVec3, - #[proxy] - to: bevy::math::DVec3, - ) -> bevy::math::DQuat; + from: LuaReflectValProxy, + to: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21202,49 +22292,56 @@ struct DAffine3 { /// # Panics /// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_rotation_arc_2d( - #[proxy] - from: bevy::math::DVec2, - #[proxy] - to: bevy::math::DVec2, - ) -> bevy::math::DQuat; + from: LuaReflectValProxy, + to: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the rotation axis scaled by the rotation in radians. - #[lua(kind = "Method", output(proxy))] - fn to_scaled_axis(self) -> bevy::math::DVec3; + #[lua()] + fn to_scaled_axis( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the rotation angles for the given euler rotation sequence. - #[lua(kind = "Method")] - fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f64, f64, f64); + #[lua()] + fn to_euler( + _self: LuaReflectValProxy, + order: LuaReflectValProxy, + ) -> (f64, f64, f64); "#, r#" /// `[x, y, z, w]` - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f64; 4]; "#, r#" /// Returns the vector part of the quaternion. - #[lua(kind = "Method", output(proxy))] - fn xyz(self) -> bevy::math::DVec3; + #[lua()] + fn xyz( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns the quaternion conjugate of `self`. For a unit quaternion the /// conjugate is also the inverse. - #[lua(kind = "Method", output(proxy))] - fn conjugate(self) -> bevy::math::DQuat; + #[lua()] + fn conjugate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21255,23 +22352,28 @@ struct DAffine3 { /// # Panics /// Will panic if `self` is not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn inverse(self) -> bevy::math::DQuat; + #[lua()] + fn inverse( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Computes the dot product of `self` and `rhs`. The dot product is /// equal to the cosine of the angle between two quaternion rotations. - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DQuat) -> f64; + #[lua()] + fn dot( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" /// Computes the length of `self`. - #[lua(kind = "Method")] - fn length(self) -> f64; + #[lua()] + fn length(_self: LuaReflectValProxy) -> f64; "#, r#" @@ -21279,16 +22381,16 @@ struct DAffine3 { /// This is generally faster than `length()` as it avoids a square /// root operation. - #[lua(kind = "Method")] - fn length_squared(self) -> f64; + #[lua()] + fn length_squared(_self: LuaReflectValProxy) -> f64; "#, r#" /// Computes `1.0 / length()`. /// For valid results, `self` must _not_ be of length zero. - #[lua(kind = "Method")] - fn length_recip(self) -> f64; + #[lua()] + fn length_recip(_self: LuaReflectValProxy) -> f64; "#, r#" @@ -21297,37 +22399,39 @@ struct DAffine3 { /// Panics /// Will panic if `self` is zero length when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::DQuat; + #[lua()] + fn normalize( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" /// Returns `true` if, and only if, all elements are finite. /// If any element is either `NaN`, positive or negative infinity, this will return `false`. - #[lua(kind = "Method")] - fn is_finite(self) -> bool; + #[lua()] + fn is_finite(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns `true` if any elements are `NAN`. - #[lua(kind = "Method")] - fn is_nan(self) -> bool; + #[lua()] + fn is_nan(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns whether `self` of length `1.0` or not. /// Uses a precision threshold of `1e-6`. - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; + #[lua()] + fn is_normalized(_self: LuaReflectValProxy) -> bool; "#, r#" - #[lua(kind = "Method")] - fn is_near_identity(self) -> bool; + #[lua()] + fn is_near_identity(_self: LuaReflectValProxy) -> bool; "#, r#" @@ -21337,8 +22441,11 @@ struct DAffine3 { /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method")] - fn angle_between(self, #[proxy] rhs: bevy::math::DQuat) -> f64; + #[lua()] + fn angle_between( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> f64; "#, r#" @@ -21350,13 +22457,12 @@ struct DAffine3 { /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn rotate_towards( - &self, - #[proxy] - rhs: bevy::math::DQuat, + _self: LuaReflectRefProxy, + rhs: LuaReflectValProxy, max_angle: f64, - ) -> bevy::math::DQuat; + ) -> LuaReflectValProxy; "#, r#" @@ -21368,8 +22474,12 @@ struct DAffine3 { /// 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::DQuat, max_abs_diff: f64) -> bool; + #[lua()] + fn abs_diff_eq( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + max_abs_diff: f64, + ) -> bool; "#, r#" @@ -21380,8 +22490,12 @@ struct DAffine3 { /// # Panics /// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] end: bevy::math::DQuat, s: f64) -> bevy::math::DQuat; + #[lua()] + fn lerp( + _self: LuaReflectValProxy, + end: LuaReflectValProxy, + s: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -21392,8 +22506,12 @@ struct DAffine3 { /// # 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; + #[lua()] + fn slerp( + _self: LuaReflectValProxy, + end: LuaReflectValProxy, + s: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -21401,8 +22519,11 @@ struct DAffine3 { /// # 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; + #[lua()] + fn mul_vec3( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21412,8 +22533,11 @@ struct DAffine3 { /// # 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()] + fn mul_quat( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -21424,91 +22548,95 @@ struct DAffine3 { /// 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; + #[lua()] + fn from_affine3( + a: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method", output(proxy))] - fn as_quat(self) -> bevy::math::Quat; + #[lua()] + fn as_quat( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct DQuat { +pub struct DQuat { x: f64, y: f64, z: f64, w: f64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::EulerRot", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::EulerRot; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::EulerRot) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct EulerRot {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct EulerRot {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::BVec3A", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" /// Creates a new vector mask. - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool) -> bevy::math::BVec3A; + #[lua()] + fn new(x: bool, y: bool, z: bool) -> LuaReflectValProxy; "#, r#" /// Creates a vector mask with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec3A; + #[lua()] + fn splat(v: bool) -> LuaReflectValProxy; "#, r#" /// Creates a new vector mask from a bool array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 3]) -> bevy::math::BVec3A; + #[lua()] + fn from_array(a: [bool; 3]) -> LuaReflectValProxy; "#, r#" @@ -21516,102 +22644,101 @@ struct EulerRot {} /// 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; + #[lua()] + fn bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns true if any of the elements are true, false otherwise. - #[lua(kind = "Method")] - fn any(self) -> bool; + #[lua()] + fn any(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns true if all the elements are true, false otherwise. - #[lua(kind = "Method")] - fn all(self) -> bool; + #[lua()] + fn all(_self: LuaReflectValProxy) -> bool; "#, r#" /// Tests the value at `index`. /// Panics if `index` is greater than 2. - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; + #[lua()] + fn test(_self: LuaReflectRefProxy, 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) -> (); + #[lua()] + fn set( + _self: LuaReflectRefMutProxy, + 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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec3A; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BVec3A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct BVec3A(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::math::BVec4A", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec4A; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new vector mask. - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool, w: bool) -> bevy::math::BVec4A; + #[lua()] + fn new(x: bool, y: bool, z: bool, w: bool) -> LuaReflectValProxy; "#, r#" /// Creates a vector mask with all elements set to `v`. - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec4A; + #[lua()] + fn splat(v: bool) -> LuaReflectValProxy; "#, r#" /// Creates a new vector mask from a bool array. - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 4]) -> bevy::math::BVec4A; + #[lua()] + fn from_array(a: [bool; 4]) -> LuaReflectValProxy; "#, r#" @@ -21619,124 +22746,124 @@ struct BVec3A(); /// 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; + #[lua()] + fn bitmask(_self: LuaReflectValProxy) -> u32; "#, r#" /// Returns true if any of the elements are true, false otherwise. - #[lua(kind = "Method")] - fn any(self) -> bool; + #[lua()] + fn any(_self: LuaReflectValProxy) -> bool; "#, r#" /// Returns true if all the elements are true, false otherwise. - #[lua(kind = "Method")] - fn all(self) -> bool; + #[lua()] + fn all(_self: LuaReflectValProxy) -> bool; "#, r#" /// Tests the value at `index`. /// Panics if `index` is greater than 3. - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; + #[lua()] + fn test(_self: LuaReflectRefProxy, index: usize) -> bool; "#, r#" /// Sets the element at `index`. /// Panics if `index` is greater than 3. - #[lua(kind = "MutatingMethod")] - fn set(&mut self, index: usize, value: bool) -> (); + #[lua()] + fn set( + _self: LuaReflectRefMutProxy, + 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; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct BVec4A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct BVec4A(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "smol_str::SmolStr", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &smol_str::SmolStr) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> smol_str::SmolStr; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Method")] - fn to_string(&self) -> std::string::String; + #[lua()] + fn to_string(_self: LuaReflectRefProxy) -> std::string::String; "#, r#" - #[lua(kind = "Method")] - fn len(&self) -> usize; + #[lua()] + fn len(_self: LuaReflectRefProxy) -> usize; "#, r#" - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; + #[lua()] + fn is_empty(_self: LuaReflectRefProxy) -> bool; "#, r#" - #[lua(kind = "Method")] - fn is_heap_allocated(&self) -> bool; + #[lua()] + fn is_heap_allocated(_self: LuaReflectRefProxy) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct SmolStr(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct SmolStr(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "uuid::Uuid", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" @@ -21761,8 +22888,8 @@ struct SmolStr(); /// [`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()] + fn new_v4() -> LuaReflectValProxy; "#, r#" @@ -21782,8 +22909,8 @@ struct SmolStr(); /// # 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; + #[lua()] + fn get_version_num(_self: LuaReflectRefProxy) -> usize; "#, r#" @@ -21802,8 +22929,8 @@ struct SmolStr(); /// # } /// ``` - #[lua(kind = "Method")] - fn as_u128(&self) -> u128; + #[lua()] + fn as_u128(_self: LuaReflectRefProxy) -> u128; "#, r#" @@ -21828,8 +22955,8 @@ struct SmolStr(); /// # } /// ``` - #[lua(kind = "Method")] - fn to_u128_le(&self) -> u128; + #[lua()] + fn to_u128_le(_self: LuaReflectRefProxy) -> u128; "#, r#" @@ -21850,8 +22977,8 @@ struct SmolStr(); /// # } /// ``` - #[lua(kind = "Method")] - fn as_u64_pair(&self) -> (u64, u64); + #[lua()] + fn as_u64_pair(_self: LuaReflectRefProxy) -> (u64, u64); "#, r#" @@ -21869,8 +22996,8 @@ struct SmolStr(); /// assert_eq!(bytes, uuid.into_bytes()); /// ``` - #[lua(kind = "Method")] - fn into_bytes(self) -> [u8; 16]; + #[lua()] + fn into_bytes(_self: LuaReflectValProxy) -> [u8; 16]; "#, r#" @@ -21894,22 +23021,22 @@ struct SmolStr(); /// # } /// ``` - #[lua(kind = "Method")] - fn to_bytes_le(&self) -> [u8; 16]; + #[lua()] + fn to_bytes_le(_self: LuaReflectRefProxy) -> [u8; 16]; "#, r#" /// Tests if the UUID is nil (all zeros). - #[lua(kind = "Method")] - fn is_nil(&self) -> bool; + #[lua()] + fn is_nil(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Tests if the UUID is max (all ones). - #[lua(kind = "Method")] - fn is_max(&self) -> bool; + #[lua()] + fn is_max(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -21934,7 +23061,7 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function")] + #[lua()] fn encode_buffer() -> [u8; 45]; "#, @@ -21942,9 +23069,9 @@ struct SmolStr(); /// 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")] + #[lua()] fn get_node_id( - &self, + _self: LuaReflectRefProxy, ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; "#, @@ -21965,8 +23092,8 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function", output(proxy))] - fn nil() -> uuid::Uuid; + #[lua()] + fn nil() -> LuaReflectValProxy; "#, r#" @@ -21986,8 +23113,8 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function", output(proxy))] - fn max() -> uuid::Uuid; + #[lua()] + fn max() -> LuaReflectValProxy; "#, r#" @@ -22004,8 +23131,8 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_u128(v: u128) -> uuid::Uuid; + #[lua()] + fn from_u128(v: u128) -> LuaReflectValProxy; "#, r#" @@ -22026,8 +23153,8 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_u128_le(v: u128) -> uuid::Uuid; + #[lua()] + fn from_u128_le(v: u128) -> LuaReflectValProxy; "#, r#" @@ -22045,8 +23172,8 @@ struct SmolStr(); /// ); /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_u64_pair(high_bits: u64, low_bits: u64) -> uuid::Uuid; + #[lua()] + fn from_u64_pair(high_bits: u64, low_bits: u64) -> LuaReflectValProxy; "#, r#" @@ -22071,8 +23198,8 @@ struct SmolStr(); /// # } /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_bytes(bytes: [u8; 16]) -> uuid::Uuid; + #[lua()] + fn from_bytes(bytes: [u8; 16]) -> LuaReflectValProxy; "#, r#" @@ -22098,646 +23225,406 @@ struct SmolStr(); /// # } /// ``` - #[lua(kind = "Function", output(proxy))] - fn from_bytes_le(b: [u8; 16]) -> uuid::Uuid; + #[lua()] + fn from_bytes_le(b: [u8; 16]) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &uuid::Uuid) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> uuid::Uuid; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone(_self: LuaReflectRefProxy) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Uuid(); +pub struct Uuid(); #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances .add_instance( "AtomicBool", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicI16", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicI32", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicI64", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicI8", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicIsize", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicU16", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicU32", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicU64", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicU8", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "AtomicUsize", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Duration", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Instant", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "PathBuf", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Quat", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Quat", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Vec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Vec3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "IVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("IVec2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "IVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("IVec3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "IVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("IVec4", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "I64Vec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "I64Vec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "I64Vec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "UVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("UVec2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "UVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("UVec3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "UVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("UVec4", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "U64Vec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "U64Vec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "U64Vec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "Vec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Vec2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Vec3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Vec3A", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Vec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Vec4", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "BVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("BVec2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "BVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("BVec3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "BVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("BVec4", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "DVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DVec2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "DVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DVec3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "DVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DVec4", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Mat2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Mat2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Mat3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Mat3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Mat3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Mat3A", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Mat4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Mat4", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "DMat2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DMat2", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "DMat3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DMat3", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "DMat4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DMat4", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Affine2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Affine3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "DAffine2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "DAffine3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances - .add_instance( - "DQuat", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("DQuat", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "BVec3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("BVec3A", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "BVec4A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("BVec4A", crate::tealr::mlu::UserDataProxy::::new)?; instances - .add_instance( - "Uuid", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Uuid", crate::tealr::mlu::UserDataProxy::::new)?; Ok(()) } } -pub struct BevyReflectAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyReflectAPIProvider { - 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( +fn bevy_reflect_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyReflectScriptingPlugin; +impl bevy::app::Plugin for BevyReflectScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_reflect_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyReflectAPI", |tw| { tw.document_global_instance::() .expect("Something went wrong documenting globals") .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicBool, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicI16, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicI32, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicI64, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicI8, - >, - >() + .process_type::>() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicIsize, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicU16, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicU32, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicU64, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicU8, - >, - >() + .process_type::>() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAtomicUsize, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaDuration, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAffine3A, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaDAffine2, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaDAffine3, - >, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .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::(); - 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::(); - 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/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs index 8910927aea..a066640a81 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs @@ -4,67 +4,69 @@ #![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, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::time::prelude::Fixed", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Fixed; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Fixed {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Fixed {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::time::prelude::Real", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Real; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Real {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Real {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::time::prelude::Timer", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -/// Creates a new timer with a given duration. -/// See also [`Timer::from_seconds`](Timer::from_seconds). - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - duration: bevy::utils::Duration, - #[proxy] - mode: bevy::time::prelude::TimerMode, - ) -> bevy::time::prelude::Timer; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" @@ -75,12 +77,11 @@ struct Real {} /// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); /// ``` - #[lua(kind = "Function", output(proxy))] + #[lua()] fn from_seconds( duration: f32, - #[proxy] - mode: bevy::time::prelude::TimerMode, - ) -> bevy::time::prelude::Timer; + mode: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -104,8 +105,8 @@ struct Real {} /// assert!(timer_repeating.finished()); /// ``` - #[lua(kind = "Method")] - fn finished(&self) -> bool; + #[lua()] + fn finished(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -121,88 +122,24 @@ struct Real {} /// assert!(!timer.just_finished()); /// ``` - #[lua(kind = "Method")] - fn just_finished(&self) -> bool; - -"#, - r#" -/// Returns the time elapsed on the timer. Guaranteed to be between 0.0 and `duration`. -/// Will only equal `duration` when the timer is finished and non repeating. -/// See also [`Stopwatch::elapsed`](Stopwatch::elapsed). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.elapsed(), Duration::from_secs_f32(0.5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn elapsed(&self) -> bevy::utils::Duration; + #[lua()] + fn just_finished(_self: LuaReflectRefProxy) -> bool; "#, r#" /// Returns the time elapsed on the timer as an `f32`. /// See also [`Timer::elapsed`](Timer::elapsed). - #[lua(kind = "Method")] - fn elapsed_secs(&self) -> f32; + #[lua()] + fn elapsed_secs(_self: LuaReflectRefProxy) -> 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. -/// See also [`Stopwatch::set`](Stopwatch::set). -/// # -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.set_elapsed(Duration::from_secs(2)); -/// assert_eq!(timer.elapsed(), Duration::from_secs(2)); -/// // the timer is not finished even if the elapsed time is greater than the duration. -/// assert!(!timer.finished()); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_elapsed(&mut self, #[proxy] time: bevy::utils::Duration) -> (); - -"#, - r#" -/// Returns the duration of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let timer = Timer::new(Duration::from_secs(1), TimerMode::Once); -/// assert_eq!(timer.duration(), Duration::from_secs(1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn duration(&self) -> bevy::utils::Duration; - -"#, - r#" -/// Sets the duration of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.5, TimerMode::Once); -/// timer.set_duration(Duration::from_secs(1)); -/// assert_eq!(timer.duration(), Duration::from_secs(1)); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_duration(&mut self, #[proxy] duration: bevy::utils::Duration) -> (); + #[lua()] + fn elapsed_secs_f64(_self: LuaReflectRefProxy) -> f64; "#, r#" @@ -214,8 +151,10 @@ struct Real {} /// assert_eq!(timer.mode(), TimerMode::Repeating); /// ``` - #[lua(kind = "Method", output(proxy))] - fn mode(&self) -> bevy::time::prelude::TimerMode; + #[lua()] + fn mode( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -228,8 +167,11 @@ struct Real {} /// assert_eq!(timer.mode(), TimerMode::Once); /// ``` - #[lua(kind = "MutatingMethod")] - fn set_mode(&mut self, #[proxy] mode: bevy::time::prelude::TimerMode) -> (); + #[lua()] + fn set_mode( + _self: LuaReflectRefMutProxy, + mode: LuaReflectValProxy, + ) -> (); "#, r#" @@ -245,8 +187,8 @@ struct Real {} /// assert_eq!(timer.elapsed_secs(), 0.0); /// ``` - #[lua(kind = "MutatingMethod")] - fn pause(&mut self) -> (); + #[lua()] + fn pause(_self: LuaReflectRefMutProxy) -> (); "#, r#" @@ -264,8 +206,8 @@ struct Real {} /// assert_eq!(timer.elapsed_secs(), 0.5); /// ``` - #[lua(kind = "MutatingMethod")] - fn unpause(&mut self) -> (); + #[lua()] + fn unpause(_self: LuaReflectRefMutProxy) -> (); "#, r#" @@ -282,8 +224,8 @@ struct Real {} /// assert!(!timer.paused()); /// ``` - #[lua(kind = "Method")] - fn paused(&self) -> bool; + #[lua()] + fn paused(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -301,8 +243,8 @@ struct Real {} /// assert_eq!(timer.elapsed_secs(), 0.0); /// ``` - #[lua(kind = "MutatingMethod")] - fn reset(&mut self) -> (); + #[lua()] + fn reset(_self: LuaReflectRefMutProxy) -> (); "#, r#" @@ -316,8 +258,8 @@ struct Real {} /// assert_eq!(timer.fraction(), 0.25); /// ``` - #[lua(kind = "Method")] - fn fraction(&self) -> f32; + #[lua()] + fn fraction(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -331,8 +273,8 @@ struct Real {} /// assert_eq!(timer.fraction_remaining(), 0.75); /// ``` - #[lua(kind = "Method")] - fn fraction_remaining(&self) -> f32; + #[lua()] + fn fraction_remaining(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -348,23 +290,8 @@ struct Real {} /// assert_eq!(Ordering::Equal, result); /// ``` - #[lua(kind = "Method")] - fn remaining_secs(&self) -> f32; - -"#, - r#" -/// Returns the remaining time using Duration -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn remaining(&self) -> bevy::utils::Duration; + #[lua()] + fn remaining_secs(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -385,113 +312,130 @@ struct Real {} /// assert_eq!(timer.times_finished_this_tick(), 0); /// ``` - #[lua(kind = "Method")] - fn times_finished_this_tick(&self) -> u32; + #[lua()] + fn times_finished_this_tick( + _self: LuaReflectRefProxy, + ) -> u32; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Timer; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &timer::Timer) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Timer {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Timer {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::time::prelude::TimerMode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &timer::TimerMode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::TimerMode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct TimerMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct TimerMode {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::time::prelude::Virtual", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Virtual; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Virtual {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Virtual {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::time::Stopwatch", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::Stopwatch; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &stopwatch::Stopwatch) -> bool; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -504,27 +448,8 @@ struct Virtual {} /// assert_eq!(stopwatch.is_paused(), false); /// ``` - #[lua(kind = "Function", output(proxy))] - fn new() -> bevy::time::Stopwatch; - -"#, - r#" -/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) -/// of the stopwatch. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.tick(Duration::from_secs(1)); -/// assert_eq!(stopwatch.elapsed(), Duration::from_secs(1)); -/// ``` -/// # See Also -/// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` value is desirable instead. -/// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. - - #[lua(kind = "Method", output(proxy))] - fn elapsed(&self) -> bevy::utils::Duration; + #[lua()] + fn new() -> LuaReflectValProxy; "#, r#" @@ -542,8 +467,8 @@ struct Virtual {} /// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. /// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. - #[lua(kind = "Method")] - fn elapsed_secs(&self) -> f32; + #[lua()] + fn elapsed_secs(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -553,23 +478,8 @@ struct Virtual {} /// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. /// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` is desirable instead. - #[lua(kind = "Method")] - fn elapsed_secs_f64(&self) -> f64; - -"#, - r#" -/// Sets the elapsed time of the stopwatch. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.set_elapsed(Duration::from_secs_f32(1.0)); -/// assert_eq!(stopwatch.elapsed_secs(), 1.0); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_elapsed(&mut self, #[proxy] time: bevy::utils::Duration) -> (); + #[lua()] + fn elapsed_secs_f64(_self: LuaReflectRefProxy) -> f64; "#, r#" @@ -586,8 +496,8 @@ struct Virtual {} /// assert_eq!(stopwatch.elapsed_secs(), 0.0); /// ``` - #[lua(kind = "MutatingMethod")] - fn pause(&mut self) -> (); + #[lua()] + fn pause(_self: LuaReflectRefMutProxy) -> (); "#, r#" @@ -605,8 +515,8 @@ struct Virtual {} /// assert_eq!(stopwatch.elapsed_secs(), 1.0); /// ``` - #[lua(kind = "MutatingMethod")] - fn unpause(&mut self) -> (); + #[lua()] + fn unpause(_self: LuaReflectRefMutProxy) -> (); "#, r#" @@ -622,8 +532,8 @@ struct Virtual {} /// assert!(!stopwatch.is_paused()); /// ``` - #[lua(kind = "Method")] - fn is_paused(&self) -> bool; + #[lua()] + fn is_paused(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -638,56 +548,54 @@ struct Virtual {} /// assert_eq!(stopwatch.elapsed_secs(), 0.0); /// ``` - #[lua(kind = "MutatingMethod")] - fn reset(&mut self) -> (); + #[lua()] + fn reset(_self: LuaReflectRefMutProxy) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Stopwatch {} +pub struct Stopwatch {} #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances - .add_instance( - "Timer", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; + .add_instance("Timer", crate::tealr::mlu::UserDataProxy::::new)?; instances .add_instance( "Stopwatch", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; Ok(()) } } -pub struct BevyTimeAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyTimeAPIProvider { - 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( +fn bevy_time_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyTimeScriptingPlugin; +impl bevy::app::Plugin for BevyTimeScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_time_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyTimeAPI", |tw| { tw.document_global_instance::() @@ -695,42 +603,13 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyTimeAPIProvider { .process_type::() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() + .process_type::>() .process_type::() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaStopwatch, - >, - >() + .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::(); + ); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs index d6e093de4a..f1c2607d4c 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs @@ -7,113 +7,61 @@ use super::bevy_reflect::*; use super::bevy_core::*; 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, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::transform::components::GlobalTransform", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &components::global_transform::GlobalTransform) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), + as_trait = "std::ops::Mul::", composite = "mul", - metamethod = "Mul", )] fn mul( - self, - #[proxy] - 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#" - - #[lua(kind = "Function", output(proxy))] - fn from_xyz(x: f32, y: f32, z: f32) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua(kind = "Function", output(proxy))] - fn from_translation( - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua(kind = "Function", output(proxy))] - fn from_rotation( - #[proxy] - rotation: bevy::math::Quat, - ) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua(kind = "Function", output(proxy))] - fn from_scale( - #[proxy] - scale: bevy::math::Vec3, - ) -> bevy::transform::components::GlobalTransform; + _self: LuaReflectValProxy, + transform: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(kind = "Function", output(proxy))] - fn from_isometry( - #[proxy] - iso: bevy::math::Isometry3d, - ) -> bevy::transform::components::GlobalTransform; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Returns the 3d affine transformation matrix as a [`Mat4`]. - #[lua(kind = "Method", output(proxy))] - fn compute_matrix(&self) -> bevy::math::Mat4; - -"#, - r#" -/// Returns the 3d affine transformation matrix as an [`Affine3A`]. - - #[lua(kind = "Method", output(proxy))] - fn affine(&self) -> bevy::math::Affine3A; + #[lua()] + fn from_xyz( + x: f32, + y: f32, + z: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -121,19 +69,10 @@ use bevy_script_api::{ /// The transform is expected to be non-degenerate and without shearing, or the output /// will be invalid. - #[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; + #[lua()] + fn compute_transform( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -168,182 +107,61 @@ use bevy_script_api::{ /// The transform is expected to be non-degenerate and without shearing, or the output /// will be invalid. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn reparented_to( - &self, - #[proxy] - parent: &components::global_transform::GlobalTransform, - ) -> bevy::transform::components::Transform; - -"#, - r#" -///Return the local right vector (X). - - #[lua(kind = "Method", output(proxy))] - fn right(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local left vector (-X). - - #[lua(kind = "Method", output(proxy))] - fn left(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local up vector (Y). - - #[lua(kind = "Method", output(proxy))] - fn up(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local down vector (-Y). - - #[lua(kind = "Method", output(proxy))] - fn down(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local back vector (Z). - - #[lua(kind = "Method", output(proxy))] - fn back(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local forward vector (-Z). - - #[lua(kind = "Method", output(proxy))] - fn forward(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Get the translation as a [`Vec3`]. - - #[lua(kind = "Method", output(proxy))] - fn translation(&self) -> bevy::math::Vec3; - -"#, - r#" -/// Get the translation as a [`Vec3A`]. - - #[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`. - - #[lua(kind = "Method")] - fn radius_vec3a(&self, #[proxy] extents: bevy::math::Vec3A) -> f32; - -"#, - r#" -/// 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; + _self: LuaReflectRefProxy, + parent: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Multiplies `self` with `transform` component by component, returning the /// resulting [`GlobalTransform`] - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_transform( - &self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::GlobalTransform; + _self: LuaReflectRefProxy, + transform: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), + as_trait = "std::ops::Mul::", composite = "mul", - metamethod = "Mul", )] fn mul( - self, - #[proxy] - global_transform: bevy::transform::components::GlobalTransform, - ) -> bevy::transform::components::GlobalTransform; + _self: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct GlobalTransform(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct GlobalTransform(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::transform::components::Transform", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &components::transform::Transform) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -351,281 +169,74 @@ struct GlobalTransform(); /// is used for z-ordering elements: higher `z`-value will be in front of lower /// `z`-value. - #[lua(kind = "Function", output(proxy))] - fn from_xyz(x: f32, y: f32, z: f32) -> bevy::transform::components::Transform; - -"#, - r#" -/// Extracts the translation, rotation, and scale from `matrix`. It must be a 3d affine -/// transformation matrix. - - #[lua(kind = "Function", output(proxy))] - fn from_matrix( - #[proxy] - world_from_local: bevy::math::Mat4, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Creates a new [`Transform`], with `translation`. Rotation will be 0 and scale 1 on -/// all axes. - - #[lua(kind = "Function", output(proxy))] - fn from_translation( - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Creates a new [`Transform`], with `rotation`. Translation will be 0 and scale 1 on -/// all axes. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation( - #[proxy] - rotation: bevy::math::Quat, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Creates a new [`Transform`], with `scale`. Translation will be 0 and rotation 0 on -/// all axes. - - #[lua(kind = "Function", output(proxy))] - fn from_scale( - #[proxy] - 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. - - #[lua(kind = "Method", output(proxy))] - fn with_translation( - self, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Returns this [`Transform`] with a new rotation. - - #[lua(kind = "Method", output(proxy))] - fn with_rotation( - self, - #[proxy] - rotation: bevy::math::Quat, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Returns this [`Transform`] with a new scale. - - #[lua(kind = "Method", output(proxy))] - fn with_scale( - self, - #[proxy] - scale: bevy::math::Vec3, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Returns the 3d affine transformation matrix from this transforms translation, -/// rotation, and scale. - - #[lua(kind = "Method", output(proxy))] - fn compute_matrix(&self) -> bevy::math::Mat4; - -"#, - r#" -/// Returns the 3d affine transformation matrix from this transforms translation, -/// rotation, and scale. - - #[lua(kind = "Method", output(proxy))] - fn compute_affine(&self) -> bevy::math::Affine3A; - -"#, - r#" -/// Get the unit vector in the local `X` direction. - - #[lua(kind = "Method", output(proxy))] - fn local_x(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`-local_x()`][Transform::local_x()] - - #[lua(kind = "Method", output(proxy))] - fn left(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`local_x()`][Transform::local_x()] - - #[lua(kind = "Method", output(proxy))] - fn right(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Get the unit vector in the local `Y` direction. - - #[lua(kind = "Method", output(proxy))] - fn local_y(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`local_y()`][Transform::local_y] - - #[lua(kind = "Method", output(proxy))] - fn up(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`-local_y()`][Transform::local_y] - - #[lua(kind = "Method", output(proxy))] - fn down(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Get the unit vector in the local `Z` direction. - - #[lua(kind = "Method", output(proxy))] - fn local_z(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`-local_z()`][Transform::local_z] - - #[lua(kind = "Method", output(proxy))] - fn forward(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`local_z()`][Transform::local_z] - - #[lua(kind = "Method", output(proxy))] - fn back(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Rotates this [`Transform`] by the given rotation. -/// If this [`Transform`] has a parent, the `rotation` is relative to the rotation of the parent. -/// # Examples -/// - [`3d_rotation`] -/// [`3d_rotation`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/3d_rotation.rs - - #[lua(kind = "MutatingMethod")] - fn rotate(&mut self, #[proxy] rotation: bevy::math::Quat) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the given `axis` by `angle` (in radians). -/// If this [`Transform`] has a parent, the `axis` is relative to the rotation of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_axis(&mut self, #[proxy] axis: bevy::math::Dir3, angle: f32) -> (); + #[lua()] + fn from_xyz( + x: f32, + y: f32, + z: f32, + ) -> LuaReflectValProxy; "#, r#" /// Rotates this [`Transform`] around the `X` axis by `angle` (in radians). /// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - #[lua(kind = "MutatingMethod")] - fn rotate_x(&mut self, angle: f32) -> (); + #[lua()] + fn rotate_x( + _self: LuaReflectRefMutProxy, + angle: f32, + ) -> (); "#, r#" /// Rotates this [`Transform`] around the `Y` axis by `angle` (in radians). /// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - #[lua(kind = "MutatingMethod")] - fn rotate_y(&mut self, angle: f32) -> (); + #[lua()] + fn rotate_y( + _self: LuaReflectRefMutProxy, + angle: f32, + ) -> (); "#, r#" /// Rotates this [`Transform`] around the `Z` axis by `angle` (in radians). /// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - #[lua(kind = "MutatingMethod")] - fn rotate_z(&mut self, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] by the given `rotation`. -/// The `rotation` is relative to this [`Transform`]'s current rotation. - - #[lua(kind = "MutatingMethod")] - fn rotate_local(&mut self, #[proxy] rotation: bevy::math::Quat) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `axis` by `angle` (in radians). - - #[lua(kind = "MutatingMethod")] - fn rotate_local_axis(&mut self, #[proxy] axis: bevy::math::Dir3, angle: f32) -> (); + #[lua()] + fn rotate_z( + _self: LuaReflectRefMutProxy, + angle: f32, + ) -> (); "#, r#" /// Rotates this [`Transform`] around its local `X` axis by `angle` (in radians). - #[lua(kind = "MutatingMethod")] - fn rotate_local_x(&mut self, angle: f32) -> (); + #[lua()] + fn rotate_local_x( + _self: LuaReflectRefMutProxy, + angle: f32, + ) -> (); "#, r#" /// Rotates this [`Transform`] around its local `Y` axis by `angle` (in radians). - #[lua(kind = "MutatingMethod")] - fn rotate_local_y(&mut self, angle: f32) -> (); + #[lua()] + fn rotate_local_y( + _self: LuaReflectRefMutProxy, + angle: f32, + ) -> (); "#, r#" /// Rotates this [`Transform`] around its local `Z` axis by `angle` (in radians). - #[lua(kind = "MutatingMethod")] - fn rotate_local_z(&mut self, angle: f32) -> (); - -"#, - r#" -/// Translates this [`Transform`] around a `point` in space. -/// If this [`Transform`] has a parent, the `point` is relative to the [`Transform`] of the parent. - - #[lua(kind = "MutatingMethod")] - fn translate_around( - &mut self, - #[proxy] - point: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around a `point` in space. -/// If this [`Transform`] has a parent, the `point` is relative to the [`Transform`] of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_around( - &mut self, - #[proxy] - point: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, + #[lua()] + fn rotate_local_z( + _self: LuaReflectRefMutProxy, + angle: f32, ) -> (); "#, @@ -633,26 +244,11 @@ struct GlobalTransform(); /// Multiplies `self` with `transform` component by component, returning the /// resulting [`Transform`] - #[lua(kind = "Method", output(proxy))] + #[lua()] fn mul_transform( - &self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Transforms the given `point`, applying scale, rotation and translation. -/// 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; + _self: LuaReflectRefProxy, + transform: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -660,160 +256,105 @@ struct GlobalTransform(); /// finite. If any of them contains a `NaN`, positive or negative infinity, /// this will return `false`. - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Get the [isometry] defined by this transform's rotation and translation, ignoring scale. -/// [isometry]: Isometry3d - - #[lua(kind = "Method", output(proxy))] - fn to_isometry(&self) -> bevy::math::Isometry3d; + #[lua()] + fn is_finite( + _self: LuaReflectRefProxy, + ) -> bool; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), + as_trait = "std::ops::Mul::", 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; + _self: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, + ) -> LuaReflectValProxy; "#, 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; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), + as_trait = "std::ops::Mul::", composite = "mul", - metamethod = "Mul", )] fn mul( - self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::Transform; + _self: LuaReflectValProxy, + transform: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Transform { - #[lua(output(proxy))] - translation: bevy::math::Vec3, - #[lua(output(proxy))] - rotation: bevy::math::Quat, - #[lua(output(proxy))] - scale: bevy::math::Vec3, +pub struct Transform { + translation: ReflectReference, + rotation: ReflectReference, + scale: ReflectReference, } #[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<()> { +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances .add_instance( "GlobalTransform", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGlobalTransform, - >::new, + crate::tealr::mlu::UserDataProxy::::new, )?; instances .add_instance( "Transform", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, + crate::tealr::mlu::UserDataProxy::::new, )?; Ok(()) } } -pub struct BevyTransformAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyTransformAPIProvider { - 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( +fn bevy_transform_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyTransformScriptingPlugin; +impl bevy::app::Plugin for BevyTransformScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_transform_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyTransformAPI", |tw| { tw.document_global_instance::() .expect("Something went wrong documenting globals") .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGlobalTransform, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaTransform, - >, - >() + .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::(); + ); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs index 75ee99eaa8..95df5fe7a7 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs @@ -8,244 +8,287 @@ 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, +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, }; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +use crate::{ + bindings::proxy::{ + LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, + LuaIdentityProxy, + }, + RegisterLua, tealr::mlu::mlua::IntoLua, +}; +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::CursorEntered", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::CursorEntered) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorEntered; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CursorEntered { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct CursorEntered { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::CursorLeft", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorLeft; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::CursorLeft) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CursorLeft { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct CursorLeft { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::CursorMoved", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::CursorMoved) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::CursorMoved; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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)] +pub struct CursorMoved { + window: ReflectReference, + position: ReflectReference, + delta: ReflectReference, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::FileDragAndDrop", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::FileDragAndDrop) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::FileDragAndDrop; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct FileDragAndDrop {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct FileDragAndDrop {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::Ime", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::Ime; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::Ime) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Ime {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct Ime {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::MonitorSelection", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::MonitorSelection; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::MonitorSelection) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct MonitorSelection {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct MonitorSelection {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::Window", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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) -> (); + #[lua()] + fn set_maximized( + _self: LuaReflectRefMutProxy, + 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) -> (); + #[lua()] + fn set_minimized( + _self: LuaReflectRefMutProxy, + minimized: bool, + ) -> (); "#, r#" @@ -253,129 +296,97 @@ struct MonitorSelection {} /// 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) -> (); + #[lua()] + fn start_drag_move( + _self: LuaReflectRefMutProxy, + ) -> (); "#, 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; + #[lua()] + fn width(_self: LuaReflectRefProxy) -> 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; + #[lua()] + fn height(_self: LuaReflectRefProxy) -> f32; "#, 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; + #[lua()] + fn physical_width(_self: LuaReflectRefProxy) -> 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; + #[lua()] + fn physical_height(_self: LuaReflectRefProxy) -> u32; "#, r#" /// The window's scale factor. /// Ratio of physical size to logical size, see [`WindowResolution`]. - #[lua(kind = "Method")] - fn scale_factor(&self) -> f32; + #[lua()] + fn scale_factor(_self: LuaReflectRefProxy) -> f32; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::Window; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Window { - #[lua(output(proxy))] +pub struct Window { 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, + ime_position: ReflectReference, + window_theme: ReflectReference, visible: bool, skip_taskbar: bool, - desired_maximum_frame_latency: ReflectedValue, + desired_maximum_frame_latency: ReflectReference, recognize_pinch_gesture: bool, recognize_rotation_gesture: bool, recognize_doubletap_gesture: bool, - recognize_pan_gesture: ReflectedValue, + recognize_pan_gesture: ReflectReference, movable_by_window_background: bool, fullsize_content_view: bool, has_shadow: bool, @@ -384,1090 +395,1184 @@ struct Window { titlebar_show_title: bool, titlebar_show_buttons: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::WindowMoved", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowMoved) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowMoved; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(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, +pub struct WindowMoved { + window: ReflectReference, + position: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::WindowPosition", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowPosition; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", 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) -> (); + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Set the window to a specific monitor. - #[lua(kind = "MutatingMethod")] + #[lua()] fn center( - &mut self, - #[proxy] - monitor: bevy::window::prelude::MonitorSelection, + _self: LuaReflectRefMutProxy, + monitor: LuaReflectValProxy, ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowPosition {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowPosition {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::prelude::WindowResizeConstraints", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::prelude::WindowResizeConstraints; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::WindowResizeConstraints) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> 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; + #[lua()] + fn check_constraints( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowResizeConstraints { +pub struct WindowResizeConstraints { min_width: f32, min_height: f32, max_width: f32, max_height: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowEvent", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowEvent) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowEvent; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowEvent {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowEvent {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowResized", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowResized; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowResized) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowResized { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowResized { + window: ReflectReference, width: f32, height: f32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowCreated", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowCreated; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowCreated) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowCreated { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowCreated { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowClosing", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowClosing; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowClosing) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowClosing { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowClosing { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowClosed", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowClosed; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowClosed) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowClosed { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowClosed { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowCloseRequested", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowCloseRequested; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowCloseRequested) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowCloseRequested { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowCloseRequested { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowDestroyed", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowDestroyed) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowDestroyed; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowDestroyed { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowDestroyed { + window: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::RequestRedraw", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::RequestRedraw; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::RequestRedraw) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct RequestRedraw {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct RequestRedraw {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowFocused", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowFocused) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowFocused; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowFocused { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowFocused { + window: ReflectReference, focused: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowOccluded", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowOccluded) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowOccluded; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowOccluded { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowOccluded { + window: ReflectReference, occluded: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowScaleFactorChanged", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowScaleFactorChanged) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowScaleFactorChanged; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowScaleFactorChanged { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowScaleFactorChanged { + window: ReflectReference, scale_factor: f64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowBackendScaleFactorChanged", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowBackendScaleFactorChanged; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowBackendScaleFactorChanged) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowBackendScaleFactorChanged { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, +pub struct WindowBackendScaleFactorChanged { + window: ReflectReference, scale_factor: f64, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowThemeChanged", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::WindowThemeChanged) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowThemeChanged; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowThemeChanged { - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - #[lua(output(proxy))] +pub struct WindowThemeChanged { + window: ReflectReference, theme: bevy::window::WindowTheme, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::AppLifecycle", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::AppLifecycle; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &event::AppLifecycle) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" /// Return `true` if the app can be updated. - #[lua(kind = "Method")] - fn is_active(&self) -> bool; + #[lua()] + fn is_active(_self: LuaReflectRefProxy) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct AppLifecycle {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct AppLifecycle {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::PrimaryWindow", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::PrimaryWindow) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PrimaryWindow; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct PrimaryWindow {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct PrimaryWindow {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowTheme", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::WindowTheme) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowTheme; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowTheme {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowTheme {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::Monitor", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[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")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::Monitor; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct Monitor { +pub struct Monitor { name: std::option::Option, physical_height: u32, physical_width: u32, - #[lua(output(proxy))] - physical_position: bevy::math::IVec2, + physical_position: ReflectReference, refresh_rate_millihertz: std::option::Option, scale_factor: f64, - video_modes: ReflectedValue, + video_modes: ReflectReference, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::VideoMode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::VideoMode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct VideoMode { - #[lua(output(proxy))] - physical_size: bevy::math::UVec2, +pub struct VideoMode { + physical_size: ReflectReference, bit_depth: u16, refresh_rate_millihertz: u32, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::PrimaryMonitor", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PrimaryMonitor; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct PrimaryMonitor {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct PrimaryMonitor {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::SystemCursorIcon", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::SystemCursorIcon; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &system_cursor::SystemCursorIcon) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct SystemCursorIcon {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct SystemCursorIcon {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowRef", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowRef; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowRef {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowRef {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::NormalizedWindowRef", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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) -> (); + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::NormalizedWindowRef) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct NormalizedWindowRef(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct NormalizedWindowRef(); +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::CursorOptions", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CursorOptions; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CursorOptions { +pub struct CursorOptions { visible: bool, - #[lua(output(proxy))] grab_mode: bevy::window::CursorGrabMode, hit_test: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::PresentMode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::PresentMode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::PresentMode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct PresentMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct PresentMode {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowMode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::WindowMode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowMode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowMode {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowResolution", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowResolution; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" /// Creates a new [`WindowResolution`]. - #[lua(kind = "Function", output(proxy))] - fn new(physical_width: f32, physical_height: f32) -> bevy::window::WindowResolution; + #[lua()] + fn new( + physical_width: f32, + physical_height: f32, + ) -> LuaReflectValProxy; "#, r#" /// Builder method for adding a scale factor override to the resolution. - #[lua(kind = "Method", output(proxy))] + #[lua()] fn with_scale_factor_override( - self, + _self: LuaReflectValProxy, scale_factor_override: f32, - ) -> bevy::window::WindowResolution; + ) -> LuaReflectValProxy; "#, r#" /// The window's client area width in logical pixels. - #[lua(kind = "Method")] - fn width(&self) -> f32; + #[lua()] + fn width(_self: LuaReflectRefProxy) -> 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; + #[lua()] + fn height(_self: LuaReflectRefProxy) -> f32; "#, r#" /// The window's client area width in physical pixels. - #[lua(kind = "Method")] - fn physical_width(&self) -> u32; + #[lua()] + fn physical_width(_self: LuaReflectRefProxy) -> 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; + #[lua()] + fn physical_height(_self: LuaReflectRefProxy) -> u32; "#, r#" /// The ratio of physical pixels to logical pixels. /// `physical_pixels = logical_pixels * scale_factor` - #[lua(kind = "Method")] - fn scale_factor(&self) -> f32; + #[lua()] + fn scale_factor(_self: LuaReflectRefProxy) -> 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; + #[lua()] + fn base_scale_factor( + _self: LuaReflectRefProxy, + ) -> 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; + #[lua()] + fn scale_factor_override( + _self: LuaReflectRefProxy, + ) -> std::option::Option; "#, r#" /// Set the window's logical resolution. - #[lua(kind = "MutatingMethod")] - fn set(&mut self, width: f32, height: f32) -> (); + #[lua()] + fn set( + _self: LuaReflectRefMutProxy, + width: f32, + height: f32, + ) -> (); "#, r#" @@ -1475,15 +1580,22 @@ struct WindowMode {} /// 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) -> (); + #[lua()] + fn set_physical_resolution( + _self: LuaReflectRefMutProxy, + 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) -> (); + #[lua()] + fn set_scale_factor( + _self: LuaReflectRefMutProxy, + scale_factor: f32, + ) -> (); "#, r#" @@ -1492,8 +1604,11 @@ struct WindowMode {} /// 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) -> (); + #[lua()] + fn set_scale_factor_and_apply_to_physical_size( + _self: LuaReflectRefMutProxy, + scale_factor: f32, + ) -> (); "#, r#" @@ -1501,9 +1616,9 @@ struct WindowMode {} /// This can change the logical and physical sizes if the resulting physical /// size is not within the limits. - #[lua(kind = "MutatingMethod")] + #[lua()] fn set_scale_factor_override( - &mut self, + _self: LuaReflectRefMutProxy, scale_factor_override: std::option::Option, ) -> (); @@ -1511,252 +1626,312 @@ struct WindowMode {} r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::WindowResolution) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowResolution {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowResolution {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::CompositeAlphaMode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::CompositeAlphaMode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CompositeAlphaMode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CompositeAlphaMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct CompositeAlphaMode {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::EnabledButtons", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::EnabledButtons) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::EnabledButtons; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct EnabledButtons { +pub struct EnabledButtons { minimize: bool, maximize: bool, close: bool, } -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::WindowLevel", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::WindowLevel) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::WindowLevel; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct WindowLevel {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct WindowLevel {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::InternalWindowState", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", 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; + #[lua()] + fn take_maximize_request( + _self: LuaReflectRefMutProxy, + ) -> 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; + #[lua()] + fn take_minimize_request( + _self: LuaReflectRefMutProxy, + ) -> 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; + #[lua()] + fn take_move_request( + _self: LuaReflectRefMutProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::InternalWindowState; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::InternalWindowState) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct InternalWindowState {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] +pub struct InternalWindowState {} +#[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( - derive(clone), remote = "bevy::window::CursorGrabMode", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", functions[r#" #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", + as_trait = "std::cmp::PartialEq::", composite = "eq", - metamethod = "Eq", )] - fn eq(&self, #[proxy] other: &window::CursorGrabMode) -> bool; + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::window::CursorGrabMode; + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(kind="MetaMethod", metamethod="ToString")] +#[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -struct CursorGrabMode {} +pub 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, - )?; +impl crate::tealr::mlu::ExportInstances for Globals { + fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( + self, + instances: &mut T, + ) -> crate::tealr::mlu::mlua::Result<()> { instances .add_instance( "WindowResolution", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaWindowResolution, - >::new, + crate::tealr::mlu::UserDataProxy::::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( +fn bevy_window_context_initializer( + _: &bevy_mod_scripting_core::script::ScriptId, + ctx: &mut crate::prelude::Lua, +) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { + crate::tealr::mlu::set_global_env(Globals, ctx)?; + Ok(()) +} +pub struct BevyWindowScriptingPlugin; +impl bevy::app::Plugin for BevyWindowScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.register_lua_proxy::(); + app.add_context_initializer::<()>(bevy_window_context_initializer); + app.add_documentation_fragment( + crate::docs::LuaDocumentationFragment::new( "BevyWindowAPI", |tw| { tw.document_global_instance::() @@ -1770,11 +1945,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { .process_type::() .process_type::() .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaWindowPosition, - >, - >() .process_type::() .process_type::() .process_type::() @@ -1803,9 +1973,7 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { .process_type::() .process_type::() .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaWindowResolution, - >, + crate::tealr::mlu::UserDataProxy, >() .process_type::() .process_type::() @@ -1814,66 +1982,6 @@ impl bevy_mod_scripting_core::hosts::APIProvider for BevyWindowAPIProvider { .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/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs index b0ca5e66d0..094ba75fd2 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs @@ -2,87 +2,28 @@ #![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; -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; -pub struct LuaBevyAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { - 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> { - bevy_a11y::BevyA11YAPIProvider.attach_api(ctx)?; - bevy_ecs::BevyEcsAPIProvider.attach_api(ctx)?; - bevy_transform::BevyTransformAPIProvider.attach_api(ctx)?; - bevy_math::BevyMathAPIProvider.attach_api(ctx)?; - bevy_input::BevyInputAPIProvider.attach_api(ctx)?; - 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(), - bevy_input::BevyInputAPIProvider.get_doc_fragment(), - 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() - .filter_map(|a: Option<_>| a) - .fold( - None, - |a, b| match a { - Some(a) => Some(a.merge(b)), - None => Some(b), - }, - ) - } - 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) { - 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); - bevy_input::BevyInputAPIProvider.register_with_app(app); - 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); +pub(crate) mod bevy_a11y; +pub(crate) mod bevy_ecs; +pub(crate) mod bevy_transform; +pub(crate) mod bevy_math; +pub(crate) mod bevy_input; +pub(crate) mod bevy_core; +pub(crate) mod bevy_time; +pub(crate) mod bevy_hierarchy; +pub(crate) mod bevy_window; +pub(crate) mod bevy_reflect; +pub struct LuaBevyScriptingPlugin; +impl bevy::app::Plugin for LuaBevyScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + bevy_a11y::BevyA11YScriptingPlugin.build(app); + bevy_ecs::BevyEcsScriptingPlugin.build(app); + bevy_transform::BevyTransformScriptingPlugin.build(app); + bevy_math::BevyMathScriptingPlugin.build(app); + bevy_input::BevyInputScriptingPlugin.build(app); + bevy_core::BevyCoreScriptingPlugin.build(app); + bevy_time::BevyTimeScriptingPlugin.build(app); + bevy_hierarchy::BevyHierarchyScriptingPlugin.build(app); + bevy_window::BevyWindowScriptingPlugin.build(app); + bevy_reflect::BevyReflectScriptingPlugin.build(app); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs new file mode 100644 index 0000000000..8fc5fad8cb --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs @@ -0,0 +1,189 @@ +//! Set of traits used to define how types are turned into and from proxies in Lua. +//! Proxies can either be logical "copies" or owned "direct representations" of the instance, or references to one via the [`bevy_mod_scripting_core::bindings::ReflectReference`] construct. + +use bevy::reflect::{FromReflect, Reflect, TypeRegistry}; +use bevy_mod_scripting_core::{ + bindings::{ + Proxy, ReflectAllocator, ReflectRefMutProxy, ReflectRefProxy, ReflectReference, + ReflectValProxy, Unproxy, ValProxy, WorldAccessGuard, WorldAccessUnit, WorldAccessWrite, + }, + error::{ScriptError, ScriptResult}, +}; +use tealr::{ + mlu::mlua::{Error, FromLua, IntoLua, Lua, Value}, + ToTypename, +}; + +/// Local trait alias for the [`Proxied`] trait. +pub trait LuaProxied { + type Proxy; +} + +/// Convenience for proxying a type into lua via itself without implementing [`Proxy`] on it. +/// Converts to Lua via T's implementation of IntoLua directly +pub struct LuaIdentityProxy(pub Option); + +impl Proxy for LuaIdentityProxy { + type Input<'i> = T; + fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { + Ok(Self(Some(value))) + } +} + +impl Unproxy for LuaIdentityProxy { + type Output<'o> = T where + Self: 'o; + + fn unproxy<'o>(&'o mut self) -> ScriptResult> { + Ok(self + .0 + .take() + .expect("IdentityProxy was already unproxied before")) + } +} + +impl ToTypename for LuaIdentityProxy { + fn to_typename() -> tealr::Type { + T::to_typename() + } +} + +impl<'a, T: IntoLua<'a>> IntoLua<'a> for LuaIdentityProxy { + fn into_lua(self, lua: &'a Lua) -> tealr::mlu::mlua::prelude::LuaResult> { + self.0.into_lua(lua) + } +} + +impl<'a, T: FromLua<'a>> FromLua<'a> for LuaIdentityProxy { + fn from_lua(value: Value<'a>, lua: &'a Lua) -> Result { + Ok(Self(Some(T::from_lua(value, lua)?))) + } +} + +/// Proxy which uses [`ValProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and that the proxy implements [`From`] for the type. +/// +/// Used for types which are copied into lua rather than references to originals in the world. +/// Use when your type does not implement Reflect or if it's a simple type that can be copied into lua. +pub struct LuaValProxy(pub ValProxy); + +/// Proxy which uses [`ReflectValProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and [`FromReflect`] and that the proxy implements [`AsRef`]. +/// Think of the proxy as just a container for a [`ReflectReference`]. +/// +/// Semantically equivalent to `T`, use it where you would use the `T` type. +pub struct LuaReflectValProxy(pub ReflectValProxy); + +/// Proxy which uses [`ReflectRefProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and [`Reflect`] and that the proxy implements [`AsRef`]. +/// Think of the proxy as just a container for a [`ReflectReference`]. +/// +/// Semantically equivalent to `&T`, use it where you would use the `&T` type. +pub struct LuaReflectRefProxy(pub ReflectRefProxy); + +/// Proxy which uses [`ReflectRefMutProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and [`Reflect`] and that the proxy implements [`AsRef`]. +/// Think of the proxy as just a container for a [`ReflectReference`]. +/// +/// Semantically equivalent to `&mut T`, use it where you would use the `&mut T` type. +pub struct LuaReflectRefMutProxy(pub ReflectRefMutProxy); + +macro_rules! impl_lua_unproxy { + ($ty:ident as $as:ident ($generic:tt) $($bound_var:path : ($($bounds:tt)+),)*) => { + impl <$generic> Unproxy for $ty<$generic> + where + $($bound_var : $($bounds)+),* + { + type Output<'b> = <$as<$generic,$generic::Proxy> as Unproxy>::Output<'b> where Self: 'b; + + fn collect_accesses<'w>( + &self, + guard: &WorldAccessGuard<'w>, + accesses: &mut smallvec::SmallVec<[WorldAccessWrite<'w>; 1]>, + ) -> ScriptResult<()> { + self.0.collect_accesses(guard, accesses) + } + + fn unproxy(&mut self) -> ScriptResult> { + self.0.unproxy() + } + + unsafe fn unproxy_with_world<'w,'o>( + &'o mut self, + guard: &WorldAccessGuard<'w>, + accesses: &'o [WorldAccessUnit<'w>], + type_registry: &TypeRegistry, + allocator: &'o ReflectAllocator, + ) -> ScriptResult> { + self.0 + .unproxy_with_world(guard, accesses, type_registry, allocator) + } + + fn accesses_len(&self) -> usize { + self.0.accesses_len() + } + } + + impl<'lua, $generic: LuaProxied> FromLua<'lua> for $ty<$generic> + where + $generic::Proxy: FromLua<'lua>, + { + fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result { + let inner: $generic::Proxy = $generic::Proxy::from_lua(value, lua)?; + let inner = $as::<$generic,$generic::Proxy>::new(inner); + Ok(Self(inner)) + } + } + + impl<'lua, $generic: LuaProxied> IntoLua<'lua> for $ty<$generic> + where + $generic::Proxy: IntoLua<'lua>, + { + fn into_lua(self, lua: &'lua Lua) -> tealr::mlu::mlua::prelude::LuaResult> { + self.0.0.into_lua(lua) + } + } + + impl ToTypename for $ty where T::Proxy: ToTypename { + fn to_typename() -> tealr::Type { + T::Proxy::to_typename() + } + } + }; +} + +macro_rules! impl_lua_proxy { + ($ty:ident as $as:ident => $generic:tt : $($bounds:path),* $(| T::Proxy: $($proxy_bounds:tt)*)?) => { + impl<$generic> bevy_mod_scripting_core::bindings::Proxy for $ty<$generic> + where + T::Proxy: $($($proxy_bounds)*)?, + T: $($bounds+)*, + { + type Input<'i>=<$as<$generic, $generic::Proxy> as bevy_mod_scripting_core::bindings::Proxy>::Input<'i>; + fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { + Ok(Self($as::<$generic,$generic::Proxy>::proxy(value)?)) + } + } + + + }; +} + +impl_lua_proxy!(LuaValProxy as ValProxy => T : LuaProxied | T::Proxy: From); +impl_lua_proxy!(LuaReflectValProxy as ReflectValProxy => T : LuaProxied,Reflect | T::Proxy: From ); + +impl_lua_unproxy!(LuaValProxy as ValProxy (T) + T: (LuaProxied), + T: (for <'l> From<&'l T::Proxy>), +); +impl_lua_unproxy!(LuaReflectValProxy as ReflectValProxy (T) + T: (FromReflect), + T: (LuaProxied), + T::Proxy: (AsRef), +); +impl_lua_unproxy!(LuaReflectRefProxy as ReflectRefProxy (T) + T: (LuaProxied), + T: (Reflect), + T::Proxy: (AsRef), +); +impl_lua_unproxy!(LuaReflectRefMutProxy as ReflectRefMutProxy (T) + T: (LuaProxied), + T: (Reflect), + T::Proxy: (AsRef), +); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs new file mode 100644 index 0000000000..607ecd239d --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -0,0 +1,428 @@ +use std::{any::Any, error::Error}; + +use bevy::{ + ecs::{reflect::AppTypeRegistry, world::Mut}, + reflect::{OffsetAccess, ParsedPath, ReflectFromReflect}, +}; +use bevy_mod_scripting_core::{ + bindings::{ReflectAllocator, ReflectReference, Unproxy, WorldCallbackAccess}, + error::ScriptError, +}; +use tealr::mlu::{ + mlua::{self, FromLua, IntoLua, Lua, MetaMethod, UserData, Value}, + TealData, +}; + +use crate::{impl_userdata_from_lua, ReflectLuaProxied, ReflectLuaValue}; + +use super::{ + proxy::{LuaProxied, LuaValProxy}, + world::GetWorld, +}; + +/// Lua UserData wrapper for [`bevy_mod_scripting_core::bindings::ReflectReference`]. +/// Acts as a lua reflection interface. Any value which is registered in the type registry can be interacted with using this type. +#[derive(Debug, Clone, tealr::mlu::UserData, tealr::ToTypename)] +pub struct LuaReflectReference(pub ReflectReference); + +impl LuaReflectReference { + /// Queries the reflection system for a proxy registration for the underlying type. + /// If found will convert to lua using this proxy + /// If not found will use ::into_lua to convert to lua + pub fn to_lua_proxy(self, lua: &Lua) -> Result, mlua::Error> { + // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, + let world = lua.get_world()?; + // TODO: i don't like the pingponging between errors here, need something more ergonomic + let result: Result = + world.with_resource(|world, type_registry: Mut| { + world.with_resource(|world, allocator: Mut| { + let type_registry = type_registry.read(); + // first we need the type id of the pointed to object to figure out how to work with it + let type_id = + self.0 + .with_reflect(world, &type_registry, Some(&allocator), |r| r.type_id()); + if let Some(type_data) = type_registry.get_type_data::(type_id) + { + self.0 + .with_reflect(world, &type_registry, Some(&allocator), |r| { + Ok((type_data.into_value)(r, lua)?) + }) + } else if let Some(type_data) = + type_registry.get_type_data::(type_id) + { + Ok((type_data.into_proxy)(self.0.clone(), lua)?) + } else { + Ok(self.clone().into_lua(lua)?) + } + }) + }); + result.map_err(mlua::Error::external) + } + + pub fn set_with_lua_proxy(&self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { + let world = lua.get_world()?; + let result: Result<(), ScriptError> = + world.with_resource(|world, type_registry: Mut| { + world.with_resource(|world, allocator: Mut| { + let type_registry = type_registry.read(); + let type_id = + self.0 + .with_reflect(world, &type_registry, Some(&allocator), |r| r.type_id()); + + if let Some(type_data) = type_registry.get_type_data::(type_id) + { + self.0 + .with_reflect_mut(world, &type_registry, Some(&allocator), |r| { + Ok((type_data.set_value)(r, value, lua)?) + }) + } else if let Some(type_data) = + type_registry.get_type_data::(type_id) + { + let other = (type_data.from_proxy)(value, lua)?; + + // first we need to get a copy of the other value + let other = other + .with_reflect(world, &type_registry, Some(&allocator), |r| { + type_registry + .get_type_data::(r.type_id()) + .and_then(|from_reflect_td| from_reflect_td.from_reflect(r)) + }) + .ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Failed to call ReflectFromReflect for type id: {:?}", + type_registry.get_type_info(type_id).map(|t| t.type_path()) + )) + })?; + + // now we can set it + self.0 + .with_reflect_mut(world, &type_registry, Some(&allocator), |r| { + r.try_apply(other.as_partial_reflect()).map_err(|e| { + ScriptError::new_runtime_error(format!( + "Invalid assignment `{:?}` = `{:?}`. Wrong type.", + self.0.clone(), + e, + )) + }) + // r.set(other).map_err(|e| { + // ScriptError::new_runtime_error(format!( + // "Invalid assignment `{:?}` = `{:?}`. Wrong type.", + // self.0.clone(), + // e, + // )) + // }) + })?; + Ok(()) + } else { + Err(ScriptError::new_runtime_error(format!( + "Invalid assignment `{:?}` = `{:?}`. Wrong type.", + self.0.clone(), + value, + ))) + } + }) + }); + + result.map_err(mlua::Error::external) + } + + /// Adjusts all the numeric accesses in the path from 1-indexed to 0-indexed + pub fn to_host_index(path: &mut ParsedPath) { + path.0.iter_mut().for_each(|a| match a.access { + bevy::reflect::Access::FieldIndex(ref mut i) => *i -= 1, + bevy::reflect::Access::TupleIndex(ref mut i) => *i -= 1, + bevy::reflect::Access::ListIndex(ref mut i) => *i -= 1, + _ => {} + }); + } + + /// Adjusts all the numeric accesses in the path from 0-indexed to 1-indexed + pub fn from_host_index(path: &mut ParsedPath) { + path.0.iter_mut().for_each(|a| match a.access { + bevy::reflect::Access::FieldIndex(ref mut i) => *i += 1, + bevy::reflect::Access::TupleIndex(ref mut i) => *i += 1, + bevy::reflect::Access::ListIndex(ref mut i) => *i += 1, + _ => {} + }); + } + + pub fn parse_value_index(value: Value) -> Result { + if let Some(num) = value.as_usize() { + Ok(vec![OffsetAccess { + access: bevy::reflect::Access::ListIndex(num), + offset: Some(1), + }] + .into()) + } else if let Some(key) = value.as_str() { + if let Some(tuple_struct_index) = key.strip_prefix("_") { + if let Ok(index) = tuple_struct_index.parse::() { + return Ok(vec![OffsetAccess { + access: bevy::reflect::Access::TupleIndex(index), + offset: Some(1), + }] + .into()); + } + } + + ParsedPath::parse(key).map_err(|e| mlua::Error::external(e.to_string())) + } else { + Err(mlua::Error::external("Invalid index")) + } + } +} + +impl_userdata_from_lua!(LuaReflectReference); + +impl LuaProxied for ReflectReference { + type Proxy = LuaReflectReference; +} + +impl TealData for LuaReflectReference { + fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(m: &mut T) { + m.add_meta_function( + MetaMethod::Index, + |l, (mut self_, key): (LuaReflectReference, Value)| { + // catchall, parse the path + let mut elem = Self::parse_value_index(key)?; + Self::to_host_index(&mut elem); + self_.0.index_path(elem); + self_.to_lua_proxy(l) + }, + ); + m.add_meta_function( + MetaMethod::NewIndex, + |l, (mut self_, key, value): (LuaReflectReference, Value, Value)| { + let mut elem = Self::parse_value_index(key)?; + Self::to_host_index(&mut elem); + self_.0.index_path(elem); + self_.set_with_lua_proxy(l, value) + }, + ); + } +} + +#[cfg(test)] +mod test { + + use bevy::{ + app::App, + ecs::{reflect::AppTypeRegistry, world::World}, + reflect::{FromReflect, OffsetAccess, Reflect}, + }; + use bevy_mod_scripting_core::{ + bindings::ReflectAllocator, + bindings::{ReflectBase, ReflectBaseType, WorldAccessGuard, WorldCallbackAccess}, + }; + use bevy_mod_scripting_derive::LuaProxy; + + use crate::{bindings::world::LuaWorld, RegisterLua}; + + use super::*; + + #[derive(Reflect)] + struct TestStruct { + value: usize, + proxy: TestProxied, + proxies: Vec, + } + + #[derive(Reflect)] + struct TestTupleStruct(usize, TestProxied, Vec); + + #[derive(Reflect)] + enum TestTupleEnum { + Value(usize), + Proxy(TestProxied), + Proxies(Vec), + } + + #[derive(Reflect, LuaProxy)] + #[proxy(bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate")] + #[reflect(LuaProxied)] + pub struct TestProxied; + + impl PartialEq for LuaTestProxied { + fn eq(&self, other: &Self) -> bool { + self.0 == other.0 + } + } + + /// asserts that setting then indexing into a LuaReflectReference of type T with the given expression returns the expected value. + /// Provides `t and `world` globals, with t being the LuaReflectReference to the provided value. + fn assert_lua_set_get_returns< + T: Reflect, + F: Fn(ReflectReference) -> O, + O: for<'l> FromLua<'l> + for<'l> IntoLua<'l> + PartialEq + std::fmt::Debug, + >( + mut world: &mut World, + val: T, + expr: &'static str, + expected: F, + ) { + let lua = Lua::new(); + let mut allocator = ReflectAllocator::default(); + let reflect_ref = LuaReflectReference(ReflectReference::new_allocated(val, &mut allocator)); + world.insert_resource(allocator); + + WorldCallbackAccess::with_callback_access(&mut world, |access| { + let globals = lua.globals(); + globals.set("test", reflect_ref.clone()).unwrap(); + globals.set("world", LuaWorld(access.clone())).unwrap(); + globals + .set("expected", expected(reflect_ref.0.clone())) + .unwrap(); + + let lua_code = format!( + r#" + {expr} = expected + return {expr} + "# + ); + let result = lua + .load(&lua_code) + .into_function() + .unwrap_or_else(|e| panic!("Could not load lua code into function: `{e}`")) + .call(()) + .unwrap_or_else(|e| { + panic!("Could not convert expression value to expected type: `{e}`") + }); + let result: O = result; + assert_eq!(result, expected(reflect_ref.0)); + }); + } + + #[test] + fn test_index_lua_value() { + // so we have the registry and can just do this + let mut app = App::new(); + app.register_lua_value::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestStruct { + value: 123, + proxy: TestProxied, + proxies: vec![], + }, + "test.value", + |_| 123usize, + ); + + let mut app = App::new(); + app.register_lua_value::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestTupleStruct(123, TestProxied, vec![]), + "test._1", + |_| 123usize, + ); + + let mut app = App::new(); + app.register_lua_value::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestTupleEnum::Value(123usize), + "test._1", + |_| 123usize, + ); + } + + #[test] + fn test_index_lua_proxy() { + // so we have the registry and can just do this + let mut app = App::new(); + app.register_lua_proxy::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestStruct { + value: 123, + proxy: TestProxied, + proxies: vec![], + }, + "test.proxy", + |mut r| { + r.index_path(ParsedPath::parse_static("proxy").unwrap()); + LuaTestProxied(r) + }, + ); + + let mut app = App::new(); + app.register_lua_proxy::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestTupleStruct(123, TestProxied, vec![]), + "test._2", + |mut r| { + r.index_path(ParsedPath::parse_static(".1").unwrap()); + LuaTestProxied(r) + }, + ); + + let mut app = App::new(); + app.register_lua_proxy::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestTupleEnum::Proxy(TestProxied), + "test._1", + |mut r| { + r.index_path(ParsedPath::parse_static(".0").unwrap()); + LuaTestProxied(r) + }, + ); + } + + #[test] + fn test_index_lua_proxy_vec() { + // so we have the registry and can just do this + let mut app = App::new(); + app.register_lua_proxy::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestStruct { + value: 123, + proxy: TestProxied, + proxies: vec![TestProxied], + }, + "test.proxies[1]", + |mut r| { + r.index_path(ParsedPath::parse_static("proxies").unwrap()); + r.index_path(ParsedPath::parse_static("[0]").unwrap()); + LuaTestProxied(r) + }, + ); + + let mut app = App::new(); + app.register_lua_proxy::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestTupleStruct(123, TestProxied, vec![TestProxied]), + "test._3[1]", + |mut r| { + r.index_path(ParsedPath::parse_static(".2").unwrap()); + r.index_path(ParsedPath::parse_static("[0]").unwrap()); + LuaTestProxied(r) + }, + ); + + let mut app = App::new(); + app.register_lua_proxy::(); + + assert_lua_set_get_returns( + app.world_mut(), + TestTupleEnum::Proxies(vec![TestProxied]), + "test._1[1]", + |mut r| { + r.index_path(ParsedPath::parse_static(".0").unwrap()); + r.index_path(ParsedPath::parse_static("[0]").unwrap()); + LuaTestProxied(r) + }, + ); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs new file mode 100644 index 0000000000..9d6e876378 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs @@ -0,0 +1,39 @@ +use tealr::{ + mlu::{mlua::IntoLua, TealData}, + ToTypename, +}; + +pub struct LuaResult(Result); + +impl TealData for LuaResult +where + T: ToTypename + for<'l> IntoLua<'l>, + E: ToTypename + for<'l> IntoLua<'l>, +{ + fn add_methods<'lua, M: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut M) { + methods.add_method("is_ok", |_, this, _: ()| Ok(this.0.is_ok())); + methods.add_method("is_err", |_, this, _: ()| Ok(this.0.is_err())); + methods.add_function("unwrap", |_, this: LuaResult| match this.0 { + Ok(value) => Ok(value), + Err(_) => Err(tealr::mlu::mlua::Error::RuntimeError( + "called `LuaResult::unwrap()` on an `Err` value".to_string(), + )), + }); + methods.add_method("unwrap_err", |_, this, _: ()| match &this.0 { + Ok(_) => Err(tealr::mlu::mlua::Error::RuntimeError( + "called `LuaResult::unwrap_err()` on an `Ok` value".to_string(), + )), + Err(value) => Ok(value), + }); + } + + fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} +} + +impl ToTypename for LuaResult { + fn to_typename() -> tealr::Type { + let t = std::any::type_name::(); + let e = std::any::type_name::(); + tealr::Type::new_single(format!("LuaResult<{t},{e}>"), tealr::KindOfType::External) + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs new file mode 100644 index 0000000000..357ebe7567 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs @@ -0,0 +1,27 @@ +use std::sync::Arc; + +use bevy::reflect::TypeRegistration; +use bevy_mod_scripting_core::bindings::ScriptTypeRegistration; +use tealr::mlu::TealData; + +use crate::impl_userdata_from_lua; + +use super::proxy::LuaProxied; + +/// Caches information about type data +#[derive(Clone, tealr::mlu::UserData, tealr::ToTypename)] +pub struct LuaTypeRegistration(pub ScriptTypeRegistration); + +impl_userdata_from_lua!(LuaTypeRegistration); + +impl TealData for LuaTypeRegistration {} + +impl From for LuaTypeRegistration { + fn from(value: ScriptTypeRegistration) -> Self { + Self(value) + } +} + +impl LuaProxied for ScriptTypeRegistration { + type Proxy = LuaTypeRegistration; +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs new file mode 100644 index 0000000000..9c3c3c1d4a --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -0,0 +1,131 @@ +use std::sync::Arc; + +use bevy::ecs::{reflect::AppTypeRegistry, world::Mut}; +use bevy::prelude::Entity; +use bevy_mod_scripting_core::{ + bindings::{ScriptTypeRegistration, Unproxy, WorldAccessGuard, WorldCallbackAccess}, + error::ScriptError, +}; +use bevy_mod_scripting_derive::LuaProxy; +use tealr::mlu::mlua::IntoLua; +use tealr::{ + mlu::{ + mlua::{self, FromLua}, + FromToLua, TealData, + }, + ToTypename, Type, +}; + +use super::{ + providers::bevy_ecs::LuaEntity, + proxy::{LuaIdentityProxy, LuaProxied, LuaReflectValProxy, LuaValProxy}, + type_registration::LuaTypeRegistration, +}; +use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata}; + +/// Lua UserData wrapper for [`bevy::ecs::world::World`] +#[derive(LuaProxy, Clone)] +#[proxy( + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + get_world_callback_access_fn = "self::LuaWorld::world_callback_access", + proxy_as_type = "self::LuaWorld", + remote = "bevy_mod_scripting_core::bindings::WorldAccessGuard<'_>", + functions [ + r#" + #[lua()] + fn add_default_component(&self, entity: LuaReflectValProxy, registration: LuaValProxy) -> Result, ScriptError>; + "#, + // r#" + // #[lua()] + // fn get_type_by_name(&self, type_name: String) -> Result; + // "#, + ] +)] +pub struct LuaWorld(pub WorldCallbackAccess); + +impl LuaWorld { + pub fn world_callback_access(self) -> WorldCallbackAccess { + self.0.clone() + } +} + +impl ToTypename for LuaWorld { + fn to_typename() -> Type { + Type::new_single("LuaWorld", tealr::KindOfType::External) + } +} + +impl LuaProxied for WorldCallbackAccess { + type Proxy = LuaWorld; +} + +impl_userdata_with_tealdata!(LuaWorld); + +// impl LuaProxied for WorldCallbackAccess { +// type Proxy = LuaWorld; +// } + +impl From<&LuaWorld> for WorldCallbackAccess { + fn from(value: &LuaWorld) -> Self { + value.0.clone() + } +} + +pub trait GetWorld { + fn get_world(&self) -> Result>, mlua::Error>; +} + +impl GetWorld for mlua::Lua { + fn get_world(&self) -> Result>, mlua::Error> { + self.globals() + .get::<_, LuaValProxy>("world")? + .unproxy() + .and_then(|guard| { + guard + .read() + .ok_or_else(|| ScriptError::new_reflection_error("Stale world access")) + }) + .map_err(mlua::Error::external) + } +} + +#[cfg(test)] +mod test { + use std::sync::Arc; + + use bevy::ecs::world::World; + use bevy_mod_scripting_core::{ + bindings::WorldAccessGuard, + bindings::{Unproxy, ValProxy}, + }; + use tealr::mlu::mlua::Lua; + + use super::*; + use crate::bindings::proxy::LuaValProxy; + use tealr::mlu::mlua::IntoLua; + + #[test] + fn test_world_from_to_lua() { + let mut world = World::new(); + let world_access_guard = Arc::new(WorldAccessGuard::new(&mut world)); + let callback_access = unsafe { + bevy_mod_scripting_core::bindings::WorldCallbackAccess::new(Arc::downgrade( + &world_access_guard, + )) + }; + let proxy = LuaValProxy::( + ValProxy::new(LuaWorld(callback_access)), + ); + + let lua = Lua::new(); + let lua_val = proxy.into_lua(&lua).unwrap(); + let mut val = + LuaValProxy::::from_lua( + lua_val, &lua, + ) + .unwrap(); + + let _val = val.unproxy().unwrap(); + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/docs.rs b/crates/languages/bevy_mod_scripting_lua/src/docs.rs index 9fbb42b0d5..7850478082 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/docs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/docs.rs @@ -1,17 +1,14 @@ -use core::str; use std::{ - borrow::Cow, env, fs::{self, File}, io::Write, - ops::Deref, process::Command, }; //use bevy::asset::FileAssetIo; use bevy::asset::io::file::FileAssetReader; use bevy_mod_scripting_core::prelude::*; -use tealr::{NameContainer, TypeGenerator, TypeWalker}; +use tealr::{TypeGenerator, TypeWalker}; pub type TypeWalkerBuilder = fn(TypeWalker) -> TypeWalker; @@ -51,14 +48,14 @@ struct Fragment { builder: TypeWalkerBuilder, } -pub struct LuaDocFragment { +pub struct LuaDocumentationFragment { name: &'static str, walker: Vec, } /// A piece of lua documentation, /// Each piece is combined into one large documentation page, and also a single teal declaration file if the `teal` feature is enabled -impl LuaDocFragment { +impl LuaDocumentationFragment { pub fn new(name: &'static str, f: TypeWalkerBuilder) -> Self { Self { name, @@ -67,7 +64,7 @@ impl LuaDocFragment { } } -impl DocFragment for LuaDocFragment { +impl DocumentationFragment for LuaDocumentationFragment { fn name(&self) -> &'static str { self.name } @@ -77,7 +74,7 @@ impl DocFragment for LuaDocFragment { self } - fn gen_docs(self) -> Result<(), ScriptError> { + fn gen_docs(self) -> Result<(), Box> { let script_asset_path = &FileAssetReader::get_base_path() .join("assets") .join("scripts"); @@ -100,128 +97,54 @@ impl DocFragment for LuaDocFragment { // fixes bug in tealr which causes syntax errors in teal due to duplicate fields (from having both getters and setters) 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())); rg.fields.dedup_by(|a, b| a.name == b.name); - rg.static_fields - .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); - } - for func in rg - .functions - .iter_mut() - .chain(rg.mut_functions.iter_mut()) - .chain(rg.methods.iter_mut()) - .chain(rg.mut_methods.iter_mut()) - { - escape_name(&mut func.name); - } } }); // generate json file - let json = serde_json::to_string_pretty(&tw) - .map_err(|e| ScriptError::DocGenError(e.to_string()))?; - - // temporary fix for incompatibility in json formats - // json.remove(json.len() - 1); - // json.push_str(",\n\"tealr_version_used\": \"0.9.0-alpha3\",\n\"extra_page\": []\n}"); + let json = serde_json::to_string_pretty(&tw)?; let json_path = script_doc_dir.join(format!("{}.json", docs_name)); - File::create(json_path) - .and_then(|mut file| { - file.write_all(json.as_bytes())?; - file.flush() - }) - .map_err(|e| ScriptError::DocGenError(e.to_string()))?; - + (File::create(json_path).and_then(|mut file| { + file.write_all(json.as_bytes())?; + file.flush() + }))?; // generate doc config files if they don't exist if !script_doc_dir.join("tealr_doc_gen_config.json").exists() { let config_path = script_doc_dir.join("tealr_doc_gen_config.json"); - File::create(config_path) - .and_then(|mut file| file.write_all(DEFAULT_DOC_CONFIG(&docs_name).as_bytes())) - .map_err(|e| ScriptError::DocGenError(e.to_string()))?; + (File::create(config_path) + .and_then(|mut file| file.write_all(DEFAULT_DOC_CONFIG(&docs_name).as_bytes())))? } // generate docs - Command::new("tealr_doc_gen") + (Command::new("tealr_doc_gen") .current_dir(script_doc_dir) .args(["run"]) - .status() - .map_err(|e| ScriptError::DocGenError(e.to_string()))?; + .status())?; #[cfg(feature = "teal")] { // now manage the definition (d.tl) file let definition_directory = script_asset_path.join("types"); - fs::create_dir_all(&definition_directory).map_err(|e| { - ScriptError::DocGenError(format!( - "Could not create `{}` directories: {e}", - &definition_directory.display() - )) - })?; + (fs::create_dir_all(&definition_directory))?; let definition_file_path = script_doc_dir .join(&docs_name) .join("definitions") .join(docs_name + ".d.tl"); let output_definition_file_path = script_asset_path.join("types").join("types.d.tl"); - fs::copy(&definition_file_path, &output_definition_file_path).map_err(|e| { - ScriptError::DocGenError(format!( - "Could not copy definition file from `{}` to `{}`: {e}", - definition_file_path.display(), - output_definition_file_path.display() - )) - })?; + (fs::copy(&definition_file_path, &output_definition_file_path))?; // finally create a tlconfig.lua file if doesn't exist // we do this to avoid problems with varying teal configurations // keep em settings consistent everywhere let tl_config_path = script_asset_path.join("tlconfig.lua"); if !tl_config_path.exists() { - let mut tl_file = File::create(tl_config_path) - .map_err(|e| ScriptError::DocGenError(e.to_string()))?; - tl_file - .write_all(DEFAULT_TEAL_CONFIG.as_bytes()) - .map_err(|e| ScriptError::DocGenError(e.to_string()))?; + let mut tl_file = (File::create(tl_config_path))?; + (tl_file.write_all(DEFAULT_TEAL_CONFIG.as_bytes()))?; } } Ok(()) } } - -/// Escapes a name of a table field, if that table field is a reserved keyword. -/// -/// ## Background -/// -/// String keys in a Lua table are allowed to be anything, even reserved -/// keywords. By default when tealr generates the type definition for a table -/// field, the string it generates is `{name} : {type}`. This causes a syntax -/// error when writing a bare keyword, since `nil : {type}` is considered trying -/// to add a type to the *value* nil (which is invalid). -/// -/// To get around this tealr allows us to escape table fields using the -/// `["{name}"] : {value}` syntax. This function detects if a name is one of the -/// Lua reserved words and fixes it if so. -fn escape_name(raw: &mut NameContainer) { - // List of Lua reserved keywords - const KEYWORD_FIELDS: &[&str] = &[ - "false", "true", "nil", // Values - "and", "not", "or", // Operators - "if", "then", "else", "elseif", "end", // If-Else - "for", "in", "break", "do", "repeat", "until", "while", // Loops - "function", "return", // Funcs - "local", // Declarations - "record", // Teal extra - ]; - let Ok(name) = str::from_utf8(raw) else { - return; - }; - if KEYWORD_FIELDS.contains(&name) { - let mapped = format!("[\"{name}\"]"); - *raw = NameContainer::from(Cow::Owned(mapped)); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 7a5dc2990b..b0e4ba6ced 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -4,7 +4,7 @@ pub mod util; use bevy::{ app::{App, Plugin}, ecs::{entity::Entity, world::World}, - reflect::{FromType, GetTypeRegistration, Reflect, TypePath}, + reflect::{FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, }; use bevy_mod_scripting_core::{ bindings::{ReflectReference, WorldCallbackAccess}, @@ -173,11 +173,10 @@ pub trait RegisterLua { T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, T::Proxy: From + AsRef; - fn register_lua_value( - &mut self, - ) -> &mut Self + fn register_lua_value(&mut self) -> &mut Self where - T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>; + T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T: Reflect + Clone + TypePath + GetTypeRegistration; } impl RegisterLua for App { @@ -192,11 +191,10 @@ impl RegisterLua for App { self.register_type_data::() } - fn register_lua_value( - &mut self, - ) -> &mut Self + fn register_lua_value(&mut self) -> &mut Self where T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T: Reflect + Clone + TypePath + GetTypeRegistration, { self.register_type::(); self.register_type_data::() @@ -231,11 +229,15 @@ where /// pass by value semantics, These need to implement [`Clone`] #[derive(Clone)] pub struct ReflectLuaValue { - pub into_value: for<'l> fn(&dyn Reflect, &'l Lua) -> Result, tealr::mlu::mlua::Error>, - pub set_value: - for<'l> fn(&mut dyn Reflect, Value<'l>, &'l Lua) -> Result<(), tealr::mlu::mlua::Error>, + pub into_value: + for<'l> fn(&dyn PartialReflect, &'l Lua) -> Result, tealr::mlu::mlua::Error>, + pub set_value: for<'l> fn( + &mut dyn PartialReflect, + Value<'l>, + &'l Lua, + ) -> Result<(), tealr::mlu::mlua::Error>, pub from_value: - for<'l> fn(Value<'l>, &'l Lua) -> Result, tealr::mlu::mlua::Error>, + for<'l> fn(Value<'l>, &'l Lua) -> Result, tealr::mlu::mlua::Error>, } impl IntoLua<'l> + for<'l> FromLua<'l>> FromType @@ -243,13 +245,13 @@ impl IntoLua<'l> + for<'l> FromLua<'l>> FromType { fn from_type() -> Self { Self { - into_value: |v, l| v.downcast_ref::().unwrap().clone().into_lua(l), + into_value: |v, l| v.try_downcast_ref::().unwrap().clone().into_lua(l), set_value: |t, v, l| { - let mut t = t.downcast_mut::().unwrap(); + let t = t.try_downcast_mut::().unwrap(); *t = T::from_lua(v, l)?; Ok(()) }, - from_value: |v, l| T::from_lua(v, l).map(|v| Box::new(v) as Box), + from_value: |v, l| T::from_lua(v, l).map(|v| Box::new(v) as Box), } } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/util.rs b/crates/languages/bevy_mod_scripting_lua/src/util.rs index 9b84ba5584..2652ee2f0a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/util.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/util.rs @@ -153,3 +153,48 @@ macro_rules! __cfg_feature_any_lua52_lua53_lua54_luajit52 { macro_rules! __cfg_feature_any_lua52_lua53_lua54_luajit52 { ( $( $tok:tt )* ) => {}; } + +#[macro_export] +macro_rules! impl_userdata_from_lua { + ($ty:ident) => { + impl<'lua> ::tealr::mlu::mlua::FromLua<'lua> for $ty { + fn from_lua( + value: ::tealr::mlu::mlua::Value<'lua>, + _lua: &::tealr::mlu::mlua::Lua, + ) -> Result { + match value { + tealr::mlu::mlua::Value::UserData(ud) => Ok(ud.borrow::()?.clone()), + _ => { + return Err(::tealr::mlu::mlua::Error::FromLuaConversionError { + from: value.type_name(), + to: stringify!($ty), + message: None, + }) + } + } + } + } + }; +} + +#[macro_export] +macro_rules! impl_userdata_with_tealdata { + ($ty:ident) => { + impl ::tealr::mlu::mlua::UserData for $ty + where + Self: ::tealr::mlu::TealData, + { + fn add_methods<'lua, T: ::tealr::mlu::mlua::UserDataMethods<'lua, Self>>( + methods: &mut T, + ) { + let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_methods(methods); + ::add_methods(&mut wrapper); + } + + fn add_fields<'lua, T: ::tealr::mlu::mlua::UserDataFields<'lua, Self>>(fields: &mut T) { + let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_fields(fields); + ::add_fields(&mut wrapper); + } + } + }; +} From 2959959e8dc6984b29f95754acf424138ac56e48 Mon Sep 17 00:00:00 2001 From: makspll Date: Wed, 13 Nov 2024 08:41:28 +0000 Subject: [PATCH 011/217] Finally get a world proxy going for lua :sparkles: --- .vscode/tasks.json | 9 +- Cargo.toml | 1 + crates/bevy_mod_scripting_derive/Cargo.toml | 7 +- .../src/bindings/proxy.rs | 56 ++- .../src/bindings/reference.rs | 12 + .../src/bindings/std.rs | 70 ++-- .../src/bindings/type_registration.rs | 16 +- .../src/bindings/world.rs | 378 ++++++++++++++++-- makefile | 2 +- 9 files changed, 479 insertions(+), 72 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 14262c18e9..ddfbb877a8 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,6 +12,12 @@ "type": "promptString", "description": "The crate location of this unit test", "default": "bevy_mod_scripting" + }, + { + "id": "features", + "type": "promptString", + "description": "The features to enable for this unit test", + "default": "" } ], "tasks": [ @@ -22,7 +28,8 @@ "args": [ "build_test_in_package", "PACKAGE=${input:package}", - "TEST_NAME=${input:test_name}" + "TEST_NAME=${input:test_name}", + "TEST_FEATURES=${input:features}" ] } ] diff --git a/Cargo.toml b/Cargo.toml index f515af7b42..833ae934bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -92,6 +92,7 @@ members = [ "crates/languages/bevy_mod_scripting_rhai_derive", "crates/languages/bevy_mod_scripting_rune", "crates/bevy_mod_scripting_common", + "crates/bevy_mod_scripting_derive", ] resolver = "2" exclude = ["crates/bevy_api_gen", "crates/macro_tests"] diff --git a/crates/bevy_mod_scripting_derive/Cargo.toml b/crates/bevy_mod_scripting_derive/Cargo.toml index 4540176a35..56257fb9ee 100644 --- a/crates/bevy_mod_scripting_derive/Cargo.toml +++ b/crates/bevy_mod_scripting_derive/Cargo.toml @@ -19,7 +19,12 @@ proc-macro = true [dependencies] paste = "1.0.7" darling = "0.20.3" -syn = { version = "2.0.38", features = ["full", "fold", "extra-traits"] } +syn = { version = "2.0.38", features = [ + "full", + "fold", + "extra-traits", + "visit-mut", +] } quote = "1.0.8" proc-macro2 = "1.0" convert_case = "0.5.0" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs index 8fc5fad8cb..edee3cc14b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs @@ -10,15 +10,67 @@ use bevy_mod_scripting_core::{ error::{ScriptError, ScriptResult}, }; use tealr::{ - mlu::mlua::{Error, FromLua, IntoLua, Lua, Value}, + mlu::mlua::{Error, FromLua, IntoLua, IntoLuaMulti, Lua, Value}, ToTypename, }; -/// Local trait alias for the [`Proxied`] trait. +use super::world::Nil; + +/// Think of this as a Local trait alias for the [`Proxy`] trait. Specifies the proxy type for a given type. pub trait LuaProxied { type Proxy; } +/// Proxy which acts exactly like `T` when converting to Lua, but provides a `ToTypename` implementation based on another type `N`. +/// Used internally basically only to support Result types in Lua directly. +/// Will be unnecessary once I get rid of tealr. +pub(crate) struct TypenameProxy(T, std::marker::PhantomData); + +impl TypenameProxy { + pub fn new(value: T) -> Self { + Self(value, std::marker::PhantomData) + } +} + +impl ToTypename for TypenameProxy { + fn to_typename() -> tealr::Type { + N::to_typename() + } +} + +impl<'a, T: IntoLuaMulti<'a>, N: ToTypename> IntoLua<'a> for TypenameProxy { + fn into_lua(self, lua: &'a Lua) -> tealr::mlu::mlua::Result> { + self.0 + .into_lua_multi(lua) + .map(|mut v| v.pop_front().unwrap()) + } +} + +/// Proxy which converts to lua by throwing the error. Can be used inside a [`Result`] to proxy into a result which will throw the error if it's an [`Err`] when converting to Lua. +pub struct ErrorProxy(E); + +impl<'a, E: Into>> IntoLua<'a> + for ErrorProxy +{ + fn into_lua(self, _: &'a Lua) -> tealr::mlu::mlua::prelude::LuaResult> { + Err(Error::external(self.0)) + } +} + +/// This should never really need to be used, but it's here so we can use the type in Lua. +impl ToTypename for ErrorProxy { + fn to_typename() -> tealr::Type { + tealr::Type::new_single("Error", tealr::KindOfType::External) + } +} + +impl>> Proxy for ErrorProxy { + type Input<'i> = E; + fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { + Ok(Self(value)) + } +} + /// Convenience for proxying a type into lua via itself without implementing [`Proxy`] on it. /// Converts to Lua via T's implementation of IntoLua directly pub struct LuaIdentityProxy(pub Option); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 607ecd239d..2f5ce99331 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -177,6 +177,18 @@ impl LuaProxied for ReflectReference { type Proxy = LuaReflectReference; } +impl From for ReflectReference { + fn from(value: LuaReflectReference) -> Self { + value.0 + } +} + +impl From for LuaReflectReference { + fn from(value: ReflectReference) -> Self { + Self(value) + } +} + impl TealData for LuaReflectReference { fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(m: &mut T) { m.add_meta_function( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs index 9d6e876378..41a3e35c00 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs @@ -1,39 +1,39 @@ -use tealr::{ - mlu::{mlua::IntoLua, TealData}, - ToTypename, -}; +// use tealr::{ +// mlu::{mlua::IntoLua, TealData}, +// ToTypename, +// }; -pub struct LuaResult(Result); +// pub struct LuaResult(Result); -impl TealData for LuaResult -where - T: ToTypename + for<'l> IntoLua<'l>, - E: ToTypename + for<'l> IntoLua<'l>, -{ - fn add_methods<'lua, M: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut M) { - methods.add_method("is_ok", |_, this, _: ()| Ok(this.0.is_ok())); - methods.add_method("is_err", |_, this, _: ()| Ok(this.0.is_err())); - methods.add_function("unwrap", |_, this: LuaResult| match this.0 { - Ok(value) => Ok(value), - Err(_) => Err(tealr::mlu::mlua::Error::RuntimeError( - "called `LuaResult::unwrap()` on an `Err` value".to_string(), - )), - }); - methods.add_method("unwrap_err", |_, this, _: ()| match &this.0 { - Ok(_) => Err(tealr::mlu::mlua::Error::RuntimeError( - "called `LuaResult::unwrap_err()` on an `Ok` value".to_string(), - )), - Err(value) => Ok(value), - }); - } +// impl TealData for LuaResult +// where +// T: ToTypename + for<'l> IntoLua<'l>, +// E: ToTypename + for<'l> IntoLua<'l>, +// { +// fn add_methods<'lua, M: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut M) { +// methods.add_method("is_ok", |_, this, _: ()| Ok(this.0.is_ok())); +// methods.add_method("is_err", |_, this, _: ()| Ok(this.0.is_err())); +// methods.add_function("unwrap", |_, this: LuaResult| match this.0 { +// Ok(value) => Ok(value), +// Err(_) => Err(tealr::mlu::mlua::Error::RuntimeError( +// "called `LuaResult::unwrap()` on an `Err` value".to_string(), +// )), +// }); +// methods.add_method("unwrap_err", |_, this, _: ()| match &this.0 { +// Ok(_) => Err(tealr::mlu::mlua::Error::RuntimeError( +// "called `LuaResult::unwrap_err()` on an `Ok` value".to_string(), +// )), +// Err(value) => Ok(value), +// }); +// } - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} -} +// fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} +// } -impl ToTypename for LuaResult { - fn to_typename() -> tealr::Type { - let t = std::any::type_name::(); - let e = std::any::type_name::(); - tealr::Type::new_single(format!("LuaResult<{t},{e}>"), tealr::KindOfType::External) - } -} +// impl ToTypename for LuaResult { +// fn to_typename() -> tealr::Type { +// let t = std::any::type_name::(); +// let e = std::any::type_name::(); +// tealr::Type::new_single(format!("LuaResult<{t},{e}>"), tealr::KindOfType::External) +// } +// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs index 357ebe7567..16955f6a38 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs @@ -14,7 +14,15 @@ pub struct LuaTypeRegistration(pub ScriptTypeRegistration); impl_userdata_from_lua!(LuaTypeRegistration); -impl TealData for LuaTypeRegistration {} +impl TealData for LuaTypeRegistration { + fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(fields: &mut F) { + fields.document("The [short name](https://docs.rs/bevy/latest/bevy/reflect/struct.TypeRegistration.html#method.get_short_name) of a type"); + fields.add_field_method_get("short_name", |_, s| Ok(s.0.short_name().to_owned())); + + fields.document("The full name of the type"); + fields.add_field_method_get("type_name", |_, s| Ok(s.0.type_name())); + } +} impl From for LuaTypeRegistration { fn from(value: ScriptTypeRegistration) -> Self { @@ -22,6 +30,12 @@ impl From for LuaTypeRegistration { } } +impl From<&LuaTypeRegistration> for ScriptTypeRegistration { + fn from(value: &LuaTypeRegistration) -> Self { + todo!() + } +} + impl LuaProxied for ScriptTypeRegistration { type Proxy = LuaTypeRegistration; } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 9c3c3c1d4a..846f412974 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -1,9 +1,12 @@ use std::sync::Arc; -use bevy::ecs::{reflect::AppTypeRegistry, world::Mut}; +use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; use bevy::prelude::Entity; + use bevy_mod_scripting_core::{ - bindings::{ScriptTypeRegistration, Unproxy, WorldAccessGuard, WorldCallbackAccess}, + bindings::{ + ReflectReference, ScriptTypeRegistration, Unproxy, WorldAccessGuard, WorldCallbackAccess, + }, error::ScriptError, }; use bevy_mod_scripting_derive::LuaProxy; @@ -16,32 +19,25 @@ use tealr::{ ToTypename, Type, }; +use super::proxy::LuaReflectRefProxy; use super::{ providers::bevy_ecs::LuaEntity, - proxy::{LuaIdentityProxy, LuaProxied, LuaReflectValProxy, LuaValProxy}, + proxy::{ + ErrorProxy, LuaIdentityProxy, LuaProxied, LuaReflectValProxy, LuaValProxy, TypenameProxy, + }, type_registration::LuaTypeRegistration, }; use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata}; -/// Lua UserData wrapper for [`bevy::ecs::world::World`] -#[derive(LuaProxy, Clone)] -#[proxy( - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - get_world_callback_access_fn = "self::LuaWorld::world_callback_access", - proxy_as_type = "self::LuaWorld", - remote = "bevy_mod_scripting_core::bindings::WorldAccessGuard<'_>", - functions [ - r#" - #[lua()] - fn add_default_component(&self, entity: LuaReflectValProxy, registration: LuaValProxy) -> Result, ScriptError>; - "#, - // r#" - // #[lua()] - // fn get_type_by_name(&self, type_name: String) -> Result; - // "#, - ] -)] +pub struct Nil; + +impl ToTypename for Nil { + fn to_typename() -> Type { + Type::new_single("nil", tealr::KindOfType::Builtin) + } +} + +#[derive(Clone, Debug)] pub struct LuaWorld(pub WorldCallbackAccess); impl LuaWorld { @@ -56,15 +52,277 @@ impl ToTypename for LuaWorld { } } -impl LuaProxied for WorldCallbackAccess { - type Proxy = LuaWorld; +impl TealData for LuaWorld { + fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut T) { + methods.add_method("get_type_by_name", |_, this, type_name: String| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Option> = world + .proxy_call(type_name, |type_name| world.get_type_by_name(type_name)) + .map_err(mlua::Error::external)?; + + Ok(out) + }); + + methods.add_method( + "add_default_component", + |_, + this, + args: ( + LuaReflectValProxy, + LuaValProxy, + )| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(args, |(entity, registration)| { + world.add_default_component(entity, registration) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method( + "get_component", + |_, this, args: (LuaReflectValProxy, LuaReflectValProxy)| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result>, ErrorProxy> = + world + .proxy_call(args, |(entity, component_id)| { + world.get_component(entity, component_id) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::< + _, + Option>, + >::new(out)) + }, + ); + + methods.add_method( + "has_component", + |_, this, args: (LuaReflectValProxy, LuaReflectValProxy)| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result> = world + .proxy_call(args, |(entity, component_id)| { + world.has_component(entity, component_id) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, bool>::new(out)) + }, + ); + + methods.add_method( + "remove_component", + |_, + this, + args: ( + LuaReflectValProxy, + LuaValProxy, + )| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(args, |(entity, registration)| { + world.remove_component(entity, registration) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method( + "get_resource", + |_, this, resource_id: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result, ErrorProxy> = world + .proxy_call(resource_id, |resource_id| world.get_resource(resource_id)) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, LuaReflectRefProxy>::new(out)) + }, + ); + + methods.add_method( + "remove_resource", + |_, this, registration: LuaValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(registration, |registration| { + world.remove_resource(registration) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method( + "has_resource", + |_, this, resource_id: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: bool = world + .proxy_call(resource_id, |resource_id| world.has_resource(resource_id)) + .map_err(mlua::Error::external)?; + + Ok(out) + }, + ); + + methods.add_method( + "get_children", + |_, this, entity: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result>, ErrorProxy> = world + .proxy_call(entity, |entity| world.get_children(entity)) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Vec>>::new( + out, + )) + }, + ); + + methods.add_method( + "get_parent", + |_, this, entity: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result>, ErrorProxy> = + world + .proxy_call(entity, |entity| world.get_parent(entity)) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Option>>::new( + out, + )) + }, + ); + + methods.add_method( + "push_children", + |_, this, args: (LuaReflectValProxy, Vec>)| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(args, |(parent, children)| { + world.push_children(parent, &children) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method( + "remove_children", + |_, this, args: (LuaReflectValProxy, Vec>)| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(args, |(parent, children)| { + world.remove_children(parent, &children) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method( + "insert_children", + |_, + this, + args: ( + LuaReflectValProxy, + usize, + Vec>, + )| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(args, |(parent, index, children)| { + world.insert_children(parent, index, &children) + }) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method( + "despawn_recursive", + |_, this, entity: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(entity, |entity| world.despawn_recursive(entity)) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + + methods.add_method("despawn", |_, this, entity: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(entity, |entity| world.despawn(entity)) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }); + + methods.add_method( + "despawn_descendants", + |_, this, entity: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: Result<(), ErrorProxy> = world + .proxy_call(entity, |entity| world.despawn_descendants(entity)) + .map_err(mlua::Error::external)?; + + Ok(TypenameProxy::<_, Nil>::new(out)) + }, + ); + } + + fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} } +impl_userdata_from_lua!(LuaWorld); impl_userdata_with_tealdata!(LuaWorld); -// impl LuaProxied for WorldCallbackAccess { -// type Proxy = LuaWorld; -// } +impl LuaProxied for WorldCallbackAccess { + type Proxy = LuaWorld; +} impl From<&LuaWorld> for WorldCallbackAccess { fn from(value: &LuaWorld) -> Self { @@ -94,10 +352,14 @@ impl GetWorld for mlua::Lua { mod test { use std::sync::Arc; - use bevy::ecs::world::World; - use bevy_mod_scripting_core::{ - bindings::WorldAccessGuard, - bindings::{Unproxy, ValProxy}, + use bevy::{ + app::App, + ecs::world::World, + prelude::{Component, Resource}, + reflect::Reflect, + }; + use bevy_mod_scripting_core::bindings::{ + ReflectAllocator, Unproxy, ValProxy, WorldAccessGuard, }; use tealr::mlu::mlua::Lua; @@ -128,4 +390,58 @@ mod test { let _val = val.unproxy().unwrap(); } + + fn lua_tests() -> Vec<(&'static str, &'static str)> { + vec![ + ( + "get_type_by_name with unregistered type returns nothing", + " + assert(world:get_type_by_name('UnregisteredType') == nil) + ", + ), + ( + "get_type_by_name with registered type returns type", + " + local type = world:get_type_by_name('TestComponent') + assert(type ~= nil) + assert(type.type_name == 'TestComponent') + assert(type.short_name == 'TestComponent') + ", + ), + ] + } + + #[derive(Component, Debug, Clone, Reflect)] + pub struct TestComponent(String); + + #[derive(Resource, Debug, Clone, Reflect)] + pub struct TestResource(String); + + /// Initializes test world for scripts + fn init_world() -> World { + let mut world = World::default(); + world.init_resource::(); + world.init_resource::(); + // add some entities + world.spawn(TestComponent("Hello".to_string())); + world.insert_resource(TestResource("World".to_string())); + world + } + + #[test] + fn world_lua_api_tests() { + // use lua assertions to test the api + + for (test_name, code) in lua_tests() { + let lua = Lua::new(); + let mut world = init_world(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + lua.globals().set("world", LuaWorld(world.clone())).unwrap(); + + let code = lua.load(code); + code.exec() + .map_err(|e| panic!("Failed lua test: {test_name}. Error: {e}")); + }); + } + } } diff --git a/makefile b/makefile index a381dd3221..527d16560d 100644 --- a/makefile +++ b/makefile @@ -32,7 +32,7 @@ GENERATED_SRC_PATH=./crates/languages/bevy_mod_scripting_lua/src/bindings/provid 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 build_test_in_package: - @cargo test --no-run --lib --workspace $(TEST_NAME) + @cargo test --no-run --lib --package ${PACKAGE} $(TEST_NAME) --features ${TEST_FEATURES} @export OUTPUT=$$(find ./target/debug/deps/ -regex ".*${PACKAGE}[^.]*" -printf "%T@\t%Tc %6k KiB %p\n" | sort -n -r | awk '{print $$NF}' | head -1); \ mv $${OUTPUT} ./target/debug/test_binary && echo "Using: $${OUTPUT}" && ls -v ./target/debug/ | grep "test_binary" From 37eb2318d451497fac0557b700f02b3c2e3e9dfe Mon Sep 17 00:00:00 2001 From: makspll Date: Wed, 13 Nov 2024 09:24:47 +0000 Subject: [PATCH 012/217] FIRST PASSING LUA WORLD API TESTS --- .../src/bindings/proxy.rs | 22 +- .../src/bindings/reference.rs | 8 +- .../src/bindings/world.rs | 533 +++++++++--------- crates/bevy_mod_scripting_core/src/error.rs | 2 +- .../src/bindings/proxy.rs | 2 +- .../src/bindings/world.rs | 38 +- 6 files changed, 318 insertions(+), 287 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs index 04c65f8180..9bc77465a5 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs @@ -82,7 +82,7 @@ pub trait Unproxy { _guard: &WorldAccessGuard<'w>, _accesses: &'o [WorldAccessUnit<'w>], _type_registry: &TypeRegistry, - _allocator: &'o ReflectAllocator, + _allocator: &ReflectAllocator, ) -> ScriptResult> { self.unproxy() } @@ -265,7 +265,7 @@ where guard: &WorldAccessGuard<'w>, accesses: &'o [WorldAccessUnit<'w>], type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, + allocator: &ReflectAllocator, ) -> ScriptResult> { let reflect_ref: &ReflectReference = self.0.as_ref(); let access = accesses.last().ok_or_else(|| { @@ -326,7 +326,7 @@ where guard: &WorldAccessGuard<'w>, accesses: &'o [WorldAccessUnit<'w>], type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, + allocator: &ReflectAllocator, ) -> ScriptResult> { let reflect_ref: &ReflectReference = self.0.as_ref(); accesses @@ -404,7 +404,7 @@ macro_rules! impl_unproxy_via_vec { guard: &WorldAccessGuard<'w>, accesses: &'o [WorldAccessUnit<'w>], type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, + allocator: &ReflectAllocator, ) -> ScriptResult> { let mut out = Vec::with_capacity(self.len()); let mut offset = 0; @@ -523,7 +523,7 @@ impl Unproxy for Option { guard: &WorldAccessGuard<'w>, accesses: &'o [WorldAccessUnit<'w>], type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, + allocator: &ReflectAllocator, ) -> ScriptResult> { if let Some(s) = self { let inner = s.unproxy_with_world(guard, accesses, type_registry, allocator)?; @@ -565,13 +565,13 @@ impl Proxy for Option { } } -impl Proxy for Result { - type Input<'a> = Result, E>; +impl Proxy for Result { + type Input<'a> = Result, E::Input<'a>>; fn proxy(input: Self::Input<'_>) -> ScriptResult { match input { Ok(i) => Ok(Ok(T::proxy(i)?)), - Err(e) => Ok(Err(e)), + Err(e) => Ok(Err(E::proxy(e)?)), } } @@ -581,7 +581,7 @@ impl Proxy for Result { ) -> ScriptResult { match input { Ok(i) => Ok(Ok(T::proxy_with_allocator(i, _allocator)?)), - Err(e) => Ok(Err(e)), + Err(e) => Ok(Err(E::proxy_with_allocator(e, _allocator)?)), } } } @@ -601,7 +601,7 @@ impl Unproxy for Result { guard: &WorldAccessGuard<'w>, accesses: &'o [WorldAccessUnit<'w>], type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, + allocator: &ReflectAllocator, ) -> ScriptResult> { match self { Ok(s) => Ok(Ok(s.unproxy_with_world( @@ -808,7 +808,7 @@ macro_rules! impl_tuple_unproxy_proxy { _guard: &WorldAccessGuard<'w>, _accesses: &'o [WorldAccessUnit<'w>], _type_registry: &TypeRegistry, - _allocator: &'o ReflectAllocator, + _allocator: &ReflectAllocator, ) -> ScriptResult> { let mut _offset = 0; diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index b89d146d06..952b50afeb 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -185,7 +185,7 @@ impl ReflectReference { world: UnsafeWorldCell<'w>, access: &'c WorldAccessWrite<'w>, type_registry: &TypeRegistry, - allocator: Option<&'c ReflectAllocator>, + allocator: Option<&ReflectAllocator>, ) -> ScriptResult<&'c dyn PartialReflect> { self.expect_read_access(access, type_registry, allocator, world)?; // Safety: since we have read access to the underlying componentId we can safely access the component @@ -202,7 +202,7 @@ impl ReflectReference { world: UnsafeWorldCell<'w>, access: &'c mut WorldAccessWrite<'w>, type_registry: &TypeRegistry, - allocator: Option<&'c ReflectAllocator>, + allocator: Option<&ReflectAllocator>, ) -> ScriptResult<&'c mut dyn PartialReflect> { self.expect_write_access(access, type_registry, allocator, world)?; // Safety: since we have write access to the underlying reflect access id we can safely access the component @@ -218,7 +218,7 @@ impl ReflectReference { &self, world: UnsafeWorldCell<'w>, type_registry: &TypeRegistry, - allocator: Option<&'w ReflectAllocator>, + allocator: Option<&ReflectAllocator>, ) -> ScriptResult<&'w dyn PartialReflect> { if let ReflectBase::Owned(id) = &self.base.base_id { let allocator = @@ -266,7 +266,7 @@ impl ReflectReference { &self, world: UnsafeWorldCell<'w>, type_registry: &TypeRegistry, - allocator: Option<&'w ReflectAllocator>, + allocator: Option<&ReflectAllocator>, ) -> ScriptResult<&'w mut dyn PartialReflect> { if let ReflectBase::Owned(id) = &self.base.base_id { let allocator = allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 0e60d2478a..6b590bbab9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -135,16 +135,10 @@ pub(crate) const CONCURRENT_ACCESS_MSG: &str = /// common world methods, see: /// - [`crate::bindings::query`] for query related functionality impl WorldCallbackAccess { - pub fn get_type_by_name(&self, type_name: &str) -> Option { + // TODO: uses `String` for type_name to avoid lifetime issues with types proxying this via macros + pub fn get_type_by_name(&self, type_name: String) -> Option { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - world.with_resource(|_, registry: Mut| { - let registry = registry.read(); - registry - .get_with_short_type_path(type_name) - .or_else(|| registry.get_with_type_path(type_name)) - .map(|registration| ScriptTypeRegistration::new(Arc::new(registration.clone()))) - }) + world.get_type_by_name(type_name) } pub fn add_default_component( @@ -153,50 +147,7 @@ impl WorldCallbackAccess { registration: ScriptTypeRegistration, ) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( - "Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", - registration.type_info().type_path() - )))?; - - // we look for ReflectDefault or ReflectFromWorld data then a ReflectComponent data - let instance = if let Some(default_td) = registration.data::() { - default_td.default() - } else if let Some(from_world_td) = registration.data::() { - if let Some(world) = world.get_whole_world_access() { - from_world_td.from_world(world) - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - } else { - return Err(ScriptError::new_runtime_error(format!( - "Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", - registration.type_info().type_path() - ))); - }; - - // TODO: this shouldn't need entire world access it feels - if let Some(world) = world.get_whole_world_access() { - let app_registry = world - .remove_resource::() - .unwrap_or_else(|| panic!("Missing type registry")); - - let mut entity = world.get_entity_mut(entity).map_err(|e| { - ScriptError::new_runtime_error(format!( - "Could not access entity: {:?}. {e}", - entity - )) - })?; - { - let registry = app_registry.read(); - component_data.insert(&mut entity, instance.as_partial_reflect(), ®istry); - } - world.insert_resource(app_registry); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.add_default_component(entity, registration) } pub fn get_component( @@ -205,45 +156,12 @@ impl WorldCallbackAccess { component_id: ComponentId, ) -> ScriptResult> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let entity = world.cell.get_entity(entity).ok_or_else(|| { - ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) - })?; - - let component_info = world - .cell - .components() - .get_info(component_id) - .ok_or_else(|| { - ScriptError::new_runtime_error(format!( - "Component does not exist: {:?}", - component_id - )) - })?; - - if entity.contains_id(component_id) { - Ok(Some(ReflectReference { - base: ReflectBaseType { - type_id: component_info - .type_id() - .expect("Component does not have type id"), - base_id: ReflectBase::Component(entity.id(), component_id), - }, - reflect_path: Default::default(), - })) - } else { - Ok(None) - } + world.get_component(entity, component_id) } pub fn has_component(&self, entity: Entity, component_id: ComponentId) -> ScriptResult { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let entity = world.cell.get_entity(entity).ok_or_else(|| { - ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) - })?; - - Ok(entity.contains_id(component_id)) + world.has_component(entity, component_id) } pub fn remove_component( @@ -252,129 +170,42 @@ impl WorldCallbackAccess { registration: ScriptTypeRegistration, ) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( - "Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", - registration.type_info().type_path() - )))?; - - // TODO: this shouldn't need entire world access it feels - if let Some(world) = world.get_whole_world_access() { - let mut entity = world.get_entity_mut(entity).map_err(|e| { - ScriptError::new_runtime_error(format!( - "Could not retrieve entity: {:?}. {e}", - entity - )) - })?; - - component_data.remove(&mut entity); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - Ok(()) + world.remove_component(entity, registration) } pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let component_info = world - .cell - .components() - .get_info(resource_id) - .ok_or_else(|| { - ScriptError::new_runtime_error(format!( - "Resource does not exist: {:?}", - resource_id - )) - })?; - - Ok(ReflectReference { - base: ReflectBaseType { - type_id: component_info - .type_id() - .expect("Resource does not have type id"), - base_id: ReflectBase::Resource(resource_id), - }, - reflect_path: Default::default(), - }) + world.get_resource(resource_id) } pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( - "Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", - registration.type_info().type_path() - )))?; - - // TODO: this shouldn't need entire world access it feels - if let Some(world) = world.get_whole_world_access() { - component_data.remove(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - Ok(()) + world.remove_resource(registration) } pub fn has_resource(&self, resource_id: ComponentId) -> bool { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - world.cell.components().get_info(resource_id).is_some() + world.has_resource(resource_id) } pub fn get_children(&self, entity: Entity) -> ScriptResult> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let access = world - .get_component_access_typed::() - .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); - - Ok(world - .get_component::(&access, entity)? - .map(|c| c.to_vec()) - .unwrap_or_default()) + world.get_children(entity) } pub fn get_parent(&self, entity: Entity) -> ScriptResult> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - let access = world - .get_component_access_typed::() - .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); - - Ok(world - .get_component::(&access, entity)? - .map(|c| c.get())) + world.get_parent(entity) } pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - if let Some(world) = world.get_whole_world_access() { - let mut queue = CommandQueue::default(); - let mut commands = Commands::new(&mut queue, world); - commands.entity(parent).add_children(children); - queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.push_children(parent, children) } pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - if let Some(world) = world.get_whole_world_access() { - let mut queue = CommandQueue::default(); - let mut commands = Commands::new(&mut queue, world); - commands.entity(parent).remove_children(children); - queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.remove_children(parent, children) } pub fn insert_children( @@ -384,62 +215,22 @@ impl WorldCallbackAccess { children: &[Entity], ) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - if let Some(world) = world.get_whole_world_access() { - let mut queue = CommandQueue::default(); - let mut commands = Commands::new(&mut queue, world); - commands.entity(parent).insert_children(index, children); - queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.insert_children(parent, index, children) } pub fn despawn_recursive(&self, entity: Entity) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - if let Some(world) = world.get_whole_world_access() { - let mut queue = CommandQueue::default(); - let mut commands = Commands::new(&mut queue, world); - commands.entity(entity).despawn_recursive(); - queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.despawn_recursive(entity) } pub fn despawn(&self, entity: Entity) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - if let Some(world) = world.get_whole_world_access() { - let mut queue = CommandQueue::default(); - let mut commands = Commands::new(&mut queue, world); - commands.entity(entity).despawn(); - queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.despawn(entity) } pub fn despawn_descendants(&self, entity: Entity) -> ScriptResult<()> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - - if let Some(world) = world.get_whole_world_access() { - let mut queue = CommandQueue::default(); - let mut commands = Commands::new(&mut queue, world); - commands.entity(entity).despawn_descendants(); - queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + world.despawn_descendants(entity) } } @@ -638,7 +429,7 @@ impl<'w> WorldAccessGuard<'w> { }); let resource = self - .get_resource_mut::(&mut access) + .get_resource_with_access_mut::(&mut access) .expect("invariant") .expect("invariant"); let out = f(self, resource); @@ -653,29 +444,30 @@ impl<'w> WorldAccessGuard<'w> { mut proxied_input: T, f: F, ) -> ScriptResult { - self.with_resource(|world, type_registry: Mut| { - world.with_resource(|_, mut allocator: Mut| { - let type_registry = type_registry.read(); - let mut world_acceses = SmallVec::default(); - - proxied_input.collect_accesses(self, &mut world_acceses)?; - let input = unsafe { - proxied_input.unproxy_with_world( - self, - &world_acceses, - &type_registry, - &allocator, - )? - }; - let out = f(input); - - O::proxy_with_allocator(out, &mut allocator) - }) - }) + let type_registry = + self.with_resource(|_, type_registry: Mut| type_registry.clone()); + + let type_registry = type_registry.read(); + let mut world_acceses = SmallVec::default(); + + let unproxied_input = self.with_resource(|_, allocator: Mut| { + proxied_input.collect_accesses(self, &mut world_acceses)?; + unsafe { + proxied_input.unproxy_with_world(self, &world_acceses, &type_registry, &allocator) + } + })?; + + let out = f(unproxied_input); + + let proxied_output = self.with_resource(|_, mut allocator: Mut| { + O::proxy_with_allocator(out, &mut allocator) + })?; + + Ok(proxied_output) } /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) - pub fn get_component( + pub fn get_component_with_access( &self, access: &WorldAccessWrite, entity: Entity, @@ -699,7 +491,7 @@ impl<'w> WorldAccessGuard<'w> { } /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) - pub fn get_component_mut( + pub fn get_component_with_access_mut( &self, access: &mut WorldAccessWrite, entity: Entity, @@ -723,7 +515,10 @@ impl<'w> WorldAccessGuard<'w> { } /// Get access to the given resource - pub fn get_resource(&self, access: &WorldAccessWrite) -> ScriptResult> { + pub fn get_resource_with_access( + &self, + access: &WorldAccessWrite, + ) -> ScriptResult> { let resource_id = match self.cell.components().resource_id::() { Some(id) => id, None => return Ok(None), @@ -743,7 +538,7 @@ impl<'w> WorldAccessGuard<'w> { } /// Get access to the given resource, this is the only way to access a component/resource safely (in the context of the world access guard) - pub fn get_resource_mut( + pub fn get_resource_with_access_mut( &self, access: &mut WorldAccessWrite, ) -> ScriptResult>> { @@ -768,12 +563,12 @@ impl<'w> WorldAccessGuard<'w> { /// Impl block for higher level world methods impl<'w> WorldAccessGuard<'w> { - pub fn get_type_by_name(&self, type_name: &str) -> Option { + pub fn get_type_by_name(&self, type_name: String) -> Option { self.with_resource(|_, registry: Mut| { let registry = registry.read(); registry - .get_with_short_type_path(type_name) - .or_else(|| registry.get_with_type_path(type_name)) + .get_with_short_type_path(&type_name) + .or_else(|| registry.get_with_type_path(&type_name)) .map(|registration| ScriptTypeRegistration::new(Arc::new(registration.clone()))) }) } @@ -825,6 +620,220 @@ impl<'w> WorldAccessGuard<'w> { panic!("{CONCURRENT_WORLD_ACCESS_MSG}") } + Ok(()) + } + pub fn get_component( + &self, + entity: Entity, + component_id: ComponentId, + ) -> ScriptResult> { + let entity = self.cell.get_entity(entity).ok_or_else(|| { + ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) + })?; + + let component_info = self + .cell + .components() + .get_info(component_id) + .ok_or_else(|| { + ScriptError::new_runtime_error(format!( + "Component does not exist: {:?}", + component_id + )) + })?; + + if entity.contains_id(component_id) { + Ok(Some(ReflectReference { + base: ReflectBaseType { + type_id: component_info + .type_id() + .expect("Component does not have type id"), + base_id: ReflectBase::Component(entity.id(), component_id), + }, + reflect_path: Default::default(), + })) + } else { + Ok(None) + } + } + + pub fn has_component(&self, entity: Entity, component_id: ComponentId) -> ScriptResult { + let entity = self.cell.get_entity(entity).ok_or_else(|| { + ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) + })?; + + Ok(entity.contains_id(component_id)) + } + + pub fn remove_component( + &self, + entity: Entity, + registration: ScriptTypeRegistration, + ) -> ScriptResult<()> { + let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + "Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", + registration.type_info().type_path() + )))?; + + // TODO: this shouldn't need entire world access it feels + if let Some(world) = self.get_whole_world_access() { + let mut entity = world.get_entity_mut(entity).map_err(|e| { + ScriptError::new_runtime_error(format!( + "Could not retrieve entity: {:?}. {e}", + entity + )) + })?; + + component_data.remove(&mut entity); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + Ok(()) + } + + pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult { + let component_info = self + .cell + .components() + .get_info(resource_id) + .ok_or_else(|| { + ScriptError::new_runtime_error(format!( + "Resource does not exist: {:?}", + resource_id + )) + })?; + + Ok(ReflectReference { + base: ReflectBaseType { + type_id: component_info + .type_id() + .expect("Resource does not have type id"), + base_id: ReflectBase::Resource(resource_id), + }, + reflect_path: Default::default(), + }) + } + + pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { + let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + "Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", + registration.type_info().type_path() + )))?; + + // TODO: this shouldn't need entire world access it feels + if let Some(world) = self.get_whole_world_access() { + component_data.remove(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + Ok(()) + } + + pub fn has_resource(&self, resource_id: ComponentId) -> bool { + self.cell.components().get_info(resource_id).is_some() + } + + pub fn get_children(&self, entity: Entity) -> ScriptResult> { + let access = self + .get_component_access_typed::() + .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); + + Ok(self + .get_component_with_access::(&access, entity)? + .map(|c| c.to_vec()) + .unwrap_or_default()) + } + + pub fn get_parent(&self, entity: Entity) -> ScriptResult> { + let access = self + .get_component_access_typed::() + .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); + + Ok(self + .get_component_with_access::(&access, entity)? + .map(|c| c.get())) + } + + pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + if let Some(world) = self.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(parent).add_children(children); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + if let Some(world) = self.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(parent).remove_children(children); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn insert_children( + &self, + parent: Entity, + index: usize, + children: &[Entity], + ) -> ScriptResult<()> { + if let Some(world) = self.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(parent).insert_children(index, children); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn despawn_recursive(&self, entity: Entity) -> ScriptResult<()> { + if let Some(world) = self.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(entity).despawn_recursive(); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn despawn(&self, entity: Entity) -> ScriptResult<()> { + if let Some(world) = self.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(entity).despawn(); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + + Ok(()) + } + + pub fn despawn_descendants(&self, entity: Entity) -> ScriptResult<()> { + if let Some(world) = self.get_whole_world_access() { + let mut queue = CommandQueue::default(); + let mut commands = Commands::new(&mut queue, world); + commands.entity(entity).despawn_descendants(); + queue.apply(world); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + Ok(()) } } @@ -1204,18 +1213,20 @@ mod test_api { use super::*; fn get_reg(world: &WorldCallbackAccess, name: &str) -> ScriptTypeRegistration { - world.get_type_by_name(name).expect("Type not found") + world + .get_type_by_name(name.to_owned()) + .expect("Type not found") } fn test_comp_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { world - .get_type_by_name("TestComponent") + .get_type_by_name("TestComponent".to_owned()) .expect("Component not found") } fn test_resource_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { world - .get_type_by_name("TestResource") + .get_type_by_name("TestResource".to_owned()) .expect("Resource not found") } @@ -1223,8 +1234,8 @@ mod test_api { fn test_get_type_by_name() { let (mut world, _, _) = setup_world(|_, _| {}); WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = world.get_type_by_name("TestComponent").unwrap(); - let resource_reg = world.get_type_by_name("TestResource").unwrap(); + let comp_reg = world.get_type_by_name("TestComponent".to_owned()).unwrap(); + let resource_reg = world.get_type_by_name("TestResource".to_owned()).unwrap(); assert_eq!( comp_reg.type_info().type_id(), @@ -1241,8 +1252,8 @@ mod test_api { fn test_get_type_by_name_invalid() { let (mut world, _, _) = setup_world(|_, _| {}); WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = world.get_type_by_name("x"); - let resource_reg = world.get_type_by_name("z"); + let comp_reg = world.get_type_by_name("x".to_owned()); + let resource_reg = world.get_type_by_name("z".to_owned()); assert!(comp_reg.is_none()); assert!(resource_reg.is_none()); diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index ad1113489a..9bcdc9127c 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -113,7 +113,7 @@ impl ScriptError { pub fn with_context(self, context: S) -> Self { Self(Arc::new(ScriptErrorInner { script: self.0.script.clone(), - kind: self.0.kind.clone(), + kind: self.0.kind, context: context.to_string(), reason: self.0.reason.clone(), })) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs index edee3cc14b..f811639338 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs @@ -161,7 +161,7 @@ macro_rules! impl_lua_unproxy { guard: &WorldAccessGuard<'w>, accesses: &'o [WorldAccessUnit<'w>], type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, + allocator: &ReflectAllocator, ) -> ScriptResult> { self.0 .unproxy_with_world(guard, accesses, type_registry, allocator) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 846f412974..1c52f6145a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -391,22 +391,30 @@ mod test { let _val = val.unproxy().unwrap(); } - fn lua_tests() -> Vec<(&'static str, &'static str)> { + fn lua_tests() -> Vec<(&'static str, &'static str, u32)> { vec![ ( "get_type_by_name with unregistered type returns nothing", " assert(world:get_type_by_name('UnregisteredType') == nil) ", + line!(), ), ( - "get_type_by_name with registered type returns type", + "get_type_by_name with registered type returns correct type", " local type = world:get_type_by_name('TestComponent') - assert(type ~= nil) - assert(type.type_name == 'TestComponent') - assert(type.short_name == 'TestComponent') + + local expected = { + type_name = 'bevy_mod_scripting_lua::bindings::world::test::TestComponent', + short_name = 'TestComponent', + } + + assert(type ~= nil, 'Type not found') + assert(type.type_name == expected.type_name, 'type_name mismatch, expected: ' .. expected.type_name .. ', got: ' .. type.type_name) + assert(type.short_name == expected.short_name, 'short_name mismatch, expected: ' .. expected.short_name .. ', got: ' .. type.short_name) ", + line!(), ), ] } @@ -417,10 +425,16 @@ mod test { #[derive(Resource, Debug, Clone, Reflect)] pub struct TestResource(String); - /// Initializes test world for scripts + /// Initializes test world for tests fn init_world() -> World { let mut world = World::default(); - world.init_resource::(); + let type_registry = AppTypeRegistry::default(); + { + let mut type_registry = type_registry.write(); + type_registry.register::(); + type_registry.register::(); + } + world.insert_resource(type_registry); world.init_resource::(); // add some entities world.spawn(TestComponent("Hello".to_string())); @@ -432,15 +446,21 @@ mod test { fn world_lua_api_tests() { // use lua assertions to test the api - for (test_name, code) in lua_tests() { + for (test_name, code, line) in lua_tests() { let lua = Lua::new(); let mut world = init_world(); WorldCallbackAccess::with_callback_access(&mut world, |world| { lua.globals().set("world", LuaWorld(world.clone())).unwrap(); let code = lua.load(code); + // ide friendly link to test, i.e. crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:139 + let filename = file!(); + let test_hyperlink = format!("{filename}:{line}"); code.exec() - .map_err(|e| panic!("Failed lua test: {test_name}. Error: {e}")); + .inspect_err(|e| { + panic!("Failed lua test: `{test_name}` at: {test_hyperlink}. Error: {e}") + }) + .unwrap(); }); } } From 8a36f8fe3071b85f35b76313651936ed0dab2545 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 13:09:19 +0000 Subject: [PATCH 013/217] Lua integration tests with some of the API's working! --- .rustfmt.toml | 5 + Cargo.toml | 2 + crates/bevy_mod_scripting_core/Cargo.toml | 3 + .../src/bindings/query.rs | 46 ++- .../src/bindings/reference.rs | 31 +- .../src/bindings/world.rs | 368 +++++++++--------- crates/bevy_mod_scripting_derive/src/lib.rs | 67 ++-- .../bevy_mod_scripting_lua/Cargo.toml | 8 + .../src/bindings/proxy.rs | 9 +- .../src/bindings/reference.rs | 21 +- .../src/bindings/type_registration.rs | 2 +- .../src/bindings/world.rs | 166 ++------ .../bevy_mod_scripting_lua/src/lib.rs | 36 +- ...t_no_default_or_from_world_data_errors.lua | 9 + ...efault_and_component_data_adds_default.lua | 9 + ..._with_default_no_component_data_errors.lua | 10 + ..._world_and_component_data_adds_default.lua | 9 + ...th_from_world_no_component_data_errors.lua | 10 + .../component_with_component_data.lua | 3 + .../registered_type_returns_correct_type.lua | 10 + .../unregistered_type_returns_nothing.lua | 1 + .../bevy_mod_scripting_lua/tests/lua_tests.rs | 151 +++++++ makefile | 8 +- 23 files changed, 587 insertions(+), 397 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/unregistered_type_returns_nothing.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs diff --git a/.rustfmt.toml b/.rustfmt.toml index 6e65172c8d..9a5f6e52a8 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -1,3 +1,8 @@ # max_width = 60 # use_small_heuristics = "Max" # format_generated_files = false + +reorder_imports = true +# currently unsupported but want them in when stable +imports_granularity = "Crate" +group_imports = "StdExternalCrate" diff --git a/Cargo.toml b/Cargo.toml index 833ae934bf..c924731e43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,6 +73,7 @@ bevy_script_api = { path = "crates/bevy_script_api", version = "0.8.0-alpha.1", 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.1" } bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.1" } +test_utils = { path = "crates/test_utils" } [dev-dependencies] bevy = { workspace = true, default-features = true } @@ -93,6 +94,7 @@ members = [ "crates/languages/bevy_mod_scripting_rune", "crates/bevy_mod_scripting_common", "crates/bevy_mod_scripting_derive", + "crates/test_utils", ] resolver = "2" exclude = ["crates/bevy_api_gen", "crates/macro_tests"] diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index ece7a115a2..c2bb18dcb8 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -27,3 +27,6 @@ paste = "1.0.7" parking_lot = "0.12.1" lockable = "0.0.8" smallvec = "1.11" + +[dev-dependencies] +test_utils = { workspace = true } diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 5a7db18a45..05f728a300 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -1,56 +1,60 @@ +use super::{ReflectReference, WorldCallbackAccess}; +use crate::prelude::ScriptResult; +use bevy::{ + ecs::{component::ComponentId, entity::Entity}, + reflect::TypeRegistration, +}; use std::{any::TypeId, ops::Deref, sync::Arc}; -use bevy::{ecs::entity::Entity, reflect::TypeRegistration}; - -use super::{ReflectReference, WorldCallbackAccess, STALE_WORLD_MSG}; -use crate::prelude::{ScriptError, ScriptResult}; - /// A wrapper around a `TypeRegistration` that provides additional information about the type. /// /// This is used as a hook to a rust type from a scripting language. We should be able to easily convert between a type name and a [`ScriptTypeRegistration`]. #[derive(Clone)] -pub struct ScriptTypeRegistration(pub(crate) Arc); +pub struct ScriptTypeRegistration { + pub(crate) registration: Arc, + pub component_id: Option, +} impl ScriptTypeRegistration { - pub fn new(arc: Arc) -> Self { - Self(arc) + pub fn new(registration: Arc, component_id: Option) -> Self { + Self { + registration, + component_id, + } } #[inline(always)] pub fn short_name(&self) -> &str { - self.0.type_info().type_path_table().short_path() + self.registration.type_info().type_path_table().short_path() } #[inline(always)] pub fn type_name(&self) -> &'static str { - self.0.type_info().type_path_table().path() + self.registration.type_info().type_path_table().path() } #[inline(always)] pub fn type_id(&self) -> TypeId { - self.0.type_info().type_id() + self.registration.type_info().type_id() + } + + #[inline(always)] + pub fn component_id(&self) -> Option { + self.component_id } } impl std::fmt::Debug for ScriptTypeRegistration { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_tuple("ScriptTypeRegistration") - .field(&self.0.type_info().type_path()) + .field(&self.registration.type_info().type_path()) .finish() } } impl std::fmt::Display for ScriptTypeRegistration { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(self.0.type_info().type_path()) - } -} - -impl Deref for ScriptTypeRegistration { - type Target = Arc; - - fn deref(&self) -> &Self::Target { - &self.0 + f.write_str(self.registration.type_info().type_path()) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 952b50afeb..df7356e356 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -28,7 +28,8 @@ use bevy::{ }, ptr::Ptr, reflect::{ - Access, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, TypeInfo, TypeRegistry + Access, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, + TypeInfo, TypeRegistry, }, }; use smallvec::SmallVec; @@ -59,7 +60,6 @@ pub struct ReflectReference { struct UnregisteredType; impl ReflectReference { - pub fn new_allocated( value: T, allocator: &mut ReflectAllocator, @@ -269,7 +269,8 @@ impl ReflectReference { allocator: Option<&ReflectAllocator>, ) -> ScriptResult<&'w mut dyn PartialReflect> { if let ReflectBase::Owned(id) = &self.base.base_id { - let allocator = allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; + let allocator = + allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; let arc = allocator .get_mut(*id) @@ -318,7 +319,10 @@ impl ReflectReference { Ok(current) } - fn walk_path_mut<'a>(&self, root: &'a mut dyn PartialReflect) -> ScriptResult<&'a mut dyn PartialReflect> { + fn walk_path_mut<'a>( + &self, + root: &'a mut dyn PartialReflect, + ) -> ScriptResult<&'a mut dyn PartialReflect> { let mut current = root; for elem in self.reflect_path.iter() { current = elem @@ -428,8 +432,12 @@ impl ReflectionPathElem { impl From<(A, B)> for DeferredReflection where - A: Fn(&dyn PartialReflect) -> Result<&dyn PartialReflect, ReflectPathError<'static>> + Send + Sync, - B: Fn(&mut dyn PartialReflect) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> + Send + Sync, + A: Fn(&dyn PartialReflect) -> Result<&dyn PartialReflect, ReflectPathError<'static>> + + Send + + Sync, + B: Fn(&mut dyn PartialReflect) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> + + Send + + Sync, { fn from((get, get_mut): (A, B)) -> Self { Self { @@ -476,10 +484,15 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { /// A ReflectPath which can perform arbitrary operations on the root object to produce a sub-reference #[derive(Clone)] pub struct DeferredReflection { - pub get: - Arc Result<&dyn PartialReflect, ReflectPathError<'static>> + Send + Sync>, + pub get: Arc< + dyn Fn(&dyn PartialReflect) -> Result<&dyn PartialReflect, ReflectPathError<'static>> + + Send + + Sync, + >, pub get_mut: Arc< - dyn Fn(&mut dyn PartialReflect) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> + dyn Fn( + &mut dyn PartialReflect, + ) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> + Send + Sync, >, diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 6b590bbab9..773619b9a7 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -4,17 +4,14 @@ //! reflection gives us access to `dyn PartialReflect` objects via their type name, //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. -use lockable::LockableHashMap; +use lockable::{LockableHashMap, SyncLimit}; use std::{ any::TypeId, - cell::UnsafeCell, - error::Error, fmt::Debug, marker::PhantomData, - ops::Index, sync::{ - atomic::{AtomicBool, AtomicUsize, Ordering}, + atomic::{AtomicUsize, Ordering}, Arc, Weak, }, time::Duration, @@ -22,7 +19,6 @@ use std::{ use bevy::{ ecs::{ - change_detection::MutUntyped, component::{Component, ComponentId}, entity::Entity, reflect::{AppTypeRegistry, ReflectComponent, ReflectFromWorld, ReflectResource}, @@ -30,17 +26,13 @@ use bevy::{ world::{unsafe_world_cell::UnsafeWorldCell, CommandQueue, Mut, World}, }, hierarchy::{BuildChildren, Children, DespawnRecursiveExt, Parent}, - ptr::Ptr, - reflect::{ - std_traits::ReflectDefault, Access, ParsedPath, Reflect, ReflectFromPtr, ReflectPath, - ReflectPathError, TypeInfo, TypePath, TypeRegistration, TypeRegistry, - }, + reflect::{std_traits::ReflectDefault, TypeRegistry}, }; use smallvec::SmallVec; use crate::{ - bindings::{ReflectAllocation, ReflectAllocationId}, + bindings::ReflectAllocationId, prelude::{ReflectAllocator, ScriptError, ScriptResult}, }; @@ -135,6 +127,11 @@ pub(crate) const CONCURRENT_ACCESS_MSG: &str = /// common world methods, see: /// - [`crate::bindings::query`] for query related functionality impl WorldCallbackAccess { + pub fn spawn(&self) -> Entity { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + world.spawn() + } + // TODO: uses `String` for type_name to avoid lifetime issues with types proxying this via macros pub fn get_type_by_name(&self, type_name: String) -> Option { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); @@ -261,6 +258,24 @@ impl<'w> WorldAccessGuard<'w> { } } + /// Purely debugging utility to list all accesses currently held. + pub fn list_accesses(&self) -> Vec { + let keys = self.accesses.keys_with_entries_or_locked(); + + // return only those which have no value + keys.into_iter() + .filter(|k| { + let val = self + .accesses + .blocking_lock(*k, SyncLimit::no_limit()) + .unwrap(); + let val = val.value().unwrap(); + + val.is_none() + }) + .collect() + } + /// Retrieves the underlying unsafe world cell, with no additional guarantees of safety /// proceed with caution and only use this if you understand what you're doing pub fn as_unsafe_world_cell(&self) -> UnsafeWorldCell<'w> { @@ -273,6 +288,14 @@ impl<'w> WorldAccessGuard<'w> { self.cell } + /// Gets the component id of the given component or resource + pub fn get_component_id(&self, id: TypeId) -> Option { + let components = self.cell.components(); + components + .get_id(id) + .or_else(|| components.get_resource_id(id)) + } + /// Checks nobody else is currently accessing the world, and if so locks access to it until /// [`release_whole_world_access`] is called. pub fn get_whole_world_access(&self) -> Option<&mut World> { @@ -463,6 +486,11 @@ impl<'w> WorldAccessGuard<'w> { O::proxy_with_allocator(out, &mut allocator) })?; + // make sure to release all accesses + world_acceses.drain(..).for_each(|a| { + self.release_access(a); + }); + Ok(proxied_output) } @@ -563,13 +591,26 @@ impl<'w> WorldAccessGuard<'w> { /// Impl block for higher level world methods impl<'w> WorldAccessGuard<'w> { + pub fn spawn(&self) -> Entity { + if let Some(world) = self.get_whole_world_access() { + world.spawn_empty().id() + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + } + pub fn get_type_by_name(&self, type_name: String) -> Option { - self.with_resource(|_, registry: Mut| { + self.with_resource(|world, registry: Mut| { let registry = registry.read(); registry .get_with_short_type_path(&type_name) .or_else(|| registry.get_with_type_path(&type_name)) - .map(|registration| ScriptTypeRegistration::new(Arc::new(registration.clone()))) + .map(|registration| { + ScriptTypeRegistration::new( + Arc::new(registration.clone()), + world.get_component_id(registration.type_id()), + ) + }) }) } @@ -578,15 +619,16 @@ impl<'w> WorldAccessGuard<'w> { entity: Entity, registration: ScriptTypeRegistration, ) -> ScriptResult<()> { - let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + let component_data = registration.registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( "Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", - registration.type_info().type_path() + registration.registration.type_info().type_path() )))?; // we look for ReflectDefault or ReflectFromWorld data then a ReflectComponent data - let instance = if let Some(default_td) = registration.data::() { + let instance = if let Some(default_td) = registration.registration.data::() + { default_td.default() - } else if let Some(from_world_td) = registration.data::() { + } else if let Some(from_world_td) = registration.registration.data::() { if let Some(world) = self.get_whole_world_access() { from_world_td.from_world(world) } else { @@ -595,7 +637,7 @@ impl<'w> WorldAccessGuard<'w> { } else { return Err(ScriptError::new_runtime_error(format!( "Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", - registration.type_info().type_path() + registration.registration.type_info().type_path() ))); }; @@ -670,9 +712,9 @@ impl<'w> WorldAccessGuard<'w> { entity: Entity, registration: ScriptTypeRegistration, ) -> ScriptResult<()> { - let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + let component_data = registration.registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( "Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", - registration.type_info().type_path() + registration.registration.type_info().type_path() )))?; // TODO: this shouldn't need entire world access it feels @@ -715,9 +757,9 @@ impl<'w> WorldAccessGuard<'w> { } pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { - let component_data = registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( + let component_data = registration.registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( "Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", - registration.type_info().type_path() + registration.registration.type_info().type_path() )))?; // TODO: this shouldn't need entire world access it feels @@ -894,70 +936,45 @@ impl<'w> WorldAccessWrite<'w> { #[cfg(test)] mod test { + use crate::bindings::ScriptTypeRegistration; + use crate::prelude::ScriptErrorKind; + use bevy::ecs::system::Commands; + use bevy::hierarchy::BuildChildren; + use bevy::reflect::{ParsedPath, Reflect}; - use std::{any::Any, cell::UnsafeCell, convert::identity, sync::RwLock}; + use super::*; + use std::any::TypeId; use crate::{ + bindings::ReflectAllocator, bindings::{ DeferredReflection, ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, }, - bindings::{ReflectAllocation, ReflectAllocator}, }; - use super::*; - use bevy::{ - ecs::{component::Component, reflect::ReflectResource, system::Resource, world::World}, - reflect::TypeRegistryArc, + use bevy::ecs::world::World; + use test_utils::test_data::{ + setup_world, CompWithFromWorld, GetTestComponentId, TestComponent, TestResource, }; - #[derive(Component, Reflect, PartialEq, Eq, Debug)] - #[reflect(Component)] - pub(crate) struct TestComponent { - pub strings: Vec, - } - - #[derive(Resource, Reflect, Default, PartialEq, Eq, Debug)] - #[reflect(Resource)] - pub(crate) struct TestResource { - pub bytes: Vec, - } - - pub(crate) fn setup_world( - init: F, - ) -> (World, ComponentId, ComponentId) { - let mut world = World::default(); - let allocator = ReflectAllocator::default(); - - let component_id = world.register_component::(); - let resource_id = world.init_resource::(); - - let mut type_registry = TypeRegistry::new(); - type_registry.register::(); - type_registry.register::(); - - init(&mut world, &mut type_registry); - - world.insert_resource(allocator); - - world.insert_resource(AppTypeRegistry(TypeRegistryArc { - internal: Arc::new(RwLock::new(type_registry)), - })); - - (world, component_id, resource_id) + fn init_world() -> World { + setup_world(|w, _| { + w.init_resource::(); + }) } /// Tests that the given ref_ can be accessed and the value is as expected and access is released correctly (not for allocated values) fn assert_access_yields< O: Reflect + PartialEq + Debug, - F: FnOnce(&mut World, ComponentId, ComponentId) -> ReflectReference, - G: FnOnce(&WorldAccessGuard, ComponentId, ComponentId), + F: FnOnce(&mut World) -> ReflectReference, + G: FnOnce(&WorldAccessGuard), >( init: F, post_check: G, expected: O, ) { - let (mut world, component_id, resource_id) = setup_world(|_, _| {}); - let ref_ = init(&mut world, component_id, resource_id); + let mut world = init_world(); + let ref_ = init(&mut world); WorldCallbackAccess::with_callback_access(&mut world, |world| { let world = world.read().unwrap(); @@ -985,31 +1002,35 @@ mod test { }); assert!( - world.get_component_access(component_id).is_some(), + world + .get_component_access(TestComponent::test_component_id()) + .is_some(), "access to component was not release correctly" ); assert!( - world.get_resource_access(resource_id).is_some(), + world + .get_resource_access(TestResource::test_component_id()) + .is_some(), "access to component was not release correctly" ); - post_check(&world, component_id, resource_id); + post_check(&world); }); } /// Tests that setting to the expected value works as well as follow up reads give the expected value fn assert_set_then_get_yields< O: Reflect + PartialEq + Debug + Clone, - F: FnOnce(&mut World, ComponentId, ComponentId) -> ReflectReference, - G: FnOnce(&WorldAccessGuard, ComponentId, ComponentId), + F: FnOnce(&mut World) -> ReflectReference, + G: FnOnce(&WorldAccessGuard), >( init: F, post_check: G, expected: O, ) { - let (mut world, component_id, resource_id) = setup_world(|_, _| {}); - let ref_ = init(&mut world, component_id, resource_id); + let mut world = init_world(); + let ref_ = init(&mut world); WorldCallbackAccess::with_callback_access(&mut world, |world| { let world = world.read().unwrap(); // test set @@ -1055,13 +1076,13 @@ mod test { }) }) }); - post_check(&world, component_id, resource_id); + post_check(&world); }); } #[test] fn test_component_access() { - let init = |world: &mut World, component_id, _| { + let init = |world: &mut World| { let entity = world .spawn(TestComponent { strings: vec![String::from("initial")], @@ -1070,7 +1091,7 @@ mod test { ReflectReference { base: ReflectBaseType { - base_id: ReflectBase::Component(entity, component_id), + base_id: ReflectBase::Component(entity, TestComponent::test_component_id()), type_id: TypeId::of::(), }, reflect_path: vec![ @@ -1089,18 +1110,18 @@ mod test { } }; - assert_access_yields(init, |_, _, _| {}, String::from("initial")); - assert_set_then_get_yields(init, |_, _, _| {}, String::from("set")); + assert_access_yields(init, |_| {}, String::from("initial")); + assert_set_then_get_yields(init, |_| {}, String::from("set")); } #[test] fn test_resource_access() { - let init = |world: &mut World, _, resource_id| { + let init = |world: &mut World| { world.insert_resource(TestResource { bytes: vec![42u8] }); ReflectReference { base: ReflectBaseType { - base_id: ReflectBase::Resource(resource_id), + base_id: ReflectBase::Resource(TestResource::test_component_id()), type_id: TypeId::of::(), }, reflect_path: vec![ @@ -1118,13 +1139,13 @@ mod test { ], } }; - assert_access_yields(init, |_, _, _| {}, 42u8); - assert_set_then_get_yields(init, |_, _, _| {}, 69u8); + assert_access_yields(init, |_| {}, 42u8); + assert_set_then_get_yields(init, |_| {}, 69u8); } #[test] fn test_script_alloc_access() { - let init = |world: &mut World, _, _| { + let init = |world: &mut World| { let mut script_allocator = ReflectAllocator::default(); let mut ref_ = ReflectReference::new_allocated( TestComponent { @@ -1146,7 +1167,7 @@ mod test { world.insert_resource(script_allocator); ref_ }; - let post_check = |world: &WorldAccessGuard, _, _| { + let post_check = |world: &WorldAccessGuard| { assert!( world .get_allocation_access(ReflectAllocationId(0)) @@ -1197,20 +1218,6 @@ mod test { guard.release_access(access); assert_eq!(0, guard.accesses_count.load(Ordering::Relaxed)); } -} - -#[cfg(test)] -mod test_api { - use bevy::ecs::system::Commands; - use bevy::ecs::world::FromWorld; - use bevy::hierarchy::BuildChildren; - - use crate::bindings::ScriptTypeRegistration; - use crate::prelude::{ScriptErrorInner, ScriptErrorKind}; - - use super::test::{setup_world, TestComponent, TestResource}; - - use super::*; fn get_reg(world: &WorldCallbackAccess, name: &str) -> ScriptTypeRegistration { world @@ -1232,17 +1239,17 @@ mod test_api { #[test] fn test_get_type_by_name() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); WorldCallbackAccess::with_callback_access(&mut world, |world| { let comp_reg = world.get_type_by_name("TestComponent".to_owned()).unwrap(); let resource_reg = world.get_type_by_name("TestResource".to_owned()).unwrap(); assert_eq!( - comp_reg.type_info().type_id(), + comp_reg.registration.type_info().type_id(), std::any::TypeId::of::() ); assert_eq!( - resource_reg.type_info().type_id(), + resource_reg.registration.type_info().type_id(), std::any::TypeId::of::() ); }); @@ -1250,7 +1257,8 @@ mod test_api { #[test] fn test_get_type_by_name_invalid() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { let comp_reg = world.get_type_by_name("x".to_owned()); let resource_reg = world.get_type_by_name("z".to_owned()); @@ -1262,19 +1270,7 @@ mod test_api { #[test] fn test_add_default_component_from_world() { - #[derive(Reflect, Component, PartialEq, Debug)] - #[reflect(FromWorld, Component)] - struct CompWithFromWorld(pub String); - impl FromWorld for CompWithFromWorld { - fn from_world(_: &mut World) -> Self { - Self(String::from("FromWorld")) - } - } - - let (mut world, _, _) = setup_world(|w, r| { - w.register_component::(); - r.register::(); - }); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1291,20 +1287,7 @@ mod test_api { #[test] fn test_add_default_component_default() { - #[derive(Reflect, Component, PartialEq, Debug)] - #[reflect(Default, Component)] - struct CompWithFromWorld(pub String); - - impl Default for CompWithFromWorld { - fn default() -> Self { - Self(String::from("Default")) - } - } - - let (mut world, _, _) = setup_world(|w, r| { - w.register_component::(); - r.register::(); - }); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1321,14 +1304,7 @@ mod test_api { #[test] fn test_add_default_component_missing_from_world_and_default() { - #[derive(Reflect, Component, PartialEq, Debug)] - #[reflect(Component)] - struct CompWithFromWorld(pub String); - - let (mut world, _, _) = setup_world(|w, r| { - w.register_component::(); - r.register::(); - }); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1340,7 +1316,7 @@ mod test_api { } Err(ScriptError(inner)) => { assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); - assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", comp_reg.type_info().type_path())); + assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", comp_reg.registration.type_info().type_path())); } } }); @@ -1348,20 +1324,7 @@ mod test_api { #[test] fn test_add_default_component_missing_component_data() { - #[derive(Reflect, Component, PartialEq, Debug)] - #[reflect(Default)] - struct CompWithFromWorld(pub String); - - impl Default for CompWithFromWorld { - fn default() -> Self { - Self(String::from("Default")) - } - } - - let (mut world, _, _) = setup_world(|w, r| { - w.register_component::(); - r.register::(); - }); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1373,7 +1336,7 @@ mod test_api { } Err(ScriptError(inner)) => { assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); - assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", comp_reg.type_info().type_path())); + assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", comp_reg.registration.type_info().type_path())); } } }); @@ -1381,17 +1344,21 @@ mod test_api { #[test] fn test_get_component_existing() { - let (mut world, comp_id, _) = setup_world(|_, _| {}); + let mut world = init_world(); + let entity = world.spawn(TestComponent { strings: vec![] }).id(); WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world.get_component(entity, comp_id).unwrap().unwrap(); + let comp_ref = world + .get_component(entity, TestComponent::test_component_id()) + .unwrap() + .unwrap(); assert_eq!( comp_ref, ReflectReference { base: ReflectBaseType { type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Component(entity, comp_id), + base_id: ReflectBase::Component(entity, TestComponent::test_component_id()), }, reflect_path: Default::default(), } @@ -1401,21 +1368,25 @@ mod test_api { #[test] fn test_get_component_missing() { - let (mut world, comp_id, _) = setup_world(|_, _| {}); + let mut world = init_world(); + let entity = world.spawn_empty().id(); WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world.get_component(entity, comp_id).unwrap(); + let comp_ref = world + .get_component(entity, TestComponent::test_component_id()) + .unwrap(); assert_eq!(comp_ref, None); }); } #[test] fn test_get_component_missing_entity() { - let (mut world, comp_id, _) = setup_world(|_, _| {}); + let mut world = init_world(); WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world.get_component(Entity::from_raw(0), comp_id); + let comp_ref = + world.get_component(Entity::from_raw(0), TestComponent::test_component_id()); match comp_ref { Ok(_) => { panic!("Expected error") @@ -1430,7 +1401,7 @@ mod test_api { #[test] fn test_get_component_unregistered_component() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let entity = world.spawn_empty().id(); let fake_id = ComponentId::new(999); @@ -1454,7 +1425,7 @@ mod test_api { #[test] fn test_remove_component() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let entity = world .spawn(TestComponent { @@ -1476,7 +1447,7 @@ mod test_api { #[test] fn test_remove_component_empty_idempotent() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1494,7 +1465,7 @@ mod test_api { #[test] fn test_remove_component_missing_comp_registration() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1506,7 +1477,10 @@ mod test_api { } Err(e) => { assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!(e.reason.to_string(), format!("Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", test_resource_reg(world).type_info().type_path())); + assert_eq!( + e.reason.to_string(), + format!("Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", test_resource_reg(world).registration.type_info().type_path()) + ); } } }); @@ -1519,7 +1493,8 @@ mod test_api { #[test] fn test_remove_component_missing_entity() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); + let fake_entity = Entity::from_raw(0); WorldCallbackAccess::with_callback_access(&mut world, |world| { @@ -1538,17 +1513,20 @@ mod test_api { #[test] fn test_get_resource_existing() { - let (mut world, _, resource_id) = setup_world(|_, _| {}); + let mut world = init_world(); + world.insert_resource(TestResource { bytes: vec![1] }); WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world.get_resource(resource_id).unwrap(); + let comp_ref = world + .get_resource(TestResource::test_component_id()) + .unwrap(); assert_eq!( comp_ref, ReflectReference { base: ReflectBaseType { type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Resource(resource_id), + base_id: ReflectBase::Resource(TestResource::test_component_id()), }, reflect_path: Default::default(), } @@ -1558,7 +1536,8 @@ mod test_api { #[test] fn test_get_resource_non_existing() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); + let fake_comp = ComponentId::new(999); WorldCallbackAccess::with_callback_access(&mut world, |world| { let comp_ref = world.get_resource(fake_comp); @@ -1577,7 +1556,7 @@ mod test_api { #[test] fn test_remove_resource() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); world.insert_resource(TestResource { bytes: vec![1] }); @@ -1590,7 +1569,7 @@ mod test_api { #[test] fn test_remove_resource_missing_idempotent() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); world.remove_resource::(); @@ -1603,14 +1582,14 @@ mod test_api { #[test] fn test_remove_resource_missing_resource_registration() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); WorldCallbackAccess::with_callback_access(&mut world, |world| { match world.remove_resource(test_comp_reg(world)) { Ok(_) => panic!("Expected error"), Err(e) => { assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!(e.reason.to_string(), format!("Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", test_comp_reg(world).type_info().type_path())); + assert_eq!(e.reason.to_string(), format!("Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", test_comp_reg(world).registration.type_info().type_path())); } } }); @@ -1618,26 +1597,26 @@ mod test_api { #[test] fn test_has_resource_existing() { - let (mut world, _, res_reg) = setup_world(|_, _| {}); + let mut world = init_world(); WorldCallbackAccess::with_callback_access(&mut world, |world| { - assert!(world.has_resource(res_reg)); + assert!(world.has_resource(TestResource::test_component_id())); }); } #[test] fn test_has_resource_missing() { - let (mut world, _, res_reg) = setup_world(|_, _| {}); + let mut world = init_world(); world.remove_resource::(); WorldCallbackAccess::with_callback_access(&mut world, |world| { - assert!(world.has_resource(res_reg)); + assert!(world.has_resource(TestResource::test_component_id())); }); } #[test] fn test_get_children_1_child() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1658,7 +1637,7 @@ mod test_api { expected = "Component not registered: `bevy_hierarchy::components::children::Children`" )] fn test_get_children_children_component_unregistered() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); @@ -1669,7 +1648,7 @@ mod test_api { #[test] fn test_get_children_no_children() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); world.register_component::(); let parent = world.spawn_empty().id(); @@ -1682,7 +1661,7 @@ mod test_api { #[test] fn test_get_parent_1_parent() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1699,7 +1678,8 @@ mod test_api { #[test] fn test_get_parent_no_parent() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); + world.register_component::(); let child = world.spawn_empty().id(); @@ -1715,7 +1695,7 @@ mod test_api { expected = "Component not registered: `bevy_hierarchy::components::parent::Parent`" )] fn test_get_parent_parent_component_unregistered() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let child = world.spawn_empty().id(); @@ -1726,7 +1706,7 @@ mod test_api { #[test] fn test_push_children_empty_entity() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1742,7 +1722,7 @@ mod test_api { #[test] fn test_push_children_entity_with_1_child() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1765,7 +1745,7 @@ mod test_api { #[test] fn test_remove_children_entity_with_1_child() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1784,7 +1764,7 @@ mod test_api { #[test] fn test_remove_children_remove_half_children() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1805,7 +1785,7 @@ mod test_api { #[test] fn test_insert_children_empty() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1821,7 +1801,7 @@ mod test_api { #[test] fn test_insert_children_middle() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1848,7 +1828,7 @@ mod test_api { #[test] fn test_despawn_entity() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let entity = world.spawn_empty().id(); @@ -1861,7 +1841,7 @@ mod test_api { #[test] fn test_despawn_recursive() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); @@ -1880,7 +1860,7 @@ mod test_api { #[test] fn test_despawn_descendants() { - let (mut world, _, _) = setup_world(|_, _| {}); + let mut world = init_world(); let parent = world.spawn_empty().id(); let child = world.spawn_empty().id(); diff --git a/crates/bevy_mod_scripting_derive/src/lib.rs b/crates/bevy_mod_scripting_derive/src/lib.rs index 6c932ffc43..62ef0e9e12 100644 --- a/crates/bevy_mod_scripting_derive/src/lib.rs +++ b/crates/bevy_mod_scripting_derive/src/lib.rs @@ -1,14 +1,13 @@ -mod input; +mod input; mod utils; use crate::{input::*, utils::doc_attribute_to_string_lit}; -use std::collections::HashMap; use darling::util::Flag; +use std::collections::HashMap; use syn::{ - spanned::Spanned, Path, Token, TraitItemFn, parse_quote, - parse_macro_input, parse_quote_spanned, DeriveInput, ExprClosure, FnArg, - punctuated::Punctuated + parse_macro_input, parse_quote, parse_quote_spanned, punctuated::Punctuated, spanned::Spanned, + DeriveInput, ExprClosure, FnArg, Path, Token, TraitItemFn, }; use darling::{FromAttributes, FromDeriveInput}; @@ -16,7 +15,6 @@ use proc_macro::TokenStream; use proc_macro2::*; use quote::*; - const SELF_ALIAS: &str = "_self"; const CTXT_ALIAS: &str = "lua"; const PROXY_PREFIX: &str = "Lua"; @@ -26,7 +24,12 @@ const PROXY_PREFIX: &str = "Lua"; /// - instead of a `&mut self` receiver we have a `_self: LuaRefMutProxy` /// - instead of a `self` receiver we have a `_self: ValLuaProxy` /// Returns true if the receiver was changed -fn standardise_receiver(receiver: &mut FnArg, target_type: &Path, bms_lua_path: &Path, proxy_as_type: Option<&Path>) -> bool { +fn standardise_receiver( + receiver: &mut FnArg, + target_type: &Path, + bms_lua_path: &Path, + proxy_as_type: Option<&Path>, +) -> bool { let replacement = if let FnArg::Receiver(receiver) = receiver { let ref_ = &receiver.reference.as_ref().map(|(amp, lifetime)| { quote_spanned! {receiver.span()=> @@ -35,12 +38,12 @@ fn standardise_receiver(receiver: &mut FnArg, target_type: &Path, bms_lua_path: }); let self_ident = syn::Ident::new(SELF_ALIAS, receiver.span()); - let self_ident_type = match proxy_as_type{ + let self_ident_type = match proxy_as_type { Some(target_type) => { quote_spanned! {receiver.span()=> #target_type } - }, + } None => { let unproxy_container_name = match (ref_.is_some(), receiver.mutability.is_some()) { (true, true) => "LuaReflectRefMutProxy", @@ -48,7 +51,7 @@ fn standardise_receiver(receiver: &mut FnArg, target_type: &Path, bms_lua_path: (false, _) => "LuaReflectValProxy", }; let unproxy_ident = syn::Ident::new(unproxy_container_name, receiver.span()); - + quote_spanned! {receiver.span()=> #bms_lua_path::bindings::proxy::#unproxy_ident::<#target_type> } @@ -123,7 +126,6 @@ fn proxy_wrap_function_def( mlua: &Path, attrs: &FunctionAttrs, ) { - // collect all args into tuple and add lua context arg let ctxt_alias = syn::Ident::new(CTXT_ALIAS, f.sig.inputs.span()); @@ -179,8 +181,6 @@ fn proxy_wrap_function_def( } else { Default::default() }; - - // change signature to take in a single args tuple instead of multiple arguments (on top of a context arg) f.sig.inputs = Punctuated::from_iter(vec![ @@ -202,13 +202,16 @@ fn proxy_wrap_function_def( syn::ReturnType::Type(_, ty) => ty.to_token_stream(), }; - // wrap function body in our unwrapping and wrapping logic, ignore pre-existing body let mut fn_call = std::panic::catch_unwind(|| { - match (&f.default, &attrs.as_trait, get_world_callback_access_fn.is_some()) { + match ( + &f.default, + &attrs.as_trait, + get_world_callback_access_fn.is_some(), + ) { (_, _, true) => quote_spanned!(span=> world.#func_name(#(#original_arg_idents),*) - ), + ), (Some(body), _, _) => quote_spanned!(span=> (||{ #body })() ), @@ -249,8 +252,7 @@ fn proxy_wrap_function_def( let mut world = <#bms_lua::bindings::proxy::LuaValProxy<#bms_core::bindings::WorldCallbackAccess> as #bms_core::bindings::Unproxy>::unproxy(&mut world).map_err(#mlua::Error::external)?; let mut world = world.read().ok_or_else(|| #mlua::Error::external("World no longer exists"))?; ) - }; - + }; f.default = Some(parse_quote_spanned! {span=> { @@ -339,10 +341,18 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { let target_type_str = target_type.segments.last().unwrap().ident.to_string(); let proxy_type_ident = match meta.proxy_as_type.as_ref() { Some(proxy_as_type) => proxy_as_type.clone(), - None => meta.proxy_name.unwrap_or_else(|| format_ident!("{PROXY_PREFIX}{}", &target_type_str, span = meta.ident.span())).into(), + None => meta + .proxy_name + .unwrap_or_else(|| { + format_ident!( + "{PROXY_PREFIX}{}", + &target_type_str, + span = meta.ident.span() + ) + }) + .into(), }; - let bms_core = meta.bms_core_path.0; let bms_lua = meta.bms_lua_path.0; let tealr: Path = parse_quote_spanned!(bms_lua.span()=> @@ -444,7 +454,16 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { return None; } - proxy_wrap_function_def(&mut f, &target_type, &bms_core, &bms_lua, meta.get_world_callback_access_fn.as_ref(), meta.proxy_as_type.as_ref(), &mlua, &attrs); + proxy_wrap_function_def( + &mut f, + &target_type, + &bms_core, + &bms_lua, + meta.get_world_callback_access_fn.as_ref(), + meta.proxy_as_type.as_ref(), + &mlua, + &attrs, + ); let name = match &attrs.metamethod { Some(metamethod) => quote_spanned!(metamethod.span()=> @@ -468,9 +487,9 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { #[derive(Clone, Debug, #tealr::mlu::UserData, #tealr::ToTypename)] #vis struct #proxy_type_ident (pub #bms_core::bindings::ReflectReference); ) - }; + }; - let conversions = if let Some(proxy_as_type) = meta.proxy_as_type.as_ref() { + let conversions = if let Some(proxy_as_type) = meta.proxy_as_type.as_ref() { Default::default() } else { quote_spanned!(derive_input.span()=> @@ -488,7 +507,6 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { ) }; - quote_spanned! {meta.ident.span()=> #definition @@ -528,4 +546,3 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { } .into() } - diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index d483005013..5c7bfa10a7 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -53,3 +53,11 @@ anyhow = "1.0.75" uuid = "1.1" smol_str = "0.2.2" smallvec = "1.13" + +[dev-dependencies] +test_utils = { workspace = true } +libtest-mimic = "0.8" + +[[test]] +name = "lua_tests" +harness = false diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs index f811639338..83689e639a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs @@ -42,7 +42,7 @@ impl<'a, T: IntoLuaMulti<'a>, N: ToTypename> IntoLua<'a> for TypenameProxy fn into_lua(self, lua: &'a Lua) -> tealr::mlu::mlua::Result> { self.0 .into_lua_multi(lua) - .map(|mut v| v.pop_front().unwrap()) + .map(|mut v| v.pop_front().unwrap_or_else(|| Value::Nil)) } } @@ -211,6 +211,13 @@ macro_rules! impl_lua_proxy { fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { Ok(Self($as::<$generic,$generic::Proxy>::proxy(value)?)) } + + fn proxy_with_allocator<'i>( + value: Self::Input<'i>, + allocator: &mut bevy_mod_scripting_core::bindings::ReflectAllocator, + ) -> ScriptResult { + Ok(Self($as::<$generic,$generic::Proxy>::proxy_with_allocator(value, allocator)?)) + } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 2f5ce99331..79903d04d2 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -1,4 +1,7 @@ -use std::{any::Any, error::Error}; +use std::{ + any::{Any, TypeId}, + error::Error, +}; use bevy::{ ecs::{reflect::AppTypeRegistry, world::Mut}, @@ -37,18 +40,28 @@ impl LuaReflectReference { world.with_resource(|world, type_registry: Mut| { world.with_resource(|world, allocator: Mut| { let type_registry = type_registry.read(); + // first we need the type id of the pointed to object to figure out how to work with it let type_id = self.0 - .with_reflect(world, &type_registry, Some(&allocator), |r| r.type_id()); - if let Some(type_data) = type_registry.get_type_data::(type_id) + .with_reflect(world, &type_registry, Some(&allocator), |r| { + r.get_represented_type_info().map(|t| t.type_id()) + }); + + // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever + // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. + struct Dummy; + let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); + + if let Some(type_data) = + type_registry.get_type_data::(type_id_or_dummy) { self.0 .with_reflect(world, &type_registry, Some(&allocator), |r| { Ok((type_data.into_value)(r, lua)?) }) } else if let Some(type_data) = - type_registry.get_type_data::(type_id) + type_registry.get_type_data::(type_id_or_dummy) { Ok((type_data.into_proxy)(self.0.clone(), lua)?) } else { diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs index 16955f6a38..eba4c05d81 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs @@ -32,7 +32,7 @@ impl From for LuaTypeRegistration { impl From<&LuaTypeRegistration> for ScriptTypeRegistration { fn from(value: &LuaTypeRegistration) -> Self { - todo!() + value.0.clone() } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 1c52f6145a..9e5a0ccb6b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -54,6 +54,28 @@ impl ToTypename for LuaWorld { impl TealData for LuaWorld { fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut T) { + methods.add_method("_list_accesses", |_, this, ()| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let accesses = world + .list_accesses() + .into_iter() + .map(|v| format!("Access to: {v:?}")) + .collect::>(); + Ok(accesses) + }); + + methods.add_method("spawn", |_, this, ()| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let entity: LuaReflectValProxy = world + .proxy_call((), |()| world.spawn()) + .map_err(mlua::Error::external)?; + Ok(entity) + }); + methods.add_method("get_type_by_name", |_, this, type_name: String| { let world = this.0.read().ok_or_else(|| { mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) @@ -88,14 +110,22 @@ impl TealData for LuaWorld { methods.add_method( "get_component", - |_, this, args: (LuaReflectValProxy, LuaReflectValProxy)| { + |_, + this, + args: ( + LuaReflectValProxy, + LuaValProxy, + )| { let world = this.0.read().ok_or_else(|| { mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) })?; let out: Result>, ErrorProxy> = world .proxy_call(args, |(entity, component_id)| { - world.get_component(entity, component_id) + match component_id.component_id() { + Some(component_id) => world.get_component(entity, component_id), + None => Ok(None), + } }) .map_err(mlua::Error::external)?; @@ -108,13 +138,21 @@ impl TealData for LuaWorld { methods.add_method( "has_component", - |_, this, args: (LuaReflectValProxy, LuaReflectValProxy)| { + |_, + this, + args: ( + LuaReflectValProxy, + LuaValProxy, + )| { let world = this.0.read().ok_or_else(|| { mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) })?; let out: Result> = world - .proxy_call(args, |(entity, component_id)| { - world.has_component(entity, component_id) + .proxy_call(args, |(entity, registration)| { + match registration.component_id() { + Some(component_id) => world.has_component(entity, component_id), + None => Ok(false), + } }) .map_err(mlua::Error::external)?; @@ -347,121 +385,3 @@ impl GetWorld for mlua::Lua { .map_err(mlua::Error::external) } } - -#[cfg(test)] -mod test { - use std::sync::Arc; - - use bevy::{ - app::App, - ecs::world::World, - prelude::{Component, Resource}, - reflect::Reflect, - }; - use bevy_mod_scripting_core::bindings::{ - ReflectAllocator, Unproxy, ValProxy, WorldAccessGuard, - }; - use tealr::mlu::mlua::Lua; - - use super::*; - use crate::bindings::proxy::LuaValProxy; - use tealr::mlu::mlua::IntoLua; - - #[test] - fn test_world_from_to_lua() { - let mut world = World::new(); - let world_access_guard = Arc::new(WorldAccessGuard::new(&mut world)); - let callback_access = unsafe { - bevy_mod_scripting_core::bindings::WorldCallbackAccess::new(Arc::downgrade( - &world_access_guard, - )) - }; - let proxy = LuaValProxy::( - ValProxy::new(LuaWorld(callback_access)), - ); - - let lua = Lua::new(); - let lua_val = proxy.into_lua(&lua).unwrap(); - let mut val = - LuaValProxy::::from_lua( - lua_val, &lua, - ) - .unwrap(); - - let _val = val.unproxy().unwrap(); - } - - fn lua_tests() -> Vec<(&'static str, &'static str, u32)> { - vec![ - ( - "get_type_by_name with unregistered type returns nothing", - " - assert(world:get_type_by_name('UnregisteredType') == nil) - ", - line!(), - ), - ( - "get_type_by_name with registered type returns correct type", - " - local type = world:get_type_by_name('TestComponent') - - local expected = { - type_name = 'bevy_mod_scripting_lua::bindings::world::test::TestComponent', - short_name = 'TestComponent', - } - - assert(type ~= nil, 'Type not found') - assert(type.type_name == expected.type_name, 'type_name mismatch, expected: ' .. expected.type_name .. ', got: ' .. type.type_name) - assert(type.short_name == expected.short_name, 'short_name mismatch, expected: ' .. expected.short_name .. ', got: ' .. type.short_name) - ", - line!(), - ), - ] - } - - #[derive(Component, Debug, Clone, Reflect)] - pub struct TestComponent(String); - - #[derive(Resource, Debug, Clone, Reflect)] - pub struct TestResource(String); - - /// Initializes test world for tests - fn init_world() -> World { - let mut world = World::default(); - let type_registry = AppTypeRegistry::default(); - { - let mut type_registry = type_registry.write(); - type_registry.register::(); - type_registry.register::(); - } - world.insert_resource(type_registry); - world.init_resource::(); - // add some entities - world.spawn(TestComponent("Hello".to_string())); - world.insert_resource(TestResource("World".to_string())); - world - } - - #[test] - fn world_lua_api_tests() { - // use lua assertions to test the api - - for (test_name, code, line) in lua_tests() { - let lua = Lua::new(); - let mut world = init_world(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - lua.globals().set("world", LuaWorld(world.clone())).unwrap(); - - let code = lua.load(code); - // ide friendly link to test, i.e. crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:139 - let filename = file!(); - let test_hyperlink = format!("{filename}:{line}"); - code.exec() - .inspect_err(|e| { - panic!("Failed lua test: `{test_name}` at: {test_hyperlink}. Error: {e}") - }) - .unwrap(); - }); - } - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index b0e4ba6ced..3fac3c6553 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -53,25 +53,29 @@ impl Default for LuaScriptingPlugin { } } +pub fn register_lua_values(app: &mut bevy::prelude::App) { + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); +} + impl Plugin for LuaScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); + register_lua_values(app); } } diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua new file mode 100644 index 0000000000..aa185b18f4 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua @@ -0,0 +1,9 @@ +function Test() + local entity = world:spawn() + local type = world:get_type_by_name('TestComponent') + world:add_default_component(entity, type) +end + +local success,err = pcall(Test) +assert(not success, 'No error thrown') +assert(string.find(tostring(err), 'Does not have ReflectDefault or ReflectFromWorld'), 'Error contains wrong message: ' .. tostring(err)) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua new file mode 100644 index 0000000000..cb7026bdff --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua @@ -0,0 +1,9 @@ +local entity = world:spawn() +local _type = world:get_type_by_name('CompWithDefaultAndComponentData') +world:add_default_component(entity, _type) + +local added = world:has_component(entity, _type) +assert(added ~= nil, 'Component not added') + +local component = world:get_component(entity, _type) +assert(component._1 == "Default", 'Component did not have default value, got: ' .. component._1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua new file mode 100644 index 0000000000..709b6fe706 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua @@ -0,0 +1,10 @@ +function Test() + local entity = world:spawn() + local _type = world:get_type_by_name('CompWithDefault') + + world:add_default_component(entity, _type) +end + +local success,err = pcall(Test) +assert(not success, 'No error thrown') +assert(string.find(tostring(err), 'Does not have ReflectComponent'), 'Error contains wrong message: ' .. tostring(err)) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua new file mode 100644 index 0000000000..797e8ce998 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua @@ -0,0 +1,9 @@ +local entity = world:spawn() +local _type = world:get_type_by_name('CompWithFromWorldAndComponentData') +world:add_default_component(entity, _type) + +local added = world:has_component(entity, _type) +assert(added ~= nil, 'Component not added') + +local component = world:get_component(entity, _type) +assert(component._1 == "Default", 'Component did not have default value, got: ' .. component._1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua new file mode 100644 index 0000000000..777651855a --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua @@ -0,0 +1,10 @@ +function Test() + local entity = world:spawn() + local _type = world:get_type_by_name('CompWithFromWorld') + + world:add_default_component(entity, _type) +end + +local success,err = pcall(Test) +assert(not success, 'No error thrown') +assert(string.find(tostring(err), 'Does not have ReflectComponent'), 'Error contains wrong message: ' .. tostring(err)) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua new file mode 100644 index 0000000000..a519c47e98 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua @@ -0,0 +1,3 @@ +let component = world:get_type_by_name("TestComponent") +world:get_component(entity, component) +// TODO \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua new file mode 100644 index 0000000000..d46f9ad774 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua @@ -0,0 +1,10 @@ +local type = world:get_type_by_name('TestComponent') + +local expected = { + type_name = 'test_utils::test_data::TestComponent', + short_name = 'TestComponent', +} + +assert(type ~= nil, 'Type not found') +assert(type.type_name == expected.type_name, 'type_name mismatch, expected: ' .. expected.type_name .. ', got: ' .. type.type_name) +assert(type.short_name == expected.short_name, 'short_name mismatch, expected: ' .. expected.short_name .. ', got: ' .. type.short_name) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/unregistered_type_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/unregistered_type_returns_nothing.lua new file mode 100644 index 0000000000..bbd1c6f119 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/unregistered_type_returns_nothing.lua @@ -0,0 +1 @@ +assert(world:get_type_by_name('UnregisteredType') == nil, 'Unregistered type was found') diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs new file mode 100644 index 0000000000..c4e6eb8b54 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -0,0 +1,151 @@ +use bevy::{ + app::App, + asset::{AssetPlugin, AssetServer}, + prelude::{AppTypeRegistry, Entity, World}, + MinimalPlugins, +}; +use bevy_mod_scripting_core::{ + bindings::{Proxy, ReflectAllocator, ReflectValProxy, WorldCallbackAccess}, + context::ContextLoadingSettings, + event::CallbackLabel, + script::ScriptId, +}; +use bevy_mod_scripting_lua::{ + bindings::{ + proxy::{LuaProxied, LuaReflectValProxy}, + world::LuaWorld, + }, + lua_context_load, lua_handler, + prelude::{Lua, LuaHookTriggers}, + register_lua_values, LuaScriptingPlugin, ReflectLuaValue, +}; +use libtest_mimic::{Arguments, Failed, Trial}; +use std::{ + any::TypeId, + fs::{self, DirEntry}, + io, + path::{Path, PathBuf}, +}; +use test_utils::test_data::setup_world; + +/// Initializes world for tests +fn init_app() -> App { + let mut app = App::new(); + + let world = setup_world(|_, _| {}); + + *app.world_mut() = world; + + // we probably should cut down some fat in here, but it's fast enough so meh + app.add_plugins(AssetPlugin::default()) + .add_plugins(LuaScriptingPlugin::<()>::default()) + .add_plugins(bevy_mod_scripting_lua::bindings::providers::LuaBevyScriptingPlugin); + + app +} + +struct Test { + code: String, + path: PathBuf, +} + +impl Test { + fn execute(self) -> Result<(), Failed> { + // let lua = Lua::new(); + // set file information + let mut app = init_app(); + let context_settings: ContextLoadingSettings = + app.world_mut() + .remove_resource() + .ok_or("could not find context loading settings")?; + + let mut lua = lua_context_load( + &(self.name()).into(), + self.code.as_bytes(), + &context_settings.context_initializers, + &context_settings.context_pre_handling_initializers, + app.world_mut(), + &mut (), + )?; + + lua_handler( + (), + Entity::from_raw(1), + &(self.name()).into(), + &CallbackLabel::new("test").ok_or("invalid callback label")?, + &mut lua, + &context_settings.context_pre_handling_initializers, + &mut (), + app.world_mut(), + )?; + + // WorldCallbackAccess::with_callback_access(app.world_mut(), |world| { + // lua.globals().set("world", LuaWorld(world.clone())).unwrap(); + + // let code = lua.load(self.code).set_name(self.path.to_string_lossy()); + // code.exec().map_err(|e| e.to_string()) + // })?; + Ok(()) + } + + fn name(&self) -> String { + // use the path from teh "data" directory as the test name separated by hyphens + let test = self + .path + .to_string_lossy() + .split("data") + .skip(1) + .collect::>() + .join("data") + .trim_start_matches("/") + .replace("/", " - ") + .replace(".lua", ""); + format!("lua_test - {test}") + } +} + +fn visit_dirs(dir: &Path, cb: &mut dyn FnMut(&DirEntry)) -> io::Result<()> { + if dir.is_dir() { + for entry in fs::read_dir(dir)? { + let entry = entry?; + let path = entry.path(); + if path.is_dir() { + visit_dirs(&path, cb)?; + } else { + cb(&entry); + } + } + } else { + panic!("Not a directory: {:?}", dir); + } + Ok(()) +} + +fn discover_all_tests() -> Vec { + let workspace_root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + let test_root = workspace_root.join("tests").join("data"); + let mut test_files = Vec::new(); + visit_dirs(&test_root, &mut |entry| { + let path = entry.path(); + let code = fs::read_to_string(&path).unwrap(); + test_files.push(Test { code, path }); + }) + .unwrap(); + + test_files +} + +// run this with `cargo test --features lua54 --package bevy_mod_scripting_lua --test lua_tests` +// or filter using the prefix "lua test -" +fn main() { + // Parse command line arguments + let args = Arguments::from_args(); + + // Create a list of tests and/or benchmarks (in this case: two dummy tests). + let tests = discover_all_tests() + .into_iter() + .map(|t| Trial::test(t.name(), move || t.execute())); + + // Run all tests and exit the application appropriatly. + libtest_mimic::run(&args, tests.collect()).exit(); +} diff --git a/makefile b/makefile index 527d16560d..2bb24d424a 100644 --- a/makefile +++ b/makefile @@ -32,9 +32,11 @@ GENERATED_SRC_PATH=./crates/languages/bevy_mod_scripting_lua/src/bindings/provid 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 build_test_in_package: - @cargo test --no-run --lib --package ${PACKAGE} $(TEST_NAME) --features ${TEST_FEATURES} - @export OUTPUT=$$(find ./target/debug/deps/ -regex ".*${PACKAGE}[^.]*" -printf "%T@\t%Tc %6k KiB %p\n" | sort -n -r | awk '{print $$NF}' | head -1); \ - mv $${OUTPUT} ./target/debug/test_binary && echo "Using: $${OUTPUT}" && ls -v ./target/debug/ | grep "test_binary" + @RUSTFLAGS=-g cargo test --no-run --all-targets --features ${TEST_FEATURES} --package ${PACKAGE} $(TEST_NAME) --message-format=json | jq -r 'first(select(.executable != null and .target.kind == ["test"])) | .executable' | xargs -I@ ln -fs @ ./target/debug/test_binary + +run_lua_tests: + cargo test --features=lua54 --package bevy_mod_scripting_lua --test lua_tests + comp_benches: RUSTFLAGS="-g" cargo bench --no-run From 8c16d8c10f56c22c5ce6672a55582f7c90ff5f98 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 14:04:47 +0000 Subject: [PATCH 014/217] Add lua test API and add pass more tests --- crates/bevy_api_gen/templates/mod.tera | 2 +- .../src/bindings/providers/bevy_ecs.rs | 72 +- .../src/bindings/providers/bevy_hierarchy.rs | 16 +- .../src/bindings/providers/bevy_input.rs | 452 +- .../src/bindings/providers/bevy_math.rs | 936 ++-- .../src/bindings/providers/bevy_reflect.rs | 4846 ++++++++--------- .../src/bindings/providers/bevy_time.rs | 84 +- .../src/bindings/providers/bevy_transform.rs | 76 +- .../src/bindings/providers/bevy_window.rs | 450 +- .../src/bindings/providers/mod.rs | 20 +- .../component_no_component_data.lua | 6 + .../component_with_component_data.lua | 9 +- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 66 +- 13 files changed, 3536 insertions(+), 3499 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua diff --git a/crates/bevy_api_gen/templates/mod.tera b/crates/bevy_api_gen/templates/mod.tera index 44530bb555..4032b344d9 100644 --- a/crates/bevy_api_gen/templates/mod.tera +++ b/crates/bevy_api_gen/templates/mod.tera @@ -4,7 +4,7 @@ #![cfg_attr(rustfmt, rustfmt_skip)] {% filter prettyplease %} {%- for crate in crates %} - pub(crate) mod {{ crate.name }}; + pub mod {{ crate.name }}; {% endfor -%} pub struct {{ api_name }}; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs index bbda61844f..ede3306eff 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs @@ -159,6 +159,14 @@ pub struct OnReplace {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -168,6 +176,14 @@ pub struct OnReplace {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" /// Creates a new [`ComponentId`]. @@ -184,22 +200,6 @@ pub struct OnReplace {} #[lua()] fn index(_self: LuaReflectValProxy) -> usize; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -216,26 +216,6 @@ pub struct ComponentId(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -274,6 +254,26 @@ pub struct ComponentId(); this_run: LuaReflectValProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs index 5db574d547..64e548268e 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs @@ -79,14 +79,6 @@ pub struct Parent(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -104,6 +96,14 @@ pub struct Parent(); _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs index 6fb241e53a..78229eaf4b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs @@ -41,6 +41,14 @@ pub struct Gamepad { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -58,14 +66,6 @@ pub struct Gamepad { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -87,14 +87,6 @@ pub struct GamepadAxis {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" @@ -107,6 +99,14 @@ pub struct GamepadAxis {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] @@ -151,6 +151,14 @@ pub struct GamepadSettings { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -160,14 +168,6 @@ pub struct GamepadSettings { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -192,14 +192,6 @@ pub struct KeyCode {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -217,6 +209,14 @@ pub struct KeyCode {} _self: LuaReflectRefProxy, ) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -272,6 +272,14 @@ pub struct TouchInput { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -281,14 +289,6 @@ pub struct TouchInput { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -313,6 +313,14 @@ pub struct KeyboardFocusLost {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -330,14 +338,6 @@ pub struct KeyboardFocusLost {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -360,6 +360,14 @@ pub struct KeyboardInput { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -369,14 +377,6 @@ pub struct KeyboardInput { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -395,14 +395,6 @@ pub struct AccumulatedMouseMotion { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -412,6 +404,14 @@ pub struct AccumulatedMouseMotion { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -431,6 +431,14 @@ pub struct AccumulatedMouseScroll { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, @@ -448,14 +456,6 @@ pub struct AccumulatedMouseScroll { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -476,6 +476,14 @@ pub struct MouseButtonInput { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -485,14 +493,6 @@ pub struct MouseButtonInput { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -549,6 +549,14 @@ pub struct MouseWheel { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -558,14 +566,6 @@ pub struct MouseWheel { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -756,6 +756,14 @@ pub struct GamepadConnectionEvent { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -765,14 +773,6 @@ pub struct GamepadConnectionEvent { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -789,6 +789,14 @@ pub struct GamepadEvent {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -806,14 +814,6 @@ pub struct GamepadEvent {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -919,6 +919,14 @@ pub struct RawGamepadButtonChangedEvent { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -928,14 +936,6 @@ pub struct RawGamepadButtonChangedEvent { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -952,6 +952,14 @@ pub struct RawGamepadEvent {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -961,14 +969,6 @@ pub struct RawGamepadEvent {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -985,6 +985,14 @@ pub struct PinchGesture(f32); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -994,14 +1002,6 @@ pub struct PinchGesture(f32); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1018,6 +1018,14 @@ pub struct RotationGesture(f32); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1027,14 +1035,6 @@ pub struct RotationGesture(f32); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1084,10 +1084,14 @@ pub struct PanGesture(ReflectReference); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1099,14 +1103,10 @@ pub struct PanGesture(ReflectReference); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -1132,14 +1132,10 @@ pub struct ButtonState {} bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -1208,10 +1204,14 @@ pub struct ButtonState {} "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1391,6 +1391,14 @@ pub struct AxisSettings {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + 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. @@ -1402,14 +1410,6 @@ pub struct AxisSettings {} old_value: std::option::Option, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1435,18 +1435,6 @@ pub struct ButtonAxisSettings { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" /// Creates a new rumble intensity with weak motor intensity set to the given value. @@ -1467,6 +1455,18 @@ pub struct ButtonAxisSettings { intensity: f32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -1486,10 +1486,10 @@ pub struct GamepadRumbleIntensity { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -1506,10 +1506,10 @@ pub struct GamepadRumbleIntensity { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -1527,10 +1527,14 @@ pub struct Key {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1543,14 +1547,10 @@ pub struct Key {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -1568,6 +1568,14 @@ pub struct NativeKeyCode {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1577,14 +1585,6 @@ pub struct NativeKeyCode {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -1609,10 +1609,14 @@ pub struct NativeKey {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1625,14 +1629,10 @@ pub struct NativeKey {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -1650,6 +1650,14 @@ pub struct MouseScrollUnit {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1659,14 +1667,6 @@ pub struct MouseScrollUnit {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -1691,14 +1691,6 @@ pub struct TouchPhase {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1708,6 +1700,14 @@ pub struct TouchPhase {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs index 67c56c306b..deab25b495 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs @@ -26,6 +26,14 @@ use crate::{ other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Returns the aspect ratio as a f32 value. @@ -63,14 +71,6 @@ use crate::{ #[lua()] fn is_square(_self: LuaReflectRefProxy) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -87,6 +87,14 @@ pub struct AspectRatio(); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -104,14 +112,6 @@ pub struct AspectRatio(); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -169,19 +169,19 @@ pub struct CompassQuadrant {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -223,20 +223,20 @@ pub struct CompassQuadrant {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -256,30 +256,10 @@ pub struct Isometry2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. - - #[lua()] - fn from_xyz(x: f32, y: f32, z: f32) -> LuaReflectValProxy; - -"#, - r#" -/// The inverse isometry that undoes this one. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn inverse_mul( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -294,9 +274,10 @@ pub struct Isometry2d { "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -310,10 +291,29 @@ pub struct Isometry2d { "#, r#" +/// Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, + #[lua()] + fn from_xyz(x: f32, y: f32, z: f32) -> LuaReflectValProxy; + +"#, + r#" +/// The inverse isometry that undoes this one. + + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + 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()] + fn inverse_mul( + _self: LuaReflectRefProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -823,18 +823,6 @@ pub struct Rot2 { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" @@ -851,6 +839,18 @@ pub struct Rot2 { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -867,6 +867,14 @@ pub struct Dir2(); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -879,9 +887,9 @@ pub struct Dir2(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -961,14 +969,6 @@ pub struct Dir2(); _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -984,6 +984,22 @@ pub struct Dir3(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + 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`. @@ -1037,14 +1053,6 @@ pub struct Dir3(); _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -1057,14 +1065,6 @@ pub struct Dir3(); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1268,6 +1268,26 @@ pub struct IRect { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + 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. @@ -1432,26 +1452,6 @@ pub struct IRect { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1471,14 +1471,6 @@ pub struct Rect { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1488,14 +1480,6 @@ pub struct Rect { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" /// Create a new rectangle from two corner points. @@ -1642,10 +1626,26 @@ pub struct Rect { "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} "#] )] pub struct URect { @@ -1702,6 +1702,14 @@ pub struct Aabb2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Get the radius of the bounding circle #[lua()] @@ -1716,14 +1724,6 @@ pub struct Aabb2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1742,17 +1742,15 @@ pub struct BoundingCircle { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Create a new [`Circle`] from a `radius` - - #[lua()] - fn new(radius: f32) -> LuaReflectValProxy; -"#, - r#" -/// Get the diameter of the circle - - #[lua()] - fn diameter(_self: LuaReflectRefProxy) -> f32; + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1764,15 +1762,17 @@ pub struct BoundingCircle { "#, r#" +/// Create a new [`Circle`] from a `radius` - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua()] + fn new(radius: f32) -> LuaReflectValProxy; + +"#, + r#" +/// Get the diameter of the circle + + #[lua()] + fn diameter(_self: LuaReflectRefProxy) -> f32; "#, r#" @@ -1792,14 +1792,6 @@ pub struct Circle { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1809,6 +1801,14 @@ pub struct Circle { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Create a new [`Annulus`] from the radii of the inner and outer circle @@ -1994,18 +1994,6 @@ pub struct Arc2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Create a new `Capsule2d` from a radius and length #[lua()] @@ -2023,6 +2011,18 @@ pub struct Arc2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" @@ -2049,6 +2049,18 @@ pub struct Capsule2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Create a new [`CircularSector`] from a `radius` and an `angle` #[lua()] @@ -2164,18 +2176,6 @@ pub struct Capsule2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -2194,14 +2194,6 @@ pub struct CircularSector { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -2323,6 +2315,14 @@ pub struct CircularSector { _self: LuaReflectRefProxy, ) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2341,6 +2341,14 @@ pub struct CircularSegment { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -2350,14 +2358,6 @@ pub struct CircularSegment { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Create a new `Ellipse` from half of its width and height. @@ -2453,14 +2453,6 @@ pub struct Line2d { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -2470,6 +2462,14 @@ pub struct Line2d { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2487,6 +2487,24 @@ pub struct Plane2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Create a new `Rectangle` from a full width and height + + #[lua()] + fn new( + width: f32, + height: f32, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Create a `Rectangle` from a single length. +/// The resulting `Rectangle` will be the same size in every direction. + + #[lua()] + fn from_length(length: f32) -> LuaReflectValProxy; + +"#, + r#" #[lua(as_trait = "std::clone::Clone")] fn clone( @@ -2505,24 +2523,6 @@ pub struct Plane2d { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" -/// Create a new `Rectangle` from a full width and height - - #[lua()] - fn new( - width: f32, - height: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a `Rectangle` from a single length. -/// The resulting `Rectangle` will be the same size in every direction. - - #[lua()] - fn from_length(length: f32) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -2540,14 +2540,6 @@ pub struct Rectangle { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Create a new `RegularPolygon` /// from the radius of the circumcircle and a number of sides /// # Panics @@ -2645,6 +2637,14 @@ pub struct Rectangle { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2669,18 +2669,6 @@ pub struct RegularPolygon { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" /// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. @@ -2732,14 +2720,26 @@ pub struct RegularPolygon { "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Rhombus { - half_diagonals: ReflectReference, + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +pub struct Rhombus { + half_diagonals: ReflectReference, } #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( @@ -2747,16 +2747,6 @@ pub struct Rhombus { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Create a new `Segment2d` from a direction and full length of the segment - - #[lua()] - fn new( - direction: LuaReflectValProxy, - length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" #[lua( as_trait = "std::cmp::PartialEq::", @@ -2775,6 +2765,16 @@ pub struct Rhombus { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" +/// Create a new `Segment2d` from a direction and full length of the segment + + #[lua()] + fn new( + direction: LuaReflectValProxy, + length: f32, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2793,18 +2793,6 @@ pub struct Segment2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Checks if the triangle is degenerate, meaning it has zero area. /// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. /// This indicates that the three vertices are collinear or nearly collinear. @@ -2845,6 +2833,18 @@ pub struct Segment2d { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" @@ -2870,20 +2870,20 @@ pub struct Triangle2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - #[lua()] - fn bounding_sphere( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" +/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua()] + fn bounding_sphere( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" @@ -2903,14 +2903,6 @@ pub struct Aabb3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Get the radius of the bounding sphere #[lua()] @@ -2925,6 +2917,14 @@ pub struct Aabb3d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2944,14 +2944,6 @@ pub struct BoundingSphere { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -2975,6 +2967,14 @@ pub struct BoundingSphere { #[lua()] fn diameter(_self: LuaReflectRefProxy) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3009,6 +3009,14 @@ pub struct Sphere { #[lua()] fn from_length(length: f32) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -3021,14 +3029,6 @@ pub struct Sphere { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3046,14 +3046,6 @@ pub struct Cuboid { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Create a new `Cylinder` from a radius and full height #[lua()] @@ -3086,6 +3078,14 @@ pub struct Cuboid { #[lua()] fn base_area(_self: LuaReflectRefProxy) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -3126,6 +3126,14 @@ pub struct Cylinder { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Create a new `Capsule3d` from a radius and length @@ -3146,14 +3154,6 @@ pub struct Cylinder { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3248,14 +3248,6 @@ pub struct Cone { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -3265,6 +3257,14 @@ pub struct Cone { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3355,18 +3355,6 @@ pub struct Line3d { bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -3382,6 +3370,18 @@ pub struct Line3d { length: f32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -3400,26 +3400,6 @@ pub struct Segment3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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 @@ -3448,6 +3428,26 @@ pub struct Segment3d { #[lua()] fn outer_radius(_self: LuaReflectRefProxy) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -3466,6 +3466,26 @@ pub struct Torus { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Checks if the triangle is degenerate, meaning it has zero area. /// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. /// This indicates that the three vertices are collinear or nearly collinear. @@ -3505,26 +3525,6 @@ pub struct Torus { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3686,14 +3686,6 @@ pub struct BoundingCircleCast { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. #[lua()] @@ -3722,6 +3714,14 @@ pub struct BoundingCircleCast { sphere: LuaReflectRefProxy, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3786,14 +3786,6 @@ pub struct AabbCast3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. #[lua()] @@ -3813,6 +3805,14 @@ pub struct AabbCast3d { sphere: LuaReflectValProxy, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3832,6 +3832,14 @@ pub struct BoundingSphereCast { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -3921,14 +3929,6 @@ pub struct BoundingSphereCast { value: f32, ) -> f32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3945,8 +3945,8 @@ pub struct Interval {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "std::cmp::PartialOrd::")] + fn lt( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; @@ -3954,24 +3954,17 @@ pub struct Interval {} "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialOrd::")] + fn le( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" #[lua(as_trait = "std::cmp::PartialOrd::")] - fn lt( + fn gt( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; @@ -3980,7 +3973,7 @@ pub struct Interval {} r#" #[lua(as_trait = "std::cmp::PartialOrd::")] - fn le( + fn ge( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; @@ -3988,21 +3981,28 @@ pub struct Interval {} "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd::")] - fn gt( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialOrd::")] - fn ge( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -4019,6 +4019,14 @@ pub struct FloatOrd(f32); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -4028,14 +4036,6 @@ pub struct FloatOrd(f32); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -4054,6 +4054,18 @@ pub struct Plane3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Get the signed volume of the tetrahedron. +/// If it's negative, the normal vector of the face defined by +/// the first three points using the right-hand rule points +/// away from the fourth vertex. + + #[lua()] + fn signed_volume( + _self: LuaReflectRefProxy, + ) -> f32; + +"#, + r#" #[lua( as_trait = "std::cmp::PartialEq::", @@ -4072,18 +4084,6 @@ pub struct Plane3d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" -/// Get the signed volume of the tetrahedron. -/// If it's negative, the normal vector of the face defined by -/// the first three points using the right-hand rule points -/// away from the fourth vertex. - - #[lua()] - fn signed_volume( - _self: LuaReflectRefProxy, - ) -> f32; - "#, r#" #[lua(metamethod="ToString")] @@ -4102,6 +4102,14 @@ pub struct Tetrahedron { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -4111,14 +4119,6 @@ pub struct Tetrahedron { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs index 1659fd0a00..b8ebe738ad 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -1349,88 +1349,78 @@ pub struct RangeFull {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. +/// 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::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, ) -> LuaReflectValProxy; "#, 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::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -1890,24 +1880,34 @@ pub struct RangeFull {} "#, 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. +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1925,12 +1925,39 @@ pub struct Quat(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" @@ -1943,10 +1970,19 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -1961,19 +1997,19 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3>", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -2802,8 +2838,8 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -2811,25 +2847,8 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -2837,21 +2856,12 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" @@ -2863,28 +2873,27 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -2896,15 +2905,6 @@ pub struct Quat(); rhs: f32, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -2937,25 +2937,51 @@ pub struct Vec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: i32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -/// Creates a new vector. - #[lua()] - fn new(x: i32, y: i32) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i32) -> LuaReflectValProxy; + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a new vector. + + #[lua()] + fn new(x: i32, y: i32) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua()] + fn splat(v: i32) -> LuaReflectValProxy; "#, r#" @@ -3464,30 +3490,21 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -3499,40 +3516,35 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: i32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -3540,28 +3552,28 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: i32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec2>", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, @@ -3576,8 +3588,8 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -3585,38 +3597,26 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec2>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" @@ -3649,300 +3649,152 @@ pub struct IVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: i32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" +/// Creates a new vector. - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua()] + fn new(x: i32, y: i32, z: i32) -> LuaReflectValProxy; "#, r#" +/// Creates a vector with all elements set to `v`. - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec3>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + #[lua()] + fn splat(v: i32) -> LuaReflectValProxy; + +"#, + 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()] + fn select( + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" +/// Creates a new vector from an array. - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua()] + fn from_array(a: [i32; 3]) -> LuaReflectValProxy; "#, r#" +/// `[x, y, z]` - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i32; 3]; "#, r#" +/// Creates a 4D vector from `self` and the given `w` value. - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua()] + fn extend( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + w: i32, + ) -> LuaReflectValProxy; "#, r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua()] + fn truncate( _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" +/// Creates a 3D vector from `self` with the given value of `x`. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua()] + fn with_x( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + x: i32, ) -> LuaReflectValProxy; "#, r#" +/// Creates a 3D vector from `self` with the given value of `y`. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua()] + fn with_y( _self: LuaReflectValProxy, - rhs: i32, + y: i32, ) -> LuaReflectValProxy; "#, r#" +/// Creates a 3D vector from `self` with the given value of `z`. - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec3>", composite = "rem")] - fn rem( + #[lua()] + fn with_z( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + z: i32, ) -> LuaReflectValProxy; "#, r#" +/// Computes the dot product of `self` and `rhs`. - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua()] + fn dot( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + ) -> i32; "#, r#" +/// Returns a vector where every component is the dot product of `self` and `rhs`. - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec3>", composite = "add")] - fn add( + #[lua()] + fn dot_into_vec( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" +/// Computes the cross product of `self` and `rhs`. - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec3>", composite = "div")] - fn div( + #[lua()] + fn cross( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" +/// Returns a vector containing the minimum values for each element of `self` and `rhs`. +/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec3>", composite = "sub")] - fn sub( + #[lua()] + fn min( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i32, y: i32, z: i32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i32; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i32; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -4339,107 +4191,186 @@ pub struct IVec2 { "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + "#, r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: i32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct IVec3 { - x: i32, - y: i32, - z: i32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::IVec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec3>", composite = "div")] fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, rhs: i32, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, rhs: i32, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} +"#, + r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: i32) -> () { + _self[idx - 1] = val +} +"#] +)] +pub struct IVec3 { + x: i32, + y: i32, + z: i32, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::IVec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -4447,35 +4378,34 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec4>", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -4987,10 +4917,27 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec4>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -5005,8 +4952,25 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -5014,12 +4978,30 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec4>", composite = "rem")] fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + "#, r#" @@ -5032,8 +5014,26 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec4>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec4>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -5070,45 +5070,117 @@ pub struct IVec4 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Creates a new vector. - #[lua()] - fn new(x: i64, y: i64) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i64, ) -> LuaReflectValProxy; "#, r#" -/// Creates a new vector from an array. - #[lua()] - fn from_array(a: [i64; 2]) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -/// `[x, y]` - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 2]; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" +/// Creates a new vector. + + #[lua()] + fn new(x: i64, y: i64) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; + +"#, + 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()] + fn select( + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua()] + fn from_array(a: [i64; 2]) -> LuaReflectValProxy; + +"#, + r#" +/// `[x, y]` + + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 2]; "#, r#" @@ -5589,36 +5661,9 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: i64, ) -> LuaReflectValProxy; "#, @@ -5633,26 +5678,25 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -5660,10 +5704,10 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -5678,36 +5722,10 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -5719,15 +5737,6 @@ pub struct IVec4 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - "#, r#" @@ -5737,21 +5746,12 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -5770,82 +5770,240 @@ pub struct I64Vec2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Creates a new vector. - #[lua()] - fn new(x: i64, y: i64, z: i64) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a vector with all elements set to `v`. - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -/// Creates a new vector from an array. - #[lua()] - fn from_array(a: [i64; 3]) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" -/// `[x, y, z]` - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 3]; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 4D vector from `self` and the given `w` value. - #[lua()] - fn extend( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - w: i64, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - #[lua()] - fn truncate( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 3D vector from `self` with the given value of `x`. - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i64, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -/// Creates a 3D vector from `self` with the given value of `y`. - #[lua()] - fn with_y( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a new vector. + + #[lua()] + fn new(x: i64, y: i64, z: i64) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; + +"#, + 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()] + fn select( + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua()] + fn from_array(a: [i64; 3]) -> LuaReflectValProxy; + +"#, + r#" +/// `[x, y, z]` + + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 3]; + +"#, + r#" +/// Creates a 4D vector from `self` and the given `w` value. + + #[lua()] + fn extend( + _self: LuaReflectValProxy, + w: i64, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. +/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. + + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `x`. + + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i64, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 3D vector from `self` with the given value of `y`. + + #[lua()] + fn with_y( _self: LuaReflectValProxy, y: i64, ) -> LuaReflectValProxy; @@ -6296,280 +6454,96 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: i64, ) -> LuaReflectValProxy; "#, r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +pub struct I64Vec3 { + x: i64, + y: i64, + z: i64, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::I64Vec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" +/// Creates a new vector. - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua()] + fn new(x: i64, y: i64, z: i64, w: i64) -> LuaReflectValProxy; "#, r#" +/// Creates a vector with all elements set to `v`. - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; "#, 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(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua()] + fn select( + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" +/// Creates a new vector from an array. - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; + #[lua()] + fn from_array(a: [i64; 4]) -> LuaReflectValProxy; "#, r#" +/// `[x, y, z, w]` - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct I64Vec3 { - x: i64, - y: i64, - z: i64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::I64Vec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i64, y: i64, z: i64, w: i64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i64; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 4]; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 4]; "#, r#" @@ -7038,14 +7012,8 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec4>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7053,26 +7021,25 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: i64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec4>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7080,8 +7047,8 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: i64, ) -> LuaReflectValProxy; @@ -7089,18 +7056,25 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -7115,8 +7089,8 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7124,10 +7098,10 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: i64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -7142,10 +7116,36 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -7169,10 +7169,10 @@ pub struct I64Vec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec2>", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -7193,34 +7193,8 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -7228,10 +7202,10 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -7246,19 +7220,10 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec2>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, @@ -7664,17 +7629,26 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec2>", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -7682,20 +7656,20 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec2>", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7709,21 +7683,47 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec2>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -7755,17 +7755,8 @@ pub struct UVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec3>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec3>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7773,11 +7764,8 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" @@ -7791,63 +7779,46 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec3>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -8292,53 +8263,70 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec3>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec3>", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec3>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec3>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -8346,8 +8334,20 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8381,8 +8381,17 @@ pub struct UVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -8390,8 +8399,41 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -8399,12 +8441,20 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec4>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec4>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -8417,17 +8467,20 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -8438,6 +8491,42 @@ pub struct UVec3 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" /// Creates a new vector. @@ -8861,142 +8950,187 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} +"#, + r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: u32) -> () { + _self[idx - 1] = val +} +"#] +)] +pub struct UVec4 { + x: u32, + y: u32, + z: u32, + w: u32, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::U64Vec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec4>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec4>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", composite = "sub")] fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", composite = "div")] fn div( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec4>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: u32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct UVec4 { - x: u32, - y: u32, - z: u32, - w: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::U64Vec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -9365,183 +9499,49 @@ pub struct UVec4 { #[lua()] fn saturating_mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, 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::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua()] + fn saturating_div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::Sub::<&bevy::math::U64Vec2>", composite = "sub")] - fn sub( + #[lua()] + fn wrapping_add_signed( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua()] + fn saturating_add_signed( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -9563,28 +9563,18 @@ pub struct U64Vec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -9608,17 +9598,8 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: u64, ) -> LuaReflectValProxy; @@ -10065,68 +10046,44 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -10143,166 +10100,93 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct U64Vec3 { - x: u64, - y: u64, - z: u64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::U64Vec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - "#, r#" #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", composite = "div")] fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", composite = "rem")] fn rem( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; "#, r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +pub struct U64Vec3 { + x: u64, + y: u64, + z: u64, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::U64Vec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec4>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -10728,8 +10612,98 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec4>", composite = "sub")] fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: u64, ) -> LuaReflectValProxy; @@ -10746,12 +10720,38 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: u64, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -10773,8 +10773,8 @@ pub struct U64Vec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -10782,44 +10782,52 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec2>", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -10827,26 +10835,26 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec2>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -10854,21 +10862,29 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec2>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a new vector. @@ -11714,52 +11730,35 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec2>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec2>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -11767,9 +11766,10 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -11803,6 +11803,15 @@ pub struct Vec2 { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, @@ -11812,17 +11821,17 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -11830,27 +11839,19 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3A>", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -11865,8 +11866,8 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3A>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3A>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -11874,10 +11875,10 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -11892,8 +11893,8 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -11901,10 +11902,10 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3A>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -11919,8 +11920,8 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3A>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3A>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -11928,36 +11929,9 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -12793,6 +12767,32 @@ pub struct Vec2 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -12830,88 +12830,105 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec4>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec4>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec4>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec4>", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec4>", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -12919,27 +12936,28 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec4>", composite = "add")] + fn add( _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec4>", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec4>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -13724,37 +13742,19 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec4>", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -13793,8 +13793,11 @@ pub struct Vec4(); "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -13863,11 +13866,8 @@ pub struct Vec4(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" @@ -13887,6 +13887,23 @@ pub struct BVec2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Creates a new vector mask. #[lua()] @@ -13949,29 +13966,12 @@ pub struct BVec2 { value: bool, ) -> (); -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -13992,17 +13992,16 @@ pub struct BVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" @@ -14071,10 +14070,11 @@ pub struct BVec3 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -14097,27 +14097,28 @@ pub struct BVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, @@ -14132,37 +14133,37 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec2>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec2>", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -15019,43 +15020,42 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec2>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -15063,38 +15063,38 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -15127,66 +15127,21 @@ pub struct DVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec3>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec3>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - "#, r#" @@ -15198,45 +15153,10 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -16071,6 +15991,60 @@ pub struct DVec2 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + "#, r#" @@ -16080,6 +16054,23 @@ pub struct DVec2 { rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -16092,8 +16083,17 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -16101,8 +16101,8 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec3>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec3>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -16110,10 +16110,10 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -16148,9 +16148,10 @@ pub struct DVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -16165,17 +16166,17 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec4>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec4>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -16183,17 +16184,16 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -16201,81 +16201,90 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec4>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec4>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec4>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec4>", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec4>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, @@ -17056,15 +17065,6 @@ pub struct DVec3 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -17077,10 +17077,10 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, @@ -17115,14 +17115,6 @@ pub struct DVec4 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Creates a 2x2 matrix from two column vectors. #[lua()] @@ -17384,17 +17376,25 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17402,18 +17402,19 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -17428,8 +17429,8 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17437,19 +17438,18 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -17486,8 +17486,8 @@ pub struct Mat2(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17504,8 +17504,17 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17513,11 +17522,38 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a 3x3 matrix from three column vectors. @@ -17907,23 +17943,6 @@ pub struct Mat2(); _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -17936,8 +17955,8 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17945,30 +17964,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -18006,6 +18006,85 @@ pub struct Mat3 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Creates a 3x3 matrix from three column vectors. #[lua()] @@ -18378,117 +18457,38 @@ pub struct Mat3 { "#, r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_dmat3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, +/// Takes the absolute value of each element in `self` + + #[lua()] + fn abs( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; + #[lua()] + fn as_dmat3( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" @@ -18528,19 +18528,10 @@ pub struct Mat3A { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -19201,8 +19192,8 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -19210,28 +19201,37 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -19245,20 +19245,20 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19307,8 +19307,8 @@ pub struct Mat4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f64, ) -> LuaReflectValProxy; @@ -19316,25 +19316,17 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -19342,19 +19334,11 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19596,28 +19580,44 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -19657,71 +19657,54 @@ pub struct DMat2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -20106,8 +20089,16 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -20121,6 +20112,15 @@ pub struct DMat2 { rhs: f64, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -20159,10 +20159,18 @@ pub struct DMat3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -20768,32 +20776,25 @@ pub struct DMat3 { "#, r#" - #[lua()] - fn as_mat4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua()] + fn as_mat4( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -20810,35 +20811,34 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f64, ) -> LuaReflectValProxy; @@ -20846,11 +20846,11 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" @@ -20890,6 +20890,50 @@ pub struct DMat4 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua()] @@ -21072,50 +21116,6 @@ pub struct DMat4 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -21134,32 +21134,6 @@ pub struct Affine2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Creates an affine transform from three column vectors. #[lua()] @@ -21462,57 +21436,48 @@ pub struct Affine2 { "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Affine3A { - matrix3: bevy::math::Mat3A, - translation: bevy::math::Vec3A, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DAffine2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +pub struct Affine3A { + matrix3: bevy::math::Mat3A, + translation: bevy::math::Vec3A, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::DAffine2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" /// Creates an affine transform from three column vectors. #[lua()] @@ -21683,10 +21648,45 @@ pub struct Affine3A { /// Return the inverse of this transform. /// Note that if the transform is not invertible the result will be invalid. - #[lua()] - fn inverse( + #[lua()] + fn inverse( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -21706,6 +21706,15 @@ pub struct DAffine2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua()] @@ -21975,15 +21984,6 @@ pub struct DAffine2 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - "#, r#" @@ -21993,6 +21993,14 @@ pub struct DAffine2 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -22002,14 +22010,6 @@ pub struct DAffine2 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -22028,21 +22028,29 @@ pub struct DAffine3 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[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::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -22056,39 +22064,6 @@ pub struct DAffine3 { rhs: f64, ) -> LuaReflectValProxy; -"#, - 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::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Divides a quaternion by a scalar value. @@ -22102,15 +22077,11 @@ pub 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. +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -22118,11 +22089,18 @@ pub struct DAffine3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -22561,6 +22539,28 @@ pub struct DAffine3 { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> 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::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -22582,6 +22582,15 @@ pub struct DQuat { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -22595,15 +22604,6 @@ pub struct DQuat { _self: LuaReflectRefProxy, ) -> (); -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -22714,10 +22714,11 @@ pub struct BVec3A(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -22786,11 +22787,10 @@ pub struct BVec3A(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -22861,38 +22861,6 @@ pub struct SmolStr(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - 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()] - fn new_v4() -> LuaReflectValProxy; - -"#, - 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`]. @@ -23074,6 +23042,44 @@ pub struct SmolStr(); _self: LuaReflectRefProxy, ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone(_self: LuaReflectRefProxy) -> LuaReflectValProxy; + +"#, + 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()] + fn new_v4() -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + "#, r#" /// The 'nil UUID' (all zeros). @@ -23237,12 +23243,6 @@ pub struct SmolStr(); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone(_self: LuaReflectRefProxy) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs index a066640a81..c75985d924 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs @@ -63,10 +63,10 @@ pub struct Real {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -317,14 +317,6 @@ pub struct Real {} _self: LuaReflectRefProxy, ) -> u32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -337,6 +329,14 @@ pub struct Real {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] @@ -353,10 +353,10 @@ pub struct Timer {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -373,10 +373,10 @@ pub struct Timer {} "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -414,31 +414,6 @@ pub struct Virtual {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Create a new unpaused `Stopwatch` with no elapsed time. /// # Examples /// ``` @@ -551,6 +526,31 @@ pub struct Virtual {} #[lua()] fn reset(_self: LuaReflectRefMutProxy) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs index f1c2607d4c..759124267a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs @@ -24,14 +24,10 @@ use crate::{ bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -48,11 +44,29 @@ use crate::{ "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + )] + fn mul( + _self: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" @@ -124,20 +138,6 @@ use crate::{ transform: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - )] - fn mul( - _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -163,6 +163,20 @@ pub struct GlobalTransform(); other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + )] + fn mul( + _self: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a new [`Transform`] at the position `(x, y, z)`. In 2d, the `z` component @@ -261,20 +275,6 @@ pub struct GlobalTransform(); _self: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - )] - fn mul( - _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, - ) -> LuaReflectValProxy; - "#, r#" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs index 95df5fe7a7..46be3ee95d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs @@ -25,6 +25,14 @@ use crate::{ bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -34,14 +42,6 @@ use crate::{ other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -68,18 +68,18 @@ pub struct CursorEntered { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -189,14 +189,6 @@ pub struct FileDragAndDrop {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -214,6 +206,14 @@ pub struct FileDragAndDrop {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] @@ -230,14 +230,6 @@ pub struct Ime {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -247,6 +239,14 @@ pub struct Ime {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -270,6 +270,14 @@ pub struct MonitorSelection {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Setting to true will attempt to maximize the window. /// Setting to false will attempt to un-maximize the window. @@ -341,14 +349,6 @@ pub struct MonitorSelection {} #[lua()] fn scale_factor(_self: LuaReflectRefProxy) -> f32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -402,6 +402,14 @@ pub struct Window { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -411,14 +419,6 @@ pub struct Window { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -488,9 +488,11 @@ pub struct WindowPosition {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Checks if the constraints are valid. +/// Will output warnings if it isn't. - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua()] + fn check_constraints( _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -508,11 +510,9 @@ pub struct WindowPosition {} "#, r#" -/// Checks if the constraints are valid. -/// Will output warnings if it isn't. - #[lua()] - fn check_constraints( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -537,6 +537,14 @@ pub struct WindowResizeConstraints { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -546,14 +554,6 @@ pub struct WindowResizeConstraints { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -693,6 +693,14 @@ pub struct WindowClosing { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -710,14 +718,6 @@ pub struct WindowClosing { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -736,10 +736,14 @@ pub struct WindowClosed { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -752,14 +756,10 @@ pub struct WindowClosed { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -791,18 +791,18 @@ pub struct WindowCloseRequested { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -863,14 +863,6 @@ pub struct RequestRedraw {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -880,6 +872,14 @@ pub struct RequestRedraw {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" @@ -907,6 +907,14 @@ pub struct WindowFocused { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -924,14 +932,6 @@ pub struct WindowFocused { _self: LuaReflectRefProxy, ) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -987,14 +987,6 @@ pub struct WindowScaleFactorChanged { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1004,6 +996,14 @@ pub struct WindowScaleFactorChanged { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1023,6 +1023,14 @@ pub struct WindowBackendScaleFactorChanged { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1040,14 +1048,6 @@ pub struct WindowBackendScaleFactorChanged { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -1067,22 +1067,18 @@ pub struct WindowThemeChanged { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -1094,10 +1090,14 @@ pub struct WindowThemeChanged { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1156,14 +1156,6 @@ pub struct PrimaryWindow {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1173,6 +1165,14 @@ pub struct PrimaryWindow {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" @@ -1272,14 +1272,6 @@ pub struct PrimaryMonitor {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, @@ -1297,6 +1289,14 @@ pub struct PrimaryMonitor {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1400,14 +1400,6 @@ pub struct CursorOptions { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1425,6 +1417,14 @@ pub struct CursorOptions { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] @@ -1441,18 +1441,6 @@ pub struct PresentMode {} bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, @@ -1466,6 +1454,18 @@ pub struct PresentMode {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -1481,14 +1481,6 @@ pub struct WindowMode {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Creates a new [`WindowResolution`]. #[lua()] @@ -1634,6 +1626,14 @@ pub struct WindowMode {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1650,14 +1650,10 @@ pub struct WindowResolution {} bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -1670,10 +1666,14 @@ pub struct WindowResolution {} "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1691,6 +1691,14 @@ pub struct CompositeAlphaMode {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1700,14 +1708,6 @@ pub struct CompositeAlphaMode {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1728,14 +1728,6 @@ pub struct EnabledButtons { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1745,6 +1737,14 @@ pub struct EnabledButtons { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" @@ -1768,6 +1768,26 @@ pub struct WindowLevel {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Consumes the current maximize request, if it exists. This should only be called by window backends. #[lua()] @@ -1793,26 +1813,6 @@ pub struct WindowLevel {} _self: LuaReflectRefMutProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -1841,18 +1841,18 @@ pub struct InternalWindowState {} "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs index 094ba75fd2..8354d705cc 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs @@ -2,16 +2,16 @@ #![allow(clippy::all)] #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] -pub(crate) mod bevy_a11y; -pub(crate) mod bevy_ecs; -pub(crate) mod bevy_transform; -pub(crate) mod bevy_math; -pub(crate) mod bevy_input; -pub(crate) mod bevy_core; -pub(crate) mod bevy_time; -pub(crate) mod bevy_hierarchy; -pub(crate) mod bevy_window; -pub(crate) mod bevy_reflect; +pub mod bevy_a11y; +pub mod bevy_ecs; +pub mod bevy_transform; +pub mod bevy_math; +pub mod bevy_input; +pub mod bevy_core; +pub mod bevy_time; +pub mod bevy_hierarchy; +pub mod bevy_window; +pub mod bevy_reflect; pub struct LuaBevyScriptingPlugin; impl bevy::app::Plugin for LuaBevyScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua new file mode 100644 index 0000000000..c9f8550d9d --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua @@ -0,0 +1,6 @@ +local component = world:get_type_by_name("CompWithDefault") +local entity = _get_entity_with_test_component("CompWithDefault") +local retrieved = world:get_component(entity, component) + +assert(retrieved ~= nil, "Component was not found") +assert(retrieved._1 == "Initial Value", "Component data was not retrieved correctly, retrieved._1 was: " .. retrieved._1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua index a519c47e98..264f4badca 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua @@ -1,3 +1,6 @@ -let component = world:get_type_by_name("TestComponent") -world:get_component(entity, component) -// TODO \ No newline at end of file +local component = world:get_type_by_name("TestComponent") +local entity = _get_entity_with_test_component("TestComponent") +local retrieved = world:get_component(entity, component) + +assert(retrieved ~= nil, "Component was not found") +assert(retrieved.strings[1] == "Initial", "Component data was not retrieved correctly, retrieved.strings[1] was: " .. retrieved.strings[1]) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index c4e6eb8b54..ddc5119a92 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -5,15 +5,17 @@ use bevy::{ MinimalPlugins, }; use bevy_mod_scripting_core::{ - bindings::{Proxy, ReflectAllocator, ReflectValProxy, WorldCallbackAccess}, + bindings::{Proxy, ReflectAllocator, ReflectReference, ReflectValProxy, WorldCallbackAccess}, context::ContextLoadingSettings, + error::ScriptError, event::CallbackLabel, script::ScriptId, }; use bevy_mod_scripting_lua::{ bindings::{ + providers::bevy_ecs::LuaEntity, proxy::{LuaProxied, LuaReflectValProxy}, - world::LuaWorld, + world::{GetWorld, LuaWorld}, }, lua_context_load, lua_handler, prelude::{Lua, LuaHookTriggers}, @@ -22,11 +24,12 @@ use bevy_mod_scripting_lua::{ use libtest_mimic::{Arguments, Failed, Trial}; use std::{ any::TypeId, + borrow::Cow, fs::{self, DirEntry}, io, path::{Path, PathBuf}, }; -use test_utils::test_data::setup_world; +use test_utils::test_data::{setup_world, EnumerateTestComponents}; /// Initializes world for tests fn init_app() -> App { @@ -44,6 +47,39 @@ fn init_app() -> App { app } +fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Result<(), ScriptError> { + let _get_entity_with_test_component = lua + .create_function(|l, s: String| { + let world = l.get_world().unwrap(); + let opt_entity = world.with_resource::(|_, mut allocator| { + let a = World::enumerate_test_components() + .iter() + .find(|(name, _, _)| name.contains(&s)) + .map(|(_, _, c)| { + let reference = ReflectReference::new_allocated( + c.unwrap_or(Entity::from_raw(9999)), + &mut allocator, + ); + <::Proxy>::from(reference) + }); + + a + }); + + Ok(opt_entity) + }) + .unwrap(); + + lua.globals() + .set( + "_get_entity_with_test_component", + _get_entity_with_test_component, + ) + .unwrap(); + + Ok(()) +} + struct Test { code: String, path: PathBuf, @@ -54,10 +90,13 @@ impl Test { // let lua = Lua::new(); // set file information let mut app = init_app(); - let context_settings: ContextLoadingSettings = - app.world_mut() - .remove_resource() - .ok_or("could not find context loading settings")?; + let mut context_settings: ContextLoadingSettings = app + .world_mut() + .remove_resource() + .ok_or("could not find context loading settings")?; + context_settings + .context_initializers + .push(init_lua_test_utils); let mut lua = lua_context_load( &(self.name()).into(), @@ -89,18 +128,7 @@ impl Test { } fn name(&self) -> String { - // use the path from teh "data" directory as the test name separated by hyphens - let test = self - .path - .to_string_lossy() - .split("data") - .skip(1) - .collect::>() - .join("data") - .trim_start_matches("/") - .replace("/", " - ") - .replace(".lua", ""); - format!("lua_test - {test}") + format!("lua_test - {}", self.path.to_string_lossy()) } } From 19985af27cf3f74ae65892172a3eea5fc5a876d6 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 14:05:40 +0000 Subject: [PATCH 015/217] remove git repo in test_utils --- crates/test_utils/Cargo.toml | 11 ++ crates/test_utils/src/asserts.rs | 1 + crates/test_utils/src/lib.rs | 2 + crates/test_utils/src/test_data.rs | 222 +++++++++++++++++++++++++++++ 4 files changed, 236 insertions(+) create mode 100644 crates/test_utils/Cargo.toml create mode 100644 crates/test_utils/src/asserts.rs create mode 100644 crates/test_utils/src/lib.rs create mode 100644 crates/test_utils/src/test_data.rs diff --git a/crates/test_utils/Cargo.toml b/crates/test_utils/Cargo.toml new file mode 100644 index 0000000000..9c3b96d895 --- /dev/null +++ b/crates/test_utils/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "test_utils" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +bevy = { workspace = true } + +[lib] +path = "src/lib.rs" diff --git a/crates/test_utils/src/asserts.rs b/crates/test_utils/src/asserts.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/crates/test_utils/src/asserts.rs @@ -0,0 +1 @@ + diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs new file mode 100644 index 0000000000..7a05954925 --- /dev/null +++ b/crates/test_utils/src/lib.rs @@ -0,0 +1,2 @@ +pub mod asserts; +pub mod test_data; diff --git a/crates/test_utils/src/test_data.rs b/crates/test_utils/src/test_data.rs new file mode 100644 index 0000000000..04400ad3e8 --- /dev/null +++ b/crates/test_utils/src/test_data.rs @@ -0,0 +1,222 @@ +use std::alloc::Layout; +use std::sync::{Arc, RwLock}; + +use bevy::ecs::{component::*, world::World}; +use bevy::prelude::*; +use bevy::reflect::*; + +/// Test component with Reflect and ReflectComponent registered +#[derive(Component, Reflect, PartialEq, Eq, Debug)] +#[reflect(Component)] +pub struct TestComponent { + pub strings: Vec, +} + +impl TestComponent { + pub fn init() -> Self { + Self { + strings: vec!["Initial".to_string(), "Value".to_string()], + } + } +} + +/// Test Resource with Reflect and ReflectResource registered +#[derive(Resource, Reflect, Default, PartialEq, Eq, Debug)] +#[reflect(Resource)] +pub struct TestResource { + pub bytes: Vec, +} + +impl TestResource { + pub fn init() -> Self { + Self { + bytes: vec![0, 1, 2, 3, 4, 5], + } + } +} + +/// Component with Reflect and ReflectFromWorld registered but no ReflectComponent +#[derive(Reflect, Component, PartialEq, Debug)] +#[reflect(FromWorld)] +pub struct CompWithFromWorld(pub String); + +impl Default for CompWithFromWorld { + fn default() -> Self { + Self(String::from("Default")) + } +} + +impl CompWithFromWorld { + pub fn init() -> Self { + Self(String::from("Initial Value")) + } +} + +/// Component with Reflect and ReflectDefault but no ReflectComponent +#[derive(Component, Reflect, PartialEq, Eq, Debug)] +#[reflect(Default)] +pub struct CompWithDefault(pub String); + +impl CompWithDefault { + pub fn init() -> Self { + Self(String::from("Initial Value")) + } +} + +impl Default for CompWithDefault { + fn default() -> Self { + Self(String::from("Default")) + } +} + +#[derive(Component, Reflect, PartialEq, Eq, Debug)] +#[reflect(Component, Default)] +pub struct CompWithDefaultAndComponentData(pub String); +impl Default for CompWithDefaultAndComponentData { + fn default() -> Self { + Self(String::from("Default")) + } +} + +impl CompWithDefaultAndComponentData { + pub fn init() -> Self { + Self(String::from("Initial Value")) + } +} + +#[derive(Component, Reflect, PartialEq, Eq, Debug)] +#[reflect(Component, FromWorld)] +pub struct CompWithFromWorldAndComponentData(pub String); +impl Default for CompWithFromWorldAndComponentData { + fn default() -> Self { + Self(String::from("Default")) + } +} + +impl CompWithFromWorldAndComponentData { + pub fn init() -> Self { + Self(String::from("Initial Value")) + } +} + +pub(crate) const TEST_COMPONENT_ID_START: usize = 20; +pub(crate) const TEST_ENTITY_ID_START: u32 = 0; + +pub trait GetTestComponentId { + fn test_component_id() -> ComponentId; +} + +pub trait GetTestEntityId { + fn test_entity_id() -> Entity; +} + +pub trait EnumerateTestComponents { + fn enumerate_test_components() -> Vec<(&'static str, ComponentId, Option)>; +} + +macro_rules! impl_test_component_ids { + ([$($comp_type:ty => $comp_id:expr),* $(,)?], [$($res_type:ty => $res_id:expr),* $(,)?]) => { + $( + impl GetTestComponentId for $comp_type { + fn test_component_id() -> ComponentId { + ComponentId::new(TEST_COMPONENT_ID_START + $comp_id) + } + } + + impl GetTestEntityId for $comp_type { + fn test_entity_id() -> Entity { + Entity::from_raw(TEST_ENTITY_ID_START + $comp_id) + } + } + )* + $( + impl GetTestComponentId for $res_type { + fn test_component_id() -> ComponentId { + ComponentId::new(TEST_COMPONENT_ID_START + $res_id) + } + } + )* + + pub(crate) fn init_all_components(world: &mut World, registry: &mut TypeRegistry) { + $( + world.register_component::<$comp_type>(); + registry.register::<$comp_type>(); + let registered_id = world.component_id::<$comp_type>().unwrap().index(); + assert_eq!(registered_id, TEST_COMPONENT_ID_START + $comp_id, "Test setup failed. Did you register components before running setup_world?"); + let entity = world.spawn(<$comp_type>::init()).id(); + assert_eq!(entity.index(), TEST_ENTITY_ID_START + $comp_id, "Test setup failed. Did you spawn entities before running setup_world?"); + assert_eq!(entity.generation(), 1, "Test setup failed. Did you spawn entities before running setup_world?"); + )* + $( + world.init_resource::<$res_type>(); + registry.register::<$res_type>(); + let registered_id = world.resource_id::<$res_type>().unwrap().index(); + assert_eq!(registered_id, TEST_COMPONENT_ID_START + $res_id, "Test setup failed. Did you register components before running setup_world?"); + )* + } + + impl EnumerateTestComponents for World { + fn enumerate_test_components() -> Vec<(&'static str, ComponentId, Option)> { + vec![ + $( + (std::any::type_name::<$comp_type>(), <$comp_type as GetTestComponentId>::test_component_id(), Some(<$comp_type as GetTestEntityId>::test_entity_id())) + ),* + $( + ,(std::any::type_name::<$res_type>(), <$res_type as GetTestComponentId>::test_component_id(), None) + )* + + ] + } + } + }; +} + +impl_test_component_ids!( + [ TestComponent => 0, + CompWithFromWorld => 1, + CompWithDefault => 2, + CompWithDefaultAndComponentData => 3, + CompWithFromWorldAndComponentData => 4 + ], + [ + TestResource => 5 + ] +); + +/// Initializes a default world with a set of test components and resources with various properties and implemantations. +pub fn setup_world(init: F) -> World { + let mut world = World::default(); + + // find the number of ComponentId's registered, fill it up until we hit the offset + while world.components().len() < TEST_COMPONENT_ID_START { + unsafe { + world.register_component_with_descriptor(ComponentDescriptor::new_with_layout( + format!("Filler{}", world.components().len()), + StorageType::Table, + Layout::new::(), + None, + )) + }; + } + + let mut type_registry = TypeRegistry::new(); + init_all_components(&mut world, &mut type_registry); + + init(&mut world, &mut type_registry); + + world.insert_resource(AppTypeRegistry(TypeRegistryArc { + internal: Arc::new(RwLock::new(type_registry)), + })); + + world +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn setup_works() { + setup_world(|_, _| {}); + } +} From 01dcf8ee9fdba0c0c06f963aee2b833ab8f59f61 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 17:03:38 +0000 Subject: [PATCH 016/217] add tests for api availability --- .../data/api_availability/api_available_on_callback.lua | 5 +++++ .../data/api_availability/api_available_on_script_load.lua | 3 +++ crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua new file mode 100644 index 0000000000..0048f7f653 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua @@ -0,0 +1,5 @@ +function on_test() + assert(world ~= nil, "World was not found") + assert(world:get_type_by_name("TestComponent") ~= nil, "Could not find TestComponent type") + Entity.from_raw(1) +end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua new file mode 100644 index 0000000000..50c2e90ed8 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua @@ -0,0 +1,3 @@ +assert(world ~= nil, "World was not found") +assert(world:get_type_by_name("TestComponent") ~= nil, "Could not find TestComponent type") +Entity.from_raw(1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index ddc5119a92..f0364e7fa3 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -111,7 +111,7 @@ impl Test { (), Entity::from_raw(1), &(self.name()).into(), - &CallbackLabel::new("test").ok_or("invalid callback label")?, + &CallbackLabel::new("on_test").ok_or("invalid callback label")?, &mut lua, &context_settings.context_pre_handling_initializers, &mut (), From 0f648524be5109fead22ddb5bccc4ef4d383afe9 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 17:25:56 +0000 Subject: [PATCH 017/217] remove unused file --- crates/bevy_mod_scripting_core/src/hosts.rs | 453 -------------------- 1 file changed, 453 deletions(-) delete mode 100644 crates/bevy_mod_scripting_core/src/hosts.rs diff --git a/crates/bevy_mod_scripting_core/src/hosts.rs b/crates/bevy_mod_scripting_core/src/hosts.rs deleted file mode 100644 index 1225782a42..0000000000 --- a/crates/bevy_mod_scripting_core/src/hosts.rs +++ /dev/null @@ -1,453 +0,0 @@ -//! All script host related stuff -use bevy::{asset::Asset, ecs::schedule::ScheduleLabel, prelude::*}; -use std::{ - collections::HashMap, - iter::once, - sync::atomic::{AtomicU32, Ordering}, -}; - -use crate::{ - asset::CodeAsset, - docs::DocFragment, - error::ScriptError, - event::{ScriptEvent, ScriptLoaded}, - world::WorldPointer, - ScriptErrorEvent, -}; - -/// Describes the target set of scripts this event should -/// be handled by -#[derive(Clone, Debug)] -pub enum Recipients { - /// Send to all scripts - All, - /// Send only to scripts on the given entity - Entity(Entity), - /// Send to script with the given ID - ScriptID(u32), - // Send to script with the given name - ScriptName(String), -} - -#[derive(Debug)] -/// Data used to describe a script instance. -pub struct ScriptData<'a> { - pub sid: u32, - pub entity: Entity, - pub name: &'a str, -} - -impl Recipients { - /// Returns true if the given script is a recipient - pub fn is_recipient(&self, c: &ScriptData) -> bool { - match self { - Recipients::All => true, - Recipients::Entity(e) => e == &c.entity, - Recipients::ScriptID(i) => i == &c.sid, - Recipients::ScriptName(n) => n == c.name, - } - } -} - -impl Default for Recipients { - fn default() -> Self { - Self::All - } -} - -/// A script host is the interface between your rust application -/// and the scripts in some interpreted language. -pub trait ScriptHost: Send + Sync + 'static + Default + Resource { - /// the type of the persistent script context, representing the execution context of the script - type ScriptContext: Send + Sync + 'static; - /// the type of events picked up by lua callbacks - type ScriptEvent: ScriptEvent; - /// the type of asset representing the script files for this host - type ScriptAsset: CodeAsset; - /// the type representing the target of api providers, i.e. the - /// script engine or the script context itself - type APITarget: Send + Sync + 'static; - /// the type of each doc fragment - type DocTarget: DocFragment; - - /// Loads a script in byte array format, the script name can be used - /// to send useful errors. - fn load_script( - &mut self, - script: &[u8], - script_data: &ScriptData, - providers: &mut APIProviders, - ) -> Result; - - /// Perform one-off initialization of scripts (happens for every new or re-loaded script) - fn setup_script( - &mut self, - script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - providers: &mut APIProviders, - ) -> Result<(), ScriptError>; - - /// the main point of contact with the bevy world. - /// Scripts are called with appropriate events in the event order - fn handle_events<'a>( - &mut self, - world_ptr: &mut World, - events: &[Self::ScriptEvent], - ctxs: impl Iterator, &'a mut Self::ScriptContext)>, - providers: &mut APIProviders, - ); - - /// Loads and runs script instantaneously without storing any script data into the world. - /// The script id is set to `u32::MAX`. - fn run_one_shot( - &mut self, - script: &[u8], - script_name: &str, - entity: Entity, - world: &mut World, - event: Self::ScriptEvent, - ) -> Result<(), ScriptError> { - let fd = ScriptData { - name: script_name, - sid: u32::MAX, - entity, - }; - - let mut providers: APIProviders = world.remove_resource().unwrap(); - let mut ctx = self.load_script(script, &fd, &mut providers).unwrap(); - self.setup_script(&fd, &mut ctx, &mut providers)?; - let events = [event; 1]; - - self.handle_events(world, &events, once((fd, &mut ctx)), &mut providers); - - world.insert_resource(providers); - - Ok(()) - } - - /// Registers the script host with the given app, and attaches handlers to deal with spawning/removing scripts in the given System Set. - /// - /// Ideally place after any game logic which can spawn/remove/modify scripts to avoid frame lag. (typically `PostUpdate`) - fn register_with_app(app: &mut App, schedule: impl ScheduleLabel) { - #[derive(SystemSet, Hash, Debug, Eq, PartialEq, Clone, Copy)] - struct DummySet; - - Self::register_with_app_in_set(app, schedule, DummySet); - } - - /// Similar to `register_with_app` but allows you to specify a system set to add the handler to. - fn register_with_app_in_set(app: &mut App, schedule: impl ScheduleLabel, set: impl SystemSet); -} - -/// Implementors can modify a script context in order to enable -/// API access. ScriptHosts call `attach_api` when creating scripts -pub trait APIProvider: 'static + Send + Sync { - /// the type of script engine/context the API is attached to, this must be the same as the APITarget of the ScriptHost meant to receive it. - type APITarget: Send + Sync + 'static; - /// The type of script context the APIProvider works with, must be the same as the ScriptContext of the target ScriptHost. - type ScriptContext: Send + Sync + 'static; - /// The type of documentation fragment produced by the APIProvider, must be the same as the DocTarget of the target ScriptHost. - type DocTarget: DocFragment; - - /// provide the given script context with the API permamently. - /// Depending on the host, API's may be attached on a per-script basis - /// or on a per-engine basis. Rhai for example allows you to decouple the State of each script from the - /// engine. For one-time setup use `Self::setup_script` - fn attach_api(&mut self, api: &mut Self::APITarget) -> Result<(), ScriptError>; - - /// Hook executed every time a script is about to handle events, most notably used to "refresh" world pointers - fn setup_script_runtime( - &mut self, - _world_ptr: WorldPointer, - _script_data: &ScriptData, - _ctx: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - Ok(()) - } - - /// Setup meant to be executed once for every single script. Use this if you need to consistently setup scripts. - /// For API's use `Self::attach_api` instead. - fn setup_script( - &mut self, - _script_data: &ScriptData, - _ctx: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - Ok(()) - } - - /// Generate a piece of documentation to be merged with the other documentation fragments - /// provided by other API providers - fn get_doc_fragment(&self) -> Option { - None - } - - /// Some providers might provide additional types which need to be registered - /// with the reflection API to work. - fn register_with_app(&self, _app: &mut App) {} -} - -#[derive(Resource)] -/// Stores many API providers -pub struct APIProviders { - pub providers: Vec< - Box< - dyn APIProvider< - APITarget = T::APITarget, - DocTarget = T::DocTarget, - ScriptContext = T::ScriptContext, - >, - >, - >, -} - -impl Default for APIProviders { - fn default() -> Self { - Self { - providers: Default::default(), - } - } -} - -impl APIProviders { - pub fn attach_all(&mut self, ctx: &mut T::APITarget) -> Result<(), ScriptError> { - for p in self.providers.iter_mut() { - p.attach_api(ctx)?; - } - - Ok(()) - } - - pub fn setup_runtime_all( - &mut self, - world_ptr: WorldPointer, - script_data: &ScriptData, - ctx: &mut T::ScriptContext, - ) -> Result<(), ScriptError> { - for p in self.providers.iter_mut() { - p.setup_script_runtime(world_ptr.clone(), script_data, ctx)?; - } - - Ok(()) - } - - pub fn setup_all( - &mut self, - script_data: &ScriptData, - ctx: &mut T::ScriptContext, - ) -> Result<(), ScriptError> { - for p in self.providers.iter_mut() { - p.setup_script(script_data, ctx)?; - } - - Ok(()) - } - - pub fn gen_all(&self) -> Result<(), ScriptError> { - let mut d: Option = None; - for p in self.providers.iter() { - if let Some(f) = p.get_doc_fragment() { - if let Some(prev) = d { - d = Some(prev.merge(f)) - } else { - d = Some(f) - } - } - } - d.map(|d| d.gen_docs()).unwrap_or_else(|| Ok(())) - } -} - -/// A resource storing the script contexts for each script instance. -/// The reason we need this is to split the world borrow in our handle event systems, but this -/// has the added benefit that users don't see the contexts at all, and we can provide -/// generic handling for each new/removed script in one place. -/// -/// We keep this public for now since there is no API for communicating with scripts -/// outside of events. Later this might change. -#[derive(Resource)] -pub struct ScriptContexts { - /// holds script contexts for all scripts given their instance ids. - /// This also stores contexts which are not fully loaded hence the Option - pub context_entities: HashMap, String)>, -} - -impl Default for ScriptContexts { - fn default() -> Self { - Self { - context_entities: Default::default(), - } - } -} - -impl ScriptContexts { - pub fn script_owner(&self, script_id: u32) -> Option { - self.context_entities.get(&script_id).map(|(e, _c, _n)| *e) - } - - pub fn insert_context(&mut self, fd: ScriptData, ctx: Option) { - self.context_entities - .insert(fd.sid, (fd.entity, ctx, fd.name.to_owned())); - } - - pub fn remove_context(&mut self, script_id: u32) { - self.context_entities.remove(&script_id); - } - - pub fn has_context(&self, script_id: u32) -> bool { - self.context_entities - .get(&script_id) - .map_or(false, |(_, c, _)| c.is_some()) - } - - pub fn is_empty(&self) -> bool { - self.context_entities.is_empty() - } -} - -/// A struct defining an instance of a script asset. -/// Multiple instances of the same script can exist on the same entity -#[derive(Debug, Reflect)] -pub struct Script { - /// a strong handle to the script asset - handle: Handle, - - /// the name of the script, usually its file name + relative asset path - name: String, - - /// uniquely identifies the script instance (scripts which use the same asset don't necessarily have the same ID) - id: u32, -} - -static COUNTER: AtomicU32 = AtomicU32::new(0); - -impl Script { - /// creates a new script instance with the given name and asset handle - /// automatically gives this script instance a unique ID. - /// No two scripts instances ever share the same ID - pub fn new(name: String, handle: Handle) -> Self { - Self { - handle, - name, - id: COUNTER.fetch_add(1, Ordering::Relaxed), - } - } - - #[inline(always)] - /// returns the name of the script - pub fn name(&self) -> &str { - &self.name - } - - #[inline(always)] - /// returns the asset handle which this script is executing - pub fn handle(&self) -> &Handle { - &self.handle - } - - #[inline(always)] - /// returns the unique ID of this script instance - pub fn id(&self) -> u32 { - self.id - } - - /// reloads the script by deleting the old context and inserting a new one - /// if the script context never existed, it will after this call. - pub(crate) fn reload_script( - host: &mut H, - script: &Script, - script_assets: &Assets, - providers: &mut APIProviders, - contexts: &mut ScriptContexts, - event_writer: &mut EventWriter, - error_writer: &mut EventWriter, - ) { - debug!("reloading script {}", script.id); - - // retrieve owning entity - if let Some(entity) = contexts.script_owner(script.id()) { - // remove old context - contexts.remove_context(script.id()); - // insert new re-loaded context - Self::insert_new_script_context::( - host, - script, - entity, - script_assets, - providers, - contexts, - event_writer, - error_writer, - ); - } else { - // remove old context - contexts.remove_context(script.id()); - } - } - - /// checks if a script has loaded, and if so loads (`ScriptHost::load_script`), - /// sets up (`ScriptHost::setup_script`) and inserts its new context into the contexts resource - /// otherwise inserts None. Sends ScriptLoaded event if the script was loaded - pub(crate) fn insert_new_script_context( - host: &mut H, - new_script: &Script, - entity: Entity, - script_assets: &Assets, - providers: &mut APIProviders, - contexts: &mut ScriptContexts, - event_writer: &mut EventWriter, - error_writer: &mut EventWriter, - ) { - let fd = ScriptData { - sid: new_script.id(), - entity, - name: new_script.name(), - }; - - let script = match script_assets.get(&new_script.handle) { - Some(s) => s, - None => { - // not loaded yet - debug!("Inserted script which hasn't loaded yet {:?}", fd); - contexts.insert_context(fd, None); - return; - } - }; - debug!("Inserted script {:?}", fd); - - match host.load_script(script.bytes(), &fd, providers) { - Ok(mut ctx) => { - host.setup_script(&fd, &mut ctx, providers) - .expect("Failed to setup script"); - contexts.insert_context(fd, Some(ctx)); - event_writer.send(ScriptLoaded { - sid: new_script.id(), - }); - } - Err(e) => { - warn! {"Error in loading script {}:\n{}", &new_script.name,e} - // this script will now never execute, unless manually reloaded - // but contexts are left in a valid state - contexts.insert_context(fd, None); - error_writer.send(ScriptErrorEvent { error: e }); - } - } - } -} - -#[derive(Component, Debug, Reflect)] -#[reflect(Component, Default)] -/// The component storing many scripts. -/// Scripts receive information about the entity they are attached to -/// Scripts have unique identifiers and hence multiple copies of the same script -/// can be attached to the same entity -pub struct ScriptCollection { - pub scripts: Vec>, -} - -impl Default for ScriptCollection { - fn default() -> Self { - Self { - scripts: Default::default(), - } - } -} From 9022289b516ee0fb4ce148938a8758aa8c31ee87 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 17:30:31 +0000 Subject: [PATCH 018/217] make things clone --- crates/bevy_mod_scripting_core/src/asset.rs | 2 +- crates/bevy_mod_scripting_core/src/script.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index c61bb7c1bf..0833c413db 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -13,7 +13,7 @@ use bevy::{ use crate::{prelude::ScriptError, script::ScriptId}; /// Represents a script loaded into memory as an asset -#[derive(Asset, TypePath)] +#[derive(Asset, TypePath, Clone)] pub struct ScriptAsset { pub content: Box<[u8]>, /// The virtual filesystem path of the asset, used to map to the script Id for asset backed scripts diff --git a/crates/bevy_mod_scripting_core/src/script.rs b/crates/bevy_mod_scripting_core/src/script.rs index 4d39427b29..9817eb8bd1 100644 --- a/crates/bevy_mod_scripting_core/src/script.rs +++ b/crates/bevy_mod_scripting_core/src/script.rs @@ -8,7 +8,7 @@ use crate::{asset::ScriptAsset, context::ContextId}; pub type ScriptId = Cow<'static, str>; -#[derive(bevy::ecs::component::Component, Reflect)] +#[derive(bevy::ecs::component::Component, Reflect, Clone)] pub struct ScriptComponent(pub Vec); impl Deref for ScriptComponent { From 691b02b67bbbe9c47d81232b058f903b3b7d9cd0 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 22:12:11 +0000 Subject: [PATCH 019/217] Fix some tests --- .../src/bindings/query.rs | 9 ++- .../src/bindings/reference.rs | 27 ++++++++- .../src/bindings/world.rs | 47 +++++++-------- .../bevy_mod_scripting_lua/Cargo.toml | 1 + .../src/bindings/reference.rs | 16 ++--- .../src/bindings/world.rs | 23 ++++++-- ...t_no_default_or_from_world_data_errors.lua | 12 ++-- ..._with_default_no_component_data_errors.lua | 12 ++-- ...th_from_world_no_component_data_errors.lua | 12 ++-- ...y_entity_component_with_component_data.lua | 5 ++ .../missing_resource_returns_nil.lua | 2 + .../no_resource_data_returns_resource.lua | 5 ++ .../with_resource_data_returns_resource.lua | 5 ++ ...g.lua => missing_type_returns_nothing.lua} | 0 ...ty_entity_with_component_data_is_false.lua | 4 ++ .../data/has_component/no_component_data.lua | 3 + .../has_component/with_component_data.lua | 3 + .../empty_entity_does_nothing.lua | 5 ++ .../no_component_data_errors.lua | 7 +++ .../with_component_data_removes_component.lua | 5 ++ ...source_with_resource_data_does_nothing.lua | 4 ++ .../no_resource_data_errors.lua | 6 ++ .../with_resource_data_removes_resource.lua | 4 ++ .../bevy_mod_scripting_lua/tests/lua_tests.rs | 58 +++++++++++++++++-- crates/test_utils/src/asserts.rs | 1 - crates/test_utils/src/lib.rs | 1 - crates/test_utils/src/test_data.rs | 22 ++++++- 27 files changed, 226 insertions(+), 73 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua rename crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/{unregistered_type_returns_nothing.lua => missing_type_returns_nothing.lua} (100%) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua delete mode 100644 crates/test_utils/src/asserts.rs diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 05f728a300..95421292ed 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -13,13 +13,19 @@ use std::{any::TypeId, ops::Deref, sync::Arc}; pub struct ScriptTypeRegistration { pub(crate) registration: Arc, pub component_id: Option, + pub resource_id: Option, } impl ScriptTypeRegistration { - pub fn new(registration: Arc, component_id: Option) -> Self { + pub fn new( + registration: Arc, + component_id: Option, + resource_id: Option, + ) -> Self { Self { registration, component_id, + resource_id, } } @@ -38,6 +44,7 @@ impl ScriptTypeRegistration { self.registration.type_info().type_id() } + /// Returns the [`ComponentId`] for this type, if it is a component or a resource. #[inline(always)] pub fn component_id(&self) -> Option { self.component_id diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index df7356e356..eaaf44e7ec 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -56,10 +56,33 @@ pub struct ReflectReference { pub reflect_path: Vec, } -// just a dummy standin for unregistered types -struct UnregisteredType; + impl ReflectReference { + + /// If this is a reference to something with a length accessible via reflection, returns that length. + pub fn len(&self, world: &WorldAccessGuard) -> Option { + world.with_resource(|world, type_registry: Mut| { + world.with_resource(|world, allocator: Mut| { + let type_registry = type_registry.read(); + self + .with_reflect(world, &type_registry, Some(&allocator), |r| { + match r.reflect_ref() { + bevy::reflect::ReflectRef::Struct(s) => Some(s.field_len()), + bevy::reflect::ReflectRef::TupleStruct(ts) => Some(ts.field_len()), + bevy::reflect::ReflectRef::Tuple(t) => Some(t.field_len()), + bevy::reflect::ReflectRef::List(l) => Some(l.len()), + bevy::reflect::ReflectRef::Array(a) => Some(a.len()), + bevy::reflect::ReflectRef::Map(m) => Some(m.len( )), + bevy::reflect::ReflectRef::Set(s) => Some(s.len()), + bevy::reflect::ReflectRef::Enum(e) => Some(e.field_len()), + bevy::reflect::ReflectRef::Opaque(_) => None, + } + }) + }) + }) + } + pub fn new_allocated( value: T, allocator: &mut ReflectAllocator, diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 773619b9a7..7dc44dc92c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -170,7 +170,7 @@ impl WorldCallbackAccess { world.remove_component(entity, registration) } - pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult { + pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.get_resource(resource_id) } @@ -290,10 +290,11 @@ impl<'w> WorldAccessGuard<'w> { /// Gets the component id of the given component or resource pub fn get_component_id(&self, id: TypeId) -> Option { - let components = self.cell.components(); - components - .get_id(id) - .or_else(|| components.get_resource_id(id)) + self.cell.components().get_id(id) + } + + pub fn get_resource_id(&self, id: TypeId) -> Option { + self.cell.components().get_resource_id(id) } /// Checks nobody else is currently accessing the world, and if so locks access to it until @@ -609,6 +610,7 @@ impl<'w> WorldAccessGuard<'w> { ScriptTypeRegistration::new( Arc::new(registration.clone()), world.get_component_id(registration.type_id()), + world.get_resource_id(registration.type_id()), ) }) }) @@ -733,19 +735,13 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult { - let component_info = self - .cell - .components() - .get_info(resource_id) - .ok_or_else(|| { - ScriptError::new_runtime_error(format!( - "Resource does not exist: {:?}", - resource_id - )) - })?; + pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult> { + let component_info = match self.cell.components().get_info(resource_id) { + Some(info) => info, + None => return Ok(None), + }; - Ok(ReflectReference { + Ok(Some(ReflectReference { base: ReflectBaseType { type_id: component_info .type_id() @@ -753,7 +749,7 @@ impl<'w> WorldAccessGuard<'w> { base_id: ReflectBase::Resource(resource_id), }, reflect_path: Default::default(), - }) + })) } pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { @@ -772,7 +768,9 @@ impl<'w> WorldAccessGuard<'w> { } pub fn has_resource(&self, resource_id: ComponentId) -> bool { - self.cell.components().get_info(resource_id).is_some() + // Safety: we are not reading the value at all + let res_ptr = unsafe { self.cell.get_resource_by_id(resource_id) }; + res_ptr.is_some() } pub fn get_children(&self, entity: Entity) -> ScriptResult> { @@ -1520,6 +1518,7 @@ mod test { WorldCallbackAccess::with_callback_access(&mut world, |world| { let comp_ref = world .get_resource(TestResource::test_component_id()) + .unwrap() .unwrap(); assert_eq!( comp_ref, @@ -1542,13 +1541,9 @@ mod test { WorldCallbackAccess::with_callback_access(&mut world, |world| { let comp_ref = world.get_resource(fake_comp); match comp_ref { - Ok(_) => panic!("Expected error"), - Err(e) => { - assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!( - e.reason.to_string(), - format!("Resource does not exist: {fake_comp:?}") - ) + Ok(None) => {} + e => { + panic!("Expected ok with none, got: {:?}", e); } } }); diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 5c7bfa10a7..be2b581d5e 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -57,6 +57,7 @@ smallvec = "1.13" [dev-dependencies] test_utils = { workspace = true } libtest-mimic = "0.8" +regex = "1.11" [[test]] name = "lua_tests" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 79903d04d2..7a7386b3c0 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -29,6 +29,11 @@ use super::{ pub struct LuaReflectReference(pub ReflectReference); impl LuaReflectReference { + pub fn len(&self, lua: &Lua) -> Result, mlua::Error> { + let world = lua.get_world()?; + Ok(self.0.len(&world)) + } + /// Queries the reflection system for a proxy registration for the underlying type. /// If found will convert to lua using this proxy /// If not found will use ::into_lua to convert to lua @@ -117,13 +122,6 @@ impl LuaReflectReference { e, )) }) - // r.set(other).map_err(|e| { - // ScriptError::new_runtime_error(format!( - // "Invalid assignment `{:?}` = `{:?}`. Wrong type.", - // self.0.clone(), - // e, - // )) - // }) })?; Ok(()) } else { @@ -223,6 +221,10 @@ impl TealData for LuaReflectReference { self_.set_with_lua_proxy(l, value) }, ); + + m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { + self_.len(l) + }) } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 9e5a0ccb6b..93bcc364c6 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -183,13 +183,19 @@ impl TealData for LuaWorld { methods.add_method( "get_resource", - |_, this, resource_id: LuaReflectValProxy| { + |_, this, registration: LuaValProxy| { let world = this.0.read().ok_or_else(|| { mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) })?; - let out: Result, ErrorProxy> = world - .proxy_call(resource_id, |resource_id| world.get_resource(resource_id)) - .map_err(mlua::Error::external)?; + let out: Result>, ErrorProxy> = + world + .proxy_call(registration, |registration| { + match registration.resource_id { + Some(resource_id) => world.get_resource(resource_id), + None => Ok(None), + } + }) + .map_err(mlua::Error::external)?; Ok(TypenameProxy::<_, LuaReflectRefProxy>::new(out)) }, @@ -213,12 +219,17 @@ impl TealData for LuaWorld { methods.add_method( "has_resource", - |_, this, resource_id: LuaReflectValProxy| { + |_, this, registration: LuaValProxy| { let world = this.0.read().ok_or_else(|| { mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) })?; let out: bool = world - .proxy_call(resource_id, |resource_id| world.has_resource(resource_id)) + .proxy_call(registration, |registration| { + match registration.resource_id { + Some(resource_id) => world.has_resource(resource_id), + None => false, + } + }) .map_err(mlua::Error::external)?; Ok(out) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua index aa185b18f4..aa31351705 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua @@ -1,9 +1,7 @@ -function Test() - local entity = world:spawn() - local type = world:get_type_by_name('TestComponent') +local entity = world:spawn() +local type = world:get_type_by_name('TestComponent') + +assert_throws(function() world:add_default_component(entity, type) -end -local success,err = pcall(Test) -assert(not success, 'No error thrown') -assert(string.find(tostring(err), 'Does not have ReflectDefault or ReflectFromWorld'), 'Error contains wrong message: ' .. tostring(err)) \ No newline at end of file +end, "Does not have ReflectDefault or ReflectFromWorld data registered") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua index 709b6fe706..bf4ba3d294 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua @@ -1,10 +1,6 @@ -function Test() - local entity = world:spawn() - local _type = world:get_type_by_name('CompWithDefault') +local entity = world:spawn() +local _type = world:get_type_by_name('CompWithDefault') +assert_throws(function() world:add_default_component(entity, _type) -end - -local success,err = pcall(Test) -assert(not success, 'No error thrown') -assert(string.find(tostring(err), 'Does not have ReflectComponent'), 'Error contains wrong message: ' .. tostring(err)) \ No newline at end of file +end, "Does not have ReflectComponent") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua index 777651855a..6f4f467703 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua @@ -1,10 +1,6 @@ -function Test() - local entity = world:spawn() - local _type = world:get_type_by_name('CompWithFromWorld') +local entity = world:spawn() +local _type = world:get_type_by_name('CompWithFromWorld') +assert_throws(function() world:add_default_component(entity, _type) -end - -local success,err = pcall(Test) -assert(not success, 'No error thrown') -assert(string.find(tostring(err), 'Does not have ReflectComponent'), 'Error contains wrong message: ' .. tostring(err)) \ No newline at end of file +end, 'Does not have ReflectComponent data registered') \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua new file mode 100644 index 0000000000..79d541883b --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua @@ -0,0 +1,5 @@ +local component = world:get_type_by_name("TestComponent") +local entity = world:spawn() +local retrieved = world:get_component(entity, component) + +assert(retrieved == nil, "Component found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua new file mode 100644 index 0000000000..a2fd345a6f --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua @@ -0,0 +1,2 @@ +local type = _get_mock_type() +assert(world:get_resource(type) == nil, "Resource should not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua new file mode 100644 index 0000000000..8bd6133492 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua @@ -0,0 +1,5 @@ +local resource = world:get_type_by_name("ResourceWithDefault") + +local retrieved = world:get_resource(resource) +assert(retrieved ~= nil, "Resource should exist") +assert(retrieved._1 == "Initial Value", "Resource should have default value but got: " .. retrieved._1) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua new file mode 100644 index 0000000000..2d21bf08a6 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua @@ -0,0 +1,5 @@ +local resource = world:get_type_by_name("TestResource") + +local retrieved = world:get_resource(resource) +assert(retrieved ~= nil, "Resource should exist") +assert(retrieved.bytes[2] == 1, "Resource should have default value but got resource with #retrieved.bytes[1]: " .. tostring(retrieved.bytes[2])) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/unregistered_type_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/missing_type_returns_nothing.lua similarity index 100% rename from crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/unregistered_type_returns_nothing.lua rename to crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/missing_type_returns_nothing.lua diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua new file mode 100644 index 0000000000..9f9fdff094 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua @@ -0,0 +1,4 @@ +local entity = world:spawn() +local type = world:get_type_by_name('TestComponent') + +assert(world:has_component(entity, type) == false, "Entity should not have component") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua new file mode 100644 index 0000000000..fc1129e5cc --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua @@ -0,0 +1,3 @@ +local entity = _get_entity_with_test_component("CompWithDefault") +local component = world:get_type_by_name("CompWithDefault") +assert(world:has_component(entity, component) == true, "Component was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua new file mode 100644 index 0000000000..a15920ea94 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua @@ -0,0 +1,3 @@ +local entity = _get_entity_with_test_component("TestComponent") +local component = world:get_type_by_name("TestComponent") +assert(world:has_component(entity, component) == true, "Component was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua new file mode 100644 index 0000000000..fd535a7f46 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua @@ -0,0 +1,5 @@ +local entity = world:spawn() +local type = world:get_type_by_name('TestComponent') + +world:remove_component(entity, type) +world:remove_component(entity, type) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua new file mode 100644 index 0000000000..572cddd599 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua @@ -0,0 +1,7 @@ + +local entity = _get_entity_with_test_component("CompWithDefault") +local component = world:get_type_by_name("CompWithDefault") + +assert_throws(function () + world:remove_component(entity, component) +end, "Does not have ReflectComponent data registered") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua new file mode 100644 index 0000000000..294430d420 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua @@ -0,0 +1,5 @@ + +local entity = _get_entity_with_test_component("TestComponent") +local component = world:get_type_by_name("TestComponent") +world:remove_component(entity, component) +assert(world:has_component(entity, component) == false, "Component was not removed") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua new file mode 100644 index 0000000000..ae802adacb --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua @@ -0,0 +1,4 @@ +local type = world:get_type_by_name("TestResource") + +world:remove_resource(type) +world:remove_resource(type) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua new file mode 100644 index 0000000000..03f456e7ff --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua @@ -0,0 +1,6 @@ + +local type = _get_mock_type() + +assert_throws(function () + world:remove_resource(type) +end, "Does not have ReflectResource data registered") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua new file mode 100644 index 0000000000..86a21cb4ce --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua @@ -0,0 +1,4 @@ + +local type = world:get_type_by_name("TestResource") +world:remove_resource(type) +assert(world:has_resource(type) == false, "Resource was not removed") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index f0364e7fa3..189a2269df 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -2,10 +2,14 @@ use bevy::{ app::App, asset::{AssetPlugin, AssetServer}, prelude::{AppTypeRegistry, Entity, World}, + reflect::{Reflect, TypeRegistration}, MinimalPlugins, }; use bevy_mod_scripting_core::{ - bindings::{Proxy, ReflectAllocator, ReflectReference, ReflectValProxy, WorldCallbackAccess}, + bindings::{ + Proxy, ReflectAllocator, ReflectReference, ReflectValProxy, ScriptTypeRegistration, + WorldCallbackAccess, + }, context::ContextLoadingSettings, error::ScriptError, event::CallbackLabel, @@ -18,7 +22,7 @@ use bevy_mod_scripting_lua::{ world::{GetWorld, LuaWorld}, }, lua_context_load, lua_handler, - prelude::{Lua, LuaHookTriggers}, + prelude::{Lua, LuaFunction, LuaHookTriggers}, register_lua_values, LuaScriptingPlugin, ReflectLuaValue, }; use libtest_mimic::{Arguments, Failed, Trial}; @@ -28,6 +32,7 @@ use std::{ fs::{self, DirEntry}, io, path::{Path, PathBuf}, + sync::Arc, }; use test_utils::test_data::{setup_world, EnumerateTestComponents}; @@ -48,6 +53,16 @@ fn init_app() -> App { } fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Result<(), ScriptError> { + let _get_mock_type = lua + .create_function(|_, ()| { + #[derive(Reflect)] + struct Dummy; + let reg = + ScriptTypeRegistration::new(Arc::new(TypeRegistration::of::()), None, None); + Ok(::Proxy::from(reg)) + }) + .unwrap(); + let _get_entity_with_test_component = lua .create_function(|l, s: String| { let world = l.get_world().unwrap(); @@ -70,13 +85,41 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul }) .unwrap(); - lua.globals() + let assert_throws = lua + .create_function(|_, (f, regex): (LuaFunction, String)| { + let result = f.call::<(), ()>(()); + match result { + Ok(_) => Err(tealr::mlu::mlua::Error::RuntimeError( + "Expected function to throw error, but it did not.".into(), + )), + Err(e) => { + let error_message = e.to_string(); + let regex = regex::Regex::new(®ex).unwrap(); + if regex.is_match(&error_message) { + Ok(()) + } else { + Err(tealr::mlu::mlua::Error::RuntimeError(format!( + "Expected error message to match the regex: \n{}\n\nBut got:\n{}", + regex.as_str(), + error_message + ))) + } + } + } + }) + .unwrap(); + + let globals = lua.globals(); + globals .set( "_get_entity_with_test_component", _get_entity_with_test_component, ) .unwrap(); + globals.set("assert_throws", assert_throws).unwrap(); + + globals.set("_get_mock_type", _get_mock_type).unwrap(); Ok(()) } @@ -128,7 +171,14 @@ impl Test { } fn name(&self) -> String { - format!("lua_test - {}", self.path.to_string_lossy()) + format!( + "lua_test - {}", + self.path + .to_string_lossy() + .split(&format!("tests{}data", std::path::MAIN_SEPARATOR)) + .last() + .unwrap() + ) } } diff --git a/crates/test_utils/src/asserts.rs b/crates/test_utils/src/asserts.rs deleted file mode 100644 index 8b13789179..0000000000 --- a/crates/test_utils/src/asserts.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 7a05954925..363a59ff80 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs @@ -1,2 +1 @@ -pub mod asserts; pub mod test_data; diff --git a/crates/test_utils/src/test_data.rs b/crates/test_utils/src/test_data.rs index 04400ad3e8..cf5fc1cc23 100644 --- a/crates/test_utils/src/test_data.rs +++ b/crates/test_utils/src/test_data.rs @@ -35,6 +35,23 @@ impl TestResource { } } +/// Resource with Reflect and ReflectDefault registered but no ReflectResource +#[derive(Resource, Reflect, PartialEq, Eq, Debug)] +#[reflect(Default)] +pub struct ResourceWithDefault(pub String); + +impl Default for ResourceWithDefault { + fn default() -> Self { + Self(String::from("Default")) + } +} + +impl ResourceWithDefault { + pub fn init() -> Self { + Self(String::from("Initial Value")) + } +} + /// Component with Reflect and ReflectFromWorld registered but no ReflectComponent #[derive(Reflect, Component, PartialEq, Debug)] #[reflect(FromWorld)] @@ -148,7 +165,7 @@ macro_rules! impl_test_component_ids { assert_eq!(entity.generation(), 1, "Test setup failed. Did you spawn entities before running setup_world?"); )* $( - world.init_resource::<$res_type>(); + world.insert_resource::<$res_type>(<$res_type>::init()); registry.register::<$res_type>(); let registered_id = world.resource_id::<$res_type>().unwrap().index(); assert_eq!(registered_id, TEST_COMPONENT_ID_START + $res_id, "Test setup failed. Did you register components before running setup_world?"); @@ -179,7 +196,8 @@ impl_test_component_ids!( CompWithFromWorldAndComponentData => 4 ], [ - TestResource => 5 + TestResource => 5, + ResourceWithDefault => 6 ] ); From b9ca2b0aba0f201a849d34af86af5571159f7451 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 14 Nov 2024 22:21:35 +0000 Subject: [PATCH 020/217] more tests --- ...ta_is_false.lua => empty_entity_mock_component_is_false.lua} | 2 +- .../tests/data/has_resource/existing_no_resource_data.lua | 2 ++ .../tests/data/has_resource/existing_with_resource_data.lua | 2 ++ .../has_resource/missing_resource_mock_resource_is_false.lua | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) rename crates/languages/bevy_mod_scripting_lua/tests/data/has_component/{empty_entity_with_component_data_is_false.lua => empty_entity_mock_component_is_false.lua} (68%) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua similarity index 68% rename from crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua rename to crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua index 9f9fdff094..7c86b381a6 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_with_component_data_is_false.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua @@ -1,4 +1,4 @@ local entity = world:spawn() -local type = world:get_type_by_name('TestComponent') +local type = _get_mock_type() assert(world:has_component(entity, type) == false, "Entity should not have component") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua new file mode 100644 index 0000000000..f0d5e1fbf2 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua @@ -0,0 +1,2 @@ +local component = world:get_type_by_name("ResourceWithDefault") +assert(world:has_resource(component) == true, "Resource was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua new file mode 100644 index 0000000000..6976b8d800 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua @@ -0,0 +1,2 @@ +local component = world:get_type_by_name("TestResource") +assert(world:has_resource(component) == true, "Resource was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua new file mode 100644 index 0000000000..7f720c2f05 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua @@ -0,0 +1,2 @@ +local type = _get_mock_type() +assert(world:has_resource(type) == false, "Resource should not exist") \ No newline at end of file From 21e33336ec42fc692411c39593f444cfc2a7f346 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 15 Nov 2024 12:23:35 +0000 Subject: [PATCH 021/217] Complete test suite for world methods --- .../src/bindings/world.rs | 105 +++++++++++++++++- .../src/bindings/world.rs | 16 ++- .../tests/data/despawn/despawns_only_root.lua | 7 ++ .../data/despawn/invalid_entity_errors.lua | 3 + .../despawns_only_child.lua | 7 ++ .../invalid_entity_errors.lua | 3 + .../despawns_recursively.lua | 7 ++ .../invalid_entity_errors.lua | 3 + .../has_children_returns_them.lua | 9 ++ .../get_children/invalid_entity_errors.lua | 4 + .../no_children_returns_empty_table.lua | 4 + .../data/get_parent/has_parent_returns_it.lua | 9 ++ .../data/get_parent/invalid_entity_errors.lua | 4 + .../data/get_parent/no_parent_returns_nil.lua | 4 + .../adding_empty_list_does_nothing.lua | 5 + .../adds_children_at_correct_index.lua | 8 ++ .../adds_children_to_existing_enttity.lua | 7 ++ .../insert_children/invalid_entity_errors.lua | 10 ++ .../adding_empty_list_does_nothing.lua | 5 + .../adds_children_to_existing_enttity.lua | 7 ++ .../push_children/invalid_entity_errors.lua | 10 ++ .../bevy_mod_scripting_lua/tests/lua_tests.rs | 44 +++++--- 22 files changed, 258 insertions(+), 23 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 7dc44dc92c..e63f51399b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -185,6 +185,11 @@ impl WorldCallbackAccess { world.has_resource(resource_id) } + pub fn has_entity(&self, entity: Entity) -> bool { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + world.has_entity(entity) + } + pub fn get_children(&self, entity: Entity) -> ScriptResult> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.get_children(entity) @@ -588,6 +593,11 @@ impl<'w> WorldAccessGuard<'w> { )) } } + + /// checks if a given entity exists and is valid + pub fn is_valid_entity(&self, entity: Entity) -> bool { + self.cell.get_entity(entity).is_some() + } } /// Impl block for higher level world methods @@ -773,7 +783,18 @@ impl<'w> WorldAccessGuard<'w> { res_ptr.is_some() } + pub fn has_entity(&self, entity: Entity) -> bool { + self.is_valid_entity(entity) + } + pub fn get_children(&self, entity: Entity) -> ScriptResult> { + if !self.is_valid_entity(entity) { + return Err(ScriptError::new_runtime_error(format!( + "Entity does not exist or is not valid: {:?}", + entity + ))); + } + let access = self .get_component_access_typed::() .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); @@ -785,6 +806,13 @@ impl<'w> WorldAccessGuard<'w> { } pub fn get_parent(&self, entity: Entity) -> ScriptResult> { + if !self.is_valid_entity(entity) { + return Err(ScriptError::new_runtime_error(format!( + "Entity does not exist or is not valid: {:?}", + entity + ))); + } + let access = self .get_component_access_typed::() .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); @@ -795,6 +823,22 @@ impl<'w> WorldAccessGuard<'w> { } pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + // verify entities exist + if !self.is_valid_entity(parent) { + return Err(ScriptError::new_runtime_error(format!( + "The parent Entity does not exist or is not valid: {:?}", + parent + ))); + } + for c in children { + if !self.is_valid_entity(*c) { + return Err(ScriptError::new_runtime_error(format!( + "the Entity does not exist or is not valid: {:?}", + c + ))); + } + } + if let Some(world) = self.get_whole_world_access() { let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); @@ -808,6 +852,22 @@ impl<'w> WorldAccessGuard<'w> { } pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + if !self.is_valid_entity(parent) { + return Err(ScriptError::new_runtime_error(format!( + "The parent Entity does not exist or is not valid: {:?}", + parent + ))); + } + + for c in children { + if !self.is_valid_entity(*c) { + return Err(ScriptError::new_runtime_error(format!( + "the Entity does not exist or is not valid: {:?}", + c + ))); + } + } + if let Some(world) = self.get_whole_world_access() { let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); @@ -826,6 +886,22 @@ impl<'w> WorldAccessGuard<'w> { index: usize, children: &[Entity], ) -> ScriptResult<()> { + if !self.is_valid_entity(parent) { + return Err(ScriptError::new_runtime_error(format!( + "parent Entity does not exist or is not valid: {:?}", + parent + ))); + } + + for c in children { + if !self.is_valid_entity(*c) { + return Err(ScriptError::new_runtime_error(format!( + "the Entity does not exist or is not valid: {:?}", + c + ))); + } + } + if let Some(world) = self.get_whole_world_access() { let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); @@ -838,11 +914,18 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn despawn_recursive(&self, entity: Entity) -> ScriptResult<()> { + pub fn despawn_recursive(&self, parent: Entity) -> ScriptResult<()> { + if !self.is_valid_entity(parent) { + return Err(ScriptError::new_runtime_error(format!( + "parent Entity does not exist or is not valid: {:?}", + parent + ))); + } + if let Some(world) = self.get_whole_world_access() { let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); - commands.entity(entity).despawn_recursive(); + commands.entity(parent).despawn_recursive(); queue.apply(world); } else { panic!("{CONCURRENT_WORLD_ACCESS_MSG}") @@ -852,6 +935,13 @@ impl<'w> WorldAccessGuard<'w> { } pub fn despawn(&self, entity: Entity) -> ScriptResult<()> { + if !self.is_valid_entity(entity) { + return Err(ScriptError::new_runtime_error(format!( + "Entity does not exist or is not valid: {:?}", + entity + ))); + } + if let Some(world) = self.get_whole_world_access() { let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); @@ -864,11 +954,18 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn despawn_descendants(&self, entity: Entity) -> ScriptResult<()> { + pub fn despawn_descendants(&self, parent: Entity) -> ScriptResult<()> { + if !self.is_valid_entity(parent) { + return Err(ScriptError::new_runtime_error(format!( + "parent Entity does not exist or is not valid: {:?}", + parent + ))); + } + if let Some(world) = self.get_whole_world_access() { let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); - commands.entity(entity).despawn_descendants(); + commands.entity(parent).despawn_descendants(); queue.apply(world); } else { panic!("{CONCURRENT_WORLD_ACCESS_MSG}") diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 93bcc364c6..f7ddbf5ed3 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -236,6 +236,20 @@ impl TealData for LuaWorld { }, ); + methods.add_method( + "has_entity", + |_, this, entity: LuaReflectValProxy| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let out: bool = world + .proxy_call(entity, |entity| world.has_entity(entity)) + .map_err(mlua::Error::external)?; + + Ok(out) + }, + ); + methods.add_method( "get_children", |_, this, entity: LuaReflectValProxy| { @@ -315,7 +329,7 @@ impl TealData for LuaWorld { })?; let out: Result<(), ErrorProxy> = world .proxy_call(args, |(parent, index, children)| { - world.insert_children(parent, index, &children) + world.insert_children(parent, index - 1, &children) }) .map_err(mlua::Error::external)?; diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua new file mode 100644 index 0000000000..2cc5a6f0b7 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua @@ -0,0 +1,7 @@ +local entity = world:spawn() +local child = world:spawn() +world:push_children(entity, {child}) +world:despawn(entity) + +assert(world:has_entity(entity) == false, "Parent should be despawned") +assert(world:has_entity(child) == true, "Child should not be despawned") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua new file mode 100644 index 0000000000..de6961bebb --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua @@ -0,0 +1,3 @@ +assert_throws(function() + world:despawn_recursive(Entity.from_raw(9999)) +end, "parent Entity does not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua new file mode 100644 index 0000000000..1b0f617540 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua @@ -0,0 +1,7 @@ +local entity = world:spawn() +local child = world:spawn() +world:push_children(entity, {child}) +world:despawn_descendants(entity) + +assert(world:has_entity(entity) == true, "Parent should not be despawned") +assert(world:has_entity(child) == false, "Child should be despawned") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua new file mode 100644 index 0000000000..de6961bebb --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua @@ -0,0 +1,3 @@ +assert_throws(function() + world:despawn_recursive(Entity.from_raw(9999)) +end, "parent Entity does not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua new file mode 100644 index 0000000000..554fe5dc9b --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua @@ -0,0 +1,7 @@ +local entity = world:spawn() +local child = world:spawn() +world:push_children(entity, {child}) +world:despawn_recursive(entity) + +assert(world:has_entity(entity) == false, "Parent should be despawned") +assert(world:has_entity(child) == false, "Child should be despawned") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua new file mode 100644 index 0000000000..de6961bebb --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua @@ -0,0 +1,3 @@ +assert_throws(function() + world:despawn_recursive(Entity.from_raw(9999)) +end, "parent Entity does not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua new file mode 100644 index 0000000000..7640c6f9c0 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua @@ -0,0 +1,9 @@ +local entity = world:spawn() +local child = world:spawn(entity) + +world:push_children(entity, {child}) + +local children = world:get_children(entity) + +assert(#children == 1, "Expected 1 child") +assert(children[1]:index() == child:index(), "Child is the wrong entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua new file mode 100644 index 0000000000..2516a20860 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua @@ -0,0 +1,4 @@ + +assert_throws(function() + world:get_children(Entity.from_raw(9999)) +end, "Entity does not exist") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua new file mode 100644 index 0000000000..49992aecf3 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua @@ -0,0 +1,4 @@ +local entity = world:spawn() +local children = world:get_children(entity) + +assert(#children == 0) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua new file mode 100644 index 0000000000..955a467b13 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua @@ -0,0 +1,9 @@ +local entity = world:spawn() +local child = world:spawn(entity) + +world:push_children(entity, {child}) + +local parent = world:get_parent(child) + +assert(parent ~= nil, "Expected a parent") +assert(parent:index() == entity:index(), "Parent is the wrong entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua new file mode 100644 index 0000000000..06500f3360 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua @@ -0,0 +1,4 @@ + +assert_throws(function() + world:get_parent(Entity.from_raw(9999)) +end, "Entity does not exist") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua new file mode 100644 index 0000000000..723c709a56 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua @@ -0,0 +1,4 @@ +local entity = world:spawn() +local parent = world:get_parent(entity) + +assert(parent == nil, "Expected no parents") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua new file mode 100644 index 0000000000..014d3bb892 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua @@ -0,0 +1,5 @@ +local entity = world:spawn() + +world:insert_children(entity,1 , {}) + +assert(#world:get_children(entity) == 0) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua new file mode 100644 index 0000000000..6f7f133beb --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua @@ -0,0 +1,8 @@ +local entity = world:spawn() +local child = world:spawn() +local child2 = world:spawn() + +world:insert_children(entity, 1, {child}) +world:insert_children(entity, 1, {child2}) + +assert(world:get_children(entity)[1]:index() == child2:index()) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua new file mode 100644 index 0000000000..b9360485fc --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua @@ -0,0 +1,7 @@ +local entity = world:spawn() +local child = world:spawn() +local child2 = world:spawn() + +world:insert_children(entity, 1, {child, child2}) + +assert(#world:get_children(entity) == 2) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua new file mode 100644 index 0000000000..528f1eb64d --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua @@ -0,0 +1,10 @@ +local fake_entity = Entity.from_raw(9999) + +assert_throws(function() + world:insert_children(fake_entity, 1, {fake_entity}) +end, "parent Entity does not exist") + +local entity = world:spawn() +assert_throws(function() + world:insert_children(entity, 1, {fake_entity}) +end, "the Entity does not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua new file mode 100644 index 0000000000..350383361a --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua @@ -0,0 +1,5 @@ +local entity = world:spawn() + +world:push_children(entity, {}) + +assert(#world:get_children(entity) == 0) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua new file mode 100644 index 0000000000..1f082f1a1d --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua @@ -0,0 +1,7 @@ +local entity = world:spawn() +local child = world:spawn() +local child2 = world:spawn() + +world:push_children(entity, {child, child2}) + +assert(#world:get_children(entity) == 2) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua new file mode 100644 index 0000000000..eae6c3b0c4 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua @@ -0,0 +1,10 @@ +local fake_entity = Entity.from_raw(9999) + +assert_throws(function() + world:push_children(fake_entity, {fake_entity}) +end, "The parent Entity does not exist") + +local entity = world:spawn() +assert_throws(function() + world:push_children(entity, {fake_entity}) +end, "the Entity does not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 189a2269df..45f5d617fe 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -1,7 +1,7 @@ use bevy::{ app::App, asset::{AssetPlugin, AssetServer}, - prelude::{AppTypeRegistry, Entity, World}, + prelude::{AppTypeRegistry, Children, Entity, HierarchyPlugin, Parent, World}, reflect::{Reflect, TypeRegistration}, MinimalPlugins, }; @@ -30,7 +30,7 @@ use std::{ any::TypeId, borrow::Cow, fs::{self, DirEntry}, - io, + io, panic, path::{Path, PathBuf}, sync::Arc, }; @@ -46,9 +46,16 @@ fn init_app() -> App { // we probably should cut down some fat in here, but it's fast enough so meh app.add_plugins(AssetPlugin::default()) + .add_plugins(HierarchyPlugin) .add_plugins(LuaScriptingPlugin::<()>::default()) .add_plugins(bevy_mod_scripting_lua::bindings::providers::LuaBevyScriptingPlugin); + // for some reason hierarchy plugin doesn't register the children component + app.world_mut().register_component::(); + app.world_mut().register_component::(); + app.finish(); + app.cleanup(); + app } @@ -88,23 +95,24 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul let assert_throws = lua .create_function(|_, (f, regex): (LuaFunction, String)| { let result = f.call::<(), ()>(()); - match result { - Ok(_) => Err(tealr::mlu::mlua::Error::RuntimeError( - "Expected function to throw error, but it did not.".into(), - )), - Err(e) => { - let error_message = e.to_string(); - let regex = regex::Regex::new(®ex).unwrap(); - if regex.is_match(&error_message) { - Ok(()) - } else { - Err(tealr::mlu::mlua::Error::RuntimeError(format!( - "Expected error message to match the regex: \n{}\n\nBut got:\n{}", - regex.as_str(), - error_message - ))) - } + let err = match result { + Ok(_) => { + return Err(tealr::mlu::mlua::Error::RuntimeError( + "Expected function to throw error, but it did not.".into(), + )) } + Err(e) => e.to_string(), + }; + + let regex = regex::Regex::new(®ex).unwrap(); + if regex.is_match(&err) { + Ok(()) + } else { + Err(tealr::mlu::mlua::Error::RuntimeError(format!( + "Expected error message to match the regex: \n{}\n\nBut got:\n{}", + regex.as_str(), + err + ))) } }) .unwrap(); From 0b9e277b828acf86f91307cc066f775b596cd494 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 15 Nov 2024 17:44:33 +0000 Subject: [PATCH 022/217] re-implement dynamic queries Co-authored-by: Lily --- .../src/bindings/query.rs | 105 ++++++++++----- .../src/bindings/world.rs | 6 +- .../src/bindings/mod.rs | 3 +- .../src/bindings/query.rs | 122 ++++++++++++++++++ .../src/bindings/world.rs | 21 +++ .../bevy_mod_scripting_lua/src/util.rs | 65 +++++++++- .../query/empty_query_returns_nothing.lua | 5 + .../query_returns_all_entities_matching.lua | 31 +++++ 8 files changed, 320 insertions(+), 38 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 95421292ed..cf2a4dfdf7 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -1,10 +1,14 @@ -use super::{ReflectReference, WorldCallbackAccess}; -use crate::prelude::ScriptResult; +use super::{ReflectReference, WorldAccessGuard, WorldCallbackAccess}; +use crate::{ + bindings::{CONCURRENT_WORLD_ACCESS_MSG, STALE_WORLD_MSG}, + prelude::ScriptResult, +}; use bevy::{ ecs::{component::ComponentId, entity::Entity}, + prelude::{EntityRef, QueryBuilder}, reflect::TypeRegistration, }; -use std::{any::TypeId, ops::Deref, sync::Arc}; +use std::{any::TypeId, collections::VecDeque, sync::Arc}; /// A wrapper around a `TypeRegistration` that provides additional information about the type. /// @@ -65,24 +69,14 @@ impl std::fmt::Display for ScriptTypeRegistration { } } -#[derive(Clone)] +#[derive(Clone, Default)] pub struct ScriptQueryBuilder { - world: WorldCallbackAccess, components: Vec, with: Vec, without: Vec, } impl ScriptQueryBuilder { - pub fn new(world: WorldCallbackAccess) -> Self { - Self { - world, - components: vec![], - with: vec![], - without: vec![], - } - } - pub fn components(&mut self, components: Vec) -> &mut Self { self.components.extend(components); self @@ -97,29 +91,76 @@ impl ScriptQueryBuilder { self.without.extend(without); self } - - pub fn build(&mut self) -> ScriptResult> { - self.world.query( - std::mem::take(&mut self.components), - std::mem::take(&mut self.with), - std::mem::take(&mut self.without), - ) - } } #[derive(Clone)] pub struct ScriptQueryResult(pub Entity, pub Vec); impl WorldCallbackAccess { - pub fn query( - &mut self, - components: Vec, - with: Vec, - without: Vec, - ) -> ScriptResult> { - // for c in components { - - // } - todo!() + pub fn query(&self, query: ScriptQueryBuilder) -> ScriptResult> { + // find the set of components + self.read() + .unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")) + .query(query) } } + +impl<'w> WorldAccessGuard<'w> { + pub fn query(&self, query: ScriptQueryBuilder) -> ScriptResult> { + let world = self + .get_whole_world_access() + .unwrap_or_else(|| panic!("{CONCURRENT_WORLD_ACCESS_MSG}")); + + let mut dynamic_query = QueryBuilder::::new(world); + + // we don't actually want to fetch the data for components now, only figure out + // which entities match the query + // so we might be being slightly overkill + for c in &query.components { + dynamic_query.ref_id(c.component_id().unwrap()); + } + + for w in query.with { + dynamic_query.with_id(w.component_id.unwrap()); + } + + for without_id in query.without { + dynamic_query.without_id(without_id.component_id.unwrap()); + } + + let mut built_query = dynamic_query.build(); + let query_result = built_query.iter(world); + + Ok(query_result + .map(|r| { + let references: Vec<_> = query + .components + .iter() + .map(|c| ReflectReference { + base: super::ReflectBaseType { + type_id: c.type_id(), + base_id: super::ReflectBase::Component(r.id(), c.component_id.unwrap()), + }, + reflect_path: vec![], + }) + .collect(); + ScriptQueryResult(r.id(), references) + }) + .collect()) + } +} + +#[cfg(test)] +mod test { + use test_utils::test_data::setup_world; + + use super::*; + + // #[test] + // fn test_simple_query() { + // let world = setup_world(|w,r|{ + // w.spawn(TestComponent::init()) + // w.spawn(Te) + // }) + // } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index e63f51399b..63f42b520e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -245,11 +245,11 @@ pub const DEFAULT_INTERVAL: Duration = Duration::from_millis(10); /// Provides safe access to the world via [`WorldAccess`] permissions, which enforce aliasing rules at runtime in multi-thread environments #[derive(Clone)] pub struct WorldAccessGuard<'w> { - cell: UnsafeWorldCell<'w>, + pub cell: UnsafeWorldCell<'w>, // TODO: this is fairly hefty, explore other ways to hand out locks on WorldAccess - accesses: Arc>>>, + pub accesses: Arc>>>, /// true if anybody has any access to the world - accesses_count: Arc, + pub accesses_count: Arc, // TODO can we track code/stack locations of things holding onto theese locks for debugging? } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs index 5a278b6306..78cd9549b3 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs @@ -1,7 +1,6 @@ -use bevy_mod_scripting_core::bindings::WorldCallbackAccess; - pub mod providers; pub mod proxy; +pub mod query; pub mod reference; pub mod std; pub mod type_registration; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs new file mode 100644 index 0000000000..da545e2483 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs @@ -0,0 +1,122 @@ +use std::ops::{Deref, DerefMut}; + +use bevy::prelude::Entity; +use bevy_mod_scripting_core::bindings::{ + ReflectAllocator, ReflectReference, ScriptQueryBuilder, ScriptTypeRegistration, Unproxy, + ValProxy, +}; +use tealr::{ + mlu::{ + mlua::{IntoLua, Value}, + TealData, TypedFunction, + }, + ToTypename, +}; + +use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata, util::Variadic}; + +use super::{ + proxy::{LuaProxied, LuaValProxy}, + reference::LuaReflectReference, + world::GetWorld, +}; + +#[derive(Default, Clone)] +pub struct LuaQueryBuilder(pub(crate) ScriptQueryBuilder); + +impl Deref for LuaQueryBuilder { + type Target = ScriptQueryBuilder; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for LuaQueryBuilder { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl LuaQueryBuilder {} + +impl LuaProxied for ScriptQueryBuilder { + type Proxy = LuaQueryBuilder; +} + +impl_userdata_from_lua!(LuaQueryBuilder); +impl_userdata_with_tealdata!(LuaQueryBuilder); + +impl TealData for LuaQueryBuilder { + fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut T) { + methods.add_function( + "with", + |_, (mut this, mut query): (Self, Variadic>)| { + let registrations: Vec<_> = query + .iter_mut() + .map(|v| v.unproxy()) + .collect::>() + .map_err(tealr::mlu::mlua::Error::external)?; + this.0.with(registrations); + Ok(this) + }, + ); + + methods.add_function( + "without", + |_, (mut this, mut query): (Self, Variadic>)| { + let registrations: Vec<_> = query + .iter_mut() + .map(|v| v.unproxy()) + .collect::>() + .map_err(tealr::mlu::mlua::Error::external)?; + this.0.without(registrations); + Ok(this) + }, + ); + + methods.add_function("iter", |l, this: LuaQueryBuilder| { + let world = l.get_world()?; + let mut result = world + .query(this.0) + .map_err(tealr::mlu::mlua::Error::external)?; + let mut len = result.len(); + let iterator = TypedFunction::from_rust_mut( + move |lua, ()| { + if len > 0 { + let result = result + .pop_front() + .expect("invariant: len of array = len && len > 0"); + let entity = + world.with_resource::(|_, mut allocator| { + ReflectReference::new_allocated(result.0, &mut allocator) + }); + let proxy_entity = + ::Proxy::from(entity).into_lua(lua)?; + let component_refs: Vec<_> = result + .1 + .into_iter() + .map(|r| LuaReflectReference(r).to_lua_proxy(lua)) + .collect::>()?; + + len -= 1; + + Ok(Variadic::new( + std::iter::once(proxy_entity).chain(component_refs.into_iter()), + )) + } else { + Ok(Variadic::new(vec![Value::Nil, Value::Nil])) + } + }, + l, + )?; + Ok(iterator) + }); + } +} + +impl ToTypename for LuaQueryBuilder { + fn to_typename() -> tealr::Type { + tealr::Type::new_single("QueryBuilder", tealr::KindOfType::External) + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index f7ddbf5ed3..3c143a5f0d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -20,6 +20,7 @@ use tealr::{ }; use super::proxy::LuaReflectRefProxy; +use super::query::LuaQueryBuilder; use super::{ providers::bevy_ecs::LuaEntity, proxy::{ @@ -27,6 +28,7 @@ use super::{ }, type_registration::LuaTypeRegistration, }; +use crate::util::Variadic; use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata}; pub struct Nil; @@ -375,6 +377,25 @@ impl TealData for LuaWorld { Ok(TypenameProxy::<_, Nil>::new(out)) }, ); + + methods.add_method( + "query", + |_, this, mut components: Variadic>| { + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + let mut builder = LuaQueryBuilder::default(); + let deque = components.0; + builder.components( + deque + .into_iter() + .map(|mut c| c.unproxy()) + .collect::>() + .map_err(tealr::mlu::mlua::Error::external)?, + ); + Ok(builder) + }, + ); } fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} diff --git a/crates/languages/bevy_mod_scripting_lua/src/util.rs b/crates/languages/bevy_mod_scripting_lua/src/util.rs index 2652ee2f0a..52d4308a5c 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/util.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/util.rs @@ -1,3 +1,10 @@ +use std::ops::{Deref, DerefMut}; + +use tealr::{ + mlu::mlua::{FromLua, FromLuaMulti, IntoLua, IntoLuaMulti}, + ToTypename, +}; + /// generates path to the given script depending on build configuration. /// (optimized builds don't have the teal compiler available) /// @@ -163,7 +170,12 @@ macro_rules! impl_userdata_from_lua { _lua: &::tealr::mlu::mlua::Lua, ) -> Result { match value { - tealr::mlu::mlua::Value::UserData(ud) => Ok(ud.borrow::()?.clone()), + tealr::mlu::mlua::Value::UserData(ud) => { + // for types which deref to something else we need to be explicit + let self_ref: std::cell::Ref = ud.borrow::()?; + let self_ref: &Self = std::ops::Deref::deref(&self_ref); + Ok(self_ref.clone()) + } _ => { return Err(::tealr::mlu::mlua::Error::FromLuaConversionError { from: value.type_name(), @@ -198,3 +210,54 @@ macro_rules! impl_userdata_with_tealdata { } }; } + +/// Variadic newtype with [`ToTypename`] implemantation +pub struct Variadic(pub(crate) tealr::mlu::mlua::Variadic); + +impl Variadic { + pub fn new>(iter: I) -> Self { + Variadic(tealr::mlu::mlua::Variadic::from_iter(iter.into_iter())) + } +} + +impl Deref for Variadic { + type Target = tealr::mlu::mlua::Variadic; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for Variadic { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl ToTypename for Variadic { + fn to_typename() -> tealr::Type { + let single_type = T::to_typename(); + let collection_type = >::to_typename(); + tealr::Type::Or(vec![single_type, collection_type]) + } +} + +impl<'lua, T: FromLua<'lua>> FromLuaMulti<'lua> for Variadic { + fn from_lua_multi( + values: tealr::mlu::mlua::MultiValue<'lua>, + lua: &'lua tealr::mlu::mlua::Lua, + ) -> tealr::mlu::mlua::Result { + Ok(Variadic(tealr::mlu::mlua::Variadic::from_lua_multi( + values, lua, + )?)) + } +} + +impl<'lua, T: IntoLua<'lua>> IntoLuaMulti<'lua> for Variadic { + fn into_lua_multi( + self, + lua: &'lua tealr::mlu::mlua::Lua, + ) -> tealr::mlu::mlua::Result> { + self.0.into_lua_multi(lua) + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua new file mode 100644 index 0000000000..d31939bdb9 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua @@ -0,0 +1,5 @@ +local component_a = world:get_type_by_name("TestComponent") + +for entity,_ in world:query(component_a):with(component_a):without(component_a):iter() do + assert(false, "This should not be reached") +end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua new file mode 100644 index 0000000000..b624260ed7 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua @@ -0,0 +1,31 @@ +local entity_a = world:spawn() +local entity_b = world:spawn() +local entity_c = world:spawn() +local entity_d = _get_entity_with_test_component("CompWithFromWorldAndComponentData") + +local component_with = world:get_type_by_name("CompWithFromWorldAndComponentData") +local component_without = world:get_type_by_name("CompWithDefaultAndComponentData") + +world:add_default_component(entity_a, component_with) +world:add_default_component(entity_b, component_with) +world:add_default_component(entity_c, component_with) + +world:add_default_component(entity_b, component_without) + +local found_entities = {} +for entity, comp in world:query(component_with):with(component_with):without(component_without):iter() do + table.insert(found_entities, entity) +end + +assert(#found_entities == 3, "Expected 3 entities, got " .. #found_entities) + +expected_entities = { + entity_d, + entity_a, + entity_c, +} + +for i, entity in ipairs(found_entities) do + assert(entity:index() == expected_entities[i]:index(), "Expected entity " .. expected_entities[i]:index() .. " but got " .. entity:index()) +end + From debaa169f7a315570cc25caa784fc81b8a8bde7b Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 19 Nov 2024 15:26:07 +0000 Subject: [PATCH 023/217] Re-implement changes to rhai and rune, and fix event recipients example --- .github/workflows/bevy_mod_scripting.yml | 22 +- .github/workflows/doc_gen.yml | 2 +- .vscode/launch.json | 2 +- Cargo.toml | 44 +- assets/scripts/event_recipients.lua | 6 +- check.sh | 2 +- .../bevy_mod_scripting_core/src/commands.rs | 4 +- crates/bevy_mod_scripting_core/src/context.rs | 2 +- crates/bevy_mod_scripting_core/src/lib.rs | 55 +- crates/bevy_mod_scripting_core/src/runtime.rs | 20 +- crates/bevy_mod_scripting_core/src/systems.rs | 34 +- .../bevy_mod_scripting_lua/src/assets.rs | 1 - .../bevy_mod_scripting_lua/src/lib.rs | 25 +- .../bevy_mod_scripting_rhai/src/lib.rs | 505 +++++++++++------ .../bevy_mod_scripting_rune/src/lib.rs | 527 +++++++++--------- crates/macro_tests/Cargo.toml | 6 +- examples/lua/event_recipients.rs | 174 ++---- src/lib.rs | 22 +- 18 files changed, 787 insertions(+), 666 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 8524716b1a..4c5b625c4e 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -26,15 +26,15 @@ jobs: strategy: matrix: run_args: [ - {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 } + {label: Windows - All Features, os: windows-latest, features: "lua54,rhai,teal,rune", cross: x86_64-pc-windows-msvc }, + {label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,teal,rune", cross: x86_64-apple-darwin }, + {label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,rune", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,rune", cross: aarch64-unknown-linux-gnu }, + {label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52", cross: x86_64-unknown-linux-gnu } ] steps: - if: runner.os == 'linux' @@ -94,7 +94,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: clippy - args: --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build -- -D warnings + args: --features=lua54,rhai,teal,rune --profile=ephemeral-build -- -D warnings tests: name: Tests runs-on: ubuntu-latest @@ -114,7 +114,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: test - args: --workspace --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build + args: --workspace --features=lua54,rhai,teal,rune --profile=ephemeral-build docs: name: Docs runs-on: ubuntu-latest diff --git a/.github/workflows/doc_gen.yml b/.github/workflows/doc_gen.yml index 0d8a75a703..ed7055970e 100644 --- a/.github/workflows/doc_gen.yml +++ b/.github/workflows/doc_gen.yml @@ -32,7 +32,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: run - args: --features=lua54,lua_script_api lua + args: --features=lua54 lua - run: cat ./assets/scripts/doc/tealr_doc_gen_config.json - name: Push to pages uses: cpina/github-action-push-to-another-repository@main diff --git a/.vscode/launch.json b/.vscode/launch.json index a6483eca38..67b227bd90 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,7 +25,7 @@ "build", "--example=game_of_life_lua", "--package=bevy_mod_scripting", - "--features=lua54,teal,lua_script_api", + "--features=lua54,teal", ], "filter": { "name": "game_of_life_lua", diff --git a/Cargo.toml b/Cargo.toml index c924731e43..e586aa3725 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,15 +21,7 @@ name = "bevy_mod_scripting" path = "src/lib.rs" [package.metadata."docs.rs"] -features = [ - "lua", - "lua54", - "rhai", - "lua_script_api", - "rhai_script_api", - "teal", - "rune", -] +features = ["lua", "lua54", "rhai", "teal", "rune"] [features] ## core @@ -46,7 +38,6 @@ luajit = ["bevy_mod_scripting_lua/luajit", "lua"] luajit52 = ["bevy_mod_scripting_lua/luajit52", "lua"] # optional -lua_script_api = ["bevy_script_api/lua"] unsafe_lua_modules = ["bevy_mod_scripting_lua/unsafe_lua_modules"] teal = ["bevy_mod_scripting_lua/teal"] mlua_serialize = ["bevy_mod_scripting_lua/mlua_serialize"] @@ -55,7 +46,6 @@ mlua_async = ["bevy_mod_scripting_lua/mlua_async"] ## rhai rhai = ["bevy_mod_scripting_rhai"] -rhai_script_api = ["bevy_script_api/rhai"] ## rune rune = ["bevy_mod_scripting_rune"] @@ -66,7 +56,6 @@ 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 } [workspace.dependencies] @@ -86,7 +75,6 @@ rhai-rand = "0.1" members = [ "crates/bevy_mod_scripting_core", "crates/bevy_event_priority", - "crates/bevy_script_api", "crates/languages/bevy_mod_scripting_lua", "crates/languages/bevy_mod_scripting_lua_derive", "crates/languages/bevy_mod_scripting_rhai", @@ -120,7 +108,7 @@ debug = false # path = "examples/lua/console_integration.rs" # required-features = [ # "lua54", -# "lua_script_api", +# # "bevy/file_watcher", # "bevy/multi_threaded", # ] @@ -130,7 +118,7 @@ debug = false # path = "examples/rhai/console_integration.rs" # required-features = [ # "rhai", -# "rhai_script_api", +# , # "bevy/file_watcher", # "bevy/multi_threaded", # ] @@ -143,32 +131,22 @@ required-features = ["lua54"] [[example]] name = "dynamic_queries_lua" path = "examples/lua/dynamic_queries.rs" -required-features = ["lua54", "lua_script_api"] +required-features = ["lua54"] [[example]] name = "dynamic_queries_rhai" path = "examples/rhai/dynamic_queries.rs" -required-features = ["rhai", "rhai_script_api"] +required-features = ["rhai"] [[example]] name = "game_of_life_lua" path = "examples/lua/game_of_life.rs" -required-features = [ - "lua54", - "lua_script_api", - "bevy/file_watcher", - "bevy/multi_threaded", -] +required-features = ["lua54", "bevy/file_watcher", "bevy/multi_threaded"] [[example]] +required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] name = "game_of_life_rhai" path = "examples/rhai/game_of_life.rs" -required-features = [ - "rhai", - "rhai_script_api", - "bevy/file_watcher", - "bevy/multi_threaded", -] [[example]] name = "event_recipients_lua" @@ -183,22 +161,22 @@ required-features = ["lua54"] [[example]] name = "documentation_gen_lua" path = "examples/lua/documentation_gen.rs" -required-features = ["lua54", "teal", "lua_script_api"] +required-features = ["lua54", "teal"] [[example]] name = "bevy_api_lua" path = "examples/lua/bevy_api.rs" -required-features = ["lua54", "lua_script_api"] +required-features = ["lua54"] [[example]] name = "bevy_api_rhai" path = "examples/rhai/bevy_api.rs" -required-features = ["rhai", "rhai_script_api"] +required-features = ["rhai"] [[example]] name = "wrappers" path = "examples/wrappers.rs" -required-features = ["lua54", "lua_script_api"] +required-features = ["lua54"] [[example]] name = "minimal_rune" diff --git a/assets/scripts/event_recipients.lua b/assets/scripts/event_recipients.lua index 2aa50e2528..b846a742ae 100644 --- a/assets/scripts/event_recipients.lua +++ b/assets/scripts/event_recipients.lua @@ -1,4 +1,6 @@ function on_event(id) - print(string.format("on_event, script_id: %d, Handling:", script_id)) - print(string.format("\t-> id: %d", id)) + print(string.format("on_event, script_id: %s, Handling:", script_id)) + print(string.format("\t-> id : %d", id)) + print(string.format("\t-> entity : %s", entity)) + end diff --git a/check.sh b/check.sh index eb7a8f5488..18d7f7c1c4 100755 --- a/check.sh +++ b/check.sh @@ -6,5 +6,5 @@ CURRENT_DIR=$(basename "$PWD") if [[ "$CURRENT_DIR" == "bevy_api_gen" ]]; then 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" + cargo clippy --workspace --all-targets --message-format=json --features="lua54 rhai teal rune bevy/file_watcher bevy/multi_threaded" fi diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index d2b3618445..ddefeee03a 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -106,10 +106,12 @@ impl Command for CreateOrUpdateScript { // If None assign new context ID, otherwise assign the old one // If re-loading and different from the previous one, the old one will be removed let current_context_id = (assigner.assign)(script.as_deref(), &self.id, &self.content, &mut contexts); + debug!("Context assigned: {:?}", current_context_id); + let current_context_id = if let Some(id) = current_context_id { id } else { - let ctxt = (builder.load)(&self.id, &self.content, &settings.context_initializers, &settings.context_pre_handling_initializers, world, runtime.runtime.as_mut().unwrap()).unwrap(); + let ctxt = (builder.load)(&self.id, &self.content, &settings.context_initializers, &settings.context_pre_handling_initializers, world, &mut runtime.runtime).unwrap(); contexts.insert(ctxt) }; diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs index 169cd831da..fcd5087cd5 100644 --- a/crates/bevy_mod_scripting_core/src/context.rs +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -136,7 +136,7 @@ pub struct ContextAssigner { impl Default for ContextAssigner { fn default() -> Self { Self { - assign: |_, _, _, c| Some(c.allocate_id()), + assign: |old, _, _, _| old.map(|s| s.context_id), remove: |id, _, c| _ = c.remove(id), } } diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 92ed2a219f..8b5c0f00df 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -34,11 +34,12 @@ pub mod prelude { pub use {crate::docs::*, crate::error::*, crate::event::*, crate::systems::*, crate::*}; } -#[derive(Default)] /// Bevy plugin enabling scripting within the bevy mod scripting framework pub struct ScriptingPlugin { /// Callback for initiating the runtime - pub runtime_builder: Option R>, + pub runtime_builder: fn() -> R, + /// Settings for the runtime + pub runtime_settings: Option>, /// The handler used for executing callbacks in scripts pub callback_handler: Option>, /// The context builder for loading contexts @@ -47,6 +48,18 @@ pub struct ScriptingPlugin { pub context_assigner: Option>, } +impl Default for ScriptingPlugin { + fn default() -> Self { + Self { + runtime_builder: R::default, + runtime_settings: Default::default(), + callback_handler: Default::default(), + context_builder: Default::default(), + context_assigner: Default::default(), + } + } +} + impl Plugin for ScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { app.add_event::() @@ -60,11 +73,10 @@ impl Plugin for ScriptingPlugin { extensions: &[], preprocessor: None, }) - // not every script host will have a runtime, for convenience we add a dummy runtime + .insert_resource(self.runtime_settings.as_ref().cloned().unwrap_or_default()) .insert_non_send_resource::>(RuntimeContainer { - runtime: self.runtime_builder.map(|f| f()), + runtime: (self.runtime_builder)(), }) - .init_non_send_resource::>() .init_non_send_resource::>() .insert_resource::>(CallbackSettings { callback_handler: self.callback_handler, @@ -86,7 +98,9 @@ pub trait AddRuntimeInitializer { impl AddRuntimeInitializer for App { fn add_runtime_initializer(&mut self, initializer: RuntimeInitializer) -> &mut Self { - self.world_mut().init_resource::>(); + if !self.world_mut().contains_resource::>() { + self.world_mut().init_resource::>(); + } self.world_mut() .resource_mut::>() .as_mut() @@ -180,3 +194,32 @@ impl StoreDocumentation for App { top_fragment.gen_docs() } } + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_default_scripting_plugin_initializes_all_resources_correctly() { + let mut app = App::new(); + #[derive(Default, Clone)] + struct A; + #[derive(Default, Clone)] + struct C; + #[derive(Default, Clone)] + struct R; + app.add_plugins(AssetPlugin::default()); + app.add_plugins(ScriptingPlugin::::default()); + + assert!(app.world().contains_resource::()); + assert!(app.world().contains_resource::()); + assert!(app.world().contains_resource::()); + assert!(app.world().contains_resource::>()); + assert!(app.world().contains_resource::>()); + assert!(app + .world() + .contains_resource::>()); + assert!(app.world().contains_non_send::>()); + assert!(app.world().contains_non_send::>()); + } +} diff --git a/crates/bevy_mod_scripting_core/src/runtime.rs b/crates/bevy_mod_scripting_core/src/runtime.rs index 6530829904..6b9fe7fb67 100644 --- a/crates/bevy_mod_scripting_core/src/runtime.rs +++ b/crates/bevy_mod_scripting_core/src/runtime.rs @@ -8,7 +8,7 @@ impl Runtime for T {} pub type RuntimeInitializer = fn(&mut R); -#[derive(Clone, Resource)] +#[derive(Resource)] pub struct RuntimeSettings { pub initializers: Vec>, } @@ -21,16 +21,16 @@ impl Default for RuntimeSettings { } } -/// Stores a particular runtime. -#[derive(Resource)] -pub struct RuntimeContainer { - pub runtime: Option, -} - -impl Default for RuntimeContainer { - fn default() -> Self { +impl Clone for RuntimeSettings { + fn clone(&self) -> Self { Self { - runtime: Default::default(), + initializers: self.initializers.clone(), } } } + +/// Stores a particular runtime. +#[derive(Resource)] +pub struct RuntimeContainer { + pub runtime: R, +} diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 78ea221327..cf38c001e2 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -22,11 +22,9 @@ pub fn initialize_runtime( mut runtime: NonSendMut>, settings: Res>, ) { - if let Some(r) = runtime.runtime.as_mut() { - for initializer in settings.initializers.iter() { - (initializer)(r); - } - }; + for initializer in settings.initializers.iter() { + (initializer)(&mut runtime.runtime); + } } /// Processes and reacts appropriately to script asset events, and queues commands to update the internal script state @@ -95,16 +93,11 @@ pub fn event_handler( .remove_non_send_resource::>() .unwrap_or_else(|| { panic!( - "No runtime container for runtime {} found", + "No runtime container for runtime {} found. Was the scripting plugin initialized correctly?", type_name::() ) }); - let runtime = runtime_container.runtime.as_mut().unwrap_or_else(|| { - panic!( - "No valid runtime in runtime container for runtime {}", - type_name::() - ) - }); + let runtime = &mut runtime_container.runtime; let mut script_contexts = world .remove_non_send_resource::>() .unwrap_or_else(|| panic!("No script contexts found for context {}", type_name::())); @@ -246,10 +239,16 @@ mod test { }); app.add_systems(Update, event_handler::); app.insert_resource::(Scripts { scripts }); - app.insert_non_send_resource::>(RuntimeContainer { - runtime: Some(runtime), - }); + app.insert_non_send_resource::>(RuntimeContainer { runtime }); app.insert_non_send_resource::>(ScriptContexts { contexts }); + app.insert_resource(ContextLoadingSettings:: { + loader: None, + assigner: None, + context_initializers: vec![], + context_pre_handling_initializers: vec![], + }); + app.finish(); + app.cleanup(); app } @@ -315,8 +314,6 @@ mod test { assert_eq!( test_runtime .runtime - .as_ref() - .unwrap() .invocations .iter() .map(|(e, s)| (*e, s.clone())) @@ -390,6 +387,7 @@ mod test { "test_args_entity".to_owned(), crate::event::Recipients::Entity(test_entity_id), )); + app.update(); let test_context = app @@ -413,8 +411,6 @@ mod test { assert_eq!( test_runtime .runtime - .as_ref() - .unwrap() .invocations .iter() .map(|(e, s)| (*e, s.clone())) diff --git a/crates/languages/bevy_mod_scripting_lua/src/assets.rs b/crates/languages/bevy_mod_scripting_lua/src/assets.rs index b7d54e0c7a..79352f5d45 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/assets.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/assets.rs @@ -3,7 +3,6 @@ // reflect::TypePath, // utils::BoxedFuture, // }; -// use bevy_mod_scripting_core::asset::CodeAsset; // use anyhow::Error; diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 3fac3c6553..4c73cc2610 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -7,15 +7,19 @@ use bevy::{ reflect::{FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, }; use bevy_mod_scripting_core::{ - bindings::{ReflectReference, WorldCallbackAccess}, + bindings::{ReflectAllocator, ReflectReference, WorldCallbackAccess}, context::{ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, error::ScriptError, event::CallbackLabel, handler::Args, script::ScriptId, - ScriptingPlugin, + AddContextPreHandlingInitializer, ScriptingPlugin, +}; +use bindings::{ + providers::bevy_ecs::LuaEntity, + proxy::LuaProxied, + world::{GetWorld, LuaWorld}, }; -use bindings::{proxy::LuaProxied, world::LuaWorld}; pub use tealr; pub mod bindings; use tealr::mlu::mlua::{FromLua, Function, IntoLua, IntoLuaMulti, Lua, Value}; @@ -42,7 +46,8 @@ impl Default for LuaScriptingPlugin { LuaScriptingPlugin { scripting_plugin: ScriptingPlugin { context_assigner: None, - runtime_builder: None, + runtime_builder: Default::default, + runtime_settings: None, callback_handler: Some(lua_handler::), context_builder: Some(ContextBuilder:: { load: lua_context_load, @@ -76,6 +81,17 @@ impl Plugin for LuaScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); register_lua_values(app); + app.add_context_pre_handling_initializer::<()>(|script_id, entity, context: &mut Lua| { + let world = context.get_world().unwrap(); + let lua_entity = world.with_resource::(|_, mut allocator| { + let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); + ::Proxy::from(reflect_reference) + }); + + context.globals().set("script_id", script_id.to_owned())?; + context.globals().set("entity", lua_entity)?; + Ok(()) + }); } } @@ -163,7 +179,6 @@ pub fn with_world Result<(), ScriptError>>( ) -> Result<(), ScriptError> { WorldCallbackAccess::with_callback_access(world, |guard| { context.globals().set("world", LuaWorld(guard.clone()))?; - // TODO set entity + script id as well f(context) }) } diff --git a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs index cbb0eb1687..267f2758ae 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs @@ -1,202 +1,351 @@ -use crate::{ - assets::{RhaiFile, RhaiLoader}, - docs::RhaiDocFragment, +use bevy::{ + app::Plugin, + ecs::{entity::Entity, world::World}, }; -use bevy::{ecs::schedule::ScheduleLabel, prelude::*}; -use bevy_mod_scripting_core::{prelude::*, systems::*, world::WorldPointerGuard}; -use rhai::*; -use std::marker::PhantomData; +use bevy_mod_scripting_core::{ + bindings::WorldCallbackAccess, + context::{ContextAssigner, ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, + error::ScriptError, + event::CallbackLabel, + handler::Args, + script::ScriptId, + ScriptingPlugin, +}; +use rhai::{CallFnOptions, Engine, FnPtr, FuncArgs, Scope, AST}; -pub mod assets; -pub mod docs; pub use rhai; pub mod prelude { - pub use crate::{ - assets::{RhaiFile, RhaiLoader}, - docs::RhaiDocFragment, - RhaiContext, RhaiEvent, RhaiScriptHost, - }; pub use rhai; - pub use rhai::{Engine, FuncArgs}; + pub use rhai::FuncArgs; } -#[derive(Resource)] -pub struct RhaiScriptHost { - pub engine: Engine, - _ph: PhantomData, +pub trait RhaiEventArg: Args + FuncArgs {} +impl RhaiEventArg for T {} + +pub type RhaiRuntime = Engine; + +pub struct RhaiScriptContext { + pub ast: AST, + pub scope: Scope<'static>, } -#[allow(deprecated)] -impl Default for RhaiScriptHost { +pub struct RhaiScriptingPlugin { + pub scripting_plugin: ScriptingPlugin, +} + +impl Default for RhaiScriptingPlugin { fn default() -> Self { - let mut e = Engine::new(); - // prevent shadowing of `state`,`world` and `entity` in variable in scripts - e.on_def_var(|_, info, _| { - Ok(info.name() != "state" && info.name() != "world" && info.name() != "entity") - }); - - Self { - engine: e, - _ph: Default::default(), + RhaiScriptingPlugin { + scripting_plugin: ScriptingPlugin { + runtime_builder: RhaiRuntime::new, + runtime_settings: None, + callback_handler: Some(rhai_callback_handler::), + context_assigner: None, + context_builder: Some(ContextBuilder { + load: rhai_context_load, + reload: rhai_context_reload, + }), + }, } } } -pub struct RhaiContext { - pub ast: AST, - pub scope: Scope<'static>, +impl Plugin for RhaiScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + self.scripting_plugin.build(app); + } } -#[derive(Clone, Event)] -/// A Rhai Hook. The result of creating this event will be -/// a call to the lua script with the hook_name and the given arguments -pub struct RhaiEvent { - pub hook_name: String, - pub args: A, - pub recipients: Recipients, +pub fn rhai_context_load( + script: &ScriptId, + content: &[u8], + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], + world: &mut World, + runtime: &mut RhaiRuntime, +) -> Result { + let mut ast = runtime.compile(std::str::from_utf8(content)?)?; + ast.set_source(script.to_string()); + + let mut context = RhaiScriptContext { + ast, + scope: Scope::new(), + }; + with_world(world, &mut context, |mut context| { + initializers + .iter() + .try_for_each(|init| init(script, context))?; + + pre_handling_initializers + .iter() + .try_for_each(|init| init(script, Entity::from_raw(0), context))?; + + runtime.eval_ast_with_scope(&mut context.scope, &context.ast)?; + // do not invoke top level statements after the first time we run the script + context.ast.clear_statements(); + + Ok(()) + })?; + Ok(context) } -impl ScriptEvent for RhaiEvent { - fn recipients(&self) -> &crate::Recipients { - &self.recipients - } +pub fn rhai_context_reload( + script: &ScriptId, + content: &[u8], + context: &mut RhaiScriptContext, + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], + world: &mut World, + runtime: &mut RhaiRuntime, +) -> Result<(), ScriptError> { + *context = rhai_context_load( + script, + content, + initializers, + pre_handling_initializers, + world, + runtime, + )?; + Ok(()) } -impl ScriptHost for RhaiScriptHost { - type ScriptContext = RhaiContext; - type ScriptEvent = RhaiEvent; - type ScriptAsset = RhaiFile; - type APITarget = Engine; - type DocTarget = RhaiDocFragment; - - fn register_with_app_in_set( - app: &mut bevy::prelude::App, - schedule: impl ScheduleLabel, - set: impl SystemSet, - ) { - app.add_priority_event::() - .init_asset::() - .init_asset_loader::() - .init_resource::>() - .init_resource::>() - .init_resource::>() - .register_type::>() - .register_type::>() - .register_type::>() - .add_systems( - schedule, - ( - script_add_synchronizer::, - script_remove_synchronizer::, - script_hot_reload_handler::, - ) - .chain() - .in_set(set), - ) - // setup engine - .add_systems( - Startup, - |mut providers: ResMut>, mut host: ResMut| { - providers - .attach_all(&mut host.engine) - .expect("Error in adding api's for rhai"); - }, - ); - } +#[allow(clippy::too_many_arguments)] +pub fn rhai_callback_handler( + args: A, + entity: Entity, + script_id: &ScriptId, + callback: &CallbackLabel, + context: &mut RhaiScriptContext, + pre_handling_initializers: &[ContextPreHandlingInitializer], + runtime: &mut RhaiRuntime, + world: &mut World, +) -> Result<(), ScriptError> { + with_world(world, context, |context| { + pre_handling_initializers + .iter() + .try_for_each(|init| init(script_id, entity, context))?; - fn setup_script( - &mut self, - script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - providers: &mut APIProviders, - ) -> Result<(), ScriptError> { - providers.setup_all(script_data, ctx) - } + if context + .scope + .get_value::(callback.as_ref()) + .is_none() + { + // not subscribed to this handler + return Ok(()); + }; - fn load_script( - &mut self, - script: &[u8], - script_data: &ScriptData, - _: &mut APIProviders, - ) -> Result { - let mut scope = Scope::new(); - let mut ast = self - .engine - .compile( - std::str::from_utf8(script).map_err(|e| ScriptError::FailedToLoad { - script: script_data.name.to_owned(), - msg: e.to_string(), - })?, - ) - .map_err(|e| ScriptError::SyntaxError { - script: script_data.name.to_owned(), - msg: e.to_string(), - })?; - - ast.set_source(script_data.name); - - // persistent state for scripts - scope.push("state", Map::new()); - - Ok(RhaiContext { ast, scope }) - } + // we want the call to be able to impact the scope + let options = CallFnOptions::new().rewind_scope(false); + runtime.call_fn_with_options( + options, + &mut context.scope, + &context.ast, + callback.as_ref(), + args, + )?; + Ok(()) + }) +} - fn handle_events<'a>( - &mut self, - world: &mut World, - events: &[Self::ScriptEvent], - ctxs: impl Iterator, &'a mut Self::ScriptContext)>, - providers: &mut APIProviders, - ) { - // safety: - // - we have &mut World access - // - we do not use the original reference again anywhere in this function - let world = unsafe { WorldPointerGuard::new(world) }; - - ctxs.for_each(|(fd, ctx)| { - providers - .setup_runtime_all(world.clone(), &fd, ctx) - .expect("Failed to setup script runtime"); - - for event in events.iter() { - // check if this script should handle this event - if !event.recipients().is_recipient(&fd) { - continue; - }; - - match self.engine.call_fn( - &mut ctx.scope, - &ctx.ast, - &event.hook_name, - event.args.clone(), - ) { - Ok(v) => v, - Err(e) => { - let mut world = world.write(); - let mut state: CachedScriptState = world.remove_resource().unwrap(); - - match *e { - EvalAltResult::ErrorFunctionNotFound(..) => {} - _ => { - let (_, mut error_wrt, _) = state.event_state.get_mut(&mut world); - - let error = ScriptError::RuntimeError { - script: fd.name.to_string(), - msg: e.to_string(), - }; - error!("{}", error); - error_wrt.send(ScriptErrorEvent { error }); - } - } - - world.insert_resource(state); - } - }; - } - - // executing this at the end here means we execute global statements exactly once - // all this method call does is set a variable on the AST to NONE so should not affect performance - ctx.ast.clear_statements(); - }); - } +pub fn with_world Result<(), ScriptError>>( + world: &mut World, + context: &mut RhaiScriptContext, + f: F, +) -> Result<(), ScriptError> { + WorldCallbackAccess::with_callback_access(world, |guard| { + context.scope.push("world", guard.clone()); + f(context) + }) } +// use crate::{ +// assets::{RhaiFile, RhaiLoader}, +// docs::RhaiDocFragment, +// }; +// use bevy::{ecs::schedule::ScheduleLabel, prelude::*}; +// use bevy_mod_scripting_core::{prelude::*, systems::*}; +// use rhai::*; +// use std::marker::PhantomData; + +// pub mod assets; +// pub mod docs; +// pub use rhai; +// pub mod prelude { +// pub use crate::{ +// assets::{RhaiFile, RhaiLoader}, +// docs::RhaiDocFragment, +// RhaiContext, RhaiEvent, RhaiScriptHost, +// }; +// pub use rhai; +// pub use rhai::{RhaiRuntime, FuncArgs}; +// } + +// #[derive(Resource)] +// pub struct RhaiScriptHost { +// pub RhaiRuntime: RhaiRuntime, +// _ph: PhantomData, +// } + +// #[allow(deprecated)] +// impl Default for RhaiScriptHost { +// fn default() -> Self { +// let mut e = RhaiRuntime::new(); +// // prevent shadowing of `state`,`world` and `entity` in variable in scripts +// e.on_def_var(|_, info, _| { +// Ok(info.name() != "state" && info.name() != "world" && info.name() != "entity") +// }); + +// Self { +// RhaiRuntime: e, +// _ph: Default::default(), +// } +// } +// } + +// pub struct RhaiContext { +// pub ast: AST, +// pub scope: Scope<'static>, +// } + +// #[derive(Clone, Event)] +// /// A Rhai Hook. The result of creating this event will be +// /// a call to the lua script with the hook_name and the given arguments +// pub struct RhaiEvent { +// pub hook_name: String, +// pub args: A, +// pub recipients: Recipients, +// } + +// impl ScriptEvent for RhaiEvent { +// fn recipients(&self) -> &crate::Recipients { +// &self.recipients +// } +// } + +// impl ScriptHost for RhaiScriptHost { +// type ScriptContext = RhaiContext; +// type ScriptEvent = RhaiEvent; +// type ScriptAsset = RhaiFile; +// type APITarget = RhaiRuntime; +// type DocTarget = RhaiDocFragment; + +// fn register_with_app_in_set( +// app: &mut bevy::prelude::App, +// schedule: impl ScheduleLabel, +// set: impl SystemSet, +// ) { +// app.add_priority_event::() +// .init_asset::() +// .init_asset_loader::() +// .init_resource::>() +// .init_resource::>() +// .init_resource::>() +// .register_type::>() +// .register_type::>() +// .register_type::>() +// .add_systems( +// schedule, +// ( +// script_add_synchronizer::, +// script_remove_synchronizer::, +// script_hot_reload_handler::, +// ) +// .chain() +// .in_set(set), +// ) +// // setup RhaiRuntime +// .add_systems( +// Startup, +// |mut providers: ResMut>, mut host: ResMut| { +// providers +// .attach_all(&mut host.RhaiRuntime) +// .expect("Error in adding api's for rhai"); +// }, +// ); +// } + +// fn setup_script( +// &mut self, +// script_data: &ScriptData, +// ctx: &mut Self::ScriptContext, +// providers: &mut APIProviders, +// ) -> Result<(), ScriptError> { +// providers.setup_all(script_data, ctx) +// } + +// fn load_script( +// &mut self, +// script: &[u8], +// script_data: &ScriptData, +// _: &mut APIProviders, +// ) -> Result { +// let mut scope = Scope::new(); +// let mut ast = self +// .RhaiRuntime +// .compile( +// std::str::from_utf8(script).map_err(|e| ScriptError::FailedToLoad { +// script: script_data.name.to_owned(), +// msg: e.to_string(), +// })?, +// ) +// .map_err(|e| ScriptError::SyntaxError { +// script: script_data.name.to_owned(), +// msg: e.to_string(), +// })?; + +// ast.set_source(script_data.name); + +// // persistent state for scripts +// scope.push("state", Map::new()); + +// Ok(RhaiContext { ast, scope }) +// } + +// fn handle_events<'a>( +// &mut self, +// world: &mut World, +// events: &[Self::ScriptEvent], +// ctxs: impl Iterator, &'a mut Self::ScriptContext)>, +// _providers: &mut APIProviders, +// ) { +// ctxs.for_each(|(fd, ctx)| { +// for event in events.iter() { +// // check if this script should handle this event +// if !event.recipients().is_recipient(&fd) { +// continue; +// }; + +// match self.RhaiRuntime.call_fn( +// &mut ctx.scope, +// &ctx.ast, +// &event.hook_name, +// event.args.clone(), +// ) { +// Ok(v) => v, +// Err(e) => { +// let mut state: CachedScriptState = world.remove_resource().unwrap(); + +// match *e { +// EvalAltResult::ErrorFunctionNotFound(..) => {} +// _ => { +// let (_, mut error_wrt, _) = state.event_state.get_mut(world); + +// let error = ScriptError::RuntimeError { +// script: fd.name.to_string(), +// msg: e.to_string(), +// }; +// error!("{}", error); +// error_wrt.send(ScriptErrorEvent { error }); +// } +// } + +// world.insert_resource(state); +// } +// }; +// } + +// // executing this at the end here means we execute global statements exactly once +// // all this method call does is set a variable on the AST to NONE so should not affect performance +// ctx.ast.clear_statements(); +// }); +// } +// } diff --git a/crates/languages/bevy_mod_scripting_rune/src/lib.rs b/crates/languages/bevy_mod_scripting_rune/src/lib.rs index 4c7dc0652a..cbcc14d4ac 100644 --- a/crates/languages/bevy_mod_scripting_rune/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rune/src/lib.rs @@ -1,271 +1,292 @@ -use std::{marker::PhantomData, sync::Arc}; +use std::sync::Arc; -use bevy::prelude::*; -use bevy_mod_scripting_core::{ - prelude::*, - systems::{self, CachedScriptState}, - world::{WorldPointer, WorldPointerGuard}, -}; -use prelude::{RuneDocFragment, RuneFile, RuneLoader}; +use bevy_mod_scripting_core::ScriptingPlugin; use rune::{ - runtime::{Args, RuntimeContext, VmError, VmResult}, - Context, Diagnostics, Source, Sources, Unit, Vm, + runtime::{Args, RuntimeContext}, + Unit, Vm, }; -mod assets; -mod docs; - -pub mod prelude { - pub use crate::{ - assets::{RuneFile, RuneLoader}, - docs::RuneDocFragment, - RuneArgs, RuneEvent, RuneScriptContext, RuneScriptHost, - }; - pub use rune::{self, runtime::Args, Context}; -} - -/// Super trait adding additional bounds to Rune's `Args` trait. -/// It's gets automatically implemented for any type that implments `Args`, -/// so you should never have to manually implement it. -pub trait RuneArgs: Args + Clone + Send + Sync + 'static {} - -impl RuneArgs for T {} - -/// A Rune script hook. -#[derive(Debug, Clone, Event)] -pub struct RuneEvent { - /// The name of the Rune function to call. - pub hook_name: String, - /// The arguments to supply the function being invoked. If you - /// don't need any arguments, `()` is a good default value. - pub args: A, - /// The target set of scripts that should handle this event. - pub recipients: Recipients, -} - -impl ScriptEvent for RuneEvent { - fn recipients(&self) -> &Recipients { - &self.recipients - } -} - -/// A cached Rune Vm used to execute units. -struct RuneVm(Vm); +pub trait RuneEventArg: Args + Clone + Send + Sync + 'static {} +impl RuneEventArg for T {} -impl Default for RuneVm { - fn default() -> Self { - Self(Vm::new( - Arc::new(RuntimeContext::default()), - Arc::new(Unit::default()), - )) - } -} - -/// Script context for a rune script. pub struct RuneScriptContext { pub unit: Arc, pub runtime_context: Arc, } -#[derive(Resource)] -/// Rune script host. Enables Rune scripting. -pub struct RuneScriptHost { - _ph: PhantomData, +pub type RuneRuntime = Vm; + +pub struct RuneScriptingPlugin { + pub scripting_plugin: ScriptingPlugin, } -impl Default for RuneScriptHost { +impl Default for RuneScriptingPlugin { fn default() -> Self { Self { - _ph: Default::default(), + scripting_plugin: ScriptingPlugin { + runtime_builder: todo!(), + runtime_settings: todo!(), + callback_handler: todo!(), + context_builder: todo!(), + context_assigner: todo!(), + }, } } } -impl RuneScriptHost { - /// Helper function to handle errors from a Rune virtual machine. - /// - #[cold] - fn handle_rune_error(world: WorldPointer, error: VmError, script_data: &ScriptData<'_>) { - let mut world = world.write(); - let mut state: CachedScriptState = world.remove_resource().unwrap(); - - let (_, mut error_wrt, _) = state.event_state.get_mut(&mut world); - - let error = ScriptError::RuntimeError { - script: script_data.name.to_owned(), - msg: error.to_string(), - }; - - error!("{}", error); - - error_wrt.send(ScriptErrorEvent { error }); - world.insert_resource(state); - } -} - -impl ScriptHost for RuneScriptHost { - type ScriptContext = RuneScriptContext; - - type ScriptEvent = RuneEvent; - - type ScriptAsset = RuneFile; - - type APITarget = Context; - - type DocTarget = RuneDocFragment; - - fn register_with_app_in_set( - app: &mut App, - schedule: impl bevy::ecs::schedule::ScheduleLabel, - set: impl SystemSet, - ) { - app.add_priority_event::() - .init_asset::() - .init_asset_loader::() - .init_resource::>() - .init_resource::>() - .init_resource::>() - .register_type::>() - .register_type::>() - .register_type::>() - // Add a cached Vm as a non-send resource. - .insert_non_send_resource(RuneVm::default()) - // handle script insertions removal first - // then update their contexts later on script asset changes - .add_systems( - schedule, - ( - systems::script_add_synchronizer::, - systems::script_remove_synchronizer::, - systems::script_hot_reload_handler::, - ) - .chain() - .in_set(set), - ); - } - - fn load_script( - &mut self, - script: &[u8], - script_data: &ScriptData, - providers: &mut APIProviders, - ) -> Result { - let mut context = rune_modules::default_context().map_err(ScriptError::new_other)?; - - // Rune requires that we tell it what modules and types we'll be using before - // it compiles a file. - providers.attach_all(&mut context).unwrap(); - - let mut diagnostics = Diagnostics::new(); - - let mut sources = Sources::new(); - sources - .insert( - Source::new( - script_data.name, - std::str::from_utf8(script).expect("Slice is not UTF-8"), - ) - .map_err(|msg| ScriptError::FailedToLoad { - script: script_data.name.into(), - msg: msg.to_string(), - })?, - ) - .map_err(|msg| ScriptError::FailedToLoad { - script: script_data.name.into(), - msg: msg.to_string(), - })?; - - let result = rune::prepare(&mut sources) - .with_context(&context) - .with_diagnostics(&mut diagnostics) - .build(); - - if !diagnostics.is_empty() { - let mut writer = rune::termcolor::Buffer::no_color(); - - diagnostics - .emit(&mut writer, &sources) - .expect("Failed to write diagnostics to buffer"); - - return Err(ScriptError::SyntaxError { - script: script_data.name.into(), - msg: std::str::from_utf8(writer.as_slice()) - .expect("Slice was not UTF-8") - .to_owned(), - }); - } - - let unit = result.expect("Failed to build Rune unit."); - - let runtime_ctx = context - .runtime() - .expect("Failed to create Rune runtime context."); - - Ok(RuneScriptContext { - unit: Arc::new(unit), - runtime_context: Arc::new(runtime_ctx), - }) - } - - fn setup_script( - &mut self, - script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - providers: &mut APIProviders, - ) -> Result<(), ScriptError> { - providers.setup_all(script_data, ctx) - } - - fn handle_events<'a>( - &mut self, - world: &mut World, - events: &[Self::ScriptEvent], - ctxs: impl Iterator, &'a mut Self::ScriptContext)>, - providers: &mut APIProviders, - ) { - // Grab the cached Vm. - let RuneVm(mut vm) = world.remove_non_send_resource::().unwrap(/* invariant */); - - { - // Safety: - // - we have &mut World access - // - we do not use the original reference again anywhere in this block. - // - the guard is dropped at the end of this block. - let world = unsafe { WorldPointerGuard::new(world) }; - - ctxs.for_each(|(script_data, ctx)| { - providers - .setup_runtime_all(world.clone(), &script_data, ctx) - .expect("Could not setup script runtime"); - - for event in events { - if !event.recipients().is_recipient(&script_data) { - continue; - } - - // Swap out the old context and old unit with the new ones. - *vm.context_mut() = Arc::clone(&ctx.runtime_context); - *vm.unit_mut() = Arc::clone(&ctx.unit); - - let mut exec = match vm.execute([event.hook_name.as_str()], event.args.clone()) - { - Ok(exec) => exec, - Err(error) => { - Self::handle_rune_error(world.clone(), error, &script_data); - continue; - } - }; - - if let VmResult::Err(error) = exec.complete() { - Self::handle_rune_error(world.clone(), error, &script_data); - } - } - }); - - // explictly release the pointer to world. - drop(world); - } - - world.insert_non_send_resource(RuneVm(vm)); - } -} +// use std::{marker::PhantomData, sync::Arc}; + +// use bevy::prelude::*; +// use bevy_mod_scripting_core::{ +// prelude::*, +// systems::{self, CachedScriptState}, +// }; +// use prelude::{RuneDocFragment, RuneFile, RuneLoader}; +// use rune::{ +// runtime::{Args, RuntimeContext, VmError, VmResult}, +// Context, Diagnostics, Source, Sources, Unit, Vm, +// }; + +// mod assets; +// mod docs; + +// pub mod prelude { +// pub use crate::{ +// assets::{RuneFile, RuneLoader}, +// docs::RuneDocFragment, +// RuneArgs, RuneEvent, RuneScriptContext, RuneScriptHost, +// }; +// pub use rune::{self, runtime::Args, Context}; +// } + +// /// Super trait adding additional bounds to Rune's `Args` trait. +// /// It's gets automatically implemented for any type that implments `Args`, +// /// so you should never have to manually implement it. +// pub trait RuneArgs: Args + Clone + Send + Sync + 'static {} + +// impl RuneArgs for T {} + +// /// A Rune script hook. +// #[derive(Debug, Clone, Event)] +// pub struct RuneEvent { +// /// The name of the Rune function to call. +// pub hook_name: String, +// /// The arguments to supply the function being invoked. If you +// /// don't need any arguments, `()` is a good default value. +// pub args: A, +// /// The target set of scripts that should handle this event. +// pub recipients: Recipients, +// } + +// impl ScriptEvent for RuneEvent { +// fn recipients(&self) -> &Recipients { +// &self.recipients +// } +// } + +// /// A cached Rune Vm used to execute units. +// struct RuneVm(Vm); + +// impl Default for RuneVm { +// fn default() -> Self { +// Self(Vm::new( +// Arc::new(RuntimeContext::default()), +// Arc::new(Unit::default()), +// )) +// } +// } + +// /// Script context for a rune script. +// pub struct RuneScriptContext { +// pub unit: Arc, +// pub runtime_context: Arc, +// } + +// #[derive(Resource)] +// /// Rune script host. Enables Rune scripting. +// pub struct RuneScriptHost { +// _ph: PhantomData, +// } + +// impl Default for RuneScriptHost { +// fn default() -> Self { +// Self { +// _ph: Default::default(), +// } +// } +// } + +// impl RuneScriptHost { +// /// Helper function to handle errors from a Rune virtual machine. +// /// +// #[cold] +// fn handle_rune_error(world: &mut World, error: VmError, script_data: &ScriptData<'_>) { +// let mut state: CachedScriptState = world.remove_resource().unwrap(); + +// let (_, mut error_wrt, _) = state.event_state.get_mut(world); + +// let error = ScriptError::RuntimeError { +// script: script_data.name.to_owned(), +// msg: error.to_string(), +// }; + +// error!("{}", error); + +// error_wrt.send(ScriptErrorEvent { error }); +// world.insert_resource(state); +// } +// } + +// impl ScriptHost for RuneScriptHost { +// type ScriptContext = RuneScriptContext; + +// type ScriptEvent = RuneEvent; + +// type ScriptAsset = RuneFile; + +// type APITarget = Context; + +// type DocTarget = RuneDocFragment; + +// fn register_with_app_in_set( +// app: &mut App, +// schedule: impl bevy::ecs::schedule::ScheduleLabel, +// set: impl SystemSet, +// ) { +// app.add_priority_event::() +// .init_asset::() +// .init_asset_loader::() +// .init_resource::>() +// .init_resource::>() +// .init_resource::>() +// .register_type::>() +// .register_type::>() +// .register_type::>() +// // Add a cached Vm as a non-send resource. +// .insert_non_send_resource(RuneVm::default()) +// // handle script insertions removal first +// // then update their contexts later on script asset changes +// .add_systems( +// schedule, +// ( +// systems::script_add_synchronizer::, +// systems::script_remove_synchronizer::, +// systems::script_hot_reload_handler::, +// ) +// .chain() +// .in_set(set), +// ); +// } + +// fn load_script( +// &mut self, +// script: &[u8], +// script_data: &ScriptData, +// providers: &mut APIProviders, +// ) -> Result { +// let mut context = rune_modules::default_context().map_err(ScriptError::new_other)?; + +// // Rune requires that we tell it what modules and types we'll be using before +// // it compiles a file. +// providers.attach_all(&mut context).unwrap(); + +// let mut diagnostics = Diagnostics::new(); + +// let mut sources = Sources::new(); +// sources +// .insert( +// Source::new( +// script_data.name, +// std::str::from_utf8(script).expect("Slice is not UTF-8"), +// ) +// .map_err(|msg| ScriptError::FailedToLoad { +// script: script_data.name.into(), +// msg: msg.to_string(), +// })?, +// ) +// .map_err(|msg| ScriptError::FailedToLoad { +// script: script_data.name.into(), +// msg: msg.to_string(), +// })?; + +// let result = rune::prepare(&mut sources) +// .with_context(&context) +// .with_diagnostics(&mut diagnostics) +// .build(); + +// if !diagnostics.is_empty() { +// let mut writer = rune::termcolor::Buffer::no_color(); + +// diagnostics +// .emit(&mut writer, &sources) +// .expect("Failed to write diagnostics to buffer"); + +// return Err(ScriptError::SyntaxError { +// script: script_data.name.into(), +// msg: std::str::from_utf8(writer.as_slice()) +// .expect("Slice was not UTF-8") +// .to_owned(), +// }); +// } + +// let unit = result.expect("Failed to build Rune unit."); + +// let runtime_ctx = context +// .runtime() +// .expect("Failed to create Rune runtime context."); + +// Ok(RuneScriptContext { +// unit: Arc::new(unit), +// runtime_context: Arc::new(runtime_ctx), +// }) +// } + +// fn setup_script( +// &mut self, +// script_data: &ScriptData, +// ctx: &mut Self::ScriptContext, +// providers: &mut APIProviders, +// ) -> Result<(), ScriptError> { +// providers.setup_all(script_data, ctx) +// } + +// fn handle_events<'a>( +// &mut self, +// world: &mut World, +// events: &[Self::ScriptEvent], +// ctxs: impl Iterator, &'a mut Self::ScriptContext)>, +// _providers: &mut APIProviders, +// ) { +// // Grab the cached Vm. +// let RuneVm(mut vm) = world.remove_non_send_resource::().unwrap(/* invariant */); + +// { +// ctxs.for_each(|(script_data, ctx)| { +// for event in events { +// if !event.recipients().is_recipient(&script_data) { +// continue; +// } + +// // Swap out the old context and old unit with the new ones. +// *vm.context_mut() = Arc::clone(&ctx.runtime_context); +// *vm.unit_mut() = Arc::clone(&ctx.unit); + +// let mut exec = match vm.execute([event.hook_name.as_str()], event.args.clone()) +// { +// Ok(exec) => exec, +// Err(error) => { +// Self::handle_rune_error(world, error, &script_data); +// continue; +// } +// }; + +// if let VmResult::Err(error) = exec.complete() { +// Self::handle_rune_error(world, error, &script_data); +// } +// } +// }); +// } + +// world.insert_non_send_resource(RuneVm(vm)); +// } +// } diff --git a/crates/macro_tests/Cargo.toml b/crates/macro_tests/Cargo.toml index 89eb194ccb..240b0c5eb9 100644 --- a/crates/macro_tests/Cargo.toml +++ b/crates/macro_tests/Cargo.toml @@ -16,11 +16,7 @@ debug = false [dev-dependencies] trybuild = "1.0" bevy = { version = "0.15.0-rc.3", default-features = false } -bevy_mod_scripting = { path = "../../", features = [ - "lua", - "lua_script_api", - "lua54", -] } +bevy_mod_scripting = { path = "../../", features = ["lua", "lua54"] } bevy_script_api = { path = "../bevy_script_api" } bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua" } bevy_mod_scripting_core = { path = "../bevy_mod_scripting_core" } diff --git a/examples/lua/event_recipients.rs b/examples/lua/event_recipients.rs index 3a8a75e106..310d50e5b2 100644 --- a/examples/lua/event_recipients.rs +++ b/examples/lua/event_recipients.rs @@ -1,134 +1,72 @@ -use bevy::prelude::*; +use bevy::{app::AppExit, core::FrameCount, prelude::*}; +use bevy_mod_scripting::lua::LuaScriptingPlugin; use bevy_mod_scripting::prelude::*; -use rand::prelude::SliceRandom; -use std::sync::atomic::Ordering::Relaxed; -use std::sync::{atomic::AtomicU32, Mutex}; - -#[derive(Clone)] -pub struct MyLuaArg(usize); - -impl<'lua> IntoLua<'lua> for MyLuaArg { - fn into_lua(self, lua: &'lua Lua) -> mlua::Result> { - self.0.into_lua(lua) - } -} - -#[derive(Default)] -pub struct LuaAPIProvider; - -/// the custom Lua api, world is provided via a global pointer, -/// and callbacks are defined only once at script creation -impl APIProvider for LuaAPIProvider { - type APITarget = Mutex; - type DocTarget = LuaDocFragment; - type ScriptContext = Mutex; - - fn attach_api(&mut self, ctx: &mut Self::APITarget) -> Result<(), ScriptError> { - // callbacks can receive any `ToLuaMulti` arguments, here '()' and - // return any `FromLuaMulti` arguments, here a `usize` - // check the Rlua documentation for more details - - let ctx = ctx.get_mut().unwrap(); - - ctx.globals() - .set( - "print", - ctx.create_function(|_ctx, msg: String| { - info!("{}", msg); - Ok(()) - }) - .map_err(ScriptError::new_other)?, - ) - .map_err(ScriptError::new_other)?; - - Ok(()) - } - - fn setup_script( - &mut self, - script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - let ctx = ctx.get_mut().unwrap(); - let globals = ctx.globals(); - globals - .set("script_id", script_data.sid) - .map_err(ScriptError::new_other)?; - Ok(()) - } +use bevy_mod_scripting_core::{ + asset::ScriptAsset, script::ScriptComponent, AddContextPreHandlingInitializer, +}; + +fn load_script( + server: Res, + mut commands: Commands, + mut handle: Local>, +) { + let path = "scripts/event_recipients.lua"; + let handle_ = server.load::(path); + *handle = handle_; + + commands.spawn(ScriptComponent::new(vec![ + "scripts/event_recipients.lua".into() + ])); + commands.spawn(ScriptComponent::new(vec![ + "scripts/event_recipients.lua".into() + ])); } -static COUNTER: AtomicU32 = AtomicU32::new(0); - -/// utility for generating random events from a list -fn fire_random_event(w: &mut PriorityEventWriter>, events: &[ScriptEventData]) { - let mut rng = rand::thread_rng(); - let id = COUNTER.fetch_add(1, Relaxed); - let arg = MyLuaArg(id as usize); - let event = events - .choose(&mut rng) - .map(|v| LuaEvent { - hook_name: v.0.to_string(), - args: arg, - recipients: v.1.clone(), - }) - .unwrap(); - - info!( - "\t - event: {},\t recipients: {:?},\t id: {}", - event.hook_name, event.recipients, id - ); - w.send(event, 0); +fn trigger_script_callback(mut writer: EventWriter>) { + writer.send(ScriptCallbackEvent::new_for_all( + OnEventCallback::into_callback_label(), + 1, + )); + + writer.send(ScriptCallbackEvent::new( + OnEventCallback::into_callback_label(), + 2, + Recipients::Entity(Entity::from_raw(6)), + )); } -fn do_update(mut w: PriorityEventWriter>) { - info!("Update, firing:"); - - let all_events = [ - ScriptEventData("on_event", Recipients::All), - ScriptEventData("on_event", Recipients::ScriptID(0)), - ScriptEventData("on_event", Recipients::ScriptID(1)), - ScriptEventData( - "on_event", - Recipients::ScriptName("scripts/event_recipients.lua".to_owned()), - ), - ]; - - // fire random event, for any of the system sets - fire_random_event(&mut w, &all_events); +fn quit_after_few_frames(mut exit: EventWriter, count: Res) { + if count.0 > 5 { + exit.send(AppExit::Success); + } } -#[derive(Clone)] -pub struct ScriptEventData(&'static str, Recipients); - -fn load_our_scripts(server: Res, mut commands: Commands) { - // spawn two identical scripts - // id's will be 0 and 1 - let path = "scripts/event_recipients.lua"; - let handle = server.load::(path); - let scripts = (0..2) - .map(|_| Script::::new(path.to_string(), handle.clone())) - .collect(); - - commands - .spawn(()) - .insert(ScriptCollection:: { scripts }); +pub struct OnEventCallback; +impl IntoCallbackLabel for OnEventCallback { + fn into_callback_label() -> CallbackLabel { + "on_event".into() + } } fn main() -> std::io::Result<()> { let mut app = App::new(); app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_systems(Startup, load_our_scripts) - // randomly fire events for either all scripts, - // the script with id 0 - // or the script with id 1 - .add_systems(Update, do_update) - .add_script_handler::, 0, 0>(PostUpdate) - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaAPIProvider)); - app.run(); + .add_plugins(LuaScriptingPlugin::::default()) + .add_context_pre_handling_initializer::<()>(|_, e, ctx: &mut Lua| { + ctx.globals().set("entity", format!("{e:?}")).unwrap(); + Ok(()) + }) + .add_systems(Startup, load_script) + .add_systems( + Update, + ( + trigger_script_callback, + event_handler::.after(trigger_script_callback), + quit_after_few_frames, + ), + ) + .run(); Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 82d53079ed..cb50ebb838 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,21 +7,11 @@ pub mod core { #[cfg(feature = "lua")] pub mod lua { pub use bevy_mod_scripting_lua::*; - - #[cfg(feature = "lua_script_api")] - pub mod api { - pub use bevy_script_api::lua::*; - } } #[cfg(feature = "rhai")] pub mod rhai { pub use bevy_mod_scripting_rhai::*; - - #[cfg(feature = "rhai_script_api")] - pub mod api { - pub use bevy_script_api::rhai::*; - } } #[cfg(feature = "rune")] @@ -29,11 +19,6 @@ pub mod rune { pub use bevy_mod_scripting_rune::*; } -#[cfg(any(feature = "lua_script_api", feature = "rhai_script_api"))] -pub mod api { - pub use bevy_script_api::*; -} - pub mod prelude { pub use bevy_mod_scripting_core::prelude::*; @@ -43,9 +28,6 @@ pub mod prelude { #[cfg(feature = "rhai")] pub use bevy_mod_scripting_rhai::prelude::*; - #[cfg(feature = "rune")] - pub use bevy_mod_scripting_rune::prelude::*; - - #[cfg(any(feature = "lua_script_api", feature = "rhai_script_api"))] - pub use bevy_script_api::prelude::*; + // #[cfg(feature = "rune")] + // pub use bevy_mod_scripting_rune::prelude::*; } From 1f329aad3cfe510861ada5301aab9564a312c58f Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 19 Nov 2024 20:08:47 +0000 Subject: [PATCH 024/217] update more examples --- assets/scripts/bevy_api.lua | 128 +++++++++++ assets/scripts/coroutines.lua | 3 +- assets/scripts/dynamic_queries.lua | 30 ++- .../src/bindings/reference.rs | 23 +- .../src/bindings/world.rs | 15 ++ .../bevy_mod_scripting_core/src/commands.rs | 13 +- crates/bevy_mod_scripting_core/src/systems.rs | 33 ++- .../src/bindings/reference.rs | 7 +- .../src/bindings/world.rs | 9 + examples/lua/bevy_api.rs | 215 +++--------------- examples/lua/complex_game_loop.rs | 193 ---------------- examples/lua/coroutines.rs | 56 +++-- examples/lua/dynamic_queries.rs | 47 ++-- examples/lua/event_recipients.rs | 16 +- 14 files changed, 324 insertions(+), 464 deletions(-) create mode 100644 assets/scripts/bevy_api.lua delete mode 100644 examples/lua/complex_game_loop.rs diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua new file mode 100644 index 0000000000..5a1f0fc8f1 --- /dev/null +++ b/assets/scripts/bevy_api.lua @@ -0,0 +1,128 @@ +function table_to_string(t) + local result = "[" + for k,v in pairs(t) do + result = result .. string.format("%s:%s,",k,v) + end + return result .. "]" +end + + +-- the api provides us with 3 globals +print(entity) +print(script) +print(world) + +-- we first retrieve ID's for our component and resource by their short name (long name/full path also work) +local my_component_type = world:get_type_by_name("MyComponent") + +-- then ask the world to give us a reference to `MyComponent` on the entity we just spawned +-- resources work the same way, but we use `get_resource` instead of `get_component` +-- the comp object is resolved to a `bevy_script_api::script_ref::ReflectValue` which implements UserData. +-- we can use a custom proxy instead (by implementing LuaProxyable), but this is the simplest way to get started. +local comp = world:get_component(entity, my_component_type) +print("Before script: ", comp) + +print("============") + +-- the index metamethod on ReflectValue's uses bevy's reflection mechanism on top of some custom sub-reflection logic to +-- allow reflecting inside Options, Vectors etc. +-- when we index into ReflectValue's we either get back a custom proxy or another ReflectValue + +-- the LuaBevyAPIProvider provides us custom proxies for many bevy types as well as std types. +-- all of these implementations can be overridden via the bevy TypeRegistry +comp.usize = 2 +print("comp.usize after assigning to 2: ", comp.usize) + +-- vec's and matrices have custom __index and __newindex overrides +print("comp.vec2 before: ", comp.vec2) +comp.vec2[1] = 69 +print("comp.vec2 after: ", comp.vec2) + +-- Option's get converted to nil or the value inside +print("comp.option_vec3 before: ", comp.option_vec3) +comp.option_vec3 = Vec3.new(2,1,3) +print("comp.option_vec3 after: ", comp.option_vec3) + +-- reflection via index is indexed starting at 1, unlike in Rust to match Lua's indexing +print("comp.option_vec3[1] before: ", comp.option_vec3[1]) +comp.option_vec3[1] = 5 +print("comp.option_vec3[1] after: ", comp.option_vec3[1]) + +print("============") + +-- Vec references get converted to a custom proxy `LuaVec` which is +-- also assignable via lua tables + +print("comp.vec_of_option_bools before: ", table_to_string(comp.vec_of_option_bools)) +comp.vec_of_option_bools = {true,false,true} +print("comp.vec_of_option_bools after assignment: ", table_to_string(comp.vec_of_option_bools)) + +print("comp.vec_of_option_bools[1] before: ", comp.vec_of_option_bools[1]) +comp.vec_of_option_bools[1] = false +print("comp.vec_of_option_bools[1] after: ", comp.vec_of_option_bools[1]) + +-- there are some additional methods available on LuaVec proxies imitating the Vec api +print("comp.vec_of_option_bools before insert: ", table_to_string(comp.vec_of_option_bools)) +comp.vec_of_option_bools:insert(1,nil) +print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) + +print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) +comp.vec_of_option_bools:push(false) +print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) + +print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) + +print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) +print(comp.vec_of_option_bools:pop()) +print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) + +print("the pairs inside comp.vec_of_option_bools: ") +for k,v in pairs(comp.vec_of_option_bools) do + print(string.format(" - %s:%s",k,v)) +end + +comp.vec_of_option_bools:clear() +print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) + +print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) +print("============") + +print("comp.option_vec_of_bools before: ", table_to_string(comp.option_vec_of_bools)) +print(comp.option_vec_of_bools:pop()) +print("comp.option_vec_of_bools after pop: ", table_to_string(comp.option_vec_of_bools)) + + +print("comp.option_vec_of_bools len after pop: ", #comp.option_vec_of_bools) + +print("the pairs inside comp.option_vec_of_bools: ") +for k,v in pairs(comp.option_vec_of_bools) do + print(string.format(" - %s:%s",k,v)) +end + +print("============") + +local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3.x_axis +print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) + +local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) +print("new_mat3 is:", new_mat3) + +comp.vec2 = comp.vec2 + comp.vec2 +comp.usize = comp.vec2:min_element() +comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() +comp.vec2 = Vec2.new(2,1) +comp.quat = Quat.from_xyzw(3,2,1,4) +comp.mat3.x_axis = Vec3.new(69,69,69) + +print("============") + +-- this is an example of something impossible to achieve with plain bevy reflection under the hood +comp.mat3[1][1] = 42 + +-- now let's retrieve these again to see if we actually changed their values permanently +comp = world:get_component(entity,my_component_type) + +print("After script:") +print(comp) + +world:exit() \ No newline at end of file diff --git a/assets/scripts/coroutines.lua b/assets/scripts/coroutines.lua index 8fec50daca..941e25cab9 100644 --- a/assets/scripts/coroutines.lua +++ b/assets/scripts/coroutines.lua @@ -1,7 +1,6 @@ local my_routine; function on_update() - if my_routine == nil then my_routine = coroutine.create(function() local starttime = os.time() @@ -18,7 +17,7 @@ function on_update() coroutine.resume(my_routine) else print("Couroutine has finished, no longer running") + world:exit() end end - end diff --git a/assets/scripts/dynamic_queries.lua b/assets/scripts/dynamic_queries.lua index 8128df28f8..92b217d110 100644 --- a/assets/scripts/dynamic_queries.lua +++ b/assets/scripts/dynamic_queries.lua @@ -1,9 +1,23 @@ -function on_event() - local component_a = world:get_type_by_name("ComponentA") - local component_b = world:get_type_by_name("ComponentB") - local component_c = world:get_type_by_name("ComponentC") - - for entity, _ in world:query(component_a):with(component_b):without(component_c):iter() do - print(entity) - end +local component_a = world:get_type_by_name("ComponentA") +local component_b = world:get_type_by_name("ComponentB") +local component_c = world:get_type_by_name("ComponentC") + +print("Querying for entities with component_a and without component_c") +for entity, c in world:query(component_a):without(component_c):iter() do + print("Entity with index: " .. entity:index() .. " component: " .. tostring(c)) +end + +print("Querying for entities with component_b and without component_a") +for entity, c in world:query(component_b):without(component_a):iter() do + print("Entity with index: " .. entity:index() .. " component: " .. tostring(c)) end + +print("Querying for all components at once") +for entity, c1,c2,c3 in world:query(component_a, component_b, component_c):iter() do + print("Entity with index: " .. entity:index()) + print("\tComponentA: " .. tostring(c1)) + print("\tComponentB: " .. tostring(c2)) + print("\tComponentC: " .. tostring(c3)) +end + +world:exit() \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index eaaf44e7ec..b0ad73756b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -57,9 +57,16 @@ pub struct ReflectReference { } - impl ReflectReference { + pub fn print_with_world(&self, world: &WorldAccessGuard) -> String { + let base = world.with_resource(|_, type_registry: Mut| { + self.base.display_with_type_name(&type_registry.read()) + }); + + format!("Reference(base: {}, path: {:?})", base, self.reflect_path) + } + /// If this is a reference to something with a length accessible via reflection, returns that length. pub fn len(&self, world: &WorldAccessGuard) -> Option { world.with_resource(|world, type_registry: Mut| { @@ -371,11 +378,15 @@ impl ReflectBaseType { } pub fn display_with_type_name(&self, type_registry: &TypeRegistry) -> String { - format!( - "ReflectBase({}, {:?})", - Self::type_name(self.type_id, type_registry), - self.base_id - ) + let type_name = Self::type_name(self.type_id, type_registry); + + let kind = match self.base_id { + ReflectBase::Component(entity, _) => "Component", + ReflectBase::Resource(_) => "Resource", + ReflectBase::Owned(id) => "Allocation", + }; + + format!("{}({})", kind, type_name) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 63f42b520e..d5b9a2f27b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -18,6 +18,7 @@ use std::{ }; use bevy::{ + app::AppExit, ecs::{ component::{Component, ComponentId}, entity::Entity, @@ -234,6 +235,11 @@ impl WorldCallbackAccess { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.despawn_descendants(entity) } + + pub fn exit(&self) { + let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + world.exit() + } } /// Unit of world access @@ -973,6 +979,15 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } + + /// Sends AppExit event to the world with success status + pub fn exit(&self) { + if let Some(world) = self.get_whole_world_access() { + world.send_event(AppExit::Success); + } else { + panic!("{CONCURRENT_WORLD_ACCESS_MSG}") + } + } } /// Having this is permission to access the contained [`ReflectAccessId`], there is no way to access anything safely through a [`WorldAccessGuard`] diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index ddefeee03a..2c5367b403 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -1,4 +1,4 @@ -use std::marker::PhantomData; +use std::{any::type_name, marker::PhantomData}; use bevy::{asset::Handle, ecs::world::Mut, log::debug, prelude::Command}; @@ -7,6 +7,7 @@ use crate::{ context::{Context, ContextLoadingSettings, ScriptContexts}, prelude::{Runtime, RuntimeContainer}, script::{Script, ScriptId, Scripts}, + systems::handle_script_errors, }; pub struct DeleteScript { @@ -111,8 +112,14 @@ impl Command for CreateOrUpdateScript { let current_context_id = if let Some(id) = current_context_id { id } else { - let ctxt = (builder.load)(&self.id, &self.content, &settings.context_initializers, &settings.context_pre_handling_initializers, world, &mut runtime.runtime).unwrap(); - contexts.insert(ctxt) + let ctxt = (builder.load)(&self.id, &self.content, &settings.context_initializers, &settings.context_pre_handling_initializers, world, &mut runtime.runtime); + match ctxt { + Ok(ctxt) => contexts.insert(ctxt), + Err(e) => { + handle_script_errors(world, &format!("Failed to load context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()), [e]); + return; + } + } }; if let Some(previous) = previous_context_id { diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index cf38c001e2..ae52b80653 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -6,6 +6,7 @@ use crate::{ bindings::ReflectAllocator, commands::{CreateOrUpdateScript, DeleteScript}, context::{Context, ContextLoadingSettings, ScriptContexts}, + error::{ScriptError, ScriptResult}, event::{IntoCallbackLabel, ScriptCallbackEvent, ScriptErrorEvent}, handler::{Args, CallbackSettings}, prelude::RuntimeSettings, @@ -181,18 +182,30 @@ pub fn event_handler( world.insert_non_send_resource(runtime_container); world.insert_non_send_resource(script_contexts); - for error in errors { - let mut error_events = world - .get_resource_mut::>() - .expect("Missing events resource"); - - bevy::log::error!( - "Encountered error in event handling for - Runtime {}, Context: {}, Args: {}. {}", + handle_script_errors( + world, + &format!( + "Encountered error in event handling for: Runtime {}, Context: {}, Args: {}", type_name::(), type_name::(), - type_name::(), - error.to_string() - ); + type_name::() + ), + errors, + ); +} + +/// Handles errors caused by script execution and sends them to the error event channel +pub(crate) fn handle_script_errors>( + world: &mut World, + context: &str, + errors: I, +) { + let mut error_events = world + .get_resource_mut::>() + .expect("Missing events resource"); + + for error in errors { + bevy::log::error!("{}. {}", context, error.to_string()); error_events.send(ScriptErrorEvent { error }); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 7a7386b3c0..619f0e6760 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -224,7 +224,12 @@ impl TealData for LuaReflectReference { m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { self_.len(l) - }) + }); + + m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { + let world = lua.get_world()?; + Ok(self_.0.print_with_world(&world)) + }); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 3c143a5f0d..4c954d86f9 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -396,6 +396,15 @@ impl TealData for LuaWorld { Ok(builder) }, ); + + methods.add_method("exit", |_, this, ()| { + // TODO: somehow end control flow on lua side + let world = this.0.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + })?; + world.exit(); + Ok(()) + }); } fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index 493bec50b4..0177101cb8 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -1,9 +1,10 @@ +use asset::ScriptAsset; use bevy::app::AppExit; - use bevy::prelude::*; +use bevy_mod_scripting::lua::LuaScriptingPlugin; use bevy_mod_scripting::prelude::*; - -use bevy_script_api::lua::RegisterForeignLuaType; +use bevy_mod_scripting_lua::bindings::providers::LuaBevyScriptingPlugin; +use script::ScriptComponent; #[derive(Component, Default, Reflect)] #[reflect(Component)] @@ -18,188 +19,44 @@ pub struct MyComponent { option_vec_of_bools: Option>, } +fn load_script( + server: Res, + mut commands: Commands, + mut handle: Local>, +) { + let path = "scripts/bevy_api.lua"; + let handle_ = server.load::(path); + *handle = handle_; + + commands.spawn(ScriptComponent::new(vec![path.into()])); +} + +fn init_data(mut commands: Commands) { + commands.spawn(MyComponent { + usize: 5, + vec2: Vec2::new(1.0, 2.0), + f32: 6.7, + mat3: Mat3::from_cols( + Vec3::new(1.0, 2.0, 3.0), + Vec3::new(4.0, 5.0, 6.0), + Vec3::new(7.0, 8.0, 9.0), + ), + quat: Quat::from_xyzw(1.0, 2.0, 3.0, 4.0), + option_vec3: None, + vec_of_option_bools: vec![Some(true), None, Some(false)], + option_vec_of_bools: Some(vec![true, true, true]), + }); +} + fn main() -> std::io::Result<()> { let mut app = App::new(); app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) + .add_plugins(LuaScriptingPlugin::<()>::default()) + .add_plugins(LuaBevyScriptingPlugin) .register_type::() // note the implementation for Option is there, but we must register `LuaProxyable` for it - .register_foreign_lua_type::>() - .register_foreign_lua_type::>>() - .register_foreign_lua_type::>() - .register_foreign_lua_type::>>() - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaBevyAPIProvider)) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_systems(Startup, - |world: &mut World| { - - let entity = world.spawn(()) - .insert(MyComponent { - usize: 5, - vec2: Vec2::new(1.0, 2.0), - f32: 6.7, - mat3: Mat3::from_cols( - Vec3::new(1.0, 2.0, 3.0), - Vec3::new(4.0, 5.0, 6.0), - Vec3::new(7.0, 8.0, 9.0), - ), - quat: Quat::from_xyzw(1.0, 2.0, 3.0, 4.0), - option_vec3: None, - vec_of_option_bools: vec![Some(true), None, Some(false)], - option_vec_of_bools: Some(vec![true, true, true]), - }).id(); - - // run script - world.resource_scope(|world, mut host: Mut>| { - host.run_one_shot( - r#" - function table_to_string(t) - local result = "[" - for k,v in pairs(t) do - result = result .. string.format("%s:%s,",k,v) - end - return result .. "]" - end - - function once() - - -- the api provides us with 3 globals - print(entity) - print(script) - print(world) - - -- we first retrieve ID's for our component and resource by their short name (long name/full path also work) - local my_component_type = world:get_type_by_name("MyComponent") - - -- then ask the world to give us a reference to `MyComponent` on the entity we just spawned - -- resources work the same way, but we use `get_resource` instead of `get_component` - -- the comp object is resolved to a `bevy_script_api::script_ref::ReflectValue` which implements UserData. - -- we can use a custom proxy instead (by implementing LuaProxyable), but this is the simplest way to get started. - local comp = world:get_component(entity, my_component_type) - print("Before script: ", comp) - - print("============") - - -- the index metamethod on ReflectValue's uses bevy's reflection mechanism on top of some custom sub-reflection logic to - -- allow reflecting inside Options, Vectors etc. - -- when we index into ReflectValue's we either get back a custom proxy or another ReflectValue - - -- the LuaBevyAPIProvider provides us custom proxies for many bevy types as well as std types. - -- all of these implementations can be overridden via the bevy TypeRegistry - comp.usize = 2 - print("comp.usize after assigning to 2: ", comp.usize) - - -- vec's and matrices have custom __index and __newindex overrides - print("comp.vec2 before: ", comp.vec2) - comp.vec2[1] = 69 - print("comp.vec2 after: ", comp.vec2) - - -- Option's get converted to nil or the value inside - print("comp.option_vec3 before: ", comp.option_vec3) - comp.option_vec3 = Vec3.new(2,1,3) - print("comp.option_vec3 after: ", comp.option_vec3) - - -- reflection via index is indexed starting at 1, unlike in Rust to match Lua's indexing - print("comp.option_vec3[1] before: ", comp.option_vec3[1]) - comp.option_vec3[1] = 5 - print("comp.option_vec3[1] after: ", comp.option_vec3[1]) - - print("============") - - -- Vec references get converted to a custom proxy `LuaVec` which is - -- also assignable via lua tables - - print("comp.vec_of_option_bools before: ", table_to_string(comp.vec_of_option_bools)) - comp.vec_of_option_bools = {true,false,true} - print("comp.vec_of_option_bools after assignment: ", table_to_string(comp.vec_of_option_bools)) - - print("comp.vec_of_option_bools[1] before: ", comp.vec_of_option_bools[1]) - comp.vec_of_option_bools[1] = false - print("comp.vec_of_option_bools[1] after: ", comp.vec_of_option_bools[1]) - - -- there are some additional methods available on LuaVec proxies imitating the Vec api - print("comp.vec_of_option_bools before insert: ", table_to_string(comp.vec_of_option_bools)) - comp.vec_of_option_bools:insert(1,nil) - print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) - - print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) - comp.vec_of_option_bools:push(false) - print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) - - print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) - - print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) - print(comp.vec_of_option_bools:pop()) - print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) - - print("the pairs inside comp.vec_of_option_bools: ") - for k,v in pairs(comp.vec_of_option_bools) do - print(string.format(" - %s:%s",k,v)) - end - - comp.vec_of_option_bools:clear() - print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) - - print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) - print("============") - - print("comp.option_vec_of_bools before: ", table_to_string(comp.option_vec_of_bools)) - print(comp.option_vec_of_bools:pop()) - print("comp.option_vec_of_bools after pop: ", table_to_string(comp.option_vec_of_bools)) - - - print("comp.option_vec_of_bools len after pop: ", #comp.option_vec_of_bools) - - print("the pairs inside comp.option_vec_of_bools: ") - for k,v in pairs(comp.option_vec_of_bools) do - print(string.format(" - %s:%s",k,v)) - end - - print("============") - - local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3.x_axis - print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) - - local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) - print("new_mat3 is:", new_mat3) - - comp.vec2 = comp.vec2 + comp.vec2 - comp.usize = comp.vec2:min_element() - comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() - comp.vec2 = Vec2.new(2,1) - comp.quat = Quat.from_xyzw(3,2,1,4) - comp.mat3.x_axis = Vec3.new(69,69,69) - - print("============") - - -- this is an example of something impossible to achieve with plain bevy reflection under the hood - comp.mat3[1][1] = 42 - - -- now let's retrieve these again to see if we actually changed their values permanently - comp = world:get_component(entity,my_component_type) - - print("After script:") - print(comp) - end - "# - .as_bytes(), - "script.lua", - entity, - world, - LuaEvent { - hook_name: "once".to_owned(), - args: (), - recipients: Recipients::All, - }, - ) - .expect("Something went wrong in the script!"); - }); - - world.send_event(AppExit::Success); - }, - ); + .add_systems(Startup, (init_data, load_script)); app.run(); diff --git a/examples/lua/complex_game_loop.rs b/examples/lua/complex_game_loop.rs deleted file mode 100644 index 55efa6573a..0000000000 --- a/examples/lua/complex_game_loop.rs +++ /dev/null @@ -1,193 +0,0 @@ -use bevy::core::FrameCount; -use bevy::ecs::schedule::ScheduleLabel; -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; -use rand::prelude::SliceRandom; -use std::sync::atomic::AtomicU32; -use std::sync::atomic::Ordering::Relaxed; - -#[derive(Clone)] -/// The type we will be using to send data to Lua -pub struct MyLuaArg(usize); - -impl<'lua> IntoLua<'lua> for MyLuaArg { - fn into_lua(self, lua: &'lua Lua) -> mlua::Result> { - self.0.into_lua(lua) - } -} - -/// Used to assign events unique ids -static COUNTER: AtomicU32 = AtomicU32::new(0); - -/// The event firing logic we will use at the each stage of the game loop -/// Fires a random event from the pool of all events i.e. one of: -/// - on_pre_physics, priority: 0 -/// - on_post_physics, priority: 11 -/// - on_pre_physics, priority: 21 -fn fire_random_event(w: &mut PriorityEventWriter>>) { - let mut rng = rand::thread_rng(); - let id = COUNTER.fetch_add(1, Relaxed); - let arg = MyLuaArg(id as usize); - let (event, prio) = [ - ("on_pre_physics", 0), - ("on_post_physics", 11), - ("on_post_update", 21), - ] - .choose(&mut rng) - .map(|v| { - let mut args = mlua::Variadic::new(); - args.push(arg); - ( - LuaEvent { - hook_name: v.0.to_string(), - args, - recipients: Recipients::All, - }, - v.1, - ) - }) - .unwrap(); - - info!( - "\t - event: {},\t prio: {},\t id: {}", - event.hook_name, prio, id - ); - w.send(event, prio); -} - -/// physics stage logic, represents a bunch of systems sending events of various types and priorities -fn do_physics(mut w: PriorityEventWriter>>) { - info!("Physics, firing:"); - - for _ in 0..5 { - fire_random_event(&mut w); - } -} - -/// update stage logic, fired each frame, represents a bunch of systems sending events of various types and priorities -/// we fire just one since we want to keep the output clean -fn do_update(mut w: PriorityEventWriter>>) { - info!("Update, firing:"); - - fire_random_event(&mut w); -} - -/// We will run this system at the end of each update to make the output easier to read -fn print_frame_count(frame: Res) { - info!("================ Frame no {} End ================", frame.0); -} - -fn load_our_script(server: Res, mut commands: Commands) { - let path = "scripts/complex_game_loop.lua"; - let handle = server.load::(path); - - commands.spawn(()).insert(ScriptCollection:: { - scripts: vec![Script::::new(path.to_string(), handle)], - }); -} - -#[derive(ScheduleLabel, Debug, Clone, PartialEq, Eq, Hash, SystemSet)] -enum ComplexGameLoopSet { - Physics, - PrePhysicsScripts, - PostPhysicsScripts, - PostUpdateScripts, - EndFrame, -} - -fn main() -> std::io::Result<()> { - const TIMESTEP_2_PER_SECOND: f64 = 30.0 / 60.0; - - let mut app = App::new(); - - // first let's configure the set orders: - // we run the pre-physics scripts before physics (duh) - // we run the post-physics scripts after physics - // we run the post-update scripts after post-update - // pretty straightforward, note we use FixedUpdate for physics, which means it runs less often than Update - app.add_plugins(DefaultPlugins) - .insert_resource(Time::::from_seconds(TIMESTEP_2_PER_SECOND)) - .add_plugins(ScriptingPlugin) - .add_systems(Startup, load_our_script) - .configure_sets( - FixedUpdate, - ComplexGameLoopSet::PrePhysicsScripts.before(ComplexGameLoopSet::Physics), - ) - .configure_sets( - FixedUpdate, - ComplexGameLoopSet::PostPhysicsScripts.after(ComplexGameLoopSet::Physics), - ) - .configure_sets( - PostUpdate, - ComplexGameLoopSet::EndFrame.after(ComplexGameLoopSet::PostUpdateScripts), - ); - - // Now let's configure our game's main logic/engine systems - app.add_systems(FixedUpdate, do_physics.in_set(ComplexGameLoopSet::Physics)) - // main update logic system set (every frame) - .add_systems(Update, do_update) - .add_systems( - PostUpdate, - print_frame_count.in_set(ComplexGameLoopSet::EndFrame), - ); - - // Finally let's configure the scripting systems. - // Think of the priority value of events as their "order" - // Events with priority "1" go before events of priority "2" - app - // --- script handler system sets - // pre_physics, event priority: [0,10] inclusive - // handlers always ignore the events of lower priority than their range - // meaning this one will only handle pre_physics events - .add_script_handler_to_set::>, 0, 10>( - FixedUpdate, - ComplexGameLoopSet::PrePhysicsScripts, - ) - // post_physics, event priority: [11,20] inclusive - // This handler one will only ever handle post_physics events, - // events of higher priority [0-11] are discarded completely - // (the logic being: if we are at a point in time where we are handling post_physics events, we don't care about pre_physics events) - .add_script_handler_to_set::>, 11, 20>( - FixedUpdate, - ComplexGameLoopSet::PostPhysicsScripts, - ) - // post_update, priority: [21,30] inclusive - // similar to before, only post_update events are handled - .add_script_handler_to_set::>, 21, 30>( - PostUpdate, - ComplexGameLoopSet::PostUpdateScripts, - ) - // finally we add core script host systems to PostUpdate - // these handle the scripts themselves i.e. add/remove/modify them when necessary - .add_script_host_to_set::>>( - PostUpdate, - ComplexGameLoopSet::PostUpdateScripts, - ); - // We have 2 core systems - - // Physics (twice per second), fires 5 random events - // Update (every frame), fires 1 random event - - // and 3 event handlers - - // pre_physics (twice per second) - // post_physics (twice per second) - // post_update (every frame) - - // each of those spawns a single random event from the pool of all events - // when a handler encounters an event of higher priority outside its range, that event is discarded - // when a handler encounters an event of lower priority outside its range, it's left in the queue - // therefore - // in our case, Physics systems can generate events which can be handled by post_update, - // but Update cannot send events which are handled by anything other than post_update - - // note that regardless of the order in which the events were spawned - // priority decides the order in which they are executed - // in case of identical priority, order is the tie-breaker (earlier events launch first) - - // interestingly, because the Main bevy scheduler runs FixedUpdate systems *before* any Update systems, in this case - // on_pre_physics events will *never* be handled! (they are discarded by the post_physics handler, and the update system never runs before physics) - app.run(); - - Ok(()) -} diff --git a/examples/lua/coroutines.rs b/examples/lua/coroutines.rs index 2285984a6d..9c41bb56a7 100644 --- a/examples/lua/coroutines.rs +++ b/examples/lua/coroutines.rs @@ -1,39 +1,49 @@ +use asset::ScriptAsset; use bevy::prelude::*; +use bevy_mod_scripting::lua::LuaScriptingPlugin; use bevy_mod_scripting::prelude::*; +use script::ScriptComponent; -/// fire on_update -fn do_update(mut w: PriorityEventWriter>) { - let event = LuaEvent { - hook_name: "on_update".to_owned(), - args: (), - recipients: Recipients::All, - }; - - w.send(event, 0); +struct OnEventCallback; +impl IntoCallbackLabel for OnEventCallback { + fn into_callback_label() -> CallbackLabel { + "on_update".into() + } } -fn load_our_scripts(server: Res, mut commands: Commands) { +fn load_script( + server: Res, + mut commands: Commands, + mut handle: Local>, +) { let path = "scripts/coroutines.lua"; - let handle = server.load::(path); - let script = Script::::new(path.to_string(), handle); + let handle_ = server.load::(path); + *handle = handle_; + + commands.spawn(ScriptComponent::new(vec![path.into()])); +} - commands.spawn(()).insert(ScriptCollection:: { - scripts: vec![script], - }); +fn send_event(mut writer: EventWriter>) { + writer.send(ScriptCallbackEvent::new_for_all( + OnEventCallback::into_callback_label(), + (), + )); } fn main() -> std::io::Result<()> { let mut app = App::new(); app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_systems(Startup, load_our_scripts) - // randomly fire events for either all scripts, - // the script with id 0 - // or the script with id 1 - .add_systems(Update, do_update) - .add_script_handler::, 0, 0>(PostUpdate) - .add_script_host::>(PostUpdate); + .add_plugins(LuaScriptingPlugin::<()>::default()) + .add_systems(Startup, load_script) + .add_systems( + Update, + ( + send_event, + event_handler::.after(send_event), + ), + ); + app.run(); Ok(()) diff --git a/examples/lua/dynamic_queries.rs b/examples/lua/dynamic_queries.rs index 9a07eb646d..d2e89aac31 100644 --- a/examples/lua/dynamic_queries.rs +++ b/examples/lua/dynamic_queries.rs @@ -1,5 +1,8 @@ -use bevy::prelude::*; +use asset::ScriptAsset; +use bevy::{core::FrameCount, prelude::*}; use bevy_mod_scripting::prelude::*; +use bevy_mod_scripting_lua::{bindings::providers::LuaBevyScriptingPlugin, LuaScriptingPlugin}; +use script::ScriptComponent; #[derive(Component, Reflect)] #[reflect(Component)] @@ -13,22 +16,32 @@ pub struct ComponentB; #[reflect(Component)] pub struct ComponentC; +fn load_script( + server: Res, + mut commands: Commands, + mut handle: Local>, +) { + let path = "scripts/dynamic_queries.lua"; + let handle_ = server.load::(path); + *handle = handle_; + + commands.spawn(ScriptComponent::new(vec![path.into()])); +} + fn main() { let mut app = App::new(); - app.add_plugins((DefaultPlugins, ScriptingPlugin)) + app.add_plugins(DefaultPlugins); + app.add_plugins(LuaScriptingPlugin::<()>::default()); + app.add_plugins(LuaBevyScriptingPlugin) .register_type::() .register_type::() .register_type::() - .add_script_host::>(PostUpdate) - .add_script_handler::, 0, 0>(PostUpdate) - .add_api_provider::>(Box::new(LuaBevyAPIProvider)) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_systems(Startup, (setup, apply_deferred, run).chain()) + .add_systems(Startup, (setup, load_script)) .run(); } -fn setup(mut commands: Commands, asset_server: Res) { +fn setup(mut commands: Commands) { commands.spawn((ComponentA,)); commands.spawn((ComponentA, ComponentB)); commands.spawn((ComponentA, ComponentC)); @@ -43,22 +56,4 @@ fn setup(mut commands: Commands, asset_server: Res) { commands.spawn((ComponentC, ComponentA)); commands.spawn((ComponentC, ComponentB)); commands.spawn((ComponentC, ComponentA, ComponentB)); - - let path = "scripts/dynamic_queries.lua"; - let handle = asset_server.load(path); - - commands.spawn(ScriptCollection:: { - scripts: vec![Script::new(path.into(), handle)], - }); -} - -fn run(mut events: PriorityEventWriter>) { - events.send( - LuaEvent { - hook_name: "on_event".into(), - args: (), - recipients: Recipients::All, - }, - 0, - ); } diff --git a/examples/lua/event_recipients.rs b/examples/lua/event_recipients.rs index 310d50e5b2..861b88381b 100644 --- a/examples/lua/event_recipients.rs +++ b/examples/lua/event_recipients.rs @@ -1,9 +1,7 @@ use bevy::{app::AppExit, core::FrameCount, prelude::*}; use bevy_mod_scripting::lua::LuaScriptingPlugin; use bevy_mod_scripting::prelude::*; -use bevy_mod_scripting_core::{ - asset::ScriptAsset, script::ScriptComponent, AddContextPreHandlingInitializer, -}; +use bevy_mod_scripting_core::{asset::ScriptAsset, script::ScriptComponent}; fn load_script( server: Res, @@ -14,12 +12,8 @@ fn load_script( let handle_ = server.load::(path); *handle = handle_; - commands.spawn(ScriptComponent::new(vec![ - "scripts/event_recipients.lua".into() - ])); - commands.spawn(ScriptComponent::new(vec![ - "scripts/event_recipients.lua".into() - ])); + commands.spawn(ScriptComponent::new(vec![path.into()])); + commands.spawn(ScriptComponent::new(vec![path.into()])); } fn trigger_script_callback(mut writer: EventWriter>) { @@ -53,10 +47,6 @@ fn main() -> std::io::Result<()> { app.add_plugins(DefaultPlugins) .add_plugins(LuaScriptingPlugin::::default()) - .add_context_pre_handling_initializer::<()>(|_, e, ctx: &mut Lua| { - ctx.globals().set("entity", format!("{e:?}")).unwrap(); - Ok(()) - }) .add_systems(Startup, load_script) .add_systems( Update, From d1f37a86791449519cfb39535d2f623d4f5dcbdf Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 24 Nov 2024 17:32:49 +0000 Subject: [PATCH 025/217] register option lua types for ALL THE TYPES BABY --- assets/scripts/bevy_api.lua | 221 +++--- crates/bevy_api_gen/templates/header.tera | 4 +- .../src/bindings/allocator.rs | 34 +- .../src/bindings/reference.rs | 29 +- .../src/bindings/world.rs | 15 + crates/bevy_mod_scripting_core/src/lib.rs | 1 + .../src/reflection_extensions.rs | 112 +++ crates/bevy_mod_scripting_core/src/systems.rs | 14 +- .../src/bindings/providers/bevy_a11y.rs | 2 +- .../src/bindings/providers/bevy_core.rs | 2 +- .../src/bindings/providers/bevy_ecs.rs | 2 +- .../src/bindings/providers/bevy_hierarchy.rs | 2 +- .../src/bindings/providers/bevy_input.rs | 2 +- .../src/bindings/providers/bevy_math.rs | 2 +- .../src/bindings/providers/bevy_reflect.rs | 2 +- .../src/bindings/providers/bevy_time.rs | 2 +- .../src/bindings/providers/bevy_transform.rs | 2 +- .../src/bindings/providers/bevy_window.rs | 2 +- .../src/bindings/reference.rs | 55 +- .../bevy_mod_scripting_lua/src/lib.rs | 125 +--- .../bevy_mod_scripting_lua/src/type_data.rs | 665 ++++++++++++++++++ examples/lua/bevy_api.rs | 72 +- 22 files changed, 1093 insertions(+), 274 deletions(-) create mode 100644 crates/bevy_mod_scripting_core/src/reflection_extensions.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/type_data.rs diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 5a1f0fc8f1..cefd120e61 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -7,122 +7,135 @@ function table_to_string(t) end --- the api provides us with 3 globals -print(entity) -print(script) -print(world) - --- we first retrieve ID's for our component and resource by their short name (long name/full path also work) -local my_component_type = world:get_type_by_name("MyComponent") - --- then ask the world to give us a reference to `MyComponent` on the entity we just spawned --- resources work the same way, but we use `get_resource` instead of `get_component` --- the comp object is resolved to a `bevy_script_api::script_ref::ReflectValue` which implements UserData. --- we can use a custom proxy instead (by implementing LuaProxyable), but this is the simplest way to get started. -local comp = world:get_component(entity, my_component_type) -print("Before script: ", comp) - -print("============") - --- the index metamethod on ReflectValue's uses bevy's reflection mechanism on top of some custom sub-reflection logic to --- allow reflecting inside Options, Vectors etc. --- when we index into ReflectValue's we either get back a custom proxy or another ReflectValue - --- the LuaBevyAPIProvider provides us custom proxies for many bevy types as well as std types. --- all of these implementations can be overridden via the bevy TypeRegistry -comp.usize = 2 -print("comp.usize after assigning to 2: ", comp.usize) - --- vec's and matrices have custom __index and __newindex overrides -print("comp.vec2 before: ", comp.vec2) -comp.vec2[1] = 69 -print("comp.vec2 after: ", comp.vec2) - --- Option's get converted to nil or the value inside -print("comp.option_vec3 before: ", comp.option_vec3) -comp.option_vec3 = Vec3.new(2,1,3) -print("comp.option_vec3 after: ", comp.option_vec3) - --- reflection via index is indexed starting at 1, unlike in Rust to match Lua's indexing -print("comp.option_vec3[1] before: ", comp.option_vec3[1]) -comp.option_vec3[1] = 5 -print("comp.option_vec3[1] after: ", comp.option_vec3[1]) - -print("============") - --- Vec references get converted to a custom proxy `LuaVec` which is --- also assignable via lua tables - -print("comp.vec_of_option_bools before: ", table_to_string(comp.vec_of_option_bools)) -comp.vec_of_option_bools = {true,false,true} -print("comp.vec_of_option_bools after assignment: ", table_to_string(comp.vec_of_option_bools)) - -print("comp.vec_of_option_bools[1] before: ", comp.vec_of_option_bools[1]) -comp.vec_of_option_bools[1] = false -print("comp.vec_of_option_bools[1] after: ", comp.vec_of_option_bools[1]) - --- there are some additional methods available on LuaVec proxies imitating the Vec api -print("comp.vec_of_option_bools before insert: ", table_to_string(comp.vec_of_option_bools)) -comp.vec_of_option_bools:insert(1,nil) -print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) - -print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) -comp.vec_of_option_bools:push(false) -print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) - -print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) - -print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) -print(comp.vec_of_option_bools:pop()) -print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) - -print("the pairs inside comp.vec_of_option_bools: ") -for k,v in pairs(comp.vec_of_option_bools) do - print(string.format(" - %s:%s",k,v)) -end +function on_event() -comp.vec_of_option_bools:clear() -print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) + print(entity) + print(script) + print(world) -print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) -print("============") -print("comp.option_vec_of_bools before: ", table_to_string(comp.option_vec_of_bools)) -print(comp.option_vec_of_bools:pop()) -print("comp.option_vec_of_bools after pop: ", table_to_string(comp.option_vec_of_bools)) + local my_component_type = world:get_type_by_name("MyComponent") + local comp = world:get_component(entity, my_component_type) + print("Before script: ", comp) -print("comp.option_vec_of_bools len after pop: ", #comp.option_vec_of_bools) -print("the pairs inside comp.option_vec_of_bools: ") -for k,v in pairs(comp.option_vec_of_bools) do - print(string.format(" - %s:%s",k,v)) -end + print(comp.option_usize) + comp.option_usize = 69 + print(comp.option_usize) + comp.option_usize = nil + print(comp.option_usize) + world:exit() + + print(comp.vec_of_usize) + print(comp.vec_of_usize[2]) + comp.vec_of_usize[2] = 69 + print(comp.vec_of_usize[2]) + world:exit() + + print("============") + + -- the index metamethod on ReflectValue's uses bevy's reflection mechanism on top of some custom sub-reflection logic to + -- allow reflecting inside Options, Vectors etc. + -- when we index into ReflectValue's we either get back a custom proxy or another ReflectValue + + -- the LuaBevyAPIProvider provides us custom proxies for many bevy types as well as std types. + -- all of these implementations can be overridden via the bevy TypeRegistry + print("Hello:", comp.usize._1) + comp.usize[1] = 2 + print("comp.usize after assigning to 2: ", comp.usize._1) + + -- vec's and matrices have custom __index and __newindex overrides + print("comp.vec2 before: ", comp.vec2) + comp.vec2[1] = 69 + print("comp.vec2 after: ", comp.vec2) + + -- Option's get converted to nil or the value inside + print("comp.option_vec3 before: ", comp.option_vec3) + comp.option_vec3 = Vec3.new(2,1,3) + print("comp.option_vec3 after: ", comp.option_vec3) + + -- reflection via index is indexed starting at 1, unlike in Rust to match Lua's indexing + print("comp.option_vec3[1] before: ", comp.option_vec3[1]) + comp.option_vec3[1] = 5 + print("comp.option_vec3[1] after: ", comp.option_vec3[1]) + + print("============") + + -- Vec references get converted to a custom proxy `LuaVec` which is + -- also assignable via lua tables + + print("comp.vec_of_option_bools before: ", table_to_string(comp.vec_of_option_bools)) + comp.vec_of_option_bools = {true,false,true} + print("comp.vec_of_option_bools after assignment: ", table_to_string(comp.vec_of_option_bools)) + + print("comp.vec_of_option_bools[1] before: ", comp.vec_of_option_bools[1]) + comp.vec_of_option_bools[1] = false + print("comp.vec_of_option_bools[1] after: ", comp.vec_of_option_bools[1]) + + -- there are some additional methods available on LuaVec proxies imitating the Vec api + print("comp.vec_of_option_bools before insert: ", table_to_string(comp.vec_of_option_bools)) + comp.vec_of_option_bools:insert(1,nil) + print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) + + print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) + comp.vec_of_option_bools:push(false) + print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) + + print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) + + print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) + print(comp.vec_of_option_bools:pop()) + print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) + + print("the pairs inside comp.vec_of_option_bools: ") + for k,v in pairs(comp.vec_of_option_bools) do + print(string.format(" - %s:%s",k,v)) + end + + comp.vec_of_option_bools:clear() + print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) + + print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) + print("============") + + print("comp.option_vec_of_bools before: ", table_to_string(comp.option_vec_of_bools)) + print(comp.option_vec_of_bools:pop()) + print("comp.option_vec_of_bools after pop: ", table_to_string(comp.option_vec_of_bools)) + + + print("comp.option_vec_of_bools len after pop: ", #comp.option_vec_of_bools) + + print("the pairs inside comp.option_vec_of_bools: ") + for k,v in pairs(comp.option_vec_of_bools) do + print(string.format(" - %s:%s",k,v)) + end -print("============") + print("============") -local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3.x_axis -print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) + local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3.x_axis + print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) -local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) -print("new_mat3 is:", new_mat3) + local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) + print("new_mat3 is:", new_mat3) -comp.vec2 = comp.vec2 + comp.vec2 -comp.usize = comp.vec2:min_element() -comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() -comp.vec2 = Vec2.new(2,1) -comp.quat = Quat.from_xyzw(3,2,1,4) -comp.mat3.x_axis = Vec3.new(69,69,69) + comp.vec2 = comp.vec2 + comp.vec2 + comp.usize = comp.vec2:min_element() + comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() + comp.vec2 = Vec2.new(2,1) + comp.quat = Quat.from_xyzw(3,2,1,4) + comp.mat3.x_axis = Vec3.new(69,69,69) -print("============") + print("============") --- this is an example of something impossible to achieve with plain bevy reflection under the hood -comp.mat3[1][1] = 42 + -- this is an example of something impossible to achieve with plain bevy reflection under the hood + comp.mat3[1][1] = 42 --- now let's retrieve these again to see if we actually changed their values permanently -comp = world:get_component(entity,my_component_type) + -- now let's retrieve these again to see if we actually changed their values permanently + comp = world:get_component(entity,my_component_type) -print("After script:") -print(comp) + print("After script:") + print(comp) -world:exit() \ No newline at end of file + world:exit() +end \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index 5404318ea2..02f0fa1b81 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -12,7 +12,7 @@ use super::{{crate}}::*; use bevy_mod_scripting_core::{AddContextInitializer, StoreDocumentation, bindings::ReflectReference}; {% if args.self_is_bms_lua %} -use crate::{bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy},RegisterLua, tealr::mlu::mlua::IntoLua}; +use crate::{bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy},type_data::RegisterLua, tealr::mlu::mlua::IntoLua}; {% else %} -use bevy_mod_scripting::{lua::bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy}, RegisterLua, tealr::mlu::mlua::IntoLua}; +use bevy_mod_scripting::{lua::bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy}, type_data::RegisterLua, tealr::mlu::mlua::IntoLua}; {% endif %} \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index c6394bc6f9..ef2c710a31 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -1,6 +1,6 @@ use bevy::ecs::system::Resource; use bevy::reflect::{PartialReflect, Reflect}; -use std::any::TypeId; +use std::any::{Any, TypeId}; use std::cell::UnsafeCell; use std::collections::HashMap; use std::fmt::{Display, Formatter}; @@ -45,18 +45,46 @@ pub struct ReflectAllocator { } impl ReflectAllocator { - /// Allocates a new [`Reflect`] value and returns an [`AllocationId`] which can be used to access it later + /// Allocates a new [`Reflect`] value and returns an [`AllocationId`] which can be used to access it later. + /// Use [`Self::allocate_boxed`] if you already have an allocated boxed value. pub fn allocate( &mut self, value: T, ) -> (ReflectAllocationId, ReflectAllocation) { + let type_id = value.get_represented_type_info().map(|i| i.type_id()); + let id = ReflectAllocationId(self.allocations.len()); let value = ReflectAllocation::new(Arc::new(UnsafeCell::new(value))); self.allocations.insert(id, value.clone()); - self.types.insert(id, TypeId::of::()); + if let Some(type_id) = type_id { + self.types.insert(id, type_id); + } (id, value) } + /// Moves the given boxed [`PartialReflect`] value into the allocator, returning an [`AllocationId`] which can be used to access it later + pub fn allocate_boxed( + &mut self, + existing: Box, + ) -> (ReflectAllocationId, ReflectAllocation) { + let type_id = existing.get_represented_type_info().map(|i| i.type_id()); + let id = ReflectAllocationId(self.allocations.len()); + + let raw_ptr = Box::into_raw(existing); + // Safety: + // - we are the only ones to have access to this value since we have the Box + // - UnsafeCell is repr(transparent), meaning we can safely transmute between it and the trait object + // TODO: I don't think we can use this, because from_raw has a pre-condition that requires the pointer to have been an arc before + let arc: Arc> = + unsafe { Arc::from_raw(raw_ptr as *const _) }; + let allocation = ReflectAllocation::new(arc); + self.allocations.insert(id, allocation.clone()); + if let Some(type_id) = type_id { + self.types.insert(id, type_id); + } + (id, allocation) + } + pub fn get(&self, id: ReflectAllocationId) -> Option { self.allocations.get(&id).cloned() } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index b0ad73756b..47ca7117c2 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -59,11 +59,17 @@ pub struct ReflectReference { impl ReflectReference { + /// Prints the reference using the world to resolve type names. pub fn print_with_world(&self, world: &WorldAccessGuard) -> String { - let base = world.with_resource(|_, type_registry: Mut| { - self.base.display_with_type_name(&type_registry.read()) - }); + world.with_resource(|_, type_registry: Mut| { + let type_registry = type_registry.read(); + self.print_with_type_registry(&type_registry) + }) + } + /// Prints the reference using the type registry to resolve type names. Prefer this over [`Self::print_with_world`] if you have a type registry available. + pub fn print_with_type_registry(&self, type_registry: &TypeRegistry) -> String { + let base = self.base.display_with_type_name(type_registry); format!("Reference(base: {}, path: {:?})", base, self.reflect_path) } @@ -90,7 +96,7 @@ impl ReflectReference { }) } - pub fn new_allocated( + pub fn new_allocated( value: T, allocator: &mut ReflectAllocator, ) -> ReflectReference { @@ -104,6 +110,21 @@ impl ReflectReference { } } + pub fn new_allocated_boxed( + value: Box, + allocator: &mut ReflectAllocator, + ) -> ReflectReference { + let type_id = value.get_represented_type_info().map(|i| i.type_id()).expect("Expected type info for boxed value"); + let (id, _) = allocator.allocate_boxed(value); + ReflectReference { + base: ReflectBaseType { + type_id, + base_id: ReflectBase::Owned(id), + }, + reflect_path: Vec::default(), + } + } + /// Indexes into the reflect path inside this reference. /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. pub fn index_path>(&mut self, index: T) { diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index d5b9a2f27b..2481ec4d4a 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -472,6 +472,21 @@ impl<'w> WorldAccessGuard<'w> { out } + /// Convenience to get commonly used resources at the same time. Internally identical to [`Self::with_resource`] + pub fn with_allocator_and_type_registry< + O, + F: FnOnce(&Self, Mut, Mut) -> O, + >( + &self, + f: F, + ) -> O { + self.with_resource(|world, registry: Mut| { + world.with_resource(|world, allocator: Mut| { + f(world, registry, allocator) + }) + }) + } + /// Call a function on a type which can be proxied, first by unproxying the input with world access, /// then calling the function and finally proxying the output with the allocator. pub fn proxy_call<'i, O: Proxy, T: Unproxy, F: Fn(T::Output<'_>) -> O::Input<'i>>( diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 8b5c0f00df..67a1ce74d0 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -26,6 +26,7 @@ pub mod docs; pub mod error; pub mod event; pub mod handler; +pub mod reflection_extensions; pub mod runtime; pub mod script; pub mod systems; diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs new file mode 100644 index 0000000000..19ca2fa664 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -0,0 +1,112 @@ +use bevy::reflect::PartialReflect; + +use crate::error::ScriptError; + +/// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. +pub trait PartialReflectExt { + /// Check if the represented type is from the given crate and has the given type identifier, + /// returns false if not representing any type or if the type is not from the given crate or does not have the given type identifier. + fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool; + + /// Equivalent to [`PartialReflectExt::is_type`] but returns an appropriate error if the type is not the expected one. + fn expect_type(&self, crate_name: Option<&str>, type_ident: &str) -> Result<(), ScriptError>; + + /// If the type is an option, returns either the inner value or None if the option is None. + /// Errors if the type is not an option. + fn as_option(&self) -> Result, ScriptError>; +} + +impl PartialReflectExt for T { + fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool { + self.get_represented_type_info().is_some_and(|v| { + let table = v.type_path_table(); + table.crate_name() == crate_name && table.ident() == Some(type_ident) + }) + } + + fn expect_type(&self, crate_name: Option<&str>, type_ident: &str) -> Result<(), ScriptError> { + if !self.is_type(crate_name, type_ident) { + return Err(ScriptError::new_runtime_error(format!( + "Expected type {type_ident}{}, but got {}", + crate_name + .map(|s| format!(" from crate {s}")) + .unwrap_or_default(), + self.get_represented_type_info() + .map(|ti| ti.type_path()) + .unwrap_or_else(|| "dynamic type with no type information") + ))); + } + Ok(()) + } + + /// If the type is an option, returns either the inner value or None if the option is None. + /// Errors if the type is not an option. + fn as_option(&self) -> Result, ScriptError> { + self.expect_type(Some("core"), "Option")?; + + if let bevy::reflect::ReflectRef::Enum(e) = self.reflect_ref() { + if let Some(field) = e.field_at(0) { + return Ok(Some(field)); + } else { + return Ok(None); + } + } + + unreachable!("core::Option is an enum with a tuple variant") + } +} + +#[cfg(test)] +mod test { + use super::*; + + #[test] + fn test_type_no_crate() { + assert!(42.is_type(None, "i32")); + assert!(42.expect_type(None, "i32").is_ok()); + } + + #[test] + fn test_is_type_with_crate() { + assert!(Some(42).is_type(Some("core"), "Option")); + assert!(Some(42).expect_type(Some("core"), "Option").is_ok()); + } + + #[test] + fn test_is_type_negative() { + assert!(!Some(42).is_type(Some("std"), "Option")); + assert_eq!( + "Encountered Runtime Error error in a script: Expected type Option from crate std, but got core::option::Option", + Some(42) + .expect_type(Some("std"), "Option") + .unwrap_err() + .to_string() + ); + } + + #[test] + fn test_as_option_some() { + assert_eq!( + &42, + Some(42) + .as_option() + .unwrap() + .unwrap() + .try_downcast_ref::() + .unwrap() + ); + } + + #[test] + fn test_as_option_none() { + assert!(None::.as_option().unwrap().is_none()); + } + + #[test] + fn test_as_option_error() { + assert_eq!( + "Encountered Runtime Error error in a script: Expected type Option from crate core, but got i32", + 42.as_option().unwrap_err().to_string() + ); + } +} diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index ae52b80653..b5c6fafefc 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -46,7 +46,19 @@ pub fn sync_script_data( }; // get the path let asset = script_assets.get(*id); - let asset = asset.as_ref().expect("Asset was expected to be loaded!"); + let asset = match asset.as_ref() { + Some(a) => a, + None => { + if remove { + debug!( + "Script presumably failed to load, no need to remove anything, ignoring." + ); + continue; + } else { + panic!("Asset was expected to be loaded!"); + } + } + }; let path = &asset.asset_path; // convert it to script id diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs index 991607f1cb..8827603674 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs @@ -12,7 +12,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs index 050cbea514..81510b9c0b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs @@ -12,7 +12,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs index ede3306eff..e62e60366c 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs @@ -11,7 +11,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs index 64e548268e..bbe353b36b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs @@ -13,7 +13,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs index 78229eaf4b..c55b025c1e 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs @@ -14,7 +14,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs index deab25b495..49f55cbfb4 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs @@ -11,7 +11,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs index b8ebe738ad..b5e5699ac5 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -10,7 +10,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs index c75985d924..34b1e2fd95 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs @@ -12,7 +12,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs index 759124267a..9ce8f17e40 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs @@ -15,7 +15,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs index 46be3ee95d..1814800abc 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs @@ -16,7 +16,7 @@ use crate::{ LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, LuaIdentityProxy, }, - RegisterLua, tealr::mlu::mlua::IntoLua, + type_data::RegisterLua, tealr::mlu::mlua::IntoLua, }; #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 619f0e6760..52c3734a16 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -8,7 +8,9 @@ use bevy::{ reflect::{OffsetAccess, ParsedPath, ReflectFromReflect}, }; use bevy_mod_scripting_core::{ - bindings::{ReflectAllocator, ReflectReference, Unproxy, WorldCallbackAccess}, + bindings::{ + ReflectAllocator, ReflectReference, ReflectionPathElem, Unproxy, WorldCallbackAccess, + }, error::ScriptError, }; use tealr::mlu::{ @@ -25,9 +27,15 @@ use super::{ /// Lua UserData wrapper for [`bevy_mod_scripting_core::bindings::ReflectReference`]. /// Acts as a lua reflection interface. Any value which is registered in the type registry can be interacted with using this type. -#[derive(Debug, Clone, tealr::mlu::UserData, tealr::ToTypename)] +#[derive(Debug, Clone, tealr::mlu::UserData, tealr::ToTypename, PartialEq)] pub struct LuaReflectReference(pub ReflectReference); +impl AsRef for LuaReflectReference { + fn as_ref(&self) -> &ReflectReference { + &self.0 + } +} + impl LuaReflectReference { pub fn len(&self, lua: &Lua) -> Result, mlua::Error> { let world = lua.get_world()?; @@ -78,6 +86,8 @@ impl LuaReflectReference { } pub fn set_with_lua_proxy(&self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { + bevy::log::debug!("Setting lua reflect reference with value: {:?}", value); + let world = lua.get_world()?; let result: Result<(), ScriptError> = world.with_resource(|world, type_registry: Mut| { @@ -85,30 +95,44 @@ impl LuaReflectReference { let type_registry = type_registry.read(); let type_id = self.0 - .with_reflect(world, &type_registry, Some(&allocator), |r| r.type_id()); + .with_reflect(world, &type_registry, Some(&allocator), |r| { + r.get_represented_type_info().map(|t| t.type_id()) + }); - if let Some(type_data) = type_registry.get_type_data::(type_id) + // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever + // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. + struct Unknown; + let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); + bevy::log::debug!("Target type is {:?}", type_registry.get_type_info(type_id_or_dummy).map(|t| t.type_path())); + + if let Some(type_data) = + type_registry.get_type_data::(type_id_or_dummy) { + bevy::log::debug!("Setting value with ReflectLuaValue registration"); self.0 .with_reflect_mut(world, &type_registry, Some(&allocator), |r| { Ok((type_data.set_value)(r, value, lua)?) }) } else if let Some(type_data) = - type_registry.get_type_data::(type_id) + type_registry.get_type_data::(type_id_or_dummy) { + bevy::log::debug!("Setting value with ReflectLuaProxied registration"); + let other = (type_data.from_proxy)(value, lua)?; // first we need to get a copy of the other value let other = other .with_reflect(world, &type_registry, Some(&allocator), |r| { type_registry - .get_type_data::(r.type_id()) + .get_type_data::(type_id_or_dummy) .and_then(|from_reflect_td| from_reflect_td.from_reflect(r)) }) .ok_or_else(|| { ScriptError::new_reflection_error(format!( "Failed to call ReflectFromReflect for type id: {:?}", - type_registry.get_type_info(type_id).map(|t| t.type_path()) + type_registry + .get_type_info(type_id_or_dummy) + .map(|t| t.type_path()) )) })?; @@ -117,18 +141,23 @@ impl LuaReflectReference { .with_reflect_mut(world, &type_registry, Some(&allocator), |r| { r.try_apply(other.as_partial_reflect()).map_err(|e| { ScriptError::new_runtime_error(format!( - "Invalid assignment `{:?}` = `{:?}`. Wrong type.", - self.0.clone(), + "Invalid assignment `{:?}` = `{:?}`. {e}.", + self.0.print_with_type_registry(&type_registry), e, )) }) })?; Ok(()) } else { + bevy::log::debug!("No registration found, throwing error"); + // we don't know how to assign the value + // prod to see if it's a common container (i.e. Option or Vec) + Err(ScriptError::new_runtime_error(format!( - "Invalid assignment `{:?}` = `{:?}`. Wrong type.", - self.0.clone(), + "Invalid assignment `{:?}` = `{:?}`. The underlying type does: `{}` not support assignment.", + self.0.print_with_type_registry(&type_registry), value, + type_registry.get_type_info(type_id_or_dummy).map(|t| t.type_path()).unwrap_or_else(|| "Unknown") ))) } }) @@ -216,8 +245,10 @@ impl TealData for LuaReflectReference { MetaMethod::NewIndex, |l, (mut self_, key, value): (LuaReflectReference, Value, Value)| { let mut elem = Self::parse_value_index(key)?; + bevy::log::debug!("New index with parsed path: {:?}", elem); Self::to_host_index(&mut elem); self_.0.index_path(elem); + bevy::log::debug!("New reflect reference after: {:?}", self_.0); self_.set_with_lua_proxy(l, value) }, ); @@ -247,7 +278,7 @@ mod test { }; use bevy_mod_scripting_derive::LuaProxy; - use crate::{bindings::world::LuaWorld, RegisterLua}; + use crate::{bindings::world::LuaWorld, type_data::RegisterLua}; use super::*; diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 4c73cc2610..c163b6027b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -1,10 +1,12 @@ pub mod assets; pub mod docs; +pub mod type_data; pub mod util; use bevy::{ - app::{App, Plugin}, + app::{App, Plugin, Startup}, ecs::{entity::Entity, world::World}, - reflect::{FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, + prelude::{AppTypeRegistry, Mut}, + reflect::{impl_reflect, FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, }; use bevy_mod_scripting_core::{ bindings::{ReflectAllocator, ReflectReference, WorldCallbackAccess}, @@ -23,6 +25,9 @@ use bindings::{ pub use tealr; pub mod bindings; use tealr::mlu::mlua::{FromLua, Function, IntoLua, IntoLuaMulti, Lua, Value}; +use type_data::{ + pre_register_common_containers, register_lua_values, ReflectLuaProxied, ReflectLuaValue, +}; pub mod prelude { pub use crate::tealr::{ @@ -58,25 +63,6 @@ impl Default for LuaScriptingPlugin { } } -pub fn register_lua_values(app: &mut bevy::prelude::App) { - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); -} - impl Plugin for LuaScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); @@ -93,6 +79,11 @@ impl Plugin for LuaScriptingPlugin { Ok(()) }); } + + fn cleanup(&self, app: &mut App) { + let mut type_registry = app.world_mut().get_resource_mut().unwrap(); + pre_register_common_containers(&mut type_registry); + } } pub fn lua_context_load( @@ -182,95 +173,3 @@ pub fn with_world Result<(), ScriptError>>( f(context) }) } - -/// Registers a lua proxy object via the reflection system -pub trait RegisterLua { - fn register_lua_proxy( - &mut self, - ) -> &mut Self - where - T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T::Proxy: From + AsRef; - - fn register_lua_value(&mut self) -> &mut Self - where - T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T: Reflect + Clone + TypePath + GetTypeRegistration; -} - -impl RegisterLua for App { - fn register_lua_proxy( - &mut self, - ) -> &mut Self - where - T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T::Proxy: From + AsRef, - { - self.register_type::(); - self.register_type_data::() - } - - fn register_lua_value(&mut self) -> &mut Self - where - T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T: Reflect + Clone + TypePath + GetTypeRegistration, - { - self.register_type::(); - self.register_type_data::() - } -} - -/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented in lua via proxies which store -/// a reference to the actual value. -/// This is used for types which are represented in lua with pass by reference semantics -#[derive(Clone)] -pub struct ReflectLuaProxied { - pub into_proxy: - for<'l> fn(ReflectReference, &'l Lua) -> Result, tealr::mlu::mlua::Error>, - pub from_proxy: - for<'l> fn(Value<'l>, &'l Lua) -> Result, -} - -impl FromType for ReflectLuaProxied -where - T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T::Proxy: From + AsRef, -{ - fn from_type() -> Self { - Self { - into_proxy: |p, l| T::Proxy::from(p).into_lua(l), - from_proxy: |v, l| T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone()), - } - } -} - -/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented directly in lua with -/// pass by value semantics, These need to implement [`Clone`] -#[derive(Clone)] -pub struct ReflectLuaValue { - pub into_value: - for<'l> fn(&dyn PartialReflect, &'l Lua) -> Result, tealr::mlu::mlua::Error>, - pub set_value: for<'l> fn( - &mut dyn PartialReflect, - Value<'l>, - &'l Lua, - ) -> Result<(), tealr::mlu::mlua::Error>, - pub from_value: - for<'l> fn(Value<'l>, &'l Lua) -> Result, tealr::mlu::mlua::Error>, -} - -impl IntoLua<'l> + for<'l> FromLua<'l>> FromType - for ReflectLuaValue -{ - fn from_type() -> Self { - Self { - into_value: |v, l| v.try_downcast_ref::().unwrap().clone().into_lua(l), - set_value: |t, v, l| { - let t = t.try_downcast_mut::().unwrap(); - *t = T::from_lua(v, l)?; - Ok(()) - }, - from_value: |v, l| T::from_lua(v, l).map(|v| Box::new(v) as Box), - } - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs new file mode 100644 index 0000000000..629fca061f --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -0,0 +1,665 @@ +use std::{ + any::TypeId, + collections::{HashMap, HashSet}, + sync::Arc, +}; + +use bevy::{ + app::App, + log::debug, + prelude::{AppTypeRegistry, Mut}, + reflect::{ + impl_reflect, DynamicEnum, DynamicTuple, DynamicVariant, FromType, GetTypeRegistration, + ParsedPath, PartialReflect, Reflect, ReflectFromReflect, ReflectPathError, TypePath, + TypeRegistration, + }, +}; +use bevy_mod_scripting_core::{ + bindings::{DeferredReflection, ReflectAllocator, ReflectReference, ReflectionPathElem}, + error::ScriptError, + reflection_extensions::PartialReflectExt, +}; +use tealr::mlu::mlua::{FromLua, IntoLua, Lua, Value}; + +use crate::bindings::{proxy::LuaProxied, world::GetWorld}; + +/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented in lua via proxies which store +/// a reference to the actual value. +/// This is used for types which are represented in lua with pass by reference semantics +#[derive(Clone)] +pub struct ReflectLuaProxied { + pub into_proxy: Arc< + dyn for<'l> Fn(ReflectReference, &'l Lua) -> Result, tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, + pub from_proxy: Arc< + dyn for<'l> Fn(Value<'l>, &'l Lua) -> Result + + Send + + Sync + + 'static, + >, +} + +impl ReflectLuaProxied { + /// Generates a type data which can be used on [`Option`] types which are represented in lua with pass by reference semantics + fn new_for_option( + inner_lua_proxied_data: &ReflectLuaProxied, + option_from_reflect: &ReflectFromReflect, + ) -> Self { + let ref_into_option = |mut r: ReflectReference| { + r.index_path(ParsedPath::parse_static("0").expect("Invalid reflection path")); + r + }; + let into_proxy_clone = inner_lua_proxied_data.into_proxy.clone(); + let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); + let option_from_reflect = option_from_reflect.clone(); + Self { + into_proxy: Arc::new(move |reflect_ref, l| { + // read the value and check if it is None, if so return nil + // otherwise use the inner type's into_proxy + let world = l.get_world()?; + let is_some = world + .with_allocator_and_type_registry(|_, type_registry, allocator| { + let type_registry = type_registry.read(); + reflect_ref.with_reflect(&world, &type_registry, Some(&allocator), |s| { + s.as_option().map(|r| r.is_some()) + }) + }) + .map_err(tealr::mlu::mlua::Error::external)?; + + if is_some { + (into_proxy_clone)(ref_into_option(reflect_ref), l) + } else { + Ok(Value::Nil) + } + }), + from_proxy: Arc::new(move |v, l| { + if v.is_nil() { + // we need to allocate a new reflect reference since we don't have one existing + let dynamic_value = DynamicEnum::new("None", DynamicVariant::Unit); + + let world = l.get_world()?; + let reflect_ref = + world.with_resource(|w, mut allocator: Mut| { + let value = option_from_reflect + .from_reflect(&dynamic_value) + .ok_or_else(|| { + tealr::mlu::mlua::Error::external( + ScriptError::new_reflection_error(""), + ) + })? + .into_partial_reflect(); + Ok::<_, tealr::mlu::mlua::Error>(ReflectReference::new_allocated_boxed( + value, + &mut allocator, + )) + })?; + + Ok(reflect_ref) + } else { + let mut inner_ref = (from_proxy_clone)(v, l)?; + inner_ref.reflect_path.pop(); + Ok(inner_ref) + } + }), + } + } +} + +impl FromType for ReflectLuaProxied +where + T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T::Proxy: From + AsRef, +{ + fn from_type() -> Self { + Self { + into_proxy: Arc::new(|p, l| T::Proxy::from(p).into_lua(l)), + from_proxy: Arc::new(|v, l| T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone())), + } + } +} + +/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented directly in lua with +/// pass by value semantics, These need to implement [`Clone`] +#[derive(Clone)] +pub struct ReflectLuaValue { + pub into_value: Arc< + dyn for<'l> Fn(&dyn PartialReflect, &'l Lua) -> Result, tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, + pub set_value: Arc< + dyn for<'l> Fn( + &mut dyn PartialReflect, + Value<'l>, + &'l Lua, + ) -> Result<(), tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, + pub from_value: Arc< + dyn for<'l> Fn( + Value<'l>, + &'l Lua, + ) -> Result, tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, +} + +impl ReflectLuaValue { + /// generates implementation for an inner type wrapped by an option + /// + /// the option should check if the value is None if so return nil, + /// if the value is some use ReflectLuaValue implementation of the inner type. + /// + /// If there is a type mismatch at any point will return an error + pub fn new_for_option( + inner_reflect_lua_value: &ReflectLuaValue, + option_from_reflect: &ReflectFromReflect, + ) -> Self { + let into_value_clone = inner_reflect_lua_value.into_value.clone(); + // we have to do this so the closures can be moved into the arc + let from_value_clone = inner_reflect_lua_value.from_value.clone(); + let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); + let from_reflect_clone = option_from_reflect.clone(); + Self { + into_value: Arc::new(move |r, lua| { + r.as_option() + .map_err(tealr::mlu::mlua::Error::external)? + .map(|inner| (into_value_clone)(inner, lua)) + .unwrap_or_else(|| Ok(Value::Nil)) + }), + set_value: Arc::new(move |r, v, l| { + if v.is_nil() { + r.apply(&DynamicEnum::new("None", DynamicVariant::Unit)); + } else { + r.apply(&DynamicEnum::new( + "Some", + DynamicVariant::Tuple([(from_value_clone)(v, l)?].into_iter().collect()), + )); + } + Ok(()) + }), + from_value: Arc::new(move |v, l| { + let dynamic_option = if v.is_nil() { + DynamicEnum::new("None", DynamicVariant::Unit) + } else { + let inner = (from_value_clone2)(v, l)?; + DynamicEnum::new("Some", DynamicVariant::Tuple([inner].into_iter().collect())) + }; + + let reflect_option = from_reflect_clone + .from_reflect(&dynamic_option) + .ok_or_else(|| { + tealr::mlu::mlua::Error::external(ScriptError::new_runtime_error( + "Failed to convert to option", + )) + })?; + Ok(reflect_option.into_partial_reflect()) + }), + } + } +} + +impl IntoLua<'l> + for<'l> FromLua<'l>> FromType + for ReflectLuaValue +{ + fn from_type() -> Self { + Self { + into_value: Arc::new(|v, l| v.try_downcast_ref::().unwrap().clone().into_lua(l)), + set_value: Arc::new(|t, v, l| { + let t = t.try_downcast_mut::().unwrap(); + *t = T::from_lua(v, l)?; + Ok(()) + }), + from_value: Arc::new(|v, l| { + T::from_lua(v, l).map(|v| Box::new(v) as Box) + }), + } + } +} + +/// Registers a lua proxy object via the reflection system +pub trait RegisterLua { + fn register_lua_proxy( + &mut self, + ) -> &mut Self + where + T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T::Proxy: From + AsRef; + + fn register_lua_value(&mut self) -> &mut Self + where + T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T: Reflect + Clone + TypePath + GetTypeRegistration; +} + +impl RegisterLua for App { + fn register_lua_proxy( + &mut self, + ) -> &mut Self + where + T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T::Proxy: From + AsRef, + { + self.register_type::(); + self.register_type_data::() + } + + fn register_lua_value(&mut self) -> &mut Self + where + T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, + T: Reflect + Clone + TypePath + GetTypeRegistration, + { + self.register_type::(); + self.register_type_data::() + } +} + +/// Checks if the type registration is for a type which matches the pattern `core::option::Option`, and extracts `T`'s typeId as well as the Option's typeId +fn destructure_option_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { + let type_path_table = reg.type_info().type_path_table(); + let is_core = type_path_table.crate_name().is_some_and(|s| s == "core"); + let is_option = type_path_table.ident().is_some_and(|s| s == "Option"); + + if is_core && is_option { + reg.type_info() + .generics() + .get_named("T") + .map(|t| (reg.type_id(), t.type_id())) + } else { + None + } +} + +/// iterates over type data for all types which have registered [`ReflectLuaProxied`] and [`ReflectLuaValue`] implementations, +/// and registers corresponding [`Option`] [`Result`] etc type data equivalents +pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { + let mut type_registry = type_registry.write(); + + let mut lua_value_insertions: HashMap = Default::default(); + let mut lua_proxied_insertions: HashMap = Default::default(); + for (option_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_option_type) + { + if let Some(inner_lua_value_data) = + type_registry.get_type_data::(inner_type_id) + { + if let Some(option_from_reflect) = + type_registry.get_type_data::(option_type_id) + { + let option_lua_proxied_data = + ReflectLuaValue::new_for_option(&inner_lua_value_data, &option_from_reflect); + + lua_value_insertions.insert(option_type_id, option_lua_proxied_data); + } + } + + if let Some(inner_lua_proxied_data) = + type_registry.get_type_data::(inner_type_id) + { + if let Some(option_from_reflect) = + type_registry.get_type_data::(option_type_id) + { + let option_lua_proxied_data = + ReflectLuaProxied::new_for_option(inner_lua_proxied_data, option_from_reflect); + + lua_proxied_insertions.insert(option_type_id, option_lua_proxied_data); + } + } + } + + for (type_id, lua_value_data) in lua_value_insertions { + type_registry + .get_mut(type_id) + .expect("We just found the type id from the type registry") + .insert(lua_value_data); + } + + for (type_id, lua_proxied_data) in lua_proxied_insertions { + type_registry + .get_mut(type_id) + .expect("We just found the type id from the type registry") + .insert(lua_proxied_data); + } +} + +pub fn register_lua_values(app: &mut bevy::prelude::App) { + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); + app.register_lua_value::(); +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::bindings::{reference::LuaReflectReference, world::LuaWorld}; + use bevy::{ + prelude::World, + reflect::{TypeRegistry, TypeRegistryArc}, + }; + use bevy_mod_scripting_core::bindings::WorldCallbackAccess; + use std::sync::Arc; + + #[derive(Reflect)] + struct Proxied(usize); + + impl LuaProxied for Proxied { + type Proxy = LuaReflectReference; + } + + fn setup_type_registry() -> AppTypeRegistry + where + T1: GetTypeRegistration, + T2: GetTypeRegistration, + { + let mut type_registry = TypeRegistry::default(); + type_registry.register::(); + type_registry.register::(); + + let type_registry_arc = TypeRegistryArc { + internal: Arc::new(type_registry.into()), + }; + AppTypeRegistry(type_registry_arc) + } + + #[test] + fn test_pre_register_common_containers_lua_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_id = std::any::TypeId::of::>(); + let option_type_registration = type_registry.get(option_type_id).unwrap(); + + let type_data = option_type_registration.contains::(); + assert!(type_data, "Option should have type data"); + } + + #[test] + fn test_pre_register_common_containers_lua_proxy() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_id = std::any::TypeId::of::>(); + let option_type_registration = type_registry.get(option_type_id).unwrap(); + + let type_data = option_type_registration.contains::(); + assert!(type_data, "Option should have type data"); + } + + #[test] + fn test_option_lua_proxy_impl_into_proxy() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + let mut world = World::default(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap() + .clone(); + let inner_type_data = type_registry + .get_type_data::(std::any::TypeId::of::()) + .unwrap() + .clone(); + + let mut allocator = ReflectAllocator::default(); + let inner_value = ReflectReference::new_allocated(Proxied(4), &mut allocator); + let some_value = ReflectReference::new_allocated(Some(Proxied(4)), &mut allocator); + let none_value = ReflectReference::new_allocated(None::, &mut allocator); + world.insert_resource(allocator); + drop(type_registry); + world.insert_resource(app_type_registry); + + let lua = Lua::new(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + lua.globals().set("world", LuaWorld(world.clone())).unwrap(); + + // option::some into_proxy should be equivalent result to inner_type into_proxy apart from the reflect path + let expected_into_value = (inner_type_data.into_proxy)(inner_value, &lua).unwrap(); + let gotten_into_value = (option_type_data.into_proxy)(some_value, &lua).unwrap(); + + let converted_into_value = LuaReflectReference::from_lua(expected_into_value, &lua) + .unwrap() + .0 + .reflect_path; + + let mut converted_gotten_into_value = + LuaReflectReference::from_lua(gotten_into_value, &lua) + .unwrap() + .0 + .reflect_path; + converted_gotten_into_value.pop(); + + assert_eq!( + converted_into_value, converted_gotten_into_value, + "Option into_proxy should be equivalent to Proxied into_proxy for Some variant apart from the last element in the path" + ); + + // the none variant should be equivalent to Value::Nil + let expected_into_value = Value::Nil; + let gotten_into_value = (option_type_data.into_proxy)(none_value, &lua).unwrap(); + + assert_eq!( + expected_into_value, gotten_into_value, + "Option into_proxy should be equivalent to Value::Nil for None variant" + ); + }) + } + + #[test] + fn test_option_lua_proxy_impl_from_proxy() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + let mut world = World::default(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap() + .clone(); + + let mut allocator = ReflectAllocator::default(); + let some_value = ReflectReference::new_allocated(Some(Proxied(4)), &mut allocator); + let none_value = ReflectReference::new_allocated(None::, &mut allocator); + world.insert_resource(allocator); + drop(type_registry); + world.insert_resource(app_type_registry); + + let lua = Lua::new(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + lua.globals().set("world", LuaWorld(world.clone())).unwrap(); + + let some_lua_value = LuaReflectReference(some_value.clone()) + .into_lua(&lua) + .unwrap(); + let gotten_value = (option_type_data.from_proxy)(some_lua_value, &lua).unwrap(); + assert_eq!(gotten_value.reflect_path, some_value.reflect_path); + + let gotten_value = (option_type_data.from_proxy)(Value::Nil, &lua).unwrap(); + assert_eq!(gotten_value.reflect_path, none_value.reflect_path); + }) + } + + #[test] + fn test_option_lua_value_impl_into_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap(); + let inner_type_data = type_registry + .get_type_data::(std::any::TypeId::of::()) + .unwrap(); + + // option::some into_value should be equivalent result to inner_type into_value + let lua = Lua::new(); + let value: usize = 5; + let option_value = Some(value); + let expected_into_value = (inner_type_data.into_value)(&value, &lua).unwrap(); + let gotten_into_value = (option_type_data.into_value)(&option_value, &lua).unwrap(); + + assert_eq!( + expected_into_value, gotten_into_value, + "Option into_value should be equivalent to usize into_value for Some variant" + ); + + // the none variant should be equivalent to Value::Nil + let option_value: Option = None; + let expected_into_value = Value::Nil; + let gotten_into_value = (option_type_data.into_value)(&option_value, &lua).unwrap(); + + assert_eq!( + expected_into_value, gotten_into_value, + "Option into_value should be equivalent to Value::Nil for None variant" + ); + } + + #[test] + fn test_option_lua_value_set_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap(); + + // setting an existing Some variant works correctly + let lua = Lua::new(); + let mut target_option = Some(0usize); + (option_type_data.set_value)(&mut target_option, 5.into_lua(&lua).unwrap(), &lua).unwrap(); + assert_eq!( + target_option, + Some(5), + "Option set_value should set the value to Some(5)" + ); + + // setting an existing Some variant to nil should set the value to None + (option_type_data.set_value)(&mut target_option, Value::Nil, &lua).unwrap(); + assert_eq!( + target_option, None, + "Option set_value should set the value to None" + ); + + // setting a none variant should set the Some variant correctly + let mut target_option: Option = None; + (option_type_data.set_value)(&mut target_option, 5usize.into_lua(&lua).unwrap(), &lua) + .unwrap(); + assert_eq!( + target_option, + Some(5), + "Option set_value should set the value to None" + ); + + // setting a none variant to nil should stay as None + (option_type_data.set_value)(&mut target_option, Value::Nil, &lua).unwrap(); + assert_eq!( + target_option, None, + "Option set_value should set the value to None" + ); + } + + #[test] + fn test_option_lua_value_from_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap(); + + // from_value should correctly work for concrete values + let lua = Lua::new(); + let value = 5usize; + let gotten_value = + (option_type_data.from_value)(value.into_lua(&lua).unwrap(), &lua).unwrap(); + + assert_eq!( + Some(value), + *gotten_value.try_downcast::>().unwrap(), + "Option from_value should correctly convert a value" + ); + + // from_value should correctly work for nil values + let nil_lua = Value::Nil; + let gotten_value = (option_type_data.from_value)(nil_lua, &lua).unwrap(); + assert_eq!( + None::, + *gotten_value.try_downcast::>().unwrap(), + "Option from_value should correctly convert a nil value" + ); + } + + #[test] + fn test_get_inner_type_id_option() { + let app_type_registry = setup_type_registry::>(); + + let type_registry = app_type_registry.read(); + let option_type_id = std::any::TypeId::of::>(); + let inner_type_id = std::any::TypeId::of::(); + let option_type_registration = type_registry.get(option_type_id).unwrap(); + + let (gotten_option_type_id, gotten_inner_type_id) = + destructure_option_type(option_type_registration).unwrap(); + assert_eq!( + gotten_inner_type_id, inner_type_id, + "Option should have inner type usize" + ); + assert_eq!( + gotten_option_type_id, option_type_id, + "Option should have type id Option" + ); + } +} diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index 0177101cb8..bbb8a7c382 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -17,35 +17,51 @@ pub struct MyComponent { option_vec3: Option, vec_of_option_bools: Vec>, option_vec_of_bools: Option>, + vec_of_usize: Vec, + option_usize: Option, } -fn load_script( - server: Res, - mut commands: Commands, - mut handle: Local>, -) { - let path = "scripts/bevy_api.lua"; - let handle_ = server.load::(path); - *handle = handle_; +const SCRIPT_NAME: &str = "scripts/bevy_api.lua"; - commands.spawn(ScriptComponent::new(vec![path.into()])); +fn load_script(server: Res, mut handle: Local>) { + let handle_ = server.load::(SCRIPT_NAME); + *handle = handle_; } fn init_data(mut commands: Commands) { - commands.spawn(MyComponent { - usize: 5, - vec2: Vec2::new(1.0, 2.0), - f32: 6.7, - mat3: Mat3::from_cols( - Vec3::new(1.0, 2.0, 3.0), - Vec3::new(4.0, 5.0, 6.0), - Vec3::new(7.0, 8.0, 9.0), - ), - quat: Quat::from_xyzw(1.0, 2.0, 3.0, 4.0), - option_vec3: None, - vec_of_option_bools: vec![Some(true), None, Some(false)], - option_vec_of_bools: Some(vec![true, true, true]), - }); + commands.spawn(( + MyComponent { + usize: 5, + vec2: Vec2::new(1.0, 2.0), + f32: 6.7, + mat3: Mat3::from_cols( + Vec3::new(1.0, 2.0, 3.0), + Vec3::new(4.0, 5.0, 6.0), + Vec3::new(7.0, 8.0, 9.0), + ), + quat: Quat::from_xyzw(1.0, 2.0, 3.0, 4.0), + option_vec3: None, + vec_of_option_bools: vec![Some(true), None, Some(false)], + option_vec_of_bools: Some(vec![true, true, true]), + vec_of_usize: vec![1, 2, 3], + option_usize: None, + }, + ScriptComponent::new(vec![SCRIPT_NAME.into()]), + )); +} + +struct EventCallbackLabel; +impl IntoCallbackLabel for EventCallbackLabel { + fn into_callback_label() -> CallbackLabel { + "on_event".into() + } +} + +pub fn send_event(mut writer: EventWriter>) { + writer.send(ScriptCallbackEvent::new_for_all( + EventCallbackLabel::into_callback_label(), + (), + )); } fn main() -> std::io::Result<()> { @@ -55,8 +71,14 @@ fn main() -> std::io::Result<()> { .add_plugins(LuaScriptingPlugin::<()>::default()) .add_plugins(LuaBevyScriptingPlugin) .register_type::() - // note the implementation for Option is there, but we must register `LuaProxyable` for it - .add_systems(Startup, (init_data, load_script)); + .add_systems(Startup, (init_data, load_script)) + .add_systems( + Update, + ( + send_event, + event_handler::.after(send_event), + ), + ); app.run(); From 60857bbc7fd4fd336d75a075ff24304a797ad5a2 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 25 Nov 2024 08:27:24 +0000 Subject: [PATCH 026/217] register vec lua types FOR ALL THE TYPES BABY --- assets/scripts/bevy_api.lua | 12 +- .../src/reflection_extensions.rs | 18 +- .../bevy_mod_scripting_lua/src/type_data.rs | 334 +++++++++++++++--- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 3 +- examples/lua/bevy_api.rs | 4 +- 5 files changed, 308 insertions(+), 63 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index cefd120e61..f70bcc41cf 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -25,8 +25,8 @@ function on_event() print(comp.option_usize) comp.option_usize = nil print(comp.option_usize) - world:exit() + print("vec") print(comp.vec_of_usize) print(comp.vec_of_usize[2]) comp.vec_of_usize[2] = 69 @@ -35,16 +35,6 @@ function on_event() print("============") - -- the index metamethod on ReflectValue's uses bevy's reflection mechanism on top of some custom sub-reflection logic to - -- allow reflecting inside Options, Vectors etc. - -- when we index into ReflectValue's we either get back a custom proxy or another ReflectValue - - -- the LuaBevyAPIProvider provides us custom proxies for many bevy types as well as std types. - -- all of these implementations can be overridden via the bevy TypeRegistry - print("Hello:", comp.usize._1) - comp.usize[1] = 2 - print("comp.usize after assigning to 2: ", comp.usize._1) - -- vec's and matrices have custom __index and __newindex overrides print("comp.vec2 before: ", comp.vec2) comp.vec2[1] = 69 diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 19ca2fa664..572f0245f6 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -14,6 +14,9 @@ pub trait PartialReflectExt { /// If the type is an option, returns either the inner value or None if the option is None. /// Errors if the type is not an option. fn as_option(&self) -> Result, ScriptError>; + + /// If the type is an iterable list-like type, returns an iterator over the elements. + fn as_list(&self) -> Result, ScriptError>; } impl PartialReflectExt for T { @@ -39,8 +42,6 @@ impl PartialReflectExt for T { Ok(()) } - /// If the type is an option, returns either the inner value or None if the option is None. - /// Errors if the type is not an option. fn as_option(&self) -> Result, ScriptError> { self.expect_type(Some("core"), "Option")?; @@ -54,6 +55,19 @@ impl PartialReflectExt for T { unreachable!("core::Option is an enum with a tuple variant") } + + fn as_list(&self) -> Result, ScriptError> { + if let bevy::reflect::ReflectRef::List(l) = self.reflect_ref() { + Ok(l.iter()) + } else { + Err(ScriptError::new_runtime_error(format!( + "Expected list-like type from crate core, but got {}", + self.get_represented_type_info() + .map(|ti| ti.type_path()) + .unwrap_or_else(|| "dynamic type with no type information") + ))) + } + } } #[cfg(test)] diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index 629fca061f..3c478cc5b4 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -9,9 +9,9 @@ use bevy::{ log::debug, prelude::{AppTypeRegistry, Mut}, reflect::{ - impl_reflect, DynamicEnum, DynamicTuple, DynamicVariant, FromType, GetTypeRegistration, - ParsedPath, PartialReflect, Reflect, ReflectFromReflect, ReflectPathError, TypePath, - TypeRegistration, + impl_reflect, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, FromType, + GetTypeRegistration, ParsedPath, PartialReflect, Reflect, ReflectFromReflect, + ReflectPathError, TypePath, TypeRegistration, }, }; use bevy_mod_scripting_core::{ @@ -153,6 +153,31 @@ pub struct ReflectLuaValue { } impl ReflectLuaValue { + fn dynamic_option_from_value<'lua>( + v: Value<'lua>, + lua: &'lua Lua, + from_value: &Arc< + dyn for<'l> Fn( + Value<'l>, + &'l Lua, + ) + -> Result, tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, + ) -> Result { + if v.is_nil() { + Ok(DynamicEnum::new("None", DynamicVariant::Unit)) + } else { + let inner = (from_value)(v, lua)?; + Ok(DynamicEnum::new( + "Some", + DynamicVariant::Tuple([inner].into_iter().collect()), + )) + } + } + /// generates implementation for an inner type wrapped by an option /// /// the option should check if the value is None if so return nil, @@ -176,32 +201,102 @@ impl ReflectLuaValue { .unwrap_or_else(|| Ok(Value::Nil)) }), set_value: Arc::new(move |r, v, l| { - if v.is_nil() { - r.apply(&DynamicEnum::new("None", DynamicVariant::Unit)); - } else { - r.apply(&DynamicEnum::new( - "Some", - DynamicVariant::Tuple([(from_value_clone)(v, l)?].into_iter().collect()), - )); - } + let dynamic = Self::dynamic_option_from_value(v, l, &from_value_clone)?; + r.apply(&dynamic); + Ok(()) }), from_value: Arc::new(move |v, l| { - let dynamic_option = if v.is_nil() { - DynamicEnum::new("None", DynamicVariant::Unit) - } else { - let inner = (from_value_clone2)(v, l)?; - DynamicEnum::new("Some", DynamicVariant::Tuple([inner].into_iter().collect())) - }; + let dynamic_option = Self::dynamic_option_from_value(v, l, &from_value_clone2)?; - let reflect_option = from_reflect_clone + from_reflect_clone .from_reflect(&dynamic_option) .ok_or_else(|| { tealr::mlu::mlua::Error::external(ScriptError::new_runtime_error( "Failed to convert to option", )) - })?; - Ok(reflect_option.into_partial_reflect()) + }) + .map(::into_partial_reflect) + }), + } + } + + fn dynamic_list_from_value<'lua>( + v: Value<'lua>, + lua: &'lua Lua, + from_value: &Arc< + dyn for<'l> Fn( + Value<'l>, + &'l Lua, + ) + -> Result, tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, + ) -> Result { + let table = if let Value::Table(t) = v { + t + } else { + return Err(tealr::mlu::mlua::Error::external( + ScriptError::new_runtime_error(format!( + "Cannot set value of type `{}` via type: `{}`. Expected table", + v.type_name(), + "List", + )), + )); + }; + + let lua_values = table.sequence_values().collect::, _>>()?; + + let converted_values = lua_values + .into_iter() + .map(|v| (from_value)(v, lua)) + .collect::, _>>()?; + + Ok(DynamicList::from_iter(converted_values)) + } + + pub fn new_for_list(inner_reflect_lua_value: &ReflectLuaValue) -> Self { + let into_value_clone = inner_reflect_lua_value.into_value.clone(); + let from_value_clone = inner_reflect_lua_value.from_value.clone(); + let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); + // let vec_from_reflect = vec_from_reflect.clone(); + Self { + into_value: Arc::new(move |r, l| { + let inner = r.as_list().map_err(tealr::mlu::mlua::Error::external)?; + let inner = inner + .map(|i| (into_value_clone)(i, l)) + .collect::, _>>()?; + + l.create_table_from( + inner + .into_iter() + .enumerate() + .map(|(i, v)| (Value::Integer(i as i64 + 1), v)), + ) + .map(Value::Table) + }), + set_value: Arc::new(move |r, v, l| { + let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone)?; + r.apply(&dynamic); + Ok(()) + }), + from_value: Arc::new(move |v, l| { + let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone2)?; + + // vec_from_reflect + // .from_reflect(&dynamic) + // .ok_or_else(|| { + // tealr::mlu::mlua::Error::external(ScriptError::new_runtime_error( + // "Failed to convert to option", + // )) + // }) + // .map(::into_partial_reflect) + // TODO: testing this out, not returning a concrete type could be weird + // would anything but this impl care about this? + // Ok(Box::new(dynamic)) + Ok(Box::new(dynamic)) }), } } @@ -278,6 +373,21 @@ fn destructure_option_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { } } +fn destructure_vec_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { + let type_path_table = reg.type_info().type_path_table(); + let is_core = type_path_table.crate_name().is_some_and(|s| s == "alloc"); + let is_vec = type_path_table.ident().is_some_and(|s| s == "Vec"); + + if is_core && is_vec { + reg.type_info() + .generics() + .get_named("T") + .map(|t| (reg.type_id(), t.type_id())) + } else { + None + } +} + /// iterates over type data for all types which have registered [`ReflectLuaProxied`] and [`ReflectLuaValue`] implementations, /// and registers corresponding [`Option`] [`Result`] etc type data equivalents pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { @@ -294,7 +404,7 @@ pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { type_registry.get_type_data::(option_type_id) { let option_lua_proxied_data = - ReflectLuaValue::new_for_option(&inner_lua_value_data, &option_from_reflect); + ReflectLuaValue::new_for_option(inner_lua_value_data, option_from_reflect); lua_value_insertions.insert(option_type_id, option_lua_proxied_data); } @@ -314,6 +424,20 @@ pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { } } + for (vec_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_vec_type) { + if let Some(inner_lua_value_data) = + type_registry.get_type_data::(inner_type_id) + { + // if let Some(vec_from_reflect) = + // type_registry.get_type_data::(vec_type_id) + // { + let vec_lua_value_data = ReflectLuaValue::new_for_list(inner_lua_value_data); + + lua_value_insertions.insert(vec_type_id, vec_lua_value_data); + // } + } + } + for (type_id, lua_value_data) in lua_value_insertions { type_registry .get_mut(type_id) @@ -381,38 +505,38 @@ mod tests { AppTypeRegistry(type_registry_arc) } + macro_rules! assert_transitively_registers { + ($target_type:ty, $container_type:ty, $type_data:ty) => {{ + let mut app_type_registry = setup_type_registry::<$target_type, $container_type>(); + app_type_registry + .write() + .register_type_data::<$target_type, $type_data>(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let container_type_id = std::any::TypeId::of::<$container_type>(); + let container_type_registration = type_registry.get(container_type_id).unwrap(); + + let type_data = container_type_registration.contains::<$type_data>(); + assert!( + type_data, + "{:?} should have type data {:?}", + std::any::type_name::<$container_type>(), + std::any::type_name::<$type_data>() + ); + }}; + } + #[test] fn test_pre_register_common_containers_lua_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_id = std::any::TypeId::of::>(); - let option_type_registration = type_registry.get(option_type_id).unwrap(); - - let type_data = option_type_registration.contains::(); - assert!(type_data, "Option should have type data"); + assert_transitively_registers!(usize, Option, ReflectLuaValue); + assert_transitively_registers!(usize, Vec, ReflectLuaValue); } #[test] fn test_pre_register_common_containers_lua_proxy() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_id = std::any::TypeId::of::>(); - let option_type_registration = type_registry.get(option_type_id).unwrap(); - - let type_data = option_type_registration.contains::(); - assert!(type_data, "Option should have type data"); + assert_transitively_registers!(Proxied, Option, ReflectLuaProxied); } #[test] @@ -557,6 +681,42 @@ mod tests { ); } + #[test] + fn test_vec_lua_value_impl_into_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap(); + let inner_type_data = type_registry + .get_type_data::(std::any::TypeId::of::()) + .unwrap(); + + // option::some into_value should be a table with the inner value converted to Lua + let lua = Lua::new(); + let value: usize = 5; + let option_value = vec![value]; + let expected_into_value = (inner_type_data.into_value)(&value, &lua).unwrap(); + let gotten_into_value = (option_type_data.into_value)(&option_value, &lua).unwrap(); + + assert_eq!( + expected_into_value, + gotten_into_value.as_table().unwrap().pop().unwrap(), + ); + + // an empty vec should be equivalent to an empty table + let vec_value: Vec = vec![]; + let gotten_into_value = (option_type_data.into_value)(&vec_value, &lua).unwrap(); + + assert!(gotten_into_value.as_table().unwrap().is_empty()); + } + #[test] fn test_option_lua_value_set_value() { let mut app_type_registry = setup_type_registry::>(); @@ -606,6 +766,47 @@ mod tests { ); } + #[test] + fn test_vec_lua_value_set_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap(); + + // setting an existing vec + let lua = Lua::new(); + let new_vec = Value::Table( + lua.create_table_from(vec![(1, 5.into_lua(&lua).unwrap())]) + .unwrap(), + ); + let mut target_vec = vec![0usize]; + (option_type_data.set_value)(&mut target_vec, new_vec.clone(), &lua).unwrap(); + assert_eq!(target_vec, vec![5],); + + // setting an existing vec to an empty table should create a new empty vec + (option_type_data.set_value)( + &mut target_vec, + Value::Table( + lua.create_table_from(Vec::<(isize, usize)>::default()) + .unwrap(), + ), + &lua, + ) + .unwrap(); + assert_eq!(target_vec, Vec::::default(),); + + // setting an empty vec to a table with a value should set the vec to the value + (option_type_data.set_value)(&mut target_vec, new_vec, &lua).unwrap(); + assert_eq!(target_vec, vec![5],); + } + #[test] fn test_option_lua_value_from_value() { let mut app_type_registry = setup_type_registry::>(); @@ -642,6 +843,45 @@ mod tests { ); } + #[test] + fn test_vec_lua_value_from_value() { + let mut app_type_registry = setup_type_registry::>(); + app_type_registry + .write() + .register_type_data::(); + + pre_register_common_containers(&mut app_type_registry); + + let type_registry = app_type_registry.read(); + let option_type_data = type_registry + .get_type_data::(std::any::TypeId::of::>()) + .unwrap(); + + // from_value should correctly work for concrete values + let lua = Lua::new(); + let value = vec![5usize]; + let gotten_value = + (option_type_data.from_value)(value.into_lua(&lua).unwrap(), &lua).unwrap(); + + assert_eq!( + gotten_value + .as_list() + .unwrap() + .map(|v| *v.try_downcast_ref::().unwrap()) + .collect::>() + .pop(), + Some(5usize) + ); + + // from_value should correctly work for empty lists + let nil_lua = Value::Table( + lua.create_table_from(Vec::<(isize, usize)>::default()) + .unwrap(), + ); + let gotten_value = (option_type_data.from_value)(nil_lua, &lua).unwrap(); + assert!(gotten_value.as_list().unwrap().count() == 0); + } + #[test] fn test_get_inner_type_id_option() { let app_type_registry = setup_type_registry::>(); diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 45f5d617fe..92f38d9b96 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -23,7 +23,8 @@ use bevy_mod_scripting_lua::{ }, lua_context_load, lua_handler, prelude::{Lua, LuaFunction, LuaHookTriggers}, - register_lua_values, LuaScriptingPlugin, ReflectLuaValue, + type_data::{register_lua_values, ReflectLuaValue}, + LuaScriptingPlugin, }; use libtest_mimic::{Arguments, Failed, Trial}; use std::{ diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index bbb8a7c382..5e496fd8a2 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -14,11 +14,11 @@ pub struct MyComponent { usize: usize, f32: f32, mat3: Mat3, + vec_of_usize: Vec, + option_usize: Option, option_vec3: Option, vec_of_option_bools: Vec>, option_vec_of_bools: Option>, - vec_of_usize: Vec, - option_usize: Option, } const SCRIPT_NAME: &str = "scripts/bevy_api.lua"; From e347a8b962ec28fe7f02cfe9ecae1510bad88bce Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 1 Dec 2024 20:52:50 +0000 Subject: [PATCH 027/217] improve type data, and add iterator to reflect ref --- .vscode/settings.json | 2 +- assets/scripts/bevy_api.lua | 19 +- crates/bevy_mod_scripting_core/Cargo.toml | 6 +- .../src/bindings/allocator.rs | 44 +- .../src/bindings/proxy.rs | 27 +- .../src/bindings/reference.rs | 193 +-- .../src/bindings/world.rs | 199 +-- crates/bevy_mod_scripting_core/src/error.rs | 43 +- .../src/reflection_extensions.rs | 229 +++- .../bevy_mod_scripting_lua/Cargo.toml | 2 +- .../src/bindings/query.rs | 2 +- .../src/bindings/reference.rs | 281 +++-- .../src/bindings/world.rs | 12 +- .../bevy_mod_scripting_lua/src/lib.rs | 2 +- .../bevy_mod_scripting_lua/src/type_data.rs | 1122 +++++++++-------- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 2 +- examples/lua/bevy_api.rs | 2 + 17 files changed, 1306 insertions(+), 881 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3c966b296b..980f809761 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,4 +24,4 @@ ], "rust-analyzer.showUnlinkedFileNotification": false, // "rust-analyzer.semanticHighlighting.operator.enable": false -} +} \ No newline at end of file diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index f70bcc41cf..c8748f0026 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -19,19 +19,26 @@ function on_event() local comp = world:get_component(entity, my_component_type) print("Before script: ", comp) - + print("\noption") print(comp.option_usize) comp.option_usize = 69 print(comp.option_usize) comp.option_usize = nil print(comp.option_usize) - print("vec") - print(comp.vec_of_usize) - print(comp.vec_of_usize[2]) - comp.vec_of_usize[2] = 69 + print("\nvec") + print(table_to_string(comp.vec_of_usize)) + comp.vec_of_usize = {42,69,72} + comp.vec_of_usize[1] = 0 print(comp.vec_of_usize[2]) - world:exit() + print(table_to_string(comp.vec_of_usize)) + comp.vec_of_usize = {} + print(table_to_string(comp.vec_of_usize)) + comp.vec_of_usize = comp.vec_of_usize2 + print(table_to_string(comp.vec_of_usize)) + comp.vec_of_usize = comp.vec_of_usize + print(table_to_string(comp.vec_of_usize)) + print("============") diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index c2bb18dcb8..45eac55116 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -19,14 +19,18 @@ path = "src/lib.rs" # if enabled enables documentation updating in optimized builds doc_always = [] +# if enabled enables some common mlua trait implementations +mlua_impls = ["mlua"] [dependencies] +mlua = { version = "0.9", optional = true } + bevy = { workspace = true, default-features = false, features = ["bevy_asset"] } thiserror = "1.0.31" paste = "1.0.7" parking_lot = "0.12.1" lockable = "0.0.8" smallvec = "1.11" - +itertools = "0.13" [dev-dependencies] test_utils = { workspace = true } diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index ef2c710a31..b338950ec2 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -62,28 +62,28 @@ impl ReflectAllocator { (id, value) } - /// Moves the given boxed [`PartialReflect`] value into the allocator, returning an [`AllocationId`] which can be used to access it later - pub fn allocate_boxed( - &mut self, - existing: Box, - ) -> (ReflectAllocationId, ReflectAllocation) { - let type_id = existing.get_represented_type_info().map(|i| i.type_id()); - let id = ReflectAllocationId(self.allocations.len()); - - let raw_ptr = Box::into_raw(existing); - // Safety: - // - we are the only ones to have access to this value since we have the Box - // - UnsafeCell is repr(transparent), meaning we can safely transmute between it and the trait object - // TODO: I don't think we can use this, because from_raw has a pre-condition that requires the pointer to have been an arc before - let arc: Arc> = - unsafe { Arc::from_raw(raw_ptr as *const _) }; - let allocation = ReflectAllocation::new(arc); - self.allocations.insert(id, allocation.clone()); - if let Some(type_id) = type_id { - self.types.insert(id, type_id); - } - (id, allocation) - } + // /// Moves the given boxed [`PartialReflect`] value into the allocator, returning an [`AllocationId`] which can be used to access it later + // pub fn allocate_boxed( + // &mut self, + // existing: Box, + // ) -> (ReflectAllocationId, ReflectAllocation) { + // let type_id = existing.get_represented_type_info().map(|i| i.type_id()); + // let id = ReflectAllocationId(self.allocations.len()); + + // let raw_ptr = Box::into_raw(existing); + // // Safety: + // // - we are the only ones to have access to this value since we have the Box + // // - UnsafeCell is repr(transparent), meaning we can safely transmute between it and the trait object + // // TODO: I don't think we can use this, because from_raw has a pre-condition that requires the pointer to have been an arc before + // let arc: Arc> = + // unsafe { Arc::from_raw(raw_ptr as *const _) }; + // let allocation = ReflectAllocation::new(arc); + // self.allocations.insert(id, allocation.clone()); + // if let Some(type_id) = type_id { + // self.types.insert(id, type_id); + // } + // (id, allocation) + // } pub fn get(&self, id: ReflectAllocationId) -> Option { self.allocations.get(&id).cloned() diff --git a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs index 9bc77465a5..ce1002b537 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs @@ -186,14 +186,7 @@ where ) -> ScriptResult> { let reflect_ref: &ReflectReference = self.0.as_ref(); let access = reflect_ref.base.base_id.get_reflect_access_id(); - let access = guard - .get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL) - .ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Could not unproxy type: `{}`. Aliasing access.", - std::any::type_name::() - )) - })?; + let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); let out = reflect_ref.reflect( guard.as_unsafe_world_cell(), &access, @@ -248,14 +241,7 @@ where ) -> ScriptResult<()> { let reflect_ref: &ReflectReference = self.0.as_ref(); let access = reflect_ref.base.base_id.get_reflect_access_id(); - let access = guard - .get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL) - .ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Could not unproxy type: `{}`. Aliasing access.", - std::any::type_name::() - )) - })?; + let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); accesses.push(access); Ok(()) } @@ -309,14 +295,7 @@ where ) -> ScriptResult<()> { let reflect_ref: &ReflectReference = self.0.as_ref(); let access = reflect_ref.base.base_id.get_reflect_access_id(); - let access = guard - .get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL) - .ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Could not unproxy type: `{}`. Aliasing access.", - std::any::type_name::() - )) - })?; + let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); accesses.push(access); Ok(()) } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 47ca7117c2..6860faa3d9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -36,7 +36,7 @@ use smallvec::SmallVec; use crate::{ bindings::{ReflectAllocation, ReflectAllocationId}, - prelude::{ReflectAllocator, ScriptError, ScriptResult}, + prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::TypeIdExtensions, }; use super::{ @@ -59,6 +59,11 @@ pub struct ReflectReference { impl ReflectReference { + /// Creates a new infinite iterator. This iterator will keep returning the next element reference forever. + pub fn into_iter_infinite(self) -> ReflectRefIter { + ReflectRefIter::new_indexed(self) + } + /// Prints the reference using the world to resolve type names. pub fn print_with_world(&self, world: &WorldAccessGuard) -> String { world.with_resource(|_, type_registry: Mut| { @@ -74,48 +79,29 @@ impl ReflectReference { } /// If this is a reference to something with a length accessible via reflection, returns that length. - pub fn len(&self, world: &WorldAccessGuard) -> Option { - world.with_resource(|world, type_registry: Mut| { - world.with_resource(|world, allocator: Mut| { - let type_registry = type_registry.read(); - self - .with_reflect(world, &type_registry, Some(&allocator), |r| { - match r.reflect_ref() { - bevy::reflect::ReflectRef::Struct(s) => Some(s.field_len()), - bevy::reflect::ReflectRef::TupleStruct(ts) => Some(ts.field_len()), - bevy::reflect::ReflectRef::Tuple(t) => Some(t.field_len()), - bevy::reflect::ReflectRef::List(l) => Some(l.len()), - bevy::reflect::ReflectRef::Array(a) => Some(a.len()), - bevy::reflect::ReflectRef::Map(m) => Some(m.len( )), - bevy::reflect::ReflectRef::Set(s) => Some(s.len()), - bevy::reflect::ReflectRef::Enum(e) => Some(e.field_len()), - bevy::reflect::ReflectRef::Opaque(_) => None, - } - }) + pub fn len(&self, world: &WorldAccessGuard) -> ScriptResult> { + self + .with_reflect(world, |r, _, _| { + match r.reflect_ref() { + bevy::reflect::ReflectRef::Struct(s) => Some(s.field_len()), + bevy::reflect::ReflectRef::TupleStruct(ts) => Some(ts.field_len()), + bevy::reflect::ReflectRef::Tuple(t) => Some(t.field_len()), + bevy::reflect::ReflectRef::List(l) => Some(l.len()), + bevy::reflect::ReflectRef::Array(a) => Some(a.len()), + bevy::reflect::ReflectRef::Map(m) => Some(m.len( )), + bevy::reflect::ReflectRef::Set(s) => Some(s.len()), + bevy::reflect::ReflectRef::Enum(e) => Some(e.field_len()), + bevy::reflect::ReflectRef::Opaque(_) => None, + } }) - }) } - pub fn new_allocated( + pub fn new_allocated( value: T, allocator: &mut ReflectAllocator, ) -> ReflectReference { + let type_id = value.get_represented_type_info().map(|i| i.type_id()).unwrap_or_else(|| panic!("Type '{}' has no represented type information to allocate with.", std::any::type_name::())); let (id, _) = allocator.allocate(value); - ReflectReference { - base: ReflectBaseType { - type_id: TypeId::of::(), - base_id: ReflectBase::Owned(id), - }, - reflect_path: Vec::default(), - } - } - - pub fn new_allocated_boxed( - value: Box, - allocator: &mut ReflectAllocator, - ) -> ReflectReference { - let type_id = value.get_represented_type_info().map(|i| i.type_id()).expect("Expected type info for boxed value"); - let (id, _) = allocator.allocate_boxed(value); ReflectReference { base: ReflectBaseType { type_id, @@ -132,61 +118,64 @@ impl ReflectReference { } /// A form of [`Self::reflect`] which does the access checks for you. - /// Panics if it waits for access too long to prevent deadlocks. - pub fn with_reflect O>( + #[track_caller] + pub fn with_reflect O>( &self, world: &WorldAccessGuard, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, f: F, - ) -> O { + ) -> ScriptResult { let access = world .get_access_timeout( self.base.base_id.get_reflect_access_id(), DEFAULT_TIMEOUT, DEFAULT_INTERVAL, - ) - .unwrap_or_else(|| panic!("Timeout when waiting for access for: `{:?}`", self)); - - let reflect = self - .reflect( - world.as_unsafe_world_cell(), - &access, - type_registry, - allocator, - ) - .unwrap(); - let o = f(reflect); + ); + + let out = world.with_allocator_and_type_registry(|_, type_registry, allocator| { + let type_registry = type_registry.read(); + let reflect = self + .reflect( + world.as_unsafe_world_cell(), + &access, + &type_registry, + Some(&allocator), + )?; + let o = f(reflect, &type_registry, &allocator); + + Ok(o) + }); + world.release_access(access); - o + out } - pub fn with_reflect_mut O>( + #[track_caller] + pub fn with_reflect_mut O>( &self, world: &WorldAccessGuard, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, f: F, - ) -> O { + ) -> ScriptResult { let mut access = world .get_access_timeout( self.base.base_id.get_reflect_access_id(), DEFAULT_TIMEOUT, DEFAULT_INTERVAL, - ) - .unwrap_or_else(|| panic!("Timeout when waiting for access for: `{:?}`", self)); - - let reflect = self - .reflect_mut( - world.as_unsafe_world_cell(), - &mut access, - type_registry, - allocator, - ) - .unwrap(); - let o = f(reflect); + ); + let out = world.with_allocator_and_type_registry(|_, type_registry, mut allocator| { + let type_registry = type_registry.read(); + let reflect = self + .reflect_mut( + world.as_unsafe_world_cell(), + &mut access, + &type_registry, + Some(&allocator), + )?; + let o = f(reflect, &type_registry, &mut allocator); + Ok(o) + }); + world.release_access(access); - o + out } /// Returns `Ok(())` if the given access is sufficient to read the value or an appropriate error otherwise @@ -566,3 +555,65 @@ impl PartialEq for DeferredReflection { } impl Eq for DeferredReflection {} + + +/// A generic iterator over any reflected value. +/// Unlike a normal iterator, this one does not have a halting condition, it will keep returning elements forever. +/// The iterator does not try to access the value, it just works out the next index/key to access. +/// You will know you've reached the end when you get an error when trying to access the next element. +#[derive(Debug,Clone)] +pub struct ReflectRefIter { + pub(crate) base: ReflectReference, + // TODO: support maps etc + pub(crate) index: IterationKey, +} + +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum IterationKey { + Index(usize), +} + +impl ReflectRefIter { + pub fn new_indexed(base: ReflectReference) -> Self { + Self { base, index: IterationKey::Index(0) } + } + + pub fn index(&self) -> IterationKey { + self.index.clone() + } + + /// Returns the next element in the iterator, it does not have a halting condition + pub fn next_ref(&mut self) -> (ReflectReference, IterationKey) { + let index = self.index(); + let next = match &mut self.index { + IterationKey::Index(i) => { + let mut next = self.base.clone(); + let parsed_path = ParsedPath::parse(&format!("[{}]", *i)).expect("invariant violated"); + next.index_path(ReflectionPathElem::Reflection(parsed_path)); + *i += 1; + next + } + }; + (next, index) + } +} + +impl Iterator for ReflectRefIter { + type Item = Result; + + fn next(&mut self) -> Option { + let result: Result<_, _> = { + match &mut self.index { + IterationKey::Index(i) => { + let mut next = self.base.clone(); + let parsed_path = ParsedPath::parse(&i.to_string()).unwrap(); + next.index_path(ReflectionPathElem::Reflection(parsed_path)); + *i += 1; + Ok(next) + } + } + }; + + return Some(result); + } +} \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 2481ec4d4a..02e7f8f212 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -10,6 +10,7 @@ use std::{ any::TypeId, fmt::Debug, marker::PhantomData, + mem, sync::{ atomic::{AtomicUsize, Ordering}, Arc, Weak, @@ -248,12 +249,52 @@ pub type WorldAccessUnit<'w> = WorldAccessWrite<'w>; pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5); pub const DEFAULT_INTERVAL: Duration = Duration::from_millis(10); +enum WorldAccessValue<'w> { + Free(WorldAccessWrite<'w>), + Locked(std::panic::Location<'static>), +} + +impl<'w> WorldAccessValue<'w> { + fn is_locked(&self) -> bool { + matches!(self, WorldAccessValue::Locked(_)) + } + + fn as_location(&self) -> Option> { + match self { + WorldAccessValue::Free(_) => None, + WorldAccessValue::Locked(location) => Some(*location), + } + } + + fn into_access(self) -> Option> { + match self { + WorldAccessValue::Free(access) => Some(access), + WorldAccessValue::Locked(_) => None, + } + } + + #[track_caller] + fn take(&mut self) -> Option> { + mem::replace( + self, + WorldAccessValue::Locked(*std::panic::Location::caller()), + ) + .into_access() + } +} + +impl<'w> From> for WorldAccessValue<'w> { + fn from(value: WorldAccessWrite<'w>) -> Self { + WorldAccessValue::Free(value) + } +} + /// Provides safe access to the world via [`WorldAccess`] permissions, which enforce aliasing rules at runtime in multi-thread environments #[derive(Clone)] pub struct WorldAccessGuard<'w> { pub cell: UnsafeWorldCell<'w>, // TODO: this is fairly hefty, explore other ways to hand out locks on WorldAccess - pub accesses: Arc>>>, + accesses: Arc>>, /// true if anybody has any access to the world pub accesses_count: Arc, // TODO can we track code/stack locations of things holding onto theese locks for debugging? @@ -282,7 +323,7 @@ impl<'w> WorldAccessGuard<'w> { .unwrap(); let val = val.value().unwrap(); - val.is_none() + val.is_locked() }) .collect() } @@ -308,6 +349,7 @@ impl<'w> WorldAccessGuard<'w> { self.cell.components().get_resource_id(id) } + #[track_caller] /// Checks nobody else is currently accessing the world, and if so locks access to it until /// [`release_whole_world_access`] is called. pub fn get_whole_world_access(&self) -> Option<&mut World> { @@ -325,6 +367,17 @@ impl<'w> WorldAccessGuard<'w> { self.accesses_count.fetch_sub(1, Ordering::Relaxed); } + pub fn get_access_location(&self, raid: ReflectAccessId) -> Option> { + let guard = self + .accesses + .blocking_lock(raid, lockable::SyncLimit::no_limit()) + .unwrap(); + let guard = guard.value().unwrap(); + + guard.as_location() + } + + #[track_caller] /// Tries to get access to the given reflect access id, if it's already given out returns `None`. If you want to wait for access, use [`WorldAccessGuard::get_access_timeout`] instead. /// Remember to release this access once done with [`WorldAccessGuard::release_access`] or nobody else will be able to access this id!. /// @@ -335,13 +388,14 @@ impl<'w> WorldAccessGuard<'w> { .blocking_lock(raid, lockable::SyncLimit::no_limit()) .unwrap(); let guard = guard.value_or_insert_with(|| { - Some(WorldAccessWrite { + WorldAccessWrite { raid, _ph: PhantomData, - }) + } + .into() }); - if guard.is_some() { + if !guard.is_locked() { self.accesses_count.fetch_add(1, Ordering::Relaxed); guard.take() } else { @@ -355,12 +409,13 @@ impl<'w> WorldAccessGuard<'w> { /// /// # Panic /// Will panic once access was not available after the timeout was reached + #[track_caller] pub fn get_access_timeout( &self, raid: ReflectAccessId, timeout: Duration, interval: Duration, - ) -> Option> { + ) -> WorldAccessUnit<'w> { let mut access = self.get_access(raid); let start = std::time::Instant::now(); @@ -368,10 +423,14 @@ impl<'w> WorldAccessGuard<'w> { std::thread::sleep(interval); access = self.get_access(raid); if start.elapsed() > timeout { - return None; + panic!( + "Timed out while waiting for access to {:?}. This is likely a deadlock. The access is being held by: {:?}", + raid, + self.get_access_location(raid) + ); } } - access + access.expect("invariant") } /// Releases access to the given reflect access id @@ -387,14 +446,15 @@ impl<'w> WorldAccessGuard<'w> { // should not be possible, we are the only ones who can instantiate WorldAccessUnit assert!( - guard.is_none(), + guard.is_locked(), "Invariant violated, an access has been released by someone else already who shouldn't have been able to do so" ); self.accesses_count.fetch_sub(1, Ordering::Relaxed); - *guard = Some(access); + *guard = WorldAccessValue::Free(access); } + #[track_caller] /// Get access to the given component_id, this is the only way to access a component/resource safely (in the context of the world access guard) /// since you can only access this component_id through a RwLock, there is no way to break aliasing rules. /// Additionally the 'w lifetime prevents you from storing this access outside the lifetime of the underlying cell @@ -406,6 +466,7 @@ impl<'w> WorldAccessGuard<'w> { self.get_access(access_id) } + #[track_caller] /// Similar to [`Self::get_component_access`] but typed, additionally panics if the component is not registered pub fn get_component_access_typed(&self) -> Option> { self.get_component_access( @@ -418,6 +479,7 @@ impl<'w> WorldAccessGuard<'w> { ) } + #[track_caller] /// Get access to the given component_id, this is the only way to access a component/resource safely (in the context of the world access guard) /// since you can only access this component_id through a RwLock, there is no way to break aliasing rules. /// Additionally the 'w lifetime prevents you from storing this access outside the lifetime of the underlying cell @@ -425,6 +487,7 @@ impl<'w> WorldAccessGuard<'w> { self.get_component_access(cid) } + #[track_caller] /// Similar to [`Self::get_resource_access`] but typed, additionally panics if the resource is not registered pub fn get_resource_access_typed(&self) -> Option> { self.get_resource_access( @@ -437,6 +500,7 @@ impl<'w> WorldAccessGuard<'w> { ) } + #[track_caller] /// Get access to the given allocation_id, this is the only way to access a script owned value safely (in the context of the world access guard) pub fn get_allocation_access(&self, id: ReflectAllocationId) -> Option> { let access_id = ReflectAccessId { @@ -446,6 +510,7 @@ impl<'w> WorldAccessGuard<'w> { self.get_access(access_id) } + #[track_caller] /// Provides access to a resource via callback. Panics if the resource does not exist or if waiting for access times out. pub fn with_resource) -> O>(&self, f: F) -> O { let cid = self @@ -454,14 +519,7 @@ impl<'w> WorldAccessGuard<'w> { .resource_id::() .unwrap_or_else(|| panic!("Resource not registered: `{}`", std::any::type_name::())); - let mut access = self - .get_access_timeout(cid.into(), DEFAULT_TIMEOUT, DEFAULT_INTERVAL) - .unwrap_or_else(|| { - panic!( - "Timed out while waiting for access to resource: `{}`", - std::any::type_name::() - ) - }); + let mut access = self.get_access_timeout(cid.into(), DEFAULT_TIMEOUT, DEFAULT_INTERVAL); let resource = self .get_resource_with_access_mut::(&mut access) @@ -472,6 +530,7 @@ impl<'w> WorldAccessGuard<'w> { out } + #[track_caller] /// Convenience to get commonly used resources at the same time. Internally identical to [`Self::with_resource`] pub fn with_allocator_and_type_registry< O, @@ -487,6 +546,7 @@ impl<'w> WorldAccessGuard<'w> { }) } + #[track_caller] /// Call a function on a type which can be proxied, first by unproxying the input with world access, /// then calling the function and finally proxying the output with the allocator. pub fn proxy_call<'i, O: Proxy, T: Unproxy, F: Fn(T::Output<'_>) -> O::Input<'i>>( @@ -521,6 +581,7 @@ impl<'w> WorldAccessGuard<'w> { Ok(proxied_output) } + #[track_caller] /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) pub fn get_component_with_access( &self, @@ -545,6 +606,7 @@ impl<'w> WorldAccessGuard<'w> { } } + #[track_caller] /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) pub fn get_component_with_access_mut( &self, @@ -569,6 +631,7 @@ impl<'w> WorldAccessGuard<'w> { } } + #[track_caller] /// Get access to the given resource pub fn get_resource_with_access( &self, @@ -592,6 +655,7 @@ impl<'w> WorldAccessGuard<'w> { } } + #[track_caller] /// Get access to the given resource, this is the only way to access a component/resource safely (in the context of the world access guard) pub fn get_resource_with_access_mut( &self, @@ -1105,25 +1169,20 @@ mod test { let world = world.read().unwrap(); // test read - world.with_resource(|world, allocator: Mut| { - world.with_resource(|world, type_registry: Mut| { - let type_registry = type_registry.read(); - ref_.with_reflect(world, &type_registry, Some(&allocator), |reflect| { - let orig = reflect.try_downcast_ref::(); - - let orig = match orig { - Some(v) => v, - None => { - panic!( - "Could not downcast value {reflect:?} to {}", - std::any::type_name::() - ) - } - }; - - assert_eq!(orig, &expected); - }) - }) + ref_.with_reflect(&world, |reflect, _, _| { + let orig = reflect.try_downcast_ref::(); + + let orig = match orig { + Some(v) => v, + None => { + panic!( + "Could not downcast value {reflect:?} to {}", + std::any::type_name::() + ) + } + }; + + assert_eq!(orig, &expected); }); assert!( @@ -1159,47 +1218,37 @@ mod test { WorldCallbackAccess::with_callback_access(&mut world, |world| { let world = world.read().unwrap(); // test set - world.with_resource(|world, allocator: Mut| { - world.with_resource(|world, type_registry: Mut| { - let type_registry = type_registry.read(); - ref_.with_reflect_mut(world, &type_registry, Some(&allocator), |reflect| { - let orig = reflect.try_downcast_mut::(); - - let orig = match orig { - Some(v) => v, - None => { - panic!( - "Could not downcast value {reflect:?} to {}", - std::any::type_name::() - ) - } - }; - - *orig = expected.clone(); - }) - }) + ref_.with_reflect_mut(&world, |reflect, _, _| { + let orig = reflect.try_downcast_mut::(); + + let orig = match orig { + Some(v) => v, + None => { + panic!( + "Could not downcast value {reflect:?} to {}", + std::any::type_name::() + ) + } + }; + + *orig = expected.clone(); }); // test read - world.with_resource(|world, allocator: Mut| { - world.with_resource(|world, type_registry: Mut| { - let type_registry = type_registry.read(); - ref_.with_reflect(world, &type_registry, Some(&allocator), |reflect| { - let orig = reflect.try_downcast_ref::(); - - let orig = match orig { - Some(v) => v, - None => { - panic!( - "Could not downcast value {reflect:?} to {}", - std::any::type_name::() - ) - } - }; - - assert_eq!(orig, &expected); - }) - }) + ref_.with_reflect(&world, |reflect, _, _| { + let orig = reflect.try_downcast_ref::(); + + let orig = match orig { + Some(v) => v, + None => { + panic!( + "Could not downcast value {reflect:?} to {}", + std::any::type_name::() + ) + } + }; + + assert_eq!(orig, &expected); }); post_check(&world); }); diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 9bcdc9127c..e3a62864b8 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -3,7 +3,7 @@ use std::{ sync::Arc, }; -use bevy::reflect::Reflect; +use bevy::reflect::{ApplyError, Reflect}; use thiserror::Error; use crate::{bindings::ReflectAllocationId, bindings::ReflectReference}; @@ -144,38 +144,9 @@ impl std::fmt::Display for ScriptError { } } -// #[derive(Error, Debug, Clone)] -// pub enum ReflectionError { -// #[error("Base reference `{base}` is invalid. {reason}")] -// InvalidBaseReference { base: String, reason: String }, -// #[error("Cannot safely access `{base}`. {reason}")] -// InsufficientAccess { base: String, reason: String }, -// #[error("Tried to access `{base:?}` with insufficient provenance. {reason}")] -// InsufficientProvenance { -// base: ReflectReference, -// reason: String, -// }, -// #[error("Cannot downcast reference: {reference:?} to: {to}")] -// CannotDowncast { -// reference: ReflectReference, -// to: String, -// }, -// #[error("Could not assign `{rhs}` to `{lhs:?}`. {reason}")] -// InvalidAssignment { -// lhs: ReflectReference, -// rhs: String, -// reason: String, -// }, -// #[error("Failed to build concrete type from &Reflect type: `{ref_}`. Does this type have a FromReflect type data?")] -// FromReflectFailure { ref_: String }, -// #[error("Could not dereference script allocation with ID: {id}. {reason}")] -// AllocationError { -// id: ReflectAllocationId, -// reason: String, -// }, -// #[error("Attempted to access world via stale world reference. Did you store a reference to a world across a frame boundary?")] -// StaleWorldAccess, - -// #[error("{0}")] -// Other(String), -// } +#[cfg(feature = "mlua_impls")] +impl From for mlua::Error { + fn from(value: ScriptError) -> Self { + mlua::Error::external(value) + } +} diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 572f0245f6..014a78ae19 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -1,4 +1,7 @@ -use bevy::reflect::PartialReflect; +use std::{any::TypeId, cmp::max}; + +use bevy::reflect::{List, PartialReflect}; +use itertools::Itertools; use crate::error::ScriptError; @@ -15,8 +18,35 @@ pub trait PartialReflectExt { /// Errors if the type is not an option. fn as_option(&self) -> Result, ScriptError>; + /// Similar to [`PartialReflectExt::as_option`] but for mutable references. + fn as_option_mut(&mut self) -> Result, ScriptError>; + /// If the type is an iterable list-like type, returns an iterator over the elements. fn as_list(&self) -> Result, ScriptError>; + + /// If the type is an iterable list-like type, sets the elements of the list to the elements of the other list-like type. + /// This acts as a set operation, so the left list will have the same length as the right list after this operation. + fn set_as_list< + F: Fn(&mut dyn PartialReflect, &dyn PartialReflect) -> Result<(), ScriptError>, + >( + &mut self, + other: Box, + apply: F, + ) -> Result<(), ScriptError>; + } + +pub trait TypeIdExtensions { + fn type_id_or_dummy(&self) -> TypeId; +} + +impl TypeIdExtensions for Option { + fn type_id_or_dummy(&self) -> TypeId { + struct UknownType; + match self { + Some(t) => *t, + None => TypeId::of::(), + } + } } impl PartialReflectExt for T { @@ -43,8 +73,6 @@ impl PartialReflectExt for T { } fn as_option(&self) -> Result, ScriptError> { - self.expect_type(Some("core"), "Option")?; - if let bevy::reflect::ReflectRef::Enum(e) = self.reflect_ref() { if let Some(field) = e.field_at(0) { return Ok(Some(field)); @@ -53,7 +81,29 @@ impl PartialReflectExt for T { } } - unreachable!("core::Option is an enum with a tuple variant") + Err(ScriptError::new_runtime_error(format!( + "Expected enum type, but got type which is not an enum: {}", + self.get_represented_type_info() + .map(|ti| ti.type_path()) + .unwrap_or_else(|| "dynamic type with no type information") + ))) + } + + fn as_option_mut(&mut self) -> Result, ScriptError> { + let type_info = self.get_represented_type_info().map(|ti| ti.type_path()); + match self.reflect_mut() { + bevy::reflect::ReflectMut::Enum(e) => { + if let Some(field) = e.field_at_mut(0) { + Ok(Some(field)) + } else { + Ok(None) + } + } + _ => Err(ScriptError::new_runtime_error(format!( + "Expected enum type, but got type which is not an enum: {}", + type_info.unwrap_or("dynamic type with no type information") + ))), + } } fn as_list(&self) -> Result, ScriptError> { @@ -68,8 +118,94 @@ impl PartialReflectExt for T { ))) } } + + fn set_as_list< + F: Fn(&mut dyn PartialReflect, &dyn PartialReflect) -> Result<(), ScriptError>, + >( + &mut self, + mut other: Box, + apply: F, + ) -> Result<(), ScriptError> { + match (self.reflect_mut(), other.reflect_mut()) { + (bevy::reflect::ReflectMut::List(l), bevy::reflect::ReflectMut::List(r)) => { + + let excess_elems = max(l.len() as isize - r.len() as isize, 0) as usize; + let to_be_inserted_elems = max(r.len() as isize - l.len() as isize, 0) as usize; + let apply_range = 0..(r.len() - to_be_inserted_elems); + + // remove in reverse order + (r.len()..l.len()).rev().for_each(|i| { + l.remove(i); + }); + + // pop then insert in reverse order of popping (last elem -> first elem to insert) + let to_insert = (0..to_be_inserted_elems).rev().map(|_| { + r.pop().expect("invariant") + }).collect::>(); + + to_insert.into_iter().rev().for_each(|e| { + l.push(e); + }); + + // at this point l is at least as long as r + + // apply to existing elements in the list + for i in apply_range { + apply(l.get_mut(i).expect("invariant"), r.get(i).expect("invariant"))?; + }; + + + + // for right_elem in r.iter() { + // if let Some(left_elem) = l.get_mut(i) { + // apply(left_elem, right_elem)? + // } else { + // shorter = true; + // break; + // } + // i+=1; + // }; + + + + Ok(()) + } + _ => Err(ScriptError::new_reflection_error(format!( + "Could not set {} with {}. Both need to reflect as list types, but at least one does not.", + self.reflect_type_path(), + other.reflect_type_path() + ))), + } + } + + // fn set_as_list>>( + // &mut self, + // other: I, + // ) -> Result<(), ScriptError> { + // if let bevy::reflect::ReflectMut::List(list) = self.reflect_mut() { + // let mut left_index = 0; + // for i in other { + // if let Some(left_item) = list.get_mut(left_index) { + // left_item.apply + // } else { + // } + // left_index += 1; + // } + // Ok(()) + // } else { + // Err(ScriptError::new_runtime_error(format!( + // "Expected list-like type from crate core, but got {}", + // self.get_represented_type_info() + // .map(|ti| ti.type_path()) + // .unwrap_or_else(|| "dynamic type with no type information") + // ))) + // } + // } } + + + #[cfg(test)] mod test { use super::*; @@ -123,4 +259,89 @@ mod test { 42.as_option().unwrap_err().to_string() ); } + + #[test] + fn test_as_list() { + let list = vec![1, 2, 3]; + let list_ref: &dyn PartialReflect = &list; + let iter = list_ref + .as_list() + .unwrap() + .map(|r| *r.try_downcast_ref::().unwrap()) + .collect::>(); + assert_eq!(list, iter); + } + + #[test] + fn test_set_as_list_equal_length() { + let mut list = vec![1, 2, 3]; + let other = vec![4, 5, 6]; + let other_ref: Box = Box::new(other.clone()); + list + .set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); + assert_eq!(other, list); + } + + + #[test] + fn test_set_as_list_shortening() { + let mut list = vec![1, 2, 3]; + let other = vec![4, 5]; + let other_ref: Box = Box::new(other.clone()); + list + .set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); + assert_eq!(other, list); + } + + #[test] + fn test_set_as_list_lengthening() { + let mut list = vec![1, 2]; + let other = vec![4, 5, 6]; + let other_ref: Box = Box::new(other.clone()); + list + .set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); + assert_eq!(other, list); + } + + + #[test] + fn test_set_as_list_empty() { + let mut list = vec![1, 2]; + let other = Vec::::default(); + let other_ref: Box = Box::new(other.clone()); + list + .set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); + assert_eq!(other, list); + } + + + #[test] + fn test_set_as_list_targe_empty() { + let mut list = Vec::::default(); + let other = vec![1]; + let other_ref: Box = Box::new(other.clone()); + list + .set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); + assert_eq!(other, list); + } } diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index be2b581d5e..3b2e9b0d2f 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -40,7 +40,7 @@ path = "src/lib.rs" [dependencies] bevy = { workspace = true, default-features = false } -bevy_mod_scripting_core = { workspace = true } +bevy_mod_scripting_core = { workspace = true, features = ["mlua_impls"] } bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } tealr = { version = "0.9", features = [ "mlua_vendored", diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs index da545e2483..5e5b1d0cfb 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs @@ -76,7 +76,7 @@ impl TealData for LuaQueryBuilder { ); methods.add_function("iter", |l, this: LuaQueryBuilder| { - let world = l.get_world()?; + let world = l.get_world(); let mut result = world .query(this.0) .map_err(tealr::mlu::mlua::Error::external)?; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 52c3734a16..ea2fe5e40d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -9,16 +9,20 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - ReflectAllocator, ReflectReference, ReflectionPathElem, Unproxy, WorldCallbackAccess, + ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, Unproxy, + WorldCallbackAccess, }, error::ScriptError, }; use tealr::mlu::{ + generics::Q, mlua::{self, FromLua, IntoLua, Lua, MetaMethod, UserData, Value}, - TealData, + TealData, TypedFunction, }; -use crate::{impl_userdata_from_lua, ReflectLuaProxied, ReflectLuaValue}; +use crate::{ + impl_userdata_from_lua, impl_userdata_with_tealdata, ReflectLuaProxied, ReflectLuaValue, +}; use super::{ proxy::{LuaProxied, LuaValProxy}, @@ -38,8 +42,10 @@ impl AsRef for LuaReflectReference { impl LuaReflectReference { pub fn len(&self, lua: &Lua) -> Result, mlua::Error> { - let world = lua.get_world()?; - Ok(self.0.len(&world)) + let world = lua.get_world(); + self.0 + .len(&world) + .map_err(tealr::mlu::mlua::Error::external) } /// Queries the reflection system for a proxy registration for the underlying type. @@ -47,123 +53,100 @@ impl LuaReflectReference { /// If not found will use ::into_lua to convert to lua pub fn to_lua_proxy(self, lua: &Lua) -> Result, mlua::Error> { // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, - let world = lua.get_world()?; + let world = lua.get_world(); // TODO: i don't like the pingponging between errors here, need something more ergonomic - let result: Result = - world.with_resource(|world, type_registry: Mut| { - world.with_resource(|world, allocator: Mut| { - let type_registry = type_registry.read(); - - // first we need the type id of the pointed to object to figure out how to work with it - let type_id = - self.0 - .with_reflect(world, &type_registry, Some(&allocator), |r| { - r.get_represented_type_info().map(|t| t.type_id()) - }); - - // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever - // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. - struct Dummy; - let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); - - if let Some(type_data) = - type_registry.get_type_data::(type_id_or_dummy) - { - self.0 - .with_reflect(world, &type_registry, Some(&allocator), |r| { - Ok((type_data.into_value)(r, lua)?) - }) - } else if let Some(type_data) = - type_registry.get_type_data::(type_id_or_dummy) - { - Ok((type_data.into_proxy)(self.0.clone(), lua)?) - } else { - Ok(self.clone().into_lua(lua)?) - } - }) - }); - result.map_err(mlua::Error::external) + // first we need the type id of the pointed to object to figure out how to work with it + let type_id = self.0.with_reflect(&world, |r, _, _| { + r.get_represented_type_info().map(|t| t.type_id()) + })?; + + // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever + // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. + struct Dummy; + let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); + + if let Some(type_data) = world.with_resource::(|_, type_registry| { + type_registry + .read() + .get_type_data::(type_id_or_dummy) + .cloned() + }) { + self.0 + .with_reflect(&world, |r, _, _| (type_data.into_value)(r, lua))? + } else if let Some(type_data) = + world.with_resource::(|_, type_registry| { + type_registry + .read() + .get_type_data::(type_id_or_dummy) + .cloned() + }) + { + Ok((type_data.into_proxy)(self.0.clone(), lua)?) + } else { + Ok(self.clone().into_lua(lua)?) + } } pub fn set_with_lua_proxy(&self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { bevy::log::debug!("Setting lua reflect reference with value: {:?}", value); - let world = lua.get_world()?; - let result: Result<(), ScriptError> = - world.with_resource(|world, type_registry: Mut| { - world.with_resource(|world, allocator: Mut| { + let world = lua.get_world(); + let type_id = self.0.with_reflect(&world, |r, _, _| { + r.get_represented_type_info().map(|t| t.type_id()) + })?; + + // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever + // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. + struct Unknown; + let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); + + if let Some(type_data) = world.with_resource::(|_, type_registry| { + type_registry + .read() + .get_type_data::(type_id_or_dummy) + .cloned() + }) { + bevy::log::debug!("Setting value with ReflectLuaValue registration"); + let other = (type_data.from_value)(value, lua)?; + let o = self + .0 + .with_reflect_mut(&world, |r, _, _| r.try_apply(other.as_partial_reflect()))?; + } else if let Some(type_data) = + world.with_resource::(|_, type_registry| { + type_registry + .read() + .get_type_data::(type_id_or_dummy) + .cloned() + }) + { + bevy::log::debug!("Setting value with ReflectLuaProxied registration"); + let other = (type_data.from_proxy)(value, lua)?; + let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; + // now we can set it + self.0.with_reflect_mut(&world, |r, _, _| { + if let Some(set) = type_data.opt_set { + set(r, other) + } else { + r.try_apply(other.as_partial_reflect()) + .map_err(ScriptError::new_reflection_error)?; + Ok(()) + } + })??; + } else { + bevy::log::debug!("No registration found, throwing error"); + // we don't know how to assign the value + // prod to see if it's a common container (i.e. Option or Vec) + world.with_resource::(|_,type_registry| { let type_registry = type_registry.read(); - let type_id = - self.0 - .with_reflect(world, &type_registry, Some(&allocator), |r| { - r.get_represented_type_info().map(|t| t.type_id()) - }); - - // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever - // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. - struct Unknown; - let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); - bevy::log::debug!("Target type is {:?}", type_registry.get_type_info(type_id_or_dummy).map(|t| t.type_path())); - - if let Some(type_data) = - type_registry.get_type_data::(type_id_or_dummy) - { - bevy::log::debug!("Setting value with ReflectLuaValue registration"); - self.0 - .with_reflect_mut(world, &type_registry, Some(&allocator), |r| { - Ok((type_data.set_value)(r, value, lua)?) - }) - } else if let Some(type_data) = - type_registry.get_type_data::(type_id_or_dummy) - { - bevy::log::debug!("Setting value with ReflectLuaProxied registration"); - - let other = (type_data.from_proxy)(value, lua)?; - - // first we need to get a copy of the other value - let other = other - .with_reflect(world, &type_registry, Some(&allocator), |r| { - type_registry - .get_type_data::(type_id_or_dummy) - .and_then(|from_reflect_td| from_reflect_td.from_reflect(r)) - }) - .ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Failed to call ReflectFromReflect for type id: {:?}", - type_registry - .get_type_info(type_id_or_dummy) - .map(|t| t.type_path()) - )) - })?; - - // now we can set it - self.0 - .with_reflect_mut(world, &type_registry, Some(&allocator), |r| { - r.try_apply(other.as_partial_reflect()).map_err(|e| { - ScriptError::new_runtime_error(format!( - "Invalid assignment `{:?}` = `{:?}`. {e}.", - self.0.print_with_type_registry(&type_registry), - e, - )) - }) - })?; - Ok(()) - } else { - bevy::log::debug!("No registration found, throwing error"); - // we don't know how to assign the value - // prod to see if it's a common container (i.e. Option or Vec) - - Err(ScriptError::new_runtime_error(format!( - "Invalid assignment `{:?}` = `{:?}`. The underlying type does: `{}` not support assignment.", - self.0.print_with_type_registry(&type_registry), - value, - type_registry.get_type_info(type_id_or_dummy).map(|t| t.type_path()).unwrap_or_else(|| "Unknown") - ))) - } - }) - }); - - result.map_err(mlua::Error::external) + Err(ScriptError::new_runtime_error(format!( + "Invalid assignment `{:?}` = `{:?}`. The underlying type does: `{}` not support assignment.", + self.0.print_with_type_registry(&type_registry), + value, + type_registry.get_type_info(type_id_or_dummy).map(|t| t.type_path()).unwrap_or_else(|| "Unknown") + ))) + })?; + }; + Ok(()) } /// Adjusts all the numeric accesses in the path from 1-indexed to 0-indexed @@ -210,7 +193,6 @@ impl LuaReflectReference { } } } - impl_userdata_from_lua!(LuaReflectReference); impl LuaProxied for ReflectReference { @@ -229,26 +211,47 @@ impl From for LuaReflectReference { } } +#[derive(Debug, Clone, tealr::mlu::UserData, tealr::ToTypename)] +pub struct LuaReflectRefIter(pub ReflectRefIter); +impl_userdata_from_lua!(LuaReflectRefIter); + +impl TealData for LuaReflectRefIter { + fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(_methods: &mut T) {} + + fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} +} + impl TealData for LuaReflectReference { fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(m: &mut T) { m.add_meta_function( MetaMethod::Index, |l, (mut self_, key): (LuaReflectReference, Value)| { + bevy::log::debug!( + "ReflectReference::Index with key: {:?} and value: {:?}", + key, + self_ + ); // catchall, parse the path let mut elem = Self::parse_value_index(key)?; Self::to_host_index(&mut elem); self_.0.index_path(elem); + bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); self_.to_lua_proxy(l) }, ); m.add_meta_function( MetaMethod::NewIndex, |l, (mut self_, key, value): (LuaReflectReference, Value, Value)| { + bevy::log::debug!( + "ReflectReference::NewIndex with key: {:?} and value: {:?}", + key, + value + ); + let mut elem = Self::parse_value_index(key)?; - bevy::log::debug!("New index with parsed path: {:?}", elem); Self::to_host_index(&mut elem); self_.0.index_path(elem); - bevy::log::debug!("New reflect reference after: {:?}", self_.0); + bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); self_.set_with_lua_proxy(l, value) }, ); @@ -257,8 +260,46 @@ impl TealData for LuaReflectReference { self_.len(l) }); + #[cfg(any( + feature = "lua54", + feature = "lua53", + feature = "lua52", + feature = "luajit52", + ))] + m.add_meta_function(MetaMethod::Pairs, |l, s: LuaReflectReference| { + bevy::log::debug!("ReflectReference::Pairs with value: {:?}", s); + let mut iterator_base = s.0.into_iter_infinite(); + let iterator = TypedFunction::from_rust_mut( + move |l, ()| { + let (next_ref, idx) = iterator_base.next_ref(); + bevy::log::debug!("iteration: {:?}", idx); + let next = LuaReflectReference(next_ref).to_lua_proxy(l); + let next = match next { + Ok(n) => Some(n), + Err(e) => { + bevy::log::debug!("Error in iteration: {:?}", e); + None + } + }; + bevy::log::debug!("next: {:?}", next); + // TODO: we should differentiate between no more values and an actual error + match (next, idx) { + (None, bevy_mod_scripting_core::bindings::IterationKey::Index(_)) => { + Ok((Value::Nil, Value::Nil)) + } + (Some(n), bevy_mod_scripting_core::bindings::IterationKey::Index(i)) => { + Ok((Value::Integer((i + 1) as i64), n)) + } + } + }, + l, + )?; + + Ok((iterator, Value::Nil, Value::Nil)) + }); + m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { - let world = lua.get_world()?; + let world = lua.get_world(); Ok(self_.0.print_with_world(&world)) }); } @@ -327,7 +368,7 @@ mod test { let reflect_ref = LuaReflectReference(ReflectReference::new_allocated(val, &mut allocator)); world.insert_resource(allocator); - WorldCallbackAccess::with_callback_access(&mut world, |access| { + WorldCallbackAccess::with_callback_access(world, |access| { let globals = lua.globals(); globals.set("test", reflect_ref.clone()).unwrap(); globals.set("world", LuaWorld(access.clone())).unwrap(); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 4c954d86f9..b817776c3f 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -397,7 +397,7 @@ impl TealData for LuaWorld { }, ); - methods.add_method("exit", |_, this, ()| { + methods.add_method("exit", |lua, this, ()| { // TODO: somehow end control flow on lua side let world = this.0.read().ok_or_else(|| { mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) @@ -424,11 +424,12 @@ impl From<&LuaWorld> for WorldCallbackAccess { } pub trait GetWorld { - fn get_world(&self) -> Result>, mlua::Error>; + fn get_world(&self) -> Arc>; + fn try_get_world(&self) -> Result>, mlua::Error>; } impl GetWorld for mlua::Lua { - fn get_world(&self) -> Result>, mlua::Error> { + fn try_get_world(&self) -> Result>, mlua::Error> { self.globals() .get::<_, LuaValProxy>("world")? .unproxy() @@ -439,4 +440,9 @@ impl GetWorld for mlua::Lua { }) .map_err(mlua::Error::external) } + + fn get_world(&self) -> Arc> { + self.try_get_world() + .expect("global 'world' did not exist or was invalid. Cannot retrieve world") + } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index c163b6027b..bbe60977e8 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -68,7 +68,7 @@ impl Plugin for LuaScriptingPlugin { self.scripting_plugin.build(app); register_lua_values(app); app.add_context_pre_handling_initializer::<()>(|script_id, entity, context: &mut Lua| { - let world = context.get_world().unwrap(); + let world = context.get_world(); let lua_entity = world.with_resource::(|_, mut allocator| { let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); ::Proxy::from(reflect_reference) diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index 3c478cc5b4..d046750c51 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -1,5 +1,6 @@ use std::{ - any::TypeId, + any::{Any, TypeId}, + clone, collections::{HashMap, HashSet}, sync::Arc, }; @@ -10,8 +11,8 @@ use bevy::{ prelude::{AppTypeRegistry, Mut}, reflect::{ impl_reflect, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, FromType, - GetTypeRegistration, ParsedPath, PartialReflect, Reflect, ReflectFromReflect, - ReflectPathError, TypePath, TypeRegistration, + GetTypeRegistration, List, ParsedPath, PartialReflect, Reflect, ReflectFromReflect, + ReflectMut, ReflectPathError, TypeInfo, TypePath, TypeRegistration, }, }; use bevy_mod_scripting_core::{ @@ -19,15 +20,16 @@ use bevy_mod_scripting_core::{ error::ScriptError, reflection_extensions::PartialReflectExt, }; -use tealr::mlu::mlua::{FromLua, IntoLua, Lua, Value}; +use tealr::mlu::mlua::{FromLua, IntoLua, Lua, Table, Value}; -use crate::bindings::{proxy::LuaProxied, world::GetWorld}; +use crate::bindings::{proxy::LuaProxied, reference::LuaReflectReference, world::GetWorld}; /// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented in lua via proxies which store /// a reference to the actual value. /// This is used for types which are represented in lua with pass by reference semantics #[derive(Clone)] pub struct ReflectLuaProxied { + // TODO: should these be script errors? pub into_proxy: Arc< dyn for<'l> Fn(ReflectReference, &'l Lua) -> Result, tealr::mlu::mlua::Error> + Send @@ -40,34 +42,38 @@ pub struct ReflectLuaProxied { + Sync + 'static, >, + /// Optional override for setting behavior, should be respected by all handling types for unproxying to work recurively. + /// Normally used when [`PartialReflect::apply`] does not do the right thing. + pub opt_set: Option< + Arc< + dyn for<'l> Fn( + &mut dyn PartialReflect, + Box, + ) -> Result<(), ScriptError> + + Send + + Sync + + 'static, + >, + >, } impl ReflectLuaProxied { /// Generates a type data which can be used on [`Option`] types which are represented in lua with pass by reference semantics - fn new_for_option( - inner_lua_proxied_data: &ReflectLuaProxied, - option_from_reflect: &ReflectFromReflect, - ) -> Self { + fn new_for_option(inner_lua_proxied_data: &ReflectLuaProxied, container_type_info: &'static TypeInfo) -> Self { let ref_into_option = |mut r: ReflectReference| { r.index_path(ParsedPath::parse_static("0").expect("Invalid reflection path")); r }; let into_proxy_clone = inner_lua_proxied_data.into_proxy.clone(); let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); - let option_from_reflect = option_from_reflect.clone(); + // let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); Self { into_proxy: Arc::new(move |reflect_ref, l| { // read the value and check if it is None, if so return nil // otherwise use the inner type's into_proxy - let world = l.get_world()?; - let is_some = world - .with_allocator_and_type_registry(|_, type_registry, allocator| { - let type_registry = type_registry.read(); - reflect_ref.with_reflect(&world, &type_registry, Some(&allocator), |s| { - s.as_option().map(|r| r.is_some()) - }) - }) - .map_err(tealr::mlu::mlua::Error::external)?; + let world = l.get_world(); + let is_some = reflect_ref + .with_reflect(&world, |s, _, _| s.as_option().map(|r| r.is_some()))??; if is_some { (into_proxy_clone)(ref_into_option(reflect_ref), l) @@ -77,33 +83,169 @@ impl ReflectLuaProxied { }), from_proxy: Arc::new(move |v, l| { if v.is_nil() { + bevy::log::debug!("Option from proxy: Nil"); // we need to allocate a new reflect reference since we don't have one existing - let dynamic_value = DynamicEnum::new("None", DynamicVariant::Unit); - - let world = l.get_world()?; + let mut dynamic_value = DynamicEnum::new("None", DynamicVariant::Unit); + dynamic_value.set_represented_type(Some(container_type_info)); + let world = l.get_world(); let reflect_ref = - world.with_resource(|w, mut allocator: Mut| { - let value = option_from_reflect - .from_reflect(&dynamic_value) - .ok_or_else(|| { - tealr::mlu::mlua::Error::external( - ScriptError::new_reflection_error(""), - ) - })? - .into_partial_reflect(); - Ok::<_, tealr::mlu::mlua::Error>(ReflectReference::new_allocated_boxed( - value, + world.with_resource(|_, mut allocator: Mut| { + Ok::<_, tealr::mlu::mlua::Error>(ReflectReference::new_allocated( + dynamic_value, &mut allocator, )) })?; Ok(reflect_ref) } else { + bevy::log::debug!("Option from proxy: {:?}", v); let mut inner_ref = (from_proxy_clone)(v, l)?; inner_ref.reflect_path.pop(); Ok(inner_ref) } }), + opt_set: None, + } + } + + fn dynamic_list_from_value<'lua>( + v: Table<'lua>, + lua: &'lua Lua, + from_proxy: &Arc< + dyn for<'l> Fn( + Value<'l>, + &'l Lua, + ) + -> Result, tealr::mlu::mlua::Error> + + Send + + Sync + + 'static, + >, + container_type_info: &'static TypeInfo + ) -> Result { + let lua_values = v.sequence_values().collect::, _>>()?; + + let converted_values = lua_values + .into_iter() + .map(|v| (from_proxy)(v, lua)) + .collect::, _>>()?; + + let mut dynamic_type = DynamicList::from_iter(converted_values); + dynamic_type.set_represented_type(Some(container_type_info)); + Ok(dynamic_type) + } + + fn dynamic_list_from_proxy<'lua>( + v: Table<'lua>, + lua: &'lua Lua, + from_proxy: &Arc< + dyn for<'l> Fn(Value<'l>, &'l Lua) -> Result + + Send + + Sync + + 'static, + >, + container_type_info: &'static TypeInfo, + ) -> Result { + let lua_values = v.sequence_values().collect::, _>>()?; + + // TODO: less allocations plz, i can't be bothered to do this right now + let converted_values = lua_values + .into_iter() + .map(|v| (from_proxy)(v, lua)) + .collect::, _>>()?; + let world = lua.get_world(); + + let boxed_values = converted_values + .into_iter() + .map(|v| v.with_reflect(&world, |r, _, _| r.clone_value())) + .collect::, _>>()?; + + let mut dynamic_type = DynamicList::from_iter(boxed_values); + // TODO: what to do with this memory, I think it's fine to leave hanging till exit + dynamic_type.set_represented_type(Some(container_type_info)); + Ok(dynamic_type) + } + + fn new_for_listlike_value( + inner_lua_value_data: &ReflectLuaValue, + container_type_info: &'static TypeInfo, + ) -> Self { + let from_value_clone = inner_lua_value_data.from_value.clone(); + Self { + into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), + from_proxy: Arc::new(move |v, l| { + if let Value::Table(t) = v { + let dynamic_table = Self::dynamic_list_from_value(t, l, &from_value_clone, container_type_info)?; + let world = l.get_world(); + let allocated = + world.with_resource(|_, mut allocator: Mut| { + ReflectReference::new_allocated(dynamic_table, &mut allocator) + }); + Ok(allocated) + } else { + LuaReflectReference::from_lua(v, l).map(|v| v.0) + } + }), + opt_set: Some(Arc::new(|r, other| { + r.set_as_list(other, |a, b| { + Ok(a.try_apply(b)?) + }) + })), + } + } + + fn new_for_listlike_proxy(inner_lua_proxied_data: &ReflectLuaProxied) -> Self { + // let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); + Self { + into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), + // from_proxy: Arc::new(|v, l| { + // // if it's a table, set existing elements using underlying from proxy + // // if it's a ref, return the ref + + // if let Value::Table(t) = v { + // let ts = t.sequence_values::(); + // for e in ts { + // let v = e?; + // let elem_ref = (from_proxy_clone)(v, l)?; + // } + // } else { + // LuaReflectReference::from_lua(v, l) + // } + // }), + from_proxy: Arc::new(|v, l| { + // can either be a table or a direct ref + // construct dynamic vec either way + // if let Value::Table(t) = v { + // for v in t.sequence_values::() { + // let lua_elem = v?; + // } + // } else { + // todo!() + // } + todo!() + }), + opt_set: todo!(), // set_from_proxy: todo!(), // set_from_proxy: Arc::new(|r, v, l| { + // // let table = if let Value::Table(t) = v { + // // t + // // } else { + // // return Err(tealr::mlu::mlua::Error::external( + // // ScriptError::new_runtime_error(format!( + // // "Cannot set value of type `{}` via type: `{}`. Expected table", + // // v.type_name(), + // // "List", + // // )), + // // )); + // // }; + + // // let lua_values = table.sequence_values().collect::, _>>()?; + + // // let converted_values = lua_values + // // .into_iter() + // // .map(|v| (from_proxy)(v, lua)) + // // .collect::, _>>()?; + + // // let target_list = r.as_list().map_err(tealr::mlu::mlua::Error::external)?; + // // }), } } } @@ -117,6 +259,16 @@ where Self { into_proxy: Arc::new(|p, l| T::Proxy::from(p).into_lua(l)), from_proxy: Arc::new(|v, l| T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone())), + opt_set: None, + // set_from_proxy: Arc::new(|r, v, l| { + // let proxy = T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone())?; + // let world = l.get_world(); + // proxy.with_reflect(&world, |other, _, _| { + // r.apply(other); + // Ok::<_, tealr::mlu::mlua::Error>(()) + // })?; + // Ok(()) + // }), } } } @@ -131,16 +283,16 @@ pub struct ReflectLuaValue { + Sync + 'static, >, - pub set_value: Arc< - dyn for<'l> Fn( - &mut dyn PartialReflect, - Value<'l>, - &'l Lua, - ) -> Result<(), tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, + // pub set_value: Arc< + // dyn for<'l> Fn( + // &mut dyn PartialReflect, + // Value<'l>, + // &'l Lua, + // ) -> Result<(), tealr::mlu::mlua::Error> + // + Send + // + Sync + // + 'static, + // >, pub from_value: Arc< dyn for<'l> Fn( Value<'l>, @@ -166,16 +318,18 @@ impl ReflectLuaValue { + Sync + 'static, >, + container_type_info: &'static TypeInfo, ) -> Result { - if v.is_nil() { - Ok(DynamicEnum::new("None", DynamicVariant::Unit)) + let mut dynamic_enum = if v.is_nil() { + DynamicEnum::new("None", DynamicVariant::Unit) } else { let inner = (from_value)(v, lua)?; - Ok(DynamicEnum::new( - "Some", - DynamicVariant::Tuple([inner].into_iter().collect()), - )) - } + DynamicEnum::new("Some", DynamicVariant::Tuple([inner].into_iter().collect())) + }; + + dynamic_enum.set_represented_type(Some(container_type_info)); + + Ok(dynamic_enum) } /// generates implementation for an inner type wrapped by an option @@ -184,15 +338,10 @@ impl ReflectLuaValue { /// if the value is some use ReflectLuaValue implementation of the inner type. /// /// If there is a type mismatch at any point will return an error - pub fn new_for_option( - inner_reflect_lua_value: &ReflectLuaValue, - option_from_reflect: &ReflectFromReflect, - ) -> Self { + pub fn new_for_option(inner_reflect_lua_value: &ReflectLuaValue, container_type_info: &'static TypeInfo) -> Self { let into_value_clone = inner_reflect_lua_value.into_value.clone(); // we have to do this so the closures can be moved into the arc - let from_value_clone = inner_reflect_lua_value.from_value.clone(); let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); - let from_reflect_clone = option_from_reflect.clone(); Self { into_value: Arc::new(move |r, lua| { r.as_option() @@ -200,106 +349,100 @@ impl ReflectLuaValue { .map(|inner| (into_value_clone)(inner, lua)) .unwrap_or_else(|| Ok(Value::Nil)) }), - set_value: Arc::new(move |r, v, l| { - let dynamic = Self::dynamic_option_from_value(v, l, &from_value_clone)?; - r.apply(&dynamic); - - Ok(()) - }), from_value: Arc::new(move |v, l| { - let dynamic_option = Self::dynamic_option_from_value(v, l, &from_value_clone2)?; - - from_reflect_clone - .from_reflect(&dynamic_option) - .ok_or_else(|| { - tealr::mlu::mlua::Error::external(ScriptError::new_runtime_error( - "Failed to convert to option", - )) - }) - .map(::into_partial_reflect) - }), - } - } + let dynamic_option = Self::dynamic_option_from_value(v, l, &from_value_clone2, container_type_info)?; - fn dynamic_list_from_value<'lua>( - v: Value<'lua>, - lua: &'lua Lua, - from_value: &Arc< - dyn for<'l> Fn( - Value<'l>, - &'l Lua, - ) - -> Result, tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, - ) -> Result { - let table = if let Value::Table(t) = v { - t - } else { - return Err(tealr::mlu::mlua::Error::external( - ScriptError::new_runtime_error(format!( - "Cannot set value of type `{}` via type: `{}`. Expected table", - v.type_name(), - "List", - )), - )); - }; - - let lua_values = table.sequence_values().collect::, _>>()?; - - let converted_values = lua_values - .into_iter() - .map(|v| (from_value)(v, lua)) - .collect::, _>>()?; - - Ok(DynamicList::from_iter(converted_values)) - } - - pub fn new_for_list(inner_reflect_lua_value: &ReflectLuaValue) -> Self { - let into_value_clone = inner_reflect_lua_value.into_value.clone(); - let from_value_clone = inner_reflect_lua_value.from_value.clone(); - let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); - // let vec_from_reflect = vec_from_reflect.clone(); - Self { - into_value: Arc::new(move |r, l| { - let inner = r.as_list().map_err(tealr::mlu::mlua::Error::external)?; - let inner = inner - .map(|i| (into_value_clone)(i, l)) - .collect::, _>>()?; - - l.create_table_from( - inner - .into_iter() - .enumerate() - .map(|(i, v)| (Value::Integer(i as i64 + 1), v)), - ) - .map(Value::Table) - }), - set_value: Arc::new(move |r, v, l| { - let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone)?; - r.apply(&dynamic); - Ok(()) - }), - from_value: Arc::new(move |v, l| { - let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone2)?; - - // vec_from_reflect - // .from_reflect(&dynamic) - // .ok_or_else(|| { - // tealr::mlu::mlua::Error::external(ScriptError::new_runtime_error( - // "Failed to convert to option", - // )) - // }) - // .map(::into_partial_reflect) - // TODO: testing this out, not returning a concrete type could be weird - // would anything but this impl care about this? - // Ok(Box::new(dynamic)) - Ok(Box::new(dynamic)) + Ok(Box::new(dynamic_option)) }), + // set_value: Arc::new(move |r, v, l| { + // let dynamic = Self::dynamic_option_from_value(v, l, &from_value_clone)?; + // r.apply(&dynamic); + // Ok(()) + // }), } } + + // fn dynamic_list_from_value<'lua>( + // v: Value<'lua>, + // lua: &'lua Lua, + // from_value: &Arc< + // dyn for<'l> Fn( + // Value<'l>, + // &'l Lua, + // ) + // -> Result, tealr::mlu::mlua::Error> + // + Send + // + Sync + // + 'static, + // >, + // ) -> Result { + // let table = if let Value::Table(t) = v { + // t + // } else { + // return Err(tealr::mlu::mlua::Error::external( + // ScriptError::new_runtime_error(format!( + // "Cannot set value of type `{}` via type: `{}`. Expected table", + // v.type_name(), + // "List", + // )), + // )); + // }; + + // let lua_values = table.sequence_values().collect::, _>>()?; + + // let converted_values = lua_values + // .into_iter() + // .map(|v| (from_value)(v, lua)) + // .collect::, _>>()?; + // let dynamic_type = DynamicList::from_iter(converted_values); + // // TODO: set the represented type, need to pass type info + // // dynamic_type.set_represented_type(represented_type); + // Ok(dynamic_type) + // } + + // pub fn new_for_list(inner_reflect_lua_value: &ReflectLuaValue) -> Self { + // let into_value_clone = inner_reflect_lua_value.into_value.clone(); + // let from_value_clone = inner_reflect_lua_value.from_value.clone(); + // let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); + // Self { + // into_value: Arc::new(move |r, l| { + // let inner = r.as_list().map_err(tealr::mlu::mlua::Error::external)?; + // let inner = inner + // .map(|i| (into_value_clone)(i, l)) + // .collect::, _>>()?; + + // let t = l.create_table_from( + // inner + // .into_iter() + // .enumerate() + // .map(|(i, v)| (Value::Integer(i as i64 + 1), v)), + // )?; + + // Ok(Value::Table(t)) + // }), + // set_value: Arc::new(move |r, v, l| { + // let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone)?; + + // // apply will not remove excess elements + // if let ReflectMut::List(list) = r.reflect_mut() { + // if dynamic.len() < list.len() { + // (dynamic.len()..list.len()).rev().for_each(|i| { + // list.remove(i); + // }); + // } + // } + // println!("reflect: {:?}", r); + // println!("dynamic: {:?}", dynamic); + + // r.apply(&dynamic); + // Ok(()) + // }), + // from_value: Arc::new(move |v, l| { + // let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone2)?; + // Ok(Box::new(dynamic)) + // }), + // } + // } } impl IntoLua<'l> + for<'l> FromLua<'l>> FromType @@ -307,13 +450,27 @@ impl IntoLua<'l> + for<'l> FromLua<'l>> FromType { fn from_type() -> Self { Self { - into_value: Arc::new(|v, l| v.try_downcast_ref::().unwrap().clone().into_lua(l)), - set_value: Arc::new(|t, v, l| { - let t = t.try_downcast_mut::().unwrap(); - *t = T::from_lua(v, l)?; - Ok(()) + into_value: Arc::new(|v, l| { + bevy::log::debug!("Converting lua value to lua: {:?}", v); + v.try_downcast_ref::() + .unwrap_or_else(|| { + panic!( + "Expected type: {}, got: {}", + std::any::type_name::(), + v.reflect_type_path() + ) + }) + .clone() + .into_lua(l) }), + // set_value: Arc::new(|t, v, l| { + // bevy::log::debug!("Setting lua value: {:?}, with {:?}", t, v); + // let t = t.try_downcast_mut::().unwrap(); + // *t = T::from_lua(v, l)?; + // Ok(()) + // }), from_value: Arc::new(|v, l| { + bevy::log::debug!("Building concrete type from lua value: {:?}", v); T::from_lua(v, l).map(|v| Box::new(v) as Box) }), } @@ -373,19 +530,11 @@ fn destructure_option_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { } } -fn destructure_vec_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { - let type_path_table = reg.type_info().type_path_table(); - let is_core = type_path_table.crate_name().is_some_and(|s| s == "alloc"); - let is_vec = type_path_table.ident().is_some_and(|s| s == "Vec"); +fn destructure_list_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { + let type_path_table = reg.type_info().as_list().ok()?; - if is_core && is_vec { - reg.type_info() - .generics() - .get_named("T") - .map(|t| (reg.type_id(), t.type_id())) - } else { - None - } + let inner_type_id = type_path_table.item_ty().id(); + Some((reg.type_id(), inner_type_id)) } /// iterates over type data for all types which have registered [`ReflectLuaProxied`] and [`ReflectLuaValue`] implementations, @@ -397,44 +546,32 @@ pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { let mut lua_proxied_insertions: HashMap = Default::default(); for (option_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_option_type) { + let container_type_info = type_registry.get(option_type_id).expect("invariant").type_info(); + // TODO: reuse the leaked box in both branches when either is true if let Some(inner_lua_value_data) = type_registry.get_type_data::(inner_type_id) { - if let Some(option_from_reflect) = - type_registry.get_type_data::(option_type_id) - { - let option_lua_proxied_data = - ReflectLuaValue::new_for_option(inner_lua_value_data, option_from_reflect); - - lua_value_insertions.insert(option_type_id, option_lua_proxied_data); - } + let option_lua_proxied_data = ReflectLuaValue::new_for_option(inner_lua_value_data, Box::leak(Box::new(container_type_info.clone()))); + lua_value_insertions.insert(option_type_id, option_lua_proxied_data); } if let Some(inner_lua_proxied_data) = type_registry.get_type_data::(inner_type_id) { - if let Some(option_from_reflect) = - type_registry.get_type_data::(option_type_id) - { - let option_lua_proxied_data = - ReflectLuaProxied::new_for_option(inner_lua_proxied_data, option_from_reflect); + let option_lua_proxied_data = ReflectLuaProxied::new_for_option(inner_lua_proxied_data, Box::leak(Box::new(container_type_info.clone()))); - lua_proxied_insertions.insert(option_type_id, option_lua_proxied_data); - } + lua_proxied_insertions.insert(option_type_id, option_lua_proxied_data); } } - for (vec_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_vec_type) { + for (vec_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_list_type) { + let container_type_info = type_registry.get(vec_type_id).expect("invariant").type_info(); if let Some(inner_lua_value_data) = type_registry.get_type_data::(inner_type_id) { - // if let Some(vec_from_reflect) = - // type_registry.get_type_data::(vec_type_id) - // { - let vec_lua_value_data = ReflectLuaValue::new_for_list(inner_lua_value_data); - - lua_value_insertions.insert(vec_type_id, vec_lua_value_data); - // } + let vec_lua_proxied_data = + ReflectLuaProxied::new_for_listlike_value(inner_lua_value_data, Box::leak(Box::new(container_type_info.clone()))); + lua_proxied_insertions.insert(vec_type_id, vec_lua_proxied_data); } } @@ -483,7 +620,7 @@ mod tests { use bevy_mod_scripting_core::bindings::WorldCallbackAccess; use std::sync::Arc; - #[derive(Reflect)] + #[derive(Reflect, Debug, PartialEq)] struct Proxied(usize); impl LuaProxied for Proxied { @@ -505,16 +642,29 @@ mod tests { AppTypeRegistry(type_registry_arc) } - macro_rules! assert_transitively_registers { + macro_rules! prepare_type_registry_with_common_containers { ($target_type:ty, $container_type:ty, $type_data:ty) => {{ - let mut app_type_registry = setup_type_registry::<$target_type, $container_type>(); - app_type_registry - .write() - .register_type_data::<$target_type, $type_data>(); + { + let mut type_registry = setup_type_registry::<$target_type, $container_type>(); + type_registry + .write() + .register_type_data::<$target_type, $type_data>(); - pre_register_common_containers(&mut app_type_registry); + pre_register_common_containers(&mut type_registry); + type_registry + } + }}; + } - let type_registry = app_type_registry.read(); + macro_rules! assert_transitively_registers { + ($target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty) => {{ + let type_registry = prepare_type_registry_with_common_containers!( + $target_type, + $container_type, + $inner_type_data + ); + + let type_registry = type_registry.read(); let container_type_id = std::any::TypeId::of::<$container_type>(); let container_type_registration = type_registry.get(container_type_id).unwrap(); @@ -528,358 +678,302 @@ mod tests { }}; } - #[test] - fn test_pre_register_common_containers_lua_value() { - assert_transitively_registers!(usize, Option, ReflectLuaValue); - assert_transitively_registers!(usize, Vec, ReflectLuaValue); - } + macro_rules! assert_lua_value_into_equals { + ($target_type:ty, $container_type:ty, $type_data:ty, $val:expr => $exp:expr) => {{ + let type_registry = prepare_type_registry_with_common_containers!( + $target_type, + $container_type, + $type_data + ); - #[test] - fn test_pre_register_common_containers_lua_proxy() { - assert_transitively_registers!(Proxied, Option, ReflectLuaProxied); + let type_registry = type_registry.read(); + let container_type_id = std::any::TypeId::of::<$container_type>(); + let container_type_data = type_registry + .get_type_data::<$type_data>(container_type_id) + .unwrap(); + let l = Lua::new(); + let out = (container_type_data.into_value)(&$val, &l).unwrap(); + assert_eq!(out, $exp); + }}; } - #[test] - fn test_option_lua_proxy_impl_into_proxy() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - let mut world = World::default(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap() - .clone(); - let inner_type_data = type_registry - .get_type_data::(std::any::TypeId::of::()) - .unwrap() - .clone(); - - let mut allocator = ReflectAllocator::default(); - let inner_value = ReflectReference::new_allocated(Proxied(4), &mut allocator); - let some_value = ReflectReference::new_allocated(Some(Proxied(4)), &mut allocator); - let none_value = ReflectReference::new_allocated(None::, &mut allocator); - world.insert_resource(allocator); - drop(type_registry); - world.insert_resource(app_type_registry); - - let lua = Lua::new(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - lua.globals().set("world", LuaWorld(world.clone())).unwrap(); - - // option::some into_proxy should be equivalent result to inner_type into_proxy apart from the reflect path - let expected_into_value = (inner_type_data.into_proxy)(inner_value, &lua).unwrap(); - let gotten_into_value = (option_type_data.into_proxy)(some_value, &lua).unwrap(); - - let converted_into_value = LuaReflectReference::from_lua(expected_into_value, &lua) - .unwrap() - .0 - .reflect_path; - - let mut converted_gotten_into_value = - LuaReflectReference::from_lua(gotten_into_value, &lua) - .unwrap() - .0 - .reflect_path; - converted_gotten_into_value.pop(); - - assert_eq!( - converted_into_value, converted_gotten_into_value, - "Option into_proxy should be equivalent to Proxied into_proxy for Some variant apart from the last element in the path" + macro_rules! assert_lua_container_value_from_equals { + ($target_type:ty, $container_type:ty, $type_data:ty, $val:expr => $exp:expr) => {{ + let type_registry = prepare_type_registry_with_common_containers!( + $target_type, + $container_type, + $type_data ); - // the none variant should be equivalent to Value::Nil - let expected_into_value = Value::Nil; - let gotten_into_value = (option_type_data.into_proxy)(none_value, &lua).unwrap(); + let type_registry = type_registry.read(); + let container_type_id = std::any::TypeId::of::<$container_type>(); + let container_type_data = type_registry + .get_type_data::<$type_data>(container_type_id) + .unwrap(); + let l = Lua::new(); + let out = (container_type_data.from_value)($val, &l).unwrap(); + assert!(out.reflect_partial_eq(&$exp).unwrap()); + }}; + } - assert_eq!( - expected_into_value, gotten_into_value, - "Option into_proxy should be equivalent to Value::Nil for None variant" + // macro_rules! assert_lua_container_value_after_set_equals { + // ($target_type:ty, $container_type:ty, $type_data:ty, $val:expr => $set:expr => $exp:expr) => {{ + // let type_registry = prepare_type_registry_with_common_containers!( + // $target_type, + // $container_type, + // $type_data + // ); + + // let type_registry = type_registry.read(); + // let container_type_id = std::any::TypeId::of::<$container_type>(); + // let container_type_data = type_registry + // .get_type_data::<$type_data>(container_type_id) + // .unwrap(); + // let l = Lua::new(); + // let mut target = $val; + // (container_type_data.set_value)(&mut target, $set, &l).unwrap(); + // assert!( + // target.reflect_partial_eq(&$exp).unwrap(), + // "Expected {:?} got: {:?}", + // $exp, + // target + // ); + // }}; + // } + + macro_rules! assert_lua_container_proxy_into_proxy { + (;WITH; $target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty ;FROM; $val:expr ;INTO; $exp:expr) => {{ + let app_type_registry = prepare_type_registry_with_common_containers!( + $target_type, + $container_type, + $inner_type_data ); - }) + let mut world = World::new(); + + let type_registry = app_type_registry.read(); + let container_type_id = std::any::TypeId::of::<$container_type>(); + let container_type_data = type_registry + .get_type_data::<$type_data>(container_type_id) + .unwrap() + .clone(); + + let mut allocator = ReflectAllocator::default(); + let allocated_value = ReflectReference::new_allocated($val, &mut allocator); + world.insert_resource(allocator); + drop(type_registry); + world.insert_resource(app_type_registry); + let lua = Lua::new(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + lua.globals().set("world", LuaWorld(world.clone())).unwrap(); + + let gotten_into_value = + (container_type_data.into_proxy)(allocated_value, &lua).unwrap(); + let converted_ref = LuaReflectReference::from_lua(gotten_into_value.clone(), &lua) + .expect(&format!( + "Could not convert to lua reflect reference got: {:?}", + gotten_into_value + )) + .0; + let world = world.read().unwrap(); + converted_ref.with_reflect(&world, |r, _, _| { + assert!( + r.reflect_partial_eq(&$exp).unwrap(), + "Expected {:?} got {:?}", + $exp, + r + ); + }); + }); + }}; } - #[test] - fn test_option_lua_proxy_impl_from_proxy() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - let mut world = World::default(); + macro_rules! assert_lua_container_proxy_opt_set { + ($allocator:ident, $lua:ident ;WITH; $target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty ;SET; $val:expr ;TO; $set:expr ;EXPECT; $exp:expr) => {{ + let app_type_registry = prepare_type_registry_with_common_containers!( + $target_type, + $container_type, + $inner_type_data + ); + let mut world = World::new(); - pre_register_common_containers(&mut app_type_registry); + let type_registry = app_type_registry.read(); + let container_type_id = std::any::TypeId::of::<$container_type>(); + let container_type_data = type_registry + .get_type_data::<$type_data>(container_type_id) + .unwrap() + .clone(); + + let mut $allocator = ReflectAllocator::default(); + drop(type_registry); + world.insert_resource(app_type_registry); + let $lua = Lua::new(); + let set_expr = Box::new($set); + world.insert_resource($allocator); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + $lua.globals() + .set("world", LuaWorld(world.clone())) + .unwrap(); + let mut target = $val; + (container_type_data.opt_set.unwrap())(&mut target, set_expr).unwrap(); + assert!(target.reflect_partial_eq(&$exp).unwrap()); + }); + }}; + } - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap() - .clone(); - - let mut allocator = ReflectAllocator::default(); - let some_value = ReflectReference::new_allocated(Some(Proxied(4)), &mut allocator); - let none_value = ReflectReference::new_allocated(None::, &mut allocator); - world.insert_resource(allocator); - drop(type_registry); - world.insert_resource(app_type_registry); - - let lua = Lua::new(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - lua.globals().set("world", LuaWorld(world.clone())).unwrap(); - - let some_lua_value = LuaReflectReference(some_value.clone()) - .into_lua(&lua) - .unwrap(); - let gotten_value = (option_type_data.from_proxy)(some_lua_value, &lua).unwrap(); - assert_eq!(gotten_value.reflect_path, some_value.reflect_path); + macro_rules! assert_lua_container_proxy_into_proxy_lua_only { + (;WITH; $target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty ;FROM; $val:expr ;INTO; $exp:expr) => {{ + let app_type_registry = prepare_type_registry_with_common_containers!( + $target_type, + $container_type, + $inner_type_data + ); + let mut world = World::new(); - let gotten_value = (option_type_data.from_proxy)(Value::Nil, &lua).unwrap(); - assert_eq!(gotten_value.reflect_path, none_value.reflect_path); - }) + let type_registry = app_type_registry.read(); + let container_type_id = std::any::TypeId::of::<$container_type>(); + let container_type_data = type_registry + .get_type_data::<$type_data>(container_type_id) + .unwrap() + .clone(); + + let mut allocator = ReflectAllocator::default(); + let allocated_value = ReflectReference::new_allocated($val, &mut allocator); + world.insert_resource(allocator); + drop(type_registry); + world.insert_resource(app_type_registry); + let lua = Lua::new(); + WorldCallbackAccess::with_callback_access(&mut world, |world| { + lua.globals().set("world", LuaWorld(world.clone())).unwrap(); + + let gotten_into_value = + (container_type_data.into_proxy)(allocated_value, &lua).unwrap(); + assert_eq!(gotten_into_value, $exp); + }); + }}; } #[test] - fn test_option_lua_value_impl_into_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap(); - let inner_type_data = type_registry - .get_type_data::(std::any::TypeId::of::()) - .unwrap(); - - // option::some into_value should be equivalent result to inner_type into_value - let lua = Lua::new(); - let value: usize = 5; - let option_value = Some(value); - let expected_into_value = (inner_type_data.into_value)(&value, &lua).unwrap(); - let gotten_into_value = (option_type_data.into_value)(&option_value, &lua).unwrap(); - - assert_eq!( - expected_into_value, gotten_into_value, - "Option into_value should be equivalent to usize into_value for Some variant" - ); - - // the none variant should be equivalent to Value::Nil - let option_value: Option = None; - let expected_into_value = Value::Nil; - let gotten_into_value = (option_type_data.into_value)(&option_value, &lua).unwrap(); - - assert_eq!( - expected_into_value, gotten_into_value, - "Option into_value should be equivalent to Value::Nil for None variant" - ); + fn test_pre_register_common_containers_lua_value() { + assert_transitively_registers!(usize = ReflectLuaValue, Option = ReflectLuaValue); + assert_transitively_registers!(usize = ReflectLuaValue, Vec = ReflectLuaProxied); } #[test] - fn test_vec_lua_value_impl_into_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap(); - let inner_type_data = type_registry - .get_type_data::(std::any::TypeId::of::()) - .unwrap(); - - // option::some into_value should be a table with the inner value converted to Lua - let lua = Lua::new(); - let value: usize = 5; - let option_value = vec![value]; - let expected_into_value = (inner_type_data.into_value)(&value, &lua).unwrap(); - let gotten_into_value = (option_type_data.into_value)(&option_value, &lua).unwrap(); - - assert_eq!( - expected_into_value, - gotten_into_value.as_table().unwrap().pop().unwrap(), - ); - - // an empty vec should be equivalent to an empty table - let vec_value: Vec = vec![]; - let gotten_into_value = (option_type_data.into_value)(&vec_value, &lua).unwrap(); - - assert!(gotten_into_value.as_table().unwrap().is_empty()); + fn test_pre_register_common_containers_lua_proxy() { + assert_transitively_registers!(Proxied = ReflectLuaProxied, Option = ReflectLuaProxied ); } #[test] - fn test_option_lua_value_set_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap(); - - // setting an existing Some variant works correctly - let lua = Lua::new(); - let mut target_option = Some(0usize); - (option_type_data.set_value)(&mut target_option, 5.into_lua(&lua).unwrap(), &lua).unwrap(); - assert_eq!( - target_option, - Some(5), - "Option set_value should set the value to Some(5)" + fn test_option_container_impls() { + // Inner Value + // into + assert_lua_value_into_equals!( + usize, + Option, + ReflectLuaValue, + Some(2usize) => Value::Integer(2) ); - - // setting an existing Some variant to nil should set the value to None - (option_type_data.set_value)(&mut target_option, Value::Nil, &lua).unwrap(); - assert_eq!( - target_option, None, - "Option set_value should set the value to None" + assert_lua_value_into_equals!( + usize, + Option, + ReflectLuaValue, + None:: => Value::Nil ); - // setting a none variant should set the Some variant correctly - let mut target_option: Option = None; - (option_type_data.set_value)(&mut target_option, 5usize.into_lua(&lua).unwrap(), &lua) - .unwrap(); - assert_eq!( - target_option, - Some(5), - "Option set_value should set the value to None" + // from + assert_lua_container_value_from_equals!( + usize, + Option, + ReflectLuaValue, + Value::Integer(2) => Some(2usize) ); - - // setting a none variant to nil should stay as None - (option_type_data.set_value)(&mut target_option, Value::Nil, &lua).unwrap(); - assert_eq!( - target_option, None, - "Option set_value should set the value to None" + assert_lua_container_value_from_equals!( + usize,Option, + ReflectLuaValue, + Value::Nil => None:: ); - } - - #[test] - fn test_vec_lua_value_set_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap(); - - // setting an existing vec - let lua = Lua::new(); - let new_vec = Value::Table( - lua.create_table_from(vec![(1, 5.into_lua(&lua).unwrap())]) - .unwrap(), + // set + // assert_lua_container_value_after_set_equals!( + // usize, Option, + // ReflectLuaValue, + // Some(2usize) => Value::Nil => None:: + // ); + // assert_lua_container_value_after_set_equals!( + // usize, Option, + // ReflectLuaValue, + // None:: => Value::Integer(2) => Some(2usize) + // ); + // assert_lua_container_value_after_set_equals!( + // usize, Option, + // ReflectLuaValue, + // None:: => Value::Nil => None:: + // ); + // assert_lua_container_value_after_set_equals!( + // usize, Option, + // ReflectLuaValue, + // Some(2usize) => Value::Integer(3) => Some(3usize) + // ); + + // Inner Proxy + // into + assert_lua_container_proxy_into_proxy!( + ;WITH; Proxied = ReflectLuaProxied, Option = ReflectLuaProxied + ;FROM; Some(Proxied(2)) + ;INTO; Proxied(2usize)); + assert_lua_container_proxy_into_proxy_lua_only!( + ;WITH; Proxied = ReflectLuaProxied, Option = ReflectLuaProxied + ;FROM; None:: + ;INTO; Value::Nil ); - let mut target_vec = vec![0usize]; - (option_type_data.set_value)(&mut target_vec, new_vec.clone(), &lua).unwrap(); - assert_eq!(target_vec, vec![5],); - - // setting an existing vec to an empty table should create a new empty vec - (option_type_data.set_value)( - &mut target_vec, - Value::Table( - lua.create_table_from(Vec::<(isize, usize)>::default()) - .unwrap(), - ), - &lua, - ) - .unwrap(); - assert_eq!(target_vec, Vec::::default(),); - - // setting an empty vec to a table with a value should set the vec to the value - (option_type_data.set_value)(&mut target_vec, new_vec, &lua).unwrap(); - assert_eq!(target_vec, vec![5],); + + // set from + // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, + // Some(Proxied(2)) + // => None:: + // => None::); + // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, + // None:: + // => Proxied(2)// LuaReflectReference(ReflectReference::new_allocated(Proxied(2), &mut alloc)) + // => Some(Proxied(2))); + // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, + // Some(Proxied(2)) + // => Proxied(3) // LuaReflectReference(ReflectReference::new_allocated(Proxied(3), &mut alloc)) + // => Some(Proxied(3))); + // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, + // None:: + // => None:: + // => None::); } #[test] - fn test_option_lua_value_from_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap(); - - // from_value should correctly work for concrete values - let lua = Lua::new(); - let value = 5usize; - let gotten_value = - (option_type_data.from_value)(value.into_lua(&lua).unwrap(), &lua).unwrap(); - - assert_eq!( - Some(value), - *gotten_value.try_downcast::>().unwrap(), - "Option from_value should correctly convert a value" + fn test_listlike_container_impls() { + // Inner Value + // into + assert_lua_container_proxy_into_proxy!( + ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied + ;FROM; vec![Proxied(2), Proxied(3)] + ;INTO; vec![Proxied(2), Proxied(3)] ); - - // from_value should correctly work for nil values - let nil_lua = Value::Nil; - let gotten_value = (option_type_data.from_value)(nil_lua, &lua).unwrap(); - assert_eq!( - None::, - *gotten_value.try_downcast::>().unwrap(), - "Option from_value should correctly convert a nil value" + assert_lua_container_proxy_into_proxy!( + ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied + ;FROM; Vec::::default() + ;INTO; Vec::::default() ); - } - - #[test] - fn test_vec_lua_value_from_value() { - let mut app_type_registry = setup_type_registry::>(); - app_type_registry - .write() - .register_type_data::(); - pre_register_common_containers(&mut app_type_registry); - - let type_registry = app_type_registry.read(); - let option_type_data = type_registry - .get_type_data::(std::any::TypeId::of::>()) - .unwrap(); - - // from_value should correctly work for concrete values - let lua = Lua::new(); - let value = vec![5usize]; - let gotten_value = - (option_type_data.from_value)(value.into_lua(&lua).unwrap(), &lua).unwrap(); - - assert_eq!( - gotten_value - .as_list() - .unwrap() - .map(|v| *v.try_downcast_ref::().unwrap()) - .collect::>() - .pop(), - Some(5usize) + assert_lua_container_proxy_opt_set!(alloc, lua + ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied + ;SET; Vec::::default() + ;TO; Vec::::default() + ;EXPECT; Vec::::default() ); - // from_value should correctly work for empty lists - let nil_lua = Value::Table( - lua.create_table_from(Vec::<(isize, usize)>::default()) - .unwrap(), + assert_lua_container_proxy_opt_set!(alloc, lua + ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied + ;SET; Vec::::default() + ;TO; vec![Proxied(2)] + ;EXPECT; vec![Proxied(2)] ); - let gotten_value = (option_type_data.from_value)(nil_lua, &lua).unwrap(); - assert!(gotten_value.as_list().unwrap().count() == 0); } #[test] diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 92f38d9b96..778bb8c3ef 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -73,7 +73,7 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul let _get_entity_with_test_component = lua .create_function(|l, s: String| { - let world = l.get_world().unwrap(); + let world = l.get_world(); let opt_entity = world.with_resource::(|_, mut allocator| { let a = World::enumerate_test_components() .iter() diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index 5e496fd8a2..51088c542b 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -15,6 +15,7 @@ pub struct MyComponent { f32: f32, mat3: Mat3, vec_of_usize: Vec, + vec_of_usize2: Vec, option_usize: Option, option_vec3: Option, vec_of_option_bools: Vec>, @@ -44,6 +45,7 @@ fn init_data(mut commands: Commands) { vec_of_option_bools: vec![Some(true), None, Some(false)], option_vec_of_bools: Some(vec![true, true, true]), vec_of_usize: vec![1, 2, 3], + vec_of_usize2: vec![4, 5, 6], option_usize: None, }, ScriptComponent::new(vec![SCRIPT_NAME.into()]), From 5f34f88aa7eb6f4da84beef3df00469df5cad4f1 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 2 Dec 2024 19:01:47 +0000 Subject: [PATCH 028/217] WIP --- .../src/bindings/reference.rs | 111 ++++++++++++------ .../src/reflection_extensions.rs | 97 +++++++++------ .../src/bindings/reference.rs | 25 ++-- .../bevy_mod_scripting_lua/src/lib.rs | 3 + .../bevy_mod_scripting_lua/src/type_data.rs | 34 ++++-- 5 files changed, 177 insertions(+), 93 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 6860faa3d9..13305542ae 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -28,15 +28,14 @@ use bevy::{ }, ptr::Ptr, reflect::{ - Access, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, - TypeInfo, TypeRegistry, + Access, DynamicEnum, DynamicTuple, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, TypeInfo, TypeRegistry }, }; use smallvec::SmallVec; use crate::{ bindings::{ReflectAllocation, ReflectAllocationId}, - prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::TypeIdExtensions, + prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, }; use super::{ @@ -64,6 +63,16 @@ impl ReflectReference { ReflectRefIter::new_indexed(self) } + /// Attempts to insert into the reflected value, if the underlying supports inserting at usize indices + pub fn insert_at(&mut self, world: &WorldAccessGuard, index: usize, elem: ReflectReference) -> ScriptResult<()> { + self.with_reflect_mut(world, |target, type_registry, allocator| { + elem.with_reflect_only(world, type_registry, allocator, |other,_,_| { + target.insert_at(index, other.clone_value()) + })? + })??; + Ok(()) + } + /// Prints the reference using the world to resolve type names. pub fn print_with_world(&self, world: &WorldAccessGuard) -> String { world.with_resource(|_, type_registry: Mut| { @@ -119,10 +128,23 @@ impl ReflectReference { /// A form of [`Self::reflect`] which does the access checks for you. #[track_caller] - pub fn with_reflect O>( + pub fn with_reflect O>( &self, world: &WorldAccessGuard, f: F, + ) -> ScriptResult { + world.with_allocator_and_type_registry(|world, type_registry, mut allocator| { + let type_registry = type_registry.write(); + self.with_reflect_only(world, &type_registry, &mut allocator, f) + }) + } + + pub fn with_reflect_only O>( + &self, + world: &WorldAccessGuard, + type_registry: &TypeRegistry, + allocator: &mut ReflectAllocator, + f: F, ) -> ScriptResult { let access = world .get_access_timeout( @@ -131,22 +153,16 @@ impl ReflectReference { DEFAULT_INTERVAL, ); - let out = world.with_allocator_and_type_registry(|_, type_registry, allocator| { - let type_registry = type_registry.read(); - let reflect = self - .reflect( - world.as_unsafe_world_cell(), - &access, - &type_registry, - Some(&allocator), - )?; - let o = f(reflect, &type_registry, &allocator); - - Ok(o) - }); + let reflect = self + .reflect( + world.as_unsafe_world_cell(), + &access, + type_registry, + Some(allocator), + ).map(|r| f(r, type_registry, allocator)); world.release_access(access); - out + reflect } #[track_caller] @@ -154,6 +170,19 @@ impl ReflectReference { &self, world: &WorldAccessGuard, f: F, + ) -> ScriptResult { + world.with_allocator_and_type_registry(|_, type_registry, mut allocator| { + let type_registry = type_registry.read(); + self.with_reflect_mut_only(world, &type_registry, &mut allocator, f) + }) + } + + pub fn with_reflect_mut_only O>( + &self, + world: &WorldAccessGuard, + type_registry: &TypeRegistry, + allocator: &mut ReflectAllocator, + f: F, ) -> ScriptResult { let mut access = world .get_access_timeout( @@ -161,21 +190,17 @@ impl ReflectReference { DEFAULT_TIMEOUT, DEFAULT_INTERVAL, ); - let out = world.with_allocator_and_type_registry(|_, type_registry, mut allocator| { - let type_registry = type_registry.read(); - let reflect = self - .reflect_mut( - world.as_unsafe_world_cell(), - &mut access, - &type_registry, - Some(&allocator), - )?; - let o = f(reflect, &type_registry, &mut allocator); - Ok(o) - }); + let reflect = self + .reflect_mut( + world.as_unsafe_world_cell(), + &mut access, + type_registry, + Some(allocator), + ).map(|r| f(r, type_registry, allocator)); + world.release_access(access); - out + reflect } /// Returns `Ok(())` if the given access is sufficient to read the value or an appropriate error otherwise @@ -456,12 +481,14 @@ impl ReflectBase { } /// An element in the reflection path, the base reference included -#[derive(Clone, PartialEq, Eq, Debug)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum ReflectionPathElem { /// A standard reflection path, i.e. `.field_name[vec_index]`, pre-parsed since we construct once potentially use many times Reflection(ParsedPath), /// a deferred reflection DeferredReflection(DeferredReflection), + /// a no-op reflection, i.e. a reference to the base object, useful identity to have + Identity } impl ReflectionPathElem { @@ -511,6 +538,7 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { match self { ReflectionPathElem::Reflection(path) => path.reflect_element(root), ReflectionPathElem::DeferredReflection(f) => (f.get)(root), + ReflectionPathElem::Identity => Ok(root), } } @@ -521,6 +549,7 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { match self { ReflectionPathElem::Reflection(path) => path.reflect_element_mut(root), ReflectionPathElem::DeferredReflection(defref) => (defref.get_mut)(root), + ReflectionPathElem::Identity => Ok(root) } } } @@ -542,6 +571,22 @@ pub struct DeferredReflection { >, } +/// Given a function, repeats it with a mutable reference for the get_mut deferred variant +#[macro_export] +macro_rules! new_deferred_reflection { + (|$root:ident| {$($get:tt)*}) => { + DeferredReflection::from(( + |$root: &dyn PartialReflect| -> Result<&dyn PartialReflect, ReflectPathError<'static>> { + $($get)* + }, + |$root: &mut dyn PartialReflect| -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> { + $($get)* + }, + )) + }; +} + + impl Debug for DeferredReflection { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str("DeferredReflection") @@ -614,6 +659,6 @@ impl Iterator for ReflectRefIter { } }; - return Some(result); + Some(result) } } \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 014a78ae19..ad2ec4dd1f 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -33,8 +33,11 @@ pub trait PartialReflectExt { other: Box, apply: F, ) -> Result<(), ScriptError>; - } + + /// Inserts into the type at the given key, if the type supports inserting with the given key + fn insert_at(&mut self, index: usize, value: Box) -> Result<(), ScriptError>; +} pub trait TypeIdExtensions { fn type_id_or_dummy(&self) -> TypeId; } @@ -129,7 +132,6 @@ impl PartialReflectExt for T { match (self.reflect_mut(), other.reflect_mut()) { (bevy::reflect::ReflectMut::List(l), bevy::reflect::ReflectMut::List(r)) => { - let excess_elems = max(l.len() as isize - r.len() as isize, 0) as usize; let to_be_inserted_elems = max(r.len() as isize - l.len() as isize, 0) as usize; let apply_range = 0..(r.len() - to_be_inserted_elems); @@ -153,20 +155,6 @@ impl PartialReflectExt for T { for i in apply_range { apply(l.get_mut(i).expect("invariant"), r.get(i).expect("invariant"))?; }; - - - - // for right_elem in r.iter() { - // if let Some(left_elem) = l.get_mut(i) { - // apply(left_elem, right_elem)? - // } else { - // shorter = true; - // break; - // } - // i+=1; - // }; - - Ok(()) } @@ -178,29 +166,27 @@ impl PartialReflectExt for T { } } - // fn set_as_list>>( - // &mut self, - // other: I, - // ) -> Result<(), ScriptError> { - // if let bevy::reflect::ReflectMut::List(list) = self.reflect_mut() { - // let mut left_index = 0; - // for i in other { - // if let Some(left_item) = list.get_mut(left_index) { - // left_item.apply - // } else { - // } - // left_index += 1; - // } - // Ok(()) - // } else { - // Err(ScriptError::new_runtime_error(format!( - // "Expected list-like type from crate core, but got {}", - // self.get_represented_type_info() - // .map(|ti| ti.type_path()) - // .unwrap_or_else(|| "dynamic type with no type information") - // ))) - // } - // } + fn insert_at(&mut self, index: usize, value: Box) -> Result<(), ScriptError> { + match self.reflect_mut() { + bevy::reflect::ReflectMut::List(l) => { + l.insert(index, value); + Ok(()) + }, + bevy::reflect::ReflectMut::Map(m) => { + m.insert_boxed(Box::new(index), value); + Ok(()) + }, + bevy::reflect::ReflectMut::Set(s) => { + s.insert_boxed(value); + Ok(()) + }, + _ => Err(ScriptError::new_reflection_error(format!( + "Could not insert into {}. The type does not support insertion at a key.", + self.reflect_type_path() + ))), + } + } + } @@ -344,4 +330,37 @@ mod test { .unwrap(); assert_eq!(other, list); } + + #[test] + fn test_insert_at_vec() { + let mut list = vec![1, 2, 3]; + let value = 4; + let value_ref: Box = Box::new(value); + list.insert_at(&1, value_ref).unwrap(); + assert_eq!(vec![1, 4, 2, 3], list); + } + + #[test] + fn test_insert_at_map() { + let mut map = std::collections::HashMap::::default(); + let value = 4; + let value_ref: Box = Box::new(value); + map.insert(1, 2); + map.insert(2, 3); + map.insert(3, 4); + map.insert_at(&1, value_ref).unwrap(); + assert_eq!(4, map[&1]); + } + + #[test] + fn test_insert_at_set() { + let mut set = std::collections::HashSet::::default(); + let value = 4; + let value_ref: Box = Box::new(value); + set.insert(1); + set.insert(2); + set.insert(3); + set.insert_at(&1, value_ref).unwrap(); + assert!(set.contains(&4)); + } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index ea2fe5e40d..17908091a3 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -108,9 +108,10 @@ impl LuaReflectReference { }) { bevy::log::debug!("Setting value with ReflectLuaValue registration"); let other = (type_data.from_value)(value, lua)?; - let o = self - .0 - .with_reflect_mut(&world, |r, _, _| r.try_apply(other.as_partial_reflect()))?; + self.0.with_reflect_mut(&world, |r, _, _| { + r.try_apply(other.as_partial_reflect()) + .map_err(ScriptError::new_reflection_error) + })??; } else if let Some(type_data) = world.with_resource::(|_, type_registry| { type_registry @@ -193,6 +194,7 @@ impl LuaReflectReference { } } } + impl_userdata_from_lua!(LuaReflectReference); impl LuaProxied for ReflectReference { @@ -211,16 +213,6 @@ impl From for LuaReflectReference { } } -#[derive(Debug, Clone, tealr::mlu::UserData, tealr::ToTypename)] -pub struct LuaReflectRefIter(pub ReflectRefIter); -impl_userdata_from_lua!(LuaReflectRefIter); - -impl TealData for LuaReflectRefIter { - fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(_methods: &mut T) {} - - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} -} - impl TealData for LuaReflectReference { fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(m: &mut T) { m.add_meta_function( @@ -256,6 +248,13 @@ impl TealData for LuaReflectReference { }, ); + m.add_function_mut( + "insert", + |l, (mut self_, key): (LuaReflectReference, usize, LuaReflect)| { + self_.0.insert_at(key, l.get_world()) + }, + ); + m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { self_.len(l) }); diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index bbe60977e8..2c4527256b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -82,6 +82,9 @@ impl Plugin for LuaScriptingPlugin { fn cleanup(&self, app: &mut App) { let mut type_registry = app.world_mut().get_resource_mut().unwrap(); + + // we register up to two levels of nesting, if more are needed, the user will have to do this manually + pre_register_common_containers(&mut type_registry); pre_register_common_containers(&mut type_registry); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index d046750c51..5abd838a5f 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -16,9 +16,7 @@ use bevy::{ }, }; use bevy_mod_scripting_core::{ - bindings::{DeferredReflection, ReflectAllocator, ReflectReference, ReflectionPathElem}, - error::ScriptError, - reflection_extensions::PartialReflectExt, + bindings::{DeferredReflection, ReflectAllocator, ReflectReference, ReflectionPathElem}, error::ScriptError, new_deferred_reflection, reflection_extensions::PartialReflectExt }; use tealr::mlu::mlua::{FromLua, IntoLua, Lua, Table, Value}; @@ -62,11 +60,13 @@ impl ReflectLuaProxied { fn new_for_option(inner_lua_proxied_data: &ReflectLuaProxied, container_type_info: &'static TypeInfo) -> Self { let ref_into_option = |mut r: ReflectReference| { r.index_path(ParsedPath::parse_static("0").expect("Invalid reflection path")); + // why is this necessary? well we need for the from_proxy to work correctly + // we need to know if the reference came from this impl so we can pop the last element + r.index_path(ReflectionPathElem::Identity); r }; let into_proxy_clone = inner_lua_proxied_data.into_proxy.clone(); let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); - // let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); Self { into_proxy: Arc::new(move |reflect_ref, l| { // read the value and check if it is None, if so return nil @@ -98,10 +98,27 @@ impl ReflectLuaProxied { Ok(reflect_ref) } else { - bevy::log::debug!("Option from proxy: {:?}", v); + // this ref could've come from this into_proxy or from something else, we need to differentiate here + // we need to let mut inner_ref = (from_proxy_clone)(v, l)?; - inner_ref.reflect_path.pop(); - Ok(inner_ref) + if inner_ref.reflect_path.last().is_some_and(|p| p == &ReflectionPathElem::Identity) { + // if the last path element is identity, then it came from this impl + // we need to remove the path derefing to the inner value and we're done + inner_ref.reflect_path.pop(); + Ok(inner_ref) + } else { + // otherwise we need to wrap it in an option dynamically so it's an option, to do that we need to reflect the value and box it + let world = l.get_world(); + let reflect_ref = inner_ref.with_reflect(&world, |r,_, mut allocator| { + let mut dynamic = DynamicEnum::new("Some", DynamicVariant::Tuple([r.clone_value()].into_iter().collect())); + dynamic.set_represented_type(Some(container_type_info)); + ReflectReference::new_allocated( + dynamic, + &mut allocator, + ) + })?; + Ok(reflect_ref) + } } }), opt_set: None, @@ -538,7 +555,8 @@ fn destructure_list_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { } /// iterates over type data for all types which have registered [`ReflectLuaProxied`] and [`ReflectLuaValue`] implementations, -/// and registers corresponding [`Option`] [`Result`] etc type data equivalents +/// and registers corresponding [`Option`] [`Result`] etc type data equivalents. +/// for combinations of nested containers, this should be run more times per level of nesting required. pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { let mut type_registry = type_registry.write(); From c222a0304ce8bea3d8f32e426ae3cbb95a292e4c Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 3 Dec 2024 09:03:47 +0000 Subject: [PATCH 029/217] 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 030/217] 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 031/217] 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 032/217] 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 033/217] 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 034/217] 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 From e01c516f2d7ca3f44c8e9921a0a62bb7eecd5566 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 3 Dec 2024 22:21:43 +0000 Subject: [PATCH 035/217] merge --- .../src/bindings/providers/bevy_a11y.rs | 58 - .../src/bindings/providers/bevy_core.rs | 16 +- .../src/bindings/providers/bevy_ecs.rs | 154 +- .../src/bindings/providers/bevy_hierarchy.rs | 16 +- .../src/bindings/providers/bevy_input.rs | 514 +- .../src/bindings/providers/bevy_math.rs | 1126 ++-- .../src/bindings/providers/bevy_reflect.rs | 5088 ++++++++--------- .../src/bindings/providers/bevy_time.rs | 72 +- .../src/bindings/providers/bevy_transform.rs | 86 +- .../src/bindings/providers/bevy_window.rs | 1987 ------- .../src/bindings/providers/mod.rs | 4 - .../bevy_mod_scripting_lua/src/docs.rs | 5 +- 12 files changed, 3569 insertions(+), 5557 deletions(-) delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs deleted file mode 100644 index 8827603674..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_a11y.rs +++ /dev/null @@ -1,58 +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::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::a11y::Focus", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[] -)] -pub struct Focus(ReflectReference); -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - Ok(()) - } -} -fn bevy_a_11_y_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyA11YScriptingPlugin; -impl bevy::app::Plugin for BevyA11YScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_a_11_y_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyA11YAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs index 81510b9c0b..b01a207d2f 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs @@ -21,14 +21,6 @@ use crate::{ bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -38,6 +30,14 @@ use crate::{ other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs index e62e60366c..5891658803 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs @@ -20,10 +20,14 @@ use crate::{ bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -82,14 +86,10 @@ use crate::{ "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -158,6 +158,22 @@ pub struct OnReplace {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", 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()] + fn new(index: usize) -> LuaReflectValProxy; + +"#, + r#" +/// Returns the index of the current component. + + #[lua()] + fn index(_self: LuaReflectValProxy) -> usize; + +"#, + r#" #[lua(as_trait = "std::clone::Clone")] fn clone( @@ -184,22 +200,6 @@ pub struct OnReplace {} _self: LuaReflectRefProxy, ) -> (); -"#, - 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()] - fn new(index: usize) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the index of the current component. - - #[lua()] - fn index(_self: LuaReflectValProxy) -> usize; - "#, r#" #[lua(metamethod="ToString")] @@ -221,6 +221,26 @@ pub struct ComponentId(); _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" /// Creates a new [`Tick`] wrapping the given value. @@ -254,26 +274,6 @@ pub struct ComponentId(); this_run: LuaReflectValProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -289,14 +289,6 @@ pub struct Tick {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Returns `true` if the component or resource was added after the system last ran /// (or the system is running for the first time). @@ -321,21 +313,12 @@ pub struct Tick {} "#, r#" -/// Returns the tick recording the time this component or resource was most recently changed. - - #[lua()] - fn last_changed_tick( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the tick recording the time this component or resource was added. +/// Creates a new instance with the same change tick for `added` and `changed`. #[lua()] - fn added_tick( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + fn new( + change_tick: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -357,6 +340,14 @@ pub struct Tick {} change_tick: LuaReflectValProxy, ) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -365,7 +356,10 @@ fn index(&self) -> String { } "#] )] -pub struct ComponentTicks {} +pub struct ComponentTicks { + added: bevy::ecs::component::Tick, + changed: bevy::ecs::component::Tick, +} #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( remote = "bevy::ecs::identifier::Identifier", @@ -373,14 +367,6 @@ pub struct ComponentTicks {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -421,6 +407,14 @@ pub struct ComponentTicks {} #[lua()] fn from_bits(value: u64) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -490,6 +484,11 @@ impl crate::tealr::mlu::ExportInstances for Globals { )?; instances .add_instance("Tick", crate::tealr::mlu::UserDataProxy::::new)?; + instances + .add_instance( + "ComponentTicks", + crate::tealr::mlu::UserDataProxy::::new, + )?; instances .add_instance( "Identifier", @@ -540,6 +539,9 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .process_type::() .process_type::>() .process_type::() + .process_type::< + crate::tealr::mlu::UserDataProxy, + >() .process_type::() .process_type::< crate::tealr::mlu::UserDataProxy, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs index bbe353b36b..46f2c009b8 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs @@ -79,6 +79,14 @@ pub struct Parent(); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -88,14 +96,6 @@ pub struct Parent(); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs index c55b025c1e..ec753f161b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs @@ -22,18 +22,64 @@ use crate::{ bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Returns the USB vendor ID as assigned by the USB-IF, if available. + + #[lua()] + fn vendor_id( + _self: LuaReflectRefProxy, + ) -> std::option::Option; + +"#, + r#" +/// Returns the USB product ID as assigned by the [vendor], if available. +/// [vendor]: Self::vendor_id + + #[lua()] + fn product_id( + _self: LuaReflectRefProxy, + ) -> std::option::Option; + +"#, + r#" +/// Returns `true` if the [`GamepadButton`] has been pressed. + + #[lua()] + fn pressed( + _self: LuaReflectRefProxy, + button_type: LuaReflectValProxy, + ) -> 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()] + fn just_pressed( + _self: LuaReflectRefProxy, + button_type: LuaReflectValProxy, + ) -> 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()] + fn just_released( + _self: LuaReflectRefProxy, + button_type: LuaReflectValProxy, + ) -> bool; + +"#, + r#" #[lua(metamethod="ToString")] fn index(&self) -> String { format!("{:?}", _self) } "#] )] -pub struct Gamepad { - vendor_id: std::option::Option, - product_id: std::option::Option, - digital: ReflectReference, - analog: ReflectReference, -} +pub struct Gamepad {} #[derive(bevy_mod_scripting_derive::LuaProxy)] #[proxy( remote = "bevy::input::gamepad::GamepadAxis", @@ -46,6 +92,14 @@ pub struct Gamepad { _self: LuaReflectRefProxy, ) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -58,14 +112,6 @@ pub struct Gamepad { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -82,14 +128,6 @@ pub struct GamepadAxis {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -107,6 +145,14 @@ pub struct GamepadAxis {} _self: LuaReflectRefProxy, ) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -151,6 +197,14 @@ pub struct GamepadSettings { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -168,14 +222,6 @@ pub struct GamepadSettings { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -204,18 +250,18 @@ pub struct KeyCode {} "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -272,10 +318,10 @@ pub struct TouchInput { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -292,10 +338,10 @@ pub struct TouchInput { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -313,14 +359,6 @@ pub struct KeyboardFocusLost {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -338,6 +376,14 @@ pub struct KeyboardFocusLost {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] @@ -360,14 +406,6 @@ pub struct KeyboardInput { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -377,6 +415,14 @@ pub struct KeyboardInput { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -431,18 +477,18 @@ pub struct AccumulatedMouseScroll { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -476,14 +522,6 @@ pub struct MouseButtonInput { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -493,6 +531,14 @@ pub struct MouseButtonInput { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -586,6 +632,14 @@ pub struct GamepadAxisChangedEvent { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -595,14 +649,6 @@ pub struct GamepadAxisChangedEvent { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -624,14 +670,6 @@ pub struct GamepadButtonChangedEvent { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, @@ -649,6 +687,14 @@ pub struct GamepadButtonChangedEvent { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -702,14 +748,6 @@ pub struct GamepadConnection {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -737,6 +775,14 @@ pub struct GamepadConnection {} _self: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -756,14 +802,6 @@ pub struct GamepadConnectionEvent { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -773,6 +811,14 @@ pub struct GamepadConnectionEvent { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -882,14 +928,6 @@ pub struct RawGamepadAxisChangedEvent { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -899,6 +937,14 @@ pub struct RawGamepadAxisChangedEvent { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -919,14 +965,6 @@ pub struct RawGamepadButtonChangedEvent { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -936,6 +974,14 @@ pub struct RawGamepadButtonChangedEvent { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -952,14 +998,6 @@ pub struct RawGamepadEvent {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -969,6 +1007,14 @@ pub struct RawGamepadEvent {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1018,14 +1064,6 @@ pub struct RotationGesture(f32); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1035,6 +1073,14 @@ pub struct RotationGesture(f32); other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1051,14 +1097,6 @@ pub struct DoubleTapGesture {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1068,6 +1106,14 @@ pub struct DoubleTapGesture {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1084,6 +1130,14 @@ pub struct PanGesture(ReflectReference); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1093,28 +1147,20 @@ pub struct PanGesture(ReflectReference); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" -/// Is this button pressed? - - #[lua()] - fn is_pressed(_self: LuaReflectRefProxy) -> bool; - "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" +/// Is this button pressed? - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua()] + fn is_pressed(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -1132,6 +1178,18 @@ pub struct ButtonState {} bms_lua_path = "crate", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1201,18 +1259,6 @@ pub struct ButtonState {} value: f32, ) -> f32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -1229,10 +1275,14 @@ pub struct ButtonSettings {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1367,14 +1417,10 @@ pub struct ButtonSettings {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -1430,6 +1476,18 @@ pub struct ButtonAxisSettings { bms_lua_path = "crate", functions[r#" + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1455,18 +1513,6 @@ pub struct ButtonAxisSettings { intensity: f32, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -1539,18 +1585,18 @@ pub struct Key {} "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" @@ -1568,6 +1614,14 @@ pub struct NativeKeyCode {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1585,14 +1639,6 @@ pub struct NativeKeyCode {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -1609,18 +1655,6 @@ pub struct NativeKey {} bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, @@ -1634,6 +1668,18 @@ pub struct NativeKey {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -1650,6 +1696,14 @@ pub struct MouseScrollUnit {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1667,14 +1721,6 @@ pub struct MouseScrollUnit {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -1691,6 +1737,14 @@ pub struct TouchPhase {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1700,14 +1754,6 @@ pub struct TouchPhase {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs index 49f55cbfb4..c3d9925ce1 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs @@ -20,15 +20,6 @@ use crate::{ bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -71,6 +62,15 @@ use crate::{ #[lua()] fn is_square(_self: LuaReflectRefProxy) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -87,18 +87,18 @@ pub struct AspectRatio(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -128,6 +128,14 @@ pub struct CompassOctant {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -145,14 +153,6 @@ pub struct CompassOctant {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -169,9 +169,19 @@ pub struct CompassQuadrant {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -183,6 +193,14 @@ pub struct CompassQuadrant {} other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Create a two-dimensional isometry from a rotation. @@ -220,24 +238,6 @@ pub struct CompassQuadrant {} rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -262,33 +262,6 @@ pub struct Isometry2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. @@ -317,6 +290,33 @@ pub struct Isometry2d { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -336,19 +336,19 @@ pub struct Isometry3d { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -369,19 +369,19 @@ pub struct Ray2d { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -401,11 +401,13 @@ pub struct Ray3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Rotates the [`Dir2`] using a [`Rot2`]. - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + direction: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -416,16 +418,6 @@ pub struct Ray3d { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" -/// Rotates the [`Dir2`] using a [`Rot2`]. - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - direction: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Creates a [`Rot2`] from a counterclockwise angle in radians. @@ -617,6 +609,16 @@ pub struct Ray3d { other: LuaReflectValProxy, ) -> f32; +"#, + r#" +/// Returns the angle in radians needed to make `self` and `other` coincide. + + #[lua()] + fn angle_to( + _self: LuaReflectValProxy, + other: LuaReflectValProxy, + ) -> f32; + "#, r#" /// Returns the inverse of the rotation. This is also the conjugate @@ -701,6 +703,14 @@ pub struct Ray3d { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -719,6 +729,18 @@ pub struct Rot2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + 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`. @@ -823,14 +845,6 @@ pub struct Rot2 { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -842,14 +856,10 @@ pub struct Rot2 { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -867,6 +877,14 @@ pub struct Dir2(); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua(as_trait = "std::ops::Neg", composite = "neg")] fn neg( _self: LuaReflectValProxy, @@ -884,14 +902,6 @@ pub struct Dir2(); other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Create a direction from its `x`, `y`, and `z` components, assuming the resulting vector is normalized. @@ -984,25 +994,9 @@ pub struct Dir3(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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`. +/// 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()] fn from_xyz_unchecked( @@ -1065,6 +1059,22 @@ pub struct Dir3(); other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1080,6 +1090,34 @@ pub struct Dir3A(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + 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. @@ -1222,34 +1260,6 @@ pub struct Dir3A(); _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1269,6 +1279,14 @@ pub struct IRect { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1278,14 +1296,6 @@ pub struct IRect { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Create a new rectangle from two corner points. @@ -1471,6 +1481,14 @@ pub struct Rect { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -1480,6 +1498,14 @@ pub struct Rect { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" /// Create a new rectangle from two corner points. @@ -1624,22 +1650,6 @@ pub struct Rect { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1702,14 +1712,6 @@ pub struct Aabb2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Get the radius of the bounding circle #[lua()] @@ -1724,6 +1726,14 @@ pub struct Aabb2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1743,18 +1753,6 @@ pub struct BoundingCircle { bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1774,6 +1772,18 @@ pub struct BoundingCircle { #[lua()] fn diameter(_self: LuaReflectRefProxy) -> f32; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -1851,6 +1861,26 @@ pub struct Annulus { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Create a new [`Arc2d`] from a `radius` and a `half_angle` #[lua()] @@ -1956,26 +1986,6 @@ pub struct Annulus { #[lua()] fn is_major(_self: LuaReflectRefProxy) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -1994,25 +2004,6 @@ pub struct Arc2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" -/// Create a new `Capsule2d` from a radius and length - - #[lua()] - fn new( - radius: f32, - length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] - - #[lua()] - fn to_inner_rectangle( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" #[lua( as_trait = "std::cmp::PartialEq::", @@ -2033,34 +2024,41 @@ pub struct Arc2d { "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Capsule2d { - radius: f32, - half_length: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::CircularSector", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" +/// Create a new `Capsule2d` from a radius and length - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua()] + fn new( + radius: f32, + length: f32, + ) -> LuaReflectValProxy; "#, r#" +/// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] + + #[lua()] + fn to_inner_rectangle( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] +)] +pub struct Capsule2d { + radius: f32, + half_length: f32, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::primitives::CircularSector", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" /// Create a new [`CircularSector`] from a `radius` and an `angle` #[lua()] @@ -2176,6 +2174,18 @@ pub struct Capsule2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -2193,18 +2203,6 @@ pub struct CircularSector { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Create a new [`CircularSegment`] from a `radius`, and an `angle` #[lua()] @@ -2315,6 +2313,18 @@ pub struct CircularSector { _self: LuaReflectRefProxy, ) -> f32; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" @@ -2340,26 +2350,6 @@ pub struct CircularSegment { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Create a new `Ellipse` from half of its width and height. /// This corresponds to the two perpendicular radii defining the ellipse. @@ -2400,6 +2390,26 @@ pub struct CircularSegment { #[lua()] fn semi_minor(_self: LuaReflectRefProxy) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -2418,14 +2428,6 @@ pub struct Ellipse { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -2435,6 +2437,14 @@ pub struct Ellipse { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2487,6 +2497,18 @@ pub struct Plane2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Create a new `Rectangle` from a full width and height #[lua()] @@ -2511,18 +2533,6 @@ pub struct Plane2d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -2540,6 +2550,26 @@ pub struct Rectangle { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Create a new `RegularPolygon` /// from the radius of the circumcircle and a number of sides /// # Panics @@ -2625,26 +2655,6 @@ pub struct Rectangle { _self: LuaReflectRefProxy, ) -> f32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -2663,14 +2673,6 @@ pub struct RegularPolygon { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. #[lua()] @@ -2730,6 +2732,14 @@ pub struct RegularPolygon { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -2793,6 +2803,26 @@ pub struct Segment2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Checks if the triangle is degenerate, meaning it has zero area. /// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. /// This indicates that the three vertices are collinear or nearly collinear. @@ -2833,26 +2863,6 @@ pub struct Segment2d { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -2870,20 +2880,20 @@ pub struct Triangle2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua()] + fn bounding_sphere( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" -/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - #[lua()] - fn bounding_sphere( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" @@ -2903,6 +2913,14 @@ pub struct Aabb3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Get the radius of the bounding sphere #[lua()] @@ -2917,14 +2935,6 @@ pub struct Aabb3d { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -2992,6 +3002,14 @@ pub struct Sphere { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Create a new `Cuboid` from a full x, y, and z length #[lua()] @@ -3009,14 +3027,6 @@ pub struct Sphere { #[lua()] fn from_length(length: f32) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -3046,6 +3056,18 @@ pub struct Cuboid { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" /// Create a new `Cylinder` from a radius and full height #[lua()] @@ -3086,18 +3108,6 @@ pub struct Cuboid { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -3116,26 +3126,6 @@ pub struct Cylinder { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Create a new `Capsule3d` from a radius and length #[lua()] @@ -3152,7 +3142,27 @@ pub struct Cylinder { #[lua()] fn to_cylinder( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -3182,14 +3192,6 @@ pub struct Capsule3d { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Create a new [`Cone`] from a radius and height. @@ -3229,6 +3231,14 @@ pub struct Capsule3d { #[lua()] fn base_area(_self: LuaReflectRefProxy) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3248,6 +3258,14 @@ pub struct Cone { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -3257,14 +3275,6 @@ pub struct Cone { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3320,6 +3330,14 @@ pub struct InfinitePlane3d { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -3329,14 +3347,6 @@ pub struct InfinitePlane3d { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3428,14 +3438,6 @@ pub struct Segment3d { #[lua()] fn outer_radius(_self: LuaReflectRefProxy) -> f32; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -3448,6 +3450,14 @@ pub struct Segment3d { other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3466,26 +3476,6 @@ pub struct Torus { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Checks if the triangle is degenerate, meaning it has zero area. /// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. /// This indicates that the three vertices are collinear or nearly collinear. @@ -3525,6 +3515,26 @@ pub struct Torus { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3542,6 +3552,14 @@ pub struct Triangle3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. #[lua()] @@ -3570,14 +3588,6 @@ pub struct Triangle3d { circle: LuaReflectRefProxy, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3641,14 +3651,6 @@ pub struct AabbCast2d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. #[lua()] @@ -3668,6 +3670,14 @@ pub struct AabbCast2d { circle: LuaReflectValProxy, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3686,6 +3696,14 @@ pub struct BoundingCircleCast { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. #[lua()] @@ -3714,14 +3732,6 @@ pub struct BoundingCircleCast { sphere: LuaReflectRefProxy, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3741,14 +3751,6 @@ pub struct RayCast3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. #[lua()] @@ -3768,6 +3770,14 @@ pub struct RayCast3d { aabb: LuaReflectValProxy, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -3786,6 +3796,14 @@ pub struct AabbCast3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. #[lua()] @@ -3805,14 +3823,6 @@ pub struct AabbCast3d { sphere: LuaReflectValProxy, ) -> std::option::Option; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -3831,26 +3841,6 @@ pub struct BoundingSphereCast { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Get the start of this interval. #[lua()] @@ -3929,6 +3919,26 @@ pub struct BoundingSphereCast { value: f32, ) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -3981,9 +3991,9 @@ pub struct Interval {} "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -3998,9 +4008,9 @@ pub struct Interval {} "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -4054,6 +4064,14 @@ pub struct Plane3d { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Get the signed volume of the tetrahedron. /// If it's negative, the normal vector of the face defined by /// the first three points using the right-hand rule points @@ -4076,14 +4094,6 @@ pub struct Plane3d { other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs index b5e5699ac5..98282ad194 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -1349,30 +1349,24 @@ pub struct RangeFull {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", 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. +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, 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::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -1383,6 +1377,23 @@ pub struct RangeFull {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Multiplies a quaternion and a 3D vector, returning the rotated vector. @@ -1397,31 +1408,36 @@ pub struct RangeFull {} "#, r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. +/// 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::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: f32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1880,35 +1896,19 @@ pub struct RangeFull {} "#, r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. +/// 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::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -1925,93 +1925,12 @@ pub struct Quat(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Creates a new vector. @@ -2838,19 +2757,19 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -2865,16 +2784,17 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -2882,8 +2802,26 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3>", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -2899,28 +2837,90 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f32) -> () { + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} +"#, + r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f32) -> () { _self[idx - 1] = val } "#] @@ -2937,8 +2937,26 @@ pub struct Vec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -2955,12 +2973,57 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -2969,6 +3032,65 @@ pub struct Vec3 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a new vector. @@ -3490,167 +3612,166 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: i32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec2>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} "#, r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: i32) -> () { + _self[idx - 1] = val +} +"#] +)] +pub struct IVec2 { + x: i32, + y: i32, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::IVec3", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( - _self: LuaReflectValProxy, + _self: LuaReflectValProxy, rhs: i32, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec3>", composite = "sub")] fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec2>", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec2>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec2>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: i32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct IVec2 { - x: i32, - y: i32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::IVec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -3658,8 +3779,17 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec3>", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec3>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -4192,14 +4322,8 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec3>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -4207,194 +4331,194 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} "#, r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: i32) -> () { + _self[idx - 1] = val +} +"#] +)] +pub struct IVec3 { + x: i32, + y: i32, + z: i32, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::IVec4", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( - _self: LuaReflectValProxy, + _self: LuaReflectValProxy, rhs: i32, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec3>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, rhs: i32, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec3>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" #[lua(as_trait = "std::ops::Neg", composite = "neg")] fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: i32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct IVec3 { - x: i32, - y: i32, - z: i32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::IVec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: i32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: i32, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec4>", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: i32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -4914,130 +5038,6 @@ pub struct IVec3 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec4>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec4>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec4>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec4>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -5071,17 +5071,17 @@ pub struct IVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -5089,8 +5089,8 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: i64, ) -> LuaReflectValProxy; @@ -5098,12 +5098,27 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + "#, r#" @@ -5116,10 +5131,10 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i64, ) -> LuaReflectValProxy; "#, @@ -5134,11 +5149,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -5661,25 +5676,26 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: i64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -5687,34 +5703,25 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: i64, ) -> LuaReflectValProxy; @@ -5722,32 +5729,25 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -5771,6 +5771,14 @@ pub struct I64Vec2 { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, @@ -5780,8 +5788,16 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", composite = "sub")] - fn sub( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -5789,10 +5805,10 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i64, ) -> LuaReflectValProxy; "#, @@ -5807,8 +5823,8 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -5816,85 +5832,86 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: i64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: i64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: i64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: i64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -5902,26 +5919,17 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -6451,14 +6459,6 @@ pub struct I64Vec2 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -6488,8 +6488,8 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: i64, ) -> LuaReflectValProxy; @@ -6497,82 +6497,187 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: i64, ) -> LuaReflectValProxy; "#, r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i64, y: i64, z: i64, w: i64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, + #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -/// Creates a new vector from an array. - #[lua()] - fn from_array(a: [i64; 4]) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" -/// `[x, y, z, w]` - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 4]; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`I64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua()] - fn truncate( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: i64, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 4D vector from `self` with the given value of `x`. - #[lua()] - fn with_x( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - x: i64, + rhs: i64, ) -> LuaReflectValProxy; "#, r#" -/// Creates a 4D vector from `self` with the given value of `y`. - #[lua()] - fn with_y( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - y: i64, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: i64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" +/// Creates a new vector. + + #[lua()] + fn new(x: i64, y: i64, z: i64, w: i64) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a vector with all elements set to `v`. + + #[lua()] + fn splat(v: i64) -> LuaReflectValProxy; + +"#, + 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()] + fn select( + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a new vector from an array. + + #[lua()] + fn from_array(a: [i64; 4]) -> LuaReflectValProxy; + +"#, + r#" +/// `[x, y, z, w]` + + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [i64; 4]; + +"#, + r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`I64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. + + #[lua()] + fn truncate( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `x`. + + #[lua()] + fn with_x( + _self: LuaReflectValProxy, + x: i64, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 4D vector from `self` with the given value of `y`. + + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: i64, ) -> LuaReflectValProxy; "#, @@ -7012,8 +7117,8 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7026,15 +7131,6 @@ pub struct I64Vec3 { _self: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -7044,84 +7140,6 @@ pub struct I64Vec3 { rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - "#, r#" @@ -7130,24 +7148,6 @@ pub struct I64Vec3 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -7169,32 +7169,32 @@ pub struct I64Vec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec2>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -7202,17 +7202,43 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec2>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -7220,12 +7246,30 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a new vector. @@ -7629,28 +7673,10 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec2>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -7665,17 +7691,8 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -7683,17 +7700,8 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -7701,8 +7709,8 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7710,16 +7718,8 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -7755,8 +7755,8 @@ pub struct UVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec3>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec3>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -7764,8 +7764,20 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -7779,8 +7791,8 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -7788,8 +7800,35 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec3>", composite = "add")] fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -7797,10 +7836,10 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: u32, ) -> LuaReflectValProxy; "#, @@ -7815,12 +7854,29 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec3>", composite = "mul")] - fn mul( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec3>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a new vector. @@ -8263,8 +8319,8 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -8272,25 +8328,14 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -8298,69 +8343,24 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec3>", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} "#, r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec3>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} "#, r#" #[lua(metamethod="NewIndex")] @@ -8381,101 +8381,6 @@ pub struct UVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec4>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec4>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec4>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec4>", composite = "mul")] fn mul( _self: LuaReflectValProxy, @@ -8485,17 +8390,8 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: u32, ) -> LuaReflectValProxy; @@ -8503,30 +8399,12 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec4>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: u32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" /// Creates a new vector. @@ -8950,118 +8828,178 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec4>", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: u32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct UVec4 { - x: u32, - y: u32, - z: u32, - w: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::U64Vec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", composite = "div")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec4>", composite = "div")] fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u32, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} +"#, + r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: u32) -> () { + _self[idx - 1] = val +} +"#] +)] +pub struct UVec4 { + x: u32, + y: u32, + z: u32, + w: u32, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::U64Vec2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: u64, ) -> LuaReflectValProxy; @@ -9069,8 +9007,8 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -9078,11 +9016,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -9090,6 +9028,41 @@ pub struct UVec4 { #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + "#, r#" @@ -9102,19 +9075,37 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -9129,8 +9120,26 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -9535,15 +9544,6 @@ pub struct UVec4 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -9562,50 +9562,6 @@ pub struct U64Vec2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" /// Creates a new vector. #[lua()] @@ -10046,17 +10002,17 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -10064,26 +10020,26 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec3>", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: u64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -10091,17 +10047,17 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec3>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: u64, ) -> LuaReflectValProxy; @@ -10109,10 +10065,10 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -10124,37 +10080,81 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", composite = "rem")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: u64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -10177,18 +10177,57 @@ pub struct U64Vec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: u64, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a new vector. @@ -10612,17 +10651,8 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( _self: LuaReflectValProxy, rhs: u64, ) -> LuaReflectValProxy; @@ -10630,28 +10660,25 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -10666,8 +10693,8 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec4>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -10693,47 +10720,21 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: u64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec4>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -10746,10 +10747,9 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -10773,26 +10773,26 @@ pub struct U64Vec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec2>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec2>", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -10800,17 +10800,8 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec2>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -10818,9 +10809,10 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -10835,8 +10827,8 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -10844,8 +10836,8 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -10853,37 +10845,20 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec2>", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec2>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -11730,17 +11705,16 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -11748,30 +11722,56 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec2>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec2>", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -11803,8 +11803,8 @@ pub struct Vec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -11812,26 +11812,17 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -11839,17 +11830,8 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3A>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3A>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -11866,35 +11848,17 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3A>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -11902,20 +11866,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3A>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> bool; "#, r#" @@ -11929,9 +11884,9 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -12770,8 +12725,25 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3A>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; @@ -12788,9 +12760,37 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3A>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -12821,17 +12821,17 @@ pub struct Vec3A(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec4>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec4>", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -12839,43 +12839,43 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec4>", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec4>", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -12883,43 +12883,44 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec4>", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -12927,10 +12928,10 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec4>", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -12945,19 +12946,9 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: f32, ) -> LuaReflectValProxy; "#, @@ -13742,17 +13733,26 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec4>", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec4>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -13785,14 +13785,6 @@ pub struct Vec4(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] fn eq( _self: LuaReflectRefProxy, @@ -13869,6 +13861,14 @@ pub struct Vec4(); #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -13887,23 +13887,6 @@ pub struct BVec2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Creates a new vector mask. #[lua()] @@ -13966,6 +13949,23 @@ pub struct BVec2 { value: bool, ) -> (); +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -13992,16 +13992,19 @@ pub struct BVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -14070,11 +14073,8 @@ pub struct BVec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); "#, r#" @@ -14097,28 +14097,27 @@ pub struct BVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: f64, ) -> LuaReflectValProxy; "#, @@ -14142,8 +14141,8 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -14160,17 +14159,26 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec2>", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: f64, ) -> LuaReflectValProxy; @@ -15020,51 +15028,43 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec2>", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec2>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec2>", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec2>", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div")] fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( _self: LuaReflectValProxy, rhs: f64, ) -> LuaReflectValProxy; @@ -15072,8 +15072,8 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: f64, ) -> LuaReflectValProxy; @@ -15081,17 +15081,17 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec2>", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec2>", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec2>", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; @@ -15127,19 +15127,28 @@ pub struct DVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add")] fn add( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, @@ -15153,20 +15162,101 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec3>", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" -/// Creates a new vector. - #[lua()] - fn new(x: f64, y: f64, z: f64) -> LuaReflectValProxy; - -"#, + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec3>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec3>", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec3>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec3>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a new vector. + + #[lua()] + fn new(x: f64, y: f64, z: f64) -> LuaReflectValProxy; + +"#, r#" /// Creates a vector with all elements set to `v`. @@ -15994,10 +16084,10 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -16009,77 +16099,6 @@ pub struct DVec2 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec3>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec3>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec3>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec3>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -16092,28 +16111,9 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec3>", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -16147,221 +16147,79 @@ pub struct DVec3 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Creates a new vector. - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec4>", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua()] + fn new(x: f64, y: f64, z: f64, w: f64) -> LuaReflectValProxy; "#, r#" +/// Creates a vector with all elements set to `v`. - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec4>", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua()] + fn splat(v: f64) -> LuaReflectValProxy; "#, 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(as_trait = "std::ops::Rem::", composite = "rem")] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + #[lua()] + fn select( + mask: LuaReflectValProxy, + if_true: LuaReflectValProxy, + if_false: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" +/// Creates a new vector from an array. - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec4>", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + #[lua()] + fn from_array(a: [f64; 4]) -> LuaReflectValProxy; "#, r#" +/// `[x, y, z, w]` - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua()] + fn to_array(_self: LuaReflectRefProxy) -> [f64; 4]; "#, r#" +/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. +/// Truncation to [`DVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua()] + fn truncate( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + ) -> LuaReflectValProxy; "#, r#" +/// Creates a 4D vector from `self` with the given value of `x`. - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec4>", composite = "sub")] - fn sub( + #[lua()] + fn with_x( _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, + x: f64, ) -> LuaReflectValProxy; "#, r#" +/// Creates a 4D vector from `self` with the given value of `y`. - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, + #[lua()] + fn with_y( + _self: LuaReflectValProxy, + y: f64, ) -> LuaReflectValProxy; "#, r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec4>", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f64, y: f64, z: f64, w: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f64; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f64; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`DVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. +/// Creates a 4D vector from `self` with the given value of `z`. #[lua()] fn with_z( @@ -17068,10 +16926,10 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec4>", composite = "sub")] fn sub( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -17085,95 +16943,255 @@ pub struct DVec3 { "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} + + #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec4>", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f64) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct DVec4 { - x: f64, - y: f64, - z: f64, - w: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Mat2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a 2x2 matrix from two column vectors. - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, 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()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 4]; + #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec4>", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; "#, 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()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 2]; 2]; + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, r#" -/// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of -/// `angle` (in radians). - #[lua()] - fn from_scale_angle( - scale: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - #[lua()] - fn from_angle(angle: f32) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec4>", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec4>", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + fn rem( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#, + r#" +#[lua(metamethod="Index")] +fn index(self, idx: usize) -> LuaIdentityProxy { + _self[idx - 1] +} +"#, + r#" +#[lua(metamethod="NewIndex")] +fn index(&mut self, idx: usize, val: f64) -> () { + _self[idx - 1] = val +} +"#] +)] +pub struct DVec4 { + x: f64, + y: f64, + z: f64, + w: f64, +} +#[derive(bevy_mod_scripting_derive::LuaProxy)] +#[proxy( + remote = "bevy::math::Mat2", + bms_core_path = "bevy_mod_scripting_core", + bms_lua_path = "crate", + functions[r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 2x2 matrix from two column vectors. + + #[lua()] + fn from_cols( + x_axis: LuaReflectValProxy, + y_axis: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + 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()] + fn to_cols_array(_self: LuaReflectRefProxy) -> [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()] + fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 2]; 2]; + +"#, + r#" +/// Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. + + #[lua()] + fn from_diagonal( + diagonal: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of +/// `angle` (in radians). + + #[lua()] + fn from_scale_angle( + scale: LuaReflectValProxy, + angle: f32, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). + + #[lua()] + fn from_angle(angle: f32) -> LuaReflectValProxy; + +"#, + r#" +/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. + + #[lua()] + fn from_mat3( + m: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -17376,45 +17394,27 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -17429,27 +17429,27 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -17492,6 +17492,15 @@ pub struct Mat2(); rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" @@ -17504,11 +17513,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -17522,41 +17531,14 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3x3 matrix from three column vectors. +/// Creates a 3x3 matrix from three column vectors. #[lua()] fn from_cols( @@ -17946,27 +17928,45 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: f32, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: f32, ) -> LuaReflectValProxy; "#, @@ -18016,34 +18016,26 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -18051,10 +18043,9 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -18066,23 +18057,6 @@ pub struct Mat3 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - "#, r#" /// Creates a 3x3 matrix from three column vectors. @@ -18475,10 +18449,27 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -18490,6 +18481,15 @@ pub struct Mat3 { rhs: f32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -18528,12 +18528,30 @@ pub struct Mat3A { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, rhs: f32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates a 4x4 matrix from four column vectors. @@ -19192,8 +19210,8 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -19201,10 +19219,18 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f32, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, @@ -19224,15 +19250,6 @@ pub struct Mat3A { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - "#, r#" @@ -19245,29 +19262,12 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -19306,42 +19306,6 @@ pub struct Mat4 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" /// Creates a 2x2 matrix from two column vectors. #[lua()] @@ -19577,23 +19541,6 @@ pub struct Mat4 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - "#, r#" @@ -19614,17 +19561,70 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) } "#, r#" @@ -19657,8 +19657,17 @@ pub struct DMat2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: f64, ) -> LuaReflectValProxy; @@ -19666,11 +19675,28 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -19684,28 +19710,37 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -20086,41 +20121,6 @@ pub struct DMat2 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - "#, r#" #[lua(metamethod="ToString")] @@ -20159,18 +20159,55 @@ pub struct DMat3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, + rhs: f64, ) -> LuaReflectValProxy; "#, @@ -20784,46 +20821,9 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -20837,20 +20837,20 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, - rhs: f64, + rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" @@ -20900,37 +20900,37 @@ pub struct DMat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -21134,6 +21134,32 @@ pub struct Affine2 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua()] @@ -21425,24 +21451,6 @@ pub struct Affine2 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -21452,14 +21460,6 @@ pub struct Affine2 { rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -21478,6 +21478,15 @@ pub struct Affine3A { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Creates an affine transform from three column vectors. #[lua()] @@ -21653,24 +21662,6 @@ pub struct Affine3A { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -21688,6 +21679,15 @@ pub struct Affine3A { rhs: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -21713,6 +21713,32 @@ pub struct DAffine2 { rhs: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" /// Creates an affine transform from three column vectors. @@ -21984,32 +22010,6 @@ pub struct DAffine2 { _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -22028,27 +22028,13 @@ pub struct DAffine3 { bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", 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::", composite = "mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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. +/// 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::Mul::", composite = "mul")] - fn mul( + #[lua(as_trait = "std::ops::Add::", composite = "add")] + fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -22066,42 +22052,19 @@ pub struct DAffine3 { "#, r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Div::", composite = "div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. +/// 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::Sub::", composite = "sub")] - fn sub( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Creates a new rotation quaternion. @@ -22542,32 +22505,69 @@ pub struct DAffine3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, 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. +/// 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::Add::", composite = "add")] - fn add( + #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + fn mul( _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; "#, r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] + + #[lua(as_trait = "std::ops::Neg", composite = "neg")] + fn neg( + _self: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + rhs: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" +/// Subtracts the `rhs` quaternion from `self`. +/// The difference is not guaranteed to be normalized. + + #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + fn sub( + _self: LuaReflectValProxy, + rhs: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + r#" +/// Divides a quaternion by a scalar value. +/// The quotient is not guaranteed to be normalized. + + #[lua(as_trait = "std::ops::Div::", composite = "div")] + fn div( + _self: LuaReflectValProxy, + rhs: f64, + ) -> LuaReflectValProxy; + +"#, + r#" +#[lua(metamethod="ToString")] +fn index(&self) -> String { + format!("{:?}", _self) +} +"#] )] pub struct DQuat { x: f64, @@ -22582,19 +22582,19 @@ pub struct DQuat { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -22684,19 +22684,19 @@ pub struct EulerRot {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone( _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + rhs: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -22808,15 +22808,6 @@ pub struct BVec4A(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -22846,6 +22837,15 @@ pub struct BVec4A(); #[lua()] fn is_heap_allocated(_self: LuaReflectRefProxy) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -22861,192 +22861,163 @@ pub struct SmolStr(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", 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`]. + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + +"#, + 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; -/// # 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(()) -/// # } +/// let uuid = Uuid::nil(); +/// assert_eq!( +/// "00000000-0000-0000-0000-000000000000", +/// uuid.hyphenated().to_string(), +/// ); /// ``` -/// # References -/// * [Version Field in RFC 9562](https://www.ietf.org/rfc/rfc9562.html#section-4.2) #[lua()] - fn get_version_num(_self: LuaReflectRefProxy) -> usize; + fn nil() -> LuaReflectValProxy; "#, r#" -/// Returns a 128bit value containing the value. -/// The bytes in the UUID will be packed directly into a `u128`. +/// 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; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; +/// let uuid = Uuid::max(); /// assert_eq!( -/// uuid.as_u128(), -/// 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8, +/// "ffffffff-ffff-ffff-ffff-ffffffffffff", +/// uuid.hyphenated().to_string(), /// ); -/// # Ok(()) -/// # } /// ``` #[lua()] - fn as_u128(_self: LuaReflectRefProxy) -> u128; + fn max() -> LuaReflectValProxy; "#, 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. +/// Creates a UUID from a 128bit value. /// # Examples +/// Basic usage: /// ``` /// # use uuid::Uuid; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128(v); /// assert_eq!( -/// uuid.to_u128_le(), -/// 0xd8d7d6d5d4d3d2d1c2c1b2b1a4a3a2a1, +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), /// ); -/// # Ok(()) -/// # } /// ``` #[lua()] - fn to_u128_le(_self: LuaReflectRefProxy) -> u128; + fn from_u128(v: u128) -> LuaReflectValProxy; "#, 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. +/// 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; -/// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; +/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; +/// let uuid = Uuid::from_u128_le(v); /// assert_eq!( -/// uuid.as_u64_pair(), -/// (0xa1a2a3a4b1b2c1c2, 0xd1d2d3d4d5d6d7d8), +/// "d8d7d6d5-d4d3-d2d1-c2c1-b2b1a4a3a2a1", +/// uuid.hyphenated().to_string(), /// ); -/// # Ok(()) -/// # } /// ``` #[lua()] - fn as_u64_pair(_self: LuaReflectRefProxy) -> (u64, u64); + fn from_u128_le(v: u128) -> LuaReflectValProxy; "#, r#" -/// Consumes self and returns the underlying byte value of the UUID. +/// Creates a UUID from two 64bit values. /// # Examples +/// Basic usage: /// ``` /// # 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()); +/// 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()] - fn into_bytes(_self: LuaReflectValProxy) -> [u8; 16]; + fn from_u64_pair(high_bits: u64, low_bits: u64) -> LuaReflectValProxy; "#, 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. +/// Creates a UUID using the supplied bytes. /// # Examples +/// Basic usage: /// ``` -/// use uuid::Uuid; /// # fn main() -> Result<(), uuid::Error> { -/// let uuid = Uuid::parse_str("a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8")?; +/// # 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.to_bytes_le(), -/// ([ -/// 0xa4, 0xa3, 0xa2, 0xa1, 0xb2, 0xb1, 0xc2, 0xc1, 0xd1, 0xd2, -/// 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 -/// ]) +/// uuid.hyphenated().to_string(), +/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" /// ); /// # Ok(()) /// # } /// ``` #[lua()] - fn to_bytes_le(_self: LuaReflectRefProxy) -> [u8; 16]; - -"#, - r#" -/// Tests if the UUID is nil (all zeros). - - #[lua()] - fn is_nil(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Tests if the UUID is max (all ones). - - #[lua()] - fn is_max(_self: LuaReflectRefProxy) -> bool; + fn from_bytes(bytes: [u8; 16]) -> LuaReflectValProxy; "#, r#" -/// A buffer that can be used for `encode_...` calls, that is -/// guaranteed to be long enough for any of the format adapters. +/// 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 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" -/// ); +/// 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!( -/// uuid.urn().encode_lower(&mut Uuid::encode_buffer()), -/// "urn:uuid:00000000-0000-0000-0000-000000000000" +/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", +/// uuid.hyphenated().to_string(), /// ); +/// # Ok(()) +/// # } /// ``` #[lua()] - 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()] - fn get_node_id( - _self: LuaReflectRefProxy, - ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone(_self: LuaReflectRefProxy) -> LuaReflectValProxy; + fn from_bytes_le(b: [u8; 16]) -> LuaReflectValProxy; "#, r#" @@ -23077,117 +23048,112 @@ pub struct SmolStr(); "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); + #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; "#, 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()] - fn nil() -> LuaReflectValProxy; + #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] + fn clone(_self: LuaReflectRefProxy) -> LuaReflectValProxy; "#, 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) +/// 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; -/// let uuid = Uuid::max(); -/// assert_eq!( -/// "ffffffff-ffff-ffff-ffff-ffffffffffff", -/// uuid.hyphenated().to_string(), -/// ); +/// # 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()] - fn max() -> LuaReflectValProxy; + fn get_version_num(_self: LuaReflectRefProxy) -> usize; "#, r#" -/// Creates a UUID from a 128bit value. +/// Returns a 128bit value containing the value. +/// The bytes in the UUID will be packed directly into a `u128`. /// # Examples -/// Basic usage: /// ``` /// # use uuid::Uuid; -/// let v = 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8u128; -/// let uuid = Uuid::from_u128(v); +/// # 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_u128(), +/// 0xa1a2a3a4b1b2c1c2d1d2d3d4d5d6d7d8, /// ); +/// # Ok(()) +/// # } /// ``` #[lua()] - fn from_u128(v: u128) -> LuaReflectValProxy; + fn as_u128(_self: LuaReflectRefProxy) -> 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()] - fn from_u128_le(v: u128) -> LuaReflectValProxy; + fn to_u128_le(_self: LuaReflectRefProxy) -> 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()] - fn from_u64_pair(high_bits: u64, low_bits: u64) -> LuaReflectValProxy; + fn as_u64_pair(_self: LuaReflectRefProxy) -> (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, @@ -23196,52 +23162,86 @@ pub struct SmolStr(); /// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, /// ]; /// let uuid = Uuid::from_bytes(bytes); +/// assert_eq!(bytes, uuid.into_bytes()); +/// ``` + + #[lua()] + fn into_bytes(_self: LuaReflectValProxy) -> [u8; 16]; + +"#, + 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.hyphenated().to_string(), -/// "a1a2a3a4-b1b2-c1c2-d1d2-d3d4d5d6d7d8" +/// uuid.to_bytes_le(), +/// ([ +/// 0xa4, 0xa3, 0xa2, 0xa1, 0xb2, 0xb1, 0xc2, 0xc1, 0xd1, 0xd2, +/// 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8 +/// ]) /// ); /// # Ok(()) /// # } /// ``` #[lua()] - fn from_bytes(bytes: [u8; 16]) -> LuaReflectValProxy; + fn to_bytes_le(_self: LuaReflectRefProxy) -> [u8; 16]; "#, r#" -/// Creates a UUID using the supplied bytes in little endian order. -/// The individual fields encoded in the buffer will be flipped. +/// Tests if the UUID is nil (all zeros). + + #[lua()] + fn is_nil(_self: LuaReflectRefProxy) -> bool; + +"#, + r#" +/// Tests if the UUID is max (all ones). + + #[lua()] + fn is_max(_self: LuaReflectRefProxy) -> 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: /// ``` -/// # 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::nil(); /// assert_eq!( -/// "a4a3a2a1-b2b1-c2c1-d1d2-d3d4d5d6d7d8", -/// uuid.hyphenated().to_string(), +/// 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" /// ); -/// # Ok(()) -/// # } /// ``` #[lua()] - fn from_bytes_le(b: [u8; 16]) -> LuaReflectValProxy; + 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(as_trait = "std::cmp::PartialEq::", composite = "eq")] - fn eq( + #[lua()] + fn get_node_id( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; "#, r#" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs index 34b1e2fd95..88b67bcdc6 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs @@ -68,6 +68,18 @@ pub struct Real {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" /// Creates a new timer with a given duration in seconds. @@ -317,18 +329,6 @@ pub struct Real {} _self: LuaReflectRefProxy, ) -> u32; -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - "#, r#" @@ -353,14 +353,6 @@ pub struct Timer {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", @@ -378,6 +370,14 @@ pub struct Timer {} _self: LuaReflectRefProxy, ) -> (); +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -414,6 +414,22 @@ pub struct Virtual {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" /// Create a new unpaused `Stopwatch` with no elapsed time. /// # Examples /// ``` @@ -526,14 +542,6 @@ pub struct Virtual {} #[lua()] fn reset(_self: LuaReflectRefMutProxy) -> (); -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -543,14 +551,6 @@ pub struct Virtual {} other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs index 9ce8f17e40..c860da7422 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs @@ -24,35 +24,35 @@ use crate::{ bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( - as_trait = "std::ops::Mul::", + as_trait = "std::ops::Mul::", composite = "mul", )] fn mul( _self: LuaReflectValProxy, - transform: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; "#, r#" #[lua( - as_trait = "std::ops::Mul::", + as_trait = "std::ops::Mul::", composite = "mul", )] fn mul( _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, + transform: LuaReflectValProxy, ) -> LuaReflectValProxy; "#, @@ -153,32 +153,6 @@ pub struct GlobalTransform(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - )] - fn mul( - _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, - ) -> LuaReflectValProxy; - -"#, - 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. @@ -278,10 +252,28 @@ pub struct GlobalTransform(); "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + )] + fn mul( + _self: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -295,6 +287,14 @@ pub struct GlobalTransform(); transform: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs deleted file mode 100644 index 1814800abc..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_window.rs +++ /dev/null @@ -1,1987 +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::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::CursorEntered", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CursorEntered { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::CursorLeft", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CursorLeft { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::CursorMoved", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CursorMoved { - window: ReflectReference, - position: ReflectReference, - delta: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::FileDragAndDrop", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct FileDragAndDrop {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::Ime", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Ime {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::MonitorSelection", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct MonitorSelection {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::Window", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Setting to true will attempt to maximize the window. -/// Setting to false will attempt to un-maximize the window. - - #[lua()] - fn set_maximized( - _self: LuaReflectRefMutProxy, - maximized: bool, - ) -> (); - -"#, - r#" -/// Setting to true will attempt to minimize the window. -/// Setting to false will attempt to un-minimize the window. - - #[lua()] - fn set_minimized( - _self: LuaReflectRefMutProxy, - 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()] - fn start_drag_move( - _self: LuaReflectRefMutProxy, - ) -> (); - -"#, - r#" -/// The window's client area width in logical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua()] - fn width(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// The window's client area height in logical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua()] - fn height(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// The window's client area width in physical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua()] - fn physical_width(_self: LuaReflectRefProxy) -> u32; - -"#, - r#" -/// The window's client area height in physical pixels. -/// See [`WindowResolution`] for an explanation about logical/physical sizes. - - #[lua()] - fn physical_height(_self: LuaReflectRefProxy) -> u32; - -"#, - r#" -/// The window's scale factor. -/// Ratio of physical size to logical size, see [`WindowResolution`]. - - #[lua()] - fn scale_factor(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Window { - cursor_options: bevy::window::CursorOptions, - present_mode: bevy::window::PresentMode, - mode: bevy::window::WindowMode, - position: bevy::window::prelude::WindowPosition, - resolution: bevy::window::WindowResolution, - title: std::string::String, - name: std::option::Option, - composite_alpha_mode: bevy::window::CompositeAlphaMode, - resize_constraints: bevy::window::prelude::WindowResizeConstraints, - resizable: bool, - enabled_buttons: bevy::window::EnabledButtons, - decorations: bool, - transparent: bool, - focused: bool, - window_level: bevy::window::WindowLevel, - canvas: std::option::Option, - fit_canvas_to_parent: bool, - prevent_default_event_handling: bool, - internal: bevy::window::InternalWindowState, - ime_enabled: bool, - ime_position: ReflectReference, - window_theme: ReflectReference, - visible: bool, - skip_taskbar: bool, - desired_maximum_frame_latency: ReflectReference, - recognize_pinch_gesture: bool, - recognize_rotation_gesture: bool, - recognize_doubletap_gesture: bool, - recognize_pan_gesture: ReflectReference, - 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_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::WindowMoved", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowMoved { - window: ReflectReference, - position: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::WindowPosition", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Set the window to a specific monitor. - - #[lua()] - fn center( - _self: LuaReflectRefMutProxy, - monitor: LuaReflectValProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowPosition {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::prelude::WindowResizeConstraints", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Checks if the constraints are valid. -/// Will output warnings if it isn't. - - #[lua()] - fn check_constraints( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowResizeConstraints { - min_width: f32, - min_height: f32, - max_width: f32, - max_height: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowEvent {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowResized", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowResized { - window: ReflectReference, - width: f32, - height: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowCreated", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowCreated { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowClosing", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowClosing { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowClosed", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowClosed { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowCloseRequested", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowCloseRequested { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowDestroyed", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowDestroyed { - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::RequestRedraw", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RequestRedraw {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowFocused", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowFocused { - window: ReflectReference, - focused: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowOccluded", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowOccluded { - window: ReflectReference, - occluded: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowScaleFactorChanged", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowScaleFactorChanged { - window: ReflectReference, - scale_factor: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowBackendScaleFactorChanged", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowBackendScaleFactorChanged { - window: ReflectReference, - scale_factor: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowThemeChanged", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowThemeChanged { - window: ReflectReference, - theme: bevy::window::WindowTheme, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::AppLifecycle", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Return `true` if the app can be updated. - - #[lua()] - fn is_active(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AppLifecycle {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::PrimaryWindow", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct PrimaryWindow {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowTheme", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowTheme {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::Monitor", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Monitor { - name: std::option::Option, - physical_height: u32, - physical_width: u32, - physical_position: ReflectReference, - refresh_rate_millihertz: std::option::Option, - scale_factor: f64, - video_modes: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::VideoMode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct VideoMode { - physical_size: ReflectReference, - bit_depth: u16, - refresh_rate_millihertz: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::PrimaryMonitor", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct PrimaryMonitor {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::SystemCursorIcon", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct SystemCursorIcon {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowRef", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowRef {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::NormalizedWindowRef", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct NormalizedWindowRef(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::CursorOptions", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CursorOptions { - visible: bool, - grab_mode: bevy::window::CursorGrabMode, - hit_test: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::PresentMode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct PresentMode {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowMode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowMode {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowResolution", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new [`WindowResolution`]. - - #[lua()] - fn new( - physical_width: f32, - physical_height: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Builder method for adding a scale factor override to the resolution. - - #[lua()] - fn with_scale_factor_override( - _self: LuaReflectValProxy, - scale_factor_override: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The window's client area width in logical pixels. - - #[lua()] - fn width(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// The window's client area height in logical pixels. - - #[lua()] - fn height(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// The window's client area width in physical pixels. - - #[lua()] - fn physical_width(_self: LuaReflectRefProxy) -> u32; - -"#, - r#" -/// The window's client area height in physical pixels. - - #[lua()] - fn physical_height(_self: LuaReflectRefProxy) -> u32; - -"#, - r#" -/// The ratio of physical pixels to logical pixels. -/// `physical_pixels = logical_pixels * scale_factor` - - #[lua()] - fn scale_factor(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// The window scale factor as reported by the window backend. -/// This value is unaffected by [`WindowResolution::scale_factor_override`]. - - #[lua()] - fn base_scale_factor( - _self: LuaReflectRefProxy, - ) -> 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()] - fn scale_factor_override( - _self: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -/// Set the window's logical resolution. - - #[lua()] - fn set( - _self: LuaReflectRefMutProxy, - 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()] - fn set_physical_resolution( - _self: LuaReflectRefMutProxy, - width: u32, - height: u32, - ) -> (); - -"#, - r#" -/// Set the window's scale factor, this may get overridden by the backend. - - #[lua()] - fn set_scale_factor( - _self: LuaReflectRefMutProxy, - 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()] - fn set_scale_factor_and_apply_to_physical_size( - _self: LuaReflectRefMutProxy, - 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()] - fn set_scale_factor_override( - _self: LuaReflectRefMutProxy, - scale_factor_override: std::option::Option, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowResolution {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::CompositeAlphaMode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CompositeAlphaMode {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::EnabledButtons", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct EnabledButtons { - minimize: bool, - maximize: bool, - close: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::WindowLevel", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct WindowLevel {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::InternalWindowState", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Consumes the current maximize request, if it exists. This should only be called by window backends. - - #[lua()] - fn take_maximize_request( - _self: LuaReflectRefMutProxy, - ) -> std::option::Option; - -"#, - r#" -/// Consumes the current minimize request, if it exists. This should only be called by window backends. - - #[lua()] - fn take_minimize_request( - _self: LuaReflectRefMutProxy, - ) -> std::option::Option; - -"#, - r#" -/// Consumes the current move request, if it exists. This should only be called by window backends. - - #[lua()] - fn take_move_request( - _self: LuaReflectRefMutProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct InternalWindowState {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::window::CursorGrabMode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CursorGrabMode {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance( - "WindowResolution", - crate::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -fn bevy_window_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyWindowScriptingPlugin; -impl bevy::app::Plugin for BevyWindowScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_window_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::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::() - .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::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs index 8354d705cc..e7ab476ca8 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/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,12 +9,10 @@ pub mod bevy_input; pub mod bevy_core; pub mod bevy_time; pub mod bevy_hierarchy; -pub mod bevy_window; pub mod bevy_reflect; pub struct LuaBevyScriptingPlugin; impl bevy::app::Plugin for LuaBevyScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { - bevy_a11y::BevyA11YScriptingPlugin.build(app); bevy_ecs::BevyEcsScriptingPlugin.build(app); bevy_transform::BevyTransformScriptingPlugin.build(app); bevy_math::BevyMathScriptingPlugin.build(app); @@ -23,7 +20,6 @@ impl bevy::app::Plugin for LuaBevyScriptingPlugin { bevy_core::BevyCoreScriptingPlugin.build(app); bevy_time::BevyTimeScriptingPlugin.build(app); bevy_hierarchy::BevyHierarchyScriptingPlugin.build(app); - bevy_window::BevyWindowScriptingPlugin.build(app); bevy_reflect::BevyReflectScriptingPlugin.build(app); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/docs.rs b/crates/languages/bevy_mod_scripting_lua/src/docs.rs index 0779afa1d0..e783d4f5b4 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/docs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/docs.rs @@ -1,14 +1,17 @@ +use core::str; use std::{ + borrow::Cow, env, fs::{self, File}, io::Write, + ops::Deref, process::Command, }; //use bevy::asset::FileAssetIo; use bevy::asset::io::file::FileAssetReader; use bevy_mod_scripting_core::prelude::*; -use tealr::{TypeGenerator, TypeWalker}; +use tealr::{NameContainer, TypeGenerator, TypeWalker}; pub type TypeWalkerBuilder = fn(TypeWalker) -> TypeWalker; From d11ff2abafeed91a51a1ae8629df81666c90dcae Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 6 Dec 2024 19:28:59 +0000 Subject: [PATCH 036/217] WIP, refactor things --- .../src/bindings/reference.rs | 44 ++++- .../src/reflection_extensions.rs | 10 +- .../src/bindings/reference.rs | 147 +++++++---------- .../bevy_mod_scripting_lua/src/type_data.rs | 152 +----------------- 4 files changed, 101 insertions(+), 252 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 13305542ae..61ff18b24a 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -6,6 +6,8 @@ //! we need wrapper types which have owned and ref variants. use lockable::LockableHashMap; +pub use itertools::Either; + use std::{ any::TypeId, cell::UnsafeCell, @@ -28,7 +30,7 @@ use bevy::{ }, ptr::Ptr, reflect::{ - Access, DynamicEnum, DynamicTuple, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, TypeInfo, TypeRegistry + Access, DynamicEnum, DynamicTuple, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, TypeData, TypeInfo, TypeRegistry }, }; use smallvec::SmallVec; @@ -203,6 +205,38 @@ impl ReflectReference { reflect } + /// convenience for: + /// - retrieving the type id at the tip of the reference + /// - retrieving the type data for that type id if it exists + /// - calling the function with the type data if it exists + /// - or calling the function with [`self`] only if the type data does not exist + pub fn map_type_data(self, world: &WorldAccessGuard, map: F) -> ScriptResult + where + F: FnOnce(Self, Option>) -> O, + D: TypeData + Clone, + D2: TypeData + Clone, + { + if let Some(type_id) = self.with_reflect(&world, |r, _, _| { + r.get_represented_type_info().map(|t| t.type_id()) + })? { + + if let Some(type_data) = world.with_resource(|_, type_registry: Mut| { + let type_registry = type_registry.read(); + type_registry.get_type_data::(type_id).cloned() + }) { + return Ok(map(self, Some(Either::Left(type_data)))); + } else if let Some(type_data) = world.with_resource(|_, type_registry: Mut| { + let type_registry = type_registry.read(); + type_registry.get_type_data::(type_id).cloned() + }) { + return Ok(map(self, Some(Either::Right(type_data)))); + } + } + + Ok(map(self, None)) + } + + /// Returns `Ok(())` if the given access is sufficient to read the value or an appropriate error otherwise pub fn expect_read_access<'w>( &self, @@ -255,7 +289,7 @@ impl ReflectReference { self.expect_read_access(access, type_registry, allocator, world)?; // Safety: since we have read access to the underlying componentId we can safely access the component // and we can return a reference tied to its lifetime, which will prevent invalid aliasing - return unsafe { self.reflect_unsafe(world, type_registry, allocator) }; + unsafe { self.reflect_unsafe(world, type_registry, allocator) } } /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell. @@ -272,7 +306,7 @@ impl ReflectReference { self.expect_write_access(access, type_registry, allocator, world)?; // Safety: since we have write access to the underlying reflect access id we can safely access the component // and we can return a reference tied to its lifetime, which will prevent invalid aliasing - return unsafe { self.reflect_mut_unsafe(world, type_registry, allocator) }; + unsafe { self.reflect_mut_unsafe(world, type_registry, allocator) } } /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell @@ -416,9 +450,9 @@ impl ReflectBaseType { let type_name = Self::type_name(self.type_id, type_registry); let kind = match self.base_id { - ReflectBase::Component(entity, _) => "Component", + ReflectBase::Component(_, _) => "Component", ReflectBase::Resource(_) => "Resource", - ReflectBase::Owned(id) => "Allocation", + ReflectBase::Owned(_) => "Allocation", }; format!("{}({})", kind, type_name) diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index ad2ec4dd1f..5cb90a5bda 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -1,6 +1,6 @@ use std::{any::TypeId, cmp::max}; -use bevy::reflect::{List, PartialReflect}; +use bevy::reflect::{FromType, List, PartialReflect, TypeData}; use itertools::Itertools; use crate::error::ScriptError; @@ -39,11 +39,11 @@ pub trait PartialReflectExt { fn insert_at(&mut self, index: usize, value: Box) -> Result<(), ScriptError>; } pub trait TypeIdExtensions { - fn type_id_or_dummy(&self) -> TypeId; + fn type_id_or_fake_id(&self) -> TypeId; } impl TypeIdExtensions for Option { - fn type_id_or_dummy(&self) -> TypeId { + fn type_id_or_fake_id(&self) -> TypeId { struct UknownType; match self { Some(t) => *t, @@ -189,13 +189,11 @@ impl PartialReflectExt for T { } - - - #[cfg(test)] mod test { use super::*; + #[test] fn test_type_no_crate() { assert!(42.is_type(None, "i32")); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 17908091a3..32296e6101 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -9,7 +9,7 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, Unproxy, + Either, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, Unproxy, WorldCallbackAccess, }, error::ScriptError, @@ -54,99 +54,64 @@ impl LuaReflectReference { pub fn to_lua_proxy(self, lua: &Lua) -> Result, mlua::Error> { // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, let world = lua.get_world(); - // TODO: i don't like the pingponging between errors here, need something more ergonomic - // first we need the type id of the pointed to object to figure out how to work with it - let type_id = self.0.with_reflect(&world, |r, _, _| { - r.get_represented_type_info().map(|t| t.type_id()) - })?; - - // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever - // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. - struct Dummy; - let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); - - if let Some(type_data) = world.with_resource::(|_, type_registry| { - type_registry - .read() - .get_type_data::(type_id_or_dummy) - .cloned() - }) { - self.0 - .with_reflect(&world, |r, _, _| (type_data.into_value)(r, lua))? - } else if let Some(type_data) = - world.with_resource::(|_, type_registry| { - type_registry - .read() - .get_type_data::(type_id_or_dummy) - .cloned() - }) - { - Ok((type_data.into_proxy)(self.0.clone(), lua)?) - } else { - Ok(self.clone().into_lua(lua)?) - } + + self.0.map_type_data( + &world, + |self_, type_data: Option>| match type_data { + Some(Either::Left(value_data)) => { + self_.with_reflect(&world, |r, _, _| (value_data.into_value)(r, lua))? + } + Some(Either::Right(proxy_data)) => Ok((proxy_data.into_proxy)(self_, lua)?), + None => Ok(LuaReflectReference(self_).into_lua(lua)?), + }, + )? } - pub fn set_with_lua_proxy(&self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { + pub fn set_with_lua_proxy(self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { bevy::log::debug!("Setting lua reflect reference with value: {:?}", value); let world = lua.get_world(); - let type_id = self.0.with_reflect(&world, |r, _, _| { - r.get_represented_type_info().map(|t| t.type_id()) - })?; - - // convenience, ideally we probably should just avoid lookups when no type id is here, but for now we just use a dummy type nothing will ever - // be registered for. If the type we're reflecting doesn't represent anything or a registered type, we use a generic reflect reference. - struct Unknown; - let type_id_or_dummy = type_id.unwrap_or(TypeId::of::()); - - if let Some(type_data) = world.with_resource::(|_, type_registry| { - type_registry - .read() - .get_type_data::(type_id_or_dummy) - .cloned() - }) { - bevy::log::debug!("Setting value with ReflectLuaValue registration"); - let other = (type_data.from_value)(value, lua)?; - self.0.with_reflect_mut(&world, |r, _, _| { - r.try_apply(other.as_partial_reflect()) - .map_err(ScriptError::new_reflection_error) - })??; - } else if let Some(type_data) = - world.with_resource::(|_, type_registry| { - type_registry - .read() - .get_type_data::(type_id_or_dummy) - .cloned() - }) - { - bevy::log::debug!("Setting value with ReflectLuaProxied registration"); - let other = (type_data.from_proxy)(value, lua)?; - let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; - // now we can set it - self.0.with_reflect_mut(&world, |r, _, _| { - if let Some(set) = type_data.opt_set { - set(r, other) - } else { - r.try_apply(other.as_partial_reflect()) - .map_err(ScriptError::new_reflection_error)?; - Ok(()) - } - })??; - } else { - bevy::log::debug!("No registration found, throwing error"); - // we don't know how to assign the value - // prod to see if it's a common container (i.e. Option or Vec) - world.with_resource::(|_,type_registry| { - let type_registry = type_registry.read(); - Err(ScriptError::new_runtime_error(format!( - "Invalid assignment `{:?}` = `{:?}`. The underlying type does: `{}` not support assignment.", - self.0.print_with_type_registry(&type_registry), - value, - type_registry.get_type_info(type_id_or_dummy).map(|t| t.type_path()).unwrap_or_else(|| "Unknown") + + self.0.map_type_data( + &world.clone(), + move |self_, type_data: Option>| { + // let world = world.clone(); // move copy into closure + match type_data { + Some(Either::Left(value_data)) => { + let other = (value_data.from_value)(value, lua)?; + self_.with_reflect_mut(&world, |r, _, _| { + r.try_apply(other.as_partial_reflect()) + .map_err(ScriptError::new_reflection_error) + })? + } + Some(Either::Right(proxy_data)) => { + let other = (proxy_data.from_proxy)(value, lua)?; + let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; + // now we can set it + self_.with_reflect_mut(&world, |r, _, _| { + if let Some(set) = proxy_data.opt_set { + set(r, other) + } else { + r.try_apply(other.as_partial_reflect()) + .map_err(ScriptError::new_reflection_error)?; + Ok(()) + } + })? + } + None => { + world.with_resource(|_, type_registry: Mut| { + let type_registry = type_registry.read(); + Err(ScriptError::new_runtime_error(format!( + "Invalid assignment `{:?}` = `{:?}`. The underlying type does not support assignment.", + self_.print_with_type_registry(&type_registry), + value ))) - })?; - }; + })?; + Ok(()) + }, + } + }, + )??; Ok(()) } @@ -250,8 +215,10 @@ impl TealData for LuaReflectReference { m.add_function_mut( "insert", - |l, (mut self_, key): (LuaReflectReference, usize, LuaReflect)| { - self_.0.insert_at(key, l.get_world()) + |l, (mut self_, key): (LuaReflectReference, usize, Value)| { + // check target type for a from_lua function + // let world = l.get_world(); + // self.0. }, ); diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index 5abd838a5f..5ce02152d5 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -215,54 +215,10 @@ impl ReflectLuaProxied { // let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); Self { into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), - // from_proxy: Arc::new(|v, l| { - // // if it's a table, set existing elements using underlying from proxy - // // if it's a ref, return the ref - - // if let Value::Table(t) = v { - // let ts = t.sequence_values::(); - // for e in ts { - // let v = e?; - // let elem_ref = (from_proxy_clone)(v, l)?; - // } - // } else { - // LuaReflectReference::from_lua(v, l) - // } - // }), from_proxy: Arc::new(|v, l| { - // can either be a table or a direct ref - // construct dynamic vec either way - // if let Value::Table(t) = v { - // for v in t.sequence_values::() { - // let lua_elem = v?; - // } - // } else { - // todo!() - // } todo!() }), - opt_set: todo!(), // set_from_proxy: todo!(), // set_from_proxy: Arc::new(|r, v, l| { - // // let table = if let Value::Table(t) = v { - // // t - // // } else { - // // return Err(tealr::mlu::mlua::Error::external( - // // ScriptError::new_runtime_error(format!( - // // "Cannot set value of type `{}` via type: `{}`. Expected table", - // // v.type_name(), - // // "List", - // // )), - // // )); - // // }; - - // // let lua_values = table.sequence_values().collect::, _>>()?; - - // // let converted_values = lua_values - // // .into_iter() - // // .map(|v| (from_proxy)(v, lua)) - // // .collect::, _>>()?; - - // // let target_list = r.as_list().map_err(tealr::mlu::mlua::Error::external)?; - // // }), + opt_set: todo!(), } } } @@ -277,15 +233,6 @@ where into_proxy: Arc::new(|p, l| T::Proxy::from(p).into_lua(l)), from_proxy: Arc::new(|v, l| T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone())), opt_set: None, - // set_from_proxy: Arc::new(|r, v, l| { - // let proxy = T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone())?; - // let world = l.get_world(); - // proxy.with_reflect(&world, |other, _, _| { - // r.apply(other); - // Ok::<_, tealr::mlu::mlua::Error>(()) - // })?; - // Ok(()) - // }), } } } @@ -300,16 +247,6 @@ pub struct ReflectLuaValue { + Sync + 'static, >, - // pub set_value: Arc< - // dyn for<'l> Fn( - // &mut dyn PartialReflect, - // Value<'l>, - // &'l Lua, - // ) -> Result<(), tealr::mlu::mlua::Error> - // + Send - // + Sync - // + 'static, - // >, pub from_value: Arc< dyn for<'l> Fn( Value<'l>, @@ -371,95 +308,8 @@ impl ReflectLuaValue { Ok(Box::new(dynamic_option)) }), - // set_value: Arc::new(move |r, v, l| { - // let dynamic = Self::dynamic_option_from_value(v, l, &from_value_clone)?; - // r.apply(&dynamic); - // Ok(()) - // }), } } - - // fn dynamic_list_from_value<'lua>( - // v: Value<'lua>, - // lua: &'lua Lua, - // from_value: &Arc< - // dyn for<'l> Fn( - // Value<'l>, - // &'l Lua, - // ) - // -> Result, tealr::mlu::mlua::Error> - // + Send - // + Sync - // + 'static, - // >, - // ) -> Result { - // let table = if let Value::Table(t) = v { - // t - // } else { - // return Err(tealr::mlu::mlua::Error::external( - // ScriptError::new_runtime_error(format!( - // "Cannot set value of type `{}` via type: `{}`. Expected table", - // v.type_name(), - // "List", - // )), - // )); - // }; - - // let lua_values = table.sequence_values().collect::, _>>()?; - - // let converted_values = lua_values - // .into_iter() - // .map(|v| (from_value)(v, lua)) - // .collect::, _>>()?; - // let dynamic_type = DynamicList::from_iter(converted_values); - // // TODO: set the represented type, need to pass type info - // // dynamic_type.set_represented_type(represented_type); - // Ok(dynamic_type) - // } - - // pub fn new_for_list(inner_reflect_lua_value: &ReflectLuaValue) -> Self { - // let into_value_clone = inner_reflect_lua_value.into_value.clone(); - // let from_value_clone = inner_reflect_lua_value.from_value.clone(); - // let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); - // Self { - // into_value: Arc::new(move |r, l| { - // let inner = r.as_list().map_err(tealr::mlu::mlua::Error::external)?; - // let inner = inner - // .map(|i| (into_value_clone)(i, l)) - // .collect::, _>>()?; - - // let t = l.create_table_from( - // inner - // .into_iter() - // .enumerate() - // .map(|(i, v)| (Value::Integer(i as i64 + 1), v)), - // )?; - - // Ok(Value::Table(t)) - // }), - // set_value: Arc::new(move |r, v, l| { - // let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone)?; - - // // apply will not remove excess elements - // if let ReflectMut::List(list) = r.reflect_mut() { - // if dynamic.len() < list.len() { - // (dynamic.len()..list.len()).rev().for_each(|i| { - // list.remove(i); - // }); - // } - // } - // println!("reflect: {:?}", r); - // println!("dynamic: {:?}", dynamic); - - // r.apply(&dynamic); - // Ok(()) - // }), - // from_value: Arc::new(move |v, l| { - // let dynamic = Self::dynamic_list_from_value(v, l, &from_value_clone2)?; - // Ok(Box::new(dynamic)) - // }), - // } - // } } impl IntoLua<'l> + for<'l> FromLua<'l>> FromType From 29b9e6fb1646e080476cb4eba9bb57aa1f3bfa98 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 7 Dec 2024 18:43:38 +0000 Subject: [PATCH 037/217] Finish generic implementations for insert,pop,clear etc.. --- assets/scripts/bevy_api.lua | 34 +- .../src/bindings/allocator.rs | 62 ++- .../src/bindings/reference.rs | 415 ++++++++++++++++-- .../src/reflection_extensions.rs | 143 +++++- .../src/bindings/providers/bevy_reflect.rs | 2 +- .../src/bindings/reference.rs | 161 +++++-- .../bevy_mod_scripting_lua/src/type_data.rs | 7 +- examples/lua/bevy_api.rs | 3 + 8 files changed, 723 insertions(+), 104 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index c8748f0026..58600ff33c 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -38,6 +38,14 @@ function on_event() print(table_to_string(comp.vec_of_usize)) comp.vec_of_usize = comp.vec_of_usize print(table_to_string(comp.vec_of_usize)) + comp.vec_of_usize:insert(1, 42) + print(table_to_string(comp.vec_of_usize)) + + print("\nmap") + -- print(comp.map_of_strings["key"]) + comp.map_of_strings:insert("key2", "value") + -- print(comp.map_of_strings["key2"]) + print("============") @@ -75,6 +83,8 @@ function on_event() comp.vec_of_option_bools:insert(1,nil) print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) + + print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) comp.vec_of_option_bools:push(false) print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) @@ -82,7 +92,7 @@ function on_event() print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) - print(comp.vec_of_option_bools:pop()) + print(comp.vec_of_option_bools:pop():print_value()) print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) print("the pairs inside comp.vec_of_option_bools: ") @@ -90,27 +100,14 @@ function on_event() print(string.format(" - %s:%s",k,v)) end + comp.vec_of_option_bools:clear() print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) - print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) - print("============") - - print("comp.option_vec_of_bools before: ", table_to_string(comp.option_vec_of_bools)) - print(comp.option_vec_of_bools:pop()) - print("comp.option_vec_of_bools after pop: ", table_to_string(comp.option_vec_of_bools)) - - - print("comp.option_vec_of_bools len after pop: ", #comp.option_vec_of_bools) - - print("the pairs inside comp.option_vec_of_bools: ") - for k,v in pairs(comp.option_vec_of_bools) do - print(string.format(" - %s:%s",k,v)) - end print("============") - local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3.x_axis + local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1] print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) @@ -121,8 +118,11 @@ function on_event() comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() comp.vec2 = Vec2.new(2,1) comp.quat = Quat.from_xyzw(3,2,1,4) - comp.mat3.x_axis = Vec3.new(69,69,69) + comp.mat3[1] = Vec3.new(69,69,69) + + world:exit() + do return end print("============") -- this is an example of something impossible to achieve with plain bevy reflection under the hood diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index b338950ec2..e9c66f83ba 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -14,18 +14,54 @@ impl ReflectAllocationId { } } +/// Pointer which owns the value it points to, and will deallocate it when dropped +#[derive(Debug)] +pub struct OwningPtr { + ptr: *mut T, +} + +impl OwningPtr { + /// Creates a new OwningPtr from a raw pointer + /// # Safety + /// The pointer must come from a Box::leak call, and no more than one OwningPtr can exist for a given pointer + pub unsafe fn new(ptr: *mut T) -> Self { + Self { ptr } + } +} + +impl Drop for OwningPtr { + fn drop(&mut self) { + unsafe { + // Safety: we own the pointer, only one OwningPtr can exist for a given pointer + let _ = Box::from_raw(self.ptr); + } + } +} + +// yikes, the indirection. I need this to store boxed values too though #[derive(Clone, Debug)] -pub struct ReflectAllocation(pub(self) Arc>); +pub enum ReflectAllocation { + Double(Arc>), + Single(Arc>), +} unsafe impl Send for ReflectAllocation {} unsafe impl Sync for ReflectAllocation {} impl ReflectAllocation { pub fn get_ptr(&self) -> *mut dyn PartialReflect { - self.0.get() + match self { + ReflectAllocation::Double(v) => v.ptr, + ReflectAllocation::Single(v) => v.get(), + } } pub fn new(value: Arc>) -> Self { - Self(value) + Self::Single(value) + } + + pub fn new_boxed(value: Box) -> Self { + let ptr = Box::leak::<'static>(value); + Self::Double(Arc::new(unsafe { OwningPtr::new(ptr) })) } } @@ -62,6 +98,21 @@ impl ReflectAllocator { (id, value) } + pub fn allocate_boxed( + &mut self, + value: Box, + ) -> (ReflectAllocationId, ReflectAllocation) { + let type_id = value.get_represented_type_info().map(|i| i.type_id()); + + let id = ReflectAllocationId(self.allocations.len()); + let value = ReflectAllocation::new_boxed(value); + self.allocations.insert(id, value.clone()); + if let Some(type_id) = type_id { + self.types.insert(id, type_id); + } + (id, value) + } + // /// Moves the given boxed [`PartialReflect`] value into the allocator, returning an [`AllocationId`] which can be used to access it later // pub fn allocate_boxed( // &mut self, @@ -105,7 +156,10 @@ impl ReflectAllocator { /// Runs a garbage collection pass on the allocations, removing any allocations which have no more strong references /// Needs to be run periodically to prevent memory leaks pub fn clean_garbage_allocations(&mut self) { - self.allocations.retain(|_, v| Arc::strong_count(&v.0) > 1); + self.allocations.retain(|_, v| match v { + ReflectAllocation::Single(v) => Arc::strong_count(v) > 1, + ReflectAllocation::Double(v) => Arc::strong_count(v) > 1, + }); } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 61ff18b24a..e86479d4b1 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -4,6 +4,7 @@ //! reflection gives us access to `dyn PartialReflect` objects via their type name, //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. +use itertools::Itertools; use lockable::LockableHashMap; pub use itertools::Either; @@ -30,7 +31,7 @@ use bevy::{ }, ptr::Ptr, reflect::{ - Access, DynamicEnum, DynamicTuple, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath, ReflectPathError, TypeData, TypeInfo, TypeRegistry + Access, AccessError, DynamicEnum, DynamicTuple, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectMut, ReflectPath, ReflectPathError, ReflectRef, TypeData, TypeInfo, TypeRegistry }, }; use smallvec::SmallVec; @@ -57,6 +58,17 @@ pub struct ReflectReference { pub reflect_path: Vec, } +/// Specifies where we should source the type id from when reflecting a ReflectReference +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum TypeIdSource { + /// Use the type id the reference points to after walking the path + Tail, + /// Given the Tail referene is a container type, use the type id of the elements in the container + Element, + /// Givent the Tail reference is a container type, use the type id of the keys of the container + Key, +} + impl ReflectReference { @@ -65,30 +77,6 @@ impl ReflectReference { ReflectRefIter::new_indexed(self) } - /// Attempts to insert into the reflected value, if the underlying supports inserting at usize indices - pub fn insert_at(&mut self, world: &WorldAccessGuard, index: usize, elem: ReflectReference) -> ScriptResult<()> { - self.with_reflect_mut(world, |target, type_registry, allocator| { - elem.with_reflect_only(world, type_registry, allocator, |other,_,_| { - target.insert_at(index, other.clone_value()) - })? - })??; - Ok(()) - } - - /// Prints the reference using the world to resolve type names. - pub fn print_with_world(&self, world: &WorldAccessGuard) -> String { - world.with_resource(|_, type_registry: Mut| { - let type_registry = type_registry.read(); - self.print_with_type_registry(&type_registry) - }) - } - - /// Prints the reference using the type registry to resolve type names. Prefer this over [`Self::print_with_world`] if you have a type registry available. - pub fn print_with_type_registry(&self, type_registry: &TypeRegistry) -> String { - let base = self.base.display_with_type_name(type_registry); - format!("Reference(base: {}, path: {:?})", base, self.reflect_path) - } - /// If this is a reference to something with a length accessible via reflection, returns that length. pub fn len(&self, world: &WorldAccessGuard) -> ScriptResult> { self @@ -122,6 +110,21 @@ impl ReflectReference { } } + pub fn new_allocated_boxed( + value: Box, + allocator: &mut ReflectAllocator, + ) -> ReflectReference { + let type_id = value.get_represented_type_info().map(|i| i.type_id()).unwrap_or_else(|| panic!("Type '{}' has no represented type information to allocate with.", std::any::type_name_of_val(value.as_ref()))); + let (id, _) = allocator.allocate_boxed(value); + ReflectReference { + base: ReflectBaseType { + type_id, + base_id: ReflectBase::Owned(id), + }, + reflect_path: Vec::default(), + } + } + /// Indexes into the reflect path inside this reference. /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. pub fn index_path>(&mut self, index: T) { @@ -205,35 +208,55 @@ impl ReflectReference { reflect } - /// convenience for: - /// - retrieving the type id at the tip of the reference - /// - retrieving the type data for that type id if it exists - /// - calling the function with the type data if it exists - /// - or calling the function with [`self`] only if the type data does not exist - pub fn map_type_data(self, world: &WorldAccessGuard, map: F) -> ScriptResult + + fn tail_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + self.with_reflect(world, |r, _, _| { + r.get_represented_type_info().map(|t| t.type_id()) + }) + } + + fn element_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + self.with_reflect(world, |r, _, _| { + r.element_type_id() + }) + } + + fn key_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + self.with_reflect(world, |r, _, _| { + r.key_type_id() + }) + } + + pub fn type_id_of(&self, source: TypeIdSource, world: &WorldAccessGuard) -> ScriptResult> { + match source { + TypeIdSource::Tail => self.tail_type_id(world), + TypeIdSource::Element => self.element_type_id(world), + TypeIdSource::Key => self.key_type_id(world), + } + } + + pub fn map_type_data(type_id: Option, world: &WorldAccessGuard, map: F) -> ScriptResult where - F: FnOnce(Self, Option>) -> O, + F: FnOnce(Option>) -> O, D: TypeData + Clone, D2: TypeData + Clone, { - if let Some(type_id) = self.with_reflect(&world, |r, _, _| { - r.get_represented_type_info().map(|t| t.type_id()) - })? { + if let Some(type_id) = type_id { if let Some(type_data) = world.with_resource(|_, type_registry: Mut| { let type_registry = type_registry.read(); type_registry.get_type_data::(type_id).cloned() }) { - return Ok(map(self, Some(Either::Left(type_data)))); + return Ok(map(Some(Either::Left(type_data)))); } else if let Some(type_data) = world.with_resource(|_, type_registry: Mut| { let type_registry = type_registry.read(); type_registry.get_type_data::(type_id).cloned() }) { - return Ok(map(self, Some(Either::Right(type_data)))); + return Ok(map(Some(Either::Right(type_data)))); } } - Ok(map(self, None)) + Ok(map(None)) } @@ -514,6 +537,24 @@ impl ReflectBase { } } +fn map_key_to_concrete(key: &str, key_type_id: TypeId) -> Option> { + let string_type_id = std::any::TypeId::of::(); + let usize_type_id = std::any::TypeId::of::(); + let f32_type_id = std::any::TypeId::of::(); + let bool_type_id = std::any::TypeId::of::(); + + + match key_type_id { + // string_type_id => Some(Box::new(key.to_owned())), + usize_type_id => key.parse::().ok().map(|u| Box::new(u) as Box), + f32_type_id => key.parse::().ok().map(|f| Box::new(f) as Box), + bool_type_id => key.parse::().ok().map(|b| Box::new(b) as Box), + _ => return None, + } +} + + + /// An element in the reflection path, the base reference included #[derive(Clone, Debug, PartialEq, Eq)] pub enum ReflectionPathElem { @@ -521,6 +562,8 @@ pub enum ReflectionPathElem { Reflection(ParsedPath), /// a deferred reflection DeferredReflection(DeferredReflection), + /// a map access, i.e. a reference to the key in a map + MapAccess(String), /// a no-op reflection, i.e. a reference to the base object, useful identity to have Identity } @@ -573,6 +616,17 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { ReflectionPathElem::Reflection(path) => path.reflect_element(root), ReflectionPathElem::DeferredReflection(f) => (f.get)(root), ReflectionPathElem::Identity => Ok(root), + ReflectionPathElem::MapAccess(key) => { + if let ReflectRef::Map(map) = root.reflect_ref() { + let key_type_id = map.key_type_id().expect("Expected map keys to represent a type to be able to assign values"); + let key = map_key_to_concrete(key, key_type_id) + .ok_or_else(|| ReflectPathError::InvalidDowncast)?; + map.get(key.as_ref()).ok_or_else(|| ReflectPathError::InvalidDowncast) + } else { + Err(ReflectPathError::InvalidDowncast) + } + }, + } } @@ -583,7 +637,18 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { match self { ReflectionPathElem::Reflection(path) => path.reflect_element_mut(root), ReflectionPathElem::DeferredReflection(defref) => (defref.get_mut)(root), - ReflectionPathElem::Identity => Ok(root) + ReflectionPathElem::Identity => Ok(root), + ReflectionPathElem::MapAccess(key) => { + if let ReflectMut::Map(map) = root.reflect_mut() { + let key_type_id = map.key_type_id().expect("Expected map keys to represent a type to be able to assign values"); + let key = map_key_to_concrete(key, key_type_id) + .ok_or_else(|| ReflectPathError::InvalidDowncast)?; + map.get_mut(key.as_ref()).ok_or_else(|| ReflectPathError::InvalidDowncast) + } else { + Err(ReflectPathError::InvalidDowncast) + } + }, + } } } @@ -609,11 +674,11 @@ pub struct DeferredReflection { #[macro_export] macro_rules! new_deferred_reflection { (|$root:ident| {$($get:tt)*}) => { - DeferredReflection::from(( - |$root: &dyn PartialReflect| -> Result<&dyn PartialReflect, ReflectPathError<'static>> { + $crate::bindings::reference::DeferredReflection::from(( + |$root: &dyn PartialReflect| -> Result<&dyn PartialReflect, bevy::reflect::ReflectPathError<'static>> { $($get)* }, - |$root: &mut dyn PartialReflect| -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> { + |$root: &mut dyn PartialReflect| -> Result<&mut dyn PartialReflect, bevy::reflect::ReflectPathError<'static>> { $($get)* }, )) @@ -695,4 +760,270 @@ impl Iterator for ReflectRefIter { Some(result) } +} + +pub struct ReflectReferencePrinter{ + pub(crate) reference: ReflectReference, +} + +#[derive(Clone, Copy, Debug)] +enum BracketType { + Square, + Curly, + Round, +} + +impl BracketType { + + fn open(self) -> char { + match self { + BracketType::Square => '[', + BracketType::Curly => '{', + BracketType::Round => '(', + } + } + + fn close(self) -> char { + match self { + BracketType::Square => ']', + BracketType::Curly => '}', + BracketType::Round => ')', + } + } + + fn surrounded(self, output: &mut String, f: F) { + output.push(self.open()); + f(output); + output.push(self.close()); + } +} + +macro_rules! downcast_case { + ($id:ident, $out:ident, $t:path) => { + { + $out.push_str(stringify!($t)); + $out.push('('); + if let Some($id) = $id.as_partial_reflect().try_downcast_ref::<$t>() { + $out.push_str(&format!("{:?}", $id)); + } else { + $out.push_str(""); + } + $out.push(')'); + } + } +} + +impl ReflectReferencePrinter { + const UNREGISTERED_TYPE: &'static str = ""; + const UNKNOWN_FIELD: &'static str = ""; + + pub fn new(reference: ReflectReference) -> Self { + Self { reference } + } + + /// Given a reflect reference, prints the type path of the reference resolving the type names with short names. + /// I.e. `MyType(Component).field_name[0].field_name[1] -> FieldType::Name` + pub fn pretty_print(&self, world: &WorldAccessGuard) -> String { + let mut pretty_path = String::new(); + + pretty_path.push_str(" format!("Component on entity {e}"), + ReflectBase::Resource(_) => "Resource".to_owned(), + ReflectBase::Owned(_) => "Allocation".to_owned(), + }; + + let tail_type_id = self.reference.tail_type_id(world).ok().flatten(); + + world.with_resource(|_, type_registry : Mut| { + let type_registry = type_registry.read(); + let root_type_path = type_registry.get_type_info(self.reference.base.type_id).map(|t| t.type_path_table().short_path()).unwrap_or(""); + pretty_path.push_str(&format!("{}({})", root_suffix, root_type_path)); + + for elem in self.reference.reflect_path.iter() { + match elem { + ReflectionPathElem::Reflection(path) => { + pretty_path.push_str(&path.to_string()); + } + ReflectionPathElem::DeferredReflection(_) => { + pretty_path.push_str("."); + } + ReflectionPathElem::Identity => { + pretty_path.push_str(""); + } + ReflectionPathElem::MapAccess(key) => { + pretty_path.push_str(&format!("[{}]", key)); + }, + + } + } + + if let Some(tail_type_id) = tail_type_id { + let type_path = type_registry.get_type_info(tail_type_id).map(|t| t.type_path_table().short_path()).unwrap_or(Self::UNREGISTERED_TYPE); + pretty_path.push_str(&format!(" -> {}", type_path)); + } + }); + + pretty_path.push('>'); + + pretty_path + } + + + pub fn pretty_print_value_opaque(&self, v: &dyn PartialReflect, output: &mut String) { + + let type_id = v.get_represented_type_info().map(|t| t.type_id()).type_id_or_fake_id(); + output.push_str("Reflect("); + match type_id { + id if id == TypeId::of::() => downcast_case!(v, output, usize), + id if id == TypeId::of::() => downcast_case!(v, output, isize), + id if id == TypeId::of::() => downcast_case!(v, output, f32), + id if id == TypeId::of::() => downcast_case!(v, output, f64), + id if id == TypeId::of::() => downcast_case!(v, output, u128), + id if id == TypeId::of::() => downcast_case!(v, output, u64), + id if id == TypeId::of::() => downcast_case!(v, output, u32), + id if id == TypeId::of::() => downcast_case!(v, output, u16), + id if id == TypeId::of::() => downcast_case!(v, output, u8), + id if id == TypeId::of::() => downcast_case!(v, output, i128), + id if id == TypeId::of::() => downcast_case!(v, output, i64), + id if id == TypeId::of::() => downcast_case!(v, output, i32), + id if id == TypeId::of::() => downcast_case!(v, output, i16), + id if id == TypeId::of::() => downcast_case!(v, output, i8), + id if id == TypeId::of::() => downcast_case!(v, output, String), + id if id == TypeId::of::() => downcast_case!(v, output, bool), + _ => { + output.push_str(v.get_represented_type_info().map(|t| t.type_path()).unwrap_or(Self::UNREGISTERED_TYPE)); + } + } + output.push(')'); + + } + + /// Prints the actual value of the reference. Tries to use best available method to print the value. + pub fn pretty_print_value(&self, world: &WorldAccessGuard) -> String { + let mut output = String::new(); + + // instead of relying on type registrations, simply traverse the reflection tree and print sensible values + self.reference.with_reflect(world, |r, _, _| { + self.pretty_print_value_inner(r, &mut output); + }).unwrap_or_else(|e| { + output.push_str(&format!("", e)); + }); + + output + } + + fn pretty_print_key_values,V: AsRef,I: IntoIterator,V)>>(bracket: BracketType, i: I, output: &mut String) { + bracket.surrounded(output, |output| { + let mut iter = i.into_iter().peekable(); + while let Some((key, val)) = iter.next() { + if let Some(key) = key { + output.push_str(key.as_ref()); + output.push_str(": "); + } + output.push_str(val.as_ref()); + if iter.peek().is_some() { + output.push_str(", "); + } + } + }); + } + + + fn pretty_print_value_struct<'k,N: Iterator, M: Iterator>(&self, field_names: N, field_values: M, output: &mut String) { + let field_names = field_names.into_iter(); + let fields = field_values.into_iter(); + let fields_iter = fields.zip_longest(field_names).map(|e| { + let (val, name) = match e { + itertools::EitherOrBoth::Both(val, name) => (val, name), + itertools::EitherOrBoth::Left(val) => (val, Self::UNKNOWN_FIELD), + itertools::EitherOrBoth::Right(name) => (().as_partial_reflect(), name), + }; + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (Some(name), field_printed) + }); + Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); + } + + fn pretty_print_value_inner(&self, v: &dyn PartialReflect, output: &mut String) { + match v.reflect_ref() { + bevy::reflect::ReflectRef::Struct(s) => { + let field_names = s.get_represented_struct_info().map(|info| info.field_names()).unwrap_or_default().iter(); + let field_values = s.iter_fields(); + + self.pretty_print_value_struct(field_names.copied(), field_values, output); + + }, + ReflectRef::TupleStruct(t) => { + let fields_iter = t.iter_fields().enumerate().map(|(i, val)| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (Some(i.to_string()), field_printed) + }); + Self::pretty_print_key_values(BracketType::Round, fields_iter, output); + }, + ReflectRef::Tuple(t) => { + let fields_iter = t.iter_fields().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Round, fields_iter, output); + }, + ReflectRef::List(l) => { + let fields_iter = l.iter().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Square, fields_iter, output); + }, + ReflectRef::Array(a) => { + let fields_iter = a.iter().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Square, fields_iter, output); + }, + ReflectRef::Map(m) => { + let fields_iter = m.iter().map(|(key, val)| { + let mut key_printed = String::new(); + self.pretty_print_value_inner(key, &mut key_printed); + + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (Some(key_printed), field_printed) + }); + Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); + }, + ReflectRef::Set(s) => { + let fields_iter = s.iter().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); + }, + ReflectRef::Enum(e) => { + output.push_str(&e.variant_path()); + let bracket_type = match e.variant_type() { + bevy::reflect::VariantType::Tuple => BracketType::Round, + _ => BracketType::Curly, + }; + let key_vals = e.iter_fields().map(|v| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(v.value(), &mut field_printed); + (v.name(), field_printed) + }); + Self::pretty_print_key_values(bracket_type, key_vals, output); + }, + ReflectRef::Opaque(o) => { + self.pretty_print_value_opaque(o, output); + }, + } + + } } \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 5cb90a5bda..24424c2468 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -24,6 +24,9 @@ pub trait PartialReflectExt { /// If the type is an iterable list-like type, returns an iterator over the elements. fn as_list(&self) -> Result, ScriptError>; + /// If the type is a usize, returns the value as a usize otherwise throws a convenient error + fn as_usize(&self) -> Result; + /// If the type is an iterable list-like type, sets the elements of the list to the elements of the other list-like type. /// This acts as a set operation, so the left list will have the same length as the right list after this operation. fn set_as_list< @@ -36,7 +39,31 @@ pub trait PartialReflectExt { /// Inserts into the type at the given key, if the type supports inserting with the given key - fn insert_at(&mut self, index: usize, value: Box) -> Result<(), ScriptError>; + fn try_insert_boxed(&mut self, index: Box, value: Box) -> Result<(), ScriptError>; + + /// Tries to insert the given value into the type, if the type is a container type. + /// The insertion will happen at the natural `end` of the container. + /// For lists, this is the length of the list. + /// For sets, this will simply insert the value into the set. + /// For maps, there is no natural `end`, so the push will error out + fn try_push_boxed(&mut self, value: Box) -> Result<(), ScriptError>; + + + // If the type has a natural last element to pop, pops the last element and returns it as a boxed value. + fn try_pop_boxed(&mut self) -> Result, ScriptError>; + + /// If the type is a container type, empties the contents + fn try_clear(&mut self) -> Result<(), ScriptError>; + + /// If the type is a container type, returns the type id of the elements in the container. + /// For maps, this is the type id of the values. + fn element_type_id(&self) -> Option; + + /// If the type is a container type, returns the type id of the keys in the container. + /// For lists and arrays, this is the type id of usize. + /// For maps, this is the type id of the keys. + fn key_type_id(&self) -> Option; + } pub trait TypeIdExtensions { fn type_id_or_fake_id(&self) -> TypeId; @@ -166,14 +193,24 @@ impl PartialReflectExt for T { } } - fn insert_at(&mut self, index: usize, value: Box) -> Result<(), ScriptError> { + fn as_usize(&self) -> Result { + self.as_partial_reflect().try_downcast_ref::().copied() + .ok_or_else(|| ScriptError::new_runtime_error(format!( + "Expected type usize, but got {}", + self.get_represented_type_info() + .map(|ti| ti.type_path()) + .unwrap_or_else(|| "dynamic type with no type information") + ))) + } + + fn try_insert_boxed(&mut self, key: Box, value: Box) -> Result<(), ScriptError> { match self.reflect_mut() { bevy::reflect::ReflectMut::List(l) => { - l.insert(index, value); + l.insert(key.as_usize()?, value); Ok(()) }, bevy::reflect::ReflectMut::Map(m) => { - m.insert_boxed(Box::new(index), value); + m.insert_boxed(key, value); Ok(()) }, bevy::reflect::ReflectMut::Set(s) => { @@ -187,10 +224,84 @@ impl PartialReflectExt for T { } } + fn try_push_boxed(&mut self, value: Box) -> Result<(), ScriptError> { + match self.reflect_mut() { + bevy::reflect::ReflectMut::List(l) => { + l.push(value); + Ok(()) + }, + bevy::reflect::ReflectMut::Set(s) => { + s.insert_boxed(value); + Ok(()) + }, + _ => Err(ScriptError::new_reflection_error(format!( + "Could not push into {}. The type does not support pushing.", + self.reflect_type_path() + ))), + } + } + + fn try_clear(&mut self) -> Result<(), ScriptError> { + match self.reflect_mut() { + bevy::reflect::ReflectMut::List(l) => { + let _ = l.drain(); + Ok(()) + }, + bevy::reflect::ReflectMut::Map(m) => { + let _ = m.drain(); + Ok(()) + }, + bevy::reflect::ReflectMut::Set(s) => { + let _ = s.drain(); + Ok(()) + }, + _ => Err(ScriptError::new_reflection_error(format!( + "Could not clear {}. The type does not support clearing.", + self.reflect_type_path() + ))), + } + } + + + fn try_pop_boxed(&mut self) -> Result, ScriptError> { + match self.reflect_mut() { + bevy::reflect::ReflectMut::List(l) => { + l.pop().ok_or_else(|| ScriptError::new_runtime_error("Tried to pop from an empty list")) + }, + _ => Err(ScriptError::new_reflection_error(format!( + "Could not pop from {}. The type does not support popping.", + self.reflect_type_path() + ))), + } + } + + fn element_type_id(&self) -> Option { + let elem: TypeId = match self.get_represented_type_info()? { + bevy::reflect::TypeInfo::List(list_info) => list_info.item_ty().id(), + bevy::reflect::TypeInfo::Array(array_info) => array_info.item_ty().id(), + bevy::reflect::TypeInfo::Map(map_info) => map_info.value_ty().id(), + bevy::reflect::TypeInfo::Set(set_info) => set_info.value_ty().id(), + _ => return None, + }; + Some(elem) + } + + fn key_type_id(&self) -> Option { + let key: TypeId = match self.get_represented_type_info()? { + bevy::reflect::TypeInfo::Map(map_info) => map_info.key_ty().id(), + bevy::reflect::TypeInfo::List(_) | bevy::reflect::TypeInfo::Array(_) => TypeId::of::(), + _ => return None, + }; + Some(key) + } + + } #[cfg(test)] mod test { + use bevy::reflect::{DynamicMap, Map}; + use super::*; @@ -330,35 +441,47 @@ mod test { } #[test] - fn test_insert_at_vec() { + fn test_try_insert_vec() { let mut list = vec![1, 2, 3]; let value = 4; let value_ref: Box = Box::new(value); - list.insert_at(&1, value_ref).unwrap(); + list.try_insert_boxed(Box::new(1usize), value_ref).unwrap(); assert_eq!(vec![1, 4, 2, 3], list); } #[test] - fn test_insert_at_map() { + fn test_try_insert_map() { let mut map = std::collections::HashMap::::default(); let value = 4; let value_ref: Box = Box::new(value); map.insert(1, 2); map.insert(2, 3); map.insert(3, 4); - map.insert_at(&1, value_ref).unwrap(); + map.try_insert_boxed(Box::new(1), value_ref).unwrap(); assert_eq!(4, map[&1]); } #[test] - fn test_insert_at_set() { + fn test_try_insert_set() { let mut set = std::collections::HashSet::::default(); let value = 4; let value_ref: Box = Box::new(value); set.insert(1); set.insert(2); set.insert(3); - set.insert_at(&1, value_ref).unwrap(); + set.try_insert_boxed(Box::new(1), value_ref).unwrap(); assert!(set.contains(&4)); } + + #[test] + fn test_try_insert_dynamic_map_into_map_of_maps() { + let mut map = std::collections::HashMap::>::default(); + let value = DynamicMap::from_iter(vec![(1, 2), (2, 3), (3, 4)]); + let value_ref: Box = Box::new(value.clone_dynamic()); + map.insert(1, std::collections::HashMap::::default()); + map.insert(2, std::collections::HashMap::::default()); + map.insert(3, std::collections::HashMap::::default()); + map.try_insert_boxed(Box::new(1), value_ref).unwrap(); + assert!(value.reflect_partial_eq(&map[&1]).unwrap()); + } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs index 98282ad194..9d4c3cb0a4 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -2775,7 +2775,7 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "MetaMethod::Add")] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 32296e6101..113ef6cd14 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -1,18 +1,21 @@ use std::{ any::{Any, TypeId}, error::Error, + sync::Arc, }; use bevy::{ ecs::{reflect::AppTypeRegistry, world::Mut}, - reflect::{OffsetAccess, ParsedPath, ReflectFromReflect}, + reflect::{OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect}, }; use bevy_mod_scripting_core::{ bindings::{ - Either, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, Unproxy, - WorldCallbackAccess, + DeferredReflection, Either, ReflectAllocator, ReflectRefIter, ReflectReference, + ReflectReferencePrinter, ReflectionPathElem, TypeIdSource, Unproxy, WorldCallbackAccess, }, error::ScriptError, + new_deferred_reflection, + reflection_extensions::PartialReflectExt, }; use tealr::mlu::{ generics::Q, @@ -48,6 +51,49 @@ impl LuaReflectReference { .map_err(tealr::mlu::mlua::Error::external) } + pub fn concrete_from_value( + self, + value: Value, + lua: &Lua, + type_id_source: TypeIdSource, + ) -> Result, mlua::Error> { + let world = lua.get_world(); + + let type_id = self.0.type_id_of(type_id_source, &world)?; + + let o = ReflectReference::map_type_data( + type_id, + &world.clone(), + move |type_data: Option>| { + let val = match type_data { + Some(Either::Left(value_data)) => { + bevy::log::debug!("Converting using ReflectLuaValue"); + (value_data.from_value)(value, lua)? + } + Some(Either::Right(proxy_data)) => { + bevy::log::debug!("Converting using ReflectLuaProxied"); + let other = (proxy_data.from_proxy)(value, lua)?; + other.with_reflect(&world, |r, _, _| r.clone_value())? + } + None => { + bevy::log::debug!("No conversion type data found"); + return Err(ScriptError::new_runtime_error(format!( + "Tried to convert lua value: '{value:?}', to {}: '{}'. but this type does not support conversion from lua.", + match type_id_source { + TypeIdSource::Key => "key type of", + TypeIdSource::Element => "element type of", + TypeIdSource::Tail => "", + }, + ReflectReferencePrinter::new(self.0).pretty_print(&world), + ))); + } + }; + Ok(val) + }, + )??; + Ok(o) + } + /// Queries the reflection system for a proxy registration for the underlying type. /// If found will convert to lua using this proxy /// If not found will use ::into_lua to convert to lua @@ -55,14 +101,17 @@ impl LuaReflectReference { // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, let world = lua.get_world(); - self.0.map_type_data( + let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; + + ReflectReference::map_type_data( + type_id, &world, - |self_, type_data: Option>| match type_data { - Some(Either::Left(value_data)) => { - self_.with_reflect(&world, |r, _, _| (value_data.into_value)(r, lua))? - } - Some(Either::Right(proxy_data)) => Ok((proxy_data.into_proxy)(self_, lua)?), - None => Ok(LuaReflectReference(self_).into_lua(lua)?), + |type_data: Option>| match type_data { + Some(Either::Left(value_data)) => self + .0 + .with_reflect(&world, |r, _, _| (value_data.into_value)(r, lua))?, + Some(Either::Right(proxy_data)) => Ok((proxy_data.into_proxy)(self.0, lua)?), + None => Ok(LuaReflectReference(self.0).into_lua(lua)?), }, )? } @@ -72,14 +121,17 @@ impl LuaReflectReference { let world = lua.get_world(); - self.0.map_type_data( + let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; + + ReflectReference::map_type_data( + type_id, &world.clone(), - move |self_, type_data: Option>| { + move |type_data: Option>| { // let world = world.clone(); // move copy into closure match type_data { Some(Either::Left(value_data)) => { let other = (value_data.from_value)(value, lua)?; - self_.with_reflect_mut(&world, |r, _, _| { + self.0.with_reflect_mut(&world, |r, _, _| { r.try_apply(other.as_partial_reflect()) .map_err(ScriptError::new_reflection_error) })? @@ -88,7 +140,7 @@ impl LuaReflectReference { let other = (proxy_data.from_proxy)(value, lua)?; let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; // now we can set it - self_.with_reflect_mut(&world, |r, _, _| { + self.0.with_reflect_mut(&world, |r, _, _| { if let Some(set) = proxy_data.opt_set { set(r, other) } else { @@ -99,16 +151,11 @@ impl LuaReflectReference { })? } None => { - world.with_resource(|_, type_registry: Mut| { - let type_registry = type_registry.read(); - Err(ScriptError::new_runtime_error(format!( - "Invalid assignment `{:?}` = `{:?}`. The underlying type does not support assignment.", - self_.print_with_type_registry(&type_registry), - value - ))) - })?; - Ok(()) - }, + return Err(ScriptError::new_runtime_error(format!( + "Invalid assignment `{}` = `{value:?}`. The left hand side does not support conversion from lua.", + ReflectReferencePrinter::new(self.0).pretty_print(&world), + ))); + } } }, )??; @@ -215,13 +262,63 @@ impl TealData for LuaReflectReference { m.add_function_mut( "insert", - |l, (mut self_, key): (LuaReflectReference, usize, Value)| { - // check target type for a from_lua function - // let world = l.get_world(); - // self.0. + |l, (self_, key, value): (LuaReflectReference, Value, Value)| { + let world = l.get_world(); + bevy::log::debug!( + "ReflectReference::insert with key: {:?} and value: {:?}", + key, + value + ); + let key = self_ + .clone() + .concrete_from_value(key, l, TypeIdSource::Key)?; + bevy::log::debug!("Key: {:?}", key); + let value = self_ + .clone() + .concrete_from_value(value, l, TypeIdSource::Element)?; + bevy::log::debug!("Value: {:?}", value); + self_ + .0 + .with_reflect_mut(&world, |r, _, _| r.try_insert_boxed(key, value))??; + Ok(()) }, ); + m.add_function_mut("push", |l, (self_, value): (LuaReflectReference, Value)| { + let world = l.get_world(); + bevy::log::debug!("ReflectReference::push with value: {:?}", value); + let value = self_ + .clone() + .concrete_from_value(value, l, TypeIdSource::Element)?; + self_ + .0 + .with_reflect_mut(&world, |r, _, _| r.try_push_boxed(value))??; + Ok(()) + }); + + m.add_function_mut("pop", |l, self_: LuaReflectReference| { + let world = l.get_world(); + bevy::log::debug!("ReflectReference::pop"); + let ref_ = self_.0.with_reflect_mut(&world, |r, _, allocator| { + let last_elem = r.try_pop_boxed()?; + let reflect_ref = LuaReflectReference(ReflectReference::new_allocated_boxed( + last_elem, allocator, + )); + Ok::<_, ScriptError>(reflect_ref) + })??; + + Ok(ref_) + }); + + m.add_function("clear", |l, self_: LuaReflectReference| { + let world = l.get_world(); + bevy::log::debug!("ReflectReference::clear"); + self_ + .0 + .with_reflect_mut(&world, |r, _, _| r.try_clear())??; + Ok(()) + }); + m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { self_.len(l) }); @@ -266,7 +363,13 @@ impl TealData for LuaReflectReference { m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { let world = lua.get_world(); - Ok(self_.0.print_with_world(&world)) + Ok(ReflectReferencePrinter::new(self_.0).pretty_print(&world)) + }); + + m.add_function("print_value", |lua, self_: LuaReflectReference| { + let world = lua.get_world(); + + Ok(ReflectReferencePrinter::new(self_.0).pretty_print_value(&world)) }); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index 5ce02152d5..794b906e20 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -191,6 +191,7 @@ impl ReflectLuaProxied { Self { into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), from_proxy: Arc::new(move |v, l| { + bevy::log::debug!("Building listlike type from lua value: {:?}", v); if let Value::Table(t) = v { let dynamic_table = Self::dynamic_list_from_value(t, l, &from_value_clone, container_type_info)?; let world = l.get_world(); @@ -216,6 +217,7 @@ impl ReflectLuaProxied { Self { into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), from_proxy: Arc::new(|v, l| { + bevy::log::debug!("Building listlike type from proxied value: {:?}", v); todo!() }), opt_set: todo!(), @@ -231,7 +233,10 @@ where fn from_type() -> Self { Self { into_proxy: Arc::new(|p, l| T::Proxy::from(p).into_lua(l)), - from_proxy: Arc::new(|v, l| T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone())), + from_proxy: Arc::new(|v, l| { + bevy::log::debug!("Building proxied type from lua value: {:?}", v); + T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone()) + }), opt_set: None, } } diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index 51088c542b..a44689c620 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -1,6 +1,7 @@ use asset::ScriptAsset; use bevy::app::AppExit; use bevy::prelude::*; +use bevy::utils::hashbrown::HashMap; use bevy_mod_scripting::lua::LuaScriptingPlugin; use bevy_mod_scripting::prelude::*; use bevy_mod_scripting_lua::bindings::providers::LuaBevyScriptingPlugin; @@ -16,6 +17,7 @@ pub struct MyComponent { mat3: Mat3, vec_of_usize: Vec, vec_of_usize2: Vec, + map_of_strings: HashMap, option_usize: Option, option_vec3: Option, vec_of_option_bools: Vec>, @@ -46,6 +48,7 @@ fn init_data(mut commands: Commands) { option_vec_of_bools: Some(vec![true, true, true]), vec_of_usize: vec![1, 2, 3], vec_of_usize2: vec![4, 5, 6], + map_of_strings: HashMap::from_iter(vec![("key".into(), "value".into())]), option_usize: None, }, ScriptComponent::new(vec![SCRIPT_NAME.into()]), From 2ba0b4e6fe2c4d61b0daac0cd0b8e972114f916d Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 9 Dec 2024 11:58:23 +0000 Subject: [PATCH 038/217] Add back metamethods for math types --- assets/scripts/bevy_api.lua | 13 +- crates/bevy_api_gen/templates/function.tera | 47 +- crates/bevy_api_gen/templates/macros.tera | 28 +- .../src/bindings/world.rs | 19 +- crates/bevy_mod_scripting_core/src/error.rs | 8 +- crates/bevy_mod_scripting_derive/src/lib.rs | 50 +- .../src/bindings/providers/bevy_core.rs | 17 +- .../src/bindings/providers/bevy_ecs.rs | 116 +- .../src/bindings/providers/bevy_hierarchy.rs | 18 +- .../src/bindings/providers/bevy_input.rs | 486 ++-- .../src/bindings/providers/bevy_math.rs | 123 +- .../src/bindings/providers/bevy_reflect.rs | 2222 +++++++++++++---- .../src/bindings/providers/bevy_time.rs | 52 +- .../src/bindings/providers/bevy_transform.rs | 98 +- .../src/bindings/proxy.rs | 10 +- makefile | 4 +- 16 files changed, 2330 insertions(+), 981 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 58600ff33c..80598acbb9 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -107,18 +107,29 @@ function on_event() print("============") + print(Vec3.new(0,1,0) + Vec3.new(1,0,0)) + print(Vec3.new(0,1,0):any_orthonormal_vector()) + print(comp.mat3[1]) + print(Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1]) local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1] print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) print("new_mat3 is:", new_mat3) - comp.vec2 = comp.vec2 + comp.vec2 + -- comp.vec2 = comp.vec2 + comp.vec2 + print("A") comp.usize = comp.vec2:min_element() + + print("B") comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() + print("C") comp.vec2 = Vec2.new(2,1) + print("D") comp.quat = Quat.from_xyzw(3,2,1,4) + print("E") comp.mat3[1] = Vec3.new(69,69,69) + print("F") world:exit() diff --git a/crates/bevy_api_gen/templates/function.tera b/crates/bevy_api_gen/templates/function.tera index 970eebdfcc..d6625298f6 100644 --- a/crates/bevy_api_gen/templates/function.tera +++ b/crates/bevy_api_gen/templates/function.tera @@ -12,42 +12,27 @@ r#" {% endif %} as_trait="{{ function.from_trait_path }}", {%- endif -%} - {% if is_op %} composite="{{ function.ident }}", {% endif %} -{# -{% if function.has_self and not is_op %} -kind="{% if function.args.0.ty is starting_with("&mut") %}Mutating{% endif %}Method", -{% elif is_op %} -kind="MetaFunction", -{% else %} -kind="Function", -{% endif %} - -{%- if function.output.reflection_strategy == "Proxy" -%} -output(proxy), -{%- endif -%} - - - -{% if function.from_trait_path == "std::ops::Neg" %} -metamethod="Unm", -{% elif function.from_trait_path == "std::ops::Mul" %} -metamethod="Mul", -{% elif function.from_trait_path == "std::ops::Add" %} -metamethod="Add", -{% elif function.from_trait_path == "std::ops::Sub" %} -metamethod="Sub", -{% elif function.from_trait_path == "std::ops::Div" %} -metamethod="Div", -{% elif function.from_trait_path == "std::ops::Rem" %} -metamethod="Mod", -{% elif function.from_trait_path == "std::cmp::PartialEq" %} -metamethod="Eq", +{% if function.from_trait_path %} + {% if function.from_trait_path is starting_with("std::ops::Neg") %} + metamethod="Unm", + {% elif function.from_trait_path is starting_with("std::ops::Mul") %} + metamethod="Mul", + {% elif function.from_trait_path is starting_with("std::ops::Add") %} + metamethod="Add", + {% elif function.from_trait_path is starting_with("std::ops::Sub") %} + metamethod="Sub", + {% elif function.from_trait_path is starting_with("std::ops::Div") %} + metamethod="Div", + {% elif function.from_trait_path is starting_with("std::ops::Rem") %} + metamethod="Mod", + {% elif function.from_trait_path is starting_with("std::cmp::PartialEq") %} + metamethod="Eq", + {% endif %} {% endif %} -#} )] {% if function.is_unsafe %}unsafe {% endif -%}fn {{ function.ident }} ( {%- filter separated(delimeter=", ", split_at="---", ignore_first=true) -%} diff --git a/crates/bevy_api_gen/templates/macros.tera b/crates/bevy_api_gen/templates/macros.tera index ec421a0605..67ad6ddaf7 100644 --- a/crates/bevy_api_gen/templates/macros.tera +++ b/crates/bevy_api_gen/templates/macros.tera @@ -13,21 +13,21 @@ fn index(&mut self, idx: usize, val: {{ num_type }}) -> () { {% endmacro vector_newindex %} {% macro matrix_index(col_type, mat_type, bms_core_path) %} -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy<{{ col_type | prefix_lua }}> { - let mut curr_ref = _self.0.clone(); - let def_ref = {{bms_core_path}}::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push({{bms_core_path}}::bindings::ReflectionPathElem::new_deferred(def_ref)); - {{ col_type | prefix_lua }}(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } {% endmacro matrix_index %} diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 02e7f8f212..a0016fad72 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -550,6 +550,20 @@ impl<'w> WorldAccessGuard<'w> { /// Call a function on a type which can be proxied, first by unproxying the input with world access, /// then calling the function and finally proxying the output with the allocator. pub fn proxy_call<'i, O: Proxy, T: Unproxy, F: Fn(T::Output<'_>) -> O::Input<'i>>( + &self, + proxied_input: T, + f: F, + ) -> ScriptResult { + self.try_proxy_call(proxied_input, |o| Ok::<_, ScriptError>(f(o))) + } + + pub fn try_proxy_call< + 'i, + O: Proxy, + E: Into>, + T: Unproxy, + F: Fn(T::Output<'_>) -> Result, E>, + >( &self, mut proxied_input: T, f: F, @@ -567,7 +581,10 @@ impl<'w> WorldAccessGuard<'w> { } })?; - let out = f(unproxied_input); + let out = f(unproxied_input).map_err(|e| { + let e: Box = e.into(); + ScriptError::new_generic_error(e) + })?; let proxied_output = self.with_resource(|_, mut allocator: Mut| { O::proxy_with_allocator(out, &mut allocator) diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index e3a62864b8..f72391c1b9 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -131,15 +131,11 @@ impl std::fmt::Display for ScriptError { if let Some(script) = &self.0.script { write!( f, - "Encountered {} error in script `{}`: {}", + "{} in script `{}`: {}", self.0.kind, script, self.0.reason ) } else { - write!( - f, - "Encountered {} error in a script: {}", - self.0.kind, self.0.reason - ) + write!(f, "{}: {}", self.0.kind, self.0.reason) } } } diff --git a/crates/bevy_mod_scripting_derive/src/lib.rs b/crates/bevy_mod_scripting_derive/src/lib.rs index 62ef0e9e12..0173ccebaa 100644 --- a/crates/bevy_mod_scripting_derive/src/lib.rs +++ b/crates/bevy_mod_scripting_derive/src/lib.rs @@ -152,7 +152,7 @@ fn proxy_wrap_function_def( }; let func_name = &f.sig.ident; - let (mut original_arg_idents, _) = f + let (mut original_arg_idents, mut original_arg_types) = f .sig .inputs .iter() @@ -190,6 +190,7 @@ fn proxy_wrap_function_def( let args_var_to_use = if get_world_callback_access_fn.is_some() { original_arg_idents.remove(0); + original_arg_types.remove(0); args_tail_ident } else { args_ident @@ -203,7 +204,7 @@ fn proxy_wrap_function_def( }; // wrap function body in our unwrapping and wrapping logic, ignore pre-existing body - let mut fn_call = std::panic::catch_unwind(|| { + let mut fn_call = //std::panic::catch_unwind(|| { match ( &f.default, &attrs.as_trait, @@ -212,9 +213,19 @@ fn proxy_wrap_function_def( (_, _, true) => quote_spanned!(span=> world.#func_name(#(#original_arg_idents),*) ), - (Some(body), _, _) => quote_spanned!(span=> - (||{ #body })() - ), + (Some(body), _, _) => { + if attrs.no_proxy.is_present() { + // in this case the entire thing is just this + quote_spanned!(span=> + {(|#ctxt_arg_ident, (#(#original_arg_idents),*) : (#(#original_arg_types),*)|{ #body })(#ctxt_alias, #args_var_to_use)} + ) + } else { + // in this case we are just using this to contain any ? calls and early returns + quote_spanned!(span=> + (|| { #body })() + ) + } + }, (_, None, _) => quote_spanned!(span=> #target_type::#func_name(#(#original_arg_idents),*) ), @@ -224,9 +235,9 @@ fn proxy_wrap_function_def( <#target_type as #trait_path>::#func_name(#(#original_arg_idents),*) ) } - } - }) - .unwrap(); // todo: handle the error nicer + }; + //}) + // .unwrap(); // todo: handle the error nicer if f.sig.unsafety.is_some() { fn_call = quote_spanned!(span=> @@ -236,9 +247,9 @@ fn proxy_wrap_function_def( if attrs.no_proxy.is_present() { f.default = Some(parse_quote_spanned! {span=> - { - #fn_call - } + + #fn_call + }); } else { let world = if let Some(world_getter_fn_path) = get_world_callback_access_fn { @@ -254,11 +265,17 @@ fn proxy_wrap_function_def( ) }; + let proxy_call_name: Ident = if attrs.fallible.is_present() { + format_ident!("try_proxy_call", span = span) + } else { + format_ident!("proxy_call", span = span) + }; + f.default = Some(parse_quote_spanned! {span=> { #args_split #world - let out: #out_type = world.proxy_call(#args_var_to_use, |(#(#original_arg_idents),*)| { + let out: #out_type = world.#proxy_call_name(#args_var_to_use, |(#(#original_arg_idents),*)| { #fn_call }).map_err(|e| #mlua::Error::external(e))?; Ok(out) @@ -315,6 +332,9 @@ struct FunctionAttrs { /// i.e. will remove that argument from the function signature and use it's name as the context alias pub with_context: Flag, + /// if true will treat output as a fallible result + pub fallible: Flag, + /// Skips the unproxying & proxying call, useful for functions that don't need to access the world pub no_proxy: Flag, } @@ -377,7 +397,7 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { // extract composites first let mut composites: HashMap> = HashMap::new(); meta.functions.0.retain(|f| { - let attrs = FunctionAttrs::from_attributes(&f.attrs).unwrap(); + let attrs = FunctionAttrs::from_attributes(&f.attrs).expect("Function attributes must be valid"); if let Some(composite_id) = &attrs.composite { composites .entry(composite_id.to_owned()) @@ -423,7 +443,7 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { .collect::>(); let closure_args_types = closures.iter().map(|closure| { - let last = closure.inputs.last().unwrap(); + let last = closure.inputs.last().expect("Closure must have at least one argument"); if let syn::Pat::Type(pat_type) = last { &pat_type.ty } else { @@ -448,7 +468,7 @@ pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { }); let add_function_stmts = meta.functions.0.into_iter().filter_map(|mut f| { - let attrs = FunctionAttrs::from_attributes(&f.attrs).unwrap(); + let attrs = FunctionAttrs::from_attributes(&f.attrs).expect("Function attributes must be valid"); if attrs.skip.is_present() { return None; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs index b01a207d2f..173f0c160e 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs @@ -21,23 +21,24 @@ use crate::{ bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs index 5891658803..abe5e34722 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs @@ -19,18 +19,6 @@ use crate::{ bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" /// Creates a new entity ID with the specified `index` and a generation of 1. /// # Note /// Spawning a specific `entity` value is __rarely the right choice__. Most apps should favor @@ -91,6 +79,19 @@ use crate::{ _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -158,6 +159,14 @@ pub struct OnReplace {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + 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. @@ -186,20 +195,13 @@ pub struct OnReplace {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -215,34 +217,6 @@ pub struct ComponentId(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" /// Creates a new [`Tick`] wrapping the given value. #[lua()] @@ -274,6 +248,35 @@ pub struct ComponentId(); this_run: LuaReflectValProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -367,9 +370,18 @@ pub struct ComponentTicks { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -407,14 +419,6 @@ pub struct ComponentTicks { #[lua()] fn from_bits(value: u64) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs index 46f2c009b8..080149c40e 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs @@ -57,6 +57,7 @@ pub struct Children(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -79,6 +80,14 @@ pub struct Parent(); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -90,20 +99,13 @@ pub struct Parent(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs index ec753f161b..ea540806c0 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs @@ -87,10 +87,15 @@ pub struct Gamepad {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -103,14 +108,10 @@ pub struct Gamepad {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -131,6 +132,7 @@ pub struct GamepadAxis {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -197,10 +199,15 @@ pub struct GamepadSettings { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -213,14 +220,10 @@ pub struct GamepadSettings { "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -238,23 +241,24 @@ pub struct KeyCode {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" @@ -279,23 +283,24 @@ pub struct MouseButton {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -329,6 +334,7 @@ pub struct TouchInput { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -359,9 +365,18 @@ pub struct KeyboardFocusLost {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -376,14 +391,6 @@ pub struct KeyboardFocusLost {} _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -406,23 +413,24 @@ pub struct KeyboardInput { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -441,23 +449,24 @@ pub struct AccumulatedMouseMotion { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -477,18 +486,18 @@ pub struct AccumulatedMouseScroll { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -496,6 +505,7 @@ pub struct AccumulatedMouseScroll { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -522,23 +532,24 @@ pub struct MouseButtonInput { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -557,23 +568,24 @@ pub struct MouseMotion { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -606,6 +618,7 @@ pub struct MouseWheel { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -632,23 +645,24 @@ pub struct GamepadAxisChangedEvent { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -681,6 +695,7 @@ pub struct GamepadButtonChangedEvent { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -718,6 +733,7 @@ pub struct GamepadButtonStateChangedEvent { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -751,6 +767,7 @@ pub struct GamepadConnection {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -802,23 +819,24 @@ pub struct GamepadConnectionEvent { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -835,23 +853,24 @@ pub struct GamepadEvent {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" @@ -894,6 +913,7 @@ pub struct GamepadRumbleRequest {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -928,23 +948,24 @@ pub struct RawGamepadAxisChangedEvent { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -968,6 +989,7 @@ pub struct RawGamepadButtonChangedEvent { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1001,6 +1023,7 @@ pub struct RawGamepadEvent {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1042,6 +1065,7 @@ pub struct PinchGesture(f32); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1064,23 +1088,24 @@ pub struct RotationGesture(f32); bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1097,23 +1122,24 @@ pub struct DoubleTapGesture {} bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1129,11 +1155,10 @@ pub struct PanGesture(ReflectReference); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" +/// Is this button pressed? - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); + #[lua()] + fn is_pressed(_self: LuaReflectRefProxy) -> bool; "#, r#" @@ -1141,6 +1166,7 @@ pub struct PanGesture(ReflectReference); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1157,10 +1183,11 @@ pub struct PanGesture(ReflectReference); "#, r#" -/// Is this button pressed? - #[lua()] - fn is_pressed(_self: LuaReflectRefProxy) -> bool; + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); "#, r#" @@ -1181,20 +1208,13 @@ pub struct ButtonState {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" /// Returns `true` if the button is pressed. @@ -1259,6 +1279,14 @@ pub struct ButtonState {} value: f32, ) -> f32; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1275,14 +1303,10 @@ pub struct ButtonSettings {} bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> LuaReflectValProxy; "#, r#" @@ -1417,10 +1441,15 @@ pub struct ButtonSettings {} "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1437,14 +1466,6 @@ pub struct AxisSettings {} bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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. @@ -1456,6 +1477,14 @@ pub struct AxisSettings {} old_value: std::option::Option, ) -> std::option::Option; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -1476,18 +1505,6 @@ pub struct ButtonAxisSettings { bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1513,6 +1530,19 @@ pub struct ButtonAxisSettings { intensity: f32, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( + _self: LuaReflectRefProxy, + other: LuaReflectRefProxy, + ) -> bool; + "#, r#" #[lua(metamethod="ToString")] @@ -1532,6 +1562,14 @@ pub struct GamepadRumbleIntensity { bms_lua_path = "crate", functions[r#" + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + #[lua(as_trait = "std::cmp::Eq")] fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, @@ -1543,20 +1581,13 @@ pub struct GamepadRumbleIntensity { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] @@ -1576,6 +1607,7 @@ pub struct Key {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1585,18 +1617,18 @@ pub struct Key {} "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -1614,10 +1646,15 @@ pub struct NativeKeyCode {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1630,14 +1667,10 @@ pub struct NativeKeyCode {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -1655,14 +1688,6 @@ pub struct NativeKey {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -1674,12 +1699,21 @@ pub struct NativeKey {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] @@ -1696,10 +1730,15 @@ pub struct MouseScrollUnit {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] + fn eq( _self: LuaReflectRefProxy, - ) -> (); + other: LuaReflectRefProxy, + ) -> bool; "#, r#" @@ -1712,14 +1751,10 @@ pub struct MouseScrollUnit {} "#, r#" - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - )] - fn eq( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; + ) -> (); "#, r#" @@ -1737,23 +1772,24 @@ pub struct TouchPhase {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs index c3d9925ce1..17549221d1 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs @@ -65,7 +65,11 @@ use crate::{ "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -106,6 +110,7 @@ pub struct AspectRatio(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -139,6 +144,7 @@ pub struct CompassOctant {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -169,7 +175,11 @@ pub struct CompassQuadrant {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -178,7 +188,11 @@ pub struct CompassQuadrant {} "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -187,7 +201,11 @@ pub struct CompassQuadrant {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -293,7 +311,11 @@ pub struct Isometry2d { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -302,7 +324,11 @@ pub struct Isometry2d { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -311,7 +337,11 @@ pub struct Isometry2d { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -336,7 +366,11 @@ pub struct Isometry3d { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -369,7 +403,11 @@ pub struct Ray2d { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -403,7 +441,11 @@ pub struct Ray3d { functions[r#" /// Rotates the [`Dir2`] using a [`Rot2`]. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, direction: LuaReflectValProxy, @@ -412,7 +454,11 @@ pub struct Ray3d { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -697,7 +743,11 @@ pub struct Ray3d { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -733,6 +783,7 @@ pub struct Rot2 { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -848,7 +899,7 @@ pub struct Rot2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -885,7 +936,7 @@ pub struct Dir2(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -896,6 +947,7 @@ pub struct Dir2(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1053,6 +1105,7 @@ pub struct Dir3(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1062,7 +1115,7 @@ pub struct Dir3(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -1094,6 +1147,7 @@ pub struct Dir3A(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1290,6 +1344,7 @@ pub struct IRect { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1492,6 +1547,7 @@ pub struct Rect { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1778,6 +1834,7 @@ pub struct BoundingCircle { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1805,6 +1862,7 @@ pub struct Circle { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -1873,6 +1931,7 @@ pub struct Annulus { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2008,6 +2067,7 @@ pub struct Arc2d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2180,6 +2240,7 @@ pub struct Capsule2d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2319,6 +2380,7 @@ pub struct CircularSector { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2404,6 +2466,7 @@ pub struct CircularSegment { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2431,6 +2494,7 @@ pub struct Ellipse { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2466,6 +2530,7 @@ pub struct Line2d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2501,6 +2566,7 @@ pub struct Plane2d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2562,6 +2628,7 @@ pub struct Rectangle { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2726,6 +2793,7 @@ pub struct RegularPolygon { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2761,6 +2829,7 @@ pub struct Rhombus { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2807,6 +2876,7 @@ pub struct Segment2d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -2957,6 +3027,7 @@ pub struct BoundingSphere { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3033,6 +3104,7 @@ pub struct Sphere { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3060,6 +3132,7 @@ pub struct Cuboid { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3158,6 +3231,7 @@ pub struct Cylinder { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3186,6 +3260,7 @@ pub struct Capsule3d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3269,6 +3344,7 @@ pub struct Cone { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3306,6 +3382,7 @@ pub struct ConicalFrustum { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3341,6 +3418,7 @@ pub struct InfinitePlane3d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3386,6 +3464,7 @@ pub struct Line3d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3444,6 +3523,7 @@ pub struct Segment3d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3521,6 +3601,7 @@ pub struct Torus { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3933,6 +4014,7 @@ pub struct BoundingSphereCast { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -3991,7 +4073,7 @@ pub struct Interval {} "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -3999,7 +4081,11 @@ pub struct Interval {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -4040,6 +4126,7 @@ pub struct FloatOrd(f32); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -4088,6 +4175,7 @@ pub struct Plane3d { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -4123,6 +4211,7 @@ pub struct Tetrahedron { #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs index 9d4c3cb0a4..6bb04c7024 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs @@ -460,7 +460,7 @@ pub struct AtomicUsize {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u32, @@ -485,7 +485,11 @@ pub struct AtomicUsize {} "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -494,7 +498,11 @@ pub struct AtomicUsize {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -978,7 +986,11 @@ pub struct AtomicUsize {} "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -987,7 +999,7 @@ pub struct AtomicUsize {} "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u32, @@ -1017,7 +1029,11 @@ pub struct Duration {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -1034,7 +1050,11 @@ pub struct Duration {} "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, other: LuaReflectValProxy, @@ -1050,7 +1070,11 @@ pub struct Duration {} /// See [Monotonicity]. /// [Monotonicity]: Instant#monotonicity - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, other: LuaReflectValProxy, @@ -1144,7 +1168,11 @@ pub struct Duration {} /// 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::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, other: LuaReflectValProxy, @@ -1166,7 +1194,11 @@ pub struct Instant(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -1328,7 +1360,11 @@ pub struct PathBuf {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -1352,7 +1388,11 @@ pub struct RangeFull {} /// Subtracts the `rhs` quaternion from `self`. /// The difference is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -1363,7 +1403,7 @@ pub struct RangeFull {} /// Multiplies a quaternion by a scalar value. /// The product is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -1380,7 +1420,7 @@ pub struct RangeFull {} "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -1388,7 +1428,11 @@ pub struct RangeFull {} "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -1400,7 +1444,11 @@ pub struct RangeFull {} /// # Panics /// Will panic if `self` is not normalized when `glam_assert` is enabled. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -1413,7 +1461,11 @@ pub struct RangeFull {} /// 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::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -1424,7 +1476,7 @@ pub struct RangeFull {} /// Divides a quaternion by a scalar value. /// The quotient is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -1433,7 +1485,11 @@ pub struct RangeFull {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -1903,7 +1959,11 @@ pub struct RangeFull {} /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -1925,7 +1985,7 @@ pub struct Quat(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -2757,7 +2817,7 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -2766,7 +2826,7 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f32, @@ -2775,7 +2835,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "MetaMethod::Add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2784,7 +2848,7 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f32, @@ -2793,7 +2857,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2802,7 +2870,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2811,7 +2883,7 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f32, @@ -2820,7 +2892,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::Vec3>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2829,7 +2905,7 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -2837,7 +2913,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::Vec3>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2846,7 +2926,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::Vec3>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2855,7 +2939,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2864,7 +2952,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::Vec3>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2873,7 +2965,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2882,7 +2978,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::Vec3>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2899,7 +2999,11 @@ pub struct Quat(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -2937,7 +3041,11 @@ pub struct Vec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2946,7 +3054,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -2955,7 +3067,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec2>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::IVec2>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2964,7 +3080,7 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: i32, @@ -2973,7 +3089,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec2>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::IVec2>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -2982,7 +3102,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -2991,7 +3115,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3000,7 +3128,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3009,7 +3141,7 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: i32, @@ -3018,7 +3150,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec2>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::IVec2>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -3041,7 +3177,7 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: i32, @@ -3050,7 +3186,7 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: i32, @@ -3059,7 +3195,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec2>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::IVec2>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -3068,7 +3208,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3077,7 +3221,7 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: i32, @@ -3086,7 +3230,7 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -3612,7 +3756,11 @@ pub struct Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec2>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::IVec2>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -3649,7 +3797,11 @@ pub struct IVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3664,7 +3816,7 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: i32, @@ -3673,7 +3825,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec3>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::IVec3>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -3682,7 +3838,7 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: i32, @@ -3691,7 +3847,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec3>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::IVec3>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -3708,7 +3868,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec3>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::IVec3>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -3717,7 +3881,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3726,7 +3894,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -3735,7 +3907,7 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -3743,7 +3915,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3752,7 +3928,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3761,7 +3941,7 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: i32, @@ -3770,7 +3950,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -3779,7 +3963,7 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: i32, @@ -3788,7 +3972,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec3>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::IVec3>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -4322,7 +4510,11 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec3>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::IVec3>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -4331,7 +4523,7 @@ pub struct IVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: i32, @@ -4369,7 +4561,11 @@ pub struct IVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -4378,7 +4574,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::IVec4>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::IVec4>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -4395,7 +4595,7 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: i32, @@ -4404,7 +4604,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -4419,7 +4623,7 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: i32, @@ -4428,7 +4632,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -4437,7 +4645,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::IVec4>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::IVec4>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -4446,7 +4658,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::IVec4>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::IVec4>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -4455,7 +4671,7 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -4463,7 +4679,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -4472,7 +4692,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -4481,7 +4705,7 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: i32, @@ -4490,7 +4714,7 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: i32, @@ -4499,7 +4723,7 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: i32, @@ -4508,7 +4732,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::IVec4>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::IVec4>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -4517,7 +4745,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -4526,7 +4758,11 @@ pub struct IVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::IVec4>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::IVec4>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5071,7 +5307,11 @@ pub struct IVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5080,7 +5320,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5089,7 +5333,7 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: i64, @@ -5098,7 +5342,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5107,7 +5355,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5122,7 +5374,7 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: i64, @@ -5131,7 +5383,7 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: i64, @@ -5140,7 +5392,7 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: i64, @@ -5149,7 +5401,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5676,7 +5932,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5685,7 +5945,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5694,7 +5958,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5703,7 +5971,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -5720,7 +5992,7 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: i64, @@ -5729,7 +6001,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5738,7 +6014,7 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -5746,7 +6022,11 @@ pub struct IVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5771,7 +6051,7 @@ pub struct I64Vec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -5779,7 +6059,7 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: i64, @@ -5796,7 +6076,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5805,7 +6089,7 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: i64, @@ -5814,7 +6098,7 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: i64, @@ -5823,7 +6107,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5838,7 +6126,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5847,7 +6139,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5856,7 +6152,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5865,7 +6165,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5874,7 +6178,7 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: i64, @@ -5883,7 +6187,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -5892,7 +6200,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -5901,7 +6213,7 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: i64, @@ -5910,7 +6222,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5919,7 +6235,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -5928,7 +6248,11 @@ pub struct I64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -6479,7 +6803,11 @@ pub struct I64Vec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -6488,7 +6816,7 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: i64, @@ -6497,7 +6825,7 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: i64, @@ -6506,7 +6834,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -6515,7 +6847,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -6530,7 +6866,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -6539,7 +6879,7 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: i64, @@ -6548,7 +6888,7 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: i64, @@ -6557,7 +6897,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -6566,7 +6910,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -6575,7 +6923,7 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: i64, @@ -6584,7 +6932,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -6593,7 +6945,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -6602,7 +6958,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -7117,7 +7477,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7126,7 +7490,7 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -7134,7 +7498,11 @@ pub struct I64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::I64Vec4>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::I64Vec4>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7175,7 +7543,7 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: u32, @@ -7184,7 +7552,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7193,7 +7565,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7202,7 +7578,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7211,7 +7591,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -7228,7 +7612,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec2>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::UVec2>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7237,7 +7625,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7246,7 +7638,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec2>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::UVec2>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7255,7 +7651,7 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: u32, @@ -7264,7 +7660,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec2>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::UVec2>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7673,7 +8073,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7682,7 +8086,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec2>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::UVec2>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7691,7 +8099,7 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: u32, @@ -7700,7 +8108,7 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u32, @@ -7709,7 +8117,11 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec2>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::UVec2>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7718,7 +8130,7 @@ pub struct I64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u32, @@ -7755,7 +8167,11 @@ pub struct UVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec3>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::UVec3>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7764,7 +8180,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7773,7 +8193,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec3>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::UVec3>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7782,7 +8206,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7791,7 +8219,7 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: u32, @@ -7800,7 +8228,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec3>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::UVec3>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7809,7 +8241,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -7818,7 +8254,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec3>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::UVec3>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7827,7 +8267,7 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u32, @@ -7836,7 +8276,7 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: u32, @@ -7845,7 +8285,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -7862,7 +8306,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec3>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::UVec3>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -7871,7 +8319,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8319,7 +8771,7 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: u32, @@ -8334,7 +8786,7 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u32, @@ -8343,7 +8795,11 @@ pub struct UVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8381,7 +8837,11 @@ pub struct UVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::UVec4>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::UVec4>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -8390,7 +8850,7 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u32, @@ -8399,7 +8859,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8828,7 +9292,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::UVec4>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::UVec4>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -8845,7 +9313,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8854,7 +9326,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8863,7 +9339,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8878,7 +9358,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::UVec4>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::UVec4>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -8887,7 +9371,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8896,7 +9384,7 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: u32, @@ -8905,7 +9393,7 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: u32, @@ -8914,7 +9402,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::UVec4>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::UVec4>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -8923,7 +9415,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::UVec4>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::UVec4>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -8932,7 +9428,11 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -8941,7 +9441,7 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: u32, @@ -8950,7 +9450,7 @@ pub struct UVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u32, @@ -8989,7 +9489,11 @@ pub struct UVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -8998,7 +9502,7 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u64, @@ -9007,7 +9511,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -9016,7 +9524,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -9031,7 +9543,7 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: u64, @@ -9048,7 +9560,7 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: u64, @@ -9057,7 +9569,7 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: u64, @@ -9066,7 +9578,7 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u64, @@ -9075,7 +9587,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -9084,7 +9600,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -9093,7 +9613,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -9102,7 +9626,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -9111,7 +9639,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -9120,7 +9652,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -9129,7 +9665,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -9138,7 +9678,11 @@ pub struct UVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10002,7 +10546,7 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u64, @@ -10011,7 +10555,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10020,7 +10568,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec3>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::U64Vec3>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10029,7 +10581,7 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u64, @@ -10038,7 +10590,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10047,7 +10603,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10056,7 +10616,7 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: u64, @@ -10065,7 +10625,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10080,7 +10644,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10089,7 +10657,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10098,7 +10670,7 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: u64, @@ -10107,7 +10679,7 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: u64, @@ -10116,7 +10688,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -10125,7 +10701,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10142,7 +10722,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10151,7 +10735,11 @@ pub struct U64Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10177,7 +10765,11 @@ pub struct U64Vec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10186,7 +10778,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -10195,7 +10791,7 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: u64, @@ -10204,7 +10800,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10213,7 +10813,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10222,7 +10826,7 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: u64, @@ -10651,7 +11255,7 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: u64, @@ -10660,7 +11264,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10675,7 +11283,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10684,7 +11296,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10693,7 +11309,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::U64Vec4>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::U64Vec4>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10702,7 +11322,7 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: u64, @@ -10711,7 +11331,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::U64Vec4>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::U64Vec4>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10720,7 +11344,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10729,7 +11357,11 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10738,7 +11370,7 @@ pub struct U64Vec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: u64, @@ -10773,7 +11405,11 @@ pub struct U64Vec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec2>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::Vec2>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10782,7 +11418,7 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f32, @@ -10791,7 +11427,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec2>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::Vec2>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10800,7 +11440,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec2>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::Vec2>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -10809,7 +11453,7 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -10818,7 +11462,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10827,7 +11475,7 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -10836,7 +11484,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -10845,7 +11497,7 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f32, @@ -10854,7 +11506,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -11713,7 +12369,7 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f32, @@ -11722,7 +12378,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -11731,7 +12391,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec2>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::Vec2>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -11740,7 +12404,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -11749,7 +12417,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec2>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::Vec2>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -11758,7 +12430,11 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -11767,7 +12443,7 @@ pub struct U64Vec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -11803,7 +12479,11 @@ pub struct Vec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -11812,7 +12492,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -11821,7 +12505,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -11830,7 +12518,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec3A>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::Vec3A>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -11839,7 +12531,7 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -11848,7 +12540,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -11857,7 +12553,7 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f32, @@ -11866,7 +12562,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -11875,7 +12575,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec3A>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::Vec3A>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -11884,7 +12588,7 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -12725,7 +13429,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec3A>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::Vec3A>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -12742,7 +13450,7 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -12751,7 +13459,7 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f32, @@ -12760,7 +13468,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec3A>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::Vec3A>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -12769,7 +13481,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -12778,7 +13494,11 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -12787,7 +13507,7 @@ pub struct Vec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f32, @@ -12821,7 +13541,11 @@ pub struct Vec3A(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -12830,7 +13554,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::Vec4>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::Vec4>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -12839,7 +13567,7 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f32, @@ -12856,7 +13584,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -12865,7 +13597,7 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f32, @@ -12874,7 +13606,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -12883,7 +13619,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -12892,7 +13632,7 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -12901,7 +13641,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::Vec4>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::Vec4>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -12910,7 +13654,7 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -12919,7 +13663,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -12928,7 +13676,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::Vec4>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::Vec4>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -12937,7 +13689,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::Vec4>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::Vec4>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -12946,7 +13702,7 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -13733,7 +14489,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -13742,7 +14502,7 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f32, @@ -13751,7 +14511,11 @@ pub struct Vec3A(); "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::Vec4>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::Vec4>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -13785,7 +14549,11 @@ pub struct Vec4(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -13952,7 +14720,11 @@ pub struct BVec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -13992,7 +14764,11 @@ pub struct BVec3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -14097,7 +14873,7 @@ pub struct BVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f64, @@ -14106,7 +14882,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -14115,7 +14895,7 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -14123,7 +14903,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec2>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::DVec2>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -14132,7 +14916,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -14141,7 +14929,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -14150,7 +14942,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -14159,7 +14955,7 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f64, @@ -14168,7 +14964,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -14177,7 +14977,7 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -15028,7 +15828,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -15037,7 +15841,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec2>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::DVec2>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15046,7 +15854,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec2>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::DVec2>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15063,7 +15875,7 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -15072,7 +15884,7 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f64, @@ -15081,7 +15893,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec2>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::DVec2>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15090,7 +15906,11 @@ pub struct BVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec2>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::DVec2>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15127,7 +15947,11 @@ pub struct DVec2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -15136,7 +15960,7 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f64, @@ -15145,7 +15969,7 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -15162,7 +15986,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec3>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::DVec3>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15171,7 +15999,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec3>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::DVec3>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15180,7 +16012,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -15189,7 +16025,7 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f64, @@ -15198,7 +16034,7 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -15207,7 +16043,7 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f64, @@ -15216,7 +16052,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec3>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::DVec3>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15225,7 +16065,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec3>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::DVec3>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15234,7 +16078,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec3>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::DVec3>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -15243,7 +16091,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -16084,7 +16936,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -16093,7 +16949,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -16102,7 +16962,11 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -16111,7 +16975,7 @@ pub struct DVec2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -16926,7 +17790,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::<&bevy::math::DVec4>", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::<&bevy::math::DVec4>", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -16935,7 +17803,7 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] fn rem( _self: LuaReflectValProxy, rhs: f64, @@ -16944,7 +17812,7 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -16952,7 +17820,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::<&bevy::math::DVec4>", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::<&bevy::math::DVec4>", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -16961,7 +17833,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -16970,7 +17846,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::<&bevy::math::DVec4>", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::<&bevy::math::DVec4>", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -16979,7 +17859,7 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] fn sub( _self: LuaReflectValProxy, rhs: f64, @@ -16988,7 +17868,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -16997,7 +17881,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua( + as_trait = "std::ops::Div::", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17006,7 +17894,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17015,7 +17907,7 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -17024,7 +17916,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::<&bevy::math::DVec4>", composite = "add")] + #[lua( + as_trait = "std::ops::Add::<&bevy::math::DVec4>", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -17033,7 +17929,7 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] fn add( _self: LuaReflectValProxy, rhs: f64, @@ -17042,7 +17938,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::<&bevy::math::DVec4>", composite = "div")] + #[lua( + as_trait = "std::ops::Div::<&bevy::math::DVec4>", + composite = "div", + metamethod = "Div", + )] fn div( _self: LuaReflectValProxy, rhs: LuaReflectRefProxy, @@ -17051,7 +17951,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17068,7 +17972,11 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Rem::", composite = "rem")] + #[lua( + as_trait = "std::ops::Rem::", + composite = "rem", + metamethod = "Mod", + )] fn rem( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17077,7 +17985,7 @@ pub struct DVec3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -17116,7 +18024,11 @@ pub struct DVec4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17125,7 +18037,11 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17394,7 +18310,7 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17402,7 +18318,7 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -17411,7 +18327,7 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -17420,7 +18336,11 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -17429,7 +18349,11 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17438,7 +18362,11 @@ pub struct DVec4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17460,21 +18388,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaVec2(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -17486,7 +18414,11 @@ pub struct Mat2(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17495,7 +18427,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17504,7 +18440,7 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -17513,7 +18449,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -17522,7 +18462,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17531,7 +18475,7 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -17928,7 +18872,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17937,7 +18885,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17954,7 +18906,11 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -17963,7 +18919,7 @@ pub struct Mat2(); "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -17977,21 +18933,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaVec3(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -18007,7 +18963,11 @@ pub struct Mat3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -18016,7 +18976,11 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -18025,7 +18989,11 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -18034,7 +19002,11 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -18043,7 +19015,7 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -18051,7 +19023,11 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -18449,7 +19425,7 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -18458,7 +19434,11 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -18475,7 +19455,7 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -18484,7 +19464,11 @@ pub struct Mat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -18498,21 +19482,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaVec3A(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -18528,7 +19512,11 @@ pub struct Mat3A { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -18537,7 +19525,7 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f32, @@ -18546,7 +19534,11 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19210,7 +20202,11 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19219,7 +20215,7 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f32, @@ -19236,7 +20232,7 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -19244,7 +20240,11 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19253,7 +20253,11 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19262,7 +20266,11 @@ pub struct Mat3A { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19276,21 +20284,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaVec4(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -19544,7 +20552,7 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -19561,7 +20569,11 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19570,7 +20582,7 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -19579,7 +20591,11 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -19588,7 +20604,11 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19597,7 +20617,11 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19606,7 +20630,11 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19615,7 +20643,7 @@ pub struct Mat4 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -19628,21 +20656,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaDVec2(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -19657,7 +20685,11 @@ pub struct DMat2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19666,7 +20698,7 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -19675,7 +20707,11 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19692,7 +20728,11 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19701,7 +20741,11 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19710,7 +20754,7 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -19719,7 +20763,7 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -19727,7 +20771,11 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -19736,7 +20784,11 @@ pub struct DMat2 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -20129,21 +21181,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaDVec3(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -20159,7 +21211,11 @@ pub struct DMat3 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20168,7 +21224,7 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -20177,7 +21233,11 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20186,7 +21246,11 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20195,7 +21259,11 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -20204,7 +21272,7 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -20821,7 +21889,7 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -20837,7 +21905,11 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Add::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20846,7 +21918,11 @@ pub struct DMat3 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20860,21 +21936,21 @@ fn index(&self) -> String { } "#, r#" -#[lua(metamethod="Index")] -fn index(_self: LuaIdentityProxy, idx: usize) -> LuaIdentityProxy { - let mut curr_ref = _self.0.clone(); - let def_ref = bevy_mod_scripting_core::bindings::DeferredReflection{ - get: std::sync::Arc::new(|ref_| Err(bevy::reflect::ReflectPathError::InvalidDowncast)), - get_mut: std::sync::Arc::new(move |ref_| { - if let Some(ret) = ref_.try_as_reflect_mut().map(|ret| ret.downcast_mut::()).flatten(){ - Ok(ret.col_mut(idx - 1)) - } else { - Err(bevy::reflect::ReflectPathError::InvalidDowncast) - } - }) +#[lua(metamethod="Index", with_context, no_proxy)] +fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { + let mut curr_ref = _self.0; + + let path = match idx { + 1 => "x_axis", + 2 => "y_axis", + 3 => "z_axis", + 4 => "w_axis", + _ => "unknown_axis" }; - curr_ref.reflect_path.push(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_deferred(def_ref)); - LuaDVec4(curr_ref) + + let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); + crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } "#] )] @@ -20891,7 +21967,11 @@ pub struct DMat4 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20900,7 +21980,11 @@ pub struct DMat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20917,7 +22001,11 @@ pub struct DMat4 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -20926,7 +22014,11 @@ pub struct DMat4 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -21135,7 +22227,11 @@ pub struct Affine2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -21144,7 +22240,11 @@ pub struct Affine2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -21454,7 +22554,11 @@ pub struct Affine2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -21479,7 +22583,11 @@ pub struct Affine3A { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -21673,7 +22781,11 @@ pub struct Affine3A { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -21682,7 +22794,11 @@ pub struct Affine3A { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -21707,7 +22823,11 @@ pub struct DAffine2 { bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -21716,7 +22836,11 @@ pub struct DAffine2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -21725,7 +22849,11 @@ pub struct DAffine2 { "#, r#" - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -22033,7 +23161,11 @@ pub struct DAffine3 { /// 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::", composite = "add")] + #[lua( + as_trait = "std::ops::Add::", + composite = "add", + metamethod = "Add", + )] fn add( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -22044,7 +23176,7 @@ pub struct DAffine3 { /// Multiplies a quaternion by a scalar value. /// The product is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] fn mul( _self: LuaReflectValProxy, rhs: f64, @@ -22059,7 +23191,11 @@ pub struct DAffine3 { /// # Panics /// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -22516,7 +23652,11 @@ pub struct DAffine3 { /// # Panics /// Will panic if `self` is not normalized when `glam_assert` is enabled. - #[lua(as_trait = "std::ops::Mul::", composite = "mul")] + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] fn mul( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -22525,7 +23665,7 @@ pub struct DAffine3 { "#, r#" - #[lua(as_trait = "std::ops::Neg", composite = "neg")] + #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] fn neg( _self: LuaReflectValProxy, ) -> LuaReflectValProxy; @@ -22533,7 +23673,11 @@ pub struct DAffine3 { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -22544,7 +23688,11 @@ pub struct DAffine3 { /// Subtracts the `rhs` quaternion from `self`. /// The difference is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Sub::", composite = "sub")] + #[lua( + as_trait = "std::ops::Sub::", + composite = "sub", + metamethod = "Sub", + )] fn sub( _self: LuaReflectValProxy, rhs: LuaReflectValProxy, @@ -22555,7 +23703,7 @@ pub struct DAffine3 { /// Divides a quaternion by a scalar value. /// The quotient is not guaranteed to be normalized. - #[lua(as_trait = "std::ops::Div::", composite = "div")] + #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] fn div( _self: LuaReflectValProxy, rhs: f64, @@ -22590,7 +23738,11 @@ pub struct DQuat { "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -22692,7 +23844,11 @@ pub struct EulerRot {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -22714,7 +23870,11 @@ pub struct BVec3A(); bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, rhs: LuaReflectRefProxy, @@ -22840,7 +24000,11 @@ pub struct BVec4A(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, @@ -23048,7 +24212,11 @@ pub struct SmolStr(); "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs index 88b67bcdc6..5868b15a02 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs @@ -74,12 +74,21 @@ pub struct Real {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" /// Creates a new timer with a given duration in seconds. @@ -329,14 +338,6 @@ pub struct Real {} _self: LuaReflectRefProxy, ) -> u32; -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - "#, r#" #[lua(metamethod="ToString")] @@ -356,6 +357,7 @@ pub struct Timer {} #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -365,18 +367,18 @@ pub struct Timer {} "#, r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( + #[lua(as_trait = "std::clone::Clone")] + fn clone( _self: LuaReflectRefProxy, - ) -> (); + ) -> LuaReflectValProxy; "#, r#" - #[lua(as_trait = "std::clone::Clone")] - fn clone( + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; + ) -> (); "#, r#" @@ -415,14 +417,6 @@ pub struct Virtual {} bms_lua_path = "crate", functions[r#" - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, @@ -545,12 +539,24 @@ pub struct Virtual {} "#, r#" - #[lua(as_trait = "std::cmp::PartialEq::", composite = "eq")] + #[lua( + as_trait = "std::cmp::PartialEq::", + composite = "eq", + metamethod = "Eq", + )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; +"#, + r#" + + #[lua(as_trait = "std::cmp::Eq")] + fn assert_receiver_is_total_eq( + _self: LuaReflectRefProxy, + ) -> (); + "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs index c860da7422..9456826998 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs @@ -24,43 +24,18 @@ use crate::{ bms_lua_path = "crate", functions[r#" - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - )] - fn mul( - _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, - ) -> LuaReflectValProxy; - -"#, - r#" - #[lua(as_trait = "std::clone::Clone")] fn clone( _self: LuaReflectRefProxy, ) -> LuaReflectValProxy; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - )] - fn mul( - _self: LuaReflectValProxy, - transform: LuaReflectValProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, @@ -138,6 +113,34 @@ use crate::{ transform: LuaReflectValProxy, ) -> LuaReflectValProxy; +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] + fn mul( + _self: LuaReflectValProxy, + global_transform: LuaReflectValProxy< + bevy::transform::components::GlobalTransform, + >, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] + fn mul( + _self: LuaReflectValProxy, + transform: LuaReflectValProxy, + ) -> LuaReflectValProxy; + "#, r#" #[lua(metamethod="ToString")] @@ -153,6 +156,27 @@ pub struct GlobalTransform(); bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate", functions[r#" + + #[lua(as_trait = "std::clone::Clone")] + fn clone( + _self: LuaReflectRefProxy, + ) -> LuaReflectValProxy; + +"#, + r#" + + #[lua( + as_trait = "std::ops::Mul::", + composite = "mul", + metamethod = "Mul", + )] + fn mul( + _self: LuaReflectValProxy, + transform: LuaReflectValProxy, + ) -> LuaReflectValProxy; + +"#, + 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. @@ -255,6 +279,7 @@ pub struct GlobalTransform(); #[lua( as_trait = "std::ops::Mul::", composite = "mul", + metamethod = "Mul", )] fn mul( _self: LuaReflectValProxy, @@ -269,32 +294,13 @@ pub struct GlobalTransform(); #[lua( as_trait = "std::cmp::PartialEq::", composite = "eq", + metamethod = "Eq", )] fn eq( _self: LuaReflectRefProxy, other: LuaReflectRefProxy, ) -> bool; -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - )] - fn mul( - _self: LuaReflectValProxy, - transform: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - "#, r#" #[lua(metamethod="ToString")] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs index 83689e639a..3848898817 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs @@ -71,6 +71,12 @@ impl>> Proxy for Erro } } +impl From> for tealr::mlu::mlua::Error { + fn from(val: ErrorProxy) -> Self { + val.0 + } +} + /// Convenience for proxying a type into lua via itself without implementing [`Proxy`] on it. /// Converts to Lua via T's implementation of IntoLua directly pub struct LuaIdentityProxy(pub Option); @@ -83,7 +89,9 @@ impl Proxy for LuaIdentityProxy { } impl Unproxy for LuaIdentityProxy { - type Output<'o> = T where + type Output<'o> + = T + where Self: 'o; fn unproxy<'o>(&'o mut self) -> ScriptResult> { diff --git a/makefile b/makefile index f6419d30d1..9f845f56d6 100644 --- a/makefile +++ b/makefile @@ -63,10 +63,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_bms_lua": true}' --features ${GEN_BEVY_FEATURES} -vv + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen generate --output ${OUTPUT_PATH} --template-args '{ "self_is_bms_lua": true}' --features ${GEN_BEVY_FEATURES} collect_bevy: - cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen collect --output ${OUTPUT_PATH} --template-args '{ "self_is_bms_lua": true}' -vv + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen collect --output ${OUTPUT_PATH} --template-args '{ "self_is_bms_lua": true}' deletion_confirmation: @echo -n "This action will delete ALL files in directories: '${GENERATED_SRC_PATH}' amd ${OUTPUT_PATH} (y/N) " From 3c37ff224f244639a47e9f505267297a39f2d264 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 12 Dec 2024 21:21:16 +0000 Subject: [PATCH 039/217] 360 turn - WIP, implementing dynamic dispatch --- assets/scripts/bevy_api.lua | 4 +- crates/bevy_mod_scripting_core/Cargo.toml | 7 +- .../src/bindings/access_map.rs | 405 +++ .../src/bindings/allocator.rs | 90 +- .../src/bindings/function.rs | 356 +++ .../src/bindings/mod.rs | 8 +- .../src/bindings/pretty_print.rs | 372 +++ .../src/bindings/proxy.rs | 86 +- .../src/bindings/query.rs | 83 +- .../src/bindings/reference.rs | 699 ++--- .../src/bindings/world.rs | 2781 ++++++++--------- crates/bevy_mod_scripting_core/src/lib.rs | 7 +- .../src/reflection_extensions.rs | 21 +- crates/bevy_mod_scripting_core/src/systems.rs | 5 +- .../src/bindings/mod.rs | 4 +- .../src/bindings/proxy.rs | 4 +- .../src/bindings/query.rs | 5 +- .../src/bindings/reference.rs | 10 +- .../src/bindings/type_registration.rs | 2 +- .../src/bindings/world.rs | 12 +- .../bevy_mod_scripting_lua/src/lib.rs | 2 +- .../bevy_mod_scripting_lua/src/type_data.rs | 2 +- crates/test_utils/src/test_data.rs | 24 +- 23 files changed, 2846 insertions(+), 2143 deletions(-) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/access_map.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/function.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 80598acbb9..46c5262949 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -116,8 +116,8 @@ function on_event() local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) print("new_mat3 is:", new_mat3) - - -- comp.vec2 = comp.vec2 + comp.vec2 + + comp.vec2 = comp.vec2 + comp.vec2 print("A") comp.usize = comp.vec2:min_element() diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 6083eb0a18..04806b1ec6 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -24,12 +24,15 @@ mlua_impls = ["mlua"] [dependencies] mlua = { version = "0.9", optional = true } -bevy = { workspace = true, default-features = false, features = ["bevy_asset"] } +bevy = { workspace = true, default-features = false, features = [ + "bevy_asset", + "reflect_functions", +] } thiserror = "1.0.31" paste = "1.0.7" parking_lot = "0.12.1" -lockable = "0.0.8" +dashmap = "6" smallvec = "1.11" itertools = "0.13" diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs new file mode 100644 index 0000000000..6df4e88878 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -0,0 +1,405 @@ +use std::sync::atomic::{AtomicBool, AtomicUsize}; + +use bevy::{ + ecs::{component::ComponentId, world::unsafe_world_cell::UnsafeWorldCell}, + prelude::Resource, +}; +use dashmap::{try_result::TryResult, DashMap, Entry, Map}; + +use super::{ReflectAllocationId, ReflectBase}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct AccessCount { + count: usize, + /// set if somebody is writing + written_by: Option>, +} + +impl Default for AccessCount { + fn default() -> Self { + Self::new() + } +} + +impl AccessCount { + fn new() -> Self { + Self { + count: 0, + written_by: None, + } + } + + fn can_read(&self) -> bool { + self.written_by.is_none() + } + + fn can_write(&self) -> bool { + self.count == 0 && self.written_by.is_none() + } + + fn as_location(&self) -> Option> { + self.written_by + } + + fn readers(&self) -> usize { + self.count + } +} + +pub trait AccessMapKey { + fn as_usize(&self) -> usize; + fn from_usize(value: usize) -> Self; +} + +impl AccessMapKey for usize { + fn as_usize(&self) -> usize { + *self + } + + fn from_usize(value: usize) -> Self { + value + } +} + +/// Describes kinds of base value we are accessing via reflection +#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] +pub enum ReflectAccessKind { + ComponentOrResource, + Allocation, +} + +/// Describes the id pointing to the base value we are accessing via reflection, for components and resources this is the ComponentId +/// for script owned values this is an allocationId, this is used to ensure we have permission to access the value. +#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] +pub struct ReflectAccessId { + kind: ReflectAccessKind, + id: usize, +} + +impl AccessMapKey for ReflectAccessId { + fn as_usize(&self) -> usize { + // project two linear non-negative ranges to a single linear non-negative range + // y1 = 2x - 0 + // y2 = 2x - 1 + match self.kind { + ReflectAccessKind::ComponentOrResource => self.id * 2, + ReflectAccessKind::Allocation => self.id * 2 + 1, + } + } + + fn from_usize(value: usize) -> Self { + // retrieve the kind of range based on if the value is odd or even + // y1 if even, y2 if odd + // to retrieve value of x: + // x1 = y / 2 + // x2 = (y - 1) / 2 + let (kind, id) = if value % 2 == 0 { + (ReflectAccessKind::ComponentOrResource, value / 2) + } else { + (ReflectAccessKind::Allocation, (value - 1) / 2) + }; + Self { kind, id } + } +} + +impl ReflectAccessId { + pub fn for_resource(cell: &UnsafeWorldCell) -> Option { + Some(Self { + kind: ReflectAccessKind::ComponentOrResource, + id: cell.components().resource_id::()?.index(), + }) + } + + pub fn for_component( + cell: &UnsafeWorldCell, + ) -> Option { + let component_id = cell.components().component_id::()?; + + Some(Self::for_component_id(component_id)) + } + + pub fn for_allocation(id: ReflectAllocationId) -> Self { + Self { + kind: ReflectAccessKind::Allocation, + id: id.id(), + } + } + + pub fn for_component_id(id: ComponentId) -> Self { + Self { + kind: ReflectAccessKind::ComponentOrResource, + id: id.index(), + } + } + + pub fn for_reference(base: ReflectBase) -> Option { + match base { + ReflectBase::Resource(id) => Some(Self::for_component_id(id)), + ReflectBase::Component(_, id) => Some(Self::for_component_id(id)), + ReflectBase::Owned(id) => Some(Self::for_allocation(id)), + } + } +} + +impl From for ReflectAccessId { + fn from(value: ComponentId) -> Self { + Self { + kind: ReflectAccessKind::ComponentOrResource, + id: value.index(), + } + } +} + +impl From for ReflectAccessId { + fn from(value: ReflectAllocationId) -> Self { + Self { + kind: ReflectAccessKind::Allocation, + id: value.id(), + } + } +} + +impl From for ComponentId { + fn from(val: ReflectAccessId) -> Self { + ComponentId::new(val.id) + } +} + +#[derive(Debug, Default)] +pub struct AccessMap { + individual_accesses: DashMap, + global_lock: AtomicBool, +} + +impl AccessMap { + /// Tries to claim read access, will return false if somebody else is writing to the same key, or holding a global lock + pub fn claim_read_access(&self, key: K) -> bool { + if self.global_lock.load(std::sync::atomic::Ordering::Relaxed) { + return false; + } + let key = key.as_usize(); + let access = self.individual_accesses.try_entry(key); + match access.map(Entry::or_default) { + Some(mut entry) if entry.can_read() => { + entry.count += 1; + true + } + _ => false, + } + } + + #[track_caller] + /// Tries to claim write access, will return false if somebody else is reading or writing to the same key, or holding a global lock + pub fn claim_write_access(&self, key: K) -> bool { + if self.global_lock.load(std::sync::atomic::Ordering::Relaxed) { + return false; + } + let key = key.as_usize(); + let access = self.individual_accesses.try_entry(key); + match access.map(Entry::or_default) { + Some(mut entry) if entry.can_write() => { + entry.count += 1; + entry.written_by = Some(*std::panic::Location::caller()); + true + } + _ => false, + } + } + + /// Tries to claim global access. This type of access prevents any other access from happening simulatenously + /// Will return false if anybody else is currently accessing any part of the map + pub fn claim_global_access(&self) -> bool { + self.individual_accesses.len() == 0 + && self + .global_lock + .compare_exchange( + false, + true, + std::sync::atomic::Ordering::Relaxed, + std::sync::atomic::Ordering::Relaxed, + ) + .is_ok() + } + + pub fn release_access(&self, key: K) { + let key = key.as_usize(); + let access = self.individual_accesses.entry(key); + match access { + dashmap::mapref::entry::Entry::Occupied(mut entry) => { + let entry_mut = entry.get_mut(); + if entry_mut.written_by.is_some() { + entry_mut.written_by = None; + } + entry_mut.count -= 1; + if entry_mut.count == 0 { + entry.remove(); + } + } + dashmap::mapref::entry::Entry::Vacant(_) => {} + } + } + + /// Releases a global access + pub fn release_global_access(&self) { + self.global_lock + .store(false, std::sync::atomic::Ordering::Relaxed); + } + + pub fn list_accesses(&self) -> Vec<(K, AccessCount)> { + self.individual_accesses + .iter() + .map(|e| (K::from_usize(*e.key()), e.value().clone())) + .collect() + } + + pub fn access_location( + &self, + key: K, + ) -> Option> { + self.individual_accesses + .try_get(&key.as_usize()) + .try_unwrap() + .map(|access| access.as_location()) + .flatten() + } +} + +pub trait DisplayCodeLocation { + fn display_location(self) -> String; +} + +impl DisplayCodeLocation for std::panic::Location<'_> { + fn display_location(self) -> String { + format!("\"{}:{}\"", self.file(), self.line()) + } +} + +impl DisplayCodeLocation for Option> { + fn display_location(self) -> String { + self.map(|l| l.display_location()) + .unwrap_or_else(|| "\"unknown location\"".to_owned()) + } +} + +#[macro_export] +macro_rules! with_access_read { + ($access_map:expr, $id:expr, $msg:expr, $body:block) => {{ + if !$access_map.claim_read_access($id) { + panic!( + "{}. Aliasing access is held somewhere else: {}", + $msg, + $crate::bindings::access_map::DisplayCodeLocation::display_location( + $access_map.access_location($id) + ) + ); + } else { + let result = $body; + $access_map.release_access($id); + result + } + }}; +} + +#[macro_export] +macro_rules! with_access_write { + ($access_map:expr, $id:expr, $msg:expr, $body:block) => { + if !$access_map.claim_write_access($id) { + panic!( + "{}. Aliasing access is held somewhere else: {}", + $msg, + $crate::bindings::access_map::DisplayCodeLocation::display_location( + $access_map.access_location($id) + ) + ); + } else { + let result = $body; + $access_map.release_access($id); + result + } + }; +} + +#[macro_export] +macro_rules! with_global_access { + ($access_map:expr, $msg:expr, $body:block) => { + if !$access_map.claim_global_access() { + panic!( + "{}. Another access is held somewhere else preventing locking the world", + $msg + ); + } else { + let result = (|| $body)(); + $access_map.release_global_access(); + result + } + }; +} + +#[cfg(test)] +mod test { + use super::*; + #[test] + fn test_list_accesses() { + let access_map = AccessMap::default(); + + access_map.claim_read_access(0); + access_map.claim_write_access(1); + + let accesses = access_map.list_accesses::(); + + assert_eq!(accesses.len(), 2); + let access_0 = accesses.iter().find(|(k, _)| *k == 0).unwrap(); + let access_1 = accesses.iter().find(|(k, _)| *k == 1).unwrap(); + + assert_eq!(access_0.1.readers(), 1); + assert_eq!(access_1.1.readers(), 1); + + assert_eq!(access_0.1.written_by, None); + assert!(access_1.1.written_by.is_some()); + } + + #[test] + fn test_read_access_blocks_write() { + let access_map = AccessMap::default(); + + assert!(access_map.claim_read_access(0)); + assert!(!access_map.claim_write_access(0)); + access_map.release_access(0); + assert!(access_map.claim_write_access(0)); + } + + #[test] + fn test_write_access_blocks_read() { + let access_map = AccessMap::default(); + + assert!(access_map.claim_write_access(0)); + assert!(!access_map.claim_read_access(0)); + access_map.release_access(0); + assert!(access_map.claim_read_access(0)); + } + + #[test] + fn test_global_access_blocks_all() { + let access_map = AccessMap::default(); + + assert!(access_map.claim_global_access()); + assert!(!access_map.claim_read_access(0)); + assert!(!access_map.claim_write_access(0)); + access_map.release_global_access(); + assert!(access_map.claim_write_access(0)); + access_map.release_access(0); + assert!(access_map.claim_read_access(0)); + } + + #[test] + fn any_access_blocks_global() { + let access_map = AccessMap::default(); + + assert!(access_map.claim_read_access(0)); + assert!(!access_map.claim_global_access()); + access_map.release_access(0); + + assert!(access_map.claim_write_access(0)); + assert!(!access_map.claim_global_access()); + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index e9c66f83ba..88b3d4d8ea 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -1,16 +1,22 @@ use bevy::ecs::system::Resource; use bevy::reflect::{PartialReflect, Reflect}; +use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::any::{Any, TypeId}; use std::cell::UnsafeCell; use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::sync::Arc; -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] -pub struct ReflectAllocationId(pub(crate) usize); +#[derive(Clone, PartialEq, Eq, Hash, Debug)] +pub struct ReflectAllocationId(pub(crate) Arc); impl ReflectAllocationId { pub fn id(&self) -> usize { - self.0 + *self.0 + } + + /// Creates a new [`ReflectAllocationId`] from its id + pub(crate) fn new(id: usize) -> Self { + Self(Arc::new(id)) } } @@ -71,13 +77,37 @@ impl Display for ReflectAllocationId { } } +/// Wrapper around a [`ReflectAllocator`] which can be freely copied and shared between threads +#[derive(Debug, Resource, Clone)] +pub struct AppReflectAllocator { + pub(crate) allocator: Arc>, +} + +impl Default for AppReflectAllocator { + fn default() -> Self { + Self { + allocator: Arc::new(RwLock::new(ReflectAllocator::default())), + } + } +} + +impl AppReflectAllocator { + pub fn read(&self) -> RwLockReadGuard { + self.allocator.read() + } + + pub fn write(&self) -> RwLockWriteGuard { + self.allocator.write() + } +} + /// Allocator used to allocate and deallocate `dyn PartialReflect` values /// Used to be able to ensure we have a "common root" for values allocated outside the world. -#[derive(Resource, Default)] +#[derive(Default, Debug)] pub struct ReflectAllocator { // TODO: experiment with object pools, sparse set etc. allocations: HashMap, - types: HashMap, + types: HashMap, } impl ReflectAllocator { @@ -89,11 +119,12 @@ impl ReflectAllocator { ) -> (ReflectAllocationId, ReflectAllocation) { let type_id = value.get_represented_type_info().map(|i| i.type_id()); - let id = ReflectAllocationId(self.allocations.len()); + let id = ReflectAllocationId::new(self.allocations.len()); + let index = id.id(); let value = ReflectAllocation::new(Arc::new(UnsafeCell::new(value))); - self.allocations.insert(id, value.clone()); + self.allocations.insert(id.clone(), value.clone()); if let Some(type_id) = type_id { - self.types.insert(id, type_id); + self.types.insert(index, type_id); } (id, value) } @@ -104,11 +135,12 @@ impl ReflectAllocator { ) -> (ReflectAllocationId, ReflectAllocation) { let type_id = value.get_represented_type_info().map(|i| i.type_id()); - let id = ReflectAllocationId(self.allocations.len()); + let id = ReflectAllocationId::new(self.allocations.len()); + let index = id.id(); let value = ReflectAllocation::new_boxed(value); - self.allocations.insert(id, value.clone()); + self.allocations.insert(id.clone(), value.clone()); if let Some(type_id) = type_id { - self.types.insert(id, type_id); + self.types.insert(index, type_id); } (id, value) } @@ -136,30 +168,27 @@ impl ReflectAllocator { // (id, allocation) // } - pub fn get(&self, id: ReflectAllocationId) -> Option { - self.allocations.get(&id).cloned() + pub fn get(&self, id: &ReflectAllocationId) -> Option { + self.allocations.get(id).cloned() } - pub fn get_type_id(&self, id: ReflectAllocationId) -> Option { - self.types.get(&id).cloned() + pub fn get_type_id(&self, id: &ReflectAllocationId) -> Option { + self.types.get(&id.id()).cloned() } - pub fn get_mut(&self, id: ReflectAllocationId) -> Option { - self.allocations.get(&id).cloned() + pub fn get_mut(&self, id: &ReflectAllocationId) -> Option { + self.allocations.get(id).cloned() } /// Deallocates the [`PartialReflect`] value with the given [`AllocationId`] - pub fn deallocate(&mut self, id: ReflectAllocationId) { - self.allocations.remove(&id); + pub fn deallocate(&mut self, id: &ReflectAllocationId) { + self.allocations.remove(id); } /// Runs a garbage collection pass on the allocations, removing any allocations which have no more strong references /// Needs to be run periodically to prevent memory leaks pub fn clean_garbage_allocations(&mut self) { - self.allocations.retain(|_, v| match v { - ReflectAllocation::Single(v) => Arc::strong_count(v) > 1, - ReflectAllocation::Double(v) => Arc::strong_count(v) > 1, - }); + self.allocations.retain(|k, _| Arc::strong_count(&k.0) > 1); } } @@ -168,12 +197,21 @@ mod test { use super::*; #[test] - fn test_reflect_allocator() { + fn test_reflect_allocator_garbage_clean() { let mut allocator = ReflectAllocator::default(); - let (id, val) = allocator.allocate(0); + let (id, _) = allocator.allocate(0); assert_eq!(allocator.allocations.len(), 1); - drop(val); + drop(id); allocator.clean_garbage_allocations(); assert_eq!(allocator.allocations.len(), 0); } + + #[test] + fn test_reflect_allocator_garbage_clean_no_garbage() { + let mut allocator = ReflectAllocator::default(); + let (_id, _) = allocator.allocate(0); + assert_eq!(allocator.allocations.len(), 1); + allocator.clean_garbage_allocations(); + assert_eq!(allocator.allocations.len(), 1); + } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs new file mode 100644 index 0000000000..9dca187910 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -0,0 +1,356 @@ +use std::borrow::Cow; + +use bevy::reflect::func::{ + args::{Arg, ArgInfo, Ownership}, + ArgList, ArgValue, DynamicFunction, FunctionResult, Return, +}; + +use crate::error::{ScriptError, ScriptResult}; + +use super::{ + access_map::ReflectAccessId, pretty_print::DisplayWithWorld, ReflectReference, WorldAccessGuard, +}; + +/// Can be implemented for callables which require dynamic access to the world to be called. +/// +/// The claim and release functions must be used to scope the access to the world such that function output . +pub trait CallableWithAccess { + fn with_call O>( + &self, + args: &[ReflectReference], + world: &WorldAccessGuard, + f: F, + ) -> ScriptResult; +} + +impl<'env> CallableWithAccess for DynamicFunction<'env> { + fn with_call O>( + &self, + args: &[ReflectReference], + world: &WorldAccessGuard, + f: F, + ) -> ScriptResult { + let info = self.info().args(); + + if info.len() != args.len() { + return Err(ScriptError::new_reflection_error(format!( + "Expected {} arguments, got {}", + info.len(), + args.len() + ))); + } + + // We need to: + // 1. Claim the correct access for each argument + // 2. Convert to ArgsList for the function call + // 3. Call the function + // 4. Relinquish access to the caller for the return value + // 5. Release the access for each argument + // 6. Return the result + let (args_list, mut accesses) = args.into_args_list_with_access(info, world)?; + + let return_val = match self.call(args_list) { + Ok(return_val) => return_val, + Err(e) => { + // Safety: we have not generated any unsafe aliases + // - we are releasing only the access we have claimed + accesses.drain(..).for_each(|(id, _)| { + unsafe { world.release_access(id) }; + }); + + return Err(e.into()); + } + }; + + let out = f(return_val); + + // Safety: we have not generated any unsafe aliases + // - we are releasing only the access we have claimed + accesses.drain(..).for_each(|(id, _)| { + unsafe { world.release_access(id) }; + }); + + Ok(out) + } +} + +/// Trait implementable by lists of things representing arguments which can be converted into an `ArgList`. +/// +/// The call needs to collect the correct access id's and types for each argument. +pub trait IntoArgsListWithAccess { + fn into_args_list_with_access<'w>( + self, + arg_info: &[ArgInfo], + world: &'w WorldAccessGuard, + ) -> ScriptResult<(ArgList<'w>, Vec<(ReflectAccessId, Ownership)>)>; +} + +impl IntoArgsListWithAccess for &[ReflectReference] { + /// Converts a list of references into an `ArgList` and collects the access id's and types for each argument. + /// + /// This is actually safe to call, since we are not actually releasing the access here. + /// Meaning that only after releasing access is it possible to create unsafe aliases + fn into_args_list_with_access<'w>( + self, + arg_info: &[ArgInfo], + world: &'w WorldAccessGuard, + ) -> ScriptResult<(ArgList<'w>, Vec<(ReflectAccessId, Ownership)>)> { + if self.len() != arg_info.len() { + return Err(ScriptError::new_reflection_error(format!( + "Expected {} arguments, got {}", + arg_info.len(), + self.len() + ))); + } + + let mut accesses = Vec::default(); + + let _ = self + .iter() + .zip(arg_info.iter()) + .map(|(arg_ref, arg_info)| { + let access_id = + ReflectAccessId::for_reference(arg_ref.base.base_id.clone()).ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "Could not call function, argument {} is not a valid reference. Have you registered the type?", + arg_ref.display_with_world(world) + )) + })?; + + let is_write = matches!(arg_info.ownership(), Ownership::Mut); + + let success = if is_write { + world.claim_write_access(access_id) + } else { + world.claim_read_access(access_id) + }; + + if !success { + return Err(ScriptError::new_reflection_error(format!( + "Could not claim access for argument {}", + arg_ref.display_with_world(world) + ))); + } + + + accesses.push((access_id, arg_info.ownership())); + + Ok(()) + }) + .collect::>>() + .inspect_err(|_| { + // we don't want to leave the world in an inconsistent state + // Safety: we have not generated any unsafe aliases + // - we are releassing only the access we have claimed + accesses.iter().for_each(|(id,_)| { + unsafe {world.release_access(*id)}; + }); + })?; + + let mut arg_list = ArgList::new(); + + for (r, info) in self.iter().zip(arg_info.iter()) { + // Safety: we have claimed access for each argument + let val = unsafe { r.clone().into_arg_value(world, info) }; + let val = match val { + Ok(v) => v, + Err(e) => { + // Safety: Same as above + + accesses.iter().for_each(|(id, _)| { + unsafe { world.release_access(*id) }; + }); + return Err(e); + } + }; + arg_list = arg_list.push_arg(val); + } + + Ok((arg_list, accesses)) + } +} + +#[cfg(test)] +mod test { + use bevy::{ + prelude::{IntoFunction, World}, + reflect::{DynamicList, ParsedPath, ReflectFromReflect}, + }; + use test_utils::test_data::TestResourceWithVariousFields; + + use crate::prelude::AppReflectAllocator; + + use super::*; + + fn setup_world() -> World { + test_utils::test_data::setup_world(|world, _| { + world.insert_resource(AppReflectAllocator::default()); + }) + } + + #[test] + fn call_t_owned() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let function = (|usize: usize| usize).into_function(); + + let allocator = world.allocator(); + let mut allocator = allocator.write(); + let arg_ref = ReflectReference::new_allocated(2usize, &mut allocator); + drop(allocator); + + function + .with_call(&[arg_ref], &world, |r| { + assert!(r.unwrap_owned().reflect_partial_eq(&2usize).unwrap()); + }) + .unwrap(); + } + + #[test] + fn call_t_ref() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let function = (|usize: &usize| *usize).into_function(); + + let mut arg_ref = + ReflectReference::new_resource_ref::(&world).unwrap(); + arg_ref.index_path(ParsedPath::parse_static("usize").unwrap()); + + function + .with_call(&[arg_ref], &world, |r| { + assert!(r.unwrap_owned().reflect_partial_eq(&22usize).unwrap()); + }) + .unwrap(); + } + + #[test] + fn call_t_mut() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let function = (|usize: &mut usize| { + *usize = 42; + *usize + }) + .into_function(); + + let mut arg_ref = + ReflectReference::new_resource_ref::(&world).unwrap(); + + arg_ref.index_path(ParsedPath::parse_static("usize").unwrap()); + + function + .with_call(&[arg_ref], &world, |r| { + assert!(r.unwrap_owned().reflect_partial_eq(&42usize).unwrap()); + }) + .unwrap(); + } + + #[test] + fn call_dynamic_t_owned() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let type_registry = world.type_registry(); + let mut type_registry = type_registry.write(); + type_registry.register::>(); + type_registry.register_type_data::, ReflectFromReflect>(); + + let function = (|arr: Vec| arr).into_function(); + + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + let mut dynamic = DynamicList::from_iter(vec![2usize]); + dynamic.set_represented_type( + type_registry.get_type_info(std::any::TypeId::of::>()), + ); + + let arg_ref = ReflectReference::new_allocated(dynamic, &mut allocator); + drop(type_registry); + drop(allocator); + + function + .with_call(&[arg_ref], &world, |r| { + assert!(r.unwrap_owned().reflect_partial_eq(&vec![2usize]).unwrap()); + }) + .unwrap(); + } + + #[test] + fn call_dynamic_t_ref() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let type_registry = world.type_registry(); + let mut type_registry = type_registry.write(); + type_registry.register::>(); + type_registry.register_type_data::, ReflectFromReflect>(); + + let function = (|arr: &Vec| arr.clone()).into_function(); + + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + let mut dynamic = DynamicList::from_iter(vec![2usize]); + dynamic.set_represented_type( + type_registry.get_type_info(std::any::TypeId::of::>()), + ); + + let arg_ref = ReflectReference::new_allocated(dynamic, &mut allocator); + drop(type_registry); + drop(allocator); + + function + .with_call(&[arg_ref], &world, |r| { + assert!(r.unwrap_owned().reflect_partial_eq(&vec![2usize]).unwrap()); + }) + .unwrap(); + } + + #[test] + fn call_dynamic_t_mut() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let type_registry = world.type_registry(); + let mut type_registry = type_registry.write(); + type_registry.register::>(); + type_registry.register_type_data::, ReflectFromReflect>(); + + let function = (|arr: &mut Vec| { + arr.push(42); + arr.clone() + }) + .into_function(); + + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + let mut dynamic = DynamicList::from_iter(vec![2usize]); + dynamic.set_represented_type( + type_registry.get_type_info(std::any::TypeId::of::>()), + ); + + let arg_ref = ReflectReference::new_allocated(dynamic, &mut allocator); + drop(type_registry); + drop(allocator); + + function + .with_call(&[arg_ref], &world, |r| { + assert!(r + .unwrap_owned() + .reflect_partial_eq(&vec![2usize, 42usize]) + .unwrap()); + }) + .unwrap(); + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/mod.rs index 24f8ddf453..5bd4d352bc 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/mod.rs @@ -1,7 +1,11 @@ +pub mod access_map; pub mod allocator; -pub mod proxy; +pub mod function; +pub mod pretty_print; +// pub mod proxy; pub mod query; pub mod reference; pub mod world; -pub use {allocator::*, proxy::*, query::*, reference::*, world::*}; +pub use {allocator::*, query::*, reference::*, world::*}; +// pub use {proxy::*}; diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs new file mode 100644 index 0000000000..347d7f8ac8 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -0,0 +1,372 @@ +use crate::reflection_extensions::TypeIdExtensions; + +use super::{ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, WorldAccessGuard}; +use bevy::reflect::{PartialReflect, ReflectRef}; +use itertools::Itertools; +use std::{any::TypeId, borrow::Cow}; + +pub struct ReflectReferencePrinter { + pub(crate) reference: ReflectReference, +} + +#[derive(Clone, Copy, Debug)] +enum BracketType { + Square, + Curly, + Round, +} + +impl BracketType { + fn open(self) -> char { + match self { + BracketType::Square => '[', + BracketType::Curly => '{', + BracketType::Round => '(', + } + } + + fn close(self) -> char { + match self { + BracketType::Square => ']', + BracketType::Curly => '}', + BracketType::Round => ')', + } + } + + fn surrounded(self, output: &mut String, f: F) { + output.push(self.open()); + f(output); + output.push(self.close()); + } +} + +macro_rules! downcast_case { + ($id:ident, $out:ident, $t:path) => {{ + $out.push_str(stringify!($t)); + $out.push('('); + if let Some($id) = $id.as_partial_reflect().try_downcast_ref::<$t>() { + $out.push_str(&format!("{:?}", $id)); + } else { + $out.push_str(""); + } + $out.push(')'); + }}; +} + +impl ReflectReferencePrinter { + const UNREGISTERED_TYPE: &'static str = "Unregistered TypeId"; + const UNKNOWN_FIELD: &'static str = ""; + + pub fn new(reference: ReflectReference) -> Self { + Self { reference } + } + + fn pretty_print_base(base: &ReflectBaseType, world: &WorldAccessGuard, out: &mut String) { + let type_id = base.type_id; + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + let type_path = type_registry + .get_type_info(type_id) + .map(|t| t.type_path_table().short_path()) + .unwrap_or_else(|| ReflectReferencePrinter::UNREGISTERED_TYPE); + + let base_kind = match base.base_id { + ReflectBase::Component(e, _) => format!("Component on entity {}", e), + ReflectBase::Resource(_) => "Resource".to_owned(), + ReflectBase::Owned(_) => "Allocation".to_owned(), + }; + + out.push_str(&format!("{}({})", base_kind, type_path)); + } + + /// Given a reflect reference, prints the type path of the reference resolving the type names with short names. + /// I.e. `MyType(Component).field_name[0].field_name[1] -> FieldType::Name` + pub fn pretty_print(&self, world: &WorldAccessGuard) -> String { + let mut pretty_path = String::new(); + + pretty_path.push_str(" { + pretty_path.push_str(&path.to_string()); + } + ReflectionPathElem::DeferredReflection(_) => { + pretty_path.push_str("."); + } + ReflectionPathElem::Identity => { + pretty_path.push_str(""); + } + ReflectionPathElem::MapAccess(key) => { + pretty_path.push_str(&format!("[{}]", key)); + } + } + } + + if let Some(tail_type_id) = tail_type_id { + let type_path = { + let type_registry = type_registry.read(); + type_registry + .get_type_info(tail_type_id) + .map(|t| t.type_path_table().short_path()) + .unwrap_or(Self::UNREGISTERED_TYPE) + }; + pretty_path.push_str(&format!(" -> {}", type_path)); + } + + pretty_path.push('>'); + + pretty_path + } + + pub fn pretty_print_value_opaque(&self, v: &dyn PartialReflect, output: &mut String) { + let type_id = v + .get_represented_type_info() + .map(|t| t.type_id()) + .type_id_or_fake_id(); + + output.push_str("Reflect("); + match type_id { + id if id == TypeId::of::() => downcast_case!(v, output, usize), + id if id == TypeId::of::() => downcast_case!(v, output, isize), + id if id == TypeId::of::() => downcast_case!(v, output, f32), + id if id == TypeId::of::() => downcast_case!(v, output, f64), + id if id == TypeId::of::() => downcast_case!(v, output, u128), + id if id == TypeId::of::() => downcast_case!(v, output, u64), + id if id == TypeId::of::() => downcast_case!(v, output, u32), + id if id == TypeId::of::() => downcast_case!(v, output, u16), + id if id == TypeId::of::() => downcast_case!(v, output, u8), + id if id == TypeId::of::() => downcast_case!(v, output, i128), + id if id == TypeId::of::() => downcast_case!(v, output, i64), + id if id == TypeId::of::() => downcast_case!(v, output, i32), + id if id == TypeId::of::() => downcast_case!(v, output, i16), + id if id == TypeId::of::() => downcast_case!(v, output, i8), + id if id == TypeId::of::() => downcast_case!(v, output, String), + id if id == TypeId::of::() => downcast_case!(v, output, bool), + _ => { + output.push_str( + v.get_represented_type_info() + .map(|t| t.type_path()) + .unwrap_or(Self::UNREGISTERED_TYPE), + ); + } + } + output.push(')'); + } + + /// Prints the actual value of the reference. Tries to use best available method to print the value. + pub fn pretty_print_value(&self, world: &WorldAccessGuard) -> String { + let mut output = String::new(); + + // instead of relying on type registrations, simply traverse the reflection tree and print sensible values + self.reference + .with_reflect(world, |r| { + self.pretty_print_value_inner(r, &mut output); + }) + .unwrap_or_else(|e| { + output.push_str(&format!("", e)); + }); + + output + } + + fn pretty_print_key_values< + K: AsRef, + V: AsRef, + I: IntoIterator, V)>, + >( + bracket: BracketType, + i: I, + output: &mut String, + ) { + bracket.surrounded(output, |output| { + let mut iter = i.into_iter().peekable(); + while let Some((key, val)) = iter.next() { + if let Some(key) = key { + output.push_str(key.as_ref()); + output.push_str(": "); + } + output.push_str(val.as_ref()); + if iter.peek().is_some() { + output.push_str(", "); + } + } + }); + } + + fn pretty_print_value_struct< + 'k, + N: Iterator, + M: Iterator, + >( + &self, + field_names: N, + field_values: M, + output: &mut String, + ) { + let field_names = field_names.into_iter(); + let fields = field_values.into_iter(); + let fields_iter = fields.zip_longest(field_names).map(|e| { + let (val, name) = match e { + itertools::EitherOrBoth::Both(val, name) => (val, name), + itertools::EitherOrBoth::Left(val) => (val, Self::UNKNOWN_FIELD), + itertools::EitherOrBoth::Right(name) => (().as_partial_reflect(), name), + }; + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (Some(name), field_printed) + }); + Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); + } + + fn pretty_print_value_inner(&self, v: &dyn PartialReflect, output: &mut String) { + match v.reflect_ref() { + bevy::reflect::ReflectRef::Struct(s) => { + let field_names = s + .get_represented_struct_info() + .map(|info| info.field_names()) + .unwrap_or_default() + .iter(); + let field_values = s.iter_fields(); + + self.pretty_print_value_struct(field_names.copied(), field_values, output); + } + ReflectRef::TupleStruct(t) => { + let fields_iter = t.iter_fields().enumerate().map(|(i, val)| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (Some(i.to_string()), field_printed) + }); + Self::pretty_print_key_values(BracketType::Round, fields_iter, output); + } + ReflectRef::Tuple(t) => { + let fields_iter = t.iter_fields().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Round, fields_iter, output); + } + ReflectRef::List(l) => { + let fields_iter = l.iter().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Square, fields_iter, output); + } + ReflectRef::Array(a) => { + let fields_iter = a.iter().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Square, fields_iter, output); + } + ReflectRef::Map(m) => { + let fields_iter = m.iter().map(|(key, val)| { + let mut key_printed = String::new(); + self.pretty_print_value_inner(key, &mut key_printed); + + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (Some(key_printed), field_printed) + }); + Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); + } + ReflectRef::Set(s) => { + let fields_iter = s.iter().map(|val| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(val, &mut field_printed); + (None::, field_printed) + }); + Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); + } + ReflectRef::Enum(e) => { + output.push_str(&e.variant_path()); + let bracket_type = match e.variant_type() { + bevy::reflect::VariantType::Tuple => BracketType::Round, + _ => BracketType::Curly, + }; + let key_vals = e.iter_fields().map(|v| { + let mut field_printed = String::new(); + self.pretty_print_value_inner(v.value(), &mut field_printed); + (v.name(), field_printed) + }); + Self::pretty_print_key_values(bracket_type, key_vals, output); + } + ReflectRef::Opaque(o) => { + self.pretty_print_value_opaque(o, output); + } + ReflectRef::Function(f) => { + output.push_str("Function("); + output.push_str( + &f.info() + .name() + .unwrap_or(&Cow::Borrowed("")) + .to_string(), + ); + output.push(')'); + } + } + } +} + +/// For types which can't be pretty printed without world access. +/// Implementors should try to print the best value they can, and never panick. +pub trait DisplayWithWorld { + /// Display the `shallowest` representation of the type using world access. + /// For references this is the type path and the type of the value they are pointing to. + fn display_with_world(&self, world: &WorldAccessGuard) -> String; + + /// Display the most literal representation of the type using world access. + /// I.e. for references this would be the pointed to value itself. + fn display_value_with_world(&self, world: &WorldAccessGuard) -> String; +} + +impl DisplayWithWorld for ReflectReference { + fn display_with_world(&self, world: &WorldAccessGuard) -> String { + ReflectReferencePrinter::new(self.clone()).pretty_print(world) + } + + fn display_value_with_world(&self, world: &WorldAccessGuard) -> String { + ReflectReferencePrinter::new(self.clone()).pretty_print_value(world) + } +} + +impl DisplayWithWorld for ReflectBaseType { + fn display_with_world(&self, world: &WorldAccessGuard) -> String { + let mut string = String::new(); + ReflectReferencePrinter::pretty_print_base(self, world, &mut string); + string + } + + fn display_value_with_world(&self, world: &WorldAccessGuard) -> String { + self.display_with_world(world) + } +} + +impl DisplayWithWorld for TypeId { + fn display_with_world(&self, world: &WorldAccessGuard) -> String { + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + type_registry + .get_type_info(*self) + .map(|t| t.type_path_table().path().to_owned()) + .unwrap_or_else(|| { + format!("{}({:?})", ReflectReferencePrinter::UNREGISTERED_TYPE, self) + }) + .to_string() + } + + fn display_value_with_world(&self, world: &WorldAccessGuard) -> String { + self.display_with_world(world) + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs index ce1002b537..d65bb53385 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs @@ -16,10 +16,7 @@ use crate::{ prelude::{ReflectAllocator, ScriptError}, }; -use super::{ - world::{WorldAccessGuard, WorldAccessUnit, WorldAccessWrite}, - ReflectReference, DEFAULT_INTERVAL, DEFAULT_TIMEOUT, -}; +use super::{world::WorldAccessGuard, ReflectReference, DEFAULT_INTERVAL, DEFAULT_TIMEOUT}; /// Inverse to [`Unproxy`], packages up a type into a proxy type. pub trait Proxy: Sized { @@ -53,11 +50,11 @@ pub trait Unproxy { where Self: 'o; - fn collect_accesses<'w>( - &self, - _guard: &WorldAccessGuard<'w>, - _accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, - ) -> ScriptResult<()> { + fn collect_accesses<'w>(&self, _guard: &WorldAccessGuard<'w>) -> ScriptResult<()> { + Ok(()) + } + + fn release_accesses<'w>(&self, _guard: &WorldAccessGuard<'w>) -> ScriptResult<()> { Ok(()) } @@ -80,7 +77,6 @@ pub trait Unproxy { unsafe fn unproxy_with_world<'w, 'o>( &'o mut self, _guard: &WorldAccessGuard<'w>, - _accesses: &'o [WorldAccessUnit<'w>], _type_registry: &TypeRegistry, _allocator: &ReflectAllocator, ) -> ScriptResult> { @@ -135,7 +131,10 @@ impl Unproxy for ValProxy where T: for<'l> From<&'l P>, { - type Output<'o> = T where Self: 'o; + type Output<'o> + = T + where + Self: 'o; fn unproxy<'o>(&'o mut self) -> ScriptResult> { Ok(T::from(&self.0)) @@ -175,7 +174,10 @@ where P: AsRef, T: FromReflect, { - type Output<'o> = T where Self: 'o; + type Output<'o> + = T + where + Self: 'o; unsafe fn unproxy_with_world<'w, 'o>( &'o mut self, @@ -184,23 +186,29 @@ where type_registry: &TypeRegistry, allocator: &'o ReflectAllocator, ) -> ScriptResult> { + bevy::log::debug!( + "Unproxying ReflectValProxy for type: `{}`", + std::any::type_name::() + ); let reflect_ref: &ReflectReference = self.0.as_ref(); let access = reflect_ref.base.base_id.get_reflect_access_id(); let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); - let out = reflect_ref.reflect( - guard.as_unsafe_world_cell(), - &access, - type_registry, - Some(allocator), - )?; - let out = T::from_reflect(out).ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "FromReflect failed for `{}`.", - std::any::type_name::() - )) - })?; + let out = (|| { + let out = reflect_ref.reflect( + guard.as_unsafe_world_cell(), + &access, + type_registry, + Some(allocator), + )?; + T::from_reflect(out).ok_or_else(|| { + ScriptError::new_reflection_error(format!( + "FromReflect failed for `{}`.", + std::any::type_name::() + )) + }) + })(); guard.release_access(access); - Ok(out) + out } } @@ -232,13 +240,20 @@ where P: AsRef, T: Reflect, { - type Output<'o> = &'o T where Self: 'o; + type Output<'o> + = &'o T + where + Self: 'o; fn collect_accesses<'w>( &self, guard: &WorldAccessGuard<'w>, accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, ) -> ScriptResult<()> { + bevy::log::debug!( + "Unproxying ReflectRefProxy for type: `{}`", + std::any::type_name::() + ); let reflect_ref: &ReflectReference = self.0.as_ref(); let access = reflect_ref.base.base_id.get_reflect_access_id(); let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); @@ -286,7 +301,10 @@ where P: AsRef, T: Reflect, { - type Output<'o> = &'o mut T where Self: 'o; + type Output<'o> + = &'o mut T + where + Self: 'o; fn collect_accesses<'w>( &self, @@ -486,7 +504,10 @@ impl_proxy_via_vec!(SmallVec<[T; C]>, T, SmallVec<[T::Input<'i>; C]>, (T: Proxy, // } impl Unproxy for Option { - type Output<'o> = Option> where Self: 'o; + type Output<'o> + = Option> + where + Self: 'o; fn unproxy(&mut self) -> ScriptResult> { if let Some(s) = self { @@ -515,7 +536,7 @@ impl Unproxy for Option { fn collect_accesses<'w>( &self, guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, + accesses: &mut SmallVec<[WorldAccess<'w>; 1]>, ) -> ScriptResult<()> { self.as_ref() .map(|s| s.collect_accesses(guard, accesses)) @@ -566,7 +587,10 @@ impl Proxy for Result { } impl Unproxy for Result { - type Output<'o> = Result, E::Output<'o>> where Self: 'o; + type Output<'o> + = Result, E::Output<'o>> + where + Self: 'o; fn unproxy(&mut self) -> ScriptResult> { match self { @@ -596,7 +620,7 @@ impl Unproxy for Result { fn collect_accesses<'w>( &self, guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, + accesses: &mut SmallVec<[WorldAccess<'w>; 1]>, ) -> ScriptResult<()> { match self { Ok(s) => s.collect_accesses(guard, accesses), diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index cf2a4dfdf7..663dd4ee1e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -2,6 +2,7 @@ use super::{ReflectReference, WorldAccessGuard, WorldCallbackAccess}; use crate::{ bindings::{CONCURRENT_WORLD_ACCESS_MSG, STALE_WORLD_MSG}, prelude::ScriptResult, + with_global_access, }; use bevy::{ ecs::{component::ComponentId, entity::Entity}, @@ -107,46 +108,48 @@ impl WorldCallbackAccess { impl<'w> WorldAccessGuard<'w> { pub fn query(&self, query: ScriptQueryBuilder) -> ScriptResult> { - let world = self - .get_whole_world_access() - .unwrap_or_else(|| panic!("{CONCURRENT_WORLD_ACCESS_MSG}")); - - let mut dynamic_query = QueryBuilder::::new(world); - - // we don't actually want to fetch the data for components now, only figure out - // which entities match the query - // so we might be being slightly overkill - for c in &query.components { - dynamic_query.ref_id(c.component_id().unwrap()); - } - - for w in query.with { - dynamic_query.with_id(w.component_id.unwrap()); - } - - for without_id in query.without { - dynamic_query.without_id(without_id.component_id.unwrap()); - } - - let mut built_query = dynamic_query.build(); - let query_result = built_query.iter(world); - - Ok(query_result - .map(|r| { - let references: Vec<_> = query - .components - .iter() - .map(|c| ReflectReference { - base: super::ReflectBaseType { - type_id: c.type_id(), - base_id: super::ReflectBase::Component(r.id(), c.component_id.unwrap()), - }, - reflect_path: vec![], - }) - .collect(); - ScriptQueryResult(r.id(), references) - }) - .collect()) + with_global_access!(self.0.accesses, "Could not query", { + let world = unsafe { self.as_unsafe_world_cell().world_mut() }; + let mut dynamic_query = QueryBuilder::::new(world); + + // we don't actually want to fetch the data for components now, only figure out + // which entities match the query + // so we might be being slightly overkill + for c in &query.components { + dynamic_query.ref_id(c.component_id().unwrap()); + } + + for w in query.with { + dynamic_query.with_id(w.component_id.unwrap()); + } + + for without_id in query.without { + dynamic_query.without_id(without_id.component_id.unwrap()); + } + + let mut built_query = dynamic_query.build(); + let query_result = built_query.iter(world); + + Ok(query_result + .map(|r| { + let references: Vec<_> = query + .components + .iter() + .map(|c| ReflectReference { + base: super::ReflectBaseType { + type_id: c.type_id(), + base_id: super::ReflectBase::Component( + r.id(), + c.component_id.unwrap(), + ), + }, + reflect_path: vec![], + }) + .collect(); + ScriptQueryResult(r.id(), references) + }) + .collect()) + }) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index e86479d4b1..fb23218f13 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -4,47 +4,40 @@ //! reflection gives us access to `dyn PartialReflect` objects via their type name, //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. -use itertools::Itertools; -use lockable::LockableHashMap; - -pub use itertools::Either; - use std::{ any::TypeId, - cell::UnsafeCell, - error::Error, fmt::Debug, - marker::PhantomData, - ops::Index, - sync::{Arc, Weak}, - time::Duration, + sync::Arc, }; - use bevy::{ ecs::{ change_detection::MutUntyped, - component::{Component, ComponentId}, + component::ComponentId, entity::Entity, - reflect::AppTypeRegistry, - system::Resource, - world::{unsafe_world_cell::UnsafeWorldCell, Mut, World}, - }, - ptr::Ptr, - reflect::{ - Access, AccessError, DynamicEnum, DynamicTuple, ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectMut, ReflectPath, ReflectPathError, ReflectRef, TypeData, TypeInfo, TypeRegistry - }, + world::unsafe_world_cell::UnsafeWorldCell, + }, prelude::{Component, Resource}, ptr::Ptr, reflect::{ + func::{args::ArgInfo, ArgValue}, + ParsedPath, + PartialReflect, + ReflectFromPtr, + ReflectMut, + ReflectPath, + ReflectPathError, + ReflectRef, + TypeData, + } }; -use smallvec::SmallVec; - +use itertools::Either; use crate::{ - bindings::{ReflectAllocation, ReflectAllocationId}, - prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, + bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, + prelude::{ReflectAllocator, ScriptError, ScriptResult}, + reflection_extensions::PartialReflectExt, + with_access_read, + with_access_write, }; - use super::{ - proxy::{Proxy, Unproxy}, - ReflectAccessId, ReflectAccessKind, WorldAccessGuard, WorldAccessWrite, DEFAULT_INTERVAL, - DEFAULT_TIMEOUT, + access_map::{AccessMapKey, ReflectAccessId}, + WorldAccessGuard, }; /// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path @@ -80,7 +73,7 @@ impl ReflectReference { /// If this is a reference to something with a length accessible via reflection, returns that length. pub fn len(&self, world: &WorldAccessGuard) -> ScriptResult> { self - .with_reflect(world, |r, _, _| { + .with_reflect(world, |r| { match r.reflect_ref() { bevy::reflect::ReflectRef::Struct(s) => Some(s.field_len()), bevy::reflect::ReflectRef::TupleStruct(ts) => Some(ts.field_len()), @@ -90,7 +83,7 @@ impl ReflectReference { bevy::reflect::ReflectRef::Map(m) => Some(m.len( )), bevy::reflect::ReflectRef::Set(s) => Some(s.len()), bevy::reflect::ReflectRef::Enum(e) => Some(e.field_len()), - bevy::reflect::ReflectRef::Opaque(_) => None, + _ => None, } }) } @@ -125,104 +118,87 @@ impl ReflectReference { } } - /// Indexes into the reflect path inside this reference. - /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. - pub fn index_path>(&mut self, index: T) { - self.reflect_path.push(index.into()); + pub fn new_resource_ref(world: &WorldAccessGuard) -> Option { + let reflect_id = ReflectAccessId::for_resource::(&world.as_unsafe_world_cell())?; + Some(Self { + base: ReflectBaseType { + type_id: TypeId::of::(), + base_id: ReflectBase::Resource(reflect_id.into()), + }, + reflect_path: Vec::default(), + }) } - /// A form of [`Self::reflect`] which does the access checks for you. - #[track_caller] - pub fn with_reflect O>( - &self, + pub fn new_component_ref( + entity: Entity, world: &WorldAccessGuard, - f: F, - ) -> ScriptResult { - world.with_allocator_and_type_registry(|world, type_registry, mut allocator| { - let type_registry = type_registry.write(); - self.with_reflect_only(world, &type_registry, &mut allocator, f) + ) -> Option { + let reflect_id = ReflectAccessId::for_component::(&world.as_unsafe_world_cell())?; + Some(Self { + base: ReflectBaseType { + type_id: TypeId::of::(), + base_id: ReflectBase::Component(entity, reflect_id.into()), + }, + reflect_path: Vec::default(), }) } - pub fn with_reflect_only O>( - &self, - world: &WorldAccessGuard, - type_registry: &TypeRegistry, - allocator: &mut ReflectAllocator, - f: F, - ) -> ScriptResult { - let access = world - .get_access_timeout( - self.base.base_id.get_reflect_access_id(), - DEFAULT_TIMEOUT, - DEFAULT_INTERVAL, - ); - - let reflect = self - .reflect( - world.as_unsafe_world_cell(), - &access, - type_registry, - Some(allocator), - ).map(|r| f(r, type_registry, allocator)); - - world.release_access(access); - reflect + /// Indexes into the reflect path inside this reference. + /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. + pub fn index_path>(&mut self, index: T) { + self.reflect_path.push(index.into()); } - #[track_caller] - pub fn with_reflect_mut O>( + /// The way to access the value of the reference, that is the pointed-to value. + /// This method is safe to use as it ensures no-one else has aliasing access to the value at the same time. + /// + /// # Panics + /// - if the value is aliased and the access is not allowed + pub fn with_reflect O>( &self, world: &WorldAccessGuard, f: F, ) -> ScriptResult { - world.with_allocator_and_type_registry(|_, type_registry, mut allocator| { - let type_registry = type_registry.read(); - self.with_reflect_mut_only(world, &type_registry, &mut allocator, f) + let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ScriptError::new_reflection_error(""))?; + with_access_read!(world.0.accesses, access_id ,"could not access reflect reference",{ + unsafe { self.reflect_unsafe(world) } + .map(f) }) } - pub fn with_reflect_mut_only O>( + + /// The way to access the value of the reference, that is the pointed-to value. + /// This method is safe to use as it ensures no-one else has aliasing access to the value at the same time. + /// + /// # Panics + /// - if the value is aliased and the access is not allowed + pub fn with_reflect_mut O>( &self, world: &WorldAccessGuard, - type_registry: &TypeRegistry, - allocator: &mut ReflectAllocator, f: F, ) -> ScriptResult { - let mut access = world - .get_access_timeout( - self.base.base_id.get_reflect_access_id(), - DEFAULT_TIMEOUT, - DEFAULT_INTERVAL, - ); - - let reflect = self - .reflect_mut( - world.as_unsafe_world_cell(), - &mut access, - type_registry, - Some(allocator), - ).map(|r| f(r, type_registry, allocator)); - - world.release_access(access); - reflect + let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ScriptError::new_reflection_error(""))?; + with_access_write!(world.0.accesses, access_id, "Could not access reflect reference mutably", { + unsafe { self.reflect_mut_unsafe(world) } + .map(f) + }) } - fn tail_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { - self.with_reflect(world, |r, _, _| { + pub fn tail_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + self.with_reflect(world, |r| { r.get_represented_type_info().map(|t| t.type_id()) }) } - fn element_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { - self.with_reflect(world, |r, _, _| { + pub fn element_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + self.with_reflect(world, |r| { r.element_type_id() }) } - fn key_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { - self.with_reflect(world, |r, _, _| { + pub fn key_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + self.with_reflect(world, |r| { r.key_type_id() }) } @@ -242,16 +218,13 @@ impl ReflectReference { D2: TypeData + Clone, { if let Some(type_id) = type_id { - - if let Some(type_data) = world.with_resource(|_, type_registry: Mut| { - let type_registry = type_registry.read(); - type_registry.get_type_data::(type_id).cloned() - }) { + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + if let Some(type_data) = type_registry.get_type_data::(type_id).cloned() { + drop(type_registry); return Ok(map(Some(Either::Left(type_data)))); - } else if let Some(type_data) = world.with_resource(|_, type_registry: Mut| { - let type_registry = type_registry.read(); - type_registry.get_type_data::(type_id).cloned() - }) { + } else if let Some(type_data) = type_registry.get_type_data::(type_id).cloned() { + drop(type_registry); return Ok(map(Some(Either::Right(type_data)))); } } @@ -259,112 +232,114 @@ impl ReflectReference { Ok(map(None)) } + /// Converts the reference into an argument that can be consumed by a dynamic function. + /// + /// In the case that the underlying value is dynamic, this will convert to an [`ArgValue::Owned`] Which notably will not be directly usable by the function. + /// To use the output you must make sure your calling mechanism is lenient enough to accept Owned variants in place of refs/muts. + /// + /// Or alternatively convert any non concrete types to concrete types using `from_reflect` before calling this function. + /// + /// # Safety + /// - The caller must ensure this reference has permission to access the underlying value + pub unsafe fn into_arg_value<'w>(self, world: &'w WorldAccessGuard, arg_info: &ArgInfo) -> ScriptResult> { + // arg values need to always return a reference to a concrete type `T`, so we need a FromReflect bound + // to ensure we can convert the `dyn PartialReflect` into a concrete type + + match arg_info.ownership() { + bevy::reflect::func::args::Ownership::Ref => { + + let mut ref_ = unsafe {self.reflect_unsafe(world)?}; + + if ref_.is_dynamic() { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + let boxed = ::from_reflect(ref_, world)?.into_partial_reflect(); + let (_, allocation) = allocator.allocate_boxed(boxed); + // Safety: + // we are the only ones with this id, nobody else can touch this. + // we only need to make sure this doesn't get dropped before we're done with it + // the only time that will happen is when ReflectAllocator::clean_garbage_allocations is called + // this will not happen while script event handlers are running + ref_ = unsafe { &*allocation.get_ptr() }; + } + Ok(ArgValue::Ref(ref_)) + }, + bevy::reflect::func::args::Ownership::Mut => { + + let mut mut_ = unsafe {self.reflect_mut_unsafe(world)?}; - /// Returns `Ok(())` if the given access is sufficient to read the value or an appropriate error otherwise - pub fn expect_read_access<'w>( - &self, - access: &WorldAccessWrite<'w>, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, - world: UnsafeWorldCell<'w>, - ) -> ScriptResult<()> { - if !access.can_read(self.base.base_id.get_reflect_access_id()) { - Err(ScriptError::new_reflection_error(format!( - "Invalid access when trying to read: `{}`, instead got access to `{}`", - self.base.display_with_type_name(type_registry), - access.to_enriched_str(type_registry, allocator, world) - ))) - } else { - Ok(()) - } - } + if mut_.is_dynamic() { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + let boxed = ::from_reflect(mut_, world)?.into_partial_reflect(); + let (_, allocation) = allocator.allocate_boxed(boxed); + // Safety: + // same as the ref branch + mut_ = unsafe { &mut *allocation.get_ptr() }; + } - /// Returns `Ok(())` if the given access is sufficient to write to the value or an appropriate error otherwise - /// Note that this is not sufficient for write access, you also need to ensure the [`WorldAccessWrite`] won't be used to access the same value mutably elsewhere, - /// if you have a `&mut WorldAccessWrite` you can guarantee this statically. This function just checks that the access itself is for the right base with write access - pub fn expect_write_access<'w>( - &self, - access: &WorldAccessWrite<'w>, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, - world: UnsafeWorldCell<'w>, - ) -> ScriptResult<()> { - if !access.can_read(self.base.base_id.get_reflect_access_id()) { - Err(ScriptError::new_reflection_error(format!( - "Invalid access when trying to write: `{}`, instead got access to `{}`", - self.base.display_with_type_name(type_registry), - access.to_enriched_str(type_registry, allocator, world) - ))) - } else { - Ok(()) + Ok(ArgValue::Mut(mut_)) + + } + _ => { + let ref_ = unsafe {self.reflect_unsafe(world)?}; + Ok(ArgValue::Owned(::from_reflect(ref_, world)?.into_partial_reflect())) + } } - } + - /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell. - /// If the underlying componentId is not the same as the one we have access to, an error is returned. - pub fn reflect<'w, 'c>( - &self, - world: UnsafeWorldCell<'w>, - access: &'c WorldAccessWrite<'w>, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, - ) -> ScriptResult<&'c dyn PartialReflect> { - self.expect_read_access(access, type_registry, allocator, world)?; - // Safety: since we have read access to the underlying componentId we can safely access the component - // and we can return a reference tied to its lifetime, which will prevent invalid aliasing - unsafe { self.reflect_unsafe(world, type_registry, allocator) } } - /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell. - /// If the underlying componentId is not the same as the one we have access to, an error is returned. - /// - /// If we are accessing a component or resource, it's marked as changed - pub fn reflect_mut<'w, 'c>( - &self, - world: UnsafeWorldCell<'w>, - access: &'c mut WorldAccessWrite<'w>, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, - ) -> ScriptResult<&'c mut dyn PartialReflect> { - self.expect_write_access(access, type_registry, allocator, world)?; - // Safety: since we have write access to the underlying reflect access id we can safely access the component - // and we can return a reference tied to its lifetime, which will prevent invalid aliasing - unsafe { self.reflect_mut_unsafe(world, type_registry, allocator) } - } /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell /// # Safety + /// /// - The caller must ensure the cell has permission to access the underlying value - /// - The caller must ensure no aliasing mut references to the same value exist at all at the same time + /// - The caller must ensure no aliasing references to the same value exist at all at the same time + /// + /// To do this safely you need to use [`WorldAccessGuard::claim_read_access`] or [`WorldAccessGuard::claim_global_access`] to ensure nobody else is currently accessing the value. pub unsafe fn reflect_unsafe<'w>( &self, - world: UnsafeWorldCell<'w>, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, + world: &WorldAccessGuard<'w> ) -> ScriptResult<&'w dyn PartialReflect> { + if let ReflectBase::Owned(id) = &self.base.base_id { - let allocator = - allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; + + let allocator = world.allocator(); + let allocator = allocator.read(); + let arc = allocator - .get(*id) + .get(id) .ok_or_else(|| ScriptError::new_reflection_error("Missing allocation"))?; // safety: caller promises it's fine :) return self.walk_path(unsafe { &*arc.get_ptr() }); }; + + + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + // all Reflect types should have this derived - let from_ptr_data: &ReflectFromPtr = type_registry - .get_type_data(self.base.type_id) - .expect("FromPtr is not registered for this type, cannot retrieve reflect reference"); + let from_ptr_data: &ReflectFromPtr = + type_registry + .get_type_data(self.base.type_id) + .ok_or_else(|| ScriptError::new_reflection_error( + format!("FromPtr is not registered for {}", self.display_with_world(world))) + )?; let ptr = self .base .base_id .clone() - .into_ptr(world) + .into_ptr(world.as_unsafe_world_cell()) .ok_or_else(|| ScriptError::new_reflection_error( - format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_type_name(type_registry))))?; + format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_world(world))))?; + // (Ptr) Safety: we use the same type_id to both // 1) retrieve the ptr @@ -374,9 +349,14 @@ impl ReflectReference { debug_assert_eq!( from_ptr_data.type_id(), self.base.type_id, - "Invariant violated" + "Safety invariant violated" ); + let base = unsafe { from_ptr_data.as_reflect(ptr) }; + + + drop(type_registry); + self.walk_path(base.as_partial_reflect()) } @@ -384,38 +364,42 @@ impl ReflectReference { /// # Safety /// - The caller must ensure the cell has permission to access the underlying value /// - The caller must ensure no other references to the same value exist at all at the same time (even if you have the correct access) + /// + /// To do this safely you need to use [`WorldAccessGuard::claim_write_access`] or [`WorldAccessGuard::claim_global_access`] to ensure nobody else is currently accessing the value. pub unsafe fn reflect_mut_unsafe<'w>( &self, - world: UnsafeWorldCell<'w>, - type_registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, + world: &WorldAccessGuard<'w> ) -> ScriptResult<&'w mut dyn PartialReflect> { if let ReflectBase::Owned(id) = &self.base.base_id { - let allocator = - allocator.ok_or_else(|| ScriptError::new_reflection_error("Allocator missing"))?; - + let allocator = world.allocator(); + let allocator = allocator.read(); let arc = allocator - .get_mut(*id) + .get_mut(id) .ok_or_else(|| ScriptError::new_reflection_error("Missing allocation"))?; // Safety: caller promises this is fine :) return self.walk_path_mut(unsafe { &mut *arc.get_ptr() }); }; + + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + // all Reflect types should have this derived let from_ptr_data: &ReflectFromPtr = type_registry .get_type_data(self.base.type_id) - .expect("FromPtr is not registered for this type, cannot retrieve reflect reference"); + .ok_or_else(|| + ScriptError::new_reflection_error( + format!("Base reference is invalid, is the component/resource initialized? When accessing: `{}`", self.base.display_with_world(world))))?; let ptr = self .base .base_id .clone() - .into_ptr_mut(world) + .into_ptr_mut(world.as_unsafe_world_cell()) .ok_or_else(|| ScriptError::new_reflection_error( - format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_type_name(type_registry))))? - .into_inner(); + format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_world(world))))?; // (Ptr) Safety: we use the same type_id to both // 1) retrieve the ptr @@ -427,7 +411,8 @@ impl ReflectReference { self.base.type_id, "Invariant violated" ); - let base = unsafe { from_ptr_data.as_reflect_mut(ptr) }; + let base = unsafe { from_ptr_data.as_reflect_mut(ptr.into_inner()) }; + drop(type_registry); self.walk_path_mut(base.as_partial_reflect_mut()) } @@ -461,27 +446,6 @@ pub struct ReflectBaseType { pub base_id: ReflectBase, } -impl ReflectBaseType { - pub fn type_name(type_id: TypeId, type_registry: &TypeRegistry) -> &'static str { - type_registry - .get_type_info(type_id) - .map(TypeInfo::type_path) - .unwrap_or("") - } - - pub fn display_with_type_name(&self, type_registry: &TypeRegistry) -> String { - let type_name = Self::type_name(self.type_id, type_registry); - - let kind = match self.base_id { - ReflectBase::Component(_, _) => "Component", - ReflectBase::Resource(_) => "Resource", - ReflectBase::Owned(_) => "Allocation", - }; - - format!("{}({})", kind, type_name) - } -} - /// The Id of the kind of reflection base being pointed to #[derive(Clone, Debug, PartialEq, Eq)] pub enum ReflectBase { @@ -528,28 +492,17 @@ impl ReflectBase { _ => None, } } - - pub fn get_reflect_access_id(&self) -> ReflectAccessId { - match self { - ReflectBase::Component(_, cid) | ReflectBase::Resource(cid) => (*cid).into(), - ReflectBase::Owned(id) => (*id).into(), - } - } } fn map_key_to_concrete(key: &str, key_type_id: TypeId) -> Option> { - let string_type_id = std::any::TypeId::of::(); - let usize_type_id = std::any::TypeId::of::(); - let f32_type_id = std::any::TypeId::of::(); - let bool_type_id = std::any::TypeId::of::(); match key_type_id { - // string_type_id => Some(Box::new(key.to_owned())), - usize_type_id => key.parse::().ok().map(|u| Box::new(u) as Box), - f32_type_id => key.parse::().ok().map(|f| Box::new(f) as Box), - bool_type_id => key.parse::().ok().map(|b| Box::new(b) as Box), - _ => return None, + _ if key_type_id == std::any::TypeId::of::() => Some(Box::new(key.to_owned())), + _ if key_type_id == std::any::TypeId::of::() => key.parse::().ok().map(|u| Box::new(u) as Box), + _ if key_type_id == std::any::TypeId::of::() => key.parse::().ok().map(|f| Box::new(f) as Box), + _ if key_type_id == std::any::TypeId::of::() => key.parse::().ok().map(|b| Box::new(b) as Box), + _ => None, } } @@ -620,8 +573,8 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { if let ReflectRef::Map(map) = root.reflect_ref() { let key_type_id = map.key_type_id().expect("Expected map keys to represent a type to be able to assign values"); let key = map_key_to_concrete(key, key_type_id) - .ok_or_else(|| ReflectPathError::InvalidDowncast)?; - map.get(key.as_ref()).ok_or_else(|| ReflectPathError::InvalidDowncast) + .ok_or(ReflectPathError::InvalidDowncast)?; + map.get(key.as_ref()).ok_or(ReflectPathError::InvalidDowncast) } else { Err(ReflectPathError::InvalidDowncast) } @@ -642,8 +595,8 @@ impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { if let ReflectMut::Map(map) = root.reflect_mut() { let key_type_id = map.key_type_id().expect("Expected map keys to represent a type to be able to assign values"); let key = map_key_to_concrete(key, key_type_id) - .ok_or_else(|| ReflectPathError::InvalidDowncast)?; - map.get_mut(key.as_ref()).ok_or_else(|| ReflectPathError::InvalidDowncast) + .ok_or(ReflectPathError::InvalidDowncast)?; + map.get_mut(key.as_ref()).ok_or(ReflectPathError::InvalidDowncast) } else { Err(ReflectPathError::InvalidDowncast) } @@ -761,269 +714,3 @@ impl Iterator for ReflectRefIter { Some(result) } } - -pub struct ReflectReferencePrinter{ - pub(crate) reference: ReflectReference, -} - -#[derive(Clone, Copy, Debug)] -enum BracketType { - Square, - Curly, - Round, -} - -impl BracketType { - - fn open(self) -> char { - match self { - BracketType::Square => '[', - BracketType::Curly => '{', - BracketType::Round => '(', - } - } - - fn close(self) -> char { - match self { - BracketType::Square => ']', - BracketType::Curly => '}', - BracketType::Round => ')', - } - } - - fn surrounded(self, output: &mut String, f: F) { - output.push(self.open()); - f(output); - output.push(self.close()); - } -} - -macro_rules! downcast_case { - ($id:ident, $out:ident, $t:path) => { - { - $out.push_str(stringify!($t)); - $out.push('('); - if let Some($id) = $id.as_partial_reflect().try_downcast_ref::<$t>() { - $out.push_str(&format!("{:?}", $id)); - } else { - $out.push_str(""); - } - $out.push(')'); - } - } -} - -impl ReflectReferencePrinter { - const UNREGISTERED_TYPE: &'static str = ""; - const UNKNOWN_FIELD: &'static str = ""; - - pub fn new(reference: ReflectReference) -> Self { - Self { reference } - } - - /// Given a reflect reference, prints the type path of the reference resolving the type names with short names. - /// I.e. `MyType(Component).field_name[0].field_name[1] -> FieldType::Name` - pub fn pretty_print(&self, world: &WorldAccessGuard) -> String { - let mut pretty_path = String::new(); - - pretty_path.push_str(" format!("Component on entity {e}"), - ReflectBase::Resource(_) => "Resource".to_owned(), - ReflectBase::Owned(_) => "Allocation".to_owned(), - }; - - let tail_type_id = self.reference.tail_type_id(world).ok().flatten(); - - world.with_resource(|_, type_registry : Mut| { - let type_registry = type_registry.read(); - let root_type_path = type_registry.get_type_info(self.reference.base.type_id).map(|t| t.type_path_table().short_path()).unwrap_or(""); - pretty_path.push_str(&format!("{}({})", root_suffix, root_type_path)); - - for elem in self.reference.reflect_path.iter() { - match elem { - ReflectionPathElem::Reflection(path) => { - pretty_path.push_str(&path.to_string()); - } - ReflectionPathElem::DeferredReflection(_) => { - pretty_path.push_str("."); - } - ReflectionPathElem::Identity => { - pretty_path.push_str(""); - } - ReflectionPathElem::MapAccess(key) => { - pretty_path.push_str(&format!("[{}]", key)); - }, - - } - } - - if let Some(tail_type_id) = tail_type_id { - let type_path = type_registry.get_type_info(tail_type_id).map(|t| t.type_path_table().short_path()).unwrap_or(Self::UNREGISTERED_TYPE); - pretty_path.push_str(&format!(" -> {}", type_path)); - } - }); - - pretty_path.push('>'); - - pretty_path - } - - - pub fn pretty_print_value_opaque(&self, v: &dyn PartialReflect, output: &mut String) { - - let type_id = v.get_represented_type_info().map(|t| t.type_id()).type_id_or_fake_id(); - output.push_str("Reflect("); - match type_id { - id if id == TypeId::of::() => downcast_case!(v, output, usize), - id if id == TypeId::of::() => downcast_case!(v, output, isize), - id if id == TypeId::of::() => downcast_case!(v, output, f32), - id if id == TypeId::of::() => downcast_case!(v, output, f64), - id if id == TypeId::of::() => downcast_case!(v, output, u128), - id if id == TypeId::of::() => downcast_case!(v, output, u64), - id if id == TypeId::of::() => downcast_case!(v, output, u32), - id if id == TypeId::of::() => downcast_case!(v, output, u16), - id if id == TypeId::of::() => downcast_case!(v, output, u8), - id if id == TypeId::of::() => downcast_case!(v, output, i128), - id if id == TypeId::of::() => downcast_case!(v, output, i64), - id if id == TypeId::of::() => downcast_case!(v, output, i32), - id if id == TypeId::of::() => downcast_case!(v, output, i16), - id if id == TypeId::of::() => downcast_case!(v, output, i8), - id if id == TypeId::of::() => downcast_case!(v, output, String), - id if id == TypeId::of::() => downcast_case!(v, output, bool), - _ => { - output.push_str(v.get_represented_type_info().map(|t| t.type_path()).unwrap_or(Self::UNREGISTERED_TYPE)); - } - } - output.push(')'); - - } - - /// Prints the actual value of the reference. Tries to use best available method to print the value. - pub fn pretty_print_value(&self, world: &WorldAccessGuard) -> String { - let mut output = String::new(); - - // instead of relying on type registrations, simply traverse the reflection tree and print sensible values - self.reference.with_reflect(world, |r, _, _| { - self.pretty_print_value_inner(r, &mut output); - }).unwrap_or_else(|e| { - output.push_str(&format!("", e)); - }); - - output - } - - fn pretty_print_key_values,V: AsRef,I: IntoIterator,V)>>(bracket: BracketType, i: I, output: &mut String) { - bracket.surrounded(output, |output| { - let mut iter = i.into_iter().peekable(); - while let Some((key, val)) = iter.next() { - if let Some(key) = key { - output.push_str(key.as_ref()); - output.push_str(": "); - } - output.push_str(val.as_ref()); - if iter.peek().is_some() { - output.push_str(", "); - } - } - }); - } - - - fn pretty_print_value_struct<'k,N: Iterator, M: Iterator>(&self, field_names: N, field_values: M, output: &mut String) { - let field_names = field_names.into_iter(); - let fields = field_values.into_iter(); - let fields_iter = fields.zip_longest(field_names).map(|e| { - let (val, name) = match e { - itertools::EitherOrBoth::Both(val, name) => (val, name), - itertools::EitherOrBoth::Left(val) => (val, Self::UNKNOWN_FIELD), - itertools::EitherOrBoth::Right(name) => (().as_partial_reflect(), name), - }; - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (Some(name), field_printed) - }); - Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); - } - - fn pretty_print_value_inner(&self, v: &dyn PartialReflect, output: &mut String) { - match v.reflect_ref() { - bevy::reflect::ReflectRef::Struct(s) => { - let field_names = s.get_represented_struct_info().map(|info| info.field_names()).unwrap_or_default().iter(); - let field_values = s.iter_fields(); - - self.pretty_print_value_struct(field_names.copied(), field_values, output); - - }, - ReflectRef::TupleStruct(t) => { - let fields_iter = t.iter_fields().enumerate().map(|(i, val)| { - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (Some(i.to_string()), field_printed) - }); - Self::pretty_print_key_values(BracketType::Round, fields_iter, output); - }, - ReflectRef::Tuple(t) => { - let fields_iter = t.iter_fields().map(|val| { - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (None::, field_printed) - }); - Self::pretty_print_key_values(BracketType::Round, fields_iter, output); - }, - ReflectRef::List(l) => { - let fields_iter = l.iter().map(|val| { - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (None::, field_printed) - }); - Self::pretty_print_key_values(BracketType::Square, fields_iter, output); - }, - ReflectRef::Array(a) => { - let fields_iter = a.iter().map(|val| { - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (None::, field_printed) - }); - Self::pretty_print_key_values(BracketType::Square, fields_iter, output); - }, - ReflectRef::Map(m) => { - let fields_iter = m.iter().map(|(key, val)| { - let mut key_printed = String::new(); - self.pretty_print_value_inner(key, &mut key_printed); - - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (Some(key_printed), field_printed) - }); - Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); - }, - ReflectRef::Set(s) => { - let fields_iter = s.iter().map(|val| { - let mut field_printed = String::new(); - self.pretty_print_value_inner(val, &mut field_printed); - (None::, field_printed) - }); - Self::pretty_print_key_values(BracketType::Curly, fields_iter, output); - }, - ReflectRef::Enum(e) => { - output.push_str(&e.variant_path()); - let bracket_type = match e.variant_type() { - bevy::reflect::VariantType::Tuple => BracketType::Round, - _ => BracketType::Curly, - }; - let key_vals = e.iter_fields().map(|v| { - let mut field_printed = String::new(); - self.pretty_print_value_inner(v.value(), &mut field_printed); - (v.name(), field_printed) - }); - Self::pretty_print_key_values(bracket_type, key_vals, output); - }, - ReflectRef::Opaque(o) => { - self.pretty_print_value_opaque(o, output); - }, - } - - } -} \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index a0016fad72..b172ba04f9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -4,13 +4,13 @@ //! reflection gives us access to `dyn PartialReflect` objects via their type name, //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. -use lockable::{LockableHashMap, SyncLimit}; use std::{ any::TypeId, fmt::Debug, marker::PhantomData, mem, + ops::Deref, sync::{ atomic::{AtomicUsize, Ordering}, Arc, Weak, @@ -28,7 +28,8 @@ use bevy::{ world::{unsafe_world_cell::UnsafeWorldCell, CommandQueue, Mut, World}, }, hierarchy::{BuildChildren, Children, DespawnRecursiveExt, Parent}, - reflect::{std_traits::ReflectDefault, TypeRegistry}, + reflect::{std_traits::ReflectDefault, Reflect, TypeRegistry, TypeRegistryArc}, + utils::HashMap, }; use smallvec::SmallVec; @@ -36,46 +37,20 @@ use smallvec::SmallVec; use crate::{ bindings::ReflectAllocationId, prelude::{ReflectAllocator, ScriptError, ScriptResult}, + reflection_extensions::TypeIdExtensions, + with_access_read, with_access_write, with_global_access, }; use super::{ - proxy::{Proxy, Unproxy}, - ReflectBase, ReflectBaseType, ReflectReference, ScriptTypeRegistration, + access_map::{AccessCount, AccessMap, AccessMapKey, ReflectAccessId}, + // proxy::{Proxy, Unproxy}, + AppReflectAllocator, + ReflectBase, + ReflectBaseType, + ReflectReference, + ScriptTypeRegistration, }; -/// Describes kinds of base value we are accessing via reflection -#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] -pub enum ReflectAccessKind { - ComponentOrResource, - Allocation, -} - -/// Describes the id pointing to the base value we are accessing via reflection, for components and resources this is the ComponentId -/// for script owned values this is an allocationId, this is used to ensure we have permission to access the value. -#[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] -pub struct ReflectAccessId { - kind: ReflectAccessKind, - id: usize, -} - -impl From for ReflectAccessId { - fn from(value: ComponentId) -> Self { - Self { - kind: ReflectAccessKind::ComponentOrResource, - id: value.index(), - } - } -} - -impl From for ReflectAccessId { - fn from(value: ReflectAllocationId) -> Self { - Self { - kind: ReflectAccessKind::Allocation, - id: value.id(), - } - } -} - /// While [`WorldAccessGuard`] prevents aliasing at runtime and also makes sure world exists at least as long as the guard itself, /// borrows sadly do not persist the script-host boundary :(. That is to be expected, but instead we can make an abstraction which removes the lifetime parameter, making the outer type 'static, /// while making sure the lifetime is still satisfied! @@ -99,7 +74,7 @@ impl WorldCallbackAccess { /// Creates a new [`WorldCallbackAccess`] with an erased lifetime. /// /// # Safety - /// - The caller must ensure the [`WorldAccessGuard`] must not outlive the 'w lifetime + /// - The caller must ensure the [`WorldAccessGuard`] will not outlive the 'w lifetime /// - In practice this means that between the moment the original Arc is dropped, the lifetime 'w must be valid /// - I.e. you *must* drop the original [`Arc`] before the original 'w scope ends pub unsafe fn new<'w>(world: Weak>) -> Self { @@ -243,489 +218,394 @@ impl WorldCallbackAccess { } } -/// Unit of world access -pub type WorldAccessUnit<'w> = WorldAccessWrite<'w>; - pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5); pub const DEFAULT_INTERVAL: Duration = Duration::from_millis(10); -enum WorldAccessValue<'w> { - Free(WorldAccessWrite<'w>), - Locked(std::panic::Location<'static>), -} - -impl<'w> WorldAccessValue<'w> { - fn is_locked(&self) -> bool { - matches!(self, WorldAccessValue::Locked(_)) - } - - fn as_location(&self) -> Option> { - match self { - WorldAccessValue::Free(_) => None, - WorldAccessValue::Locked(location) => Some(*location), - } - } - - fn into_access(self) -> Option> { - match self { - WorldAccessValue::Free(access) => Some(access), - WorldAccessValue::Locked(_) => None, - } - } - - #[track_caller] - fn take(&mut self) -> Option> { - mem::replace( - self, - WorldAccessValue::Locked(*std::panic::Location::caller()), - ) - .into_access() - } -} - -impl<'w> From> for WorldAccessValue<'w> { - fn from(value: WorldAccessWrite<'w>) -> Self { - WorldAccessValue::Free(value) - } -} - /// Provides safe access to the world via [`WorldAccess`] permissions, which enforce aliasing rules at runtime in multi-thread environments #[derive(Clone)] -pub struct WorldAccessGuard<'w> { - pub cell: UnsafeWorldCell<'w>, - // TODO: this is fairly hefty, explore other ways to hand out locks on WorldAccess - accesses: Arc>>, - /// true if anybody has any access to the world - pub accesses_count: Arc, - // TODO can we track code/stack locations of things holding onto theese locks for debugging? +pub struct WorldAccessGuard<'w>(pub(crate) Arc>); + +/// Used to decrease the stack size of [`WorldAccessGuard`] +pub(crate) struct WorldAccessGuardInner<'w> { + cell: UnsafeWorldCell<'w>, + // TODO: this is fairly hefty, explore sparse sets, bit fields etc + pub(crate) accesses: AccessMap, + /// Cached for convenience, since we need it for most operations, means we don't need to lock the type registry every time + type_registry: TypeRegistryArc, + allocator: AppReflectAllocator, } impl<'w> WorldAccessGuard<'w> { /// Creates a new [`WorldAccessGuard`] for the given mutable borrow of the world pub fn new(world: &'w mut World) -> Self { - Self { + let type_registry = world + .get_resource::() + .expect("Type registry not present, cannot create world access guard") + .0 + .clone(); + + let allocator = world + .get_resource::() + .expect("Reflect allocator not present, cannot create world access guard") + .clone(); + + Self(Arc::new(WorldAccessGuardInner { cell: world.as_unsafe_world_cell(), accesses: Default::default(), - accesses_count: Arc::new(AtomicUsize::new(0)), - } + allocator, + type_registry, + })) } /// Purely debugging utility to list all accesses currently held. - pub fn list_accesses(&self) -> Vec { - let keys = self.accesses.keys_with_entries_or_locked(); - - // return only those which have no value - keys.into_iter() - .filter(|k| { - let val = self - .accesses - .blocking_lock(*k, SyncLimit::no_limit()) - .unwrap(); - let val = val.value().unwrap(); - - val.is_locked() - }) - .collect() + pub fn list_accesses(&self) -> Vec<(ReflectAccessId, AccessCount)> { + self.0.accesses.list_accesses() } /// Retrieves the underlying unsafe world cell, with no additional guarantees of safety /// proceed with caution and only use this if you understand what you're doing pub fn as_unsafe_world_cell(&self) -> UnsafeWorldCell<'w> { - self.cell + self.0.cell } /// Retrieves the underlying read only unsafe world cell, with no additional guarantees of safety /// proceed with caution and only use this if you understand what you're doing pub fn as_unsafe_world_cell_readonly(&self) -> UnsafeWorldCell<'w> { - self.cell + self.0.cell } /// Gets the component id of the given component or resource pub fn get_component_id(&self, id: TypeId) -> Option { - self.cell.components().get_id(id) + self.0.cell.components().get_id(id) } pub fn get_resource_id(&self, id: TypeId) -> Option { - self.cell.components().get_resource_id(id) - } - - #[track_caller] - /// Checks nobody else is currently accessing the world, and if so locks access to it until - /// [`release_whole_world_access`] is called. - pub fn get_whole_world_access(&self) -> Option<&mut World> { - if self.accesses_count.load(Ordering::Relaxed) == 0 { - Some(unsafe { self.cell.world_mut() }) - } else { - None - } - } - - /// Releases whole world access. Allowing others to access it. - pub fn release_whole_world_access(&self, _world: &mut World) { - // we do not need ot use the world reference, it's there as proof that the caller has claimed access before - assert_eq!(self.accesses_count.load(Ordering::Relaxed), 1); - self.accesses_count.fetch_sub(1, Ordering::Relaxed); + self.0.cell.components().get_resource_id(id) } pub fn get_access_location(&self, raid: ReflectAccessId) -> Option> { - let guard = self - .accesses - .blocking_lock(raid, lockable::SyncLimit::no_limit()) - .unwrap(); - let guard = guard.value().unwrap(); - - guard.as_location() + self.0.accesses.access_location(raid) } - #[track_caller] - /// Tries to get access to the given reflect access id, if it's already given out returns `None`. If you want to wait for access, use [`WorldAccessGuard::get_access_timeout`] instead. - /// Remember to release this access once done with [`WorldAccessGuard::release_access`] or nobody else will be able to access this id!. - /// - /// Although forgetting to release access is safe, it's frankly quite rude and can lead to deadlocks. - pub fn get_access(&self, raid: ReflectAccessId) -> Option> { - let mut guard = self - .accesses - .blocking_lock(raid, lockable::SyncLimit::no_limit()) - .unwrap(); - let guard = guard.value_or_insert_with(|| { - WorldAccessWrite { - raid, - _ph: PhantomData, - } - .into() - }); - - if !guard.is_locked() { - self.accesses_count.fetch_add(1, Ordering::Relaxed); - guard.take() - } else { - // somebody has access to this already, we cannot access at the moment - None - } + pub fn claim_read_access(&self, raid: ReflectAccessId) -> bool { + self.0.accesses.claim_read_access(raid) } - /// Blocking version of [`WorldAccessGuard::get_access`], waits for access to the given reflect access id. Will busy wait at the given intervals, untill the timeout is reached. - /// If interval is zero this is equivalent to busy waiting. - /// - /// # Panic - /// Will panic once access was not available after the timeout was reached #[track_caller] - pub fn get_access_timeout( - &self, - raid: ReflectAccessId, - timeout: Duration, - interval: Duration, - ) -> WorldAccessUnit<'w> { - let mut access = self.get_access(raid); - let start = std::time::Instant::now(); - - while access.is_none() { - std::thread::sleep(interval); - access = self.get_access(raid); - if start.elapsed() > timeout { - panic!( - "Timed out while waiting for access to {:?}. This is likely a deadlock. The access is being held by: {:?}", - raid, - self.get_access_location(raid) - ); - } - } - access.expect("invariant") + pub fn claim_write_access(&self, raid: ReflectAccessId) -> bool { + self.0.accesses.claim_write_access(raid) } - /// Releases access to the given reflect access id - pub fn release_access(&self, access: WorldAccessUnit<'w>) { - let mut guard = self - .accesses - .blocking_lock(access.raid, lockable::SyncLimit::no_limit()) - .unwrap(); - - let guard = guard - .value_mut() - .expect("Invariant violated, access should exist"); - - // should not be possible, we are the only ones who can instantiate WorldAccessUnit - assert!( - guard.is_locked(), - "Invariant violated, an access has been released by someone else already who shouldn't have been able to do so" - ); - - self.accesses_count.fetch_sub(1, Ordering::Relaxed); - *guard = WorldAccessValue::Free(access); + /// Releases read or write access to the given type. + /// + /// # Safety + /// - This can only be called safely after all references to the type created using the access have been dropped + /// - You can only call this if you previously called one of: [`WorldAccessGuard::claim_read_access`] or [`WorldAccessGuard::claim_write_access`] + /// - The number of claim and release calls for the same id must always match + pub unsafe fn release_access(&self, raid: ReflectAccessId) { + self.0.accesses.release_access(raid) } - #[track_caller] - /// Get access to the given component_id, this is the only way to access a component/resource safely (in the context of the world access guard) - /// since you can only access this component_id through a RwLock, there is no way to break aliasing rules. - /// Additionally the 'w lifetime prevents you from storing this access outside the lifetime of the underlying cell - pub fn get_component_access(&self, cid: ComponentId) -> Option> { - let access_id = ReflectAccessId { - kind: ReflectAccessKind::ComponentOrResource, - id: cid.index(), - }; - self.get_access(access_id) + pub fn claim_global_access(&self) -> bool { + self.0.accesses.claim_global_access() } - #[track_caller] - /// Similar to [`Self::get_component_access`] but typed, additionally panics if the component is not registered - pub fn get_component_access_typed(&self) -> Option> { - self.get_component_access( - self.cell - .components() - .component_id::() - .unwrap_or_else(|| { - panic!("Component not registered: `{}`", std::any::type_name::()) - }), + /// Releases global access to the world + /// + /// # Safety + /// - This can only be called safely after all references created using the access have been dropped + pub unsafe fn release_global_access(&self) { + self.0.accesses.release_global_access() + } + + pub fn type_registry(&self) -> TypeRegistryArc { + self.0.type_registry.clone() + } + + pub fn allocator(&self) -> AppReflectAllocator { + self.0.allocator.clone() + } + + // #[track_caller] + // /// Call a function on a type which can be proxied, first by unproxying the input with world access, + // /// then calling the function and finally proxying the output with the allocator. + // pub fn proxy_call<'i, O: Proxy, T: Unproxy, F: Fn(T::Output<'_>) -> O::Input<'i>>( + // &self, + // proxied_input: T, + // f: F, + // ) -> ScriptResult { + // self.try_proxy_call(proxied_input, |o| Ok::<_, ScriptError>(f(o))) + // } + + // pub fn try_proxy_call< + // 'i, + // O: Proxy, + // E: Into>, + // T: Unproxy, + // F: Fn(T::Output<'_>) -> Result, E>, + // >( + // &self, + // mut proxied_input: T, + // f: F, + // ) -> ScriptResult { + // let type_registry = self.type_registry(); + // let type_registry = type_registry.read(); + + // let app_allocator = self.allocator(); + + // let output = (|| { + // let unproxied_input = { + // let allocator = app_allocator.read(); + // proxied_input.collect_accesses(self)?; + // unsafe { proxied_input.unproxy_with_world(self, &type_registry, &allocator) }? + // }; + + // let out = f(unproxied_input).map_err(|e| { + // let e: Box = e.into(); + // ScriptError::new_generic_error(e) + // })?; + + // let mut allocator = app_allocator.write(); + // let proxied_output = O::proxy_with_allocator(out, &mut allocator)?; + // Ok(proxied_output) + // })(); + + // // make sure to release all accesses + // proxied_input.release_accesses(self); + + // output + // } + + /// Safely accesses the resource by claiming and releasing access to it. + /// + /// # Panics + /// - if the resource does not exist + pub fn with_resource(&self, f: F) -> O + where + R: Resource, + F: FnOnce(&R) -> O, + { + let access_id = ReflectAccessId::for_resource::(&self.0.cell) + .unwrap_or_else(|| panic!("Resource does not exist: {}", std::any::type_name::())); + + with_access_read!( + self.0.accesses, + access_id, + format!("Could not access resource: {}", std::any::type_name::()), + { + // Safety: we have acquired access for the duration of the closure + f(unsafe { self.0.cell.get_resource::().expect("invariant") }) + } ) } - #[track_caller] - /// Get access to the given component_id, this is the only way to access a component/resource safely (in the context of the world access guard) - /// since you can only access this component_id through a RwLock, there is no way to break aliasing rules. - /// Additionally the 'w lifetime prevents you from storing this access outside the lifetime of the underlying cell - pub fn get_resource_access(&self, cid: ComponentId) -> Option> { - self.get_component_access(cid) - } - - #[track_caller] - /// Similar to [`Self::get_resource_access`] but typed, additionally panics if the resource is not registered - pub fn get_resource_access_typed(&self) -> Option> { - self.get_resource_access( - self.cell - .components() - .resource_id::() - .unwrap_or_else(|| { - panic!("Resource not registered: `{}`", std::any::type_name::()) - }), + /// Safely accesses the resource by claiming and releasing access to it. + /// + /// # Panics + /// - if the resource does not exist + pub fn with_resource_mut(&self, f: F) -> O + where + R: Resource, + F: FnOnce(Mut) -> O, + { + let access_id = ReflectAccessId::for_resource::(&self.0.cell) + .unwrap_or_else(|| panic!("Resource does not exist: {}", std::any::type_name::())); + + with_access_write!( + self.0.accesses, + access_id, + format!("Could not access resource: {}", std::any::type_name::()), + { + // Safety: we have acquired access for the duration of the closure + f(unsafe { self.0.cell.get_resource_mut::().expect("invariant") }) + } ) } - #[track_caller] - /// Get access to the given allocation_id, this is the only way to access a script owned value safely (in the context of the world access guard) - pub fn get_allocation_access(&self, id: ReflectAllocationId) -> Option> { - let access_id = ReflectAccessId { - kind: ReflectAccessKind::Allocation, - id: id.id(), - }; - self.get_access(access_id) - } - - #[track_caller] - /// Provides access to a resource via callback. Panics if the resource does not exist or if waiting for access times out. - pub fn with_resource) -> O>(&self, f: F) -> O { - let cid = self - .cell - .components() - .resource_id::() - .unwrap_or_else(|| panic!("Resource not registered: `{}`", std::any::type_name::())); - - let mut access = self.get_access_timeout(cid.into(), DEFAULT_TIMEOUT, DEFAULT_INTERVAL); - - let resource = self - .get_resource_with_access_mut::(&mut access) - .expect("invariant") - .expect("invariant"); - let out = f(self, resource); - self.release_access(access); - out - } - - #[track_caller] - /// Convenience to get commonly used resources at the same time. Internally identical to [`Self::with_resource`] - pub fn with_allocator_and_type_registry< - O, - F: FnOnce(&Self, Mut, Mut) -> O, - >( - &self, - f: F, - ) -> O { - self.with_resource(|world, registry: Mut| { - world.with_resource(|world, allocator: Mut| { - f(world, registry, allocator) - }) - }) - } - - #[track_caller] - /// Call a function on a type which can be proxied, first by unproxying the input with world access, - /// then calling the function and finally proxying the output with the allocator. - pub fn proxy_call<'i, O: Proxy, T: Unproxy, F: Fn(T::Output<'_>) -> O::Input<'i>>( - &self, - proxied_input: T, - f: F, - ) -> ScriptResult { - self.try_proxy_call(proxied_input, |o| Ok::<_, ScriptError>(f(o))) - } - - pub fn try_proxy_call< - 'i, - O: Proxy, - E: Into>, - T: Unproxy, - F: Fn(T::Output<'_>) -> Result, E>, - >( - &self, - mut proxied_input: T, - f: F, - ) -> ScriptResult { - let type_registry = - self.with_resource(|_, type_registry: Mut| type_registry.clone()); - - let type_registry = type_registry.read(); - let mut world_acceses = SmallVec::default(); - - let unproxied_input = self.with_resource(|_, allocator: Mut| { - proxied_input.collect_accesses(self, &mut world_acceses)?; - unsafe { - proxied_input.unproxy_with_world(self, &world_acceses, &type_registry, &allocator) + /// Safely accesses the component by claiming and releasing access to it. + /// + /// # Panics + /// - if the component does not exist + pub fn with_component(&self, entity: Entity, f: F) -> O + where + T: Component, + F: FnOnce(Option<&T>) -> O, + { + let access_id = ReflectAccessId::for_component::(&self.0.cell) + .unwrap_or_else(|| panic!("Component does not exist: {}", std::any::type_name::())); + + with_access_read!( + self.0.accesses, + access_id, + format!("Could not access component: {}", std::any::type_name::()), + { + // Safety: we have acquired access for the duration of the closure + f(unsafe { self.0.cell.get_entity(entity).and_then(|e| e.get::()) }) } - })?; - - let out = f(unproxied_input).map_err(|e| { - let e: Box = e.into(); - ScriptError::new_generic_error(e) - })?; - - let proxied_output = self.with_resource(|_, mut allocator: Mut| { - O::proxy_with_allocator(out, &mut allocator) - })?; - - // make sure to release all accesses - world_acceses.drain(..).for_each(|a| { - self.release_access(a); - }); - - Ok(proxied_output) - } - - #[track_caller] - /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) - pub fn get_component_with_access( - &self, - access: &WorldAccessWrite, - entity: Entity, - ) -> ScriptResult> { - let component_id = match self.cell.components().component_id::() { - Some(id) => id, - None => return Ok(None), - }; - - if access.can_read(ReflectAccessId { - kind: ReflectAccessKind::ComponentOrResource, - id: component_id.index(), - }) { - // Safety: we have the correct access id - return unsafe { Ok(self.cell.get_entity(entity).and_then(|e| e.get::())) }; - } else { - Err(ScriptError::new_reflection_error( - "Cannot read component, received invalid access".to_string(), - )) - } - } - - #[track_caller] - /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) - pub fn get_component_with_access_mut( - &self, - access: &mut WorldAccessWrite, - entity: Entity, - ) -> ScriptResult>> { - let component_id = match self.cell.components().component_id::() { - Some(id) => id, - None => return Ok(None), - }; - - if access.can_write(ReflectAccessId { - kind: ReflectAccessKind::ComponentOrResource, - id: component_id.index(), - }) { - // Safety: we have the correct access id - return unsafe { Ok(self.cell.get_entity(entity).and_then(|e| e.get_mut::())) }; - } else { - Err(ScriptError::new_reflection_error( - "Cannot write component, received invalid access".to_string(), - )) - } + ) } - #[track_caller] - /// Get access to the given resource - pub fn get_resource_with_access( - &self, - access: &WorldAccessWrite, - ) -> ScriptResult> { - let resource_id = match self.cell.components().resource_id::() { - Some(id) => id, - None => return Ok(None), - }; - - if access.can_read(ReflectAccessId { - kind: ReflectAccessKind::ComponentOrResource, - id: resource_id.index(), - }) { - // Safety: we have the correct access id - return unsafe { Ok(self.cell.get_resource::()) }; - } else { - Err(ScriptError::new_reflection_error( - "Cannot read resource, received invalid access".to_string(), - )) - } + /// Safely accesses the component by claiming and releasing access to it. + /// + /// # Panics + /// - if the component does not exist + pub fn with_component_mut(&self, entity: Entity, f: F) -> O + where + T: Component, + F: FnOnce(Option>) -> O, + { + let access_id = ReflectAccessId::for_component::(&self.0.cell) + .unwrap_or_else(|| panic!("Component does not exist: {}", std::any::type_name::())); + + with_access_write!( + self.0.accesses, + access_id, + format!("Could not access component: {}", std::any::type_name::()), + { + // Safety: we have acquired access for the duration of the closure + f(unsafe { + self.0 + .cell + .get_entity(entity) + .and_then(|e| e.get_mut::()) + }) + } + ) } - #[track_caller] - /// Get access to the given resource, this is the only way to access a component/resource safely (in the context of the world access guard) - pub fn get_resource_with_access_mut( - &self, - access: &mut WorldAccessWrite, - ) -> ScriptResult>> { - let resource_id = match self.cell.components().resource_id::() { - Some(id) => id, - None => return Ok(None), - }; - - if access.can_write(ReflectAccessId { - kind: ReflectAccessKind::ComponentOrResource, - id: resource_id.index(), - }) { - // Safety: we have the correct access id - return unsafe { Ok(self.cell.get_resource_mut::()) }; - } else { - Err(ScriptError::new_reflection_error( - "Cannot write resource, received invalid access".to_string(), - )) - } - } + // #[track_caller] + // /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) + // pub fn get_component_with_access( + // &self, + // access: &WorldAccess, + // entity: Entity, + // ) -> ScriptResult> { + // let component_id = match self.0.cell.components().component_id::() { + // Some(id) => id, + // None => return Ok(None), + // }; + + // if access.can_read(ReflectAccessId { + // kind: ReflectAccessKind::ComponentOrResource, + // id: component_id.index(), + // }) { + // // Safety: we have the correct access id + // unsafe { Ok(self.0.cell.get_entity(entity).and_then(|e| e.get::())) } + // } else { + // Err(ScriptError::new_reflection_error( + // "Cannot read component, received invalid access".to_string(), + // )) + // } + // } + + // #[track_caller] + // /// Get access to the given component, this is the only way to access a component/resource safely (in the context of the world access guard) + // pub fn get_component_with_access_mut( + // &self, + // access: &mut WorldAccess, + // entity: Entity, + // ) -> ScriptResult>> { + // let component_id = match self.0.cell.components().component_id::() { + // Some(id) => id, + // None => return Ok(None), + // }; + + // if access.can_write(ReflectAccessId { + // kind: ReflectAccessKind::ComponentOrResource, + // id: component_id.index(), + // }) { + // // Safety: we have the correct access id + // unsafe { + // Ok(self + // .0 + // .cell + // .get_entity(entity) + // .and_then(|e| e.get_mut::())) + // } + // } else { + // Err(ScriptError::new_reflection_error( + // "Cannot write component, received invalid access".to_string(), + // )) + // } + // } + + // #[track_caller] + // /// Get access to the given resource + // pub fn get_resource_with_access( + // &self, + // access: &WorldAccess, + // ) -> ScriptResult> { + // let resource_id = match self.0.cell.components().resource_id::() { + // Some(id) => id, + // None => return Ok(None), + // }; + + // if access.can_read(ReflectAccessId { + // kind: ReflectAccessKind::ComponentOrResource, + // id: resource_id.index(), + // }) { + // // Safety: we have the correct access id + // unsafe { Ok(self.0.cell.get_resource::()) } + // } else { + // Err(ScriptError::new_reflection_error( + // "Cannot read resource, received invalid access".to_string(), + // )) + // } + // } + + // #[track_caller] + // /// Get access to the given resource, this is the only way to access a component/resource safely (in the context of the world access guard) + // pub fn get_resource_with_access_mut( + // &self, + // access: &mut WorldAccess, + // ) -> ScriptResult>> { + // let resource_id = match self.0.cell.components().resource_id::() { + // Some(id) => id, + // None => return Ok(None), + // }; + + // if access.can_write(ReflectAccessId { + // kind: ReflectAccessKind::ComponentOrResource, + // id: resource_id.index(), + // }) { + // // Safety: we have the correct access id + // unsafe { Ok(self.0.cell.get_resource_mut::()) } + // } else { + // Err(ScriptError::new_reflection_error( + // "Cannot write resource, received invalid access".to_string(), + // )) + // } + // } /// checks if a given entity exists and is valid pub fn is_valid_entity(&self, entity: Entity) -> bool { - self.cell.get_entity(entity).is_some() + self.0.cell.get_entity(entity).is_some() } } /// Impl block for higher level world methods impl<'w> WorldAccessGuard<'w> { pub fn spawn(&self) -> Entity { - if let Some(world) = self.get_whole_world_access() { - world.spawn_empty().id() - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + with_global_access!(self.0.accesses, "Could not spawn entity", { + // Safety we have global access + let entity = unsafe { self.0.cell.world_mut().spawn_empty() }; + entity.id() + }) } pub fn get_type_by_name(&self, type_name: String) -> Option { - self.with_resource(|world, registry: Mut| { - let registry = registry.read(); - registry - .get_with_short_type_path(&type_name) - .or_else(|| registry.get_with_type_path(&type_name)) - .map(|registration| { - ScriptTypeRegistration::new( - Arc::new(registration.clone()), - world.get_component_id(registration.type_id()), - world.get_resource_id(registration.type_id()), - ) - }) - }) + let type_registry = self.type_registry(); + let type_registry = type_registry.read(); + type_registry + .get_with_short_type_path(&type_name) + .or_else(|| type_registry.get_with_type_path(&type_name)) + .map(|registration| { + ScriptTypeRegistration::new( + Arc::new(registration.clone()), + self.get_component_id(registration.type_id()), + self.get_resource_id(registration.type_id()), + ) + }) } pub fn add_default_component( @@ -743,11 +623,10 @@ impl<'w> WorldAccessGuard<'w> { { default_td.default() } else if let Some(from_world_td) = registration.registration.data::() { - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not add default component", { + let world = unsafe { self.0.cell.world_mut() }; from_world_td.from_world(world) - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }) } else { return Err(ScriptError::new_runtime_error(format!( "Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", @@ -756,10 +635,9 @@ impl<'w> WorldAccessGuard<'w> { }; // TODO: this shouldn't need entire world access it feels - if let Some(world) = self.get_whole_world_access() { - let app_registry = world - .remove_resource::() - .unwrap_or_else(|| panic!("Missing type registry")); + with_global_access!(self.0.accesses, "Could not add default component", { + let type_registry = self.type_registry(); + let world = unsafe { self.0.cell.world_mut() }; let mut entity = world.get_entity_mut(entity).map_err(|e| { ScriptError::new_runtime_error(format!( @@ -768,26 +646,24 @@ impl<'w> WorldAccessGuard<'w> { )) })?; { - let registry = app_registry.read(); + let registry = type_registry.read(); component_data.insert(&mut entity, instance.as_partial_reflect(), ®istry); } - world.insert_resource(app_registry); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - - Ok(()) + Ok(()) + }) } + pub fn get_component( &self, entity: Entity, component_id: ComponentId, ) -> ScriptResult> { - let entity = self.cell.get_entity(entity).ok_or_else(|| { + let entity = self.0.cell.get_entity(entity).ok_or_else(|| { ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) })?; let component_info = self + .0 .cell .components() .get_info(component_id) @@ -814,7 +690,7 @@ impl<'w> WorldAccessGuard<'w> { } pub fn has_component(&self, entity: Entity, component_id: ComponentId) -> ScriptResult { - let entity = self.cell.get_entity(entity).ok_or_else(|| { + let entity = self.0.cell.get_entity(entity).ok_or_else(|| { ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) })?; @@ -832,7 +708,8 @@ impl<'w> WorldAccessGuard<'w> { )))?; // TODO: this shouldn't need entire world access it feels - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not remove component", { + let world = unsafe { self.0.cell.world_mut() }; let mut entity = world.get_entity_mut(entity).map_err(|e| { ScriptError::new_runtime_error(format!( "Could not retrieve entity: {:?}. {e}", @@ -841,14 +718,12 @@ impl<'w> WorldAccessGuard<'w> { })?; component_data.remove(&mut entity); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - Ok(()) + Ok(()) + }) } pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult> { - let component_info = match self.cell.components().get_info(resource_id) { + let component_info = match self.0.cell.components().get_info(resource_id) { Some(info) => info, None => return Ok(None), }; @@ -871,17 +746,16 @@ impl<'w> WorldAccessGuard<'w> { )))?; // TODO: this shouldn't need entire world access it feels - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not remove resource", { + let world = unsafe { self.0.cell.world_mut() }; component_data.remove(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - Ok(()) + Ok(()) + }) } pub fn has_resource(&self, resource_id: ComponentId) -> bool { // Safety: we are not reading the value at all - let res_ptr = unsafe { self.cell.get_resource_by_id(resource_id) }; + let res_ptr = unsafe { self.0.cell.get_resource_by_id(resource_id) }; res_ptr.is_some() } @@ -897,14 +771,9 @@ impl<'w> WorldAccessGuard<'w> { ))); } - let access = self - .get_component_access_typed::() - .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); - - Ok(self - .get_component_with_access::(&access, entity)? - .map(|c| c.to_vec()) - .unwrap_or_default()) + self.with_component(entity, |c: Option<&Children>| { + Ok(c.map(|c| c.to_vec()).unwrap_or_default()) + }) } pub fn get_parent(&self, entity: Entity) -> ScriptResult> { @@ -915,13 +784,7 @@ impl<'w> WorldAccessGuard<'w> { ))); } - let access = self - .get_component_access_typed::() - .unwrap_or_else(|| panic!("{CONCURRENT_ACCESS_MSG}")); - - Ok(self - .get_component_with_access::(&access, entity)? - .map(|c| c.get())) + self.with_component(entity, |c: Option<&Parent>| Ok(c.map(|c| c.get()))) } pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { @@ -941,14 +804,13 @@ impl<'w> WorldAccessGuard<'w> { } } - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not push children", { + let world = unsafe { self.0.cell.world_mut() }; let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); commands.entity(parent).add_children(children); queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }); Ok(()) } @@ -970,14 +832,13 @@ impl<'w> WorldAccessGuard<'w> { } } - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not remove children", { + let world = unsafe { self.0.cell.world_mut() }; let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); commands.entity(parent).remove_children(children); queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }); Ok(()) } @@ -1004,14 +865,13 @@ impl<'w> WorldAccessGuard<'w> { } } - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not insert children", { + let world = unsafe { self.0.cell.world_mut() }; let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); commands.entity(parent).insert_children(index, children); queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }); Ok(()) } @@ -1024,14 +884,13 @@ impl<'w> WorldAccessGuard<'w> { ))); } - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not despawn entity", { + let world = unsafe { self.0.cell.world_mut() }; let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); commands.entity(parent).despawn_recursive(); queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }); Ok(()) } @@ -1044,14 +903,13 @@ impl<'w> WorldAccessGuard<'w> { ))); } - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not despawn entity", { + let world = unsafe { self.0.cell.world_mut() }; let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); commands.entity(entity).despawn(); queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }); Ok(()) } @@ -1064,1004 +922,921 @@ impl<'w> WorldAccessGuard<'w> { ))); } - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not despawn descendants", { + let world = unsafe { self.0.cell.world_mut() }; let mut queue = CommandQueue::default(); let mut commands = Commands::new(&mut queue, world); commands.entity(parent).despawn_descendants(); queue.apply(world); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } + }); Ok(()) } /// Sends AppExit event to the world with success status pub fn exit(&self) { - if let Some(world) = self.get_whole_world_access() { + with_global_access!(self.0.accesses, "Could not exit the app", { + let world = unsafe { self.0.cell.world_mut() }; world.send_event(AppExit::Success); - } else { - panic!("{CONCURRENT_WORLD_ACCESS_MSG}") - } - } -} - -/// Having this is permission to access the contained [`ReflectAccessId`], there is no way to access anything safely through a [`WorldAccessGuard`] -/// without having a [`WorldAccess`] instance for that particular [`ReflectAccessId`]. -/// -/// If you do own a [`WorldAccess`] for some [`ReflectAccessId`], you can read and write to it safely. -/// If you only have an immutable borrow of [`WorldAccess`] you can only read it safely. -/// If you have a mutable borrow of [`WorldAccess`] you can read and write to it safely. -#[derive(Debug)] -pub struct WorldAccessWrite<'a> { - pub raid: ReflectAccessId, - pub(self) _ph: PhantomData<&'a usize>, -} - -impl<'w> WorldAccessWrite<'w> { - pub fn can_read(&self, raid: ReflectAccessId) -> bool { - self.raid == raid - } - - #[inline] - pub fn can_write(&self, raid: ReflectAccessId) -> bool { - self.can_read(raid) - } - - /// Prints the type of access this [`WorldAccessWrite`] entails, enriched with type information from the registry - pub fn to_enriched_str( - &self, - registry: &TypeRegistry, - allocator: Option<&ReflectAllocator>, - cell: UnsafeWorldCell, - ) -> String { - let (base_type, type_id) = match self.raid.kind { - ReflectAccessKind::ComponentOrResource => { - let type_id = cell - .components() - .get_info(ComponentId::new(self.raid.id)) - .and_then(|info| info.type_id()); - - ("Component/Resource", type_id) - } - ReflectAccessKind::Allocation => { - let type_id = allocator - .and_then(|allocator| allocator.get_type_id(ReflectAllocationId(self.raid.id))); - ("Allocation", type_id) - } - }; - - type_id - .and_then(|type_id| registry.get_type_info(type_id)) - .map(|info| format!("{base_type}<{}>", info.type_path())) - .unwrap_or(format!("{:?}", self.raid)) - } -} - -// pub struct - -#[cfg(test)] -mod test { - use crate::bindings::ScriptTypeRegistration; - use crate::prelude::ScriptErrorKind; - use bevy::ecs::system::Commands; - use bevy::hierarchy::BuildChildren; - use bevy::reflect::{ParsedPath, Reflect}; - - use super::*; - use std::any::TypeId; - - use crate::{ - bindings::ReflectAllocator, - bindings::{ - DeferredReflection, ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, - }, - }; - - use bevy::ecs::world::World; - use test_utils::test_data::{ - setup_world, CompWithFromWorld, GetTestComponentId, TestComponent, TestResource, - }; - - fn init_world() -> World { - setup_world(|w, _| { - w.init_resource::(); - }) - } - - /// Tests that the given ref_ can be accessed and the value is as expected and access is released correctly (not for allocated values) - fn assert_access_yields< - O: Reflect + PartialEq + Debug, - F: FnOnce(&mut World) -> ReflectReference, - G: FnOnce(&WorldAccessGuard), - >( - init: F, - post_check: G, - expected: O, - ) { - let mut world = init_world(); - let ref_ = init(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let world = world.read().unwrap(); - - // test read - ref_.with_reflect(&world, |reflect, _, _| { - let orig = reflect.try_downcast_ref::(); - - let orig = match orig { - Some(v) => v, - None => { - panic!( - "Could not downcast value {reflect:?} to {}", - std::any::type_name::() - ) - } - }; - - assert_eq!(orig, &expected); - }); - - assert!( - world - .get_component_access(TestComponent::test_component_id()) - .is_some(), - "access to component was not release correctly" - ); - - assert!( - world - .get_resource_access(TestResource::test_component_id()) - .is_some(), - "access to component was not release correctly" - ); - - post_check(&world); }); } - - /// Tests that setting to the expected value works as well as follow up reads give the expected value - fn assert_set_then_get_yields< - O: Reflect + PartialEq + Debug + Clone, - F: FnOnce(&mut World) -> ReflectReference, - G: FnOnce(&WorldAccessGuard), - >( - init: F, - post_check: G, - expected: O, - ) { - let mut world = init_world(); - let ref_ = init(&mut world); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let world = world.read().unwrap(); - // test set - ref_.with_reflect_mut(&world, |reflect, _, _| { - let orig = reflect.try_downcast_mut::(); - - let orig = match orig { - Some(v) => v, - None => { - panic!( - "Could not downcast value {reflect:?} to {}", - std::any::type_name::() - ) - } - }; - - *orig = expected.clone(); - }); - - // test read - ref_.with_reflect(&world, |reflect, _, _| { - let orig = reflect.try_downcast_ref::(); - - let orig = match orig { - Some(v) => v, - None => { - panic!( - "Could not downcast value {reflect:?} to {}", - std::any::type_name::() - ) - } - }; - - assert_eq!(orig, &expected); - }); - post_check(&world); - }); - } - - #[test] - fn test_component_access() { - let init = |world: &mut World| { - let entity = world - .spawn(TestComponent { - strings: vec![String::from("initial")], - }) - .id(); - - ReflectReference { - base: ReflectBaseType { - base_id: ReflectBase::Component(entity, TestComponent::test_component_id()), - type_id: TypeId::of::(), - }, - reflect_path: vec![ - ReflectionPathElem::Reflection(ParsedPath::parse_static(".strings").unwrap()), - ReflectionPathElem::DeferredReflection(DeferredReflection { - get: Arc::new(|root| { - let strings = root.try_downcast_ref::>().unwrap(); - Ok(strings.first().unwrap()) - }), - get_mut: Arc::new(|root| { - let strings = root.try_downcast_mut::>().unwrap(); - Ok(strings.first_mut().unwrap()) - }), - }), - ], - } - }; - - assert_access_yields(init, |_| {}, String::from("initial")); - assert_set_then_get_yields(init, |_| {}, String::from("set")); - } - - #[test] - fn test_resource_access() { - let init = |world: &mut World| { - world.insert_resource(TestResource { bytes: vec![42u8] }); - - ReflectReference { - base: ReflectBaseType { - base_id: ReflectBase::Resource(TestResource::test_component_id()), - type_id: TypeId::of::(), - }, - reflect_path: vec![ - ReflectionPathElem::Reflection(ParsedPath::parse_static(".bytes").unwrap()), - ReflectionPathElem::DeferredReflection(DeferredReflection { - get: Arc::new(|root| { - let strings = root.try_downcast_ref::>().unwrap(); - Ok(strings.first().unwrap()) - }), - get_mut: Arc::new(|root| { - let strings = root.try_downcast_mut::>().unwrap(); - Ok(strings.first_mut().unwrap()) - }), - }), - ], - } - }; - assert_access_yields(init, |_| {}, 42u8); - assert_set_then_get_yields(init, |_| {}, 69u8); - } - - #[test] - fn test_script_alloc_access() { - let init = |world: &mut World| { - let mut script_allocator = ReflectAllocator::default(); - let mut ref_ = ReflectReference::new_allocated( - TestComponent { - strings: vec![String::from("initial")], - }, - &mut script_allocator, - ); - ref_.index_path(ParsedPath::parse_static(".strings").unwrap()); - ref_.index_path(DeferredReflection { - get: Arc::new(|root| { - let strings = root.try_downcast_ref::>().unwrap(); - Ok(strings.first().unwrap()) - }), - get_mut: Arc::new(|root| { - let strings = root.try_downcast_mut::>().unwrap(); - Ok(strings.first_mut().unwrap()) - }), - }); - world.insert_resource(script_allocator); - ref_ - }; - let post_check = |world: &WorldAccessGuard| { - assert!( - world - .get_allocation_access(ReflectAllocationId(0)) - .is_some(), - "allocation access was not released correctly" - ); - }; - assert_access_yields(init, post_check, String::from("initial")); - assert_set_then_get_yields(init, post_check, String::from("set")); - } - - #[test] - #[allow(clippy::drop_non_drop)] - fn test_invalid_runtime_access() { - let mut world = World::new(); - let world = WorldAccessGuard::new(&mut world); - let access = world.get_component_access(ComponentId::new(0)); - assert!( - world.get_component_access(ComponentId::new(0)).is_none(), - "access was allowed to alias" - ); - drop(access); - } - - #[test] - #[should_panic] - fn test_double_release_panics() { - let mut world = World::new(); - let world = WorldAccessGuard::new(&mut world); - let access = world.get_component_access(ComponentId::new(0)).unwrap(); - world.release_access(access); - // This won't be possible in client code - world.release_access(WorldAccessWrite { - raid: ReflectAccessId { - kind: ReflectAccessKind::ComponentOrResource, - id: 0, - }, - _ph: PhantomData, - }); - } - - #[test] - fn test_count_updated_correctly() { - let mut world = World::new(); - let guard = WorldAccessGuard::new(&mut world); - let access = guard.get_access(ComponentId::new(0).into()).unwrap(); - assert_eq!(1, guard.accesses_count.load(Ordering::Relaxed)); - guard.release_access(access); - assert_eq!(0, guard.accesses_count.load(Ordering::Relaxed)); - } - - fn get_reg(world: &WorldCallbackAccess, name: &str) -> ScriptTypeRegistration { - world - .get_type_by_name(name.to_owned()) - .expect("Type not found") - } - - fn test_comp_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { - world - .get_type_by_name("TestComponent".to_owned()) - .expect("Component not found") - } - - fn test_resource_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { - world - .get_type_by_name("TestResource".to_owned()) - .expect("Resource not found") - } - - #[test] - fn test_get_type_by_name() { - let mut world = init_world(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = world.get_type_by_name("TestComponent".to_owned()).unwrap(); - let resource_reg = world.get_type_by_name("TestResource".to_owned()).unwrap(); - - assert_eq!( - comp_reg.registration.type_info().type_id(), - std::any::TypeId::of::() - ); - assert_eq!( - resource_reg.registration.type_info().type_id(), - std::any::TypeId::of::() - ); - }); - } - - #[test] - fn test_get_type_by_name_invalid() { - let mut world = init_world(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = world.get_type_by_name("x".to_owned()); - let resource_reg = world.get_type_by_name("z".to_owned()); - - assert!(comp_reg.is_none()); - assert!(resource_reg.is_none()); - }); - } - - #[test] - fn test_add_default_component_from_world() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = get_reg(world, "CompWithFromWorld"); - world.add_default_component(entity, comp_reg).unwrap() - }); - - assert_eq!( - world.get_entity(entity).unwrap().get::(), - Some(&CompWithFromWorld(String::from("FromWorld"))) - ); - } - - #[test] - fn test_add_default_component_default() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = get_reg(world, "CompWithFromWorld"); - world.add_default_component(entity, comp_reg).unwrap() - }); - - assert_eq!( - world.get_entity(entity).unwrap().get::(), - Some(&CompWithFromWorld(String::from("Default"))) - ); - } - - #[test] - fn test_add_default_component_missing_from_world_and_default() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = get_reg(world, "CompWithFromWorld"); - match world.add_default_component(entity, comp_reg.clone()) { - Ok(_) => { - panic!("Expected error") - } - Err(ScriptError(inner)) => { - assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); - assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", comp_reg.registration.type_info().type_path())); - } - } - }); - } - - #[test] - fn test_add_default_component_missing_component_data() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_reg = get_reg(world, "CompWithFromWorld"); - match world.add_default_component(entity, comp_reg.clone()) { - Ok(_) => { - panic!("Expected error") - } - Err(ScriptError(inner)) => { - assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); - assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", comp_reg.registration.type_info().type_path())); - } - } - }); - } - - #[test] - fn test_get_component_existing() { - let mut world = init_world(); - - let entity = world.spawn(TestComponent { strings: vec![] }).id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world - .get_component(entity, TestComponent::test_component_id()) - .unwrap() - .unwrap(); - assert_eq!( - comp_ref, - ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Component(entity, TestComponent::test_component_id()), - }, - reflect_path: Default::default(), - } - ); - }); - } - - #[test] - fn test_get_component_missing() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world - .get_component(entity, TestComponent::test_component_id()) - .unwrap(); - assert_eq!(comp_ref, None); - }); - } - - #[test] - fn test_get_component_missing_entity() { - let mut world = init_world(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = - world.get_component(Entity::from_raw(0), TestComponent::test_component_id()); - match comp_ref { - Ok(_) => { - panic!("Expected error") - } - Err(e) => { - assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!(e.reason.to_string(), "Entity does not exist: 0v1"); - } - } - }); - } - - #[test] - fn test_get_component_unregistered_component() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - let fake_id = ComponentId::new(999); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world.get_component(entity, fake_id); - match comp_ref { - Ok(_) => { - panic!("Expected error") - } - Err(e) => { - assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!( - e.reason.to_string(), - format!("Component does not exist: {fake_id:?}"), - ); - } - } - }); - } - - #[test] - fn test_remove_component() { - let mut world = init_world(); - - let entity = world - .spawn(TestComponent { - strings: vec![String::from("strings")], - }) - .id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world - .remove_component(entity, test_comp_reg(world)) - .unwrap(); - }); - - assert_eq!( - world.get_entity(entity).unwrap().get::(), - None - ); - } - - #[test] - fn test_remove_component_empty_idempotent() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world - .remove_component(entity, test_comp_reg(world)) - .unwrap(); - }); - - assert_eq!( - world.get_entity(entity).unwrap().get::(), - None - ); - } - - #[test] - fn test_remove_component_missing_comp_registration() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let result = world.remove_component(entity, test_resource_reg(world)); - match result { - Ok(_) => { - panic!("Expected error") - } - Err(e) => { - assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!( - e.reason.to_string(), - format!("Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", test_resource_reg(world).registration.type_info().type_path()) - ); - } - } - }); - - assert_eq!( - world.get_entity(entity).unwrap().get::(), - None - ); - } - - #[test] - fn test_remove_component_missing_entity() { - let mut world = init_world(); - - let fake_entity = Entity::from_raw(0); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let result = world.remove_component(fake_entity, test_comp_reg(world)); - match result { - Ok(_) => { - panic!("Expected error") - } - Err(e) => { - assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!(e.reason.to_string(), "Entity does not exist: 0v1"); - } - } - }); - } - - #[test] - fn test_get_resource_existing() { - let mut world = init_world(); - - world.insert_resource(TestResource { bytes: vec![1] }); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world - .get_resource(TestResource::test_component_id()) - .unwrap() - .unwrap(); - assert_eq!( - comp_ref, - ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Resource(TestResource::test_component_id()), - }, - reflect_path: Default::default(), - } - ); - }); - } - - #[test] - fn test_get_resource_non_existing() { - let mut world = init_world(); - - let fake_comp = ComponentId::new(999); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let comp_ref = world.get_resource(fake_comp); - match comp_ref { - Ok(None) => {} - e => { - panic!("Expected ok with none, got: {:?}", e); - } - } - }); - } - - #[test] - fn test_remove_resource() { - let mut world = init_world(); - - world.insert_resource(TestResource { bytes: vec![1] }); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.remove_resource(test_resource_reg(world)).unwrap(); - }); - - assert_eq!(world.get_resource::(), None); - } - - #[test] - fn test_remove_resource_missing_idempotent() { - let mut world = init_world(); - - world.remove_resource::(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.remove_resource(test_resource_reg(world)).unwrap(); - }); - - assert_eq!(world.get_resource::(), None); - } - - #[test] - fn test_remove_resource_missing_resource_registration() { - let mut world = init_world(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - match world.remove_resource(test_comp_reg(world)) { - Ok(_) => panic!("Expected error"), - Err(e) => { - assert_eq!(e.kind, ScriptErrorKind::RuntimeError); - assert_eq!(e.reason.to_string(), format!("Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", test_comp_reg(world).registration.type_info().type_path())); - } - } - }); - } - - #[test] - fn test_has_resource_existing() { - let mut world = init_world(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - assert!(world.has_resource(TestResource::test_component_id())); - }); - } - - #[test] - fn test_has_resource_missing() { - let mut world = init_world(); - - world.remove_resource::(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - assert!(world.has_resource(TestResource::test_component_id())); - }); - } - - #[test] - fn test_get_children_1_child() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child]); - cmnds.apply(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let children = world.get_children(parent).unwrap(); - assert_eq!(children.len(), 1); - assert_eq!(children[0], child); - }); - } - - #[test] - #[should_panic( - expected = "Component not registered: `bevy_hierarchy::components::children::Children`" - )] - fn test_get_children_children_component_unregistered() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.get_children(parent).unwrap(); - }); - } - - #[test] - fn test_get_children_no_children() { - let mut world = init_world(); - - world.register_component::(); - let parent = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let children = world.get_children(parent).unwrap(); - assert_eq!(children.len(), 0); - }); - } - - #[test] - fn test_get_parent_1_parent() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child]); - cmnds.apply(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let found_parent = world.get_parent(child).unwrap(); - assert_eq!(found_parent, Some(parent)); - }); - } - - #[test] - fn test_get_parent_no_parent() { - let mut world = init_world(); - - world.register_component::(); - - let child = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - let found_parent = world.get_parent(child).unwrap(); - assert_eq!(found_parent, None); - }); - } - - #[test] - #[should_panic( - expected = "Component not registered: `bevy_hierarchy::components::parent::Parent`" - )] - fn test_get_parent_parent_component_unregistered() { - let mut world = init_world(); - - let child = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.get_parent(child).unwrap(); - }); - } - - #[test] - fn test_push_children_empty_entity() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.push_children(parent, &[child]).unwrap(); - }); - - let children = world.get::(parent).unwrap(); - assert_eq!(children.len(), 1); - assert_eq!(children[0], child); - } - - #[test] - fn test_push_children_entity_with_1_child() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child]); - cmnds.apply(&mut world); - - let child_2 = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.push_children(parent, &[child_2]).unwrap(); - }); - - let children = world.get::(parent).unwrap(); - assert_eq!(children.len(), 2); - assert_eq!(children[0], child); - assert_eq!(children[1], child_2); - } - - #[test] - fn test_remove_children_entity_with_1_child() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child]); - cmnds.apply(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.remove_children(parent, &[child]).unwrap(); - }); - - let children = world.get::(parent); - assert!(children.is_none()); - } - - #[test] - fn test_remove_children_remove_half_children() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let child_2 = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child, child_2]); - cmnds.apply(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.remove_children(parent, &[child]).unwrap(); - }); - - let children = world.get::(parent).unwrap(); - assert_eq!(children.len(), 1); - assert_eq!(children[0], child_2); - } - - #[test] - fn test_insert_children_empty() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.insert_children(parent, 0, &[child]).unwrap(); - }); - - let children = world.get::(parent).unwrap(); - assert_eq!(children.len(), 1); - assert_eq!(children[0], child); - } - - #[test] - fn test_insert_children_middle() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let child_2 = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child, child_2]); - cmnds.apply(&mut world); - - let child_to_insert = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world - .insert_children(parent, 1, &[child_to_insert]) - .unwrap(); - }); - - let children = world.get::(parent).unwrap(); - assert_eq!(children.len(), 3); - assert_eq!(children[0], child); - assert_eq!(children[1], child_to_insert); - assert_eq!(children[2], child_2); - } - - #[test] - fn test_despawn_entity() { - let mut world = init_world(); - - let entity = world.spawn_empty().id(); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.despawn(entity).unwrap(); - }); - - assert!(world.get_entity(entity).is_err()); - } - - #[test] - fn test_despawn_recursive() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child]); - cmnds.apply(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.despawn_recursive(parent).unwrap(); - }); - - assert!(world.get_entity(parent).is_err()); - assert!(world.get_entity(child).is_err()); - } - - #[test] - fn test_despawn_descendants() { - let mut world = init_world(); - - let parent = world.spawn_empty().id(); - let child = world.spawn_empty().id(); - let mut cmnds = CommandQueue::default(); - let mut cmnd = Commands::new(&mut cmnds, &world); - cmnd.entity(parent).add_children(&[child]); - cmnds.apply(&mut world); - - WorldCallbackAccess::with_callback_access(&mut world, |world| { - world.despawn_descendants(parent).unwrap(); - }); - - assert!(world.get_entity(parent).is_ok()); - assert!(world.get_entity(child).is_err()); - } } + +// #[cfg(test)] +// mod test { +// use crate::bindings::ScriptTypeRegistration; +// use crate::prelude::ScriptErrorKind; +// use bevy::ecs::system::Commands; +// use bevy::hierarchy::BuildChildren; +// use bevy::reflect::{ParsedPath, Reflect}; + +// use super::*; +// use std::any::TypeId; + +// use crate::{ +// bindings::ReflectAllocator, +// bindings::{ +// DeferredReflection, ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, +// }, +// }; + +// use bevy::ecs::world::World; +// use test_utils::test_data::{ +// setup_world, CompWithFromWorld, GetTestComponentId, TestComponent, TestResource, +// }; + +// fn init_world() -> World { +// setup_world(|w, _| { +// w.init_resource::(); +// }) +// } + +// /// Tests that the given ref_ can be accessed and the value is as expected and access is released correctly (not for allocated values) +// fn assert_access_yields< +// O: Reflect + PartialEq + Debug, +// F: FnOnce(&mut World) -> ReflectReference, +// G: FnOnce(&WorldAccessGuard), +// >( +// init: F, +// post_check: G, +// expected: O, +// ) { +// let mut world = init_world(); +// let ref_ = init(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let world = world.read().unwrap(); + +// // test read +// ref_.with_reflect(&world, |reflect| { +// let orig = reflect.try_downcast_ref::(); + +// let orig = match orig { +// Some(v) => v, +// None => { +// panic!( +// "Could not downcast value {reflect:?} to {}", +// std::any::type_name::() +// ) +// } +// }; + +// assert_eq!(orig, &expected); +// }); + +// assert!( +// world +// .get_component_access(TestComponent::test_component_id(), true) +// .is_some(), +// "access to component was not release correctly" +// ); + +// assert!( +// world +// .get_resource_access(TestResource::test_component_id()) +// .is_some(), +// "access to component was not release correctly" +// ); + +// post_check(&world); +// }); +// } + +// /// Tests that setting to the expected value works as well as follow up reads give the expected value +// fn assert_set_then_get_yields< +// O: Reflect + PartialEq + Debug + Clone, +// F: FnOnce(&mut World) -> ReflectReference, +// G: FnOnce(&WorldAccessGuard), +// >( +// init: F, +// post_check: G, +// expected: O, +// ) { +// let mut world = init_world(); +// let ref_ = init(&mut world); +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let world = world.read().unwrap(); +// // test set +// ref_.with_reflect_mut(&world, |reflect, _, _| { +// let orig = reflect.try_downcast_mut::(); + +// let orig = match orig { +// Some(v) => v, +// None => { +// panic!( +// "Could not downcast value {reflect:?} to {}", +// std::any::type_name::() +// ) +// } +// }; + +// *orig = expected.clone(); +// }); + +// // test read +// ref_.with_reflect(&world, |reflect, _, _| { +// let orig = reflect.try_downcast_ref::(); + +// let orig = match orig { +// Some(v) => v, +// None => { +// panic!( +// "Could not downcast value {reflect:?} to {}", +// std::any::type_name::() +// ) +// } +// }; + +// assert_eq!(orig, &expected); +// }); +// post_check(&world); +// }); +// } + +// #[test] +// fn test_component_access() { +// let init = |world: &mut World| { +// let entity = world +// .spawn(TestComponent { +// strings: vec![String::from("initial")], +// }) +// .id(); + +// ReflectReference { +// base: ReflectBaseType { +// base_id: ReflectBase::Component(entity, TestComponent::test_component_id()), +// type_id: TypeId::of::(), +// }, +// reflect_path: vec![ +// ReflectionPathElem::Reflection(ParsedPath::parse_static(".strings").unwrap()), +// ReflectionPathElem::DeferredReflection(DeferredReflection { +// get: Arc::new(|root| { +// let strings = root.try_downcast_ref::>().unwrap(); +// Ok(strings.first().unwrap()) +// }), +// get_mut: Arc::new(|root| { +// let strings = root.try_downcast_mut::>().unwrap(); +// Ok(strings.first_mut().unwrap()) +// }), +// }), +// ], +// } +// }; + +// assert_access_yields(init, |_| {}, String::from("initial")); +// assert_set_then_get_yields(init, |_| {}, String::from("set")); +// } + +// #[test] +// fn test_resource_access() { +// let init = |world: &mut World| { +// world.insert_resource(TestResource { bytes: vec![42u8] }); + +// ReflectReference { +// base: ReflectBaseType { +// base_id: ReflectBase::Resource(TestResource::test_component_id()), +// type_id: TypeId::of::(), +// }, +// reflect_path: vec![ +// ReflectionPathElem::Reflection(ParsedPath::parse_static(".bytes").unwrap()), +// ReflectionPathElem::DeferredReflection(DeferredReflection { +// get: Arc::new(|root| { +// let strings = root.try_downcast_ref::>().unwrap(); +// Ok(strings.first().unwrap()) +// }), +// get_mut: Arc::new(|root| { +// let strings = root.try_downcast_mut::>().unwrap(); +// Ok(strings.first_mut().unwrap()) +// }), +// }), +// ], +// } +// }; +// assert_access_yields(init, |_| {}, 42u8); +// assert_set_then_get_yields(init, |_| {}, 69u8); +// } + +// #[test] +// fn test_script_alloc_access() { +// let init = |world: &mut World| { +// let mut script_allocator = ReflectAllocator::default(); +// let mut ref_ = ReflectReference::new_allocated( +// TestComponent { +// strings: vec![String::from("initial")], +// }, +// &mut script_allocator, +// ); +// ref_.index_path(ParsedPath::parse_static(".strings").unwrap()); +// ref_.index_path(DeferredReflection { +// get: Arc::new(|root| { +// let strings = root.try_downcast_ref::>().unwrap(); +// Ok(strings.first().unwrap()) +// }), +// get_mut: Arc::new(|root| { +// let strings = root.try_downcast_mut::>().unwrap(); +// Ok(strings.first_mut().unwrap()) +// }), +// }); +// world.insert_resource(script_allocator); +// ref_ +// }; +// let post_check = |world: &WorldAccessGuard| { +// assert!( +// world +// .get_allocation_access(ReflectAllocationId(0)) +// .is_some(), +// "allocation access was not released correctly" +// ); +// }; +// assert_access_yields(init, post_check, String::from("initial")); +// assert_set_then_get_yields(init, post_check, String::from("set")); +// } + +// #[test] +// #[allow(clippy::drop_non_drop)] +// fn test_invalid_runtime_access() { +// let mut world = World::new(); +// let world = WorldAccessGuard::new(&mut world); +// let access = world.get_component_access(ComponentId::new(0)); +// assert!( +// world.get_component_access(ComponentId::new(0)).is_none(), +// "access was allowed to alias" +// ); +// drop(access); +// } + +// fn get_reg(world: &WorldCallbackAccess, name: &str) -> ScriptTypeRegistration { +// world +// .get_type_by_name(name.to_owned()) +// .expect("Type not found") +// } + +// fn test_comp_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { +// world +// .get_type_by_name("TestComponent".to_owned()) +// .expect("Component not found") +// } + +// fn test_resource_reg(world: &WorldCallbackAccess) -> ScriptTypeRegistration { +// world +// .get_type_by_name("TestResource".to_owned()) +// .expect("Resource not found") +// } + +// #[test] +// fn test_get_type_by_name() { +// let mut world = init_world(); +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_reg = world.get_type_by_name("TestComponent".to_owned()).unwrap(); +// let resource_reg = world.get_type_by_name("TestResource".to_owned()).unwrap(); + +// assert_eq!( +// comp_reg.registration.type_info().type_id(), +// std::any::TypeId::of::() +// ); +// assert_eq!( +// resource_reg.registration.type_info().type_id(), +// std::any::TypeId::of::() +// ); +// }); +// } + +// #[test] +// fn test_get_type_by_name_invalid() { +// let mut world = init_world(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_reg = world.get_type_by_name("x".to_owned()); +// let resource_reg = world.get_type_by_name("z".to_owned()); + +// assert!(comp_reg.is_none()); +// assert!(resource_reg.is_none()); +// }); +// } + +// #[test] +// fn test_add_default_component_from_world() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_reg = get_reg(world, "CompWithFromWorld"); +// world.add_default_component(entity, comp_reg).unwrap() +// }); + +// assert_eq!( +// world.get_entity(entity).unwrap().get::(), +// Some(&CompWithFromWorld(String::from("FromWorld"))) +// ); +// } + +// #[test] +// fn test_add_default_component_default() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_reg = get_reg(world, "CompWithFromWorld"); +// world.add_default_component(entity, comp_reg).unwrap() +// }); + +// assert_eq!( +// world.get_entity(entity).unwrap().get::(), +// Some(&CompWithFromWorld(String::from("Default"))) +// ); +// } + +// #[test] +// fn test_add_default_component_missing_from_world_and_default() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_reg = get_reg(world, "CompWithFromWorld"); +// match world.add_default_component(entity, comp_reg.clone()) { +// Ok(_) => { +// panic!("Expected error") +// } +// Err(ScriptError(inner)) => { +// assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); +// assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", comp_reg.registration.type_info().type_path())); +// } +// } +// }); +// } + +// #[test] +// fn test_add_default_component_missing_component_data() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_reg = get_reg(world, "CompWithFromWorld"); +// match world.add_default_component(entity, comp_reg.clone()) { +// Ok(_) => { +// panic!("Expected error") +// } +// Err(ScriptError(inner)) => { +// assert_eq!(inner.kind, ScriptErrorKind::RuntimeError); +// assert_eq!(inner.reason.to_string(), format!("Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", comp_reg.registration.type_info().type_path())); +// } +// } +// }); +// } + +// #[test] +// fn test_get_component_existing() { +// let mut world = init_world(); + +// let entity = world.spawn(TestComponent { strings: vec![] }).id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_ref = world +// .get_component(entity, TestComponent::test_component_id()) +// .unwrap() +// .unwrap(); +// assert_eq!( +// comp_ref, +// ReflectReference { +// base: ReflectBaseType { +// type_id: std::any::TypeId::of::(), +// base_id: ReflectBase::Component(entity, TestComponent::test_component_id()), +// }, +// reflect_path: Default::default(), +// } +// ); +// }); +// } + +// #[test] +// fn test_get_component_missing() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_ref = world +// .get_component(entity, TestComponent::test_component_id()) +// .unwrap(); +// assert_eq!(comp_ref, None); +// }); +// } + +// #[test] +// fn test_get_component_missing_entity() { +// let mut world = init_world(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_ref = +// world.get_component(Entity::from_raw(0), TestComponent::test_component_id()); +// match comp_ref { +// Ok(_) => { +// panic!("Expected error") +// } +// Err(e) => { +// assert_eq!(e.kind, ScriptErrorKind::RuntimeError); +// assert_eq!(e.reason.to_string(), "Entity does not exist: 0v1"); +// } +// } +// }); +// } + +// #[test] +// fn test_get_component_unregistered_component() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); +// let fake_id = ComponentId::new(999); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_ref = world.get_component(entity, fake_id); +// match comp_ref { +// Ok(_) => { +// panic!("Expected error") +// } +// Err(e) => { +// assert_eq!(e.kind, ScriptErrorKind::RuntimeError); +// assert_eq!( +// e.reason.to_string(), +// format!("Component does not exist: {fake_id:?}"), +// ); +// } +// } +// }); +// } + +// #[test] +// fn test_remove_component() { +// let mut world = init_world(); + +// let entity = world +// .spawn(TestComponent { +// strings: vec![String::from("strings")], +// }) +// .id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world +// .remove_component(entity, test_comp_reg(world)) +// .unwrap(); +// }); + +// assert_eq!( +// world.get_entity(entity).unwrap().get::(), +// None +// ); +// } + +// #[test] +// fn test_remove_component_empty_idempotent() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world +// .remove_component(entity, test_comp_reg(world)) +// .unwrap(); +// }); + +// assert_eq!( +// world.get_entity(entity).unwrap().get::(), +// None +// ); +// } + +// #[test] +// fn test_remove_component_missing_comp_registration() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let result = world.remove_component(entity, test_resource_reg(world)); +// match result { +// Ok(_) => { +// panic!("Expected error") +// } +// Err(e) => { +// assert_eq!(e.kind, ScriptErrorKind::RuntimeError); +// assert_eq!( +// e.reason.to_string(), +// format!("Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", test_resource_reg(world).registration.type_info().type_path()) +// ); +// } +// } +// }); + +// assert_eq!( +// world.get_entity(entity).unwrap().get::(), +// None +// ); +// } + +// #[test] +// fn test_remove_component_missing_entity() { +// let mut world = init_world(); + +// let fake_entity = Entity::from_raw(0); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let result = world.remove_component(fake_entity, test_comp_reg(world)); +// match result { +// Ok(_) => { +// panic!("Expected error") +// } +// Err(e) => { +// assert_eq!(e.kind, ScriptErrorKind::RuntimeError); +// assert_eq!(e.reason.to_string(), "Entity does not exist: 0v1"); +// } +// } +// }); +// } + +// #[test] +// fn test_get_resource_existing() { +// let mut world = init_world(); + +// world.insert_resource(TestResource { bytes: vec![1] }); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_ref = world +// .get_resource(TestResource::test_component_id()) +// .unwrap() +// .unwrap(); +// assert_eq!( +// comp_ref, +// ReflectReference { +// base: ReflectBaseType { +// type_id: std::any::TypeId::of::(), +// base_id: ReflectBase::Resource(TestResource::test_component_id()), +// }, +// reflect_path: Default::default(), +// } +// ); +// }); +// } + +// #[test] +// fn test_get_resource_non_existing() { +// let mut world = init_world(); + +// let fake_comp = ComponentId::new(999); +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let comp_ref = world.get_resource(fake_comp); +// match comp_ref { +// Ok(None) => {} +// e => { +// panic!("Expected ok with none, got: {:?}", e); +// } +// } +// }); +// } + +// #[test] +// fn test_remove_resource() { +// let mut world = init_world(); + +// world.insert_resource(TestResource { bytes: vec![1] }); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.remove_resource(test_resource_reg(world)).unwrap(); +// }); + +// assert_eq!(world.get_resource::(), None); +// } + +// #[test] +// fn test_remove_resource_missing_idempotent() { +// let mut world = init_world(); + +// world.remove_resource::(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.remove_resource(test_resource_reg(world)).unwrap(); +// }); + +// assert_eq!(world.get_resource::(), None); +// } + +// #[test] +// fn test_remove_resource_missing_resource_registration() { +// let mut world = init_world(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// match world.remove_resource(test_comp_reg(world)) { +// Ok(_) => panic!("Expected error"), +// Err(e) => { +// assert_eq!(e.kind, ScriptErrorKind::RuntimeError); +// assert_eq!(e.reason.to_string(), format!("Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", test_comp_reg(world).registration.type_info().type_path())); +// } +// } +// }); +// } + +// #[test] +// fn test_has_resource_existing() { +// let mut world = init_world(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// assert!(world.has_resource(TestResource::test_component_id())); +// }); +// } + +// #[test] +// fn test_has_resource_missing() { +// let mut world = init_world(); + +// world.remove_resource::(); +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// assert!(world.has_resource(TestResource::test_component_id())); +// }); +// } + +// #[test] +// fn test_get_children_1_child() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child]); +// cmnds.apply(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let children = world.get_children(parent).unwrap(); +// assert_eq!(children.len(), 1); +// assert_eq!(children[0], child); +// }); +// } + +// #[test] +// #[should_panic( +// expected = "Component not registered: `bevy_hierarchy::components::children::Children`" +// )] +// fn test_get_children_children_component_unregistered() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.get_children(parent).unwrap(); +// }); +// } + +// #[test] +// fn test_get_children_no_children() { +// let mut world = init_world(); + +// world.register_component::(); +// let parent = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let children = world.get_children(parent).unwrap(); +// assert_eq!(children.len(), 0); +// }); +// } + +// #[test] +// fn test_get_parent_1_parent() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child]); +// cmnds.apply(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let found_parent = world.get_parent(child).unwrap(); +// assert_eq!(found_parent, Some(parent)); +// }); +// } + +// #[test] +// fn test_get_parent_no_parent() { +// let mut world = init_world(); + +// world.register_component::(); + +// let child = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// let found_parent = world.get_parent(child).unwrap(); +// assert_eq!(found_parent, None); +// }); +// } + +// #[test] +// #[should_panic( +// expected = "Component not registered: `bevy_hierarchy::components::parent::Parent`" +// )] +// fn test_get_parent_parent_component_unregistered() { +// let mut world = init_world(); + +// let child = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.get_parent(child).unwrap(); +// }); +// } + +// #[test] +// fn test_push_children_empty_entity() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.push_children(parent, &[child]).unwrap(); +// }); + +// let children = world.get::(parent).unwrap(); +// assert_eq!(children.len(), 1); +// assert_eq!(children[0], child); +// } + +// #[test] +// fn test_push_children_entity_with_1_child() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child]); +// cmnds.apply(&mut world); + +// let child_2 = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.push_children(parent, &[child_2]).unwrap(); +// }); + +// let children = world.get::(parent).unwrap(); +// assert_eq!(children.len(), 2); +// assert_eq!(children[0], child); +// assert_eq!(children[1], child_2); +// } + +// #[test] +// fn test_remove_children_entity_with_1_child() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child]); +// cmnds.apply(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.remove_children(parent, &[child]).unwrap(); +// }); + +// let children = world.get::(parent); +// assert!(children.is_none()); +// } + +// #[test] +// fn test_remove_children_remove_half_children() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let child_2 = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child, child_2]); +// cmnds.apply(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.remove_children(parent, &[child]).unwrap(); +// }); + +// let children = world.get::(parent).unwrap(); +// assert_eq!(children.len(), 1); +// assert_eq!(children[0], child_2); +// } + +// #[test] +// fn test_insert_children_empty() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.insert_children(parent, 0, &[child]).unwrap(); +// }); + +// let children = world.get::(parent).unwrap(); +// assert_eq!(children.len(), 1); +// assert_eq!(children[0], child); +// } + +// #[test] +// fn test_insert_children_middle() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let child_2 = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child, child_2]); +// cmnds.apply(&mut world); + +// let child_to_insert = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world +// .insert_children(parent, 1, &[child_to_insert]) +// .unwrap(); +// }); + +// let children = world.get::(parent).unwrap(); +// assert_eq!(children.len(), 3); +// assert_eq!(children[0], child); +// assert_eq!(children[1], child_to_insert); +// assert_eq!(children[2], child_2); +// } + +// #[test] +// fn test_despawn_entity() { +// let mut world = init_world(); + +// let entity = world.spawn_empty().id(); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.despawn(entity).unwrap(); +// }); + +// assert!(world.get_entity(entity).is_err()); +// } + +// #[test] +// fn test_despawn_recursive() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child]); +// cmnds.apply(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.despawn_recursive(parent).unwrap(); +// }); + +// assert!(world.get_entity(parent).is_err()); +// assert!(world.get_entity(child).is_err()); +// } + +// #[test] +// fn test_despawn_descendants() { +// let mut world = init_world(); + +// let parent = world.spawn_empty().id(); +// let child = world.spawn_empty().id(); +// let mut cmnds = CommandQueue::default(); +// let mut cmnd = Commands::new(&mut cmnds, &world); +// cmnd.entity(parent).add_children(&[child]); +// cmnds.apply(&mut world); + +// WorldCallbackAccess::with_callback_access(&mut world, |world| { +// world.despawn_descendants(parent).unwrap(); +// }); + +// assert!(world.get_entity(parent).is_ok()); +// assert!(world.get_entity(child).is_err()); +// } +// } diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 67a1ce74d0..c862a81270 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -3,12 +3,13 @@ use crate::event::ScriptErrorEvent; use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; -use bindings::ReflectAllocator; +use bindings::{AppReflectAllocator, ReflectAllocator}; use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, ContextPreHandlingInitializer, ScriptContexts, }; use handler::{Args, CallbackSettings, HandlerFn}; +pub use itertools::Either; use prelude::{ initialize_runtime, runtime::{RuntimeInitializer, RuntimeSettings}, @@ -65,7 +66,7 @@ impl Plugin for ScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { app.add_event::() .add_event::>() - .init_resource::() + .init_resource::() .init_resource::() .init_resource::() .init_asset::() @@ -213,7 +214,7 @@ mod test { app.add_plugins(ScriptingPlugin::::default()); assert!(app.world().contains_resource::()); - assert!(app.world().contains_resource::()); + assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::>()); assert!(app.world().contains_resource::>()); diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 24424c2468..315f954d95 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -1,9 +1,9 @@ -use std::{any::TypeId, cmp::max}; +use std::{any::{Any, TypeId}, cmp::max}; -use bevy::reflect::{FromType, List, PartialReflect, TypeData}; +use bevy::reflect::{FromType, List, PartialReflect, Reflect, ReflectFromReflect, TypeData}; use itertools::Itertools; -use crate::error::ScriptError; +use crate::{bindings::{pretty_print::DisplayWithWorld, WorldAccessGuard}, error::{ScriptError, ScriptResult}}; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { @@ -64,6 +64,8 @@ pub trait PartialReflectExt { /// For maps, this is the type id of the keys. fn key_type_id(&self) -> Option; + /// Tries to construct the concrete underlying type from a possibly untyped reference + fn from_reflect(reflect: &dyn PartialReflect, world: &WorldAccessGuard) -> ScriptResult>; } pub trait TypeIdExtensions { fn type_id_or_fake_id(&self) -> TypeId; @@ -294,6 +296,19 @@ impl PartialReflectExt for T { }; Some(key) } + + fn from_reflect(reflect: &dyn PartialReflect, world: &WorldAccessGuard) -> ScriptResult> { + + let type_info = reflect.get_represented_type_info().ok_or_else(|| ScriptError::new_runtime_error("Could not construct concrete type as the reference does not contain type information."))?; + let type_id = type_info.type_id(); + + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + let from_reflect_type_data: &ReflectFromReflect = type_registry.get_type_data(type_id).ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type id {} as it does not have a FromReflect type data registered.", type_id.display_with_world(world))))?; + from_reflect_type_data.from_reflect(reflect) + .ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type: {}. From Reflect implementation failed", type_id.display_with_world(world)))) + } } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index b5c6fafefc..3f870bb029 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -9,13 +9,14 @@ use crate::{ error::{ScriptError, ScriptResult}, event::{IntoCallbackLabel, ScriptCallbackEvent, ScriptErrorEvent}, handler::{Args, CallbackSettings}, - prelude::RuntimeSettings, + prelude::{AppReflectAllocator, RuntimeSettings}, runtime::{Runtime, RuntimeContainer}, script::{ScriptComponent, Scripts}, }; /// Cleans up dangling script allocations -pub fn garbage_collector(mut allocator: ResMut) { +pub fn garbage_collector(allocator: ResMut) { + let mut allocator = allocator.write(); allocator.clean_garbage_allocations() } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs index 78cd9549b3..3e905b28f4 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs @@ -1,5 +1,5 @@ -pub mod providers; -pub mod proxy; +// pub mod providers; +// pub mod proxy; pub mod query; pub mod reference; pub mod std; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs index 3848898817..b81e66e4e0 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs @@ -4,8 +4,8 @@ use bevy::reflect::{FromReflect, Reflect, TypeRegistry}; use bevy_mod_scripting_core::{ bindings::{ - Proxy, ReflectAllocator, ReflectRefMutProxy, ReflectRefProxy, ReflectReference, - ReflectValProxy, Unproxy, ValProxy, WorldAccessGuard, WorldAccessUnit, WorldAccessWrite, + Proxy, ReflectAllocator, ReflectReference, ReflectValProxy, Unproxy, ValProxy, + WorldAccessGuard, }, error::{ScriptError, ScriptResult}, }; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs index 5e5b1d0cfb..748aec10fb 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs @@ -2,8 +2,7 @@ use std::ops::{Deref, DerefMut}; use bevy::prelude::Entity; use bevy_mod_scripting_core::bindings::{ - ReflectAllocator, ReflectReference, ScriptQueryBuilder, ScriptTypeRegistration, Unproxy, - ValProxy, + ReflectAllocator, ReflectReference, ScriptQueryBuilder, ScriptTypeRegistration, }; use tealr::{ mlu::{ @@ -16,7 +15,7 @@ use tealr::{ use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata, util::Variadic}; use super::{ - proxy::{LuaProxied, LuaValProxy}, + // proxy::{LuaProxied, LuaValProxy}, reference::LuaReflectReference, world::GetWorld, }; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 113ef6cd14..be3fd1e2f6 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -10,8 +10,8 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - DeferredReflection, Either, ReflectAllocator, ReflectRefIter, ReflectReference, - ReflectReferencePrinter, ReflectionPathElem, TypeIdSource, Unproxy, WorldCallbackAccess, + DeferredReflection, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, + TypeIdSource, WorldCallbackAccess, }, error::ScriptError, new_deferred_reflection, @@ -28,7 +28,7 @@ use crate::{ }; use super::{ - proxy::{LuaProxied, LuaValProxy}, + // proxy::{LuaProxied, LuaValProxy}, world::GetWorld, }; @@ -151,10 +151,10 @@ impl LuaReflectReference { })? } None => { - return Err(ScriptError::new_runtime_error(format!( + Err(ScriptError::new_runtime_error(format!( "Invalid assignment `{}` = `{value:?}`. The left hand side does not support conversion from lua.", ReflectReferencePrinter::new(self.0).pretty_print(&world), - ))); + ))) } } }, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs index eba4c05d81..6adc131333 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs @@ -6,7 +6,7 @@ use tealr::mlu::TealData; use crate::impl_userdata_from_lua; -use super::proxy::LuaProxied; +// use super::proxy::LuaProxied; /// Caches information about type data #[derive(Clone, tealr::mlu::UserData, tealr::ToTypename)] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index b817776c3f..771a792769 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -4,9 +4,7 @@ use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; use bevy::prelude::Entity; use bevy_mod_scripting_core::{ - bindings::{ - ReflectReference, ScriptTypeRegistration, Unproxy, WorldAccessGuard, WorldCallbackAccess, - }, + bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, error::ScriptError, }; use bevy_mod_scripting_derive::LuaProxy; @@ -19,13 +17,13 @@ use tealr::{ ToTypename, Type, }; -use super::proxy::LuaReflectRefProxy; +// use super::proxy::LuaReflectRefProxy; use super::query::LuaQueryBuilder; use super::{ providers::bevy_ecs::LuaEntity, - proxy::{ - ErrorProxy, LuaIdentityProxy, LuaProxied, LuaReflectValProxy, LuaValProxy, TypenameProxy, - }, + // proxy::{ + // ErrorProxy, LuaIdentityProxy, LuaProxied, LuaReflectValProxy, LuaValProxy, TypenameProxy, + // }, type_registration::LuaTypeRegistration, }; use crate::util::Variadic; diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 2c4527256b..ad0057427a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -19,7 +19,7 @@ use bevy_mod_scripting_core::{ }; use bindings::{ providers::bevy_ecs::LuaEntity, - proxy::LuaProxied, + // proxy::LuaProxied, world::{GetWorld, LuaWorld}, }; pub use tealr; diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index 794b906e20..1a1f453478 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -20,7 +20,7 @@ use bevy_mod_scripting_core::{ }; use tealr::mlu::mlua::{FromLua, IntoLua, Lua, Table, Value}; -use crate::bindings::{proxy::LuaProxied, reference::LuaReflectReference, world::GetWorld}; +use crate::bindings::{reference::LuaReflectReference, world::GetWorld}; /// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented in lua via proxies which store /// a reference to the actual value. diff --git a/crates/test_utils/src/test_data.rs b/crates/test_utils/src/test_data.rs index cf5fc1cc23..2d100369d8 100644 --- a/crates/test_utils/src/test_data.rs +++ b/crates/test_utils/src/test_data.rs @@ -116,6 +116,27 @@ impl CompWithFromWorldAndComponentData { } } +#[derive(Resource, Reflect, PartialEq, Debug)] +pub struct TestResourceWithVariousFields { + pub string: String, + pub usize: usize, + pub int: i32, + pub float: f32, + pub bool: bool, +} + +impl TestResourceWithVariousFields { + pub fn init() -> Self { + Self { + string: "Initial Value".to_string(), + usize: 22, + int: 42, + float: 69.0, + bool: true, + } + } +} + pub(crate) const TEST_COMPONENT_ID_START: usize = 20; pub(crate) const TEST_ENTITY_ID_START: u32 = 0; @@ -197,7 +218,8 @@ impl_test_component_ids!( ], [ TestResource => 5, - ResourceWithDefault => 6 + ResourceWithDefault => 6, + TestResourceWithVariousFields => 7, ] ); From 8bfd501b245970474f5d15d2d64d99c989f4ea60 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 14 Dec 2024 12:51:58 +0000 Subject: [PATCH 040/217] DYNAMIC CALLS WOOOOOOO --- Cargo.toml | 16 +- assets/scripts/bevy_api.lua | 206 +- .../src/bindings/access_map.rs | 1 + .../src/bindings/allocator.rs | 2 +- .../src/bindings/function.rs | 211 +- .../src/bindings/mod.rs | 1 + .../src/bindings/pretty_print.rs | 53 +- .../src/bindings/reference.rs | 112 +- .../src/bindings/script_val.rs | 1356 + .../src/bindings/world.rs | 25 +- crates/bevy_mod_scripting_core/src/error.rs | 53 +- crates/bevy_mod_scripting_core/src/lib.rs | 9 +- .../src/reflection_extensions.rs | 187 +- .../bevy_mod_scripting_functions/Cargo.toml | 23 + .../bevy_mod_scripting_functions/src/core.rs | 33 + .../bevy_mod_scripting_functions/src/lib.rs | 15 + .../src/namespaced_register.rs | 136 + .../bevy_mod_scripting_lua/Cargo.toml | 29 +- .../src/bindings/mod.rs | 6 +- .../src/bindings/providers/bevy_core.rs | 84 - .../src/bindings/providers/bevy_ecs.rs | 560 - .../src/bindings/providers/bevy_hierarchy.rs | 155 - .../src/bindings/providers/bevy_input.rs | 1921 -- .../src/bindings/providers/bevy_math.rs | 4548 --- .../src/bindings/providers/bevy_reflect.rs | 24798 ---------------- .../src/bindings/providers/bevy_time.rs | 621 - .../src/bindings/providers/bevy_transform.rs | 366 - .../src/bindings/providers/mod.rs | 25 - .../src/bindings/proxy.rs | 256 - .../src/bindings/query.rs | 6 +- .../src/bindings/reference.rs | 1109 +- .../src/bindings/script_value.rs | 68 + .../src/bindings/std.rs | 39 - .../src/bindings/world.rs | 819 +- .../bevy_mod_scripting_lua/src/docs.rs | 257 +- .../bevy_mod_scripting_lua/src/lib.rs | 46 +- .../bevy_mod_scripting_lua/src/type_data.rs | 5 + .../bevy_mod_scripting_lua/src/util.rs | 188 +- examples/lua/bevy_api.rs | 6 +- src/lib.rs | 2 + 40 files changed, 3533 insertions(+), 34820 deletions(-) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_val.rs create mode 100644 crates/bevy_mod_scripting_functions/Cargo.toml create mode 100644 crates/bevy_mod_scripting_functions/src/core.rs create mode 100644 crates/bevy_mod_scripting_functions/src/lib.rs create mode 100644 crates/bevy_mod_scripting_functions/src/namespaced_register.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs create mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs diff --git a/Cargo.toml b/Cargo.toml index 5f7b601e69..ea198b5561 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,12 +57,13 @@ bevy_mod_scripting_core = { workspace = 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_mod_scripting_functions = { workspace = 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.2" } bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.2" } +bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.8.0-alpha.2" } test_utils = { path = "crates/test_utils" } [dev-dependencies] @@ -84,6 +85,7 @@ members = [ "crates/bevy_mod_scripting_common", "crates/bevy_mod_scripting_derive", "crates/test_utils", + "crates/bevy_mod_scripting_functions", ] resolver = "2" exclude = ["crates/bevy_api_gen", "crates/macro_tests"] @@ -106,20 +108,12 @@ debug = false [[example]] name = "console_integration_lua" path = "examples/lua/console_integration.rs" -required-features = [ - "lua54", - "bevy/file_watcher", - "bevy/multi_threaded", -] +required-features = ["lua54", "bevy/file_watcher", "bevy/multi_threaded"] [[example]] name = "console_integration_rhai" path = "examples/rhai/console_integration.rs" -required-features = [ - "rhai", - "bevy/file_watcher", - "bevy/multi_threaded", -] +required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] [[example]] name = "complex_game_loop_lua" diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 46c5262949..a0183bc6f4 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -9,141 +9,145 @@ end function on_event() - print(entity) - print(script) - print(world) + world:spawn() + world:exit() - local my_component_type = world:get_type_by_name("MyComponent") + -- print(entity) + -- print(script) + -- print(world) - local comp = world:get_component(entity, my_component_type) - print("Before script: ", comp) - print("\noption") - print(comp.option_usize) - comp.option_usize = 69 - print(comp.option_usize) - comp.option_usize = nil - print(comp.option_usize) + -- local my_component_type = world:get_type_by_name("MyComponent") - print("\nvec") - print(table_to_string(comp.vec_of_usize)) - comp.vec_of_usize = {42,69,72} - comp.vec_of_usize[1] = 0 - print(comp.vec_of_usize[2]) - print(table_to_string(comp.vec_of_usize)) - comp.vec_of_usize = {} - print(table_to_string(comp.vec_of_usize)) - comp.vec_of_usize = comp.vec_of_usize2 - print(table_to_string(comp.vec_of_usize)) - comp.vec_of_usize = comp.vec_of_usize - print(table_to_string(comp.vec_of_usize)) - comp.vec_of_usize:insert(1, 42) - print(table_to_string(comp.vec_of_usize)) + -- local comp = world:get_component(entity, my_component_type) + -- print("Before script: ", comp) - print("\nmap") - -- print(comp.map_of_strings["key"]) - comp.map_of_strings:insert("key2", "value") - -- print(comp.map_of_strings["key2"]) + -- print("\noption") + -- print(comp.option_usize) + -- comp.option_usize = 69 + -- print(comp.option_usize) + -- comp.option_usize = nil + -- print(comp.option_usize) + -- print("\nvec") + -- print(table_to_string(comp.vec_of_usize)) + -- comp.vec_of_usize = {42,69,72} + -- comp.vec_of_usize[1] = 0 + -- print(comp.vec_of_usize[2]) + -- print(table_to_string(comp.vec_of_usize)) + -- comp.vec_of_usize = {} + -- print(table_to_string(comp.vec_of_usize)) + -- comp.vec_of_usize = comp.vec_of_usize2 + -- print(table_to_string(comp.vec_of_usize)) + -- comp.vec_of_usize = comp.vec_of_usize + -- print(table_to_string(comp.vec_of_usize)) + -- comp.vec_of_usize:insert(1, 42) + -- print(table_to_string(comp.vec_of_usize)) + -- print("\nmap") + -- -- print(comp.map_of_strings["key"]) + -- comp.map_of_strings:insert("key2", "value") + -- -- print(comp.map_of_strings["key2"]) - print("============") - -- vec's and matrices have custom __index and __newindex overrides - print("comp.vec2 before: ", comp.vec2) - comp.vec2[1] = 69 - print("comp.vec2 after: ", comp.vec2) - -- Option's get converted to nil or the value inside - print("comp.option_vec3 before: ", comp.option_vec3) - comp.option_vec3 = Vec3.new(2,1,3) - print("comp.option_vec3 after: ", comp.option_vec3) + -- print("============") - -- reflection via index is indexed starting at 1, unlike in Rust to match Lua's indexing - print("comp.option_vec3[1] before: ", comp.option_vec3[1]) - comp.option_vec3[1] = 5 - print("comp.option_vec3[1] after: ", comp.option_vec3[1]) + -- -- vec's and matrices have custom __index and __newindex overrides + -- print("comp.vec2 before: ", comp.vec2) + -- comp.vec2[1] = 69 + -- print("comp.vec2 after: ", comp.vec2) - print("============") + -- -- Option's get converted to nil or the value inside + -- print("comp.option_vec3 before: ", comp.option_vec3) + -- comp.option_vec3 = Vec3.new(2,1,3) + -- print("comp.option_vec3 after: ", comp.option_vec3) - -- Vec references get converted to a custom proxy `LuaVec` which is - -- also assignable via lua tables + -- -- reflection via index is indexed starting at 1, unlike in Rust to match Lua's indexing + -- print("comp.option_vec3[1] before: ", comp.option_vec3[1]) + -- comp.option_vec3[1] = 5 + -- print("comp.option_vec3[1] after: ", comp.option_vec3[1]) - print("comp.vec_of_option_bools before: ", table_to_string(comp.vec_of_option_bools)) - comp.vec_of_option_bools = {true,false,true} - print("comp.vec_of_option_bools after assignment: ", table_to_string(comp.vec_of_option_bools)) + -- print("============") - print("comp.vec_of_option_bools[1] before: ", comp.vec_of_option_bools[1]) - comp.vec_of_option_bools[1] = false - print("comp.vec_of_option_bools[1] after: ", comp.vec_of_option_bools[1]) + -- -- Vec references get converted to a custom proxy `LuaVec` which is + -- -- also assignable via lua tables - -- there are some additional methods available on LuaVec proxies imitating the Vec api - print("comp.vec_of_option_bools before insert: ", table_to_string(comp.vec_of_option_bools)) - comp.vec_of_option_bools:insert(1,nil) - print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) + -- print("comp.vec_of_option_bools before: ", table_to_string(comp.vec_of_option_bools)) + -- comp.vec_of_option_bools = {true,false,true} + -- print("comp.vec_of_option_bools after assignment: ", table_to_string(comp.vec_of_option_bools)) + -- print("comp.vec_of_option_bools[1] before: ", comp.vec_of_option_bools[1]) + -- comp.vec_of_option_bools[1] = false + -- print("comp.vec_of_option_bools[1] after: ", comp.vec_of_option_bools[1]) + -- -- there are some additional methods available on LuaVec proxies imitating the Vec api + -- print("comp.vec_of_option_bools before insert: ", table_to_string(comp.vec_of_option_bools)) + -- comp.vec_of_option_bools:insert(1,nil) + -- print("comp.vec_of_option_bools after insert: ", table_to_string(comp.vec_of_option_bools)) - print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) - comp.vec_of_option_bools:push(false) - print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) - print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) - print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) - print(comp.vec_of_option_bools:pop():print_value()) - print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) + -- print("comp.vec_of_option_bools before push: ", table_to_string(comp.vec_of_option_bools)) + -- comp.vec_of_option_bools:push(false) + -- print("comp.vec_of_option_bools after push: ", table_to_string(comp.vec_of_option_bools)) - print("the pairs inside comp.vec_of_option_bools: ") - for k,v in pairs(comp.vec_of_option_bools) do - print(string.format(" - %s:%s",k,v)) - end + -- print("comp.vec_of_option_bools len after push: ", #comp.vec_of_option_bools) + + -- print("comp.vec_of_option_bools before pop: ", table_to_string(comp.vec_of_option_bools)) + -- print(comp.vec_of_option_bools:pop():print_value()) + -- print("comp.vec_of_option_bools after pop: ", table_to_string(comp.vec_of_option_bools)) + -- print("the pairs inside comp.vec_of_option_bools: ") + -- for k,v in pairs(comp.vec_of_option_bools) do + -- print(string.format(" - %s:%s",k,v)) + -- end - comp.vec_of_option_bools:clear() - print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) - print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) - print("============") + -- comp.vec_of_option_bools:clear() + -- print("comp.vec_of_option_bools after clear: ", table_to_string(comp.vec_of_option_bools)) + -- print("comp.vec_of_option_bools len after clear: ", #comp.vec_of_option_bools) - print(Vec3.new(0,1,0) + Vec3.new(1,0,0)) - print(Vec3.new(0,1,0):any_orthonormal_vector()) - print(comp.mat3[1]) - print(Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1]) - local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1] - print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) + -- print("============") - local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) - print("new_mat3 is:", new_mat3) + -- print(Vec3.new(0,1,0) + Vec3.new(1,0,0)) + -- print(Vec3.new(0,1,0):any_orthonormal_vector()) + -- print(comp.mat3[1]) + -- print(Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1]) + -- local complex_vec_op = Vec3.new(0,1,0):any_orthonormal_vector() + comp.mat3[1] + -- print("(0,1,0).any_orthonormal_vector() + mat3.x_axis is: ", complex_vec_op) + + -- local new_mat3 = Mat3.from_cols(Vec3.new(1,0,0),Vec3.new(0,1,0),Vec3.new(0,0,-1)) + -- print("new_mat3 is:", new_mat3) - comp.vec2 = comp.vec2 + comp.vec2 - print("A") - comp.usize = comp.vec2:min_element() + -- comp.vec2 = comp.vec2 + comp.vec2 + -- print("A") + -- comp.usize = comp.vec2:min_element() - print("B") - comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() - print("C") - comp.vec2 = Vec2.new(2,1) - print("D") - comp.quat = Quat.from_xyzw(3,2,1,4) - print("E") - comp.mat3[1] = Vec3.new(69,69,69) - print("F") + -- print("B") + -- comp.f32 = comp.f32 + comp.f32 + comp.vec2:min_element() + -- print("C") + -- comp.vec2 = Vec2.new(2,1) + -- print("D") + -- comp.quat = Quat.from_xyzw(3,2,1,4) + -- print("E") + -- comp.mat3[1] = Vec3.new(69,69,69) + -- print("F") - world:exit() - do return end - print("============") + -- world:exit() + -- do return end + -- print("============") - -- this is an example of something impossible to achieve with plain bevy reflection under the hood - comp.mat3[1][1] = 42 + -- -- this is an example of something impossible to achieve with plain bevy reflection under the hood + -- comp.mat3[1][1] = 42 - -- now let's retrieve these again to see if we actually changed their values permanently - comp = world:get_component(entity,my_component_type) + -- -- now let's retrieve these again to see if we actually changed their values permanently + -- comp = world:get_component(entity,my_component_type) - print("After script:") - print(comp) + -- print("After script:") + -- print(comp) - world:exit() + -- world:exit() end \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs index 6df4e88878..4769f43f65 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -137,6 +137,7 @@ impl ReflectAccessId { ReflectBase::Resource(id) => Some(Self::for_component_id(id)), ReflectBase::Component(_, id) => Some(Self::for_component_id(id)), ReflectBase::Owned(id) => Some(Self::for_allocation(id)), + ReflectBase::World => None, } } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index 88b3d4d8ea..1f8d5cb01f 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -7,7 +7,7 @@ use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::sync::Arc; -#[derive(Clone, PartialEq, Eq, Hash, Debug)] +#[derive(Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)] pub struct ReflectAllocationId(pub(crate) Arc); impl ReflectAllocationId { pub fn id(&self) -> usize { diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index 9dca187910..7099ebd575 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -1,4 +1,4 @@ -use std::borrow::Cow; +use std::{borrow::Cow, sync::Arc}; use bevy::reflect::func::{ args::{Arg, ArgInfo, Ownership}, @@ -8,37 +8,38 @@ use bevy::reflect::func::{ use crate::error::{ScriptError, ScriptResult}; use super::{ - access_map::ReflectAccessId, pretty_print::DisplayWithWorld, ReflectReference, WorldAccessGuard, + access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_val::ScriptValue, + ReflectBase, ReflectReference, WorldAccessGuard, WorldCallbackAccess, WorldGuard, }; /// Can be implemented for callables which require dynamic access to the world to be called. /// /// The claim and release functions must be used to scope the access to the world such that function output . pub trait CallableWithAccess { - fn with_call O>( + fn with_call O, I: IntoIterator>( &self, - args: &[ReflectReference], - world: &WorldAccessGuard, + args: I, + world: Arc, f: F, ) -> ScriptResult; } -impl<'env> CallableWithAccess for DynamicFunction<'env> { - fn with_call O>( +impl CallableWithAccess for DynamicFunction<'_> { + fn with_call O, I: IntoIterator>( &self, - args: &[ReflectReference], - world: &WorldAccessGuard, + args: I, + world: Arc, f: F, ) -> ScriptResult { let info = self.info().args(); - if info.len() != args.len() { - return Err(ScriptError::new_reflection_error(format!( - "Expected {} arguments, got {}", - info.len(), - args.len() - ))); - } + // if info.len() != args.len() { + // return Err(ScriptError::new_reflection_error(format!( + // "Expected {} arguments, got {}", + // info.len(), + // args.len() + // ))); + // } // We need to: // 1. Claim the correct access for each argument @@ -47,7 +48,10 @@ impl<'env> CallableWithAccess for DynamicFunction<'env> { // 4. Relinquish access to the caller for the return value // 5. Release the access for each argument // 6. Return the result - let (args_list, mut accesses) = args.into_args_list_with_access(info, world)?; + let arg_iter = args.into_iter(); + + let (args_list, mut accesses) = arg_iter.into_args_list_with_access(info, world.clone())?; + // let arc_world = &arc_world; let return_val = match self.call(args_list) { Ok(return_val) => return_val, @@ -63,7 +67,6 @@ impl<'env> CallableWithAccess for DynamicFunction<'env> { }; let out = f(return_val); - // Safety: we have not generated any unsafe aliases // - we are releasing only the access we have claimed accesses.drain(..).for_each(|(id, _)| { @@ -81,11 +84,11 @@ pub trait IntoArgsListWithAccess { fn into_args_list_with_access<'w>( self, arg_info: &[ArgInfo], - world: &'w WorldAccessGuard, + world: WorldGuard<'w>, ) -> ScriptResult<(ArgList<'w>, Vec<(ReflectAccessId, Ownership)>)>; } -impl IntoArgsListWithAccess for &[ReflectReference] { +impl> IntoArgsListWithAccess for I { /// Converts a list of references into an `ArgList` and collects the access id's and types for each argument. /// /// This is actually safe to call, since we are not actually releasing the access here. @@ -93,77 +96,73 @@ impl IntoArgsListWithAccess for &[ReflectReference] { fn into_args_list_with_access<'w>( self, arg_info: &[ArgInfo], - world: &'w WorldAccessGuard, + world: WorldGuard<'w>, ) -> ScriptResult<(ArgList<'w>, Vec<(ReflectAccessId, Ownership)>)> { - if self.len() != arg_info.len() { - return Err(ScriptError::new_reflection_error(format!( - "Expected {} arguments, got {}", - arg_info.len(), - self.len() - ))); - } + // if self.len() != arg_info.len() { + // return Err(ScriptError::new_reflection_error(format!( + // "Expected {} arguments, got {}", + // arg_info.len(), + // self.len() + // ))); + // } let mut accesses = Vec::default(); + let mut arg_list = ArgList::new(); - let _ = self - .iter() - .zip(arg_info.iter()) - .map(|(arg_ref, arg_info)| { - let access_id = + for (value, arg_info) in self.zip(arg_info.iter()) { + match value { + ScriptValue::Reference(arg_ref) => { + let access_id = ReflectAccessId::for_reference(arg_ref.base.base_id.clone()).ok_or_else(|| { ScriptError::new_reflection_error(format!( - "Could not call function, argument {} is not a valid reference. Have you registered the type?", - arg_ref.display_with_world(world) + "Could not call function, argument: {:?}, with type: {} is not a valid reference. Have you registered the type?", + arg_info.name(), + arg_ref.display_with_world(world.clone()) )) })?; - let is_write = matches!(arg_info.ownership(), Ownership::Mut); - - let success = if is_write { - world.claim_write_access(access_id) - } else { - world.claim_read_access(access_id) - }; - - if !success { - return Err(ScriptError::new_reflection_error(format!( - "Could not claim access for argument {}", - arg_ref.display_with_world(world) - ))); + let is_write = matches!(arg_info.ownership(), Ownership::Mut); + + let success = if is_write { + world.claim_write_access(access_id) + } else { + world.claim_read_access(access_id) + }; + + if !success { + accesses.drain(..).for_each(|(id, _)| { + // Safety: we have not generated any unsafe aliases + unsafe { world.release_access(id) }; + }); + return Err(ScriptError::new_reflection_error(format!( + "Could not claim access for argument {}", + arg_ref.display_with_world(world.clone()) + ))); + } + + accesses.push((access_id, arg_info.ownership())); + + let val = unsafe { arg_ref.clone().into_arg_value(world.clone(), arg_info) }; + let val = match val { + Ok(v) => v, + Err(e) => { + // Safety: Same as above + + accesses.iter().for_each(|(id, _)| { + unsafe { world.release_access(*id) }; + }); + return Err(e); + } + }; + arg_list = arg_list.push_arg(val); } - - - accesses.push((access_id, arg_info.ownership())); - - Ok(()) - }) - .collect::>>() - .inspect_err(|_| { - // we don't want to leave the world in an inconsistent state - // Safety: we have not generated any unsafe aliases - // - we are releassing only the access we have claimed - accesses.iter().for_each(|(id,_)| { - unsafe {world.release_access(*id)}; - }); - })?; - - let mut arg_list = ArgList::new(); - - for (r, info) in self.iter().zip(arg_info.iter()) { - // Safety: we have claimed access for each argument - let val = unsafe { r.clone().into_arg_value(world, info) }; - let val = match val { - Ok(v) => v, - Err(e) => { - // Safety: Same as above - - accesses.iter().for_each(|(id, _)| { - unsafe { world.release_access(*id) }; - }); - return Err(e); + ScriptValue::World => { + arg_list = arg_list.push_arg(ArgValue::Owned(Box::new( + WorldCallbackAccess::from_guard(world.clone()), + ))); } - }; - arg_list = arg_list.push_arg(val); + v => todo!(), + } } Ok((arg_list, accesses)) @@ -173,7 +172,7 @@ impl IntoArgsListWithAccess for &[ReflectReference] { #[cfg(test)] mod test { use bevy::{ - prelude::{IntoFunction, World}, + prelude::{Entity, IntoFunction, World}, reflect::{DynamicList, ParsedPath, ReflectFromReflect}, }; use test_utils::test_data::TestResourceWithVariousFields; @@ -183,8 +182,9 @@ mod test { use super::*; fn setup_world() -> World { - test_utils::test_data::setup_world(|world, _| { + test_utils::test_data::setup_world(|world, t| { world.insert_resource(AppReflectAllocator::default()); + t.register::() }) } @@ -201,8 +201,10 @@ mod test { let arg_ref = ReflectReference::new_allocated(2usize, &mut allocator); drop(allocator); + let arc_world = Arc::new(world); + function - .with_call(&[arg_ref], &world, |r| { + .with_call(vec![ScriptValue::Reference(arg_ref)], arc_world, |r| { assert!(r.unwrap_owned().reflect_partial_eq(&2usize).unwrap()); }) .unwrap(); @@ -213,15 +215,16 @@ mod test { let mut world = setup_world(); let world = WorldAccessGuard::new(&mut world); - + let world = WorldGuard::new(world); let function = (|usize: &usize| *usize).into_function(); let mut arg_ref = - ReflectReference::new_resource_ref::(&world).unwrap(); + ReflectReference::new_resource_ref::(world.clone()) + .unwrap(); arg_ref.index_path(ParsedPath::parse_static("usize").unwrap()); function - .with_call(&[arg_ref], &world, |r| { + .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { assert!(r.unwrap_owned().reflect_partial_eq(&22usize).unwrap()); }) .unwrap(); @@ -232,6 +235,7 @@ mod test { let mut world = setup_world(); let world = WorldAccessGuard::new(&mut world); + let world = WorldGuard::new(world); let function = (|usize: &mut usize| { *usize = 42; @@ -240,12 +244,13 @@ mod test { .into_function(); let mut arg_ref = - ReflectReference::new_resource_ref::(&world).unwrap(); + ReflectReference::new_resource_ref::(world.clone()) + .unwrap(); arg_ref.index_path(ParsedPath::parse_static("usize").unwrap()); function - .with_call(&[arg_ref], &world, |r| { + .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { assert!(r.unwrap_owned().reflect_partial_eq(&42usize).unwrap()); }) .unwrap(); @@ -256,6 +261,7 @@ mod test { let mut world = setup_world(); let world = WorldAccessGuard::new(&mut world); + let world = WorldGuard::new(world); let type_registry = world.type_registry(); let mut type_registry = type_registry.write(); @@ -277,7 +283,7 @@ mod test { drop(allocator); function - .with_call(&[arg_ref], &world, |r| { + .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { assert!(r.unwrap_owned().reflect_partial_eq(&vec![2usize]).unwrap()); }) .unwrap(); @@ -288,6 +294,7 @@ mod test { let mut world = setup_world(); let world = WorldAccessGuard::new(&mut world); + let world = WorldGuard::new(world); let type_registry = world.type_registry(); let mut type_registry = type_registry.write(); @@ -309,7 +316,7 @@ mod test { drop(allocator); function - .with_call(&[arg_ref], &world, |r| { + .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { assert!(r.unwrap_owned().reflect_partial_eq(&vec![2usize]).unwrap()); }) .unwrap(); @@ -320,6 +327,7 @@ mod test { let mut world = setup_world(); let world = WorldAccessGuard::new(&mut world); + let world = WorldGuard::new(world); let type_registry = world.type_registry(); let mut type_registry = type_registry.write(); @@ -345,7 +353,7 @@ mod test { drop(allocator); function - .with_call(&[arg_ref], &world, |r| { + .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { assert!(r .unwrap_owned() .reflect_partial_eq(&vec![2usize, 42usize]) @@ -353,4 +361,25 @@ mod test { }) .unwrap(); } + + #[test] + pub fn call_world_access_callback() { + let mut world = setup_world(); + + let world = WorldAccessGuard::new(&mut world); + + let function = (|world: WorldCallbackAccess| world.spawn()).into_function(); + + let arc_world = Arc::new(world); + let cloned_world = arc_world.clone(); + drop(arc_world); + function + .with_call(vec![ScriptValue::World], cloned_world, |r| { + assert!(r + .unwrap_owned() + .reflect_partial_eq(&Entity::from_raw(5)) + .unwrap()); + }) + .unwrap(); + } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/mod.rs index 5bd4d352bc..d96e5fc35d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/mod.rs @@ -5,6 +5,7 @@ pub mod pretty_print; // pub mod proxy; pub mod query; pub mod reference; +pub mod script_val; pub mod world; pub use {allocator::*, query::*, reference::*, world::*}; diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 347d7f8ac8..f96557c431 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -1,6 +1,9 @@ use crate::reflection_extensions::TypeIdExtensions; -use super::{ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, WorldAccessGuard}; +use super::{ + script_val::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, + WorldAccessGuard, WorldGuard, +}; use bevy::reflect::{PartialReflect, ReflectRef}; use itertools::Itertools; use std::{any::TypeId, borrow::Cow}; @@ -61,7 +64,7 @@ impl ReflectReferencePrinter { Self { reference } } - fn pretty_print_base(base: &ReflectBaseType, world: &WorldAccessGuard, out: &mut String) { + fn pretty_print_base(base: &ReflectBaseType, world: WorldGuard, out: &mut String) { let type_id = base.type_id; let type_registry = world.type_registry(); let type_registry = type_registry.read(); @@ -75,6 +78,7 @@ impl ReflectReferencePrinter { ReflectBase::Component(e, _) => format!("Component on entity {}", e), ReflectBase::Resource(_) => "Resource".to_owned(), ReflectBase::Owned(_) => "Allocation".to_owned(), + ReflectBase::World => "World".to_owned(), }; out.push_str(&format!("{}({})", base_kind, type_path)); @@ -82,15 +86,15 @@ impl ReflectReferencePrinter { /// Given a reflect reference, prints the type path of the reference resolving the type names with short names. /// I.e. `MyType(Component).field_name[0].field_name[1] -> FieldType::Name` - pub fn pretty_print(&self, world: &WorldAccessGuard) -> String { + pub fn pretty_print(&self, world: WorldGuard) -> String { let mut pretty_path = String::new(); pretty_path.push_str(" String { + pub fn pretty_print_value(&self, world: WorldGuard) -> String { let mut output = String::new(); // instead of relying on type registrations, simply traverse the reflection tree and print sensible values @@ -323,37 +327,37 @@ impl ReflectReferencePrinter { pub trait DisplayWithWorld { /// Display the `shallowest` representation of the type using world access. /// For references this is the type path and the type of the value they are pointing to. - fn display_with_world(&self, world: &WorldAccessGuard) -> String; + fn display_with_world(&self, world: WorldGuard) -> String; /// Display the most literal representation of the type using world access. /// I.e. for references this would be the pointed to value itself. - fn display_value_with_world(&self, world: &WorldAccessGuard) -> String; + fn display_value_with_world(&self, world: WorldGuard) -> String; } impl DisplayWithWorld for ReflectReference { - fn display_with_world(&self, world: &WorldAccessGuard) -> String { + fn display_with_world(&self, world: WorldGuard) -> String { ReflectReferencePrinter::new(self.clone()).pretty_print(world) } - fn display_value_with_world(&self, world: &WorldAccessGuard) -> String { + fn display_value_with_world(&self, world: WorldGuard) -> String { ReflectReferencePrinter::new(self.clone()).pretty_print_value(world) } } impl DisplayWithWorld for ReflectBaseType { - fn display_with_world(&self, world: &WorldAccessGuard) -> String { + fn display_with_world(&self, world: WorldGuard) -> String { let mut string = String::new(); ReflectReferencePrinter::pretty_print_base(self, world, &mut string); string } - fn display_value_with_world(&self, world: &WorldAccessGuard) -> String { + fn display_value_with_world(&self, world: WorldGuard) -> String { self.display_with_world(world) } } impl DisplayWithWorld for TypeId { - fn display_with_world(&self, world: &WorldAccessGuard) -> String { + fn display_with_world(&self, world: WorldGuard) -> String { let type_registry = world.type_registry(); let type_registry = type_registry.read(); @@ -366,7 +370,28 @@ impl DisplayWithWorld for TypeId { .to_string() } - fn display_value_with_world(&self, world: &WorldAccessGuard) -> String { + fn display_value_with_world(&self, world: WorldGuard) -> String { self.display_with_world(world) } } + +impl DisplayWithWorld for ScriptValue { + fn display_with_world(&self, world: WorldGuard) -> String { + match self { + ScriptValue::Reference(r) => r.display_with_world(world), + _ => self.display_value_with_world(world), + } + } + + fn display_value_with_world(&self, world: WorldGuard) -> String { + match self { + ScriptValue::Reference(r) => r.display_value_with_world(world), + ScriptValue::Unit => "()".to_owned(), + ScriptValue::Bool(b) => b.to_string(), + ScriptValue::Integer(i) => i.to_string(), + ScriptValue::Float(f) => f.to_string(), + ScriptValue::String(cow) => cow.to_string(), + ScriptValue::World => "World".to_owned(), + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index fb23218f13..d1c748f0a1 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -29,15 +29,11 @@ use bevy::{ }; use itertools::Either; use crate::{ - bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, - prelude::{ReflectAllocator, ScriptError, ScriptResult}, - reflection_extensions::PartialReflectExt, - with_access_read, - with_access_write, + bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, error::{ReflectReferenceError, ValueConversionError}, prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::PartialReflectExt, with_access_read, with_access_write }; use super::{ access_map::{AccessMapKey, ReflectAccessId}, - WorldAccessGuard, + WorldAccessGuard, WorldCallbackAccess, WorldGuard, }; /// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path @@ -71,7 +67,7 @@ impl ReflectReference { } /// If this is a reference to something with a length accessible via reflection, returns that length. - pub fn len(&self, world: &WorldAccessGuard) -> ScriptResult> { + pub fn len(&self, world: WorldGuard) -> ScriptResult> { self .with_reflect(world, |r| { match r.reflect_ref() { @@ -88,6 +84,16 @@ impl ReflectReference { }) } + pub fn new_world() -> Self { + Self { + base: ReflectBaseType { + type_id: TypeId::of::(), + base_id: ReflectBase::World, + }, + reflect_path: Vec::default(), + } + } + pub fn new_allocated( value: T, allocator: &mut ReflectAllocator, @@ -118,7 +124,7 @@ impl ReflectReference { } } - pub fn new_resource_ref(world: &WorldAccessGuard) -> Option { + pub fn new_resource_ref(world: WorldGuard) -> Option { let reflect_id = ReflectAccessId::for_resource::(&world.as_unsafe_world_cell())?; Some(Self { base: ReflectBaseType { @@ -131,7 +137,7 @@ impl ReflectReference { pub fn new_component_ref( entity: Entity, - world: &WorldAccessGuard, + world: WorldGuard, ) -> Option { let reflect_id = ReflectAccessId::for_component::(&world.as_unsafe_world_cell())?; Some(Self { @@ -146,9 +152,31 @@ impl ReflectReference { /// Indexes into the reflect path inside this reference. /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. pub fn index_path>(&mut self, index: T) { + debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to index into a world reference. This will always fail"); self.reflect_path.push(index.into()); } + + /// Tries to downcast to the specified type and cloning the value if successful. + pub fn downcast(&self, world: WorldGuard) -> ScriptResult { + self.with_reflect(world, |r| { + r.try_downcast_ref::().cloned() + }).transpose().ok_or_else(|| ScriptError::new_reflection_error(ValueConversionError::TypeMismatch { + expected_type: std::any::type_name::().into(), + actual_type: None, + }))? + } + + /// Reflects into the value of the reference, cloning it using [`PartialReflect::clone_value`] or if it's a world reference, cloning the world access. + pub fn clone_value(&self, world: WorldGuard) -> ScriptResult> { + if matches!(self.base.base_id, ReflectBase::World) { + return Ok(Box::new(WorldCallbackAccess::from_guard(world))); + } + self.with_reflect(world, |r| { + r.clone_value() + }) + } + /// The way to access the value of the reference, that is the pointed-to value. /// This method is safe to use as it ensures no-one else has aliasing access to the value at the same time. /// @@ -156,12 +184,14 @@ impl ReflectReference { /// - if the value is aliased and the access is not allowed pub fn with_reflect O>( &self, - world: &WorldAccessGuard, + world: WorldGuard, f: F, ) -> ScriptResult { - let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ScriptError::new_reflection_error(""))?; + debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to access a world reference directly. This will always fail"); + + let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ReflectReferenceError::InvalidBaseReference { reason: format!("For Reference: {}. Component or allocation id is invalid.", self.display_with_world(world.clone())).into() })?; with_access_read!(world.0.accesses, access_id ,"could not access reflect reference",{ - unsafe { self.reflect_unsafe(world) } + unsafe { self.reflect_unsafe(world.clone()) } .map(f) }) } @@ -174,36 +204,41 @@ impl ReflectReference { /// - if the value is aliased and the access is not allowed pub fn with_reflect_mut O>( &self, - world: &WorldAccessGuard, + world: WorldGuard, f: F, ) -> ScriptResult { - let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ScriptError::new_reflection_error(""))?; + debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to access a world reference directly. This will always fail"); + + let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ReflectReferenceError::InvalidBaseReference { reason: format!("For Reference: {}. Component or allocation id is invalid.", self.display_with_world(world.clone())).into() })?; with_access_write!(world.0.accesses, access_id, "Could not access reflect reference mutably", { - unsafe { self.reflect_mut_unsafe(world) } + unsafe { self.reflect_mut_unsafe(world.clone()) } .map(f) }) } - pub fn tail_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + pub fn tail_type_id(&self, world: WorldGuard) -> ScriptResult> { + if self.reflect_path.is_empty() { + return Ok(Some(self.base.type_id)); + } self.with_reflect(world, |r| { r.get_represented_type_info().map(|t| t.type_id()) }) } - pub fn element_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + pub fn element_type_id(&self, world: WorldGuard) -> ScriptResult> { self.with_reflect(world, |r| { r.element_type_id() }) } - pub fn key_type_id(&self, world: &WorldAccessGuard) -> ScriptResult> { + pub fn key_type_id(&self, world: WorldGuard) -> ScriptResult> { self.with_reflect(world, |r| { r.key_type_id() }) } - pub fn type_id_of(&self, source: TypeIdSource, world: &WorldAccessGuard) -> ScriptResult> { + pub fn type_id_of(&self, source: TypeIdSource, world: WorldGuard) -> ScriptResult> { match source { TypeIdSource::Tail => self.tail_type_id(world), TypeIdSource::Element => self.element_type_id(world), @@ -211,7 +246,7 @@ impl ReflectReference { } } - pub fn map_type_data(type_id: Option, world: &WorldAccessGuard, map: F) -> ScriptResult + pub fn map_type_data(type_id: Option, world: WorldGuard, map: F) -> ScriptResult where F: FnOnce(Option>) -> O, D: TypeData + Clone, @@ -241,14 +276,22 @@ impl ReflectReference { /// /// # Safety /// - The caller must ensure this reference has permission to access the underlying value - pub unsafe fn into_arg_value<'w>(self, world: &'w WorldAccessGuard, arg_info: &ArgInfo) -> ScriptResult> { - // arg values need to always return a reference to a concrete type `T`, so we need a FromReflect bound - // to ensure we can convert the `dyn PartialReflect` into a concrete type - + pub unsafe fn into_arg_value<'w>(self, world: WorldGuard<'w>, arg_info: &ArgInfo) -> ScriptResult> { + println!("A {}", Arc::strong_count(&world)); + println!("{:?}", self); + if ReflectBase::World == self.base.base_id { + // Safety: we already have an Arc> so creating a new one from the existing one is safe + // as the caller of this function will make sure the Arc is dropped after the lifetime 'w is done. + let new_guard = WorldCallbackAccess::from_guard(world.clone()); + println!("B {}", Arc::strong_count(&world)); + new_guard.read().unwrap(); + return Ok(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard(world)))); + } + match arg_info.ownership() { bevy::reflect::func::args::Ownership::Ref => { - let mut ref_ = unsafe {self.reflect_unsafe(world)?}; + let mut ref_ = unsafe {self.reflect_unsafe(world.clone())?}; if ref_.is_dynamic() { let allocator = world.allocator(); @@ -267,7 +310,7 @@ impl ReflectReference { }, bevy::reflect::func::args::Ownership::Mut => { - let mut mut_ = unsafe {self.reflect_mut_unsafe(world)?}; + let mut mut_ = unsafe {self.reflect_mut_unsafe(world.clone())?}; if mut_.is_dynamic() { let allocator = world.allocator(); @@ -284,7 +327,7 @@ impl ReflectReference { } _ => { - let ref_ = unsafe {self.reflect_unsafe(world)?}; + let ref_ = unsafe {self.reflect_unsafe(world.clone())?}; Ok(ArgValue::Owned(::from_reflect(ref_, world)?.into_partial_reflect())) } } @@ -302,7 +345,7 @@ impl ReflectReference { /// To do this safely you need to use [`WorldAccessGuard::claim_read_access`] or [`WorldAccessGuard::claim_global_access`] to ensure nobody else is currently accessing the value. pub unsafe fn reflect_unsafe<'w>( &self, - world: &WorldAccessGuard<'w> + world: WorldGuard<'w> ) -> ScriptResult<&'w dyn PartialReflect> { if let ReflectBase::Owned(id) = &self.base.base_id { @@ -316,7 +359,7 @@ impl ReflectReference { // safety: caller promises it's fine :) return self.walk_path(unsafe { &*arc.get_ptr() }); - }; + } let type_registry = world.type_registry(); @@ -328,7 +371,7 @@ impl ReflectReference { type_registry .get_type_data(self.base.type_id) .ok_or_else(|| ScriptError::new_reflection_error( - format!("FromPtr is not registered for {}", self.display_with_world(world))) + format!("FromPtr is not registered for {}", self.display_with_world(world.clone()))) )?; let ptr = self @@ -368,7 +411,7 @@ impl ReflectReference { /// To do this safely you need to use [`WorldAccessGuard::claim_write_access`] or [`WorldAccessGuard::claim_global_access`] to ensure nobody else is currently accessing the value. pub unsafe fn reflect_mut_unsafe<'w>( &self, - world: &WorldAccessGuard<'w> + world: WorldGuard<'w> ) -> ScriptResult<&'w mut dyn PartialReflect> { if let ReflectBase::Owned(id) = &self.base.base_id { let allocator = world.allocator(); @@ -390,7 +433,7 @@ impl ReflectReference { .get_type_data(self.base.type_id) .ok_or_else(|| ScriptError::new_reflection_error( - format!("Base reference is invalid, is the component/resource initialized? When accessing: `{}`", self.base.display_with_world(world))))?; + format!("Base reference is invalid, is the component/resource initialized? When accessing: `{}`", self.base.display_with_world(world.clone()))))?; let ptr = self .base @@ -440,18 +483,19 @@ impl ReflectReference { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd)] pub struct ReflectBaseType { pub type_id: TypeId, pub base_id: ReflectBase, } /// The Id of the kind of reflection base being pointed to -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd)] pub enum ReflectBase { Component(Entity, ComponentId), Resource(ComponentId), Owned(ReflectAllocationId), + World } impl ReflectBase { diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs new file mode 100644 index 0000000000..616d184960 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -0,0 +1,1356 @@ +use std::{ + any::{type_name, TypeId}, + borrow::Cow, + ffi::{CStr, CString, OsStr, OsString}, + path::{Path, PathBuf}, +}; + +use bevy::reflect::{ + Access, DynamicEnum, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, PartialReflect, +}; + +use crate::{ + error::{ScriptError, ScriptResult, ValueConversionError}, + reflection_extensions::{PartialReflectExt, TypeInfoExtensions}, +}; + +use super::{ + pretty_print::DisplayWithWorld, ReflectReference, ReflectionPathElem, WorldAccessGuard, + WorldGuard, +}; + +/// An abstraction of values that can be passed to and from scripts. +/// This allows us to re-use logic between scripting languages. +#[derive(Debug, Clone, PartialEq)] +pub enum ScriptValue { + Unit, + Bool(bool), + Integer(i64), + Float(f64), + String(Cow<'static, str>), + Reference(ReflectReference), + World, +} + +impl TryFrom for ReflectionPathElem { + type Error = ScriptError; + fn try_from(value: ScriptValue) -> Result { + Ok(match value { + ScriptValue::Integer(i) => { + ReflectionPathElem::Reflection(ParsedPath::from(vec![OffsetAccess { + access: bevy::reflect::Access::ListIndex(i as usize), + offset: Some(1), + }])) + } + ScriptValue::Float(v) => { + return Err(ValueConversionError::InvalidIndex { + index: v.to_string().into(), + base: None, + reason: Some("floating point numbers cannot be used as indices".into()), + })? + } + ScriptValue::String(cow) => { + if let Some(tuple_struct_index) = cow.strip_prefix("_") { + if let Ok(index) = tuple_struct_index.parse::() { + let parsed_path = ParsedPath::from(vec![OffsetAccess { + access: bevy::reflect::Access::TupleIndex(index), + offset: Some(1), + }]); + return Ok(ReflectionPathElem::Reflection(parsed_path)); + } + } + + let path = match cow { + Cow::Borrowed(v) => ParsedPath::parse_static(v).map_err(|e| { + ValueConversionError::InvalidIndex { + index: v.into(), + base: None, + reason: Some(e.to_string().into()), + } + })?, + Cow::Owned(o) => { + ParsedPath::parse(&o).map_err(|e| ValueConversionError::InvalidIndex { + index: o.clone().into(), + base: None, + reason: Some(e.to_string().into()), + })? + } + }; + + ReflectionPathElem::new_reflection(path) + } + ScriptValue::Reference(reflect_reference) => { + return Err(ValueConversionError::InvalidIndex { + index: format!("{:?}", reflect_reference).into(), + base: None, + reason: Some("References cannot be used as indices".into()), + })? + } + _ => ReflectionPathElem::Identity, + }) + } +} + +/// A trait for converting a value into a [`ScriptVal`]. +pub trait IntoScriptValue { + fn into_script_value(self, guard: WorldGuard) -> ScriptResult; +} + +/// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. +pub trait FromScriptValue { + fn from_script_value( + value: ScriptValue, + guard: WorldGuard, + target_type: TypeId, + ) -> ScriptResult>; +} + +impl IntoScriptValue for ReflectReference { + /// For ReflectReferences we do a bit more logic here. + /// + /// We don't want to output references when they are pointing to primitives for example. + /// + /// There are a few rules: + /// - If we are pointing to a type that is better represented as another variant other than [`ScriptValue::Reference`], we will convert it to that variant. + /// - If we are pointing to a type that is better represented as a [`ScriptValue::Reference`], we will keep it as is. + fn into_script_value(self, world: WorldGuard) -> ScriptResult { + self.clone().with_reflect(world.clone(), move |r| { + // for primitives we want to convert to the primitive type + // we do not need to retain the reference + if let Some(prim) = r.as_primitive(world.clone()) { + return Ok(prim); + } + + // for options we want to convert to + // - the inner type if it's some + // - nil if it's none + // to retain the reference we need to return a reference pointing into the inner type + if let Ok(inner) = r.as_option() { + if inner.is_some() { + let mut inner_ref = self; + inner_ref.index_path(ParsedPath::parse_static(".0").expect("invariant")); + // hint for the from impl that we want to trim the reference + inner_ref.index_path(ReflectionPathElem::Identity); + // cascade the conversion + return inner_ref.into_script_value(world); + } else { + return Ok(ScriptValue::Unit); + } + } + + // as a last resort we just retain the original reference with no conversion + Ok(ScriptValue::Reference(self)) + })? + } +} + +impl FromScriptValue for ScriptValue { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + // is the target type an option? + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + let type_info = type_registry.get_type_info(target_type).ok_or({ + ValueConversionError::MissingTypeInformation { + type_id: target_type, + } + })?; + + // for primitives + if let Some(value) = + ::from_primitive(value.clone(), world.clone(), target_type) + { + return value; + } + + if type_info.is_option() { + // in this case we can expect a few things + // - the value we're pointing to will: + // - either point to 'inside' the option + // - or to the whole option + // - the Value might be either a Unit or a Reference + let inner_type_id = type_info.option_inner_type().expect("invariant"); + + match value { + ScriptValue::Unit => { + // if the value is a unit it's easy, we just construct a dynamic none variant + let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); + dynamic_none.set_represented_type(Some(type_info)); + return Ok(Box::new(dynamic_none)); + } + ScriptValue::Reference(mut reference) => { + // if the value is a reference we need to check if it's pointing to the inner value + // that will only be the case if the reference was created using into_script_value + // meaning it will end with a ".0" followed by Identity index. + + if reference.reflect_path.last() == Some(&ReflectionPathElem::Identity) + && reference.reflect_path.len() > 2 + { + let _ = reference + .reflect_path + .drain(reference.reflect_path.len() - 2..); + } + + // construct dynamic variant + let out = reference.clone_value(world)?; + // out.set_represented_type(Some(type_info)); + return Ok(out); + } + value => { + let inner = + ScriptValue::from_script_value(value, world.clone(), inner_type_id)?; + + let mut dynamic_some = DynamicEnum::new( + "Some", + DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), + ); + dynamic_some.set_represented_type(Some(type_info)); + return Ok(Box::new(dynamic_some)); + } + }; + } + + // if not primitive or option, we expect a reference + if let ScriptValue::Reference(reflect_reference) = value { + reflect_reference.clone_value(world) + } else { + return Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + })?; + } + } +} + +impl IntoScriptValue for () { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Unit) + } +} + +impl IntoScriptValue for &'static str { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.into())) + } +} + +impl IntoScriptValue for &'static CStr { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.to_string_lossy())) + } +} + +impl IntoScriptValue for &'static OsStr { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.to_string_lossy())) + } +} + +impl IntoScriptValue for &'static Path { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.to_string_lossy())) + } +} + +impl IntoScriptValue for Cow<'static, str> { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.into_owned().into())) + } +} + +impl IntoScriptValue for Cow<'static, CStr> { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl IntoScriptValue for bool { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Bool(self)) + } +} + +impl IntoScriptValue for f32 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Float(self as f64)) + } +} + +impl IntoScriptValue for f64 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Float(self)) + } +} + +impl IntoScriptValue for i8 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for i16 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for i32 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for i64 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self)) + } +} + +impl IntoScriptValue for i128 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for isize { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for u8 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for u16 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for u32 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for u64 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for u128 { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for usize { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } +} + +impl IntoScriptValue for Box { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.to_string().into())) + } +} + +impl IntoScriptValue for CString { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl IntoScriptValue for String { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String(self.into())) + } +} + +impl IntoScriptValue for OsString { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl IntoScriptValue for PathBuf { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl FromScriptValue for () { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::<()>() { + match value { + ScriptValue::Unit => Ok(Box::new(())), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::<()>(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::<()>())), + } + .into()) + } + } +} + +impl FromScriptValue for bool { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::() { + match value { + ScriptValue::Bool(v) => Ok(Box::new(v)), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::())), + } + .into()) + } + } +} + +impl FromScriptValue for &'static str { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::<&'static str>() { + match value { + ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(s)), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::<&'static str>(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::<&'static str>())), + } + .into()) + } + } +} + +impl FromScriptValue for Cow<'static, str> { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::>() { + match value { + ScriptValue::String(s) => Ok(Box::new(s)), + ScriptValue::Reference(ref_) => { + Ok(Box::new(ref_.downcast::>(world)?)) + } + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::>())), + } + .into()) + } + } +} + +impl FromScriptValue for String { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::() { + match value { + ScriptValue::String(s) => Ok(Box::new(s.into_owned())), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::())), + } + .into()) + } + } +} + +impl FromScriptValue for f32 { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::() { + match value { + ScriptValue::Float(v) => Ok(Box::new(v as f32)), + ScriptValue::Integer(v) => Ok(Box::new(v as f32)), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::())), + } + .into()) + } + } +} + +impl FromScriptValue for f64 { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::() { + match value { + ScriptValue::Float(v) => Ok(Box::new(v)), + ScriptValue::Integer(v) => Ok(Box::new(v as f64)), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::())), + } + .into()) + } + } +} + +// Macro to implement FromScriptValue for integer types +macro_rules! impl_from_script_value_integer { + ($($t:ty),*) => { + $( + impl FromScriptValue for $t { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::<$t>() { + match value { + ScriptValue::Integer(v) => Ok(Box::new(v as $t)), + ScriptValue::Float(v) => Ok(Box::new(v as $t)), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::<$t>(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::<$t>())), + } + .into()) + } + } + } + )* + }; +} + +impl_from_script_value_integer!(i8, i16, i32, i64, i128, isize); +impl_from_script_value_integer!(u8, u16, u32, u64, u128, usize); + +impl FromScriptValue for &'static Path { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::<&'static Path>() { + match value { + ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(Path::new(s))), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::<&'static Path>())), + } + .into()) + } + } +} + +impl FromScriptValue for PathBuf { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::() { + match value { + ScriptValue::String(s) => Ok(Box::new(PathBuf::from(s.into_owned()))), + ScriptValue::Reference(ref_) => { + Ok(Box::new(ref_.downcast::<&'static Path>(world)?)) + } + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::())), + } + .into()) + } + } +} + +// Implementations for additional types + +// impl FromScriptValue for Box { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::>() { +// match value { +// ScriptValue::String(s) => Ok(Box::new(s.into_owned().into_boxed_str())), +// _ => Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::>())), +// } +// .into()) +// } +// } +// } + +// impl FromScriptValue for CString { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::() { +// match value { +// ScriptValue::String(s) => CString::new(s.into_owned()) +// .map(|cstr| Box::new(cstr) as Box) +// .map_err(|e| { +// ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(e.to_string())), +// } +// .into() +// }), +// _ => Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::())), +// } +// .into()) +// } +// } +// } + +impl FromScriptValue for OsString { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> ScriptResult> { + if target_type == TypeId::of::() { + match value { + ScriptValue::String(s) => Ok(Box::new(OsString::from(s.into_owned()))), + ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + _ => Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world.clone())), + actual_type: Some(Cow::Owned(value.display_with_world(world))), + } + .into()), + } + } else { + Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(target_type.display_with_world(world)), + actual_type: Some(Cow::Borrowed(type_name::())), + } + .into()) + } + } +} + +// impl FromScriptValue for &'static OsStr { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::<&'static OsStr>() { +// match value { +// ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(OsStr::new(s))), +// _ => Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::<&'static OsStr>())), +// } +// .into()) +// } +// } +// } + +// impl FromScriptValue for &'static CStr { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::<&'static CStr>() { +// match value { +// ScriptValue::String(Cow::Borrowed(s)) => { +// let bytes = s.as_bytes(); +// CStr::from_bytes_with_nul(bytes) +// .map(|cstr| Box::new(cstr) as Box) +// .map_err(|e| { +// ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(e.to_string())), +// } +// .into() +// }) +// } +// _ => Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(ValueConversionError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::<&'static CStr>())), +// } +// .into()) +// } +// } +// } + +#[cfg(test)] +mod test { + use std::any::Any; + + use bevy::{ + prelude::{AppTypeRegistry, World}, + utils::HashMap, + }; + + use crate::prelude::AppReflectAllocator; + + use super::*; + + #[test] + fn test_basic_into_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + let guard = WorldGuard::new(guard); + assert_eq!( + ().into_script_value(guard.clone()).unwrap(), + ScriptValue::Unit + ); + assert_eq!( + true.into_script_value(guard.clone()).unwrap(), + ScriptValue::Bool(true) + ); + assert_eq!( + false.into_script_value(guard.clone()).unwrap(), + ScriptValue::Bool(false) + ); + assert_eq!( + 0i64.into_script_value(guard.clone()).unwrap(), + ScriptValue::Integer(0) + ); + assert_eq!( + 0.0f64.into_script_value(guard.clone()).unwrap(), + ScriptValue::Float(0.0) + ); + assert_eq!( + "".into_script_value(guard.clone()).unwrap(), + ScriptValue::String("".into()) + ); + assert_eq!( + "hello".into_script_value(guard.clone()).unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + CString::new("hello") + .unwrap() + .into_script_value(guard.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + OsStr::new("hello") + .into_script_value(guard.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + Path::new("hello").into_script_value(guard.clone()).unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + Cow::Borrowed("hello") + .into_script_value(guard.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + Cow::::Owned("hello".to_string()) + .into_script_value(guard) + .unwrap(), + ScriptValue::String("hello".into()) + ); + } + + #[test] + fn test_reference_into_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let world = WorldAccessGuard::new(&mut world); + + let allocator = world.allocator(); + let mut allocator = allocator.write(); + let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); + let string_reference = ReflectReference::new_allocated("hello", &mut allocator); + let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); + let none_reference = ReflectReference::new_allocated(None::, &mut allocator); + let nested_option_reference = + ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); + let nested_none_reference = + ReflectReference::new_allocated(Some(None::), &mut allocator); + + let vec_reference = ReflectReference::new_allocated(vec![1, 2, 3], &mut allocator); + let map_reference = ReflectReference::new_allocated( + HashMap::from_iter(vec![(1, 2), (3, 4)]), + &mut allocator, + ); + + drop(allocator); + + let world = WorldGuard::new(world); + + assert_eq!( + usize_reference.clone().into_script_value(world.clone()), + Ok(ScriptValue::Integer(2)) + ); + + assert_eq!( + string_reference.clone().into_script_value(world.clone()), + Ok(ScriptValue::String("hello".into())) + ); + + assert_eq!( + option_reference.clone().into_script_value(world.clone()), + Ok(ScriptValue::Integer(2)) + ); + + assert_eq!( + none_reference.clone().into_script_value(world.clone()), + Ok(ScriptValue::Unit) + ); + + assert_eq!( + nested_option_reference + .clone() + .into_script_value(world.clone()), + Ok(ScriptValue::Integer(2)) + ); + + assert_eq!( + nested_none_reference + .clone() + .into_script_value(world.clone()), + Ok(ScriptValue::Unit) + ); + + assert_eq!( + vec_reference.clone().into_script_value(world.clone()), + Ok(ScriptValue::Reference(vec_reference)) + ); + + assert_eq!( + map_reference.clone().into_script_value(world.clone()), + Ok(ScriptValue::Reference(map_reference)) + ); + } + + #[test] + fn test_basic_from_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + let guard = WorldGuard::new(guard); + + assert!( + <()>::from_script_value(ScriptValue::Unit, guard.clone(), TypeId::of::<()>()) + .unwrap() + .reflect_partial_eq(&()) + .unwrap() + ); + + assert!(::from_script_value( + ScriptValue::Bool(true), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&true) + .unwrap()); + + assert!(<&'static str>::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::<&'static str>() + ) + .unwrap() + .reflect_partial_eq(&"hello") + .unwrap()); + + assert!(>::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .reflect_partial_eq(&Cow::Borrowed("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&"hello".to_string()) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Float(0.0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0.0f32) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Float(0.0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0.0f64) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0i64) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0i8) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0i16) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0i32) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0i128) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0isize) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0u8) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0u16) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0u32) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0u64) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0u128) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&0usize) + .unwrap()); + + assert!(<&'static Path>::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::<&'static Path>() + ) + .unwrap() + .reflect_partial_eq(&Path::new("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&PathBuf::from("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&OsString::from("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&OsString::from("hello")) + .unwrap()); + } + + #[test] + fn test_script_value_reference_from_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + + let allocator = guard.allocator(); + let mut allocator = allocator.write(); + let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); + let string_reference = ReflectReference::new_allocated("hello", &mut allocator); + let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); + let none_reference = ReflectReference::new_allocated(None::, &mut allocator); + let nested_option_reference = + ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); + let nested_none_reference = + ReflectReference::new_allocated(Some(None::), &mut allocator); + + let vec_option_reference = + ReflectReference::new_allocated(vec![Some(1usize), None, Some(3usize)], &mut allocator); + + let type_registry = guard.type_registry(); + let mut type_registry = type_registry.write(); + + type_registry.register::<&'static str>(); + type_registry.register::>(); + type_registry.register::>>(); + type_registry.register::>>(); + + drop(type_registry); + drop(allocator); + let guard = WorldGuard::new(guard); + + assert!(::from_script_value( + ScriptValue::Reference(usize_reference.clone()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .reflect_partial_eq(&2usize) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(string_reference.clone()), + guard.clone(), + TypeId::of::<&'static str>() + ) + .unwrap() + .reflect_partial_eq(&"hello") + .unwrap()); + + println!( + "{:?}", + ::from_script_value( + ScriptValue::Reference(option_reference.clone()), + guard.clone(), + TypeId::of::>() + ) + ); + assert!(::from_script_value( + ScriptValue::Reference(option_reference.clone()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .reflect_partial_eq(&Some(2usize)) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(none_reference.clone()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .reflect_partial_eq(&None::) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(nested_option_reference.clone()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .reflect_partial_eq(&Some(Some(2usize))) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(nested_none_reference.clone()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .reflect_partial_eq(&Some(None::)) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(vec_option_reference.clone()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .reflect_partial_eq(&vec![Some(1usize), None, Some(3usize)]) + .unwrap()); + } + + #[test] + pub fn test_script_value_other_from_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + + let type_registry = guard.type_registry(); + let mut type_registry = type_registry.write(); + type_registry.register::>(); + type_registry.register::>>(); + + drop(type_registry); + let guard = WorldGuard::new(guard); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .reflect_partial_eq(&Some("hello".to_string())) + .unwrap()); + + println!( + "{:?}", + ::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>() + ) + ); + assert!(::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .reflect_partial_eq(&None::) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .reflect_partial_eq(&None::) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .reflect_partial_eq(&Some(Some("hello".to_string()))) + .unwrap()); + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index b172ba04f9..a237f28e6e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -28,7 +28,10 @@ use bevy::{ world::{unsafe_world_cell::UnsafeWorldCell, CommandQueue, Mut, World}, }, hierarchy::{BuildChildren, Children, DespawnRecursiveExt, Parent}, - reflect::{std_traits::ReflectDefault, Reflect, TypeRegistry, TypeRegistryArc}, + reflect::{ + func::args::FromArg, std_traits::ReflectDefault, PartialReflect, Reflect, TypePath, + TypeRegistry, TypeRegistryArc, + }, utils::HashMap, }; @@ -42,7 +45,7 @@ use crate::{ }; use super::{ - access_map::{AccessCount, AccessMap, AccessMapKey, ReflectAccessId}, + access_map::{AccessCount, AccessMap, ReflectAccessId}, // proxy::{Proxy, Unproxy}, AppReflectAllocator, ReflectBase, @@ -51,11 +54,16 @@ use super::{ ScriptTypeRegistration, }; +/// Prefer to directly using [`WorldAccessGuard`]. If the underlying type changes, this alias will be updated. +pub type WorldGuard<'w> = Arc>; +/// Similar to [`WorldGuard`], but without the arc, use for when you don't need the outer Arc. +pub type WorldGuardRef<'w> = &'w WorldAccessGuard<'w>; + /// While [`WorldAccessGuard`] prevents aliasing at runtime and also makes sure world exists at least as long as the guard itself, /// borrows sadly do not persist the script-host boundary :(. That is to be expected, but instead we can make an abstraction which removes the lifetime parameter, making the outer type 'static, /// while making sure the lifetime is still satisfied! -#[derive(Clone, Debug)] -pub struct WorldCallbackAccess(Weak>); +#[derive(Clone, Debug, Reflect)] +pub struct WorldCallbackAccess(#[reflect(ignore)] pub(crate) Weak>); impl WorldCallbackAccess { /// Wraps a callback which requires access to the world in a 'static way via [`WorldCallbackAccess`]. @@ -73,6 +81,8 @@ impl WorldCallbackAccess { /// Creates a new [`WorldCallbackAccess`] with an erased lifetime. /// + /// For safe alternative see [`Self::from_guard`] + /// /// # Safety /// - The caller must ensure the [`WorldAccessGuard`] will not outlive the 'w lifetime /// - In practice this means that between the moment the original Arc is dropped, the lifetime 'w must be valid @@ -89,8 +99,13 @@ impl WorldCallbackAccess { Self(world) } + pub fn from_guard(world: WorldGuard<'_>) -> Self { + // Safety: the caller ensures `WorldAccessGuard` does not outlive the original lifetime 'w + unsafe { Self::new(Arc::downgrade(&world)) } + } + /// Attempts to read the world access guard, if it still exists - pub fn read(&self) -> Option>> { + pub fn read(&self) -> Option> { self.0.upgrade() } } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index f72391c1b9..3263a41009 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -1,4 +1,6 @@ use std::{ + any::TypeId, + borrow::Cow, ops::{Deref, DerefMut}, sync::Arc, }; @@ -49,7 +51,7 @@ impl From for Box { } } /// An error with an optional script Context -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct ScriptError(pub Arc); impl Deref for ScriptError { @@ -69,6 +71,14 @@ pub struct ScriptErrorInner { pub reason: Arc, } +impl PartialEq for ScriptErrorInner { + fn eq(&self, other: &Self) -> bool { + self.kind == other.kind + && self.context == other.context + && self.reason.to_string() == other.reason.to_string() + } +} + impl ScriptError { pub fn new_reflection_error>>( reason: E, @@ -118,6 +128,15 @@ impl ScriptError { reason: self.0.reason.clone(), })) } + + pub fn with_appended_context(self, context: S) -> Self { + Self(Arc::new(ScriptErrorInner { + script: self.0.script.clone(), + kind: self.0.kind, + context: format!("{}. {}", self.0.context, context.to_string()), + reason: self.0.reason.clone(), + })) + } } impl From for ScriptError { @@ -146,3 +165,35 @@ impl From for mlua::Error { mlua::Error::external(value) } } + +#[derive(thiserror::Error, Debug)] +pub enum ValueConversionError { + #[error("Expected type: {expected_type}, got: {actual_type:?}")] + TypeMismatch { + expected_type: Cow<'static, str>, + actual_type: Option>, + }, + #[error("Could not index script value {base:?} using index {index}. Reason: {reason:?}")] + InvalidIndex { + index: Cow<'static, str>, + base: Option>, + reason: Option>, + }, + #[error("Type was not registed with the type registry: {type_id:?}. Could not convert.")] + MissingTypeInformation { type_id: TypeId }, +} + +#[derive(thiserror::Error, Debug)] +pub enum FunctionError { + #[error("Function {function_name:?} not found in type registry for type {type_:?}")] + FunctionNotFound { + function_name: Cow<'static, str>, + type_: Option>, + }, +} + +#[derive(thiserror::Error, Debug)] +pub enum ReflectReferenceError { + #[error("Reference could not be reflected, due to missing component, entity or resource. {reason:?}")] + InvalidBaseReference { reason: Cow<'static, str> }, +} diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index c862a81270..0461455f75 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -3,7 +3,7 @@ use crate::event::ScriptErrorEvent; use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; -use bindings::{AppReflectAllocator, ReflectAllocator}; +use bindings::{AppReflectAllocator, ReflectAllocator, WorldCallbackAccess}; use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, ContextPreHandlingInitializer, ScriptContexts, @@ -91,9 +91,16 @@ impl Plugin for ScriptingPlugin { }) .add_systems(PostUpdate, (garbage_collector, sync_script_data::)) .add_systems(PostStartup, initialize_runtime::); + + register_types(app); } } +/// Register all types that need to be accessed via reflection +fn register_types(app: &mut App) { + app.register_type::(); +} + pub trait AddRuntimeInitializer { fn add_runtime_initializer(&mut self, initializer: RuntimeInitializer) -> &mut Self; } diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 315f954d95..130ebe06ad 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -1,12 +1,20 @@ -use std::{any::{Any, TypeId}, cmp::max}; +use std::{any::{Any, TypeId}, borrow::Cow, cmp::max, ffi::{CStr, CString, OsStr, OsString}, os::unix::ffi::OsStrExt, path::{Path, PathBuf}, str::FromStr}; -use bevy::reflect::{FromType, List, PartialReflect, Reflect, ReflectFromReflect, TypeData}; +use bevy::reflect::{FromType, List, PartialReflect, Reflect, ReflectFromReflect, TypeData, TypeInfo}; use itertools::Itertools; -use crate::{bindings::{pretty_print::DisplayWithWorld, WorldAccessGuard}, error::{ScriptError, ScriptResult}}; - +use crate::{bindings::{pretty_print::DisplayWithWorld, script_val::{IntoScriptValue, ScriptValue}, ReflectReference, WorldAccessGuard, WorldGuard}, error::{ScriptError, ScriptResult}}; +use crate::bindings::script_val::FromScriptValue; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { + fn allocate(boxed: Box, world: WorldGuard) -> ReflectReference; + + fn from_primitive(value: ScriptValue, _: WorldGuard, target_type_id: TypeId) -> Option>>; + + /// If the type is a primitive type, returns the value as a [`ScriptValue`]. + /// Primitive types are all simple types that are not the [`ScriptValue::Reference`] variant. + fn as_primitive(&self, guard: WorldGuard) -> Option; + /// Check if the represented type is from the given crate and has the given type identifier, /// returns false if not representing any type or if the type is not from the given crate or does not have the given type identifier. fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool; @@ -65,7 +73,7 @@ pub trait PartialReflectExt { fn key_type_id(&self) -> Option; /// Tries to construct the concrete underlying type from a possibly untyped reference - fn from_reflect(reflect: &dyn PartialReflect, world: &WorldAccessGuard) -> ScriptResult>; + fn from_reflect(reflect: &dyn PartialReflect, world: WorldGuard) -> ScriptResult>; } pub trait TypeIdExtensions { fn type_id_or_fake_id(&self) -> TypeId; @@ -104,6 +112,77 @@ impl PartialReflectExt for T { Ok(()) } + fn from_primitive(value: ScriptValue, world: WorldGuard, target_type_id: TypeId) -> Option>> { + Some(match target_type_id{ + // TODO: if these types ever support reflect, we can uncomment these lines + // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script + // we should instead allocate and leak perhaps. then garbage collect later + t if t == TypeId::of::<()>() => <()>::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => bool::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => <&str>::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => <&Path>::from_script_value(value, world, target_type_id), + t if t == TypeId::of::>() => >::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::>() => >::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => f32::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => f64::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => i8::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => i16::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => i32::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => i64::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => i128::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => isize::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => u8::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => u16::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => u32::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => u64::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => u128::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => usize::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::>() => >::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), + _ => return None, + }) + } + + fn as_primitive(&self, guard: WorldGuard) -> Option { + let type_id = self.get_represented_type_info().map(|ti| ti.type_id()).type_id_or_fake_id(); + + match type_id { + _ if TypeId::of::<()>() == type_id => self.as_partial_reflect().try_downcast_ref::<()>().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::<&'static str>() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static str>().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::<&'static CStr>() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static CStr>().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::<&'static OsStr>() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static OsStr>().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static Path>().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::>() == type_id => self.as_partial_reflect().try_downcast_ref::>().and_then(|v| v.clone().into_script_value(guard).ok()), + _ if TypeId::of::>() == type_id => self.as_partial_reflect().try_downcast_ref::>().and_then(|v| v.clone().into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), + _ if TypeId::of::>() == type_id => self.as_partial_reflect().try_downcast_ref::>().and_then(|v| v.to_owned().into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), + _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), + _ => None, + } + } + fn as_option(&self) -> Result, ScriptError> { if let bevy::reflect::ReflectRef::Enum(e) = self.reflect_ref() { if let Some(field) = e.field_at(0) { @@ -297,7 +376,7 @@ impl PartialReflectExt for T { Some(key) } - fn from_reflect(reflect: &dyn PartialReflect, world: &WorldAccessGuard) -> ScriptResult> { + fn from_reflect(reflect: &dyn PartialReflect, world: WorldGuard) -> ScriptResult> { let type_info = reflect.get_represented_type_info().ok_or_else(|| ScriptError::new_runtime_error("Could not construct concrete type as the reference does not contain type information."))?; let type_id = type_info.type_id(); @@ -305,20 +384,66 @@ impl PartialReflectExt for T { let type_registry = world.type_registry(); let type_registry = type_registry.read(); - let from_reflect_type_data: &ReflectFromReflect = type_registry.get_type_data(type_id).ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type id {} as it does not have a FromReflect type data registered.", type_id.display_with_world(world))))?; + let from_reflect_type_data: &ReflectFromReflect = type_registry.get_type_data(type_id).ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type id {} as it does not have a FromReflect type data registered.", type_id.display_with_world(world.clone()))))?; from_reflect_type_data.from_reflect(reflect) - .ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type: {}. From Reflect implementation failed", type_id.display_with_world(world)))) + .ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type: {}. From Reflect implementation failed", type_id.display_with_world(world.clone())))) + } + + fn allocate(boxed: Box, world: WorldGuard) -> ReflectReference { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + ReflectReference::new_allocated_boxed(boxed, &mut allocator) } } +pub trait TypeInfoExtensions { + fn is_option(&self) -> bool; + fn option_inner_type(&self) -> Option; + fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool; +} + +impl TypeInfoExtensions for TypeInfo { + fn is_option(&self) -> bool { + self.is_type(Some("core"), "Option") + } + + fn option_inner_type(&self) -> Option { + if self.is_option() { + self.generics().first().map(|g| g.type_id()) + } else { + None + } + } + + fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool { + self.type_path_table().ident() == Some(type_ident) + && self.type_path_table().crate_name() == crate_name + } + +} + + #[cfg(test)] mod test { - use bevy::reflect::{DynamicMap, Map}; + use bevy::{prelude::{AppTypeRegistry, World}, reflect::{DynamicMap, Map}}; + + use crate::prelude::AppReflectAllocator; use super::*; + #[test] + fn test_type_info_is_option() { + let type_info = Some("hello").get_represented_type_info().unwrap(); + assert!(type_info.is_option()); + } + + #[test] + fn test_type_info_is_type() { + let type_info = Some("hello").get_represented_type_info().unwrap(); + assert!(type_info.is_type(Some("core"), "Option")); + } #[test] fn test_type_no_crate() { @@ -499,4 +624,48 @@ mod test { map.try_insert_boxed(Box::new(1), value_ref).unwrap(); assert!(value.reflect_partial_eq(&map[&1]).unwrap()); } + + + #[test] + fn test_as_primitive() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let world = WorldAccessGuard::new(&mut world); + let world = WorldGuard::new(world); + + assert_eq!(true.as_primitive(world.clone()), Some(ScriptValue::Bool(true))); + assert_eq!(false.as_primitive(world.clone()), Some(ScriptValue::Bool(false))); + assert_eq!(0i64.as_primitive(world.clone()), Some(ScriptValue::Integer(0))); + assert_eq!(0.0f64.as_primitive(world.clone()), Some(ScriptValue::Float(0.0))); + assert_eq!("".as_primitive(world.clone()), Some(ScriptValue::String("".into()))); + assert_eq!("hello".as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); + // assert_eq!(CString::new("hello").unwrap().as_primtive(world.clone()), Some(ScriptValue::String("hello".into()))); + // assert_eq!(OsStr::new("hello").as_primtive(world.clone()), Some(ScriptValue::String("hello".into()))); + assert_eq!(Path::new("hello").as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); + assert_eq!(Cow::Borrowed("hello").as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); + assert_eq!(Cow::Owned::("hello".to_string()).as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); + // assert_eq!(Box::::from("hello").as_primtive(world.clone()), Some(ScriptValue::String("hello".into()))); + assert_eq!(().as_primitive(world.clone()), Some(ScriptValue::Unit)); + } + + #[test] + fn test_from_primitive() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let world = WorldAccessGuard::new(&mut world); + let world = WorldGuard::new(world); + + assert!(<()>::from_primitive(ScriptValue::Unit, world.clone(), TypeId::of::<()>()).unwrap().unwrap().reflect_partial_eq(&()).unwrap()); + assert!(bool::from_primitive(ScriptValue::Bool(true), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&true).unwrap()); + assert!(i32::from_primitive(ScriptValue::Integer(42), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42).unwrap()); + assert!(f64::from_primitive(ScriptValue::Float(42.0), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42.0).unwrap()); + assert!(String::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&"hello".to_string()).unwrap()); + assert!(OsString::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&OsString::from("hello")).unwrap()); + assert!(PathBuf::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&PathBuf::from("hello")).unwrap()); + assert!(Cow::::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::>()).unwrap().unwrap().reflect_partial_eq(&Cow::Borrowed("hello")).unwrap()); + assert!(i32::from_primitive(ScriptValue::Float(42.0), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42).unwrap()); + assert!(f32::from_primitive(ScriptValue::Float(42.0), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42).unwrap()); + } } diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml new file mode 100644 index 0000000000..38a841d46a --- /dev/null +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "bevy_mod_scripting_functions" +version = "0.8.0-alpha.2" +edition = "2021" +authors = ["Maksymilian Mozolewski "] +license = "MIT OR Apache-2.0" +description = "Necessary functionality for Lua support with bevy_mod_scripting" +repository = "https://github.com/makspll/bevy_mod_scripting" +homepage = "https://github.com/makspll/bevy_mod_scripting" +keywords = ["bevy", "gamedev", "scripting", "rhai"] +categories = ["game-development"] +readme = "readme.md" + +[features] +default = ["core_functions"] +core_functions = ["bevy_mod_scripting_core"] + + +[dependencies] +bevy = { workspace = true, default-features = false, features = [ + "reflect_functions", +] } +bevy_mod_scripting_core = { workspace = true, optional = true } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs new file mode 100644 index 0000000000..4237a8af96 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -0,0 +1,33 @@ +//! Contains functions defined by the [`bevy_mod_scripting_core`] crate +use bevy::{ + prelude::*, + reflect::func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, +}; +use bevy_mod_scripting_core::*; +use bindings::{WorldAccessGuard, WorldCallbackAccess}; + +use crate::namespaced_register::NamespaceBuilder; + +pub struct CoreFunctionsPlugin; + +impl Plugin for CoreFunctionsPlugin { + fn build(&self, app: &mut App) { + let function_registry = app + .world_mut() + .get_resource_or_init::(); + + let mut function_registry = function_registry.write(); + + // function_registry.register_with_name("spawn", || Entity::from_bits(2)); + register_world_functions(&mut function_registry) + .expect("Failed to register world functions"); + } +} + +fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { + NamespaceBuilder::::new(reg) + .register_function("spawn", |s: WorldCallbackAccess| s.spawn())? + .register_function("exit", |s: WorldCallbackAccess| s.exit())?; + + Ok(()) +} diff --git a/crates/bevy_mod_scripting_functions/src/lib.rs b/crates/bevy_mod_scripting_functions/src/lib.rs new file mode 100644 index 0000000000..b016d5c870 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/lib.rs @@ -0,0 +1,15 @@ +use bevy::prelude::*; + +#[cfg(feature = "core_functions")] +pub mod core; + +pub mod namespaced_register; + +pub struct BevyFunctionsPlugin; + +impl Plugin for BevyFunctionsPlugin { + fn build(&self, app: &mut App) { + #[cfg(feature = "core_functions")] + app.add_plugins(core::CoreFunctionsPlugin); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs new file mode 100644 index 0000000000..ccfac41f3b --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -0,0 +1,136 @@ +use std::{any::TypeId, borrow::Cow, marker::PhantomData}; + +use bevy::{ + prelude::IntoFunction, + reflect::func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, +}; + +pub trait RegisterNamespacedFunction { + fn register_namespaced_function( + &mut self, + name: N, + function: F, + ) -> Result<(), FunctionRegistrationError> + where + N: Into>, + S: IntoNamespace, + F: IntoFunction<'static, M> + 'static; +} + +pub trait GetNamespacedFunction { + fn get_namespaced_function( + &self, + name: N, + namespace: Namespace, + ) -> Option<&DynamicFunction<'static>> + where + N: Into>; + + fn has_namespaced_function(&self, name: N, namespace: Namespace) -> bool + where + N: Into>; +} + +pub enum Namespace { + /// The function is registered in the global namespace, i.e. with no namespace + Global, + /// The function is registered in the namespace corresponding to the given type + OnType(TypeId), +} + +pub trait IntoNamespace { + fn into_namespace() -> Namespace; +} + +impl IntoNamespace for T { + fn into_namespace() -> Namespace { + Namespace::OnType(TypeId::of::()) + } +} + +impl Namespace { + pub fn prefix(self) -> Cow<'static, str> { + match self { + Namespace::Global => Cow::Borrowed(""), + Namespace::OnType(type_id) => Cow::Owned(format!("{:?}::", type_id)), + } + } + + /// Returns the fully qualified name of a function in this namespace + pub fn function_name(self, name: Cow<'static, str>) -> Cow<'static, str> { + match self { + Namespace::Global => name, + Namespace::OnType(type_id) => Cow::Owned(format!("{:?}::{}", type_id, name)), + } + } +} + +impl RegisterNamespacedFunction for FunctionRegistry { + fn register_namespaced_function( + &mut self, + name: N, + function: F, + ) -> Result<(), FunctionRegistrationError> + where + N: Into>, + S: IntoNamespace, + F: IntoFunction<'static, M> + 'static, + { + let cow: Cow<'static, str> = name.into(); + let function_name = S::into_namespace().function_name(cow); + self.register_with_name(function_name, function)?; + Ok(()) + } +} + +impl GetNamespacedFunction for FunctionRegistry { + fn get_namespaced_function( + &self, + name: N, + namespace: Namespace, + ) -> Option<&DynamicFunction<'static>> + where + N: Into>, + { + let cow: Cow<'static, str> = name.into(); + let function_name = namespace.function_name(cow); + self.get(&function_name) + } + + fn has_namespaced_function(&self, name: N, namespace: Namespace) -> bool + where + N: Into>, + { + let cow: Cow<'static, str> = name.into(); + let function_name = namespace.function_name(cow); + self.contains(&function_name) + } +} + +pub struct NamespaceBuilder<'a, N> { + namespace: PhantomData, + registry: &'a mut FunctionRegistry, +} + +impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { + pub fn new(registry: &'a mut FunctionRegistry) -> Self { + Self { + namespace: Default::default(), + registry, + } + } + + pub fn register_function( + &mut self, + name: N, + function: F, + ) -> Result<&mut Self, FunctionRegistrationError> + where + N: Into>, + F: IntoFunction<'static, M> + 'static, + { + self.registry + .register_namespaced_function::(name, function)?; + Ok(self) + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 198c5af0d0..22931f6926 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -24,16 +24,16 @@ unsafe_lua_modules = [] # enable teal utilities teal = [] -lua51 = ["tealr/mlua_lua51"] -lua52 = ["tealr/mlua_lua52"] -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"] +lua51 = ["mlua/lua51"] +lua52 = ["mlua/lua52"] +lua53 = ["mlua/lua53"] +lua54 = ["mlua/lua54"] +luajit = ["mlua/luajit"] +luajit52 = ["mlua/luajit52"] +luau = ["mlua/luau"] +mlua_serialize = ["mlua/serialize"] +mlua_macros = ["mlua/macros"] +mlua_async = ["mlua/async"] [lib] name = "bevy_mod_scripting_lua" @@ -42,12 +42,11 @@ path = "src/lib.rs" [dependencies] bevy = { workspace = true, default-features = false } bevy_mod_scripting_core = { workspace = true, features = ["mlua_impls"] } -bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } -tealr = { version = "0.9", features = [ - "mlua_vendored", - "mlua_send", - "mlua_macros", +bevy_mod_scripting_functions = { workspace = true, features = [ + "core_functions", ] } +bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } +mlua = { version = "0.9", features = ["vendored", "send", "macros"] } parking_lot = "0.12.1" serde_json = "1.0.81" anyhow = "1.0.75" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs index 3e905b28f4..b4f4e7d1b7 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs @@ -1,7 +1,7 @@ // pub mod providers; // pub mod proxy; -pub mod query; +// pub mod query; pub mod reference; -pub mod std; -pub mod type_registration; +// pub mod type_registration; +pub mod script_value; pub mod world; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs deleted file mode 100644 index 173f0c160e..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_core.rs +++ /dev/null @@ -1,84 +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::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::core::prelude::Name", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -pub struct Name {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - Ok(()) - } -} -fn bevy_core_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyCoreScriptingPlugin; -impl bevy::app::Plugin for BevyCoreScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_core_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyCoreAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs deleted file mode 100644 index abe5e34722..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_ecs.rs +++ /dev/null @@ -1,560 +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_reflect::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::entity::Entity", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new entity ID with the specified `index` and a generation of 1. -/// # Note -/// Spawning a specific `entity` value is __rarely the right choice__. Most apps should favor -/// [`Commands::spawn`](crate::system::Commands::spawn). This method should generally -/// only be used for sharing entities across apps, and only when they have a scheme -/// worked out to share an index space (which doesn't happen by default). -/// In general, one should not try to synchronize the ECS by attempting to ensure that -/// `Entity` lines up between instances, but instead insert a secondary identifier as -/// a component. - - #[lua()] - fn from_raw(index: u32) -> LuaReflectValProxy; - -"#, - r#" -/// Convert to a form convenient for passing outside of rust. -/// Only useful for identifying entities within the same instance of an application. Do not use -/// for serialization between runs. -/// No particular structure is guaranteed for the returned bits. - - #[lua()] - fn to_bits(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Reconstruct an `Entity` previously destructured with [`Entity::to_bits`]. -/// Only useful when applied to results from `to_bits` in the same instance of an application. -/// # Panics -/// This method will likely panic if given `u64` values that did not come from [`Entity::to_bits`]. - - #[lua()] - fn from_bits(bits: u64) -> LuaReflectValProxy; - -"#, - r#" -/// Return a transiently unique identifier. -/// No two simultaneously-live entities share the same index, but dead entities' indices may collide -/// with both live and dead entities. Useful for compactly representing entities within a -/// specific snapshot of the world, such as when serializing. - - #[lua()] - fn index(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the generation of this Entity's index. The generation is incremented each time an -/// entity with a given index is despawned. This serves as a "count" of the number of times a -/// given index has been reused (index, generation) pairs uniquely identify a given Entity. - - #[lua()] - fn generation(_self: LuaReflectValProxy) -> u32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Entity {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::world::OnAdd", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct OnAdd {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::world::OnInsert", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct OnInsert {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::world::OnRemove", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct OnRemove {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::world::OnReplace", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct OnReplace {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::component::ComponentId", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - 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()] - fn new(index: usize) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the index of the current component. - - #[lua()] - fn index(_self: LuaReflectValProxy) -> usize; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ComponentId(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::component::Tick", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new [`Tick`] wrapping the given value. - - #[lua()] - fn new(tick: u32) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the value of this change tick. - - #[lua()] - fn get(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Sets the value of this change tick. - - #[lua()] - fn set(_self: LuaReflectRefMutProxy, tick: u32) -> (); - -"#, - r#" -/// Returns `true` if this `Tick` occurred since the system's `last_run`. -/// `this_run` is the current tick of the system, used as a reference to help deal with wraparound. - - #[lua()] - fn is_newer_than( - _self: LuaReflectValProxy, - last_run: LuaReflectValProxy, - this_run: LuaReflectValProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Tick {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::component::ComponentTicks", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Returns `true` if the component or resource was added after the system last ran -/// (or the system is running for the first time). - - #[lua()] - fn is_added( - _self: LuaReflectRefProxy, - last_run: LuaReflectValProxy, - this_run: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -/// Returns `true` if the component or resource was added or mutably dereferenced after the system last ran -/// (or the system is running for the first time). - - #[lua()] - fn is_changed( - _self: LuaReflectRefProxy, - last_run: LuaReflectValProxy, - this_run: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -/// Creates a new instance with the same change tick for `added` and `changed`. - - #[lua()] - fn new( - change_tick: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Manually sets the change tick. -/// This is normally done automatically via the [`DerefMut`](std::ops::DerefMut) implementation -/// on [`Mut`](crate::change_detection::Mut), [`ResMut`](crate::change_detection::ResMut), etc. -/// However, components and resources that make use of interior mutability might require manual updates. -/// # Example -/// ```no_run -/// # use bevy_ecs::{world::World, component::ComponentTicks}; -/// let world: World = unimplemented!(); -/// let component_ticks: ComponentTicks = unimplemented!(); -/// component_ticks.set_changed(world.read_change_tick()); -/// ``` - - #[lua()] - fn set_changed( - _self: LuaReflectRefMutProxy, - change_tick: LuaReflectValProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ComponentTicks { - added: bevy::ecs::component::Tick, - changed: bevy::ecs::component::Tick, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::identifier::Identifier", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Returns the value of the low segment of the [`Identifier`]. - - #[lua()] - fn low(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the masked value of the high segment of the [`Identifier`]. -/// Does not include the flag bits. - - #[lua()] - fn masked_high(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Convert the [`Identifier`] into a `u64`. - - #[lua()] - fn to_bits(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Convert a `u64` into an [`Identifier`]. -/// # Panics -/// This method will likely panic if given `u64` values that did not come from [`Identifier::to_bits`]. - - #[lua()] - fn from_bits(value: u64) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Identifier {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::entity::EntityHash", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#] -)] -pub struct EntityHash {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::removal_detection::RemovedComponentEntity", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RemovedComponentEntity(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::ecs::system::SystemIdMarker", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[] -)] -pub struct SystemIdMarker {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance("Entity", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "ComponentId", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Tick", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "ComponentTicks", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Identifier", - crate::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -fn bevy_ecs_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyEcsScriptingPlugin; -impl bevy::app::Plugin for BevyEcsScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_ecs_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyEcsAPI", - |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::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::>() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs deleted file mode 100644 index 080149c40e..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_hierarchy.rs +++ /dev/null @@ -1,155 +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::*; -use super::bevy_core::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::hierarchy::prelude::Children", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Swaps the child at `a_index` with the child at `b_index`. - - #[lua()] - fn swap( - _self: LuaReflectRefMutProxy, - a_index: usize, - b_index: usize, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Children(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::hierarchy::prelude::Parent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Parent(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::hierarchy::HierarchyEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct HierarchyEvent {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - Ok(()) - } -} -fn bevy_hierarchy_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyHierarchyScriptingPlugin; -impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_hierarchy_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyHierarchyAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::() - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs deleted file mode 100644 index ea540806c0..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_input.rs +++ /dev/null @@ -1,1921 +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::*; -use super::bevy_core::*; -use super::bevy_math::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::Gamepad", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Returns the USB vendor ID as assigned by the USB-IF, if available. - - #[lua()] - fn vendor_id( - _self: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -/// Returns the USB product ID as assigned by the [vendor], if available. -/// [vendor]: Self::vendor_id - - #[lua()] - fn product_id( - _self: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -/// Returns `true` if the [`GamepadButton`] has been pressed. - - #[lua()] - fn pressed( - _self: LuaReflectRefProxy, - button_type: LuaReflectValProxy, - ) -> 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()] - fn just_pressed( - _self: LuaReflectRefProxy, - button_type: LuaReflectValProxy, - ) -> 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()] - fn just_released( - _self: LuaReflectRefProxy, - button_type: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Gamepad {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadAxis", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadAxis {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadButton", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadButton {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadSettings", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadSettings { - default_button_settings: bevy::input::gamepad::ButtonSettings, - default_axis_settings: bevy::input::gamepad::AxisSettings, - default_button_axis_settings: bevy::input::gamepad::ButtonAxisSettings, - button_settings: ReflectReference, - axis_settings: ReflectReference, - button_axis_settings: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::keyboard::KeyCode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct KeyCode {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::MouseButton", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct MouseButton {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::touch::TouchInput", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct TouchInput { - phase: bevy::input::touch::TouchPhase, - position: ReflectReference, - window: ReflectReference, - force: ReflectReference, - id: u64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::keyboard::KeyboardFocusLost", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct KeyboardFocusLost {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::keyboard::KeyboardInput", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct KeyboardInput { - key_code: bevy::input::keyboard::KeyCode, - logical_key: bevy::input::keyboard::Key, - state: bevy::input::ButtonState, - repeat: bool, - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::AccumulatedMouseMotion", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AccumulatedMouseMotion { - delta: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::AccumulatedMouseScroll", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AccumulatedMouseScroll { - unit: bevy::input::mouse::MouseScrollUnit, - delta: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::MouseButtonInput", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct MouseButtonInput { - button: bevy::input::mouse::MouseButton, - state: bevy::input::ButtonState, - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::MouseMotion", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct MouseMotion { - delta: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::MouseWheel", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct MouseWheel { - unit: bevy::input::mouse::MouseScrollUnit, - x: f32, - y: f32, - window: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadAxisChangedEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadAxisChangedEvent { - entity: ReflectReference, - axis: bevy::input::gamepad::GamepadAxis, - value: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadButtonChangedEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadButtonChangedEvent { - entity: ReflectReference, - button: bevy::input::gamepad::GamepadButton, - state: bevy::input::ButtonState, - value: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadButtonStateChangedEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadButtonStateChangedEvent { - entity: ReflectReference, - button: bevy::input::gamepad::GamepadButton, - state: bevy::input::ButtonState, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadConnection", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadConnection {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadConnectionEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Is the gamepad connected? - - #[lua()] - fn connected( - _self: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Is the gamepad disconnected? - - #[lua()] - fn disconnected( - _self: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadConnectionEvent { - gamepad: ReflectReference, - connection: bevy::input::gamepad::GamepadConnection, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadEvent {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadInput", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadInput {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadRumbleRequest", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#] -)] -pub struct GamepadRumbleRequest {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::RawGamepadAxisChangedEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RawGamepadAxisChangedEvent { - gamepad: ReflectReference, - axis: bevy::input::gamepad::GamepadAxis, - value: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::RawGamepadButtonChangedEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RawGamepadButtonChangedEvent { - gamepad: ReflectReference, - button: bevy::input::gamepad::GamepadButton, - value: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::RawGamepadEvent", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RawGamepadEvent {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gestures::PinchGesture", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct PinchGesture(f32); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gestures::RotationGesture", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RotationGesture(f32); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gestures::DoubleTapGesture", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct DoubleTapGesture {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gestures::PanGesture", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct PanGesture(ReflectReference); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::ButtonState", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Is this button pressed? - - #[lua()] - fn is_pressed(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ButtonState {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::ButtonSettings", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - 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. - - #[lua()] - fn is_pressed( - _self: LuaReflectRefProxy, - value: f32, - ) -> bool; - -"#, - r#" -/// Returns `true` if the button is released. -/// A button is considered released if the `value` passed is lower than or equal to the release threshold. - - #[lua()] - fn is_released( - _self: LuaReflectRefProxy, - value: f32, - ) -> bool; - -"#, - r#" -/// Get the button input threshold above which the button is considered pressed. - - #[lua()] - fn press_threshold( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Try to set the button input threshold above which the button is considered pressed. -/// If the value passed is outside the range [release threshold..=1.0], the value will not be changed. -/// Returns the new value of the press threshold. - - #[lua()] - fn set_press_threshold( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" -/// Get the button input threshold below which the button is considered released. - - #[lua()] - fn release_threshold( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Try to set the button input threshold below which the button is considered released. If the -/// value passed is outside the range [0.0..=press threshold], the value will not be changed. -/// Returns the new value of the release threshold. - - #[lua()] - fn set_release_threshold( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ButtonSettings {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::AxisSettings", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the value above which inputs will be rounded up to 1.0. - - #[lua()] - fn livezone_upperbound( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Try to set the value above which inputs will be rounded up to 1.0. -/// If the value passed is negative or less than `deadzone_upperbound`, -/// the value will not be changed. -/// Returns the new value of `livezone_upperbound`. - - #[lua()] - fn set_livezone_upperbound( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" -/// Get the value below which positive inputs will be rounded down to 0.0. - - #[lua()] - fn deadzone_upperbound( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Try to set the value below which positive inputs will be rounded down to 0.0. -/// If the value passed is negative or greater than `livezone_upperbound`, -/// the value will not be changed. -/// Returns the new value of `deadzone_upperbound`. - - #[lua()] - fn set_deadzone_upperbound( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" -/// Get the value below which negative inputs will be rounded down to -1.0. - - #[lua()] - fn livezone_lowerbound( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Try to set the value below which negative inputs will be rounded down to -1.0. -/// If the value passed is positive or greater than `deadzone_lowerbound`, -/// the value will not be changed. -/// Returns the new value of `livezone_lowerbound`. - - #[lua()] - fn set_livezone_lowerbound( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" -/// Get the value above which inputs will be rounded up to 0.0. - - #[lua()] - fn deadzone_lowerbound( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Try to set the value above which inputs will be rounded up to 0.0. -/// If the value passed is less than -1.0 or less than `livezone_lowerbound`, -/// the value will not be changed. -/// Returns the new value of `deadzone_lowerbound`. - - #[lua()] - fn set_deadzone_lowerbound( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" -/// Get the minimum value by which input must change before the change is registered. - - #[lua()] - fn threshold(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Try to set the minimum value by which input must change before the changes will be applied. -/// If the value passed is not within [0.0..=2.0], the value will not be changed. -/// Returns the new value of threshold. - - #[lua()] - fn set_threshold( - _self: LuaReflectRefMutProxy, - value: f32, - ) -> f32; - -"#, - r#" -/// Clamps the `raw_value` according to the `AxisSettings`. - - #[lua()] - fn clamp( - _self: LuaReflectRefProxy, - new_value: f32, - ) -> f32; - -"#, - r#" -/// Filters the `new_value` based on the `old_value`, according to the [`AxisSettings`]. -/// Returns the clamped `new_value` if the change exceeds the settings threshold, -/// and `None` otherwise. - - #[lua()] - fn filter( - _self: LuaReflectRefProxy, - new_value: f32, - old_value: std::option::Option, - ) -> std::option::Option; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AxisSettings {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::ButtonAxisSettings", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[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. - - #[lua()] - fn filter( - _self: LuaReflectRefProxy, - new_value: f32, - old_value: std::option::Option, - ) -> std::option::Option; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ButtonAxisSettings { - high: f32, - low: f32, - threshold: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::gamepad::GamepadRumbleIntensity", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn weak_motor( - intensity: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn strong_motor( - intensity: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GamepadRumbleIntensity { - strong_motor: f32, - weak_motor: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::keyboard::Key", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Key {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::keyboard::NativeKeyCode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct NativeKeyCode {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::keyboard::NativeKey", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct NativeKey {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::mouse::MouseScrollUnit", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct MouseScrollUnit {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::touch::TouchPhase", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct TouchPhase {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::input::touch::ForceTouch", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ForceTouch {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance( - "GamepadRumbleIntensity", - crate::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -fn bevy_input_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyInputScriptingPlugin; -impl bevy::app::Plugin for BevyInputScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_input_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyInputAPI", - |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::() - .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::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs deleted file mode 100644 index 17549221d1..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_math.rs +++ /dev/null @@ -1,4548 +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_reflect::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::AspectRatio", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the aspect ratio as a f32 value. - - #[lua()] - fn ratio(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the inverse of this aspect ratio (height/width). - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns true if the aspect ratio represents a landscape orientation. - - #[lua()] - fn is_landscape(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns true if the aspect ratio represents a portrait orientation. - - #[lua()] - fn is_portrait(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns true if the aspect ratio is exactly square. - - #[lua()] - fn is_square(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AspectRatio(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::CompassOctant", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CompassOctant {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::CompassQuadrant", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CompassQuadrant {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Isometry2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a two-dimensional isometry from a rotation. - - #[lua()] - fn from_rotation( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a two-dimensional isometry from a translation with the given `x` and `y` components. - - #[lua()] - fn from_xy(x: f32, y: f32) -> LuaReflectValProxy; - -"#, - r#" -/// The inverse isometry that undoes this one. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn inverse_mul( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Isometry2d { - rotation: bevy::math::Rot2, - translation: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Isometry3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a three-dimensional isometry from a translation with the given `x`, `y`, and `z` components. - - #[lua()] - fn from_xyz(x: f32, y: f32, z: f32) -> LuaReflectValProxy; - -"#, - r#" -/// The inverse isometry that undoes this one. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn inverse_mul( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Isometry3d { - rotation: ReflectReference, - translation: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Ray2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Ray2d { - origin: ReflectReference, - direction: bevy::math::prelude::Dir2, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Ray3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Ray3d { - origin: ReflectReference, - direction: bevy::math::prelude::Dir3, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Rot2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Rotates the [`Dir2`] using a [`Rot2`]. - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - direction: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn radians(radians: f32) -> LuaReflectValProxy; - -"#, - 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()] - fn degrees(degrees: f32) -> LuaReflectValProxy; - -"#, - 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()] - fn turn_fraction(fraction: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a [`Rot2`] from the sine and cosine of an angle in radians. -/// The rotation is only valid if `sin * sin + cos * cos == 1.0`. -/// # Panics -/// Panics if `sin * sin + cos * cos != 1.0` when the `glam_assert` feature is enabled. - - #[lua()] - fn from_sin_cos(sin: f32, cos: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the rotation in radians in the `(-pi, pi]` range. - - #[lua()] - fn as_radians(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the rotation in degrees in the `(-180, 180]` range. - - #[lua()] - fn as_degrees(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the rotation as a fraction of a full 360 degree turn. - - #[lua()] - fn as_turn_fraction(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the sine and cosine of the rotation angle in radians. - - #[lua()] - fn sin_cos(_self: LuaReflectValProxy) -> (f32, f32); - -"#, - r#" -/// Computes the length or norm of the complex number used to represent the rotation. -/// The length is typically expected to be `1.0`. Unexpectedly denormalized rotations -/// can be a result of incorrect construction or floating point error caused by -/// successive operations. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the squared length or norm of the complex number used to represent the rotation. -/// This is generally faster than [`Rot2::length()`], as it avoids a square -/// root operation. -/// The length is typically expected to be `1.0`. Unexpectedly denormalized rotations -/// can be a result of incorrect construction or floating point error caused by -/// successive operations. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes `1.0 / self.length()`. -/// For valid results, `self` must _not_ have a length of zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns `self` with a length of `1.0`. -/// Note that [`Rot2`] should typically already be normalized by design. -/// Manual normalization is only needed when successive operations result in -/// accumulated floating point error, or if the rotation was constructed -/// with invalid values. -/// # Panics -/// Panics if `self` has a length of zero, NaN, or infinity when debug assertions are enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn fast_renormalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if the rotation is neither infinite nor NaN. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns `true` if the rotation is NaN. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns whether `self` has a length of `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns `true` if the rotation is near [`Rot2::IDENTITY`]. - - #[lua()] - fn is_near_identity(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the angle in radians needed to make `self` and `other` coincide. - - #[lua()] - fn angle_between( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns the angle in radians needed to make `self` and `other` coincide. - - #[lua()] - fn angle_to( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns the inverse of the rotation. This is also the conjugate -/// of the unit complex number representing the rotation. - - #[lua()] - fn inverse( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` based on -/// the value `s`, and normalizes the rotation afterwards. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// This is slightly more efficient than [`slerp`](Self::slerp), and produces a similar result -/// when the difference between the two rotations is small. At larger differences, -/// the result resembles a kind of ease-in-out effect. -/// If you would like the angular velocity to remain constant, consider using [`slerp`](Self::slerp) instead. -/// # Details -/// `nlerp` corresponds to computing an angle for a point at position `s` on a line drawn -/// between the endpoints of the arc formed by `self` and `rhs` on a unit circle, -/// and normalizing the result afterwards. -/// Note that if the angles are opposite like 0 and π, the line will pass through the origin, -/// and the resulting angle will always be either `self` or `rhs` depending on `s`. -/// If `s` happens to be `0.5` in this case, a valid rotation cannot be computed, and `self` -/// will be returned as a fallback. -/// # Example -/// ``` -/// # use bevy_math::Rot2; -/// # -/// let rot1 = Rot2::IDENTITY; -/// let rot2 = Rot2::degrees(135.0); -/// let result1 = rot1.nlerp(rot2, 1.0 / 3.0); -/// assert_eq!(result1.as_degrees(), 28.675055); -/// let result2 = rot1.nlerp(rot2, 0.5); -/// assert_eq!(result2.as_degrees(), 67.5); -/// ``` - - #[lua()] - fn nlerp( - _self: LuaReflectValProxy, - end: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `end` -/// based on the value `s`. -/// This corresponds to interpolating between the two angles at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// If you would like the rotation to have a kind of ease-in-out effect, consider -/// using the slightly more efficient [`nlerp`](Self::nlerp) instead. -/// # Example -/// ``` -/// # use bevy_math::Rot2; -/// # -/// let rot1 = Rot2::IDENTITY; -/// let rot2 = Rot2::degrees(135.0); -/// let result1 = rot1.slerp(rot2, 1.0 / 3.0); -/// assert_eq!(result1.as_degrees(), 45.0); -/// let result2 = rot1.slerp(rot2, 0.5); -/// assert_eq!(result2.as_degrees(), 67.5); -/// ``` - - #[lua()] - fn slerp( - _self: LuaReflectValProxy, - end: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Rot2 { - cos: f32, - sin: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::prelude::Dir2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - 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()] - fn from_xy_unchecked( - x: f32, - y: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `rhs` -/// based on the value `s`. -/// This corresponds to interpolating between the two directions at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// # Example -/// ``` -/// # use bevy_math::Dir2; -/// # use approx::{assert_relative_eq, RelativeEq}; -/// # -/// let dir1 = Dir2::X; -/// let dir2 = Dir2::Y; -/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); -/// assert_relative_eq!(result1, Dir2::from_xy(0.75_f32.sqrt(), 0.5).unwrap()); -/// let result2 = dir1.slerp(dir2, 0.5); -/// assert_relative_eq!(result2, Dir2::from_xy(0.5_f32.sqrt(), 0.5_f32.sqrt()).unwrap()); -/// ``` - - #[lua()] - fn slerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the rotation that rotates this direction to `other`. - - #[lua()] - fn rotation_to( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the rotation that rotates `other` to this direction. - - #[lua()] - fn rotation_from( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the rotation that rotates the X-axis to this direction. - - #[lua()] - fn rotation_from_x( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the rotation that rotates this direction to the X-axis. - - #[lua()] - fn rotation_to_x( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the rotation that rotates the Y-axis to this direction. - - #[lua()] - fn rotation_from_y( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the rotation that rotates this direction to the Y-axis. - - #[lua()] - fn rotation_to_y( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn fast_renormalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Dir2(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::prelude::Dir3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - 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()] - fn from_xyz_unchecked( - x: f32, - y: f32, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `rhs` -/// based on the value `s`. -/// This corresponds to interpolating between the two directions at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// # Example -/// ``` -/// # use bevy_math::Dir3; -/// # use approx::{assert_relative_eq, RelativeEq}; -/// # -/// let dir1 = Dir3::X; -/// let dir2 = Dir3::Y; -/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); -/// assert_relative_eq!( -/// result1, -/// Dir3::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), -/// epsilon = 0.000001 -/// ); -/// let result2 = dir1.slerp(dir2, 0.5); -/// assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); -/// ``` - - #[lua()] - fn slerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn fast_renormalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Dir3(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::prelude::Dir3A", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[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()] - fn from_xyz_unchecked( - x: f32, - y: f32, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `rhs` -/// based on the value `s`. -/// This corresponds to interpolating between the two directions at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// # Example -/// ``` -/// # use bevy_math::Dir3A; -/// # use approx::{assert_relative_eq, RelativeEq}; -/// # -/// let dir1 = Dir3A::X; -/// let dir2 = Dir3A::Y; -/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); -/// assert_relative_eq!( -/// result1, -/// Dir3A::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), -/// epsilon = 0.000001 -/// ); -/// let result2 = dir1.slerp(dir2, 0.5); -/// assert_relative_eq!(result2, Dir3A::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); -/// ``` - - #[lua()] - fn slerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn fast_renormalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Dir3A(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::prelude::IRect", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - 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. -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 4, 10, 6); // w=10 h=2 -/// let r = IRect::new(2, 3, 5, -1); // w=3 h=4 -/// ``` - - #[lua()] - fn new( - x0: i32, - y0: i32, - x1: i32, - y1: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::from_corners(IVec2::ZERO, IVec2::new(0, 1)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua()] - fn is_empty(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.width(), 5); -/// ``` - - #[lua()] - fn width(_self: LuaReflectRefProxy) -> i32; - -"#, - r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.height(), 1); -/// ``` - - #[lua()] - fn height(_self: LuaReflectRefProxy) -> i32; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and another rectangle. -/// The union is the smallest rectangle enclosing both rectangles. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 -/// let r = r1.union(r2); -/// assert_eq!(r.min, IVec2::new(0, -1)); -/// assert_eq!(r.max, IVec2::new(5, 3)); -/// ``` - - #[lua()] - fn union( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. -/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection -/// is empty, this method returns an empty rectangle ([`IRect::is_empty()`] returns `true`), but -/// the actual values of [`IRect::min`] and [`IRect::max`] are implementation-dependent. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 -/// let r = r1.intersect(r2); -/// assert_eq!(r.min, IVec2::new(1, 0)); -/// assert_eq!(r.max, IVec2::new(3, 1)); -/// ``` - - #[lua()] - fn intersect( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new rectangle by expanding it evenly on all sides. -/// A positive expansion value produces a larger rectangle, -/// while a negative expansion value produces a smaller rectangle. -/// If this would result in zero or negative width or height, [`IRect::EMPTY`] is returned instead. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = r.inflate(3); // w=11 h=7 -/// assert_eq!(r2.min, IVec2::splat(-3)); -/// assert_eq!(r2.max, IVec2::new(8, 4)); -/// let r = IRect::new(0, -1, 4, 3); // w=4 h=4 -/// let r2 = r.inflate(-1); // w=2 h=2 -/// assert_eq!(r2.min, IVec2::new(1, 0)); -/// assert_eq!(r2.max, IVec2::new(3, 2)); -/// ``` - - #[lua()] - fn inflate( - _self: LuaReflectRefProxy, - expansion: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns self as [`Rect`] (f32) - - #[lua()] - fn as_rect( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns self as [`URect`] (u32) - - #[lua()] - fn as_urect( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct IRect { - min: ReflectReference, - max: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::prelude::Rect", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> 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. -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 -/// let r = Rect::new(2., 3., 5., -1.); // w=3 h=4 -/// ``` - - #[lua()] - fn new( - x0: f32, - y0: f32, - x1: f32, - y1: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua()] - fn is_empty(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!((r.width() - 5.).abs() <= 1e-5); -/// ``` - - #[lua()] - fn width(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!((r.height() - 1.).abs() <= 1e-5); -/// ``` - - #[lua()] - fn height(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and another rectangle. -/// The union is the smallest rectangle enclosing both rectangles. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 -/// let r = r1.union(r2); -/// assert!(r.min.abs_diff_eq(Vec2::new(0., -1.), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::new(5., 3.), 1e-5)); -/// ``` - - #[lua()] - fn union( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. -/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection -/// is empty, this method returns an empty rectangle ([`Rect::is_empty()`] returns `true`), but -/// the actual values of [`Rect::min`] and [`Rect::max`] are implementation-dependent. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 -/// let r = r1.intersect(r2); -/// assert!(r.min.abs_diff_eq(Vec2::new(1., 0.), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::new(3., 1.), 1e-5)); -/// ``` - - #[lua()] - fn intersect( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new rectangle by expanding it evenly on all sides. -/// A positive expansion value produces a larger rectangle, -/// while a negative expansion value produces a smaller rectangle. -/// If this would result in zero or negative width or height, [`Rect::EMPTY`] is returned instead. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let r2 = r.inflate(3.); // w=11 h=7 -/// assert!(r2.min.abs_diff_eq(Vec2::splat(-3.), 1e-5)); -/// assert!(r2.max.abs_diff_eq(Vec2::new(8., 4.), 1e-5)); -/// let r = Rect::new(0., -1., 6., 7.); // w=6 h=8 -/// let r2 = r.inflate(-2.); // w=11 h=7 -/// assert!(r2.min.abs_diff_eq(Vec2::new(2., 1.), 1e-5)); -/// assert!(r2.max.abs_diff_eq(Vec2::new(4., 5.), 1e-5)); -/// ``` - - #[lua()] - fn inflate( - _self: LuaReflectRefProxy, - expansion: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Build a new rectangle from this one with its coordinates expressed -/// relative to `other` in a normalized ([0..1] x [0..1]) coordinate system. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(2., 3., 4., 6.); -/// let s = Rect::new(0., 0., 10., 10.); -/// let n = r.normalize(s); -/// assert_eq!(n.min.x, 0.2); -/// assert_eq!(n.min.y, 0.3); -/// assert_eq!(n.max.x, 0.4); -/// assert_eq!(n.max.y, 0.6); -/// ``` - - #[lua()] - fn normalize( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns self as [`IRect`] (i32) - - #[lua()] - fn as_irect( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns self as [`URect`] (u32) - - #[lua()] - fn as_urect( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Rect { - min: ReflectReference, - max: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::prelude::URect", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - 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. -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 4, 10, 6); // w=10 h=2 -/// let r = URect::new(2, 4, 5, 0); // w=3 h=4 -/// ``` - - #[lua()] - fn new( - x0: u32, - y0: u32, - x1: u32, - y1: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::from_corners(UVec2::ZERO, UVec2::new(0, 1)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua()] - fn is_empty(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.width(), 5); -/// ``` - - #[lua()] - fn width(_self: LuaReflectRefProxy) -> u32; - -"#, - r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.height(), 1); -/// ``` - - #[lua()] - fn height(_self: LuaReflectRefProxy) -> u32; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and another rectangle. -/// The union is the smallest rectangle enclosing both rectangles. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r1 = URect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = URect::new(1, 0, 3, 8); // w=2 h=4 -/// let r = r1.union(r2); -/// assert_eq!(r.min, UVec2::new(0, 0)); -/// assert_eq!(r.max, UVec2::new(5, 8)); -/// ``` - - #[lua()] - fn union( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. -/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection -/// is empty, this method returns an empty rectangle ([`URect::is_empty()`] returns `true`), but -/// the actual values of [`URect::min`] and [`URect::max`] are implementation-dependent. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r1 = URect::new(0, 0, 2, 2); // w=2 h=2 -/// let r2 = URect::new(1, 1, 3, 3); // w=2 h=2 -/// let r = r1.intersect(r2); -/// assert_eq!(r.min, UVec2::new(1, 1)); -/// assert_eq!(r.max, UVec2::new(2, 2)); -/// ``` - - #[lua()] - fn intersect( - _self: LuaReflectRefProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new rectangle by expanding it evenly on all sides. -/// A positive expansion value produces a larger rectangle, -/// while a negative expansion value produces a smaller rectangle. -/// If this would result in zero width or height, [`URect::EMPTY`] is returned instead. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(4, 4, 6, 6); // w=2 h=2 -/// let r2 = r.inflate(1); // w=4 h=4 -/// assert_eq!(r2.min, UVec2::splat(3)); -/// assert_eq!(r2.max, UVec2::splat(7)); -/// let r = URect::new(4, 4, 8, 8); // w=4 h=4 -/// let r2 = r.inflate(-1); // w=2 h=2 -/// assert_eq!(r2.min, UVec2::splat(5)); -/// assert_eq!(r2.max, UVec2::splat(7)); -/// ``` - - #[lua()] - fn inflate( - _self: LuaReflectRefProxy, - expansion: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns self as [`Rect`] (f32) - - #[lua()] - fn as_rect( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns self as [`IRect`] (i32) - - #[lua()] - fn as_irect( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct URect { - min: ReflectReference, - max: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Affine3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[] -)] -pub struct Affine3 { - matrix3: ReflectReference, - translation: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::Aabb2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. - - #[lua()] - fn bounding_circle( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Aabb2d { - min: ReflectReference, - max: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::BoundingCircle", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Get the radius of the bounding circle - - #[lua()] - fn radius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. - - #[lua()] - fn aabb_2d( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BoundingCircle { - center: ReflectReference, - circle: bevy::math::primitives::Circle, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Circle", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`Circle`] from a `radius` - - #[lua()] - fn new(radius: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Get the diameter of the circle - - #[lua()] - fn diameter(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Circle { - radius: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Annulus", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`Annulus`] from the radii of the inner and outer circle - - #[lua()] - fn new( - inner_radius: f32, - outer_radius: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the diameter of the annulus - - #[lua()] - fn diameter(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the thickness of the annulus - - #[lua()] - fn thickness(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Annulus { - inner_circle: bevy::math::primitives::Circle, - outer_circle: bevy::math::primitives::Circle, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Arc2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and a `half_angle` - - #[lua()] - fn new( - radius: f32, - half_angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and an `angle` in radians - - #[lua()] - fn from_radians( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and an `angle` in degrees. - - #[lua()] - fn from_degrees( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and a `fraction` of a single turn. -/// For instance, `0.5` turns is a semicircle. - - #[lua()] - fn from_turns( - radius: f32, - fraction: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the angle of the arc - - #[lua()] - fn angle(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the length of the arc - - #[lua()] - fn length(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get half the distance between the endpoints (half the length of the chord) - - #[lua()] - fn half_chord_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the distance between the endpoints (the length of the chord) - - #[lua()] - fn chord_length(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the length of the apothem of this arc, that is, -/// the distance from the center of the circle to the midpoint of the chord, in the direction of the midpoint of the arc. -/// Equivalently, the [`radius`](Self::radius) minus the [`sagitta`](Self::sagitta). -/// Note that for a [`major`](Self::is_major) arc, the apothem will be negative. - - #[lua()] - fn apothem(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the length of the sagitta of this arc, that is, -/// the length of the line between the midpoints of the arc and its chord. -/// Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc. -/// The sagitta is also the sum of the [`radius`](Self::radius) and the [`apothem`](Self::apothem). - - #[lua()] - fn sagitta(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Produces true if the arc is at most half a circle. -/// **Note:** This is not the negation of [`is_major`](Self::is_major): an exact semicircle is both major and minor. - - #[lua()] - fn is_minor(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Produces true if the arc is at least half a circle. -/// **Note:** This is not the negation of [`is_minor`](Self::is_minor): an exact semicircle is both major and minor. - - #[lua()] - fn is_major(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Arc2d { - radius: f32, - half_angle: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Capsule2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new `Capsule2d` from a radius and length - - #[lua()] - fn new( - radius: f32, - length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] - - #[lua()] - fn to_inner_rectangle( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Capsule2d { - radius: f32, - half_length: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::CircularSector", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Create a new [`CircularSector`] from a `radius` and an `angle` - - #[lua()] - fn new( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`CircularSector`] from a `radius` and an `angle` in radians. - - #[lua()] - fn from_radians( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`CircularSector`] from a `radius` and an `angle` in degrees. - - #[lua()] - fn from_degrees( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`CircularSector`] from a `radius` and a number of `turns` of a circle. -/// For instance, `0.5` turns is a semicircle. - - #[lua()] - fn from_turns( - radius: f32, - fraction: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get half the angle of the sector - - #[lua()] - fn half_angle( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the angle of the sector - - #[lua()] - fn angle(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the radius of the sector - - #[lua()] - fn radius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the length of the arc defining the sector - - #[lua()] - fn arc_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get half the length of the chord defined by the sector -/// See [`Arc2d::half_chord_length`] - - #[lua()] - fn half_chord_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the length of the chord defined by the sector -/// See [`Arc2d::chord_length`] - - #[lua()] - fn chord_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the length of the apothem of this sector -/// See [`Arc2d::apothem`] - - #[lua()] - fn apothem(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the length of the sagitta of this sector -/// See [`Arc2d::sagitta`] - - #[lua()] - fn sagitta(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CircularSector { - arc: bevy::math::primitives::Arc2d, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::CircularSegment", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Create a new [`CircularSegment`] from a `radius`, and an `angle` - - #[lua()] - fn new( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`CircularSegment`] from a `radius` and an `angle` in radians. - - #[lua()] - fn from_radians( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`CircularSegment`] from a `radius` and an `angle` in degrees. - - #[lua()] - fn from_degrees( - radius: f32, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new [`CircularSegment`] from a `radius` and a number of `turns` of a circle. -/// For instance, `0.5` turns is a semicircle. - - #[lua()] - fn from_turns( - radius: f32, - fraction: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the half-angle of the segment - - #[lua()] - fn half_angle( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the angle of the segment - - #[lua()] - fn angle(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the radius of the segment - - #[lua()] - fn radius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the length of the arc defining the segment - - #[lua()] - fn arc_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get half the length of the segment's base, also known as its chord - - #[lua()] - fn half_chord_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the length of the segment's base, also known as its chord - - #[lua()] - fn chord_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the length of the apothem of this segment, -/// which is the signed distance between the segment and the center of its circle -/// See [`Arc2d::apothem`] - - #[lua()] - fn apothem( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the length of the sagitta of this segment, also known as its height -/// See [`Arc2d::sagitta`] - - #[lua()] - fn sagitta( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct CircularSegment { - arc: bevy::math::primitives::Arc2d, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Ellipse", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Create a new `Ellipse` from half of its width and height. -/// This corresponds to the two perpendicular radii defining the ellipse. - - #[lua()] - fn new( - half_width: f32, - half_height: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the [eccentricity](https://en.wikipedia.org/wiki/Eccentricity_(mathematics)) of the ellipse. -/// It can be thought of as a measure of how "stretched" or elongated the ellipse is. -/// The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola. - - #[lua()] - fn eccentricity(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse. -/// The focal length of an ellipse is related to its eccentricity by `eccentricity = focal_length / semi_major` - - #[lua()] - fn focal_length(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse. - - #[lua()] - fn semi_major(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse. - - #[lua()] - fn semi_minor(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Ellipse { - half_size: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Line2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Line2d { - direction: bevy::math::prelude::Dir2, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Plane2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Plane2d { - normal: bevy::math::prelude::Dir2, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Rectangle", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Create a new `Rectangle` from a full width and height - - #[lua()] - fn new( - width: f32, - height: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a `Rectangle` from a single length. -/// The resulting `Rectangle` will be the same size in every direction. - - #[lua()] - fn from_length(length: f32) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Rectangle { - half_size: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::RegularPolygon", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Create a new `RegularPolygon` -/// from the radius of the circumcircle and a number of sides -/// # Panics -/// Panics if `circumradius` is negative - - #[lua()] - fn new( - circumradius: f32, - sides: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the radius of the circumcircle on which all vertices -/// of the regular polygon lie - - #[lua()] - fn circumradius( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the inradius or apothem of the regular polygon. -/// This is the radius of the largest circle that can -/// be drawn within the polygon - - #[lua()] - fn inradius( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the length of one side of the regular polygon - - #[lua()] - fn side_length( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the internal angle of the regular polygon in degrees. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the interior of the polygon - - #[lua()] - fn internal_angle_degrees( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the internal angle of the regular polygon in radians. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the interior of the polygon - - #[lua()] - fn internal_angle_radians( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the external angle of the regular polygon in degrees. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the exterior of the polygon - - #[lua()] - fn external_angle_degrees( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -/// Get the external angle of the regular polygon in radians. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the exterior of the polygon - - #[lua()] - fn external_angle_radians( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RegularPolygon { - circumcircle: bevy::math::primitives::Circle, - sides: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Rhombus", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. - - #[lua()] - fn new( - horizontal_diagonal: f32, - vertical_diagonal: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new `Rhombus` from a side length with all inner angles equal. - - #[lua()] - fn from_side(side: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new `Rhombus` from a given inradius with all inner angles equal. - - #[lua()] - fn from_inradius( - inradius: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the length of each side of the rhombus - - #[lua()] - fn side(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the radius of the circumcircle on which all vertices -/// of the rhombus lie - - #[lua()] - fn circumradius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the radius of the largest circle that can -/// be drawn within the rhombus - - #[lua()] - fn inradius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Rhombus { - half_diagonals: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Segment2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new `Segment2d` from a direction and full length of the segment - - #[lua()] - fn new( - direction: LuaReflectValProxy, - length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Segment2d { - direction: bevy::math::prelude::Dir2, - half_length: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Triangle2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Checks if the triangle is degenerate, meaning it has zero area. -/// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. -/// This indicates that the three vertices are collinear or nearly collinear. - - #[lua()] - fn is_degenerate( - _self: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Checks if the triangle is acute, meaning all angles are less than 90 degrees - - #[lua()] - fn is_acute(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees - - #[lua()] - fn is_obtuse(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Reverse the [`WindingOrder`] of the triangle -/// by swapping the first and last vertices. - - #[lua()] - fn reverse(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// This triangle but reversed. - - #[lua()] - fn reversed( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Triangle2d { - vertices: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::Aabb3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - - #[lua()] - fn bounding_sphere( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Aabb3d { - min: ReflectReference, - max: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::BoundingSphere", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the radius of the bounding sphere - - #[lua()] - fn radius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. - - #[lua()] - fn aabb_3d( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BoundingSphere { - center: ReflectReference, - sphere: bevy::math::primitives::Sphere, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Sphere", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Create a new [`Sphere`] from a `radius` - - #[lua()] - fn new(radius: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Get the diameter of the sphere - - #[lua()] - fn diameter(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Sphere { - radius: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Cuboid", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new `Cuboid` from a full x, y, and z length - - #[lua()] - fn new( - x_length: f32, - y_length: f32, - z_length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a `Cuboid` from a single length. -/// The resulting `Cuboid` will be the same size in every direction. - - #[lua()] - fn from_length(length: f32) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Cuboid { - half_size: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Cylinder", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Create a new `Cylinder` from a radius and full height - - #[lua()] - fn new( - radius: f32, - height: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the base of the cylinder as a [`Circle`] - - #[lua()] - fn base( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the surface area of the side of the cylinder, -/// also known as the lateral area - - #[lua()] - fn lateral_area(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the surface area of one base of the cylinder - - #[lua()] - fn base_area(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Cylinder { - radius: f32, - half_height: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Capsule3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Create a new `Capsule3d` from a radius and length - - #[lua()] - fn new( - radius: f32, - length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the part connecting the hemispherical ends -/// of the capsule as a [`Cylinder`] - - #[lua()] - fn to_cylinder( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Capsule3d { - radius: f32, - half_length: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Cone", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Create a new [`Cone`] from a radius and height. - - #[lua()] - fn new(radius: f32, height: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Get the base of the cone as a [`Circle`] - - #[lua()] - fn base( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the slant height of the cone, the length of the line segment -/// connecting a point on the base to the apex - - #[lua()] - fn slant_height(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the surface area of the side of the cone, -/// also known as the lateral area - - #[lua()] - fn lateral_area(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the surface area of the base of the cone - - #[lua()] - fn base_area(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Cone { - radius: f32, - height: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::ConicalFrustum", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct ConicalFrustum { - radius_top: f32, - radius_bottom: f32, - height: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::InfinitePlane3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct InfinitePlane3d { - normal: bevy::math::prelude::Dir3, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Line3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Line3d { - direction: bevy::math::prelude::Dir3, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Segment3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new `Segment3d` from a direction and full length of the segment - - #[lua()] - fn new( - direction: LuaReflectValProxy, - length: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Segment3d { - direction: bevy::math::prelude::Dir3, - half_length: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Torus", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[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 - - #[lua()] - fn new( - inner_radius: f32, - outer_radius: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the inner radius of the torus. -/// For a ring torus, this corresponds to the radius of the hole, -/// or `major_radius - minor_radius` - - #[lua()] - fn inner_radius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Get the outer radius of the torus. -/// This corresponds to the overall radius of the entire object, -/// or `major_radius + minor_radius` - - #[lua()] - fn outer_radius(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Torus { - minor_radius: f32, - major_radius: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Triangle3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Checks if the triangle is degenerate, meaning it has zero area. -/// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. -/// This indicates that the three vertices are collinear or nearly collinear. - - #[lua()] - fn is_degenerate( - _self: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Checks if the triangle is acute, meaning all angles are less than 90 degrees - - #[lua()] - fn is_acute(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees - - #[lua()] - fn is_obtuse(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Reverse the triangle by swapping the first and last vertices. - - #[lua()] - fn reverse(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// This triangle but reversed. - - #[lua()] - fn reversed( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Triangle3d { - vertices: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::RayCast2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. - - #[lua()] - fn from_ray( - ray: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the distance of an intersection with an [`Aabb2d`], if any. - - #[lua()] - fn aabb_intersection_at( - _self: LuaReflectRefProxy, - aabb: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -/// Get the distance of an intersection with a [`BoundingCircle`], if any. - - #[lua()] - fn circle_intersection_at( - _self: LuaReflectRefProxy, - circle: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RayCast2d { - ray: bevy::math::Ray2d, - max: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::AabbCast2d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. - - #[lua()] - fn from_ray( - aabb: LuaReflectValProxy, - ray: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the distance at which the [`Aabb2d`]s collide, if at all. - - #[lua()] - fn aabb_collision_at( - _self: LuaReflectRefProxy, - aabb: LuaReflectValProxy, - ) -> std::option::Option; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AabbCast2d { - ray: bevy::math::bounding::RayCast2d, - aabb: bevy::math::bounding::Aabb2d, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::BoundingCircleCast", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. - - #[lua()] - fn from_ray( - circle: LuaReflectValProxy, - ray: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the distance at which the [`BoundingCircle`]s collide, if at all. - - #[lua()] - fn circle_collision_at( - _self: LuaReflectRefProxy, - circle: LuaReflectValProxy, - ) -> std::option::Option; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BoundingCircleCast { - ray: bevy::math::bounding::RayCast2d, - circle: bevy::math::bounding::BoundingCircle, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::RayCast3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Construct a [`RayCast3d`] from a [`Ray3d`] and max distance. - - #[lua()] - fn from_ray( - ray: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the distance of an intersection with an [`Aabb3d`], if any. - - #[lua()] - fn aabb_intersection_at( - _self: LuaReflectRefProxy, - aabb: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -/// Get the distance of an intersection with a [`BoundingSphere`], if any. - - #[lua()] - fn sphere_intersection_at( - _self: LuaReflectRefProxy, - sphere: LuaReflectRefProxy, - ) -> std::option::Option; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RayCast3d { - origin: ReflectReference, - direction: bevy::math::prelude::Dir3A, - max: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::AabbCast3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. - - #[lua()] - fn from_ray( - aabb: LuaReflectValProxy, - ray: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the distance at which the [`Aabb3d`]s collide, if at all. - - #[lua()] - fn aabb_collision_at( - _self: LuaReflectRefProxy, - aabb: LuaReflectValProxy, - ) -> std::option::Option; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AabbCast3d { - ray: bevy::math::bounding::RayCast3d, - aabb: bevy::math::bounding::Aabb3d, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::bounding::BoundingSphereCast", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. - - #[lua()] - fn from_ray( - sphere: LuaReflectValProxy, - ray: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the distance at which the [`BoundingSphere`]s collide, if at all. - - #[lua()] - fn sphere_collision_at( - _self: LuaReflectRefProxy, - sphere: LuaReflectValProxy, - ) -> std::option::Option; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BoundingSphereCast { - ray: bevy::math::bounding::RayCast3d, - sphere: bevy::math::bounding::BoundingSphere, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::curve::interval::Interval", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Get the start of this interval. - - #[lua()] - fn start(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Get the end of this interval. - - #[lua()] - fn end(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). - - #[lua()] - fn length(_self: LuaReflectValProxy) -> 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()] - fn is_bounded( - _self: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -/// Returns `true` if this interval has a finite start. - - #[lua()] - fn has_finite_start( - _self: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -/// Returns `true` if this interval has a finite end. - - #[lua()] - fn has_finite_end( - _self: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -/// Returns `true` if `item` is contained in this interval. - - #[lua()] - fn contains( - _self: LuaReflectValProxy, - 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()] - fn contains_interval( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> bool; - -"#, - r#" -/// Clamp the given `value` to lie within this interval. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - value: f32, - ) -> f32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Interval {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::FloatOrd", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::PartialOrd::")] - fn lt( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialOrd::")] - fn le( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialOrd::")] - fn gt( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::PartialOrd::")] - fn ge( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct FloatOrd(f32); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Plane3d", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Plane3d { - normal: bevy::math::prelude::Dir3, - half_size: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::primitives::Tetrahedron", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Get the signed volume of the tetrahedron. -/// If it's negative, the normal vector of the face defined by -/// the first three points using the right-hand rule points -/// away from the fourth vertex. - - #[lua()] - fn signed_volume( - _self: LuaReflectRefProxy, - ) -> f32; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Tetrahedron { - vertices: ReflectReference, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::curve::easing::EaseFunction", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct EaseFunction {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance( - "Isometry2d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Isometry3d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Rot2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Dir2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Dir3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Dir3A", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("IRect", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Rect", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("URect", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Circle", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "Annulus", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Arc2d", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "Capsule2d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "CircularSector", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "CircularSegment", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Ellipse", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Rectangle", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "RegularPolygon", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Rhombus", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Segment2d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Sphere", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Cuboid", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "Cylinder", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Capsule3d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Cone", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "Segment3d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Torus", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "RayCast2d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AabbCast2d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BoundingCircleCast", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "RayCast3d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AabbCast3d", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BoundingSphereCast", - crate::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -fn bevy_math_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyMathScriptingPlugin; -impl bevy::app::Plugin for BevyMathScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_math_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyMathAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .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::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::>() - .process_type::() - .process_type::() - .process_type::() - .process_type::>() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .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::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::>() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs deleted file mode 100644 index 6bb04c7024..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_reflect.rs +++ /dev/null @@ -1,24798 +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 bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicBool", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new `AtomicBool`. -/// # Examples -/// ``` -/// use std::sync::atomic::AtomicBool; -/// let atomic_true = AtomicBool::new(true); -/// let atomic_false = AtomicBool::new(false); -/// ``` - - #[lua()] - fn new(v: bool) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicBool {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicI16", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI16; -///let atomic_forty_two = AtomicI16::new(42); -/// ``` - - #[lua()] - fn new(v: i16) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> i16; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicI16 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicI32", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI32; -///let atomic_forty_two = AtomicI32::new(42); -/// ``` - - #[lua()] - fn new(v: i32) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicI32 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicI64", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI64; -///let atomic_forty_two = AtomicI64::new(42); -/// ``` - - #[lua()] - fn new(v: i64) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicI64 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicI8", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicI8; -///let atomic_forty_two = AtomicI8::new(42); -/// ``` - - #[lua()] - fn new(v: i8) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> i8; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicI8 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicIsize", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicIsize; -///let atomic_forty_two = AtomicIsize::new(42); -/// ``` - - #[lua()] - fn new(v: isize) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> isize; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicIsize {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicU16", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU16; -///let atomic_forty_two = AtomicU16::new(42); -/// ``` - - #[lua()] - fn new(v: u16) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> u16; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicU16 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicU32", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU32; -///let atomic_forty_two = AtomicU32::new(42); -/// ``` - - #[lua()] - fn new(v: u32) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicU32 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicU64", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU64; -///let atomic_forty_two = AtomicU64::new(42); -/// ``` - - #[lua()] - fn new(v: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicU64 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicU8", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicU8; -///let atomic_forty_two = AtomicU8::new(42); -/// ``` - - #[lua()] - fn new(v: u8) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> u8; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicU8 {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::sync::atomic::AtomicUsize", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new atomic integer. -/// # Examples -/// ``` -///use std::sync::atomic::AtomicUsize; -///let atomic_forty_two = AtomicUsize::new(42); -/// ``` - - #[lua()] - fn new(v: usize) -> LuaReflectValProxy; - -"#, - 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()] - fn into_inner(_self: LuaReflectValProxy) -> usize; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct AtomicUsize {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::utils::Duration", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> 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()] - fn new(secs: u64, nanos: u32) -> LuaReflectValProxy; - -"#, - 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()] - fn from_secs(secs: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn from_millis(millis: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn from_micros(micros: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn from_nanos(nanos: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn is_zero(_self: LuaReflectRefProxy) -> 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()] - fn as_secs(_self: LuaReflectRefProxy) -> 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()] - fn subsec_millis(_self: LuaReflectRefProxy) -> 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()] - fn subsec_micros(_self: LuaReflectRefProxy) -> 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()] - fn subsec_nanos(_self: LuaReflectRefProxy) -> 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()] - fn as_millis(_self: LuaReflectRefProxy) -> 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()] - fn as_micros(_self: LuaReflectRefProxy) -> 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()] - fn as_nanos(_self: LuaReflectRefProxy) -> 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()] - fn abs_diff( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Saturating `Duration` multiplication. Computes `self * other`, returning -/// [`Duration::MAX`] if overflow occurred. -/// # Examples -/// ``` -/// #![feature(duration_constants)] -/// use std::time::Duration; -/// assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); -/// assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX); -/// ``` - - #[lua()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the number of seconds contained by this `Duration` as `f64`. -/// The returned value includes the fractional (nanosecond) part of the duration. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.as_secs_f64(), 2.7); -/// ``` - - #[lua()] - fn as_secs_f64(_self: LuaReflectRefProxy) -> f64; - -"#, - r#" -/// Returns the number of seconds contained by this `Duration` as `f32`. -/// The returned value includes the fractional (nanosecond) part of the duration. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.as_secs_f32(), 2.7); -/// ``` - - #[lua()] - fn as_secs_f32(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Creates a new `Duration` from the specified number of seconds represented -/// as `f64`. -/// # Panics -/// This constructor will panic if `secs` is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let res = Duration::from_secs_f64(0.0); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f64(1e-20); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f64(4.2e-7); -/// assert_eq!(res, Duration::new(0, 420)); -/// let res = Duration::from_secs_f64(2.7); -/// assert_eq!(res, Duration::new(2, 700_000_000)); -/// let res = Duration::from_secs_f64(3e10); -/// assert_eq!(res, Duration::new(30_000_000_000, 0)); -/// // subnormal float -/// let res = Duration::from_secs_f64(f64::from_bits(1)); -/// assert_eq!(res, Duration::new(0, 0)); -/// // conversion uses rounding -/// let res = Duration::from_secs_f64(0.999e-9); -/// assert_eq!(res, Duration::new(0, 1)); -/// ``` - - #[lua()] - fn from_secs_f64(secs: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new `Duration` from the specified number of seconds represented -/// as `f32`. -/// # Panics -/// This constructor will panic if `secs` is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let res = Duration::from_secs_f32(0.0); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f32(1e-20); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f32(4.2e-7); -/// assert_eq!(res, Duration::new(0, 420)); -/// let res = Duration::from_secs_f32(2.7); -/// assert_eq!(res, Duration::new(2, 700_000_048)); -/// let res = Duration::from_secs_f32(3e10); -/// assert_eq!(res, Duration::new(30_000_001_024, 0)); -/// // subnormal float -/// let res = Duration::from_secs_f32(f32::from_bits(1)); -/// assert_eq!(res, Duration::new(0, 0)); -/// // conversion uses rounding -/// let res = Duration::from_secs_f32(0.999e-9); -/// assert_eq!(res, Duration::new(0, 1)); -/// ``` - - #[lua()] - fn from_secs_f32(secs: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies `Duration` by `f64`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000)); -/// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0)); -/// ``` - - #[lua()] - fn mul_f64( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies `Duration` by `f32`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// 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(847_800, 0)); -/// ``` - - #[lua()] - fn mul_f32( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides `Duration` by `f64`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611)); -/// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599)); -/// ``` - - #[lua()] - fn div_f64( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides `Duration` by `f32`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// // note that due to rounding errors result is slightly -/// // different from 0.859_872_611 -/// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_580)); -/// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599)); -/// ``` - - #[lua()] - fn div_f32( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn div_duration_f64( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn div_duration_f32( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Duration {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::utils::Instant", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns an instant corresponding to "now". -/// # Examples -/// ``` -/// use std::time::Instant; -/// let now = Instant::now(); -/// ``` - - #[lua()] - fn now() -> LuaReflectValProxy; - -"#, - 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 `earlier` was later than `self`. Currently this -/// method saturates. Future versions may reintroduce the panic in some circumstances. -/// See [Monotonicity]. -/// [Monotonicity]: Instant#monotonicity -/// # Examples -/// ```no_run -/// use std::time::{Duration, Instant}; -/// use std::thread::sleep; -/// let now = Instant::now(); -/// sleep(Duration::new(1, 0)); -/// let new_now = Instant::now(); -/// println!("{:?}", new_now.duration_since(now)); -/// println!("{:?}", now.duration_since(new_now)); // 0ns -/// ``` - - #[lua()] - fn duration_since( - _self: LuaReflectRefProxy, - earlier: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the amount of time elapsed from another instant to this one, -/// or zero duration if that instant is later than this one. -/// # Examples -/// ```no_run -/// use std::time::{Duration, Instant}; -/// use std::thread::sleep; -/// let now = Instant::now(); -/// sleep(Duration::new(1, 0)); -/// let new_now = Instant::now(); -/// println!("{:?}", new_now.saturating_duration_since(now)); -/// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns -/// ``` - - #[lua()] - fn saturating_duration_since( - _self: LuaReflectRefProxy, - earlier: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the amount of time elapsed since this instant. -/// # Panics -/// Previous Rust versions panicked when the current time was earlier than self. Currently this -/// method returns a Duration of zero in that case. Future versions may reintroduce the panic. -/// See [Monotonicity]. -/// [Monotonicity]: Instant#monotonicity -/// # Examples -/// ```no_run -/// use std::thread::sleep; -/// use std::time::{Duration, Instant}; -/// let instant = Instant::now(); -/// let three_secs = Duration::from_secs(3); -/// sleep(three_secs); -/// assert!(instant.elapsed() >= three_secs); -/// ``` - - #[lua()] - fn elapsed( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// # 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. - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - other: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Instant(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::path::PathBuf", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Allocates an empty `PathBuf`. -/// # Examples -/// ``` -/// use std::path::PathBuf; -/// let path = PathBuf::new(); -/// ``` - - #[lua()] - fn new() -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new `PathBuf` with a given capacity used to create the -/// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`]. -/// # Examples -/// ``` -/// use std::path::PathBuf; -/// let mut path = PathBuf::with_capacity(10); -/// let capacity = path.capacity(); -/// // This push is done without reallocating -/// path.push(r"C:\"); -/// assert_eq!(capacity, path.capacity()); -/// ``` -/// [`with_capacity`]: OsString::with_capacity - - #[lua()] - fn with_capacity(capacity: usize) -> LuaReflectValProxy; - -"#, - r#" -/// Truncates `self` to [`self.parent`]. -/// Returns `false` and does nothing if [`self.parent`] is [`None`]. -/// Otherwise, returns `true`. -/// [`self.parent`]: Path::parent -/// # Examples -/// ``` -/// use std::path::{Path, PathBuf}; -/// let mut p = PathBuf::from("/spirited/away.rs"); -/// p.pop(); -/// assert_eq!(Path::new("/spirited"), p); -/// p.pop(); -/// assert_eq!(Path::new("/"), p); -/// ``` - - #[lua()] - fn pop(_self: LuaReflectRefMutProxy) -> bool; - -"#, - r#" -/// Invokes [`capacity`] on the underlying instance of [`OsString`]. -/// [`capacity`]: OsString::capacity - - #[lua()] - fn capacity(_self: LuaReflectRefProxy) -> usize; - -"#, - r#" -/// Invokes [`clear`] on the underlying instance of [`OsString`]. -/// [`clear`]: OsString::clear - - #[lua()] - fn clear(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Invokes [`reserve`] on the underlying instance of [`OsString`]. -/// [`reserve`]: OsString::reserve - - #[lua()] - fn reserve( - _self: LuaReflectRefMutProxy, - additional: usize, - ) -> (); - -"#, - r#" -/// Invokes [`reserve_exact`] on the underlying instance of [`OsString`]. -/// [`reserve_exact`]: OsString::reserve_exact - - #[lua()] - fn reserve_exact( - _self: LuaReflectRefMutProxy, - additional: usize, - ) -> (); - -"#, - r#" -/// Invokes [`shrink_to_fit`] on the underlying instance of [`OsString`]. -/// [`shrink_to_fit`]: OsString::shrink_to_fit - - #[lua()] - fn shrink_to_fit(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Invokes [`shrink_to`] on the underlying instance of [`OsString`]. -/// [`shrink_to`]: OsString::shrink_to - - #[lua()] - fn shrink_to( - _self: LuaReflectRefMutProxy, - min_capacity: usize, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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")] - fn clone_from( - _self: LuaReflectRefMutProxy, - source: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct PathBuf {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "std::ops::RangeFull", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct RangeFull {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Quat", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a new rotation quaternion. -/// This should generally not be called manually unless you know what you are doing. -/// Use one of the other constructors instead such as `identity` or `from_axis_angle`. -/// `from_xyzw` is mostly used by unit tests and `serde` deserialization. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua()] - fn from_xyzw(x: f32, y: f32, z: f32, w: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a rotation quaternion from an array. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua()] - fn from_array(a: [f32; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new rotation quaternion from a 4D vector. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua()] - fn from_vec4( - v: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). -/// The axis must be a unit vector. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. -/// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. - - #[lua()] - fn from_scaled_axis( - v: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the x axis. - - #[lua()] - fn from_rotation_x(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the y axis. - - #[lua()] - fn from_rotation_y(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the z axis. - - #[lua()] - fn from_rotation_z(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). - - #[lua()] - fn from_euler( - euler: LuaReflectValProxy, - a: f32, - b: f32, - c: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat3( - mat: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat3a( - mat: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn from_mat4( - mat: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the -/// plane spanned by the two vectors. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_arc( - from: LuaReflectValProxy, - to: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means -/// that the resulting quaternion will rotate `from` so that it is colinear with `to`. -/// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 -/// degrees. -/// The inputs must be unit vectors. -/// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_arc_colinear( - from: LuaReflectValProxy, - to: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is -/// around the z axis. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc_2d(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_arc_2d( - from: LuaReflectValProxy, - to: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the rotation axis scaled by the rotation in radians. - - #[lua()] - fn to_scaled_axis( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the rotation angles for the given euler rotation sequence. - - #[lua()] - fn to_euler( - _self: LuaReflectValProxy, - order: LuaReflectValProxy, - ) -> (f32, f32, f32); - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f32; 4]; - -"#, - r#" -/// Returns the vector part of the quaternion. - - #[lua()] - fn xyz( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the quaternion conjugate of `self`. For a unit quaternion the -/// conjugate is also the inverse. - - #[lua()] - fn conjugate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the inverse of a normalized quaternion. -/// Typically quaternion inverse returns the conjugate of a normalized quaternion. -/// Because `self` is assumed to already be unit length this method *does not* normalize -/// before returning the conjugate. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. The dot product is -/// equal to the cosine of the angle between two quaternion rotations. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is generally faster than `length()` as it avoids a square -/// root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero. -/// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NAN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns whether `self` of length `1.0` or not. -/// Uses a precision threshold of `1e-6`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" - - #[lua()] - fn is_near_identity(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the angle (in radians) for the minimal rotation -/// for transforming this quaternion into another. -/// Both quaternions must be normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn rotate_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_angle: f32, - ) -> LuaReflectValProxy; - -"#, - 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 quaternions 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. -/// # Panics -/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - end: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn slerp( - _self: LuaReflectValProxy, - end: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn mul_vec3( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn mul_quat( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_affine3( - a: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a quaternion and a 3D vector, returning the rotated vector. - - #[lua()] - fn mul_vec3a( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_dquat( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Quat(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Vec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f32, y: f32, z: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f32; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f32; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f32, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f32, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn any_orthogonal_vector( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn any_orthonormal_vector( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::Vec3>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::Vec3>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::Vec3>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::Vec3>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::Vec3>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct Vec3 { - x: f32, - y: f32, - z: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::IVec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::IVec2>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::IVec2>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::IVec2>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::IVec2>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i32, y: i32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i32; 2]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i32; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - z: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector that is equal to `self` rotated by 90 degrees. - - #[lua()] - fn perp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua()] - fn perp_dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua()] - fn rotate( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::IVec2>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: i32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct IVec2 { - x: i32, - y: i32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::IVec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::IVec3>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::IVec3>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::IVec3>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::IVec3>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i32, y: i32, z: i32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i32; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i32; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3a( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::IVec3>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: i32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct IVec3 { - x: i32, - y: i32, - z: i32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::IVec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::IVec4>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::IVec4>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::IVec4>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: i32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::IVec4>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::IVec4>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i32, y: i32, z: i32, w: i32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i32; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i32; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`IVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua()] - fn with_w( - _self: LuaReflectValProxy, - w: i32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> i32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: i32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct IVec4 { - x: i32, - y: i32, - z: i32, - w: i32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::I64Vec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::I64Vec2>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::I64Vec2>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::I64Vec2>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i64, y: i64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i64; 2]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - z: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i64::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector that is equal to `self` rotated by 90 degrees. - - #[lua()] - fn perp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua()] - fn perp_dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua()] - fn rotate( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::I64Vec2>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::I64Vec2>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct I64Vec2 { - x: i64, - y: i64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::I64Vec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::I64Vec3>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::I64Vec3>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::I64Vec3>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::I64Vec3>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::I64Vec3>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i64, y: i64, z: i64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i64; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i64::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3a( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct I64Vec3 { - x: i64, - y: i64, - z: i64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::I64Vec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::I64Vec4>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: i64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::I64Vec4>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::I64Vec4>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: i64, y: i64, z: i64, w: i64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: i64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [i64; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [i64; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`I64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua()] - fn with_w( - _self: LuaReflectValProxy, - w: i64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> i64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> i64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i64::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn wrapping_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_add_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua()] - fn saturating_sub_unsigned( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::I64Vec4>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::I64Vec4>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct I64Vec4 { - x: i64, - y: i64, - z: i64, - w: i64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::UVec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::UVec2>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::UVec2>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::UVec2>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: u32, y: u32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: u32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [u32; 2]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [u32; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - z: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> u32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::UVec2>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::UVec2>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: u32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct UVec2 { - x: u32, - y: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::UVec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::UVec3>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::UVec3>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::UVec3>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::UVec3>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::UVec3>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: u32, y: u32, z: u32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: u32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [u32; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [u32; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> u32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3a( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: u32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct UVec3 { - x: u32, - y: u32, - z: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::UVec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::UVec4>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: u32, y: u32, z: u32, w: u32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: u32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [u32; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [u32; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`UVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua()] - fn with_w( - _self: LuaReflectValProxy, - w: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> u32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::UVec4>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::UVec4>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::UVec4>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::UVec4>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: u32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct UVec4 { - x: u32, - y: u32, - z: u32, - w: u32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::U64Vec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::U64Vec2>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::U64Vec2>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::U64Vec2>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::U64Vec2>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::U64Vec2>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: u64, y: u64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [u64; 2]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [u64; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - z: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> u64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct U64Vec2 { - x: u64, - y: u64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::U64Vec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new vector. - - #[lua()] - fn new(x: u64, y: u64, z: u64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [u64; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [u64; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> u64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3a( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::U64Vec3>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::U64Vec3>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::U64Vec3>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::U64Vec3>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::U64Vec3>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct U64Vec3 { - x: u64, - y: u64, - z: u64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::U64Vec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::U64Vec4>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: u64, y: u64, z: u64, w: u64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [u64; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [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()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua()] - fn with_w( - _self: LuaReflectValProxy, - w: u64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> u64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> u64; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn wrapping_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn saturating_add_signed( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::U64Vec4>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::U64Vec4>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::U64Vec4>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::U64Vec4>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: u64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct U64Vec4 { - x: u64, - y: u64, - z: u64, - w: u64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Vec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::Vec2>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::Vec2>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::Vec2>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f32, y: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f32; 2]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f32; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f32, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f32, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in -/// conjunction with the [`rotate()`][Self::rotate()] method, e.g. -/// `Vec2::from_angle(PI).rotate(Vec2::Y)` will create the vector `[-1, 0]` -/// and rotate [`Vec2::Y`] around it returning `-Vec2::Y`. - - #[lua()] - fn from_angle(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the angle (in radians) of this vector in the range `[-π, +π]`. -/// The input does not need to be a unit vector however it must be non-zero. - - #[lua()] - fn to_angle(_self: LuaReflectValProxy) -> f32; - -"#, - r#" - - #[lua()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn angle_to( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns a vector that is equal to `self` rotated by 90 degrees. - - #[lua()] - fn perp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua()] - fn perp_dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua()] - fn rotate( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn rotate_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::Vec2>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::Vec2>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct Vec2 { - x: f32, - y: f32, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Vec3A", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::Vec3A>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::Vec3A>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::Vec3A>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f32, y: f32, z: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f32; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [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()] - fn from_vec4( - v: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f32, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f32, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn any_orthogonal_vector( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn any_orthonormal_vector( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::Vec3A>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::Vec3A>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct Vec3A(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Vec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::Vec4>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::Vec4>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::Vec4>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::Vec4>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f32, y: f32, z: f32, w: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f32) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f32; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f32; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. -/// To truncate to [`Vec3A`] use [`Vec3A::from()`]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua()] - fn with_w( - _self: LuaReflectValProxy, - w: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f32, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f32, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f64`. - - #[lua()] - fn as_dvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::Vec4>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f32) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct Vec4(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::BVec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a new vector mask. - - #[lua()] - fn new(x: bool, y: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua()] - fn splat(v: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua()] - fn from_array(a: [bool; 2]) -> LuaReflectValProxy; - -"#, - 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()] - fn bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns true if any of the elements are true, false otherwise. - - #[lua()] - fn any(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns true if all the elements are true, false otherwise. - - #[lua()] - fn all(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Tests the value at `index`. -/// Panics if `index` is greater than 1. - - #[lua()] - fn test(_self: LuaReflectRefProxy, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 1. - - #[lua()] - fn set( - _self: LuaReflectRefMutProxy, - index: usize, - value: bool, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BVec2 { - x: bool, - y: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::BVec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new vector mask. - - #[lua()] - fn new(x: bool, y: bool, z: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua()] - fn splat(v: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua()] - fn from_array(a: [bool; 3]) -> LuaReflectValProxy; - -"#, - 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()] - fn bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns true if any of the elements are true, false otherwise. - - #[lua()] - fn any(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns true if all the elements are true, false otherwise. - - #[lua()] - fn all(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Tests the value at `index`. -/// Panics if `index` is greater than 2. - - #[lua()] - fn test(_self: LuaReflectRefProxy, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 2. - - #[lua()] - fn set( - _self: LuaReflectRefMutProxy, - index: usize, - value: bool, - ) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BVec3 { - x: bool, - y: bool, - z: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::BVec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector mask. - - #[lua()] - fn new(x: bool, y: bool, z: bool, w: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua()] - fn splat(v: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua()] - fn from_array(a: [bool; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 4 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()] - fn bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns true if any of the elements are true, false otherwise. - - #[lua()] - fn any(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns true if all the elements are true, false otherwise. - - #[lua()] - fn all(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Tests the value at `index`. -/// Panics if `index` is greater than 3. - - #[lua()] - fn test(_self: LuaReflectRefProxy, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 3. - - #[lua()] - fn set( - _self: LuaReflectRefMutProxy, - index: usize, - value: bool, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BVec4 { - x: bool, - y: bool, - z: bool, - w: bool, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DVec2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::DVec2>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f64, y: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f64; 2]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f64; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - z: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f64::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f64, - max: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f64, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in -/// conjunction with the [`rotate()`][Self::rotate()] method, e.g. -/// `DVec2::from_angle(PI).rotate(DVec2::Y)` will create the vector `[-1, 0]` -/// and rotate [`DVec2::Y`] around it returning `-DVec2::Y`. - - #[lua()] - fn from_angle(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the angle (in radians) of this vector in the range `[-π, +π]`. -/// The input does not need to be a unit vector however it must be non-zero. - - #[lua()] - fn to_angle(_self: LuaReflectValProxy) -> f64; - -"#, - r#" - - #[lua()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn angle_to( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns a vector that is equal to `self` rotated by 90 degrees. - - #[lua()] - fn perp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua()] - fn perp_dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua()] - fn rotate( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn rotate_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_angle: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::DVec2>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::DVec2>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::DVec2>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::DVec2>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f64) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct DVec2 { - x: f64, - y: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DVec3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::DVec3>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::DVec3>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::DVec3>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::DVec3>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::DVec3>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f64, y: f64, z: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f64; 3]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f64; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua()] - fn extend( - _self: LuaReflectValProxy, - w: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua()] - fn cross( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f64::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f64, - max: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f64, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - 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()] - fn any_orthogonal_vector( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn any_orthonormal_vector( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec3a( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f64) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct DVec3 { - x: f64, - y: f64, - z: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DVec4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new vector. - - #[lua()] - fn new(x: f64, y: f64, z: f64, w: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua()] - fn splat(v: f64) -> LuaReflectValProxy; - -"#, - 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()] - fn select( - mask: LuaReflectValProxy, - if_true: LuaReflectValProxy, - if_false: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua()] - fn from_array(a: [f64; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f64; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`DVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua()] - fn truncate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua()] - fn with_x( - _self: LuaReflectValProxy, - x: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua()] - fn with_y( - _self: LuaReflectValProxy, - y: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua()] - fn with_z( - _self: LuaReflectValProxy, - z: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua()] - fn with_w( - _self: LuaReflectValProxy, - w: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua()] - fn dot_into_vec( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua()] - fn min( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua()] - fn max( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua()] - fn clamp( - _self: LuaReflectValProxy, - min: LuaReflectValProxy, - max: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua()] - fn min_element(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua()] - fn max_element(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua()] - fn element_sum(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua()] - fn element_product(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpeq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpne( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpge( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmpgt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmple( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua()] - fn cmplt( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua()] - fn abs( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua()] - fn signum( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua()] - fn copysign( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua()] - fn is_negative_bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> 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()] - fn is_finite_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - 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(), ...]`. - - #[lua()] - fn is_nan_mask( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua()] - fn distance( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua()] - fn distance_squared( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua()] - fn div_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f64::rem_euclid - - #[lua()] - fn rem_euclid( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or( - _self: LuaReflectValProxy, - fallback: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua()] - fn normalize_or_zero( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua()] - fn project_onto( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua()] - fn reject_from( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn project_onto_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn reject_from_normalized( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua()] - fn round( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua()] - fn floor( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua()] - fn ceil( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua()] - fn trunc( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua()] - fn fract_gl( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua()] - fn exp( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua()] - fn powf( - _self: LuaReflectValProxy, - n: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua()] - fn recip( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - s: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua()] - fn move_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - d: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua()] - fn midpoint( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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 vectors 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// Will panic if `min` is greater than `max`, or if either `min` or `max` is negative, when `glam_assert` is enabled. - - #[lua()] - fn clamp_length( - _self: LuaReflectValProxy, - min: f64, - max: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no more than `max`. -/// # Panics -/// Will panic if `max` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_max( - _self: LuaReflectValProxy, - max: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a vector with a length no less than `min`. -/// # Panics -/// Will panic if `min` is negative when `glam_assert` is enabled. - - #[lua()] - fn clamp_length_min( - _self: LuaReflectValProxy, - min: f64, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn mul_add( - _self: LuaReflectValProxy, - a: LuaReflectValProxy, - b: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn reflect( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn refract( - _self: LuaReflectValProxy, - normal: LuaReflectValProxy, - eta: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua()] - fn as_vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i32`. - - #[lua()] - fn as_ivec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u32`. - - #[lua()] - fn as_uvec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `i64`. - - #[lua()] - fn as_i64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua()] - fn as_u64vec4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::<&bevy::math::DVec4>", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Rem::", composite = "rem", metamethod = "Mod")] - fn rem( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::<&bevy::math::DVec4>", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::<&bevy::math::DVec4>", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Sub::", composite = "sub", metamethod = "Sub")] - fn sub( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::<&bevy::math::DVec4>", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Add::", composite = "add", metamethod = "Add")] - fn add( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div::<&bevy::math::DVec4>", - composite = "div", - metamethod = "Div", - )] - fn div( - _self: LuaReflectValProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem::", - composite = "rem", - metamethod = "Mod", - )] - fn rem( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index")] -fn index(self, idx: usize) -> LuaIdentityProxy { - _self[idx - 1] -} -"#, - r#" -#[lua(metamethod="NewIndex")] -fn index(&mut self, idx: usize, val: f64) -> () { - _self[idx - 1] = val -} -"#] -)] -pub struct DVec4 { - x: f64, - y: f64, - z: f64, - w: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Mat2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix from two column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [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()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 2]; 2]; - -"#, - r#" -/// Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of -/// `angle` (in radians). - - #[lua()] - fn from_scale_angle( - scale: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - - #[lua()] - fn from_angle(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat3_minor( - m: LuaReflectValProxy, - i: usize, - j: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - - #[lua()] - fn from_mat3a( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat3a_minor( - m: LuaReflectValProxy, - i: usize, - j: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 2D vector. - - #[lua()] - fn mul_vec2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 2x2 matrices. - - #[lua()] - fn mul_mat2( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 2x2 matrices. - - #[lua()] - fn add_mat2( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 2x2 matrices. - - #[lua()] - fn sub_mat2( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 2x2 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 2x2 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_dmat2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct Mat2(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Mat3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3x3 matrix from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f32; 9]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 9]; - -"#, - r#" -/// Creates a `[[f32; 3]; 3]` 3D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 3]; 3]; - -"#, - r#" -/// Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - - #[lua()] - fn from_mat4( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat4_minor( - m: LuaReflectValProxy, - i: usize, - j: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from the given quaternion. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in -/// radians). -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in -/// radians). - - #[lua()] - fn from_euler( - order: LuaReflectValProxy, - a: f32, - b: f32, - c: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn to_euler( - _self: LuaReflectRefProxy, - order: LuaReflectValProxy, - ) -> (f32, f32, f32); - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. - - #[lua()] - fn from_rotation_x(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - - #[lua()] - fn from_rotation_y(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - - #[lua()] - fn from_rotation_z(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D rotation `angle` (in -/// radians). -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_angle(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in -/// radians) and `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_scale_angle_translation( - scale: LuaReflectValProxy, - angle: f32, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2x2 matrix. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_mat2( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D vector as a point. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_point2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Rotates the given 2D vector. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_vector2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 3D vector. - - #[lua()] - fn mul_vec3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a [`Vec3A`]. - - #[lua()] - fn mul_vec3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 3x3 matrices. - - #[lua()] - fn mul_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 3x3 matrices. - - #[lua()] - fn add_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 3x3 matrices. - - #[lua()] - fn sub_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 3x3 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 3x3 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_dmat3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct Mat3 { - x_axis: bevy::math::Vec3, - y_axis: bevy::math::Vec3, - z_axis: bevy::math::Vec3, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Mat3A", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3x3 matrix from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f32; 9]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 9]; - -"#, - r#" -/// Creates a `[[f32; 3]; 3]` 3D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 3]; 3]; - -"#, - r#" -/// Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - - #[lua()] - fn from_mat4( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat4_minor( - m: LuaReflectValProxy, - i: usize, - j: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from the given quaternion. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in -/// radians). -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in -/// radians). - - #[lua()] - fn from_euler( - order: LuaReflectValProxy, - a: f32, - b: f32, - c: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn to_euler( - _self: LuaReflectRefProxy, - order: LuaReflectValProxy, - ) -> (f32, f32, f32); - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. - - #[lua()] - fn from_rotation_x(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - - #[lua()] - fn from_rotation_y(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - - #[lua()] - fn from_rotation_z(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D rotation `angle` (in -/// radians). -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_angle(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in -/// radians) and `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_scale_angle_translation( - scale: LuaReflectValProxy, - angle: f32, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2x2 matrix. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_mat2( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D vector as a point. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_point2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Rotates the given 2D vector. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_vector2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 3D vector. - - #[lua()] - fn mul_vec3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a [`Vec3A`]. - - #[lua()] - fn mul_vec3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 3x3 matrices. - - #[lua()] - fn mul_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 3x3 matrices. - - #[lua()] - fn add_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 3x3 matrices. - - #[lua()] - fn sub_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 3x3 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 3x3 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_dmat3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct Mat3A { - x_axis: bevy::math::Vec3A, - y_axis: bevy::math::Vec3A, - z_axis: bevy::math::Vec3A, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Mat4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4x4 matrix from four column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - w_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f32; 16]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 16]; - -"#, - r#" -/// Creates a `[[f32; 4]; 4]` 4D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 4]; 4]; - -"#, - r#" -/// Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `scale`, `rotation` and -/// `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_scale_rotation_translation( - scale: LuaReflectValProxy, - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_translation( - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given `rotation` quaternion. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3x3 linear transformation -/// matrix. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3x3 linear transformation -/// matrix. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_mat3a( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a affine transformation matrix containing a rotation from the given euler -/// rotation sequence and angles (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_euler( - order: LuaReflectValProxy, - a: f32, - b: f32, - c: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn to_euler( - _self: LuaReflectRefProxy, - order: LuaReflectValProxy, - ) -> (f32, f32, f32); - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the x axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_rotation_x(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the y axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_rotation_y(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the z axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_rotation_z(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing the given 3D non-uniform `scale`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua()] - fn look_to_lh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua()] - fn look_to_rh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_lh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_rh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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 - - #[lua()] - fn perspective_rh_gl( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - z_far: f32, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn perspective_lh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - z_far: f32, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn perspective_rh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - z_far: f32, - ) -> LuaReflectValProxy; - -"#, - 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` or `z_far` are less than or equal to zero when `glam_assert` is -/// enabled. - - #[lua()] - fn perspective_infinite_lh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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. - - #[lua()] - fn perspective_infinite_reverse_lh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn perspective_infinite_rh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn perspective_infinite_reverse_rh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed orthographic projection matrix with `[-1,1]` depth -/// 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()] - fn orthographic_rh_gl( - left: f32, - right: f32, - bottom: f32, - top: f32, - near: f32, - far: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn orthographic_lh( - left: f32, - right: f32, - bottom: f32, - top: f32, - near: f32, - far: f32, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn orthographic_rh( - left: f32, - right: f32, - bottom: f32, - top: f32, - near: f32, - far: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D vector as a point, applying perspective correction. -/// This is the equivalent of multiplying the 3D vector 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()] - fn project_point3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D vector as a point. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `1.0`. -/// This method assumes that `self` contains a valid affine transform. It does not perform -/// a perspective divide, if `self` contains a perspective transform, or if you are unsure, -/// the [`Self::project_point3()`] method should be used instead. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_point3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the give 3D vector as a direction. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `0.0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_vector3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn project_point3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given [`Vec3A`] as 3D point. -/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `1.0`. - - #[lua()] - fn transform_point3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the give [`Vec3A`] as 3D vector. -/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `0.0`. - - #[lua()] - fn transform_vector3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 4D vector. - - #[lua()] - fn mul_vec4( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 4x4 matrices. - - #[lua()] - fn mul_mat4( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 4x4 matrices. - - #[lua()] - fn add_mat4( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 4x4 matrices. - - #[lua()] - fn sub_mat4( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 4x4 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 4x4 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_dmat4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f32, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct Mat4 { - x_axis: bevy::math::Vec4, - y_axis: bevy::math::Vec4, - z_axis: bevy::math::Vec4, - w_axis: bevy::math::Vec4, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DMat2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a 2x2 matrix from two column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f64; 4]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 4]; - -"#, - r#" -/// Creates a `[[f64; 2]; 2]` 2D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f64; 2]; 2]; - -"#, - r#" -/// Creates a 2x2 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix containing the combining non-uniform `scale` and rotation of -/// `angle` (in radians). - - #[lua()] - fn from_scale_angle( - scale: LuaReflectValProxy, - angle: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - - #[lua()] - fn from_angle(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat3_minor( - m: LuaReflectValProxy, - i: usize, - j: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f64; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 2D vector. - - #[lua()] - fn mul_vec2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 2x2 matrices. - - #[lua()] - fn mul_mat2( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 2x2 matrices. - - #[lua()] - fn add_mat2( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 2x2 matrices. - - #[lua()] - fn sub_mat2( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 2x2 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 2x2 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_mat2( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct DMat2 { - x_axis: bevy::math::DVec2, - y_axis: bevy::math::DVec2, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DMat3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a 3x3 matrix from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f64; 9]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 9]; - -"#, - r#" -/// Creates a `[[f64; 3]; 3]` 3D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f64; 3]; 3]; - -"#, - r#" -/// Creates a 3x3 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - - #[lua()] - fn from_mat4( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat4_minor( - m: LuaReflectValProxy, - i: usize, - j: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from the given quaternion. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in -/// radians). -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in -/// radians). - - #[lua()] - fn from_euler( - order: LuaReflectValProxy, - a: f64, - b: f64, - c: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn to_euler( - _self: LuaReflectRefProxy, - order: LuaReflectValProxy, - ) -> (f64, f64, f64); - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the x axis. - - #[lua()] - fn from_rotation_x(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - - #[lua()] - fn from_rotation_y(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - - #[lua()] - fn from_rotation_z(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D rotation `angle` (in -/// radians). -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_angle(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in -/// radians) and `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_scale_angle_translation( - scale: LuaReflectValProxy, - angle: f64, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2x2 matrix. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua()] - fn from_mat2( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f64; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D vector as a point. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_point2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Rotates the given 2D vector. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_vector2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 3D vector. - - #[lua()] - fn mul_vec3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 3x3 matrices. - - #[lua()] - fn mul_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 3x3 matrices. - - #[lua()] - fn add_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 3x3 matrices. - - #[lua()] - fn sub_mat3( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 3x3 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 3x3 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_mat3( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct DMat3 { - x_axis: bevy::math::DVec3, - y_axis: bevy::math::DVec3, - z_axis: bevy::math::DVec3, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DMat4", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a 4x4 matrix from four column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - w_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f64; 16]` array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 16]; - -"#, - r#" -/// Creates a `[[f64; 4]; 4]` 4D array storing data in column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f64; 4]; 4]; - -"#, - r#" -/// Creates a 4x4 matrix with its diagonal set to `diagonal` and all other entries set to 0. - - #[lua()] - fn from_diagonal( - diagonal: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `scale`, `rotation` and -/// `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_scale_rotation_translation( - scale: LuaReflectValProxy, - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_translation( - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given `rotation` quaternion. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3x3 linear transformation -/// matrix. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a affine transformation matrix containing a rotation from the given euler -/// rotation sequence and angles (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_euler( - order: LuaReflectValProxy, - a: f64, - b: f64, - c: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn to_euler( - _self: LuaReflectRefProxy, - order: LuaReflectValProxy, - ) -> (f64, f64, f64); - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the x axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_rotation_x(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the y axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_rotation_y(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the z axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua()] - fn from_rotation_z(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation matrix containing the given 3D non-uniform `scale`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua()] - fn col( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua()] - fn row( - _self: LuaReflectRefProxy, - index: usize, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua()] - fn transpose( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua()] - fn determinant(_self: LuaReflectRefProxy) -> f64; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua()] - fn look_to_lh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua()] - fn look_to_rh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_lh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_rh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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 - - #[lua()] - fn perspective_rh_gl( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - z_far: f64, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn perspective_lh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - z_far: f64, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn perspective_rh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - z_far: f64, - ) -> LuaReflectValProxy; - -"#, - 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` or `z_far` are less than or equal to zero when `glam_assert` is -/// enabled. - - #[lua()] - fn perspective_infinite_lh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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. - - #[lua()] - fn perspective_infinite_reverse_lh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn perspective_infinite_rh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn perspective_infinite_reverse_rh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed orthographic projection matrix with `[-1,1]` depth -/// 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()] - fn orthographic_rh_gl( - left: f64, - right: f64, - bottom: f64, - top: f64, - near: f64, - far: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn orthographic_lh( - left: f64, - right: f64, - bottom: f64, - top: f64, - near: f64, - far: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn orthographic_rh( - left: f64, - right: f64, - bottom: f64, - top: f64, - near: f64, - far: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D vector as a point, applying perspective correction. -/// This is the equivalent of multiplying the 3D vector 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()] - fn project_point3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D vector as a point. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `1.0`. -/// This method assumes that `self` contains a valid affine transform. It does not perform -/// a perspective divide, if `self` contains a perspective transform, or if you are unsure, -/// the [`Self::project_point3()`] method should be used instead. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_point3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the give 3D vector as a direction. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `0.0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua()] - fn transform_vector3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms a 4D vector. - - #[lua()] - fn mul_vec4( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies two 4x4 matrices. - - #[lua()] - fn mul_mat4( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Adds two 4x4 matrices. - - #[lua()] - fn add_mat4( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Subtracts two 4x4 matrices. - - #[lua()] - fn sub_mat4( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a 4x4 matrix by a scalar. - - #[lua()] - fn mul_scalar( - _self: LuaReflectRefProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a 4x4 matrix by a scalar. - - #[lua()] - fn div_scalar( - _self: LuaReflectRefProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - 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/). - - #[lua()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua()] - fn abs( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_mat4( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(metamethod="Index", with_context, no_proxy)] -fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result { - let mut curr_ref = _self.0; - - let path = match idx { - 1 => "x_axis", - 2 => "y_axis", - 3 => "z_axis", - 4 => "w_axis", - _ => "unknown_axis" - }; - - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); - curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); - crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) -} -"#] -)] -pub struct DMat4 { - x_axis: bevy::math::DVec4, - y_axis: bevy::math::DVec4, - z_axis: bevy::math::DVec4, - w_axis: bevy::math::DVec4, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Affine2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates an affine transform from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f32; 6]` array storing data in column major order. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 6]; - -"#, - r#" -/// Creates a `[[f32; 2]; 3]` 2D array storing data in -/// column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d(_self: LuaReflectRefProxy) -> [[f32; 2]; 3]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given rotation `angle`. - - #[lua()] - fn from_angle(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation from the given 2D `translation`. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) - - #[lua()] - fn from_mat2( - matrix2: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a -/// translation vector. -/// Equivalent to -/// `Affine2::from_translation(translation) * Affine2::from_mat2(mat2)` - - #[lua()] - fn from_mat2_translation( - matrix2: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `Affine2::from_translation(translation) * -/// Affine2::from_angle(angle) * Affine2::from_scale(scale)` - - #[lua()] - fn from_scale_angle_translation( - scale: LuaReflectValProxy, - angle: f32, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 2D rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `Affine2::from_translation(translation) * Affine2::from_angle(angle)` - - #[lua()] - fn from_angle_translation( - angle: f32, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The given `Mat3` must be an affine transform, - - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The given [`Mat3A`] must be an affine transform, - - #[lua()] - fn from_mat3a( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D point, applying shear, scale, rotation and translation. - - #[lua()] - fn transform_point2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point2()`] instead. - - #[lua()] - fn transform_vector2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - 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 3x4 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()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Return the inverse of this transform. -/// Note that if the transform is not invertible the result will be invalid. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Affine2 { - matrix2: bevy::math::Mat2, - translation: bevy::math::Vec2, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::Affine3A", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - w_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f32; 12]` array storing data in column major order. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f32; 12]; - -"#, - r#" -/// Creates a `[[f32; 3]; 4]` 3D array storing data in -/// column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d( - _self: LuaReflectRefProxy, - ) -> [[f32; 3]; 4]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given `rotation` quaternion. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the x axis of -/// `angle` (in radians). - - #[lua()] - fn from_rotation_x(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the y axis of -/// `angle` (in radians). - - #[lua()] - fn from_rotation_y(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the z axis of -/// `angle` (in radians). - - #[lua()] - fn from_rotation_z(angle: f32) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation from the given 3D `translation`. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and -/// rotation) - - #[lua()] - fn from_mat3( - mat3: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) -/// and a translation vector. -/// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_mat3(mat3)` - - #[lua()] - fn from_mat3_translation( - mat3: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 3D `scale`, `rotation` and -/// `translation`. -/// Equivalent to `Affine3A::from_translation(translation) * -/// Affine3A::from_quat(rotation) * Affine3A::from_scale(scale)` - - #[lua()] - fn from_scale_rotation_translation( - scale: LuaReflectValProxy, - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 3D `rotation` and `translation`. -/// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_quat(rotation)` - - #[lua()] - fn from_rotation_translation( - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The given `Mat4` must be an affine transform, -/// i.e. contain no perspective transform. - - #[lua()] - fn from_mat4( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua()] - fn look_to_lh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua()] - fn look_to_rh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_lh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_rh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D points, applying shear, scale, rotation and translation. - - #[lua()] - fn transform_point3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point3()`] instead. - - #[lua()] - fn transform_vector3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given [`Vec3A`], applying shear, scale, rotation and translation. - - #[lua()] - fn transform_point3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given [`Vec3A`], applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point3a()`] instead. - - #[lua()] - fn transform_vector3a( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - 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 3x4 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()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f32, - ) -> bool; - -"#, - r#" -/// Return the inverse of this transform. -/// Note that if the transform is not invertible the result will be invalid. - - #[lua()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Affine3A { - matrix3: bevy::math::Mat3A, - translation: bevy::math::Vec3A, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DAffine2", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f64; 6]` array storing data in column major order. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 6]; - -"#, - r#" -/// Creates a `[[f64; 2]; 3]` 2D array storing data in -/// column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d( - _self: LuaReflectRefProxy, - ) -> [[f64; 2]; 3]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given rotation `angle`. - - #[lua()] - fn from_angle(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation from the given 2D `translation`. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) - - #[lua()] - fn from_mat2( - matrix2: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a -/// translation vector. -/// Equivalent to -/// `DAffine2::from_translation(translation) * DAffine2::from_mat2(mat2)` - - #[lua()] - fn from_mat2_translation( - matrix2: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `DAffine2::from_translation(translation) * -/// DAffine2::from_angle(angle) * DAffine2::from_scale(scale)` - - #[lua()] - fn from_scale_angle_translation( - scale: LuaReflectValProxy, - angle: f64, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 2D rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `DAffine2::from_translation(translation) * DAffine2::from_angle(angle)` - - #[lua()] - fn from_angle_translation( - angle: f64, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The given `DMat3` must be an affine transform, - - #[lua()] - fn from_mat3( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D point, applying shear, scale, rotation and translation. - - #[lua()] - fn transform_point2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 2D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point2()`] instead. - - #[lua()] - fn transform_vector2( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - 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 3x4 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()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - 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()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct DAffine2 { - matrix2: bevy::math::DMat2, - translation: bevy::math::DVec2, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DAffine3", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from three column vectors. - - #[lua()] - fn from_cols( - x_axis: LuaReflectValProxy, - y_axis: LuaReflectValProxy, - z_axis: LuaReflectValProxy, - w_axis: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a `[f64; 12]` array storing data in column major order. - - #[lua()] - fn to_cols_array(_self: LuaReflectRefProxy) -> [f64; 12]; - -"#, - r#" -/// Creates a `[[f64; 3]; 4]` 3D array storing data in -/// column major order. -/// If you require data in row major order `transpose` the matrix first. - - #[lua()] - fn to_cols_array_2d( - _self: LuaReflectRefProxy, - ) -> [[f64; 3]; 4]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua()] - fn from_scale( - scale: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given `rotation` quaternion. - - #[lua()] - fn from_quat( - rotation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the x axis of -/// `angle` (in radians). - - #[lua()] - fn from_rotation_x(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the y axis of -/// `angle` (in radians). - - #[lua()] - fn from_rotation_y(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the z axis of -/// `angle` (in radians). - - #[lua()] - fn from_rotation_z(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transformation from the given 3D `translation`. - - #[lua()] - fn from_translation( - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and -/// rotation) - - #[lua()] - fn from_mat3( - mat3: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) -/// and a translation vector. -/// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_mat3(mat3)` - - #[lua()] - fn from_mat3_translation( - mat3: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 3D `scale`, `rotation` and -/// `translation`. -/// Equivalent to `DAffine3::from_translation(translation) * -/// DAffine3::from_quat(rotation) * DAffine3::from_scale(scale)` - - #[lua()] - fn from_scale_rotation_translation( - scale: LuaReflectValProxy, - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates an affine transform from the given 3D `rotation` and `translation`. -/// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_quat(rotation)` - - #[lua()] - fn from_rotation_translation( - rotation: LuaReflectValProxy, - translation: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// The given `DMat4` must be an affine transform, -/// i.e. contain no perspective transform. - - #[lua()] - fn from_mat4( - m: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua()] - fn look_to_lh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua()] - fn look_to_rh( - eye: LuaReflectValProxy, - dir: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_lh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn look_at_rh( - eye: LuaReflectValProxy, - center: LuaReflectValProxy, - up: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D points, applying shear, scale, rotation and translation. - - #[lua()] - fn transform_point3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Transforms the given 3D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point3()`] instead. - - #[lua()] - fn transform_vector3( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua()] - fn is_finite(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua()] - fn is_nan(_self: LuaReflectRefProxy) -> bool; - -"#, - 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 3x4 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()] - fn abs_diff_eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - 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()] - fn inverse( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct DAffine3 { - matrix3: bevy::math::DMat3, - translation: bevy::math::DVec3, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::DQuat", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - 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::Add::", - composite = "add", - metamethod = "Add", - )] - fn add( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies a quaternion by a scalar value. -/// The product is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Mul::", composite = "mul", metamethod = "Mul")] - fn mul( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - 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::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new rotation quaternion. -/// This should generally not be called manually unless you know what you are doing. -/// Use one of the other constructors instead such as `identity` or `from_axis_angle`. -/// `from_xyzw` is mostly used by unit tests and `serde` deserialization. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua()] - fn from_xyzw( - x: f64, - y: f64, - z: f64, - w: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a rotation quaternion from an array. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua()] - fn from_array(a: [f64; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new rotation quaternion from a 4D vector. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua()] - fn from_vec4( - v: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). -/// The axis must be a unit vector. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_axis_angle( - axis: LuaReflectValProxy, - angle: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. -/// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. - - #[lua()] - fn from_scaled_axis( - v: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the x axis. - - #[lua()] - fn from_rotation_x(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the y axis. - - #[lua()] - fn from_rotation_y(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the z axis. - - #[lua()] - fn from_rotation_z(angle: f64) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). - - #[lua()] - fn from_euler( - euler: LuaReflectValProxy, - a: f64, - b: f64, - c: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_mat3( - mat: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn from_mat4( - mat: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the -/// plane spanned by the two vectors. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_arc( - from: LuaReflectValProxy, - to: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means -/// that the resulting quaternion will rotate `from` so that it is colinear with `to`. -/// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 -/// degrees. -/// The inputs must be unit vectors. -/// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_arc_colinear( - from: LuaReflectValProxy, - to: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is -/// around the z axis. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc_2d(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn from_rotation_arc_2d( - from: LuaReflectValProxy, - to: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the rotation axis scaled by the rotation in radians. - - #[lua()] - fn to_scaled_axis( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the rotation angles for the given euler rotation sequence. - - #[lua()] - fn to_euler( - _self: LuaReflectValProxy, - order: LuaReflectValProxy, - ) -> (f64, f64, f64); - -"#, - r#" -/// `[x, y, z, w]` - - #[lua()] - fn to_array(_self: LuaReflectRefProxy) -> [f64; 4]; - -"#, - r#" -/// Returns the vector part of the quaternion. - - #[lua()] - fn xyz( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the quaternion conjugate of `self`. For a unit quaternion the -/// conjugate is also the inverse. - - #[lua()] - fn conjugate( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the inverse of a normalized quaternion. -/// Typically quaternion inverse returns the conjugate of a normalized quaternion. -/// Because `self` is assumed to already be unit length this method *does not* normalize -/// before returning the conjugate. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - - #[lua()] - fn inverse( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. The dot product is -/// equal to the cosine of the angle between two quaternion rotations. - - #[lua()] - fn dot( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> f64; - -"#, - r#" -/// Computes the length of `self`. - - #[lua()] - fn length(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is generally faster than `length()` as it avoids a square -/// root operation. - - #[lua()] - fn length_squared(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua()] - fn length_recip(_self: LuaReflectValProxy) -> f64; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero. -/// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. - - #[lua()] - fn normalize( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua()] - fn is_finite(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NAN`. - - #[lua()] - fn is_nan(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns whether `self` of length `1.0` or not. -/// Uses a precision threshold of `1e-6`. - - #[lua()] - fn is_normalized(_self: LuaReflectValProxy) -> bool; - -"#, - r#" - - #[lua()] - fn is_near_identity(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns the angle (in radians) for the minimal rotation -/// for transforming this quaternion into another. -/// Both quaternions must be normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn angle_between( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> 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()] - fn rotate_towards( - _self: LuaReflectRefProxy, - rhs: LuaReflectValProxy, - max_angle: f64, - ) -> LuaReflectValProxy; - -"#, - 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 quaternions 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()] - fn abs_diff_eq( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - max_abs_diff: f64, - ) -> bool; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. -/// # Panics -/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - - #[lua()] - fn lerp( - _self: LuaReflectValProxy, - end: LuaReflectValProxy, - s: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -/// 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()] - fn slerp( - _self: LuaReflectValProxy, - end: LuaReflectValProxy, - s: f64, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn mul_vec3( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn mul_quat( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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()] - fn from_affine3( - a: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn as_quat( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - 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::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::ops::Neg", composite = "neg", metamethod = "Unm")] - fn neg( - _self: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Subtracts the `rhs` quaternion from `self`. -/// The difference is not guaranteed to be normalized. - - #[lua( - as_trait = "std::ops::Sub::", - composite = "sub", - metamethod = "Sub", - )] - fn sub( - _self: LuaReflectValProxy, - rhs: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Divides a quaternion by a scalar value. -/// The quotient is not guaranteed to be normalized. - - #[lua(as_trait = "std::ops::Div::", composite = "div", metamethod = "Div")] - fn div( - _self: LuaReflectValProxy, - rhs: f64, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct DQuat { - x: f64, - y: f64, - z: f64, - w: f64, -} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::EulerRot", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct EulerRot {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::BVec3A", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" -/// Creates a new vector mask. - - #[lua()] - fn new(x: bool, y: bool, z: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua()] - fn splat(v: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua()] - fn from_array(a: [bool; 3]) -> LuaReflectValProxy; - -"#, - 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()] - fn bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns true if any of the elements are true, false otherwise. - - #[lua()] - fn any(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns true if all the elements are true, false otherwise. - - #[lua()] - fn all(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Tests the value at `index`. -/// Panics if `index` is greater than 2. - - #[lua()] - fn test(_self: LuaReflectRefProxy, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 2. - - #[lua()] - fn set( - _self: LuaReflectRefMutProxy, - index: usize, - value: bool, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BVec3A(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::math::BVec4A", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - rhs: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -/// Creates a new vector mask. - - #[lua()] - fn new(x: bool, y: bool, z: bool, w: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua()] - fn splat(v: bool) -> LuaReflectValProxy; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua()] - fn from_array(a: [bool; 4]) -> LuaReflectValProxy; - -"#, - r#" -/// Returns a bitmask with the lowest 4 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()] - fn bitmask(_self: LuaReflectValProxy) -> u32; - -"#, - r#" -/// Returns true if any of the elements are true, false otherwise. - - #[lua()] - fn any(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Returns true if all the elements are true, false otherwise. - - #[lua()] - fn all(_self: LuaReflectValProxy) -> bool; - -"#, - r#" -/// Tests the value at `index`. -/// Panics if `index` is greater than 3. - - #[lua()] - fn test(_self: LuaReflectRefProxy, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 3. - - #[lua()] - fn set( - _self: LuaReflectRefMutProxy, - index: usize, - value: bool, - ) -> (); - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct BVec4A(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "smol_str::SmolStr", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua()] - fn to_string(_self: LuaReflectRefProxy) -> std::string::String; - -"#, - r#" - - #[lua()] - fn len(_self: LuaReflectRefProxy) -> usize; - -"#, - r#" - - #[lua()] - fn is_empty(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" - - #[lua()] - fn is_heap_allocated(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct SmolStr(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "uuid::Uuid", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq(_self: LuaReflectRefProxy) -> (); - -"#, - 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()] - fn nil() -> LuaReflectValProxy; - -"#, - 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()] - fn max() -> LuaReflectValProxy; - -"#, - 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()] - fn from_u128(v: u128) -> LuaReflectValProxy; - -"#, - 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()] - fn from_u128_le(v: u128) -> LuaReflectValProxy; - -"#, - 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()] - fn from_u64_pair(high_bits: u64, low_bits: u64) -> LuaReflectValProxy; - -"#, - 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()] - fn from_bytes(bytes: [u8; 16]) -> LuaReflectValProxy; - -"#, - 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()] - fn from_bytes_le(b: [u8; 16]) -> LuaReflectValProxy; - -"#, - 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()] - fn new_v4() -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone")] - fn clone(_self: LuaReflectRefProxy) -> LuaReflectValProxy; - -"#, - 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()] - fn get_version_num(_self: LuaReflectRefProxy) -> 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()] - fn as_u128(_self: LuaReflectRefProxy) -> 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()] - fn to_u128_le(_self: LuaReflectRefProxy) -> 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()] - fn as_u64_pair(_self: LuaReflectRefProxy) -> (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()); -/// ``` - - #[lua()] - fn into_bytes(_self: LuaReflectValProxy) -> [u8; 16]; - -"#, - 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()] - fn to_bytes_le(_self: LuaReflectRefProxy) -> [u8; 16]; - -"#, - r#" -/// Tests if the UUID is nil (all zeros). - - #[lua()] - fn is_nil(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Tests if the UUID is max (all ones). - - #[lua()] - fn is_max(_self: LuaReflectRefProxy) -> 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 -/// ``` -/// # 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()] - 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()] - fn get_node_id( - _self: LuaReflectRefProxy, - ) -> bevy::reflect::erased_serde::__private::serde::__private::Option<[u8; 6]>; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Uuid(); -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance( - "AtomicBool", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicI16", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicI32", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicI64", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicI8", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicIsize", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicU16", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicU32", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicU64", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicU8", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AtomicUsize", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Duration", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Instant", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "PathBuf", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Quat", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Vec3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("IVec2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("IVec3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("IVec4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "I64Vec2", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "I64Vec3", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "I64Vec4", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("UVec2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("UVec3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("UVec4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "U64Vec2", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "U64Vec3", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "U64Vec4", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("Vec2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Vec3A", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Vec4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("BVec2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("BVec3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("BVec4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("DVec2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("DVec3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("DVec4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Mat2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Mat3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Mat3A", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Mat4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("DMat2", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("DMat3", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("DMat4", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "Affine2", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Affine3A", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DAffine2", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DAffine3", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance("DQuat", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("BVec3A", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("BVec4A", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance("Uuid", crate::tealr::mlu::UserDataProxy::::new)?; - Ok(()) - } -} -fn bevy_reflect_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyReflectScriptingPlugin; -impl bevy::app::Plugin for BevyReflectScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_reflect_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyReflectAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::>() - .process_type::() - .process_type::>() - .process_type::() - .process_type::>() - .process_type::() - .process_type::>() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::>() - .process_type::() - .process_type::>() - .process_type::() - .process_type::>() - .process_type::() - .process_type::>() - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .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::() - .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::() - .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::() - .process_type::>() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs deleted file mode 100644 index 5868b15a02..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_time.rs +++ /dev/null @@ -1,621 +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::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::time::prelude::Fixed", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Fixed {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::time::prelude::Real", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Real {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::time::prelude::Timer", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -/// Creates a new timer with a given duration in seconds. -/// # Example -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// ``` - - #[lua()] - fn from_seconds( - duration: f32, - mode: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if the timer has reached its duration. -/// For repeating timers, this method behaves identically to [`Timer::just_finished`]. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer_once = Timer::from_seconds(1.0, TimerMode::Once); -/// timer_once.tick(Duration::from_secs_f32(1.5)); -/// assert!(timer_once.finished()); -/// timer_once.tick(Duration::from_secs_f32(0.5)); -/// assert!(timer_once.finished()); -/// let mut timer_repeating = Timer::from_seconds(1.0, TimerMode::Repeating); -/// timer_repeating.tick(Duration::from_secs_f32(1.1)); -/// assert!(timer_repeating.finished()); -/// timer_repeating.tick(Duration::from_secs_f32(0.8)); -/// assert!(!timer_repeating.finished()); -/// timer_repeating.tick(Duration::from_secs_f32(0.6)); -/// assert!(timer_repeating.finished()); -/// ``` - - #[lua()] - fn finished(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns `true` only on the tick the timer reached its duration. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(1.5)); -/// assert!(timer.just_finished()); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert!(!timer.just_finished()); -/// ``` - - #[lua()] - fn just_finished(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Returns the time elapsed on the timer as an `f32`. -/// See also [`Timer::elapsed`](Timer::elapsed). - - #[lua()] - fn elapsed_secs(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the time elapsed on the timer as an `f64`. -/// See also [`Timer::elapsed`](Timer::elapsed). - - #[lua()] - fn elapsed_secs_f64(_self: LuaReflectRefProxy) -> f64; - -"#, - r#" -/// Returns the mode of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); -/// assert_eq!(timer.mode(), TimerMode::Repeating); -/// ``` - - #[lua()] - fn mode( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Sets the mode of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); -/// timer.set_mode(TimerMode::Once); -/// assert_eq!(timer.mode(), TimerMode::Once); -/// ``` - - #[lua()] - fn set_mode( - _self: LuaReflectRefMutProxy, - mode: LuaReflectValProxy, - ) -> (); - -"#, - r#" -/// Pauses the Timer. Disables the ticking of the timer. -/// See also [`Stopwatch::pause`](Stopwatch::pause). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.pause(); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.elapsed_secs(), 0.0); -/// ``` - - #[lua()] - fn pause(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Unpauses the Timer. Resumes the ticking of the timer. -/// See also [`Stopwatch::unpause()`](Stopwatch::unpause). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.pause(); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// timer.unpause(); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.elapsed_secs(), 0.5); -/// ``` - - #[lua()] - fn unpause(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Returns `true` if the timer is paused. -/// See also [`Stopwatch::is_paused`](Stopwatch::is_paused). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// assert!(!timer.paused()); -/// timer.pause(); -/// assert!(timer.paused()); -/// timer.unpause(); -/// assert!(!timer.paused()); -/// ``` - - #[lua()] - fn paused(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Resets the timer. The reset doesn't affect the `paused` state of the timer. -/// See also [`Stopwatch::reset`](Stopwatch::reset). -/// Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(1.5)); -/// timer.reset(); -/// assert!(!timer.finished()); -/// assert!(!timer.just_finished()); -/// assert_eq!(timer.elapsed_secs(), 0.0); -/// ``` - - #[lua()] - fn reset(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.fraction(), 0.25); -/// ``` - - #[lua()] - fn fraction(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the fraction of the timer remaining time (goes from 1.0 to 0.0). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.fraction_remaining(), 0.75); -/// ``` - - #[lua()] - fn fraction_remaining(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the remaining time in seconds -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::cmp::Ordering; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// let result = timer.remaining_secs().total_cmp(&1.5); -/// assert_eq!(Ordering::Equal, result); -/// ``` - - #[lua()] - fn remaining_secs(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the number of times a repeating timer -/// finished during the last [`tick`](Timer::tick) call. -/// For non repeating-timers, this method will only ever -/// return 0 or 1. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); -/// timer.tick(Duration::from_secs_f32(6.0)); -/// assert_eq!(timer.times_finished_this_tick(), 6); -/// timer.tick(Duration::from_secs_f32(2.0)); -/// assert_eq!(timer.times_finished_this_tick(), 2); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.times_finished_this_tick(), 0); -/// ``` - - #[lua()] - fn times_finished_this_tick( - _self: LuaReflectRefProxy, - ) -> u32; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Timer {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::time::prelude::TimerMode", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct TimerMode {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::time::prelude::Virtual", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Virtual {} -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::time::Stopwatch", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Create a new unpaused `Stopwatch` with no elapsed time. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let stopwatch = Stopwatch::new(); -/// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// assert_eq!(stopwatch.is_paused(), false); -/// ``` - - #[lua()] - fn new() -> LuaReflectValProxy; - -"#, - r#" -/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) -/// of the stopwatch, in seconds. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.tick(Duration::from_secs(1)); -/// assert_eq!(stopwatch.elapsed_secs(), 1.0); -/// ``` -/// # See Also -/// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. -/// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. - - #[lua()] - fn elapsed_secs(_self: LuaReflectRefProxy) -> f32; - -"#, - r#" -/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) -/// of the stopwatch, in seconds, as f64. -/// # See Also -/// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. -/// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` is desirable instead. - - #[lua()] - fn elapsed_secs_f64(_self: LuaReflectRefProxy) -> f64; - -"#, - r#" -/// Pauses the stopwatch. Any call to [`tick`](Stopwatch::tick) while -/// paused will not have any effect on the elapsed time. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.pause(); -/// stopwatch.tick(Duration::from_secs_f32(1.5)); -/// assert!(stopwatch.is_paused()); -/// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// ``` - - #[lua()] - fn pause(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Unpauses the stopwatch. Resume the effect of ticking on elapsed time. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.pause(); -/// stopwatch.tick(Duration::from_secs_f32(1.0)); -/// stopwatch.unpause(); -/// stopwatch.tick(Duration::from_secs_f32(1.0)); -/// assert!(!stopwatch.is_paused()); -/// assert_eq!(stopwatch.elapsed_secs(), 1.0); -/// ``` - - #[lua()] - fn unpause(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" -/// Returns `true` if the stopwatch is paused. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut stopwatch = Stopwatch::new(); -/// assert!(!stopwatch.is_paused()); -/// stopwatch.pause(); -/// assert!(stopwatch.is_paused()); -/// stopwatch.unpause(); -/// assert!(!stopwatch.is_paused()); -/// ``` - - #[lua()] - fn is_paused(_self: LuaReflectRefProxy) -> bool; - -"#, - r#" -/// Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.tick(Duration::from_secs_f32(1.5)); -/// stopwatch.reset(); -/// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// ``` - - #[lua()] - fn reset(_self: LuaReflectRefMutProxy) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq")] - fn assert_receiver_is_total_eq( - _self: LuaReflectRefProxy, - ) -> (); - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Stopwatch {} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance("Timer", crate::tealr::mlu::UserDataProxy::::new)?; - instances - .add_instance( - "Stopwatch", - crate::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -fn bevy_time_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyTimeScriptingPlugin; -impl bevy::app::Plugin for BevyTimeScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_time_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyTimeAPI", - |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::>() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs deleted file mode 100644 index 9456826998..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/bevy_transform.rs +++ /dev/null @@ -1,366 +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::*; -use super::bevy_core::*; -use super::bevy_math::*; -use super::bevy_hierarchy::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, -}; -use crate::{ - bindings::proxy::{ - LuaReflectRefProxy, LuaReflectRefMutProxy, LuaReflectValProxy, LuaValProxy, - LuaIdentityProxy, - }, - type_data::RegisterLua, tealr::mlu::mlua::IntoLua, -}; -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::transform::components::GlobalTransform", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua()] - fn from_xyz( - x: f32, - y: f32, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the transformation as a [`Transform`]. -/// The transform is expected to be non-degenerate and without shearing, or the output -/// will be invalid. - - #[lua()] - fn compute_transform( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns the [`Transform`] `self` would have if it was a child of an entity -/// with the `parent` [`GlobalTransform`]. -/// This is useful if you want to "reparent" an [`Entity`](bevy_ecs::entity::Entity). -/// Say you have an entity `e1` that you want to turn into a child of `e2`, -/// but you want `e1` to keep the same global transform, even after re-parenting. You would use: -/// ``` -/// # use bevy_transform::prelude::{GlobalTransform, Transform}; -/// # use bevy_ecs::prelude::{Entity, Query, Component, Commands}; -/// # use bevy_hierarchy::{prelude::Parent, BuildChildren}; -/// #[derive(Component)] -/// struct ToReparent { -/// new_parent: Entity, -/// } -/// fn reparent_system( -/// mut commands: Commands, -/// mut targets: Query<(&mut Transform, Entity, &GlobalTransform, &ToReparent)>, -/// transforms: Query<&GlobalTransform>, -/// ) { -/// for (mut transform, entity, initial, to_reparent) in targets.iter_mut() { -/// if let Ok(parent_transform) = transforms.get(to_reparent.new_parent) { -/// *transform = initial.reparented_to(parent_transform); -/// commands.entity(entity) -/// .remove::() -/// .set_parent(to_reparent.new_parent); -/// } -/// } -/// } -/// ``` -/// The transform is expected to be non-degenerate and without shearing, or the output -/// will be invalid. - - #[lua()] - fn reparented_to( - _self: LuaReflectRefProxy, - parent: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Multiplies `self` with `transform` component by component, returning the -/// resulting [`GlobalTransform`] - - #[lua()] - fn mul_transform( - _self: LuaReflectRefProxy, - transform: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - transform: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct GlobalTransform(); -#[derive(bevy_mod_scripting_derive::LuaProxy)] -#[proxy( - remote = "bevy::transform::components::Transform", - bms_core_path = "bevy_mod_scripting_core", - bms_lua_path = "crate", - functions[r#" - - #[lua(as_trait = "std::clone::Clone")] - fn clone( - _self: LuaReflectRefProxy, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - transform: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - 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. - - #[lua()] - fn from_xyz( - x: f32, - y: f32, - z: f32, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Rotates this [`Transform`] around the `X` axis by `angle` (in radians). -/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - - #[lua()] - fn rotate_x( - _self: LuaReflectRefMutProxy, - angle: f32, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the `Y` axis by `angle` (in radians). -/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - - #[lua()] - fn rotate_y( - _self: LuaReflectRefMutProxy, - angle: f32, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the `Z` axis by `angle` (in radians). -/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - - #[lua()] - fn rotate_z( - _self: LuaReflectRefMutProxy, - angle: f32, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `X` axis by `angle` (in radians). - - #[lua()] - fn rotate_local_x( - _self: LuaReflectRefMutProxy, - angle: f32, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `Y` axis by `angle` (in radians). - - #[lua()] - fn rotate_local_y( - _self: LuaReflectRefMutProxy, - angle: f32, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `Z` axis by `angle` (in radians). - - #[lua()] - fn rotate_local_z( - _self: LuaReflectRefMutProxy, - angle: f32, - ) -> (); - -"#, - r#" -/// Multiplies `self` with `transform` component by component, returning the -/// resulting [`Transform`] - - #[lua()] - fn mul_transform( - _self: LuaReflectRefProxy, - transform: LuaReflectValProxy, - ) -> LuaReflectValProxy; - -"#, - r#" -/// Returns `true` if, and only if, translation, rotation and scale all are -/// finite. If any of them contains a `NaN`, positive or negative infinity, -/// this will return `false`. - - #[lua()] - fn is_finite( - _self: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul::", - composite = "mul", - metamethod = "Mul", - )] - fn mul( - _self: LuaReflectValProxy, - global_transform: LuaReflectValProxy< - bevy::transform::components::GlobalTransform, - >, - ) -> LuaReflectValProxy; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq::", - composite = "eq", - metamethod = "Eq", - )] - fn eq( - _self: LuaReflectRefProxy, - other: LuaReflectRefProxy, - ) -> bool; - -"#, - r#" -#[lua(metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -pub struct Transform { - translation: ReflectReference, - rotation: ReflectReference, - scale: ReflectReference, -} -#[derive(Default)] -pub(crate) struct Globals; -impl crate::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: crate::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> crate::tealr::mlu::mlua::Result<()> { - instances - .add_instance( - "GlobalTransform", - crate::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Transform", - crate::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -fn bevy_transform_context_initializer( - _: &bevy_mod_scripting_core::script::ScriptId, - ctx: &mut crate::prelude::Lua, -) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - crate::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} -pub struct BevyTransformScriptingPlugin; -impl bevy::app::Plugin for BevyTransformScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - app.register_lua_proxy::(); - app.register_lua_proxy::(); - app.add_context_initializer::<()>(bevy_transform_context_initializer); - app.add_documentation_fragment( - crate::docs::LuaDocumentationFragment::new( - "BevyTransformAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::< - crate::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::>() - }, - ), - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs deleted file mode 100644 index e7ab476ca8..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/providers/mod.rs +++ /dev/null @@ -1,25 +0,0 @@ -// @generated by cargo bevy-api-gen collect, modify the templates not this file -#![allow(clippy::all)] -#![allow(unused, deprecated, dead_code)] -#![cfg_attr(rustfmt, rustfmt_skip)] -pub mod bevy_ecs; -pub mod bevy_transform; -pub mod bevy_math; -pub mod bevy_input; -pub mod bevy_core; -pub mod bevy_time; -pub mod bevy_hierarchy; -pub mod bevy_reflect; -pub struct LuaBevyScriptingPlugin; -impl bevy::app::Plugin for LuaBevyScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { - bevy_ecs::BevyEcsScriptingPlugin.build(app); - bevy_transform::BevyTransformScriptingPlugin.build(app); - bevy_math::BevyMathScriptingPlugin.build(app); - bevy_input::BevyInputScriptingPlugin.build(app); - bevy_core::BevyCoreScriptingPlugin.build(app); - bevy_time::BevyTimeScriptingPlugin.build(app); - bevy_hierarchy::BevyHierarchyScriptingPlugin.build(app); - bevy_reflect::BevyReflectScriptingPlugin.build(app); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs deleted file mode 100644 index b81e66e4e0..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/proxy.rs +++ /dev/null @@ -1,256 +0,0 @@ -//! Set of traits used to define how types are turned into and from proxies in Lua. -//! Proxies can either be logical "copies" or owned "direct representations" of the instance, or references to one via the [`bevy_mod_scripting_core::bindings::ReflectReference`] construct. - -use bevy::reflect::{FromReflect, Reflect, TypeRegistry}; -use bevy_mod_scripting_core::{ - bindings::{ - Proxy, ReflectAllocator, ReflectReference, ReflectValProxy, Unproxy, ValProxy, - WorldAccessGuard, - }, - error::{ScriptError, ScriptResult}, -}; -use tealr::{ - mlu::mlua::{Error, FromLua, IntoLua, IntoLuaMulti, Lua, Value}, - ToTypename, -}; - -use super::world::Nil; - -/// Think of this as a Local trait alias for the [`Proxy`] trait. Specifies the proxy type for a given type. -pub trait LuaProxied { - type Proxy; -} - -/// Proxy which acts exactly like `T` when converting to Lua, but provides a `ToTypename` implementation based on another type `N`. -/// Used internally basically only to support Result types in Lua directly. -/// Will be unnecessary once I get rid of tealr. -pub(crate) struct TypenameProxy(T, std::marker::PhantomData); - -impl TypenameProxy { - pub fn new(value: T) -> Self { - Self(value, std::marker::PhantomData) - } -} - -impl ToTypename for TypenameProxy { - fn to_typename() -> tealr::Type { - N::to_typename() - } -} - -impl<'a, T: IntoLuaMulti<'a>, N: ToTypename> IntoLua<'a> for TypenameProxy { - fn into_lua(self, lua: &'a Lua) -> tealr::mlu::mlua::Result> { - self.0 - .into_lua_multi(lua) - .map(|mut v| v.pop_front().unwrap_or_else(|| Value::Nil)) - } -} - -/// Proxy which converts to lua by throwing the error. Can be used inside a [`Result`] to proxy into a result which will throw the error if it's an [`Err`] when converting to Lua. -pub struct ErrorProxy(E); - -impl<'a, E: Into>> IntoLua<'a> - for ErrorProxy -{ - fn into_lua(self, _: &'a Lua) -> tealr::mlu::mlua::prelude::LuaResult> { - Err(Error::external(self.0)) - } -} - -/// This should never really need to be used, but it's here so we can use the type in Lua. -impl ToTypename for ErrorProxy { - fn to_typename() -> tealr::Type { - tealr::Type::new_single("Error", tealr::KindOfType::External) - } -} - -impl>> Proxy for ErrorProxy { - type Input<'i> = E; - fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { - Ok(Self(value)) - } -} - -impl From> for tealr::mlu::mlua::Error { - fn from(val: ErrorProxy) -> Self { - val.0 - } -} - -/// Convenience for proxying a type into lua via itself without implementing [`Proxy`] on it. -/// Converts to Lua via T's implementation of IntoLua directly -pub struct LuaIdentityProxy(pub Option); - -impl Proxy for LuaIdentityProxy { - type Input<'i> = T; - fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { - Ok(Self(Some(value))) - } -} - -impl Unproxy for LuaIdentityProxy { - type Output<'o> - = T - where - Self: 'o; - - fn unproxy<'o>(&'o mut self) -> ScriptResult> { - Ok(self - .0 - .take() - .expect("IdentityProxy was already unproxied before")) - } -} - -impl ToTypename for LuaIdentityProxy { - fn to_typename() -> tealr::Type { - T::to_typename() - } -} - -impl<'a, T: IntoLua<'a>> IntoLua<'a> for LuaIdentityProxy { - fn into_lua(self, lua: &'a Lua) -> tealr::mlu::mlua::prelude::LuaResult> { - self.0.into_lua(lua) - } -} - -impl<'a, T: FromLua<'a>> FromLua<'a> for LuaIdentityProxy { - fn from_lua(value: Value<'a>, lua: &'a Lua) -> Result { - Ok(Self(Some(T::from_lua(value, lua)?))) - } -} - -/// Proxy which uses [`ValProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and that the proxy implements [`From`] for the type. -/// -/// Used for types which are copied into lua rather than references to originals in the world. -/// Use when your type does not implement Reflect or if it's a simple type that can be copied into lua. -pub struct LuaValProxy(pub ValProxy); - -/// Proxy which uses [`ReflectValProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and [`FromReflect`] and that the proxy implements [`AsRef`]. -/// Think of the proxy as just a container for a [`ReflectReference`]. -/// -/// Semantically equivalent to `T`, use it where you would use the `T` type. -pub struct LuaReflectValProxy(pub ReflectValProxy); - -/// Proxy which uses [`ReflectRefProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and [`Reflect`] and that the proxy implements [`AsRef`]. -/// Think of the proxy as just a container for a [`ReflectReference`]. -/// -/// Semantically equivalent to `&T`, use it where you would use the `&T` type. -pub struct LuaReflectRefProxy(pub ReflectRefProxy); - -/// Proxy which uses [`ReflectRefMutProxy`] to represent the type in Lua. Requires that the type implements [`LuaProxied`] and [`Reflect`] and that the proxy implements [`AsRef`]. -/// Think of the proxy as just a container for a [`ReflectReference`]. -/// -/// Semantically equivalent to `&mut T`, use it where you would use the `&mut T` type. -pub struct LuaReflectRefMutProxy(pub ReflectRefMutProxy); - -macro_rules! impl_lua_unproxy { - ($ty:ident as $as:ident ($generic:tt) $($bound_var:path : ($($bounds:tt)+),)*) => { - impl <$generic> Unproxy for $ty<$generic> - where - $($bound_var : $($bounds)+),* - { - type Output<'b> = <$as<$generic,$generic::Proxy> as Unproxy>::Output<'b> where Self: 'b; - - fn collect_accesses<'w>( - &self, - guard: &WorldAccessGuard<'w>, - accesses: &mut smallvec::SmallVec<[WorldAccessWrite<'w>; 1]>, - ) -> ScriptResult<()> { - self.0.collect_accesses(guard, accesses) - } - - fn unproxy(&mut self) -> ScriptResult> { - self.0.unproxy() - } - - unsafe fn unproxy_with_world<'w,'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &ReflectAllocator, - ) -> ScriptResult> { - self.0 - .unproxy_with_world(guard, accesses, type_registry, allocator) - } - - fn accesses_len(&self) -> usize { - self.0.accesses_len() - } - } - - impl<'lua, $generic: LuaProxied> FromLua<'lua> for $ty<$generic> - where - $generic::Proxy: FromLua<'lua>, - { - fn from_lua(value: Value<'lua>, lua: &'lua Lua) -> Result { - let inner: $generic::Proxy = $generic::Proxy::from_lua(value, lua)?; - let inner = $as::<$generic,$generic::Proxy>::new(inner); - Ok(Self(inner)) - } - } - - impl<'lua, $generic: LuaProxied> IntoLua<'lua> for $ty<$generic> - where - $generic::Proxy: IntoLua<'lua>, - { - fn into_lua(self, lua: &'lua Lua) -> tealr::mlu::mlua::prelude::LuaResult> { - self.0.0.into_lua(lua) - } - } - - impl ToTypename for $ty where T::Proxy: ToTypename { - fn to_typename() -> tealr::Type { - T::Proxy::to_typename() - } - } - }; -} - -macro_rules! impl_lua_proxy { - ($ty:ident as $as:ident => $generic:tt : $($bounds:path),* $(| T::Proxy: $($proxy_bounds:tt)*)?) => { - impl<$generic> bevy_mod_scripting_core::bindings::Proxy for $ty<$generic> - where - T::Proxy: $($($proxy_bounds)*)?, - T: $($bounds+)*, - { - type Input<'i>=<$as<$generic, $generic::Proxy> as bevy_mod_scripting_core::bindings::Proxy>::Input<'i>; - fn proxy<'i>(value: Self::Input<'i>) -> ScriptResult { - Ok(Self($as::<$generic,$generic::Proxy>::proxy(value)?)) - } - - fn proxy_with_allocator<'i>( - value: Self::Input<'i>, - allocator: &mut bevy_mod_scripting_core::bindings::ReflectAllocator, - ) -> ScriptResult { - Ok(Self($as::<$generic,$generic::Proxy>::proxy_with_allocator(value, allocator)?)) - } - } - - - }; -} - -impl_lua_proxy!(LuaValProxy as ValProxy => T : LuaProxied | T::Proxy: From); -impl_lua_proxy!(LuaReflectValProxy as ReflectValProxy => T : LuaProxied,Reflect | T::Proxy: From ); - -impl_lua_unproxy!(LuaValProxy as ValProxy (T) - T: (LuaProxied), - T: (for <'l> From<&'l T::Proxy>), -); -impl_lua_unproxy!(LuaReflectValProxy as ReflectValProxy (T) - T: (FromReflect), - T: (LuaProxied), - T::Proxy: (AsRef), -); -impl_lua_unproxy!(LuaReflectRefProxy as ReflectRefProxy (T) - T: (LuaProxied), - T: (Reflect), - T::Proxy: (AsRef), -); -impl_lua_unproxy!(LuaReflectRefMutProxy as ReflectRefMutProxy (T) - T: (LuaProxied), - T: (Reflect), - T::Proxy: (AsRef), -); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs index 748aec10fb..80291f2f81 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs @@ -39,9 +39,9 @@ impl DerefMut for LuaQueryBuilder { impl LuaQueryBuilder {} -impl LuaProxied for ScriptQueryBuilder { - type Proxy = LuaQueryBuilder; -} +// impl LuaProxied for ScriptQueryBuilder { +// type Proxy = LuaQueryBuilder; +// } impl_userdata_from_lua!(LuaQueryBuilder); impl_userdata_with_tealdata!(LuaQueryBuilder); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index be3fd1e2f6..5ce2d377bd 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -1,40 +1,44 @@ use std::{ any::{Any, TypeId}, + borrow::Cow, error::Error, + ffi::{CStr, CString, OsStr, OsString}, + path::{Path, PathBuf}, sync::Arc, }; use bevy::{ ecs::{reflect::AppTypeRegistry, world::Mut}, + prelude::AppFunctionRegistry, reflect::{OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect}, }; use bevy_mod_scripting_core::{ bindings::{ + function::CallableWithAccess, + pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, + script_val::{FromScriptValue, ScriptValue}, DeferredReflection, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, TypeIdSource, WorldCallbackAccess, }, - error::ScriptError, + error::{FunctionError, ScriptError, ScriptResult}, new_deferred_reflection, - reflection_extensions::PartialReflectExt, -}; -use tealr::mlu::{ - generics::Q, - mlua::{self, FromLua, IntoLua, Lua, MetaMethod, UserData, Value}, - TealData, TypedFunction, + reflection_extensions::{PartialReflectExt, TypeIdExtensions}, + Either, }; +use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; +use mlua::{IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value, Variadic}; -use crate::{ - impl_userdata_from_lua, impl_userdata_with_tealdata, ReflectLuaProxied, ReflectLuaValue, -}; +use crate::bindings::world::LuaWorld; use super::{ // proxy::{LuaProxied, LuaValProxy}, + script_value::LuaScriptValue, world::GetWorld, }; /// Lua UserData wrapper for [`bevy_mod_scripting_core::bindings::ReflectReference`]. /// Acts as a lua reflection interface. Any value which is registered in the type registry can be interacted with using this type. -#[derive(Debug, Clone, tealr::mlu::UserData, tealr::ToTypename, PartialEq)] +#[derive(Debug, Clone, PartialEq, mlua::FromLua)] pub struct LuaReflectReference(pub ReflectReference); impl AsRef for LuaReflectReference { @@ -45,122 +49,119 @@ impl AsRef for LuaReflectReference { impl LuaReflectReference { pub fn len(&self, lua: &Lua) -> Result, mlua::Error> { - let world = lua.get_world(); - self.0 - .len(&world) - .map_err(tealr::mlu::mlua::Error::external) - } - - pub fn concrete_from_value( - self, - value: Value, - lua: &Lua, - type_id_source: TypeIdSource, - ) -> Result, mlua::Error> { - let world = lua.get_world(); - - let type_id = self.0.type_id_of(type_id_source, &world)?; - - let o = ReflectReference::map_type_data( - type_id, - &world.clone(), - move |type_data: Option>| { - let val = match type_data { - Some(Either::Left(value_data)) => { - bevy::log::debug!("Converting using ReflectLuaValue"); - (value_data.from_value)(value, lua)? - } - Some(Either::Right(proxy_data)) => { - bevy::log::debug!("Converting using ReflectLuaProxied"); - let other = (proxy_data.from_proxy)(value, lua)?; - other.with_reflect(&world, |r, _, _| r.clone_value())? - } - None => { - bevy::log::debug!("No conversion type data found"); - return Err(ScriptError::new_runtime_error(format!( - "Tried to convert lua value: '{value:?}', to {}: '{}'. but this type does not support conversion from lua.", - match type_id_source { - TypeIdSource::Key => "key type of", - TypeIdSource::Element => "element type of", - TypeIdSource::Tail => "", - }, - ReflectReferencePrinter::new(self.0).pretty_print(&world), - ))); - } - }; - Ok(val) - }, - )??; - Ok(o) + self.0.len(lua.get_world()).map_err(mlua::Error::external) } - /// Queries the reflection system for a proxy registration for the underlying type. - /// If found will convert to lua using this proxy - /// If not found will use ::into_lua to convert to lua - pub fn to_lua_proxy(self, lua: &Lua) -> Result, mlua::Error> { - // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, - let world = lua.get_world(); - - let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; - - ReflectReference::map_type_data( - type_id, - &world, - |type_data: Option>| match type_data { - Some(Either::Left(value_data)) => self - .0 - .with_reflect(&world, |r, _, _| (value_data.into_value)(r, lua))?, - Some(Either::Right(proxy_data)) => Ok((proxy_data.into_proxy)(self.0, lua)?), - None => Ok(LuaReflectReference(self.0).into_lua(lua)?), - }, - )? - } - - pub fn set_with_lua_proxy(self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { - bevy::log::debug!("Setting lua reflect reference with value: {:?}", value); - - let world = lua.get_world(); - - let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; - - ReflectReference::map_type_data( - type_id, - &world.clone(), - move |type_data: Option>| { - // let world = world.clone(); // move copy into closure - match type_data { - Some(Either::Left(value_data)) => { - let other = (value_data.from_value)(value, lua)?; - self.0.with_reflect_mut(&world, |r, _, _| { - r.try_apply(other.as_partial_reflect()) - .map_err(ScriptError::new_reflection_error) - })? - } - Some(Either::Right(proxy_data)) => { - let other = (proxy_data.from_proxy)(value, lua)?; - let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; - // now we can set it - self.0.with_reflect_mut(&world, |r, _, _| { - if let Some(set) = proxy_data.opt_set { - set(r, other) - } else { - r.try_apply(other.as_partial_reflect()) - .map_err(ScriptError::new_reflection_error)?; - Ok(()) - } - })? - } - None => { - Err(ScriptError::new_runtime_error(format!( - "Invalid assignment `{}` = `{value:?}`. The left hand side does not support conversion from lua.", - ReflectReferencePrinter::new(self.0).pretty_print(&world), - ))) - } - } - }, - )??; - Ok(()) - } + // pub fn concrete_from_value( + // self, + // value: Value, + // lua: &Lua, + // type_id_source: TypeIdSource, + // ) -> Result, mlua::Error> { + // let world = lua.get_world(); + + // let type_id = self.0.type_id_of(type_id_source, &world)?; + + // let o = ReflectReference::map_type_data( + // type_id, + // &world.clone(), + // move |type_data: Option>| { + // let val = match type_data { + // Some(Either::Left(value_data)) => { + // bevy::log::debug!("Converting using ReflectLuaValue"); + // (value_data.from_value)(value, lua)? + // } + // Some(Either::Right(proxy_data)) => { + // bevy::log::debug!("Converting using ReflectLuaProxied"); + // let other = (proxy_data.from_proxy)(value, lua)?; + // other.with_reflect(&world, |r, _, _| r.clone_value())? + // } + // None => { + // bevy::log::debug!("No conversion type data found"); + // return Err(ScriptError::new_runtime_error(format!( + // "Tried to convert lua value: '{value:?}', to {}: '{}'. but this type does not support conversion from lua.", + // match type_id_source { + // TypeIdSource::Key => "key type of", + // TypeIdSource::Element => "element type of", + // TypeIdSource::Tail => "", + // }, + // ReflectReferencePrinter::new(self.0).pretty_print(&world), + // ))); + // } + // }; + // Ok(val) + // }, + // )??; + // Ok(o) + // } + + // /// Queries the reflection system for a proxy registration for the underlying type. + // /// If found will convert to lua using this proxy + // /// If not found will use ::into_lua to convert to lua + // pub fn to_lua_proxy(self, lua: &Lua) -> Result, mlua::Error> { + // // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, + // let world = lua.get_world(); + + // let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; + + // ReflectReference::map_type_data( + // type_id, + // &world, + // |type_data: Option>| match type_data { + // Some(Either::Left(value_data)) => self + // .0 + // .with_reflect(&world, |r| (value_data.into_value)(r, lua))?, + // Some(Either::Right(proxy_data)) => Ok((proxy_data.into_proxy)(self.0, lua)?), + // None => Ok(LuaReflectReference(self.0).into_lua(lua)?), + // }, + // )? + // } + + // pub fn set_with_lua_proxy(self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { + // bevy::log::debug!("Setting lua reflect reference with value: {:?}", value); + + // let world = lua.get_world(); + + // let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; + + // ReflectReference::map_type_data( + // type_id, + // &world.clone(), + // move |type_data: Option>| { + // // let world = world.clone(); // move copy into closure + // match type_data { + // Some(Either::Left(value_data)) => { + // let other = (value_data.from_value)(value, lua)?; + // self.0.with_reflect_mut(&world, |r| { + // r.try_apply(other.as_partial_reflect()) + // .map_err(ScriptError::new_reflection_error) + // })? + // } + // Some(Either::Right(proxy_data)) => { + // let other = (proxy_data.from_proxy)(value, lua)?; + // let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; + // // now we can set it + // self.0.with_reflect_mut(&world, |r| { + // if let Some(set) = proxy_data.opt_set { + // set(r, other) + // } else { + // r.try_apply(other.as_partial_reflect()) + // .map_err(ScriptError::new_reflection_error)?; + // Ok(()) + // } + // })? + // } + // None => { + // Err(ScriptError::new_runtime_error(format!( + // "Invalid assignment `{}` = `{value:?}`. The left hand side does not support conversion from lua.", + // ReflectReferencePrinter::new(self.0).pretty_print(&world), + // ))) + // } + // } + // }, + // )??; + // Ok(()) + // } /// Adjusts all the numeric accesses in the path from 1-indexed to 0-indexed pub fn to_host_index(path: &mut ParsedPath) { @@ -207,11 +208,67 @@ impl LuaReflectReference { } } -impl_userdata_from_lua!(LuaReflectReference); - -impl LuaProxied for ReflectReference { - type Proxy = LuaReflectReference; -} +// impl<'lua> IntoLua<'lua> for LuaReflectReference { +// fn into_lua(self, lua: &'lua Lua) -> mlua::Result> { +// // if we are a primitive type, we can convert to lua directly +// let world = lua.get_world(); + +// let value = self.0.with_reflect(&world, |r| { +// let tail_type_id = r +// .get_represented_type_info() +// .map(|i| i.type_id()) +// .type_id_or_fake_id(); + +// if let Ok(v) = r.as_option() { +// if let Some(v) = v { +// return Ok(v); +// } +// } + +// into_lua_cases!( +// lua, +// world, +// self, +// r, +// [ +// // TODO: after update to mlua 10, we can use the new `IntoLua` impls for these types +// &'static str, +// &'static CStr, +// // &'static OsStr, +// // &'static Path, +// Cow<'static, str>, +// Cow<'static, CStr>, +// bool, +// f32, +// f64, +// i8, +// i16, +// i32, +// i64, +// i128, +// isize, +// u8, +// u16, +// u32, +// u64, +// u128, +// usize, +// Box, +// CString, +// String +// // OsString, +// // PathBuf +// ] +// ); +// }); +// } +// } + +// impl_userdata_from_lua!(LuaReflectReference); + +// impl LuaProxied for ReflectReference { +// type Proxy = LuaReflectReference; +// } impl From for ReflectReference { fn from(value: LuaReflectReference) -> Self { @@ -225,377 +282,433 @@ impl From for LuaReflectReference { } } -impl TealData for LuaReflectReference { - fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(m: &mut T) { +impl UserData for LuaReflectReference { + fn add_methods<'lua, T: UserDataMethods<'lua, Self>>(m: &mut T) { m.add_meta_function( MetaMethod::Index, - |l, (mut self_, key): (LuaReflectReference, Value)| { - bevy::log::debug!( - "ReflectReference::Index with key: {:?} and value: {:?}", - key, - self_ - ); - // catchall, parse the path - let mut elem = Self::parse_value_index(key)?; - Self::to_host_index(&mut elem); - self_.0.index_path(elem); - bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); - self_.to_lua_proxy(l) - }, - ); - m.add_meta_function( - MetaMethod::NewIndex, - |l, (mut self_, key, value): (LuaReflectReference, Value, Value)| { - bevy::log::debug!( - "ReflectReference::NewIndex with key: {:?} and value: {:?}", - key, - value - ); - - let mut elem = Self::parse_value_index(key)?; - Self::to_host_index(&mut elem); - self_.0.index_path(elem); - bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); - self_.set_with_lua_proxy(l, value) + |lua, (self_, key): (LuaReflectReference, String)| { + let world = lua.get_world(); + let type_id = self_.0.tail_type_id(world.clone())?.type_id_or_fake_id(); + + let func = lua.create_function(move |_, args: Variadic| { + let registry = + world.with_resource(|registry: &AppFunctionRegistry| registry.clone()); + let registry = registry.read(); + + let func = registry + .get_namespaced_function(key.clone(), Namespace::OnType(type_id)) + .ok_or_else(|| { + mlua::Error::external(FunctionError::FunctionNotFound { + function_name: key.clone().into(), + type_: Some(type_id.display_with_world(world.clone()).into()), + }) + })?; + let info = func.info(); + + // convert args according to type info + println!( + "Calling function {:?} with args (before converting): {:?}", + info.name(), + args + ); + + // let args = info + // .args() + // .iter() + // .map(|i| i.type_id()) + // .zip(args.into_iter()) + // .map(|(target_type_id, arg)| { + // let boxed = ::from_script_value( + // arg.into(), + // world.clone(), + // target_type_id, + // )?; + // Ok(::allocate(boxed, world.clone())) + // }) + // .collect::>>()?; + println!("Calling function {:?} with args: {:?}", info.name(), args); + func.with_call(args.into_iter().map(Into::into), world.clone(), |r| { + // let result = r.call()?; + println!("Result: {:?}", r); + 0 + })?; + Ok(()) + })?; + + Ok(func) }, - ); - - m.add_function_mut( - "insert", - |l, (self_, key, value): (LuaReflectReference, Value, Value)| { - let world = l.get_world(); - bevy::log::debug!( - "ReflectReference::insert with key: {:?} and value: {:?}", - key, - value - ); - let key = self_ - .clone() - .concrete_from_value(key, l, TypeIdSource::Key)?; - bevy::log::debug!("Key: {:?}", key); - let value = self_ - .clone() - .concrete_from_value(value, l, TypeIdSource::Element)?; - bevy::log::debug!("Value: {:?}", value); - self_ - .0 - .with_reflect_mut(&world, |r, _, _| r.try_insert_boxed(key, value))??; - Ok(()) - }, - ); - - m.add_function_mut("push", |l, (self_, value): (LuaReflectReference, Value)| { - let world = l.get_world(); - bevy::log::debug!("ReflectReference::push with value: {:?}", value); - let value = self_ - .clone() - .concrete_from_value(value, l, TypeIdSource::Element)?; - self_ - .0 - .with_reflect_mut(&world, |r, _, _| r.try_push_boxed(value))??; - Ok(()) - }); - - m.add_function_mut("pop", |l, self_: LuaReflectReference| { - let world = l.get_world(); - bevy::log::debug!("ReflectReference::pop"); - let ref_ = self_.0.with_reflect_mut(&world, |r, _, allocator| { - let last_elem = r.try_pop_boxed()?; - let reflect_ref = LuaReflectReference(ReflectReference::new_allocated_boxed( - last_elem, allocator, - )); - Ok::<_, ScriptError>(reflect_ref) - })??; - - Ok(ref_) - }); - - m.add_function("clear", |l, self_: LuaReflectReference| { - let world = l.get_world(); - bevy::log::debug!("ReflectReference::clear"); - self_ - .0 - .with_reflect_mut(&world, |r, _, _| r.try_clear())??; - Ok(()) - }); - - m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { - self_.len(l) - }); - - #[cfg(any( - feature = "lua54", - feature = "lua53", - feature = "lua52", - feature = "luajit52", - ))] - m.add_meta_function(MetaMethod::Pairs, |l, s: LuaReflectReference| { - bevy::log::debug!("ReflectReference::Pairs with value: {:?}", s); - let mut iterator_base = s.0.into_iter_infinite(); - let iterator = TypedFunction::from_rust_mut( - move |l, ()| { - let (next_ref, idx) = iterator_base.next_ref(); - bevy::log::debug!("iteration: {:?}", idx); - let next = LuaReflectReference(next_ref).to_lua_proxy(l); - let next = match next { - Ok(n) => Some(n), - Err(e) => { - bevy::log::debug!("Error in iteration: {:?}", e); - None - } - }; - bevy::log::debug!("next: {:?}", next); - // TODO: we should differentiate between no more values and an actual error - match (next, idx) { - (None, bevy_mod_scripting_core::bindings::IterationKey::Index(_)) => { - Ok((Value::Nil, Value::Nil)) - } - (Some(n), bevy_mod_scripting_core::bindings::IterationKey::Index(i)) => { - Ok((Value::Integer((i + 1) as i64), n)) - } - } - }, - l, - )?; - - Ok((iterator, Value::Nil, Value::Nil)) - }); - - m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { - let world = lua.get_world(); - Ok(ReflectReferencePrinter::new(self_.0).pretty_print(&world)) - }); - - m.add_function("print_value", |lua, self_: LuaReflectReference| { - let world = lua.get_world(); - - Ok(ReflectReferencePrinter::new(self_.0).pretty_print_value(&world)) - }); + ) + + // m.add_meta_function( + // MetaMethod::Index, + // |l, (mut self_, key): (LuaReflectReference, Value)| { + // bevy::log::debug!( + // "ReflectReference::Index with key: {:?} and value: {:?}", + // key, + // self_ + // ); + // // catchall, parse the path + // let mut elem = Self::parse_value_index(key)?; + // Self::to_host_index(&mut elem); + // self_.0.index_path(elem); + // bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); + // self_.to_lua_proxy(l) + // }, + // ); + // m.add_meta_function( + // MetaMethod::NewIndex, + // |l, (mut self_, key, value): (LuaReflectReference, Value, Value)| { + // bevy::log::debug!( + // "ReflectReference::NewIndex with key: {:?} and value: {:?}", + // key, + // value + // ); + + // let mut elem = Self::parse_value_index(key)?; + // Self::to_host_index(&mut elem); + // self_.0.index_path(elem); + // bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); + // self_.set_with_lua_proxy(l, value) + // }, + // ); + + // m.add_function_mut( + // "insert", + // |l, (self_, key, value): (LuaReflectReference, Value, Value)| { + // let world = l.get_world(); + // bevy::log::debug!( + // "ReflectReference::insert with key: {:?} and value: {:?}", + // key, + // value + // ); + // let key = self_ + // .clone() + // .concrete_from_value(key, l, TypeIdSource::Key)?; + // bevy::log::debug!("Key: {:?}", key); + // let value = self_ + // .clone() + // .concrete_from_value(value, l, TypeIdSource::Element)?; + // bevy::log::debug!("Value: {:?}", value); + // self_ + // .0 + // .with_reflect_mut(&world, |r| r.try_insert_boxed(key, value))??; + // Ok(()) + // }, + // ); + + // m.add_function_mut("push", |l, (self_, value): (LuaReflectReference, Value)| { + // let world = l.get_world(); + // bevy::log::debug!("ReflectReference::push with value: {:?}", value); + // let value = self_ + // .clone() + // .concrete_from_value(value, l, TypeIdSource::Element)?; + // self_ + // .0 + // .with_reflect_mut(&world, |r| r.try_push_boxed(value))??; + // Ok(()) + // }); + + // m.add_function_mut("pop", |l, self_: LuaReflectReference| { + // let world = l.get_world(); + // bevy::log::debug!("ReflectReference::pop"); + // let ref_ = self_.0.with_reflect_mut(&world, |r| { + // let last_elem = r.try_pop_boxed()?; + // let allocator = world.allocator(); + // let mut allocator = allocator.write(); + // let reflect_ref = LuaReflectReference(ReflectReference::new_allocated_boxed( + // last_elem, + // &mut allocator, + // )); + // Ok::<_, ScriptError>(reflect_ref) + // })??; + + // Ok(ref_) + // }); + + // m.add_function("clear", |l, self_: LuaReflectReference| { + // let world = l.get_world(); + // bevy::log::debug!("ReflectReference::clear"); + // self_.0.with_reflect_mut(&world, |r| r.try_clear())??; + // Ok(()) + // }); + + // m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { + // self_.len(l) + // }); + + // #[cfg(any( + // feature = "lua54", + // feature = "lua53", + // feature = "lua52", + // feature = "luajit52", + // ))] + // m.add_meta_function(MetaMethod::Pairs, |l, s: LuaReflectReference| { + // bevy::log::debug!("ReflectReference::Pairs with value: {:?}", s); + // let mut iterator_base = s.0.into_iter_infinite(); + // let iterator = TypedFunction::from_rust_mut( + // move |l, ()| { + // let (next_ref, idx) = iterator_base.next_ref(); + // bevy::log::debug!("iteration: {:?}", idx); + // let next = LuaReflectReference(next_ref).to_lua_proxy(l); + // let next = match next { + // Ok(n) => Some(n), + // Err(e) => { + // bevy::log::debug!("Error in iteration: {:?}", e); + // None + // } + // }; + // bevy::log::debug!("next: {:?}", next); + // // TODO: we should differentiate between no more values and an actual error + // match (next, idx) { + // (None, bevy_mod_scripting_core::bindings::IterationKey::Index(_)) => { + // Ok((Value::Nil, Value::Nil)) + // } + // (Some(n), bevy_mod_scripting_core::bindings::IterationKey::Index(i)) => { + // Ok((Value::Integer((i + 1) as i64), n)) + // } + // } + // }, + // l, + // )?; + + // Ok((iterator, Value::Nil, Value::Nil)) + // }); + + // m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { + // let world = lua.get_world(); + // Ok(ReflectReferencePrinter::new(self_.0).pretty_print(&world)) + // }); + + // m.add_function("print_value", |lua, self_: LuaReflectReference| { + // let world = lua.get_world(); + + // Ok(ReflectReferencePrinter::new(self_.0).pretty_print_value(&world)) + // }); } } -#[cfg(test)] -mod test { - - use bevy::{ - app::App, - ecs::{reflect::AppTypeRegistry, world::World}, - reflect::{FromReflect, OffsetAccess, Reflect}, - }; - use bevy_mod_scripting_core::{ - bindings::ReflectAllocator, - bindings::{ReflectBase, ReflectBaseType, WorldAccessGuard, WorldCallbackAccess}, - }; - use bevy_mod_scripting_derive::LuaProxy; - - use crate::{bindings::world::LuaWorld, type_data::RegisterLua}; - - use super::*; - - #[derive(Reflect)] - struct TestStruct { - value: usize, - proxy: TestProxied, - proxies: Vec, - } - - #[derive(Reflect)] - struct TestTupleStruct(usize, TestProxied, Vec); - - #[derive(Reflect)] - enum TestTupleEnum { - Value(usize), - Proxy(TestProxied), - Proxies(Vec), - } - - #[derive(Reflect, LuaProxy)] - #[proxy(bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate")] - #[reflect(LuaProxied)] - pub struct TestProxied; - - impl PartialEq for LuaTestProxied { - fn eq(&self, other: &Self) -> bool { - self.0 == other.0 - } - } - - /// asserts that setting then indexing into a LuaReflectReference of type T with the given expression returns the expected value. - /// Provides `t and `world` globals, with t being the LuaReflectReference to the provided value. - fn assert_lua_set_get_returns< - T: Reflect, - F: Fn(ReflectReference) -> O, - O: for<'l> FromLua<'l> + for<'l> IntoLua<'l> + PartialEq + std::fmt::Debug, - >( - mut world: &mut World, - val: T, - expr: &'static str, - expected: F, - ) { - let lua = Lua::new(); - let mut allocator = ReflectAllocator::default(); - let reflect_ref = LuaReflectReference(ReflectReference::new_allocated(val, &mut allocator)); - world.insert_resource(allocator); - - WorldCallbackAccess::with_callback_access(world, |access| { - let globals = lua.globals(); - globals.set("test", reflect_ref.clone()).unwrap(); - globals.set("world", LuaWorld(access.clone())).unwrap(); - globals - .set("expected", expected(reflect_ref.0.clone())) - .unwrap(); - - let lua_code = format!( - r#" - {expr} = expected - return {expr} - "# - ); - let result = lua - .load(&lua_code) - .into_function() - .unwrap_or_else(|e| panic!("Could not load lua code into function: `{e}`")) - .call(()) - .unwrap_or_else(|e| { - panic!("Could not convert expression value to expected type: `{e}`") - }); - let result: O = result; - assert_eq!(result, expected(reflect_ref.0)); - }); - } - - #[test] - fn test_index_lua_value() { - // so we have the registry and can just do this - let mut app = App::new(); - app.register_lua_value::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestStruct { - value: 123, - proxy: TestProxied, - proxies: vec![], - }, - "test.value", - |_| 123usize, - ); - - let mut app = App::new(); - app.register_lua_value::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestTupleStruct(123, TestProxied, vec![]), - "test._1", - |_| 123usize, - ); - - let mut app = App::new(); - app.register_lua_value::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestTupleEnum::Value(123usize), - "test._1", - |_| 123usize, - ); - } - - #[test] - fn test_index_lua_proxy() { - // so we have the registry and can just do this - let mut app = App::new(); - app.register_lua_proxy::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestStruct { - value: 123, - proxy: TestProxied, - proxies: vec![], - }, - "test.proxy", - |mut r| { - r.index_path(ParsedPath::parse_static("proxy").unwrap()); - LuaTestProxied(r) - }, - ); - - let mut app = App::new(); - app.register_lua_proxy::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestTupleStruct(123, TestProxied, vec![]), - "test._2", - |mut r| { - r.index_path(ParsedPath::parse_static(".1").unwrap()); - LuaTestProxied(r) - }, - ); - - let mut app = App::new(); - app.register_lua_proxy::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestTupleEnum::Proxy(TestProxied), - "test._1", - |mut r| { - r.index_path(ParsedPath::parse_static(".0").unwrap()); - LuaTestProxied(r) - }, - ); - } - - #[test] - fn test_index_lua_proxy_vec() { - // so we have the registry and can just do this - let mut app = App::new(); - app.register_lua_proxy::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestStruct { - value: 123, - proxy: TestProxied, - proxies: vec![TestProxied], - }, - "test.proxies[1]", - |mut r| { - r.index_path(ParsedPath::parse_static("proxies").unwrap()); - r.index_path(ParsedPath::parse_static("[0]").unwrap()); - LuaTestProxied(r) - }, - ); - - let mut app = App::new(); - app.register_lua_proxy::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestTupleStruct(123, TestProxied, vec![TestProxied]), - "test._3[1]", - |mut r| { - r.index_path(ParsedPath::parse_static(".2").unwrap()); - r.index_path(ParsedPath::parse_static("[0]").unwrap()); - LuaTestProxied(r) - }, - ); - - let mut app = App::new(); - app.register_lua_proxy::(); - - assert_lua_set_get_returns( - app.world_mut(), - TestTupleEnum::Proxies(vec![TestProxied]), - "test._1[1]", - |mut r| { - r.index_path(ParsedPath::parse_static(".0").unwrap()); - r.index_path(ParsedPath::parse_static("[0]").unwrap()); - LuaTestProxied(r) - }, - ); - } -} +// #[cfg(test)] +// mod test { + +// use bevy::{ +// app::App, +// ecs::{reflect::AppTypeRegistry, world::World}, +// reflect::{FromReflect, OffsetAccess, Reflect}, +// }; +// use bevy_mod_scripting_core::{ +// bindings::ReflectAllocator, +// bindings::{ReflectBase, ReflectBaseType, WorldAccessGuard, WorldCallbackAccess}, +// }; +// use bevy_mod_scripting_derive::LuaProxy; + +// use crate::{bindings::world::LuaWorld, type_data::RegisterLua}; + +// use super::*; + +// #[derive(Reflect)] +// struct TestStruct { +// value: usize, +// proxy: TestProxied, +// proxies: Vec, +// } + +// #[derive(Reflect)] +// struct TestTupleStruct(usize, TestProxied, Vec); + +// #[derive(Reflect)] +// enum TestTupleEnum { +// Value(usize), +// Proxy(TestProxied), +// Proxies(Vec), +// } + +// #[derive(Reflect, LuaProxy)] +// #[proxy(bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate")] +// #[reflect(LuaProxied)] +// pub struct TestProxied; + +// impl PartialEq for LuaTestProxied { +// fn eq(&self, other: &Self) -> bool { +// self.0 == other.0 +// } +// } + +// /// asserts that setting then indexing into a LuaReflectReference of type T with the given expression returns the expected value. +// /// Provides `t and `world` globals, with t being the LuaReflectReference to the provided value. +// fn assert_lua_set_get_returns< +// T: Reflect, +// F: Fn(ReflectReference) -> O, +// O: for<'l> FromLua<'l> + for<'l> IntoLua<'l> + PartialEq + std::fmt::Debug, +// >( +// mut world: &mut World, +// val: T, +// expr: &'static str, +// expected: F, +// ) { +// let lua = Lua::new(); +// let mut allocator = ReflectAllocator::default(); +// let reflect_ref = LuaReflectReference(ReflectReference::new_allocated(val, &mut allocator)); +// world.insert_resource(allocator); + +// WorldCallbackAccess::with_callback_access(world, |access| { +// let globals = lua.globals(); +// globals.set("test", reflect_ref.clone()).unwrap(); +// globals.set("world", LuaWorld(access.clone())).unwrap(); +// globals +// .set("expected", expected(reflect_ref.0.clone())) +// .unwrap(); + +// let lua_code = format!( +// r#" +// {expr} = expected +// return {expr} +// "# +// ); +// let result = lua +// .load(&lua_code) +// .into_function() +// .unwrap_or_else(|e| panic!("Could not load lua code into function: `{e}`")) +// .call(()) +// .unwrap_or_else(|e| { +// panic!("Could not convert expression value to expected type: `{e}`") +// }); +// let result: O = result; +// assert_eq!(result, expected(reflect_ref.0)); +// }); +// } + +// #[test] +// fn test_index_lua_value() { +// // so we have the registry and can just do this +// let mut app = App::new(); +// app.register_lua_value::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestStruct { +// value: 123, +// proxy: TestProxied, +// proxies: vec![], +// }, +// "test.value", +// |_| 123usize, +// ); + +// let mut app = App::new(); +// app.register_lua_value::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestTupleStruct(123, TestProxied, vec![]), +// "test._1", +// |_| 123usize, +// ); + +// let mut app = App::new(); +// app.register_lua_value::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestTupleEnum::Value(123usize), +// "test._1", +// |_| 123usize, +// ); +// } + +// #[test] +// fn test_index_lua_proxy() { +// // so we have the registry and can just do this +// let mut app = App::new(); +// app.register_lua_proxy::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestStruct { +// value: 123, +// proxy: TestProxied, +// proxies: vec![], +// }, +// "test.proxy", +// |mut r| { +// r.index_path(ParsedPath::parse_static("proxy").unwrap()); +// LuaTestProxied(r) +// }, +// ); + +// let mut app = App::new(); +// app.register_lua_proxy::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestTupleStruct(123, TestProxied, vec![]), +// "test._2", +// |mut r| { +// r.index_path(ParsedPath::parse_static(".1").unwrap()); +// LuaTestProxied(r) +// }, +// ); + +// let mut app = App::new(); +// app.register_lua_proxy::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestTupleEnum::Proxy(TestProxied), +// "test._1", +// |mut r| { +// r.index_path(ParsedPath::parse_static(".0").unwrap()); +// LuaTestProxied(r) +// }, +// ); +// } + +// #[test] +// fn test_index_lua_proxy_vec() { +// // so we have the registry and can just do this +// let mut app = App::new(); +// app.register_lua_proxy::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestStruct { +// value: 123, +// proxy: TestProxied, +// proxies: vec![TestProxied], +// }, +// "test.proxies[1]", +// |mut r| { +// r.index_path(ParsedPath::parse_static("proxies").unwrap()); +// r.index_path(ParsedPath::parse_static("[0]").unwrap()); +// LuaTestProxied(r) +// }, +// ); + +// let mut app = App::new(); +// app.register_lua_proxy::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestTupleStruct(123, TestProxied, vec![TestProxied]), +// "test._3[1]", +// |mut r| { +// r.index_path(ParsedPath::parse_static(".2").unwrap()); +// r.index_path(ParsedPath::parse_static("[0]").unwrap()); +// LuaTestProxied(r) +// }, +// ); + +// let mut app = App::new(); +// app.register_lua_proxy::(); + +// assert_lua_set_get_returns( +// app.world_mut(), +// TestTupleEnum::Proxies(vec![TestProxied]), +// "test._1[1]", +// |mut r| { +// r.index_path(ParsedPath::parse_static(".0").unwrap()); +// r.index_path(ParsedPath::parse_static("[0]").unwrap()); +// LuaTestProxied(r) +// }, +// ); +// } +// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs new file mode 100644 index 0000000000..2859dac47e --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -0,0 +1,68 @@ +use std::ops::{Deref, DerefMut}; + +use bevy_mod_scripting_core::bindings::{script_val::ScriptValue, ReflectBase}; +use mlua::{FromLua, Value}; + +use super::reference::LuaReflectReference; + +#[derive(Debug, Clone)] +pub struct LuaScriptValue(ScriptValue); + +impl Deref for LuaScriptValue { + type Target = ScriptValue; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for LuaScriptValue { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl From for LuaScriptValue { + fn from(value: ScriptValue) -> Self { + LuaScriptValue(value) + } +} + +impl<'lua> FromLua<'lua> for LuaScriptValue { + fn from_lua(value: mlua::Value<'lua>, lua: &'lua mlua::Lua) -> mlua::Result { + Ok(match value { + Value::Nil => ScriptValue::Unit, + Value::Boolean(b) => ScriptValue::Bool(b), + // Value::LightUserData(light_user_data) => todo!(), + Value::Integer(i) => ScriptValue::Integer(i), + Value::Number(n) => ScriptValue::Float(n), + Value::String(s) => ScriptValue::String(s.to_str()?.to_owned().into()), + // Value::Table(table) => todo!(), + // Value::Function(function) => todo!(), + // Value::Thread(thread) => todo!(), + Value::UserData(ud) => { + let ud = ud.take::()?; + if ud.0.base.base_id == ReflectBase::World { + ScriptValue::World + } else { + ScriptValue::Reference(ud.into()) + } + } + // Value::Error(error) => todo!(), + _ => { + return Err(mlua::Error::FromLuaConversionError { + from: value.type_name(), + to: "ScriptValue", + message: Some("unsupported value type".to_owned()), + }) + } + } + .into()) + } +} + +impl From for ScriptValue { + fn from(value: LuaScriptValue) -> Self { + value.0 + } +} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs deleted file mode 100644 index 41a3e35c00..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/std.rs +++ /dev/null @@ -1,39 +0,0 @@ -// use tealr::{ -// mlu::{mlua::IntoLua, TealData}, -// ToTypename, -// }; - -// pub struct LuaResult(Result); - -// impl TealData for LuaResult -// where -// T: ToTypename + for<'l> IntoLua<'l>, -// E: ToTypename + for<'l> IntoLua<'l>, -// { -// fn add_methods<'lua, M: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut M) { -// methods.add_method("is_ok", |_, this, _: ()| Ok(this.0.is_ok())); -// methods.add_method("is_err", |_, this, _: ()| Ok(this.0.is_err())); -// methods.add_function("unwrap", |_, this: LuaResult| match this.0 { -// Ok(value) => Ok(value), -// Err(_) => Err(tealr::mlu::mlua::Error::RuntimeError( -// "called `LuaResult::unwrap()` on an `Err` value".to_string(), -// )), -// }); -// methods.add_method("unwrap_err", |_, this, _: ()| match &this.0 { -// Ok(_) => Err(tealr::mlu::mlua::Error::RuntimeError( -// "called `LuaResult::unwrap_err()` on an `Ok` value".to_string(), -// )), -// Err(value) => Ok(value), -// }); -// } - -// fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} -// } - -// impl ToTypename for LuaResult { -// fn to_typename() -> tealr::Type { -// let t = std::any::type_name::(); -// let e = std::any::type_name::(); -// tealr::Type::new_single(format!("LuaResult<{t},{e}>"), tealr::KindOfType::External) -// } -// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 771a792769..65ad7b1c7b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -1,43 +1,25 @@ use std::sync::Arc; use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; -use bevy::prelude::Entity; +use bevy::prelude::{AppFunctionRegistry, Entity, World}; +use bevy_mod_scripting_core::bindings::function::CallableWithAccess; +use bevy_mod_scripting_core::bindings::WorldGuard; +use bevy_mod_scripting_core::error::FunctionError; use bevy_mod_scripting_core::{ bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, error::ScriptError, }; use bevy_mod_scripting_derive::LuaProxy; -use tealr::mlu::mlua::IntoLua; -use tealr::{ - mlu::{ - mlua::{self, FromLua}, - FromToLua, TealData, - }, - ToTypename, Type, -}; - -// use super::proxy::LuaReflectRefProxy; -use super::query::LuaQueryBuilder; -use super::{ - providers::bevy_ecs::LuaEntity, - // proxy::{ - // ErrorProxy, LuaIdentityProxy, LuaProxied, LuaReflectValProxy, LuaValProxy, TypenameProxy, - // }, - type_registration::LuaTypeRegistration, -}; -use crate::util::Variadic; -use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata}; +use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; +use mlua::{MetaMethod, UserData, UserDataFields, UserDataMethods, Value, Variadic}; -pub struct Nil; +use super::script_value::LuaScriptValue; -impl ToTypename for Nil { - fn to_typename() -> Type { - Type::new_single("nil", tealr::KindOfType::Builtin) - } -} +// use super::proxy::LuaReflectRefProxy; +// use super::query::LuaQueryBuilder; -#[derive(Clone, Debug)] +#[derive(Clone, Debug, mlua::FromLua)] pub struct LuaWorld(pub WorldCallbackAccess); impl LuaWorld { @@ -46,374 +28,396 @@ impl LuaWorld { } } -impl ToTypename for LuaWorld { - fn to_typename() -> Type { - Type::new_single("LuaWorld", tealr::KindOfType::External) +impl UserData for LuaWorld { + fn add_methods<'lua, T: UserDataMethods<'lua, Self>>(methods: &mut T) { + // methods.add_meta_function( + // MetaMethod::Index, + // |lua, (world, key): (LuaWorld, String)| { + // // func.with_call(args, world, f) + // // Ok(()) + // let func = lua.create_function(move |lua, args: Variadic| { + // let world = world.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error( + // "Stale world access", + // )) + // })?; + + // let registry = + // world.with_resource(|registry: &AppFunctionRegistry| registry.clone()); + // let registry = registry.read(); + // let func = registry + // .get_namespaced_function::(key.clone()) + // .ok_or_else(|| { + // mlua::Error::external(FunctionError::FunctionNotFound { + // function_name: key.clone().into(), + // type_: Some("World".into()), + // }) + // })?; + // let info = func.info(); + // println!("Calling function {:?} with args: {:?}", info.name(), args); + + // Ok(()) + // })?; + + // Ok(func) + // }, + // ); + + // methods.add_method("_list_accesses", |_, this, ()| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let accesses = world + // .list_accesses() + // .into_iter() + // .map(|v| format!("Access to: {v:?}")) + // .collect::>(); + // Ok(accesses) + // }); + + // methods.add_method("spawn", |_, this, ()| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let entity: LuaReflectValProxy = world + // .proxy_call((), |()| world.spawn()) + // .map_err(mlua::Error::external)?; + // Ok(entity) + // }); + + // methods.add_method("get_type_by_name", |_, this, type_name: String| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Option> = world + // .proxy_call(type_name, |type_name| world.get_type_by_name(type_name)) + // .map_err(mlua::Error::external)?; + + // Ok(out) + // }); + + // methods.add_method( + // "add_default_component", + // |_, + // this, + // args: ( + // LuaReflectValProxy, + // LuaValProxy, + // )| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(args, |(entity, registration)| { + // world.add_default_component(entity, registration) + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "get_component", + // |_, + // this, + // args: ( + // LuaReflectValProxy, + // LuaValProxy, + // )| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result>, ErrorProxy> = + // world + // .proxy_call(args, |(entity, component_id)| { + // match component_id.component_id() { + // Some(component_id) => world.get_component(entity, component_id), + // None => Ok(None), + // } + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::< + // _, + // Option>, + // >::new(out)) + // }, + // ); + + // methods.add_method( + // "has_component", + // |_, + // this, + // args: ( + // LuaReflectValProxy, + // LuaValProxy, + // )| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result> = world + // .proxy_call(args, |(entity, registration)| { + // match registration.component_id() { + // Some(component_id) => world.has_component(entity, component_id), + // None => Ok(false), + // } + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, bool>::new(out)) + // }, + // ); + + // methods.add_method( + // "remove_component", + // |_, + // this, + // args: ( + // LuaReflectValProxy, + // LuaValProxy, + // )| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(args, |(entity, registration)| { + // world.remove_component(entity, registration) + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "get_resource", + // |_, this, registration: LuaValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result>, ErrorProxy> = + // world + // .proxy_call(registration, |registration| { + // match registration.resource_id { + // Some(resource_id) => world.get_resource(resource_id), + // None => Ok(None), + // } + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, LuaReflectRefProxy>::new(out)) + // }, + // ); + + // methods.add_method( + // "remove_resource", + // |_, this, registration: LuaValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(registration, |registration| { + // world.remove_resource(registration) + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "has_resource", + // |_, this, registration: LuaValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: bool = world + // .proxy_call(registration, |registration| { + // match registration.resource_id { + // Some(resource_id) => world.has_resource(resource_id), + // None => false, + // } + // }) + // .map_err(mlua::Error::external)?; + + // Ok(out) + // }, + // ); + + // methods.add_method( + // "has_entity", + // |_, this, entity: LuaReflectValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: bool = world + // .proxy_call(entity, |entity| world.has_entity(entity)) + // .map_err(mlua::Error::external)?; + + // Ok(out) + // }, + // ); + + // methods.add_method( + // "get_children", + // |_, this, entity: LuaReflectValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result>, ErrorProxy> = world + // .proxy_call(entity, |entity| world.get_children(entity)) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Vec>>::new( + // out, + // )) + // }, + // ); + + // methods.add_method( + // "get_parent", + // |_, this, entity: LuaReflectValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result>, ErrorProxy> = + // world + // .proxy_call(entity, |entity| world.get_parent(entity)) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Option>>::new( + // out, + // )) + // }, + // ); + + // methods.add_method( + // "push_children", + // |_, this, args: (LuaReflectValProxy, Vec>)| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(args, |(parent, children)| { + // world.push_children(parent, &children) + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "remove_children", + // |_, this, args: (LuaReflectValProxy, Vec>)| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(args, |(parent, children)| { + // world.remove_children(parent, &children) + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "insert_children", + // |_, + // this, + // args: ( + // LuaReflectValProxy, + // usize, + // Vec>, + // )| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(args, |(parent, index, children)| { + // world.insert_children(parent, index - 1, &children) + // }) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "despawn_recursive", + // |_, this, entity: LuaReflectValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(entity, |entity| world.despawn_recursive(entity)) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method("despawn", |_, this, entity: LuaReflectValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(entity, |entity| world.despawn(entity)) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }); + + // methods.add_method( + // "despawn_descendants", + // |_, this, entity: LuaReflectValProxy| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let out: Result<(), ErrorProxy> = world + // .proxy_call(entity, |entity| world.despawn_descendants(entity)) + // .map_err(mlua::Error::external)?; + + // Ok(TypenameProxy::<_, Nil>::new(out)) + // }, + // ); + + // methods.add_method( + // "query", + // |_, this, mut components: Variadic>| { + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // let mut builder = LuaQueryBuilder::default(); + // let deque = components.0; + // builder.components( + // deque + // .into_iter() + // .map(|mut c| c.unproxy()) + // .collect::>() + // .map_err(tealr::mlu::mlua::Error::external)?, + // ); + // Ok(builder) + // }, + // ); + + // methods.add_method("exit", |lua, this, ()| { + // // TODO: somehow end control flow on lua side + // let world = this.0.read().ok_or_else(|| { + // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + // })?; + // world.exit(); + // Ok(()) + // }); } } -impl TealData for LuaWorld { - fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.add_method("_list_accesses", |_, this, ()| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let accesses = world - .list_accesses() - .into_iter() - .map(|v| format!("Access to: {v:?}")) - .collect::>(); - Ok(accesses) - }); - - methods.add_method("spawn", |_, this, ()| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let entity: LuaReflectValProxy = world - .proxy_call((), |()| world.spawn()) - .map_err(mlua::Error::external)?; - Ok(entity) - }); - - methods.add_method("get_type_by_name", |_, this, type_name: String| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Option> = world - .proxy_call(type_name, |type_name| world.get_type_by_name(type_name)) - .map_err(mlua::Error::external)?; - - Ok(out) - }); - - methods.add_method( - "add_default_component", - |_, - this, - args: ( - LuaReflectValProxy, - LuaValProxy, - )| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(args, |(entity, registration)| { - world.add_default_component(entity, registration) - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "get_component", - |_, - this, - args: ( - LuaReflectValProxy, - LuaValProxy, - )| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result>, ErrorProxy> = - world - .proxy_call(args, |(entity, component_id)| { - match component_id.component_id() { - Some(component_id) => world.get_component(entity, component_id), - None => Ok(None), - } - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::< - _, - Option>, - >::new(out)) - }, - ); - - methods.add_method( - "has_component", - |_, - this, - args: ( - LuaReflectValProxy, - LuaValProxy, - )| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result> = world - .proxy_call(args, |(entity, registration)| { - match registration.component_id() { - Some(component_id) => world.has_component(entity, component_id), - None => Ok(false), - } - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, bool>::new(out)) - }, - ); - - methods.add_method( - "remove_component", - |_, - this, - args: ( - LuaReflectValProxy, - LuaValProxy, - )| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(args, |(entity, registration)| { - world.remove_component(entity, registration) - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "get_resource", - |_, this, registration: LuaValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result>, ErrorProxy> = - world - .proxy_call(registration, |registration| { - match registration.resource_id { - Some(resource_id) => world.get_resource(resource_id), - None => Ok(None), - } - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, LuaReflectRefProxy>::new(out)) - }, - ); - - methods.add_method( - "remove_resource", - |_, this, registration: LuaValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(registration, |registration| { - world.remove_resource(registration) - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "has_resource", - |_, this, registration: LuaValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: bool = world - .proxy_call(registration, |registration| { - match registration.resource_id { - Some(resource_id) => world.has_resource(resource_id), - None => false, - } - }) - .map_err(mlua::Error::external)?; - - Ok(out) - }, - ); - - methods.add_method( - "has_entity", - |_, this, entity: LuaReflectValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: bool = world - .proxy_call(entity, |entity| world.has_entity(entity)) - .map_err(mlua::Error::external)?; - - Ok(out) - }, - ); - - methods.add_method( - "get_children", - |_, this, entity: LuaReflectValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result>, ErrorProxy> = world - .proxy_call(entity, |entity| world.get_children(entity)) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Vec>>::new( - out, - )) - }, - ); - - methods.add_method( - "get_parent", - |_, this, entity: LuaReflectValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result>, ErrorProxy> = - world - .proxy_call(entity, |entity| world.get_parent(entity)) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Option>>::new( - out, - )) - }, - ); - - methods.add_method( - "push_children", - |_, this, args: (LuaReflectValProxy, Vec>)| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(args, |(parent, children)| { - world.push_children(parent, &children) - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "remove_children", - |_, this, args: (LuaReflectValProxy, Vec>)| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(args, |(parent, children)| { - world.remove_children(parent, &children) - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "insert_children", - |_, - this, - args: ( - LuaReflectValProxy, - usize, - Vec>, - )| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(args, |(parent, index, children)| { - world.insert_children(parent, index - 1, &children) - }) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "despawn_recursive", - |_, this, entity: LuaReflectValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(entity, |entity| world.despawn_recursive(entity)) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method("despawn", |_, this, entity: LuaReflectValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(entity, |entity| world.despawn(entity)) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }); - - methods.add_method( - "despawn_descendants", - |_, this, entity: LuaReflectValProxy| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let out: Result<(), ErrorProxy> = world - .proxy_call(entity, |entity| world.despawn_descendants(entity)) - .map_err(mlua::Error::external)?; - - Ok(TypenameProxy::<_, Nil>::new(out)) - }, - ); - - methods.add_method( - "query", - |_, this, mut components: Variadic>| { - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - let mut builder = LuaQueryBuilder::default(); - let deque = components.0; - builder.components( - deque - .into_iter() - .map(|mut c| c.unproxy()) - .collect::>() - .map_err(tealr::mlu::mlua::Error::external)?, - ); - Ok(builder) - }, - ); - - methods.add_method("exit", |lua, this, ()| { - // TODO: somehow end control flow on lua side - let world = this.0.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - })?; - world.exit(); - Ok(()) - }); - } - - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(_fields: &mut F) {} -} - -impl_userdata_from_lua!(LuaWorld); -impl_userdata_with_tealdata!(LuaWorld); - -impl LuaProxied for WorldCallbackAccess { - type Proxy = LuaWorld; -} +// impl LuaProxied for WorldCallbackAccess { +// type Proxy = LuaWorld; +// } impl From<&LuaWorld> for WorldCallbackAccess { fn from(value: &LuaWorld) -> Self { @@ -422,24 +426,31 @@ impl From<&LuaWorld> for WorldCallbackAccess { } pub trait GetWorld { - fn get_world(&self) -> Arc>; + fn get_world(&self) -> WorldGuard<'static>; fn try_get_world(&self) -> Result>, mlua::Error>; } impl GetWorld for mlua::Lua { fn try_get_world(&self) -> Result>, mlua::Error> { - self.globals() - .get::<_, LuaValProxy>("world")? - .unproxy() - .and_then(|guard| { - guard - .read() - .ok_or_else(|| ScriptError::new_reflection_error("Stale world access")) - }) - .map_err(mlua::Error::external) + // self.globals() + // .get::<_, LuaWorld>("world")? + // .0 + // .read() + // .ok_or_else(|| ScriptError::new_reflection_error("Stale world access")) + // .map_err(mlua::Error::external) + let access = self.app_data_ref::().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error( + "World was not initialized", + )) + })?; + + access.read().ok_or_else(|| { + mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) + }) + // todo!() } - fn get_world(&self) -> Arc> { + fn get_world(&self) -> WorldGuard<'static> { self.try_get_world() .expect("global 'world' did not exist or was invalid. Cannot retrieve world") } diff --git a/crates/languages/bevy_mod_scripting_lua/src/docs.rs b/crates/languages/bevy_mod_scripting_lua/src/docs.rs index e783d4f5b4..63a56ca965 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/docs.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/docs.rs @@ -11,9 +11,6 @@ use std::{ //use bevy::asset::FileAssetIo; use bevy::asset::io::file::FileAssetReader; use bevy_mod_scripting_core::prelude::*; -use tealr::{NameContainer, TypeGenerator, TypeWalker}; - -pub type TypeWalkerBuilder = fn(TypeWalker) -> TypeWalker; static DEFAULT_DOC_CONFIG: fn(&str) -> String = |s| { format!( @@ -48,7 +45,7 @@ return { "#; struct Fragment { - builder: TypeWalkerBuilder, + builder: (), } pub struct LuaDocumentationFragment { @@ -56,17 +53,6 @@ pub struct LuaDocumentationFragment { walker: Vec, } -/// A piece of lua documentation, -/// Each piece is combined into one large documentation page, and also a single teal declaration file if the `teal` feature is enabled -impl LuaDocumentationFragment { - pub fn new(name: &'static str, f: TypeWalkerBuilder) -> Self { - Self { - name, - walker: vec![Fragment { builder: f }], - } - } -} - impl DocumentationFragment for LuaDocumentationFragment { fn name(&self) -> &'static str { self.name @@ -78,126 +64,127 @@ impl DocumentationFragment for LuaDocumentationFragment { } fn gen_docs(self) -> Result<(), Box> { - let script_asset_path = &FileAssetReader::get_base_path() - .join("assets") - .join("scripts"); - - let script_doc_dir = &env::var("SCRIPT_DOC_DIR") - .map(|v| v.into()) - .unwrap_or_else(|_e| script_asset_path.join("doc")); - - fs::create_dir_all(script_doc_dir) - .expect("Could not create `.../assets/scripts/doc` directories"); - - let docs_name = self.name().to_owned(); - - // build the type walker - let mut tw = self - .walker - .into_iter() - .fold(TypeWalker::new(), |a, v| (v.builder)(a)); - - // fixes bug in tealr which causes syntax errors in teal due to duplicate fields (from having both getters and setters) - 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())); - rg.fields.dedup_by(|a, b| a.name == b.name); - rg.static_fields - .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); - } - for func in rg - .functions - .iter_mut() - .chain(rg.mut_functions.iter_mut()) - .chain(rg.methods.iter_mut()) - .chain(rg.mut_methods.iter_mut()) - { - escape_name(&mut func.name); - } - } - }); - - // generate json file - let json = serde_json::to_string_pretty(&tw)?; - - let json_path = script_doc_dir.join(format!("{}.json", docs_name)); - - (File::create(json_path).and_then(|mut file| { - file.write_all(json.as_bytes())?; - file.flush() - }))?; - // generate doc config files if they don't exist - if !script_doc_dir.join("tealr_doc_gen_config.json").exists() { - let config_path = script_doc_dir.join("tealr_doc_gen_config.json"); - (File::create(config_path) - .and_then(|mut file| file.write_all(DEFAULT_DOC_CONFIG(&docs_name).as_bytes())))? - } - - // generate docs - (Command::new("tealr_doc_gen") - .current_dir(script_doc_dir) - .args(["run"]) - .status())?; - - #[cfg(feature = "teal")] - { - // now manage the definition (d.tl) file - let definition_directory = script_asset_path.join("types"); - (fs::create_dir_all(&definition_directory))?; - - let definition_file_path = script_doc_dir - .join(&docs_name) - .join("definitions") - .join(docs_name + ".d.tl"); - let output_definition_file_path = script_asset_path.join("types").join("types.d.tl"); - (fs::copy(&definition_file_path, &output_definition_file_path))?; - - // finally create a tlconfig.lua file if doesn't exist - // we do this to avoid problems with varying teal configurations - // keep em settings consistent everywhere - let tl_config_path = script_asset_path.join("tlconfig.lua"); - if !tl_config_path.exists() { - let mut tl_file = (File::create(tl_config_path))?; - (tl_file.write_all(DEFAULT_TEAL_CONFIG.as_bytes()))?; - } - } - Ok(()) + todo!() + // let script_asset_path = &FileAssetReader::get_base_path() + // .join("assets") + // .join("scripts"); + + // let script_doc_dir = &env::var("SCRIPT_DOC_DIR") + // .map(|v| v.into()) + // .unwrap_or_else(|_e| script_asset_path.join("doc")); + + // fs::create_dir_all(script_doc_dir) + // .expect("Could not create `.../assets/scripts/doc` directories"); + + // let docs_name = self.name().to_owned(); + + // // build the type walker + // let mut tw = self + // .walker + // .into_iter() + // .fold(TypeWalker::new(), |a, v| (v.builder)(a)); + + // // fixes bug in tealr which causes syntax errors in teal due to duplicate fields (from having both getters and setters) + // 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())); + // rg.fields.dedup_by(|a, b| a.name == b.name); + // rg.static_fields + // .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); + // } + // for func in rg + // .functions + // .iter_mut() + // .chain(rg.mut_functions.iter_mut()) + // .chain(rg.methods.iter_mut()) + // .chain(rg.mut_methods.iter_mut()) + // { + // escape_name(&mut func.name); + // } + // } + // }); + + // // generate json file + // let json = serde_json::to_string_pretty(&tw)?; + + // let json_path = script_doc_dir.join(format!("{}.json", docs_name)); + + // (File::create(json_path).and_then(|mut file| { + // file.write_all(json.as_bytes())?; + // file.flush() + // }))?; + // // generate doc config files if they don't exist + // if !script_doc_dir.join("tealr_doc_gen_config.json").exists() { + // let config_path = script_doc_dir.join("tealr_doc_gen_config.json"); + // (File::create(config_path) + // .and_then(|mut file| file.write_all(DEFAULT_DOC_CONFIG(&docs_name).as_bytes())))? + // } + + // // generate docs + // (Command::new("tealr_doc_gen") + // .current_dir(script_doc_dir) + // .args(["run"]) + // .status())?; + + // #[cfg(feature = "teal")] + // { + // // now manage the definition (d.tl) file + // let definition_directory = script_asset_path.join("types"); + // (fs::create_dir_all(&definition_directory))?; + + // let definition_file_path = script_doc_dir + // .join(&docs_name) + // .join("definitions") + // .join(docs_name + ".d.tl"); + // let output_definition_file_path = script_asset_path.join("types").join("types.d.tl"); + // (fs::copy(&definition_file_path, &output_definition_file_path))?; + + // // finally create a tlconfig.lua file if doesn't exist + // // we do this to avoid problems with varying teal configurations + // // keep em settings consistent everywhere + // let tl_config_path = script_asset_path.join("tlconfig.lua"); + // if !tl_config_path.exists() { + // let mut tl_file = (File::create(tl_config_path))?; + // (tl_file.write_all(DEFAULT_TEAL_CONFIG.as_bytes()))?; + // } + // } + // Ok(()) } } -/// Escapes a name of a table field, if that table field is a reserved keyword. -/// -/// ## Background -/// -/// String keys in a Lua table are allowed to be anything, even reserved -/// keywords. By default when tealr generates the type definition for a table -/// field, the string it generates is `{name} : {type}`. This causes a syntax -/// error when writing a bare keyword, since `nil : {type}` is considered trying -/// to add a type to the *value* nil (which is invalid). -/// -/// To get around this tealr allows us to escape table fields using the -/// `["{name}"] : {value}` syntax. This function detects if a name is one of the -/// Lua reserved words and fixes it if so. -fn escape_name(raw: &mut NameContainer) { - // List of Lua reserved keywords - const KEYWORD_FIELDS: &[&str] = &[ - "false", "true", "nil", // Values - "and", "not", "or", // Operators - "if", "then", "else", "elseif", "end", // If-Else - "for", "in", "break", "do", "repeat", "until", "while", // Loops - "function", "return", // Funcs - "local", // Declarations - "record", // Teal extra - ]; - let Ok(name) = str::from_utf8(raw) else { - return; - }; - if KEYWORD_FIELDS.contains(&name) { - let mapped = format!("[\"{name}\"]"); - *raw = NameContainer::from(Cow::Owned(mapped)); - } -} +// /// Escapes a name of a table field, if that table field is a reserved keyword. +// /// +// /// ## Background +// /// +// /// String keys in a Lua table are allowed to be anything, even reserved +// /// keywords. By default when tealr generates the type definition for a table +// /// field, the string it generates is `{name} : {type}`. This causes a syntax +// /// error when writing a bare keyword, since `nil : {type}` is considered trying +// /// to add a type to the *value* nil (which is invalid). +// /// +// /// To get around this tealr allows us to escape table fields using the +// /// `["{name}"] : {value}` syntax. This function detects if a name is one of the +// /// Lua reserved words and fixes it if so. +// fn escape_name(raw: &mut NameContainer) { +// // List of Lua reserved keywords +// const KEYWORD_FIELDS: &[&str] = &[ +// "false", "true", "nil", // Values +// "and", "not", "or", // Operators +// "if", "then", "else", "elseif", "end", // If-Else +// "for", "in", "break", "do", "repeat", "until", "while", // Loops +// "function", "return", // Funcs +// "local", // Declarations +// "record", // Teal extra +// ]; +// let Ok(name) = str::from_utf8(raw) else { +// return; +// }; +// if KEYWORD_FIELDS.contains(&name) { +// let mapped = format!("[\"{name}\"]"); +// *raw = NameContainer::from(Cow::Owned(mapped)); +// } +// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index ad0057427a..34b9b5b8dd 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -1,6 +1,6 @@ pub mod assets; pub mod docs; -pub mod type_data; +// pub mod type_data; pub mod util; use bevy::{ app::{App, Plugin, Startup}, @@ -18,25 +18,20 @@ use bevy_mod_scripting_core::{ AddContextPreHandlingInitializer, ScriptingPlugin, }; use bindings::{ - providers::bevy_ecs::LuaEntity, + // providers::bevy_ecs::LuaEntity, // proxy::LuaProxied, + reference::LuaReflectReference, world::{GetWorld, LuaWorld}, }; -pub use tealr; +pub use mlua; +use mlua::{Function, IntoLuaMulti, Lua}; pub mod bindings; -use tealr::mlu::mlua::{FromLua, Function, IntoLua, IntoLuaMulti, Lua, Value}; -use type_data::{ - pre_register_common_containers, register_lua_values, ReflectLuaProxied, ReflectLuaValue, -}; +// use type_data::{ +// pre_register_common_containers, register_lua_values, ReflectLuaProxied, ReflectLuaValue, +// }; pub mod prelude { - pub use crate::tealr::{ - self, - mlu::{ - mlua::{self, prelude::*, Value}, - TealData, - }, - }; + pub use crate::mlua::{self, prelude::*, Value}; } pub trait LuaEventArg: Args + for<'l> IntoLuaMulti<'l> {} @@ -66,26 +61,26 @@ impl Default for LuaScriptingPlugin { impl Plugin for LuaScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); - register_lua_values(app); + // register_lua_values(app); app.add_context_pre_handling_initializer::<()>(|script_id, entity, context: &mut Lua| { let world = context.get_world(); - let lua_entity = world.with_resource::(|_, mut allocator| { - let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); - ::Proxy::from(reflect_reference) - }); + // let lua_entity = world.with_resource::(|_, mut allocator| { + // let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); + // ::Proxy::from(reflect_reference) + // }); context.globals().set("script_id", script_id.to_owned())?; - context.globals().set("entity", lua_entity)?; + // context.globals().set("entity", lua_entity)?; Ok(()) }); } fn cleanup(&self, app: &mut App) { - let mut type_registry = app.world_mut().get_resource_mut().unwrap(); + // let mut type_registry = app.world_mut().get_resource_mut().unwrap(); // we register up to two levels of nesting, if more are needed, the user will have to do this manually - pre_register_common_containers(&mut type_registry); - pre_register_common_containers(&mut type_registry); + // pre_register_common_containers(&mut type_registry); + // pre_register_common_containers(&mut type_registry); } } @@ -172,7 +167,10 @@ pub fn with_world Result<(), ScriptError>>( f: F, ) -> Result<(), ScriptError> { WorldCallbackAccess::with_callback_access(world, |guard| { - context.globals().set("world", LuaWorld(guard.clone()))?; + context + .globals() + .set("world", LuaReflectReference(ReflectReference::new_world()))?; + context.set_app_data(guard.clone()); f(context) }) } diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs index 1a1f453478..cc9418b075 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs @@ -225,6 +225,11 @@ impl ReflectLuaProxied { } } +/// Temp for compat +pub trait LuaProxied { + type Proxy; +} + impl FromType for ReflectLuaProxied where T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, diff --git a/crates/languages/bevy_mod_scripting_lua/src/util.rs b/crates/languages/bevy_mod_scripting_lua/src/util.rs index 52d4308a5c..9a1148ff34 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/util.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/util.rs @@ -1,9 +1,9 @@ use std::ops::{Deref, DerefMut}; -use tealr::{ - mlu::mlua::{FromLua, FromLuaMulti, IntoLua, IntoLuaMulti}, - ToTypename, -}; +// use tealr::{ +// mlu::mlua::{FromLua, FromLuaMulti, IntoLua, IntoLuaMulti}, +// ToTypename, +// }; /// generates path to the given script depending on build configuration. /// (optimized builds don't have the teal compiler available) @@ -161,103 +161,103 @@ macro_rules! __cfg_feature_any_lua52_lua53_lua54_luajit52 { ( $( $tok:tt )* ) => {}; } -#[macro_export] -macro_rules! impl_userdata_from_lua { - ($ty:ident) => { - impl<'lua> ::tealr::mlu::mlua::FromLua<'lua> for $ty { - fn from_lua( - value: ::tealr::mlu::mlua::Value<'lua>, - _lua: &::tealr::mlu::mlua::Lua, - ) -> Result { - match value { - tealr::mlu::mlua::Value::UserData(ud) => { - // for types which deref to something else we need to be explicit - let self_ref: std::cell::Ref = ud.borrow::()?; - let self_ref: &Self = std::ops::Deref::deref(&self_ref); - Ok(self_ref.clone()) - } - _ => { - return Err(::tealr::mlu::mlua::Error::FromLuaConversionError { - from: value.type_name(), - to: stringify!($ty), - message: None, - }) - } - } - } - } - }; -} +// #[macro_export] +// macro_rules! impl_userdata_from_lua { +// ($ty:ident) => { +// impl<'lua> ::tealr::mlu::mlua::FromLua<'lua> for $ty { +// fn from_lua( +// value: ::tealr::mlu::mlua::Value<'lua>, +// _lua: &::tealr::mlu::mlua::Lua, +// ) -> Result { +// match value { +// tealr::mlu::mlua::Value::UserData(ud) => { +// // for types which deref to something else we need to be explicit +// let self_ref: std::cell::Ref = ud.borrow::()?; +// let self_ref: &Self = std::ops::Deref::deref(&self_ref); +// Ok(self_ref.clone()) +// } +// _ => { +// return Err(::tealr::mlu::mlua::Error::FromLuaConversionError { +// from: value.type_name(), +// to: stringify!($ty), +// message: None, +// }) +// } +// } +// } +// } +// }; +// } -#[macro_export] -macro_rules! impl_userdata_with_tealdata { - ($ty:ident) => { - impl ::tealr::mlu::mlua::UserData for $ty - where - Self: ::tealr::mlu::TealData, - { - fn add_methods<'lua, T: ::tealr::mlu::mlua::UserDataMethods<'lua, Self>>( - methods: &mut T, - ) { - let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_methods(methods); - ::add_methods(&mut wrapper); - } +// #[macro_export] +// macro_rules! impl_userdata_with_tealdata { +// ($ty:ident) => { +// impl ::tealr::mlu::mlua::UserData for $ty +// where +// Self: ::tealr::mlu::TealData, +// { +// fn add_methods<'lua, T: ::tealr::mlu::mlua::UserDataMethods<'lua, Self>>( +// methods: &mut T, +// ) { +// let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_methods(methods); +// ::add_methods(&mut wrapper); +// } - fn add_fields<'lua, T: ::tealr::mlu::mlua::UserDataFields<'lua, Self>>(fields: &mut T) { - let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_fields(fields); - ::add_fields(&mut wrapper); - } - } - }; -} +// fn add_fields<'lua, T: ::tealr::mlu::mlua::UserDataFields<'lua, Self>>(fields: &mut T) { +// let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_fields(fields); +// ::add_fields(&mut wrapper); +// } +// } +// }; +// } -/// Variadic newtype with [`ToTypename`] implemantation -pub struct Variadic(pub(crate) tealr::mlu::mlua::Variadic); +// /// Variadic newtype with [`ToTypename`] implemantation +// pub struct Variadic(pub(crate) tealr::mlu::mlua::Variadic); -impl Variadic { - pub fn new>(iter: I) -> Self { - Variadic(tealr::mlu::mlua::Variadic::from_iter(iter.into_iter())) - } -} +// impl Variadic { +// pub fn new>(iter: I) -> Self { +// Variadic(tealr::mlu::mlua::Variadic::from_iter(iter.into_iter())) +// } +// } -impl Deref for Variadic { - type Target = tealr::mlu::mlua::Variadic; +// impl Deref for Variadic { +// type Target = tealr::mlu::mlua::Variadic; - fn deref(&self) -> &Self::Target { - &self.0 - } -} +// fn deref(&self) -> &Self::Target { +// &self.0 +// } +// } -impl DerefMut for Variadic { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} +// impl DerefMut for Variadic { +// fn deref_mut(&mut self) -> &mut Self::Target { +// &mut self.0 +// } +// } -impl ToTypename for Variadic { - fn to_typename() -> tealr::Type { - let single_type = T::to_typename(); - let collection_type = >::to_typename(); - tealr::Type::Or(vec![single_type, collection_type]) - } -} +// impl ToTypename for Variadic { +// fn to_typename() -> tealr::Type { +// let single_type = T::to_typename(); +// let collection_type = >::to_typename(); +// tealr::Type::Or(vec![single_type, collection_type]) +// } +// } -impl<'lua, T: FromLua<'lua>> FromLuaMulti<'lua> for Variadic { - fn from_lua_multi( - values: tealr::mlu::mlua::MultiValue<'lua>, - lua: &'lua tealr::mlu::mlua::Lua, - ) -> tealr::mlu::mlua::Result { - Ok(Variadic(tealr::mlu::mlua::Variadic::from_lua_multi( - values, lua, - )?)) - } -} +// impl<'lua, T: FromLua<'lua>> FromLuaMulti<'lua> for Variadic { +// fn from_lua_multi( +// values: tealr::mlu::mlua::MultiValue<'lua>, +// lua: &'lua tealr::mlu::mlua::Lua, +// ) -> tealr::mlu::mlua::Result { +// Ok(Variadic(tealr::mlu::mlua::Variadic::from_lua_multi( +// values, lua, +// )?)) +// } +// } -impl<'lua, T: IntoLua<'lua>> IntoLuaMulti<'lua> for Variadic { - fn into_lua_multi( - self, - lua: &'lua tealr::mlu::mlua::Lua, - ) -> tealr::mlu::mlua::Result> { - self.0.into_lua_multi(lua) - } -} +// impl<'lua, T: IntoLua<'lua>> IntoLuaMulti<'lua> for Variadic { +// fn into_lua_multi( +// self, +// lua: &'lua tealr::mlu::mlua::Lua, +// ) -> tealr::mlu::mlua::Result> { +// self.0.into_lua_multi(lua) +// } +// } diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index a44689c620..073e3134cb 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -3,8 +3,7 @@ use bevy::app::AppExit; use bevy::prelude::*; use bevy::utils::hashbrown::HashMap; use bevy_mod_scripting::lua::LuaScriptingPlugin; -use bevy_mod_scripting::prelude::*; -use bevy_mod_scripting_lua::bindings::providers::LuaBevyScriptingPlugin; +use bevy_mod_scripting::{prelude::*, BevyFunctionsPlugin}; use script::ScriptComponent; #[derive(Component, Default, Reflect)] @@ -74,7 +73,8 @@ fn main() -> std::io::Result<()> { app.add_plugins(DefaultPlugins) .add_plugins(LuaScriptingPlugin::<()>::default()) - .add_plugins(LuaBevyScriptingPlugin) + .add_plugins(BevyFunctionsPlugin) + // .add_plugins(LuaBevyScriptingPlugin) .register_type::() .add_systems(Startup, (init_data, load_script)) .add_systems( diff --git a/src/lib.rs b/src/lib.rs index cb50ebb838..77a11261a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,3 +31,5 @@ pub mod prelude { // #[cfg(feature = "rune")] // pub use bevy_mod_scripting_rune::prelude::*; } + +pub use bevy_mod_scripting_functions::*; From 7743b2e47284b32864d24c584b495d2f8fb1fc0e Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 14 Dec 2024 23:37:24 +0000 Subject: [PATCH 041/217] Implement ScriptValue things --- .vscode/settings.json | 6 + Cargo.toml | 4 + assets/scripts/bevy_api.lua | 28 +- .../src/bindings/function.rs | 128 ++-- .../src/bindings/query.rs | 5 +- .../src/bindings/reference.rs | 20 +- .../src/bindings/script_val.rs | 686 ++++++++++++------ .../src/bindings/world.rs | 3 +- crates/bevy_mod_scripting_core/src/error.rs | 3 +- crates/bevy_mod_scripting_core/src/lib.rs | 7 +- .../src/reflection_extensions.rs | 124 +--- .../bevy_mod_scripting_functions/src/core.rs | 17 +- .../src/bindings/reference.rs | 103 ++- .../src/bindings/script_value.rs | 24 +- .../bevy_mod_scripting_lua/src/lib.rs | 8 +- 15 files changed, 691 insertions(+), 475 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 980f809761..22a322ee64 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -23,5 +23,11 @@ "/home/makspll/git/bevy_mod_scripting/check.sh" ], "rust-analyzer.showUnlinkedFileNotification": false, + "rust-analyzer.runnables.extraTestBinaryArgs": [ + "--show-output", + ], + "rust-analyzer.runnables.extraArgs": [ + "--profile=release-with-debug", + ], // "rust-analyzer.semanticHighlighting.operator.enable": false } \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index ea198b5561..ab670e0f95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -105,6 +105,10 @@ codegen-units = 8 incremental = false debug = false +[profile.release-with-debug] +inherits = "release" +debug = true + [[example]] name = "console_integration_lua" path = "examples/lua/console_integration.rs" diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index a0183bc6f4..df38c45f7b 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -9,26 +9,22 @@ end function on_event() - world:spawn() + print(entity) + print(script) + print(world) - world:exit() - -- print(entity) - -- print(script) - -- print(world) + local my_component_type = world:get_type_by_name("MyComponent") + local comp = world:get_component(entity, my_component_type) + print("Before script: ", comp:print_value()) - -- local my_component_type = world:get_type_by_name("MyComponent") - - -- local comp = world:get_component(entity, my_component_type) - -- print("Before script: ", comp) - - -- print("\noption") - -- print(comp.option_usize) - -- comp.option_usize = 69 - -- print(comp.option_usize) - -- comp.option_usize = nil - -- print(comp.option_usize) + print("\noption") + print(comp.option_usize) + comp.option_usize = 69 + print(comp.option_usize) + comp.option_usize = nil + print(comp.option_usize) -- print("\nvec") -- print(table_to_string(comp.vec_of_usize)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index 7099ebd575..5a504329c6 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -1,14 +1,19 @@ -use std::{borrow::Cow, sync::Arc}; - -use bevy::reflect::func::{ - args::{Arg, ArgInfo, Ownership}, - ArgList, ArgValue, DynamicFunction, FunctionResult, Return, +use std::{borrow::Cow, ops::Deref, sync::Arc}; + +use bevy::reflect::{ + func::{ + args::{Arg, ArgInfo, Ownership}, + ArgList, ArgValue, DynamicFunction, FunctionResult, Return, + }, + PartialReflect, }; -use crate::error::{ScriptError, ScriptResult}; +use crate::error::{ScriptError, ScriptResult, ValueConversionError}; use super::{ - access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_val::ScriptValue, + access_map::ReflectAccessId, + pretty_print::DisplayWithWorld, + script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectBase, ReflectReference, WorldAccessGuard, WorldCallbackAccess, WorldGuard, }; @@ -22,6 +27,18 @@ pub trait CallableWithAccess { world: Arc, f: F, ) -> ScriptResult; + + fn dynamic_call>( + &self, + args: I, + world: Arc, + ) -> ScriptResult { + self.with_call(args, world.clone(), |r| match r { + Return::Owned(partial_reflect) => partial_reflect.as_ref().into_script_value(world), + Return::Ref(ref_) => ref_.into_script_value(world), + Return::Mut(mut_ref) => mut_ref.into_script_value(world), + })? + } } impl CallableWithAccess for DynamicFunction<'_> { @@ -33,14 +50,6 @@ impl CallableWithAccess for DynamicFunction<'_> { ) -> ScriptResult { let info = self.info().args(); - // if info.len() != args.len() { - // return Err(ScriptError::new_reflection_error(format!( - // "Expected {} arguments, got {}", - // info.len(), - // args.len() - // ))); - // } - // We need to: // 1. Claim the correct access for each argument // 2. Convert to ArgsList for the function call @@ -50,10 +59,28 @@ impl CallableWithAccess for DynamicFunction<'_> { // 6. Return the result let arg_iter = args.into_iter(); - let (args_list, mut accesses) = arg_iter.into_args_list_with_access(info, world.clone())?; - // let arc_world = &arc_world; + let (mut args_list, mut accesses) = + arg_iter.into_args_list_with_access(info, world.clone())?; - let return_val = match self.call(args_list) { + let mut final_args_list = ArgList::default(); + // we sometimes want to use the boxed value in the arg instead of allocating and refing to it. + // for this reason let's be lenient in calling functions. Allow passing owned values as refs + for (arg, info) in args_list.iter_mut().zip(info.iter()) { + let next_arg = match (arg, info.ownership()) { + (ArgValue::Owned(r), Ownership::Ref) => { + ArgValue::Ref((r as &Box).as_ref()) + } + (ArgValue::Owned(r), Ownership::Mut) => ArgValue::Mut(r.as_mut()), + (v, _) => { + // muahaha, shouldn't allocate due to ZST + let a = std::mem::replace(v, ArgValue::Owned(Box::new(()))); + a + } + }; + final_args_list = final_args_list.push_arg(next_arg); + } + + let return_val = match self.call(final_args_list) { Ok(return_val) => return_val, Err(e) => { // Safety: we have not generated any unsafe aliases @@ -85,7 +112,7 @@ pub trait IntoArgsListWithAccess { self, arg_info: &[ArgInfo], world: WorldGuard<'w>, - ) -> ScriptResult<(ArgList<'w>, Vec<(ReflectAccessId, Ownership)>)>; + ) -> ScriptResult<(Vec>, Vec<(ReflectAccessId, Ownership)>)>; } impl> IntoArgsListWithAccess for I { @@ -97,17 +124,16 @@ impl> IntoArgsListWithAccess for I { self, arg_info: &[ArgInfo], world: WorldGuard<'w>, - ) -> ScriptResult<(ArgList<'w>, Vec<(ReflectAccessId, Ownership)>)> { - // if self.len() != arg_info.len() { - // return Err(ScriptError::new_reflection_error(format!( - // "Expected {} arguments, got {}", - // arg_info.len(), - // self.len() - // ))); - // } - + ) -> ScriptResult<(Vec>, Vec<(ReflectAccessId, Ownership)>)> { let mut accesses = Vec::default(); - let mut arg_list = ArgList::new(); + let mut arg_list = Vec::default(); + + let release_accesses = |accesses: &mut Vec<(ReflectAccessId, Ownership)>| { + accesses.iter().for_each(|(id, _)| { + // Safety: we have not generated any unsafe aliases + unsafe { world.release_access(*id) }; + }); + }; for (value, arg_info) in self.zip(arg_info.iter()) { match value { @@ -116,7 +142,7 @@ impl> IntoArgsListWithAccess for I { ReflectAccessId::for_reference(arg_ref.base.base_id.clone()).ok_or_else(|| { ScriptError::new_reflection_error(format!( "Could not call function, argument: {:?}, with type: {} is not a valid reference. Have you registered the type?", - arg_info.name(), + arg_info.name().map(str::to_owned).unwrap_or_else(|| arg_info.index().to_string()), arg_ref.display_with_world(world.clone()) )) })?; @@ -130,10 +156,7 @@ impl> IntoArgsListWithAccess for I { }; if !success { - accesses.drain(..).for_each(|(id, _)| { - // Safety: we have not generated any unsafe aliases - unsafe { world.release_access(id) }; - }); + release_accesses(&mut accesses); return Err(ScriptError::new_reflection_error(format!( "Could not claim access for argument {}", arg_ref.display_with_world(world.clone()) @@ -146,22 +169,43 @@ impl> IntoArgsListWithAccess for I { let val = match val { Ok(v) => v, Err(e) => { + release_accesses(&mut accesses); + return Err(e); + } + }; + arg_list.push(val); + } + ScriptValue::World => { + arg_list.push(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard( + world.clone(), + )))); + } + value => { + let value = match ::from_script_value( + value, + world.clone(), + arg_info.type_id(), + ) { + Some(Ok(v)) => v, + Some(Err(e)) => { // Safety: Same as above - accesses.iter().for_each(|(id, _)| { unsafe { world.release_access(*id) }; }); return Err(e); } + None => { + release_accesses(&mut accesses); + return Err(ValueConversionError::TypeMismatch { + expected_type: arg_info.type_path().into(), + actual_type: None, + } + .into()); + } }; - arg_list = arg_list.push_arg(val); - } - ScriptValue::World => { - arg_list = arg_list.push_arg(ArgValue::Owned(Box::new( - WorldCallbackAccess::from_guard(world.clone()), - ))); + + arg_list.push(ArgValue::Owned(value)); } - v => todo!(), } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 663dd4ee1e..487cae75e1 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -7,14 +7,15 @@ use crate::{ use bevy::{ ecs::{component::ComponentId, entity::Entity}, prelude::{EntityRef, QueryBuilder}, - reflect::TypeRegistration, + reflect::{Reflect, TypeRegistration}, }; use std::{any::TypeId, collections::VecDeque, sync::Arc}; /// A wrapper around a `TypeRegistration` that provides additional information about the type. /// /// This is used as a hook to a rust type from a scripting language. We should be able to easily convert between a type name and a [`ScriptTypeRegistration`]. -#[derive(Clone)] +#[derive(Clone, Reflect)] +#[reflect(opaque)] pub struct ScriptTypeRegistration { pub(crate) registration: Arc, pub component_id: Option, diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index d1c748f0a1..2aee5ba7ea 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -277,13 +277,10 @@ impl ReflectReference { /// # Safety /// - The caller must ensure this reference has permission to access the underlying value pub unsafe fn into_arg_value<'w>(self, world: WorldGuard<'w>, arg_info: &ArgInfo) -> ScriptResult> { - println!("A {}", Arc::strong_count(&world)); - println!("{:?}", self); if ReflectBase::World == self.base.base_id { // Safety: we already have an Arc> so creating a new one from the existing one is safe // as the caller of this function will make sure the Arc is dropped after the lifetime 'w is done. let new_guard = WorldCallbackAccess::from_guard(world.clone()); - println!("B {}", Arc::strong_count(&world)); new_guard.read().unwrap(); return Ok(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard(world)))); } @@ -573,6 +570,23 @@ impl ReflectionPathElem { pub fn new_deferred>(defref: I) -> Self { Self::DeferredReflection(defref.into()) } + + /// Assumes the accesses are 1 indexed and converts them to 0 indexed + pub fn convert_to_0_indexed(&mut self){ + match self { + ReflectionPathElem::Reflection(path) => { + path.0.iter_mut().for_each(|a| match a.access { + bevy::reflect::Access::FieldIndex(ref mut i) => *i -= 1, + bevy::reflect::Access::TupleIndex(ref mut i) => *i -= 1, + bevy::reflect::Access::ListIndex(ref mut i) => *i -= 1, + _ => {} + }); + }, + ReflectionPathElem::DeferredReflection(_) => {}, + ReflectionPathElem::MapAccess(_) => {}, + ReflectionPathElem::Identity => {}, + }; + } } impl From<(A, B)> for DeferredReflection diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs index 616d184960..d8af43cc0b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -7,11 +7,12 @@ use std::{ use bevy::reflect::{ Access, DynamicEnum, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, PartialReflect, + Reflect, }; use crate::{ error::{ScriptError, ScriptResult, ValueConversionError}, - reflection_extensions::{PartialReflectExt, TypeInfoExtensions}, + reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, }; use super::{ @@ -21,7 +22,8 @@ use super::{ /// An abstraction of values that can be passed to and from scripts. /// This allows us to re-use logic between scripting languages. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Reflect)] +#[reflect(opaque)] pub enum ScriptValue { Unit, Bool(bool), @@ -93,134 +95,337 @@ impl TryFrom for ReflectionPathElem { /// A trait for converting a value into a [`ScriptVal`]. pub trait IntoScriptValue { - fn into_script_value(self, guard: WorldGuard) -> ScriptResult; + fn into_script_value(self, world: WorldGuard) -> ScriptResult; } /// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. pub trait FromScriptValue { + /// Returning None is saying that the conversion is not possible. + /// Returning Some means that the conversion was possible and the result is the converted value or a failure. fn from_script_value( value: ScriptValue, - guard: WorldGuard, - target_type: TypeId, - ) -> ScriptResult>; + world: WorldGuard, + target_type_id: TypeId, + ) -> Option>>; } -impl IntoScriptValue for ReflectReference { - /// For ReflectReferences we do a bit more logic here. - /// - /// We don't want to output references when they are pointing to primitives for example. - /// - /// There are a few rules: - /// - If we are pointing to a type that is better represented as another variant other than [`ScriptValue::Reference`], we will convert it to that variant. - /// - If we are pointing to a type that is better represented as a [`ScriptValue::Reference`], we will keep it as is. - fn into_script_value(self, world: WorldGuard) -> ScriptResult { - self.clone().with_reflect(world.clone(), move |r| { - // for primitives we want to convert to the primitive type - // we do not need to retain the reference - if let Some(prim) = r.as_primitive(world.clone()) { - return Ok(prim); - } +macro_rules! into_script_value_downcast { + ($self_:ident, $ty:ty, $world:ident $(, $($exp:tt)*)?) => {{ + $self_ + .try_downcast_ref::<$ty>() + .ok_or_else(|| ValueConversionError::TypeMismatch { + expected_type: Cow::Owned(stringify!($ty).into()), + actual_type: Some( + $self_ + .get_represented_type_info() + .map(|ti| ti.type_id()) + .type_id_or_fake_id() + .display_with_world($world.clone()) + .into(), + ), + })? + $($($exp)*)? + .into_script_value($world.clone()) + }}; +} - // for options we want to convert to - // - the inner type if it's some - // - nil if it's none - // to retain the reference we need to return a reference pointing into the inner type - if let Ok(inner) = r.as_option() { - if inner.is_some() { - let mut inner_ref = self; - inner_ref.index_path(ParsedPath::parse_static(".0").expect("invariant")); - // hint for the from impl that we want to trim the reference - inner_ref.index_path(ReflectionPathElem::Identity); - // cascade the conversion - return inner_ref.into_script_value(world); - } else { - return Ok(ScriptValue::Unit); +impl IntoScriptValue for &dyn PartialReflect { + fn into_script_value(self, world: WorldGuard) -> ScriptResult { + let target_type_id = self + .get_represented_type_info() + .map(|ti| ti.type_id()) + .type_id_or_fake_id(); + + match target_type_id { + // for arbitrary result types we support ScriptValue returns + _ if TypeId::of::() == target_type_id => { + match self.try_downcast_ref::() { + Some(script_val) => return Ok(script_val.clone()), + None => { + return Err(ValueConversionError::TypeMismatch { + expected_type: Cow::Owned("ScriptValue".into()), + actual_type: Some( + self.get_represented_type_info() + .map(|ti| ti.type_id()) + .type_id_or_fake_id() + .display_with_world(world.clone()) + .into(), + ), + } + .into()) + } } } + _ if TypeId::of::<()>() == target_type_id => { + return into_script_value_downcast!(self, (), world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, bool, world); + } + _ if TypeId::of::<&'static str>() == target_type_id => { + return into_script_value_downcast!(self, &'static str, world); + } + _ if TypeId::of::<&'static CStr>() == target_type_id => { + return into_script_value_downcast!(self, &'static CStr, world); + } + _ if TypeId::of::<&'static OsStr>() == target_type_id => { + return into_script_value_downcast!(self, &'static OsStr, world); + } + _ if TypeId::of::<&'static Path>() == target_type_id => { + return into_script_value_downcast!(self, &'static Path, world); + } + _ if TypeId::of::>() == target_type_id => { + return into_script_value_downcast!(self, Cow<'static, str>, world, .clone()); + } + _ if TypeId::of::>() == target_type_id => { + return into_script_value_downcast!(self, Cow<'static, CStr>, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, f32, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, f64, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i8, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i16, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i32, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i64, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i128, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, isize, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u8, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u16, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u32, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u64, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u128, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, usize, world); + } + _ if TypeId::of::>() == target_type_id => { + return into_script_value_downcast!(self, Box, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, CString, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, String, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, OsString, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, PathBuf, world, .clone()); + } + _ => {} + }; + + // for options we want to convert to + // - the inner type if it's some + // - nil if it's none + // to retain the reference we need to return a reference pointing into the inner type + if let Ok(inner) = self.as_option() { + return inner.into_script_value(world); + } - // as a last resort we just retain the original reference with no conversion - Ok(ScriptValue::Reference(self)) - })? + // as a last resort we just allocate the value and return a reference to it + let reflect_reference = self.allocate_cloned(world.clone()); + ReflectReference::into_script_value(reflect_reference, world) } } -impl FromScriptValue for ScriptValue { +impl IntoScriptValue for Option<&dyn PartialReflect> { + fn into_script_value(self, world: WorldGuard) -> ScriptResult { + match self { + Some(inner) => inner.into_script_value(world), + None => Ok(ScriptValue::Unit), + } + } +} + +impl IntoScriptValue for ReflectReference { + fn into_script_value(self, _world: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Reference(self)) + } +} + +// macro_rules + +impl FromScriptValue for dyn PartialReflect { fn from_script_value( value: ScriptValue, world: WorldGuard, - target_type: TypeId, - ) -> ScriptResult> { - // is the target type an option? + target_type_id: TypeId, + ) -> Option>> { + println!( + "type: {:?}", + target_type_id.display_with_world(world.clone()) + ); + + match target_type_id { + // TODO: if these types ever support reflect, we can uncomment these lines + // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script + // we should instead allocate and leak perhaps. then garbage collect later + t if t == TypeId::of::<()>() => { + return <()>::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return bool::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return <&str>::from_script_value(value, world, target_type_id) + } + // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => { + return <&Path>::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::>() => { + return >::from_script_value(value, world, target_type_id) + } + // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => { + return f32::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return f64::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i8::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i16::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i32::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i64::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i128::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return isize::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u8::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u16::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u32::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u64::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u128::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + println!("usize {:?}", value); + return usize::from_script_value(value, world, target_type_id); + } + // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => { + return ::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return ::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return ::from_script_value(value, world, target_type_id) + } + _ => {} + }; + + if let Some(opt) = >::from_script_value( + value.clone(), + world.clone(), + target_type_id, + ) { + Some(opt) + } else { + ReflectReference::from_script_value(value, world.clone(), target_type_id) + } + } +} + +impl FromScriptValue for Option<&dyn PartialReflect> { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type_id: TypeId, + ) -> Option>> { let type_registry = world.type_registry(); let type_registry = type_registry.read(); - let type_info = type_registry.get_type_info(target_type).ok_or({ - ValueConversionError::MissingTypeInformation { - type_id: target_type, - } - })?; + let type_info = type_registry.get_type_info(target_type_id)?; - // for primitives - if let Some(value) = - ::from_primitive(value.clone(), world.clone(), target_type) - { - return value; - } + if !type_info.is_option() { + return None; + }; - if type_info.is_option() { - // in this case we can expect a few things - // - the value we're pointing to will: - // - either point to 'inside' the option - // - or to the whole option - // - the Value might be either a Unit or a Reference - let inner_type_id = type_info.option_inner_type().expect("invariant"); - - match value { - ScriptValue::Unit => { - // if the value is a unit it's easy, we just construct a dynamic none variant - let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); - dynamic_none.set_represented_type(Some(type_info)); - return Ok(Box::new(dynamic_none)); - } - ScriptValue::Reference(mut reference) => { - // if the value is a reference we need to check if it's pointing to the inner value - // that will only be the case if the reference was created using into_script_value - // meaning it will end with a ".0" followed by Identity index. - - if reference.reflect_path.last() == Some(&ReflectionPathElem::Identity) - && reference.reflect_path.len() > 2 - { - let _ = reference - .reflect_path - .drain(reference.reflect_path.len() - 2..); - } + let inner_type_id = type_info.option_inner_type().expect("invariant"); - // construct dynamic variant - let out = reference.clone_value(world)?; - // out.set_represented_type(Some(type_info)); - return Ok(out); - } - value => { - let inner = - ScriptValue::from_script_value(value, world.clone(), inner_type_id)?; - - let mut dynamic_some = DynamicEnum::new( - "Some", - DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), - ); - dynamic_some.set_represented_type(Some(type_info)); - return Ok(Box::new(dynamic_some)); - } - }; + match value { + ScriptValue::Unit => { + let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); + dynamic_none.set_represented_type(Some(type_info)); + Some(Ok(Box::new(dynamic_none))) + } + v => { + let inner = match ::from_script_value( + v, + world.clone(), + inner_type_id, + ) { + Some(Ok(inner)) => inner, + Some(Err(e)) => return Some(Err(e)), + None => return None, + }; + + let mut dynamic_some = DynamicEnum::new( + "Some", + DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), + ); + dynamic_some.set_represented_type(Some(type_info)); + Some(Ok(Box::new(dynamic_some))) + } } + } +} - // if not primitive or option, we expect a reference - if let ScriptValue::Reference(reflect_reference) = value { - reflect_reference.clone_value(world) - } else { - return Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - })?; +impl FromScriptValue for ReflectReference { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option>> { + match value { + ScriptValue::Reference(ref_) => Some(ref_.clone_value(world)), + _ => None, } } } @@ -400,23 +605,22 @@ impl FromScriptValue for () { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::<()>() { - match value { + Some(match value { ScriptValue::Unit => Ok(Box::new(())), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::<()>(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::<()>(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::<()>())), - } - .into()) + None } } } @@ -426,23 +630,22 @@ impl FromScriptValue for bool { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::() { - match value { + Some(match value { ScriptValue::Bool(v) => Ok(Box::new(v)), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::())), - } - .into()) + None } } } @@ -452,23 +655,22 @@ impl FromScriptValue for &'static str { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::<&'static str>() { - match value { + Some(match value { ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(s)), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::<&'static str>(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::<&'static str>(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::<&'static str>())), - } - .into()) + None } } } @@ -478,25 +680,22 @@ impl FromScriptValue for Cow<'static, str> { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::>() { - match value { + Some(match value { ScriptValue::String(s) => Ok(Box::new(s)), - ScriptValue::Reference(ref_) => { - Ok(Box::new(ref_.downcast::>(world)?)) - } + ScriptValue::Reference(ref_) => ref_ + .downcast::>(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::>())), - } - .into()) + None } } } @@ -506,23 +705,22 @@ impl FromScriptValue for String { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::() { - match value { + Some(match value { ScriptValue::String(s) => Ok(Box::new(s.into_owned())), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::())), - } - .into()) + None } } } @@ -532,24 +730,23 @@ impl FromScriptValue for f32 { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::() { - match value { + Some(match value { ScriptValue::Float(v) => Ok(Box::new(v as f32)), ScriptValue::Integer(v) => Ok(Box::new(v as f32)), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::())), - } - .into()) + None } } } @@ -559,24 +756,23 @@ impl FromScriptValue for f64 { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::() { - match value { + Some(match value { ScriptValue::Float(v) => Ok(Box::new(v)), ScriptValue::Integer(v) => Ok(Box::new(v as f64)), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::())), - } - .into()) + None } } } @@ -590,24 +786,23 @@ macro_rules! impl_from_script_value_integer { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::<$t>() { - match value { + Some(match value { ScriptValue::Integer(v) => Ok(Box::new(v as $t)), ScriptValue::Float(v) => Ok(Box::new(v as $t)), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::<$t>(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::<$t>(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::<$t>())), - } - .into()) + None } } } @@ -623,22 +818,18 @@ impl FromScriptValue for &'static Path { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::<&'static Path>() { - match value { + Some(match value { ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(Path::new(s))), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::<&'static Path>())), - } - .into()) + None } } } @@ -648,25 +839,22 @@ impl FromScriptValue for PathBuf { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::() { - match value { + Some(match value { ScriptValue::String(s) => Ok(Box::new(PathBuf::from(s.into_owned()))), - ScriptValue::Reference(ref_) => { - Ok(Box::new(ref_.downcast::<&'static Path>(world)?)) - } + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::())), - } - .into()) + None } } } @@ -736,23 +924,22 @@ impl FromScriptValue for OsString { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> ScriptResult> { + ) -> Option>> { if target_type == TypeId::of::() { - match value { + Some(match value { ScriptValue::String(s) => Ok(Box::new(OsString::from(s.into_owned()))), - ScriptValue::Reference(ref_) => Ok(Box::new(ref_.downcast::(world)?)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box) + .map_err(Into::into), _ => Err(ValueConversionError::TypeMismatch { expected_type: Cow::Owned(target_type.display_with_world(world.clone())), actual_type: Some(Cow::Owned(value.display_with_world(world))), } .into()), - } + }) } else { - Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world)), - actual_type: Some(Cow::Borrowed(type_name::())), - } - .into()) + None } } } @@ -985,6 +1172,7 @@ mod test { assert!( <()>::from_script_value(ScriptValue::Unit, guard.clone(), TypeId::of::<()>()) + .unwrap() .unwrap() .reflect_partial_eq(&()) .unwrap() @@ -996,6 +1184,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&true) .unwrap()); @@ -1005,6 +1194,7 @@ mod test { TypeId::of::<&'static str>() ) .unwrap() + .unwrap() .reflect_partial_eq(&"hello") .unwrap()); @@ -1014,6 +1204,7 @@ mod test { TypeId::of::>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Cow::Borrowed("hello")) .unwrap()); @@ -1023,6 +1214,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&"hello".to_string()) .unwrap()); @@ -1032,6 +1224,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0.0f32) .unwrap()); @@ -1041,6 +1234,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0.0f64) .unwrap()); @@ -1050,6 +1244,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0i64) .unwrap()); @@ -1059,6 +1254,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0i8) .unwrap()); @@ -1068,6 +1264,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0i16) .unwrap()); @@ -1077,6 +1274,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0i32) .unwrap()); @@ -1086,6 +1284,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0i128) .unwrap()); @@ -1095,6 +1294,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0isize) .unwrap()); @@ -1104,6 +1304,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0u8) .unwrap()); @@ -1113,6 +1314,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0u16) .unwrap()); @@ -1122,6 +1324,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0u32) .unwrap()); @@ -1131,6 +1334,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0u64) .unwrap()); @@ -1140,6 +1344,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0u128) .unwrap()); @@ -1149,6 +1354,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&0usize) .unwrap()); @@ -1158,6 +1364,7 @@ mod test { TypeId::of::<&'static Path>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Path::new("hello")) .unwrap()); @@ -1167,6 +1374,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&PathBuf::from("hello")) .unwrap()); @@ -1176,6 +1384,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&OsString::from("hello")) .unwrap()); @@ -1185,6 +1394,7 @@ mod test { TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&OsString::from("hello")) .unwrap()); } @@ -1222,74 +1432,98 @@ mod test { drop(allocator); let guard = WorldGuard::new(guard); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::Reference(usize_reference.clone()), guard.clone(), TypeId::of::() ) .unwrap() + .unwrap() .reflect_partial_eq(&2usize) .unwrap()); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::Reference(string_reference.clone()), guard.clone(), TypeId::of::<&'static str>() ) .unwrap() + .unwrap() .reflect_partial_eq(&"hello") .unwrap()); println!( "{:?}", - ::from_script_value( + ::from_script_value( ScriptValue::Reference(option_reference.clone()), guard.clone(), TypeId::of::>() ) ); - assert!(::from_script_value( - ScriptValue::Reference(option_reference.clone()), + + println!( + "heL: {:?}", + ::from_script_value( + ScriptValue::Reference(usize_reference.clone()), + guard.clone(), + TypeId::of::>() + ) + ); + assert!(::from_script_value( + ScriptValue::Reference(usize_reference.clone()), guard.clone(), TypeId::of::>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Some(2usize)) .unwrap()); - assert!(::from_script_value( - ScriptValue::Reference(none_reference.clone()), + assert!(::from_script_value( + ScriptValue::Unit, guard.clone(), TypeId::of::>() ) .unwrap() + .unwrap() .reflect_partial_eq(&None::) .unwrap()); - assert!(::from_script_value( - ScriptValue::Reference(nested_option_reference.clone()), + assert!(::from_script_value( + ScriptValue::Reference(usize_reference.clone()), guard.clone(), TypeId::of::>>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Some(Some(2usize))) .unwrap()); - assert!(::from_script_value( - ScriptValue::Reference(nested_none_reference.clone()), + println!( + "heL: {:?}", + ::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>>() + ) + ); + assert!(::from_script_value( + ScriptValue::Unit, guard.clone(), TypeId::of::>>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Some(None::)) .unwrap()); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::Reference(vec_option_reference.clone()), guard.clone(), TypeId::of::>>() ) .unwrap() + .unwrap() .reflect_partial_eq(&vec![Some(1usize), None, Some(3usize)]) .unwrap()); } @@ -1309,47 +1543,51 @@ mod test { drop(type_registry); let guard = WorldGuard::new(guard); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::String("hello".into()), guard.clone(), TypeId::of::>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Some("hello".to_string())) .unwrap()); println!( "{:?}", - ::from_script_value( + ::from_script_value( ScriptValue::Unit, guard.clone(), TypeId::of::>() ) ); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::Unit, guard.clone(), TypeId::of::>() ) .unwrap() + .unwrap() .reflect_partial_eq(&None::) .unwrap()); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::Unit, guard.clone(), TypeId::of::>>() ) .unwrap() + .unwrap() .reflect_partial_eq(&None::) .unwrap()); - assert!(::from_script_value( + assert!(::from_script_value( ScriptValue::String("hello".into()), guard.clone(), TypeId::of::>>() ) .unwrap() + .unwrap() .reflect_partial_eq(&Some(Some("hello".to_string()))) .unwrap()); } diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index a237f28e6e..9353c8836e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -63,7 +63,8 @@ pub type WorldGuardRef<'w> = &'w WorldAccessGuard<'w>; /// borrows sadly do not persist the script-host boundary :(. That is to be expected, but instead we can make an abstraction which removes the lifetime parameter, making the outer type 'static, /// while making sure the lifetime is still satisfied! #[derive(Clone, Debug, Reflect)] -pub struct WorldCallbackAccess(#[reflect(ignore)] pub(crate) Weak>); +#[reflect(opaque)] +pub struct WorldCallbackAccess(pub(crate) Weak>); impl WorldCallbackAccess { /// Wraps a callback which requires access to the world in a 'static way via [`WorldCallbackAccess`]. diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 3263a41009..b9f7b6d218 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -51,7 +51,8 @@ impl From for Box { } } /// An error with an optional script Context -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Reflect)] +#[reflect(opaque)] pub struct ScriptError(pub Arc); impl Deref for ScriptError { diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 0461455f75..c1c69c21a7 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -3,7 +3,10 @@ use crate::event::ScriptErrorEvent; use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; -use bindings::{AppReflectAllocator, ReflectAllocator, WorldCallbackAccess}; +use bindings::{ + script_val::ScriptValue, AppReflectAllocator, ReflectAllocator, ScriptTypeRegistration, + WorldCallbackAccess, +}; use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, ContextPreHandlingInitializer, ScriptContexts, @@ -99,6 +102,8 @@ impl Plugin for ScriptingPlugin { /// Register all types that need to be accessed via reflection fn register_types(app: &mut App) { app.register_type::(); + app.register_type::(); + app.register_type::(); } pub trait AddRuntimeInitializer { diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 130ebe06ad..2429418518 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -7,14 +7,9 @@ use crate::{bindings::{pretty_print::DisplayWithWorld, script_val::{IntoScriptVa use crate::bindings::script_val::FromScriptValue; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { + fn allocate_cloned(&self, world: WorldGuard) -> ReflectReference; fn allocate(boxed: Box, world: WorldGuard) -> ReflectReference; - fn from_primitive(value: ScriptValue, _: WorldGuard, target_type_id: TypeId) -> Option>>; - - /// If the type is a primitive type, returns the value as a [`ScriptValue`]. - /// Primitive types are all simple types that are not the [`ScriptValue::Reference`] variant. - fn as_primitive(&self, guard: WorldGuard) -> Option; - /// Check if the represented type is from the given crate and has the given type identifier, /// returns false if not representing any type or if the type is not from the given crate or does not have the given type identifier. fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool; @@ -112,76 +107,6 @@ impl PartialReflectExt for T { Ok(()) } - fn from_primitive(value: ScriptValue, world: WorldGuard, target_type_id: TypeId) -> Option>> { - Some(match target_type_id{ - // TODO: if these types ever support reflect, we can uncomment these lines - // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script - // we should instead allocate and leak perhaps. then garbage collect later - t if t == TypeId::of::<()>() => <()>::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => bool::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => <&str>::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => <&Path>::from_script_value(value, world, target_type_id), - t if t == TypeId::of::>() => >::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::>() => >::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => f32::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => f64::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => i8::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => i16::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => i32::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => i64::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => i128::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => isize::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => u8::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => u16::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => u32::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => u64::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => u128::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => usize::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::>() => >::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => ::from_script_value(value, world, target_type_id), - _ => return None, - }) - } - - fn as_primitive(&self, guard: WorldGuard) -> Option { - let type_id = self.get_represented_type_info().map(|ti| ti.type_id()).type_id_or_fake_id(); - - match type_id { - _ if TypeId::of::<()>() == type_id => self.as_partial_reflect().try_downcast_ref::<()>().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::<&'static str>() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static str>().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::<&'static CStr>() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static CStr>().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::<&'static OsStr>() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static OsStr>().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::<&'static Path>().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::>() == type_id => self.as_partial_reflect().try_downcast_ref::>().and_then(|v| v.clone().into_script_value(guard).ok()), - _ if TypeId::of::>() == type_id => self.as_partial_reflect().try_downcast_ref::>().and_then(|v| v.clone().into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.into_script_value(guard).ok()), - _ if TypeId::of::>() == type_id => self.as_partial_reflect().try_downcast_ref::>().and_then(|v| v.to_owned().into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), - _ if TypeId::of::() == type_id => self.as_partial_reflect().try_downcast_ref::().and_then(|v| v.to_owned().into_script_value(guard).ok()), - _ => None, - } - } fn as_option(&self) -> Result, ScriptError> { if let bevy::reflect::ReflectRef::Enum(e) = self.reflect_ref() { @@ -394,6 +319,11 @@ impl PartialReflectExt for T { let mut allocator = allocator.write(); ReflectReference::new_allocated_boxed(boxed, &mut allocator) } + + fn allocate_cloned(&self, world: WorldGuard) -> ReflectReference { + let boxed = self.clone_value(); + Self::allocate(boxed, world) + } } @@ -626,46 +556,4 @@ mod test { } - #[test] - fn test_as_primitive() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - - assert_eq!(true.as_primitive(world.clone()), Some(ScriptValue::Bool(true))); - assert_eq!(false.as_primitive(world.clone()), Some(ScriptValue::Bool(false))); - assert_eq!(0i64.as_primitive(world.clone()), Some(ScriptValue::Integer(0))); - assert_eq!(0.0f64.as_primitive(world.clone()), Some(ScriptValue::Float(0.0))); - assert_eq!("".as_primitive(world.clone()), Some(ScriptValue::String("".into()))); - assert_eq!("hello".as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); - // assert_eq!(CString::new("hello").unwrap().as_primtive(world.clone()), Some(ScriptValue::String("hello".into()))); - // assert_eq!(OsStr::new("hello").as_primtive(world.clone()), Some(ScriptValue::String("hello".into()))); - assert_eq!(Path::new("hello").as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); - assert_eq!(Cow::Borrowed("hello").as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); - assert_eq!(Cow::Owned::("hello".to_string()).as_primitive(world.clone()), Some(ScriptValue::String("hello".into()))); - // assert_eq!(Box::::from("hello").as_primtive(world.clone()), Some(ScriptValue::String("hello".into()))); - assert_eq!(().as_primitive(world.clone()), Some(ScriptValue::Unit)); - } - - #[test] - fn test_from_primitive() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - - assert!(<()>::from_primitive(ScriptValue::Unit, world.clone(), TypeId::of::<()>()).unwrap().unwrap().reflect_partial_eq(&()).unwrap()); - assert!(bool::from_primitive(ScriptValue::Bool(true), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&true).unwrap()); - assert!(i32::from_primitive(ScriptValue::Integer(42), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42).unwrap()); - assert!(f64::from_primitive(ScriptValue::Float(42.0), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42.0).unwrap()); - assert!(String::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&"hello".to_string()).unwrap()); - assert!(OsString::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&OsString::from("hello")).unwrap()); - assert!(PathBuf::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&PathBuf::from("hello")).unwrap()); - assert!(Cow::::from_primitive(ScriptValue::String("hello".into()), world.clone(), TypeId::of::>()).unwrap().unwrap().reflect_partial_eq(&Cow::Borrowed("hello")).unwrap()); - assert!(i32::from_primitive(ScriptValue::Float(42.0), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42).unwrap()); - assert!(f32::from_primitive(ScriptValue::Float(42.0), world.clone(), TypeId::of::()).unwrap().unwrap().reflect_partial_eq(&42).unwrap()); - } } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 4237a8af96..fff65b3e5d 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -4,7 +4,9 @@ use bevy::{ reflect::func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, }; use bevy_mod_scripting_core::*; -use bindings::{WorldAccessGuard, WorldCallbackAccess}; +use bindings::{ + script_val::ScriptValue, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, +}; use crate::namespaced_register::NamespaceBuilder; @@ -27,6 +29,19 @@ impl Plugin for CoreFunctionsPlugin { fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) .register_function("spawn", |s: WorldCallbackAccess| s.spawn())? + .register_function( + "get_type_by_name", + |world: WorldCallbackAccess, type_name: String| world.get_type_by_name(type_name), + )? + .register_function( + "get_component", + |s: WorldCallbackAccess, entity: Entity, registration: ScriptTypeRegistration| { + let c = s + .get_component(entity, registration.component_id().unwrap()) + .unwrap(); + c.map(ScriptValue::Reference).unwrap_or(ScriptValue::Unit) + }, + )? .register_function("exit", |s: WorldCallbackAccess| s.exit())?; Ok(()) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 5ce2d377bd..f41cf18567 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -16,7 +16,7 @@ use bevy_mod_scripting_core::{ bindings::{ function::CallableWithAccess, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, - script_val::{FromScriptValue, ScriptValue}, + script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, DeferredReflection, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, TypeIdSource, WorldCallbackAccess, }, @@ -28,13 +28,12 @@ use bevy_mod_scripting_core::{ use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; use mlua::{IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value, Variadic}; -use crate::bindings::world::LuaWorld; - use super::{ // proxy::{LuaProxied, LuaValProxy}, script_value::LuaScriptValue, world::GetWorld, }; +use crate::bindings::world::LuaWorld; /// Lua UserData wrapper for [`bevy_mod_scripting_core::bindings::ReflectReference`]. /// Acts as a lua reflection interface. Any value which is registered in the type registry can be interacted with using this type. @@ -286,58 +285,43 @@ impl UserData for LuaReflectReference { fn add_methods<'lua, T: UserDataMethods<'lua, Self>>(m: &mut T) { m.add_meta_function( MetaMethod::Index, - |lua, (self_, key): (LuaReflectReference, String)| { + |lua, (self_, key): (LuaReflectReference, LuaScriptValue)| { let world = lua.get_world(); - let type_id = self_.0.tail_type_id(world.clone())?.type_id_or_fake_id(); + let mut self_: ReflectReference = self_.into(); + let type_id = self_.tail_type_id(world.clone())?.type_id_or_fake_id(); - let func = lua.create_function(move |_, args: Variadic| { - let registry = + let key: ScriptValue = key.into(); + + if let ScriptValue::String(ref key) = key { + let function_registry = world.with_resource(|registry: &AppFunctionRegistry| registry.clone()); - let registry = registry.read(); - - let func = registry - .get_namespaced_function(key.clone(), Namespace::OnType(type_id)) - .ok_or_else(|| { - mlua::Error::external(FunctionError::FunctionNotFound { - function_name: key.clone().into(), - type_: Some(type_id.display_with_world(world.clone()).into()), - }) - })?; - let info = func.info(); - - // convert args according to type info - println!( - "Calling function {:?} with args (before converting): {:?}", - info.name(), - args - ); - - // let args = info - // .args() - // .iter() - // .map(|i| i.type_id()) - // .zip(args.into_iter()) - // .map(|(target_type_id, arg)| { - // let boxed = ::from_script_value( - // arg.into(), - // world.clone(), - // target_type_id, - // )?; - // Ok(::allocate(boxed, world.clone())) - // }) - // .collect::>>()?; - println!("Calling function {:?} with args: {:?}", info.name(), args); - func.with_call(args.into_iter().map(Into::into), world.clone(), |r| { - // let result = r.call()?; - println!("Result: {:?}", r); - 0 - })?; - Ok(()) - })?; - - Ok(func) + let registry = function_registry.read(); + + if let Some(func) = + registry.get_namespaced_function(key.clone(), Namespace::OnType(type_id)) + { + let func = func.clone(); + let func = + lua.create_function(move |_, args: Variadic| { + let out = func.dynamic_call( + args.into_iter().map(Into::into), + world.clone(), + )?; + + Ok(LuaScriptValue::from(out)) + })?; + + return func.into_lua(lua); + } + }; + + let mut reflect_path: ReflectionPathElem = key.try_into()?; + reflect_path.convert_to_0_indexed(); + self_.index_path(reflect_path); + let script_value = self_.into_script_value(world)?; + LuaScriptValue::from(script_value).into_lua(lua) }, - ) + ); // m.add_meta_function( // MetaMethod::Index, @@ -474,16 +458,15 @@ impl UserData for LuaReflectReference { // Ok((iterator, Value::Nil, Value::Nil)) // }); - // m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { - // let world = lua.get_world(); - // Ok(ReflectReferencePrinter::new(self_.0).pretty_print(&world)) - // }); - - // m.add_function("print_value", |lua, self_: LuaReflectReference| { - // let world = lua.get_world(); + m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { + let world = lua.get_world(); + Ok(self_.0.display_with_world(world)) + }); - // Ok(ReflectReferencePrinter::new(self_.0).pretty_print_value(&world)) - // }); + m.add_function("print_value", |lua, self_: LuaReflectReference| { + let world = lua.get_world(); + Ok(self_.0.display_value_with_world(world)) + }); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 2859dac47e..83d12766df 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -1,7 +1,7 @@ use std::ops::{Deref, DerefMut}; -use bevy_mod_scripting_core::bindings::{script_val::ScriptValue, ReflectBase}; -use mlua::{FromLua, Value}; +use bevy_mod_scripting_core::bindings::{script_val::ScriptValue, ReflectBase, ReflectReference}; +use mlua::{FromLua, IntoLua, IntoLuaMulti, MultiValue, Value}; use super::reference::LuaReflectReference; @@ -41,11 +41,11 @@ impl<'lua> FromLua<'lua> for LuaScriptValue { // Value::Function(function) => todo!(), // Value::Thread(thread) => todo!(), Value::UserData(ud) => { - let ud = ud.take::()?; + let ud = ud.borrow::()?; if ud.0.base.base_id == ReflectBase::World { ScriptValue::World } else { - ScriptValue::Reference(ud.into()) + ScriptValue::Reference(ud.clone().into()) } } // Value::Error(error) => todo!(), @@ -61,6 +61,22 @@ impl<'lua> FromLua<'lua> for LuaScriptValue { } } +impl<'lua> IntoLua<'lua> for LuaScriptValue { + fn into_lua(self, lua: &'lua mlua::Lua) -> mlua::Result> { + Ok(match self.0 { + ScriptValue::Unit => Value::Nil, + ScriptValue::Bool(b) => Value::Boolean(b), + ScriptValue::Integer(i) => Value::Integer(i), + ScriptValue::Float(f) => Value::Number(f), + ScriptValue::String(s) => Value::String(lua.create_string(s.as_ref())?), + ScriptValue::World => { + LuaReflectReference::from(ReflectReference::new_world()).into_lua(lua)? + } + ScriptValue::Reference(r) => LuaReflectReference::from(r).into_lua(lua)?, + }) + } +} + impl From for ScriptValue { fn from(value: LuaScriptValue) -> Self { value.0 diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 34b9b5b8dd..c9f39eaae8 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -14,6 +14,7 @@ use bevy_mod_scripting_core::{ error::ScriptError, event::CallbackLabel, handler::Args, + reflection_extensions::PartialReflectExt, script::ScriptId, AddContextPreHandlingInitializer, ScriptingPlugin, }; @@ -68,8 +69,11 @@ impl Plugin for LuaScriptingPlugin { // let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); // ::Proxy::from(reflect_reference) // }); - - context.globals().set("script_id", script_id.to_owned())?; + context.globals().set( + "entity", + LuaReflectReference(::allocate(Box::new(entity), world)), + )?; + context.globals().set("script_id", script_id.clone())?; // context.globals().set("entity", lua_entity)?; Ok(()) }); From f2905c72a2326b461a0cb8de266627be2ffea304 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 00:02:11 +0000 Subject: [PATCH 042/217] re-do newindex --- assets/scripts/bevy_api.lua | 6 +-- .../src/bindings/script_val.rs | 40 ---------------- .../src/bindings/reference.rs | 48 ++++++++++++++++++- 3 files changed, 49 insertions(+), 45 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index df38c45f7b..ddea9e8ceb 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -25,10 +25,10 @@ function on_event() print(comp.option_usize) comp.option_usize = nil print(comp.option_usize) - - -- print("\nvec") + world:exit() + print("\nvec") -- print(table_to_string(comp.vec_of_usize)) - -- comp.vec_of_usize = {42,69,72} + comp.vec_of_usize = {42,69,72} -- comp.vec_of_usize[1] = 0 -- print(comp.vec_of_usize[2]) -- print(table_to_string(comp.vec_of_usize)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs index d8af43cc0b..6ea967d134 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -277,11 +277,6 @@ impl FromScriptValue for dyn PartialReflect { world: WorldGuard, target_type_id: TypeId, ) -> Option>> { - println!( - "type: {:?}", - target_type_id.display_with_world(world.clone()) - ); - match target_type_id { // TODO: if these types ever support reflect, we can uncomment these lines // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script @@ -344,7 +339,6 @@ impl FromScriptValue for dyn PartialReflect { return u128::from_script_value(value, world, target_type_id) } t if t == TypeId::of::() => { - println!("usize {:?}", value); return usize::from_script_value(value, world, target_type_id); } // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), @@ -1451,24 +1445,6 @@ mod test { .unwrap() .reflect_partial_eq(&"hello") .unwrap()); - - println!( - "{:?}", - ::from_script_value( - ScriptValue::Reference(option_reference.clone()), - guard.clone(), - TypeId::of::>() - ) - ); - - println!( - "heL: {:?}", - ::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::>() - ) - ); assert!(::from_script_value( ScriptValue::Reference(usize_reference.clone()), guard.clone(), @@ -1499,14 +1475,6 @@ mod test { .reflect_partial_eq(&Some(Some(2usize))) .unwrap()); - println!( - "heL: {:?}", - ::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>>() - ) - ); assert!(::from_script_value( ScriptValue::Unit, guard.clone(), @@ -1553,14 +1521,6 @@ mod test { .reflect_partial_eq(&Some("hello".to_string())) .unwrap()); - println!( - "{:?}", - ::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>() - ) - ); assert!(::from_script_value( ScriptValue::Unit, guard.clone(), diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index f41cf18567..3377235517 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -20,7 +20,7 @@ use bevy_mod_scripting_core::{ DeferredReflection, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, TypeIdSource, WorldCallbackAccess, }, - error::{FunctionError, ScriptError, ScriptResult}, + error::{FunctionError, ScriptError, ScriptResult, ValueConversionError}, new_deferred_reflection, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, Either, @@ -318,11 +318,55 @@ impl UserData for LuaReflectReference { let mut reflect_path: ReflectionPathElem = key.try_into()?; reflect_path.convert_to_0_indexed(); self_.index_path(reflect_path); - let script_value = self_.into_script_value(world)?; + let script_value = self_.with_reflect(world.clone(), |r| { + <&dyn PartialReflect>::into_script_value(r, world.clone()) + })??; LuaScriptValue::from(script_value).into_lua(lua) }, ); + m.add_meta_function( + MetaMethod::NewIndex, + |lua, (self_, key, value): (LuaReflectReference, LuaScriptValue, LuaScriptValue)| { + let mut self_: ReflectReference = self_.into(); + let key: ScriptValue = key.into(); + let value: ScriptValue = value.into(); + let mut reflect_path: ReflectionPathElem = key.try_into()?; + reflect_path.convert_to_0_indexed(); + + let world = lua.get_world(); + + self_.index_path(reflect_path); + self_.with_reflect_mut(world.clone(), |r| { + let target_type_id = r + .get_represented_type_info() + .map(|i| i.type_id()) + .type_id_or_fake_id(); + let other = ::from_script_value( + value, + world.clone(), + target_type_id, + ) + .transpose()? + .ok_or_else(|| ValueConversionError::TypeMismatch { + expected_type: target_type_id.display_with_world(world.clone()).into(), + actual_type: Some( + r.get_represented_type_info() + .map(|i| i.type_id()) + .type_id_or_fake_id() + .display_with_world(world.clone()) + .into(), + ), + })?; + + r.try_apply(other.as_partial_reflect())?; + Ok::<_, ScriptError>(()) + })??; + + Ok(()) + }, + ); + // m.add_meta_function( // MetaMethod::Index, // |l, (mut self_, key): (LuaReflectReference, Value)| { From 85f2e9e993eb9e7260326d6e8a256da20afb2603 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 12:16:35 +0000 Subject: [PATCH 043/217] dynamic get and set calls --- assets/scripts/bevy_api.lua | 3 +- .../src/bindings/function.rs | 60 ++- .../src/bindings/pretty_print.rs | 21 +- .../src/bindings/query.rs | 4 +- .../src/bindings/reference.rs | 205 ++-------- .../src/bindings/script_val.rs | 113 ++---- .../src/bindings/world.rs | 8 +- .../bevy_mod_scripting_functions/src/core.rs | 126 ++++++- .../src/namespaced_register.rs | 37 +- .../src/bindings/reference.rs | 354 ++++-------------- 10 files changed, 343 insertions(+), 588 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index ddea9e8ceb..4a623a36a5 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -8,6 +8,7 @@ end function on_event() + world:exit() print(entity) print(script) @@ -20,12 +21,12 @@ function on_event() print("Before script: ", comp:print_value()) print("\noption") + -- print(comp:get("option_usize")) print(comp.option_usize) comp.option_usize = 69 print(comp.option_usize) comp.option_usize = nil print(comp.option_usize) - world:exit() print("\nvec") -- print(table_to_string(comp.vec_of_usize)) comp.vec_of_usize = {42,69,72} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index 5a504329c6..cb718f46e1 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, ops::Deref, sync::Arc}; +use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; use bevy::reflect::{ func::{ @@ -57,12 +57,24 @@ impl CallableWithAccess for DynamicFunction<'_> { // 4. Relinquish access to the caller for the return value // 5. Release the access for each argument // 6. Return the result - let arg_iter = args.into_iter(); - - let (mut args_list, mut accesses) = - arg_iter.into_args_list_with_access(info, world.clone())?; + let mut arg_iter = args.into_iter().peekable(); + + // we also want to add the world arg if it's required as the first arg but not present + let (mut args_list, mut accesses) = if self.first_arg_is_world() + && !arg_iter + .peek() + .map(|a| a == &ScriptValue::World) + .unwrap_or(false) + { + std::iter::once(ScriptValue::World) + .chain(arg_iter) + .into_args_list_with_access(info, world.clone())? + } else { + arg_iter.into_args_list_with_access(info, world.clone())? + }; let mut final_args_list = ArgList::default(); + // we sometimes want to use the boxed value in the arg instead of allocating and refing to it. // for this reason let's be lenient in calling functions. Allow passing owned values as refs for (arg, info) in args_list.iter_mut().zip(info.iter()) { @@ -137,7 +149,11 @@ impl> IntoArgsListWithAccess for I { for (value, arg_info) in self.zip(arg_info.iter()) { match value { - ScriptValue::Reference(arg_ref) => { + // TODO: I'd see the logic be a bit cleaner, this if is needed to support 'Raw' ScriptValue arguments + // as we do not want to claim any access since we're not using the value yet + ScriptValue::Reference(arg_ref) + if arg_info.type_id() != TypeId::of::() => + { let access_id = ReflectAccessId::for_reference(arg_ref.base.base_id.clone()).ok_or_else(|| { ScriptError::new_reflection_error(format!( @@ -213,6 +229,38 @@ impl> IntoArgsListWithAccess for I { } } +pub trait DynamicFunctionExt { + fn first_arg_is_world(&self) -> bool; +} + +impl DynamicFunctionExt for DynamicFunction<'_> { + fn first_arg_is_world(&self) -> bool { + self.info().args().first().map_or(false, |arg| { + arg.type_id() == std::any::TypeId::of::() + }) + } +} + +pub trait ArgValueExt { + fn is_type_id(&self, type_id: std::any::TypeId) -> bool; +} + +impl ArgValueExt for ArgValue<'_> { + fn is_type_id(&self, type_id: std::any::TypeId) -> bool { + match self { + ArgValue::Owned(r) => r + .get_represented_type_info() + .map_or(false, |t| t.type_id() == type_id), + ArgValue::Ref(r) => r + .get_represented_type_info() + .map_or(false, |t| t.type_id() == type_id), + ArgValue::Mut(r) => r + .get_represented_type_info() + .map_or(false, |t| t.type_id() == type_id), + } + } +} + #[cfg(test)] mod test { use bevy::{ diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index f96557c431..3ed977dae0 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -1,8 +1,8 @@ use crate::reflection_extensions::TypeIdExtensions; use super::{ - script_val::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, ReflectionPathElem, - WorldAccessGuard, WorldGuard, + script_val::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldAccessGuard, + WorldGuard, }; use bevy::reflect::{PartialReflect, ReflectRef}; use itertools::Itertools; @@ -96,22 +96,7 @@ impl ReflectReferencePrinter { Self::pretty_print_base(&self.reference.base, world.clone(), &mut pretty_path); - for elem in self.reference.reflect_path.iter() { - match elem { - ReflectionPathElem::Reflection(path) => { - pretty_path.push_str(&path.to_string()); - } - ReflectionPathElem::DeferredReflection(_) => { - pretty_path.push_str("."); - } - ReflectionPathElem::Identity => { - pretty_path.push_str(""); - } - ReflectionPathElem::MapAccess(key) => { - pretty_path.push_str(&format!("[{}]", key)); - } - } - } + pretty_path.push_str(&self.reference.reflect_path.to_string()); if let Some(tail_type_id) = tail_type_id { let type_path = { diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 487cae75e1..76461e355b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -7,7 +7,7 @@ use crate::{ use bevy::{ ecs::{component::ComponentId, entity::Entity}, prelude::{EntityRef, QueryBuilder}, - reflect::{Reflect, TypeRegistration}, + reflect::{ParsedPath, Reflect, TypeRegistration}, }; use std::{any::TypeId, collections::VecDeque, sync::Arc}; @@ -144,7 +144,7 @@ impl<'w> WorldAccessGuard<'w> { c.component_id.unwrap(), ), }, - reflect_path: vec![], + reflect_path: ParsedPath(vec![]), }) .collect(); ScriptQueryResult(r.id(), references) diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 2aee5ba7ea..674547b506 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -44,7 +44,7 @@ pub struct ReflectReference { // TODO: experiment with Fixed capacity vec, boxed array etc, compromise between heap allocation and runtime cost // needs benchmarks first though /// The path from the top level type to the actual value we want to access - pub reflect_path: Vec, + pub reflect_path: ParsedPath, } /// Specifies where we should source the type id from when reflecting a ReflectReference @@ -90,7 +90,7 @@ impl ReflectReference { type_id: TypeId::of::(), base_id: ReflectBase::World, }, - reflect_path: Vec::default(), + reflect_path: ParsedPath(Vec::default()), } } @@ -105,7 +105,7 @@ impl ReflectReference { type_id, base_id: ReflectBase::Owned(id), }, - reflect_path: Vec::default(), + reflect_path: ParsedPath(Vec::default()), } } @@ -120,7 +120,7 @@ impl ReflectReference { type_id, base_id: ReflectBase::Owned(id), }, - reflect_path: Vec::default(), + reflect_path: ParsedPath(Vec::default()), } } @@ -131,7 +131,7 @@ impl ReflectReference { type_id: TypeId::of::(), base_id: ReflectBase::Resource(reflect_id.into()), }, - reflect_path: Vec::default(), + reflect_path: ParsedPath(Vec::default()), }) } @@ -145,15 +145,15 @@ impl ReflectReference { type_id: TypeId::of::(), base_id: ReflectBase::Component(entity, reflect_id.into()), }, - reflect_path: Vec::default(), + reflect_path: ParsedPath(Vec::default()), }) } /// Indexes into the reflect path inside this reference. /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. - pub fn index_path>(&mut self, index: T) { + pub fn index_path>(&mut self, index: T) { debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to index into a world reference. This will always fail"); - self.reflect_path.push(index.into()); + self.reflect_path.0.extend(index.into().0); } @@ -457,26 +457,14 @@ impl ReflectReference { } fn walk_path<'a>(&self, root: &'a dyn PartialReflect) -> ScriptResult<&'a dyn PartialReflect> { - let mut current = root; - for elem in self.reflect_path.iter() { - current = elem - .reflect_element(current) - .map_err(|e| ScriptError::new_reflection_error(e.to_string()))?; - } - Ok(current) + self.reflect_path.reflect_element(root).map_err(|e| ScriptError::new_reflection_error(e.to_string())) } fn walk_path_mut<'a>( &self, root: &'a mut dyn PartialReflect, ) -> ScriptResult<&'a mut dyn PartialReflect> { - let mut current = root; - for elem in self.reflect_path.iter() { - current = elem - .reflect_element_mut(current) - .map_err(|e| ScriptError::new_reflection_error(e.to_string()))?; - } - Ok(current) + self.reflect_path.reflect_element_mut(root).map_err(|e| ScriptError::new_reflection_error(e.to_string())) } } @@ -548,169 +536,36 @@ fn map_key_to_concrete(key: &str, key_type_id: TypeId) -> Option>(path: I) -> Self { - Self::Reflection(path.into()) - } - - pub fn new_deferred>(defref: I) -> Self { - Self::DeferredReflection(defref.into()) - } - - /// Assumes the accesses are 1 indexed and converts them to 0 indexed - pub fn convert_to_0_indexed(&mut self){ - match self { - ReflectionPathElem::Reflection(path) => { - path.0.iter_mut().for_each(|a| match a.access { - bevy::reflect::Access::FieldIndex(ref mut i) => *i -= 1, - bevy::reflect::Access::TupleIndex(ref mut i) => *i -= 1, - bevy::reflect::Access::ListIndex(ref mut i) => *i -= 1, - _ => {} - }); - }, - ReflectionPathElem::DeferredReflection(_) => {}, - ReflectionPathElem::MapAccess(_) => {}, - ReflectionPathElem::Identity => {}, - }; - } -} - -impl From<(A, B)> for DeferredReflection -where - A: Fn(&dyn PartialReflect) -> Result<&dyn PartialReflect, ReflectPathError<'static>> - + Send - + Sync, - B: Fn(&mut dyn PartialReflect) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> - + Send - + Sync, -{ - fn from((get, get_mut): (A, B)) -> Self { - Self { - get: Arc::new(get), - get_mut: Arc::new(get_mut), - } - } -} - -impl> From for ReflectionPathElem { - fn from(value: T) -> Self { - Self::DeferredReflection(value.into()) - } -} + fn is_empty(&self) -> bool; -impl From for ReflectionPathElem { - fn from(value: ParsedPath) -> Self { - Self::Reflection(value) - } + fn iter(&self) -> impl Iterator; } -impl<'a> ReflectPath<'a> for &'a ReflectionPathElem { - fn reflect_element<'r>( - self, - root: &'r dyn PartialReflect, - ) -> Result<&'r dyn PartialReflect, ReflectPathError<'a>> { - match self { - ReflectionPathElem::Reflection(path) => path.reflect_element(root), - ReflectionPathElem::DeferredReflection(f) => (f.get)(root), - ReflectionPathElem::Identity => Ok(root), - ReflectionPathElem::MapAccess(key) => { - if let ReflectRef::Map(map) = root.reflect_ref() { - let key_type_id = map.key_type_id().expect("Expected map keys to represent a type to be able to assign values"); - let key = map_key_to_concrete(key, key_type_id) - .ok_or(ReflectPathError::InvalidDowncast)?; - map.get(key.as_ref()).ok_or(ReflectPathError::InvalidDowncast) - } else { - Err(ReflectPathError::InvalidDowncast) - } - }, - - } - } +impl ReflectionPathExt for ParsedPath { - fn reflect_element_mut<'r>( - self, - root: &'r mut dyn PartialReflect, - ) -> Result<&'r mut dyn PartialReflect, ReflectPathError<'a>> { - match self { - ReflectionPathElem::Reflection(path) => path.reflect_element_mut(root), - ReflectionPathElem::DeferredReflection(defref) => (defref.get_mut)(root), - ReflectionPathElem::Identity => Ok(root), - ReflectionPathElem::MapAccess(key) => { - if let ReflectMut::Map(map) = root.reflect_mut() { - let key_type_id = map.key_type_id().expect("Expected map keys to represent a type to be able to assign values"); - let key = map_key_to_concrete(key, key_type_id) - .ok_or(ReflectPathError::InvalidDowncast)?; - map.get_mut(key.as_ref()).ok_or(ReflectPathError::InvalidDowncast) - } else { - Err(ReflectPathError::InvalidDowncast) - } - }, - - } + /// Assumes the accesses are 1 indexed and converts them to 0 indexed + fn convert_to_0_indexed(&mut self){ + self.0.iter_mut().for_each(|a| match a.access { + bevy::reflect::Access::FieldIndex(ref mut i) => *i -= 1, + bevy::reflect::Access::TupleIndex(ref mut i) => *i -= 1, + bevy::reflect::Access::ListIndex(ref mut i) => *i -= 1, + _ => {} + }); } -} - -/// A ReflectPath which can perform arbitrary operations on the root object to produce a sub-reference -#[derive(Clone)] -pub struct DeferredReflection { - pub get: Arc< - dyn Fn(&dyn PartialReflect) -> Result<&dyn PartialReflect, ReflectPathError<'static>> - + Send - + Sync, - >, - pub get_mut: Arc< - dyn Fn( - &mut dyn PartialReflect, - ) -> Result<&mut dyn PartialReflect, ReflectPathError<'static>> - + Send - + Sync, - >, -} -/// Given a function, repeats it with a mutable reference for the get_mut deferred variant -#[macro_export] -macro_rules! new_deferred_reflection { - (|$root:ident| {$($get:tt)*}) => { - $crate::bindings::reference::DeferredReflection::from(( - |$root: &dyn PartialReflect| -> Result<&dyn PartialReflect, bevy::reflect::ReflectPathError<'static>> { - $($get)* - }, - |$root: &mut dyn PartialReflect| -> Result<&mut dyn PartialReflect, bevy::reflect::ReflectPathError<'static>> { - $($get)* - }, - )) - }; -} - - -impl Debug for DeferredReflection { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str("DeferredReflection") + fn is_empty(&self) -> bool { + self.0.is_empty() } -} -impl PartialEq for DeferredReflection { - fn eq(&self, other: &Self) -> bool { - Arc::ptr_eq(&self.get, &other.get) && Arc::ptr_eq(&self.get_mut, &other.get_mut) + fn iter(&self) -> impl Iterator { + self.0.iter() } + } -impl Eq for DeferredReflection {} - /// A generic iterator over any reflected value. /// Unlike a normal iterator, this one does not have a halting condition, it will keep returning elements forever. @@ -744,7 +599,7 @@ impl ReflectRefIter { IterationKey::Index(i) => { let mut next = self.base.clone(); let parsed_path = ParsedPath::parse(&format!("[{}]", *i)).expect("invariant violated"); - next.index_path(ReflectionPathElem::Reflection(parsed_path)); + next.index_path(parsed_path); *i += 1; next } @@ -762,7 +617,7 @@ impl Iterator for ReflectRefIter { IterationKey::Index(i) => { let mut next = self.base.clone(); let parsed_path = ParsedPath::parse(&i.to_string()).unwrap(); - next.index_path(ReflectionPathElem::Reflection(parsed_path)); + next.index_path(parsed_path); *i += 1; Ok(next) } diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs index 6ea967d134..40f1ee6523 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -15,10 +15,7 @@ use crate::{ reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, }; -use super::{ - pretty_print::DisplayWithWorld, ReflectReference, ReflectionPathElem, WorldAccessGuard, - WorldGuard, -}; +use super::{pretty_print::DisplayWithWorld, ReflectReference, WorldGuard}; /// An abstraction of values that can be passed to and from scripts. /// This allows us to re-use logic between scripting languages. @@ -34,16 +31,14 @@ pub enum ScriptValue { World, } -impl TryFrom for ReflectionPathElem { +impl TryFrom for ParsedPath { type Error = ScriptError; fn try_from(value: ScriptValue) -> Result { Ok(match value { - ScriptValue::Integer(i) => { - ReflectionPathElem::Reflection(ParsedPath::from(vec![OffsetAccess { - access: bevy::reflect::Access::ListIndex(i as usize), - offset: Some(1), - }])) - } + ScriptValue::Integer(i) => ParsedPath::from(vec![OffsetAccess { + access: bevy::reflect::Access::ListIndex(i as usize), + offset: Some(1), + }]), ScriptValue::Float(v) => { return Err(ValueConversionError::InvalidIndex { index: v.to_string().into(), @@ -58,11 +53,11 @@ impl TryFrom for ReflectionPathElem { access: bevy::reflect::Access::TupleIndex(index), offset: Some(1), }]); - return Ok(ReflectionPathElem::Reflection(parsed_path)); + return Ok(parsed_path); } } - let path = match cow { + match cow { Cow::Borrowed(v) => ParsedPath::parse_static(v).map_err(|e| { ValueConversionError::InvalidIndex { index: v.into(), @@ -77,9 +72,7 @@ impl TryFrom for ReflectionPathElem { reason: Some(e.to_string().into()), })? } - }; - - ReflectionPathElem::new_reflection(path) + } } ScriptValue::Reference(reflect_reference) => { return Err(ValueConversionError::InvalidIndex { @@ -88,7 +81,7 @@ impl TryFrom for ReflectionPathElem { reason: Some("References cannot be used as indices".into()), })? } - _ => ReflectionPathElem::Identity, + _ => ParsedPath(vec![]), }) } } @@ -281,6 +274,10 @@ impl FromScriptValue for dyn PartialReflect { // TODO: if these types ever support reflect, we can uncomment these lines // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script // we should instead allocate and leak perhaps. then garbage collect later + + // support for arbitrary arg types + t if t == TypeId::of::() => return Some(Ok(Box::new(value))), + t if t == TypeId::of::<()>() => { return <()>::from_script_value(value, world, target_type_id) } @@ -486,77 +483,19 @@ impl IntoScriptValue for f64 { } } -impl IntoScriptValue for i8 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for i16 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for i32 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for i64 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self)) - } -} - -impl IntoScriptValue for i128 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for isize { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for u8 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for u16 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for u32 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for u64 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} - -impl IntoScriptValue for u128 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } +macro_rules! into_script_value_integers { + ($($ty:ty),*) => { + $( + impl IntoScriptValue for $ty { + fn into_script_value(self, _: WorldGuard) -> ScriptResult { + Ok(ScriptValue::Integer(self as i64)) + } + } + )* + }; } -impl IntoScriptValue for usize { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { - Ok(ScriptValue::Integer(self as i64)) - } -} +into_script_value_integers!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize); impl IntoScriptValue for Box { fn into_script_value(self, _: WorldGuard) -> ScriptResult { @@ -1008,7 +947,7 @@ mod test { utils::HashMap, }; - use crate::prelude::AppReflectAllocator; + use crate::{bindings::WorldAccessGuard, prelude::AppReflectAllocator}; use super::*; diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 9353c8836e..2e0787104d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -29,8 +29,8 @@ use bevy::{ }, hierarchy::{BuildChildren, Children, DespawnRecursiveExt, Parent}, reflect::{ - func::args::FromArg, std_traits::ReflectDefault, PartialReflect, Reflect, TypePath, - TypeRegistry, TypeRegistryArc, + func::args::FromArg, std_traits::ReflectDefault, ParsedPath, PartialReflect, Reflect, + TypePath, TypeRegistry, TypeRegistryArc, }, utils::HashMap, }; @@ -698,7 +698,7 @@ impl<'w> WorldAccessGuard<'w> { .expect("Component does not have type id"), base_id: ReflectBase::Component(entity.id(), component_id), }, - reflect_path: Default::default(), + reflect_path: ParsedPath(vec![]), })) } else { Ok(None) @@ -751,7 +751,7 @@ impl<'w> WorldAccessGuard<'w> { .expect("Resource does not have type id"), base_id: ReflectBase::Resource(resource_id), }, - reflect_path: Default::default(), + reflect_path: ParsedPath(vec![]), })) } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index fff65b3e5d..0fbfd13b8c 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -1,12 +1,18 @@ //! Contains functions defined by the [`bevy_mod_scripting_core`] crate use bevy::{ prelude::*, - reflect::func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, + reflect::{ + func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, + ParsedPath, + }, }; use bevy_mod_scripting_core::*; use bindings::{ - script_val::ScriptValue, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, + script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, + ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, + WorldCallbackAccess, }; +use reflection_extensions::TypeIdExtensions; use crate::namespaced_register::NamespaceBuilder; @@ -28,12 +34,12 @@ impl Plugin for CoreFunctionsPlugin { fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - .register_function("spawn", |s: WorldCallbackAccess| s.spawn())? - .register_function( + .overwrite("spawn", |s: WorldCallbackAccess| s.spawn()) + .overwrite( "get_type_by_name", |world: WorldCallbackAccess, type_name: String| world.get_type_by_name(type_name), - )? - .register_function( + ) + .overwrite( "get_component", |s: WorldCallbackAccess, entity: Entity, registration: ScriptTypeRegistration| { let c = s @@ -41,8 +47,112 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe .unwrap(); c.map(ScriptValue::Reference).unwrap_or(ScriptValue::Unit) }, - )? - .register_function("exit", |s: WorldCallbackAccess| s.exit())?; + ) + .overwrite("exit", |s: WorldCallbackAccess| s.exit()); + + NamespaceBuilder::::new(reg) + .overwrite( + "get", + |world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue| { + if let ScriptValue::Reference(mut r) = self_ { + let path: ParsedPath = key.try_into().unwrap(); + r.index_path(path); + let world = world.read().expect("Stale world"); + let script_val = r + .with_reflect(world.clone(), |r| r.into_script_value(world).unwrap()) + .unwrap(); + script_val + } else { + ScriptValue::Unit + } + }, + ) + .overwrite( + "get_1_indexed", + |world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue| { + if let ScriptValue::Reference(mut r) = self_ { + let mut path: ParsedPath = key.try_into().unwrap(); + path.convert_to_0_indexed(); + r.index_path(path); + let world = world.read().expect("Stale world"); + let script_val = r + .with_reflect(world.clone(), |r| r.into_script_value(world).unwrap()) + .unwrap(); + script_val + } else { + ScriptValue::Unit + } + }, + ) + .overwrite( + "set", + |world: WorldCallbackAccess, + self_: ScriptValue, + key: ScriptValue, + value: ScriptValue| { + if let ScriptValue::Reference(mut self_) = self_ { + let world = world.read().expect("stale world"); + let path: ParsedPath = key.try_into().unwrap(); + + self_.index_path(path); + self_ + .with_reflect_mut(world.clone(), |r| { + let target_type_id = r + .get_represented_type_info() + .map(|i| i.type_id()) + .type_id_or_fake_id(); + let other = ::from_script_value( + value, + world.clone(), + target_type_id, + ) + .transpose() + .unwrap() + .unwrap(); + + r.try_apply(other.as_partial_reflect()).unwrap(); + ScriptValue::Unit + }) + .unwrap(); + } + ScriptValue::Unit + }, + ) + .overwrite( + "set_1_indexed", + |world: WorldCallbackAccess, + self_: ScriptValue, + key: ScriptValue, + value: ScriptValue| { + if let ScriptValue::Reference(mut self_) = self_ { + let world = world.read().expect("stale world"); + let mut path: ParsedPath = key.try_into().unwrap(); + path.convert_to_0_indexed(); + + self_.index_path(path); + self_ + .with_reflect_mut(world.clone(), |r| { + let target_type_id = r + .get_represented_type_info() + .map(|i| i.type_id()) + .type_id_or_fake_id(); + let other = ::from_script_value( + value, + world.clone(), + target_type_id, + ) + .transpose() + .unwrap() + .unwrap(); + + r.try_apply(other.as_partial_reflect()).unwrap(); + ScriptValue::Unit + }) + .unwrap(); + } + ScriptValue::Unit + }, + ); Ok(()) } diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index ccfac41f3b..96a495fdb8 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -15,6 +15,16 @@ pub trait RegisterNamespacedFunction { N: Into>, S: IntoNamespace, F: IntoFunction<'static, M> + 'static; + + fn overwrite_namespaced_function( + &mut self, + name: N, + function: F, + ) -> Option> + where + N: Into>, + S: IntoNamespace, + F: IntoFunction<'static, M> + 'static; } pub trait GetNamespacedFunction { @@ -81,6 +91,21 @@ impl RegisterNamespacedFunction for FunctionRegistry { self.register_with_name(function_name, function)?; Ok(()) } + + fn overwrite_namespaced_function( + &mut self, + name: N, + function: F, + ) -> Option> + where + N: Into>, + S: IntoNamespace, + F: IntoFunction<'static, M> + 'static, + { + let cow: Cow<'static, str> = name.into(); + let function_name = S::into_namespace().function_name(cow); + self.overwrite_registration_with_name(function_name, function) + } } impl GetNamespacedFunction for FunctionRegistry { @@ -120,7 +145,7 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { } } - pub fn register_function( + pub fn register( &mut self, name: N, function: F, @@ -133,4 +158,14 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { .register_namespaced_function::(name, function)?; Ok(self) } + + pub fn overwrite(&mut self, name: N, function: F) -> &mut Self + where + N: Into>, + F: IntoFunction<'static, M> + 'static, + { + self.registry + .overwrite_namespaced_function::(name, function); + self + } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 3377235517..2e5202f2c5 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -10,23 +10,24 @@ use std::{ use bevy::{ ecs::{reflect::AppTypeRegistry, world::Mut}, prelude::AppFunctionRegistry, - reflect::{OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect}, + reflect::{ + func::DynamicFunction, OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect, + }, }; use bevy_mod_scripting_core::{ bindings::{ function::CallableWithAccess, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, - DeferredReflection, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathElem, - TypeIdSource, WorldCallbackAccess, + ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, + WorldCallbackAccess, }, error::{FunctionError, ScriptError, ScriptResult, ValueConversionError}, - new_deferred_reflection, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, Either, }; use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; -use mlua::{IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value, Variadic}; +use mlua::{Function, IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value, Variadic}; use super::{ // proxy::{LuaProxied, LuaValProxy}, @@ -46,229 +47,6 @@ impl AsRef for LuaReflectReference { } } -impl LuaReflectReference { - pub fn len(&self, lua: &Lua) -> Result, mlua::Error> { - self.0.len(lua.get_world()).map_err(mlua::Error::external) - } - - // pub fn concrete_from_value( - // self, - // value: Value, - // lua: &Lua, - // type_id_source: TypeIdSource, - // ) -> Result, mlua::Error> { - // let world = lua.get_world(); - - // let type_id = self.0.type_id_of(type_id_source, &world)?; - - // let o = ReflectReference::map_type_data( - // type_id, - // &world.clone(), - // move |type_data: Option>| { - // let val = match type_data { - // Some(Either::Left(value_data)) => { - // bevy::log::debug!("Converting using ReflectLuaValue"); - // (value_data.from_value)(value, lua)? - // } - // Some(Either::Right(proxy_data)) => { - // bevy::log::debug!("Converting using ReflectLuaProxied"); - // let other = (proxy_data.from_proxy)(value, lua)?; - // other.with_reflect(&world, |r, _, _| r.clone_value())? - // } - // None => { - // bevy::log::debug!("No conversion type data found"); - // return Err(ScriptError::new_runtime_error(format!( - // "Tried to convert lua value: '{value:?}', to {}: '{}'. but this type does not support conversion from lua.", - // match type_id_source { - // TypeIdSource::Key => "key type of", - // TypeIdSource::Element => "element type of", - // TypeIdSource::Tail => "", - // }, - // ReflectReferencePrinter::new(self.0).pretty_print(&world), - // ))); - // } - // }; - // Ok(val) - // }, - // )??; - // Ok(o) - // } - - // /// Queries the reflection system for a proxy registration for the underlying type. - // /// If found will convert to lua using this proxy - // /// If not found will use ::into_lua to convert to lua - // pub fn to_lua_proxy(self, lua: &Lua) -> Result, mlua::Error> { - // // note we do not need to refer to LuaWorld here, it does not matter what the proxy is, that's pretty neat, - // let world = lua.get_world(); - - // let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; - - // ReflectReference::map_type_data( - // type_id, - // &world, - // |type_data: Option>| match type_data { - // Some(Either::Left(value_data)) => self - // .0 - // .with_reflect(&world, |r| (value_data.into_value)(r, lua))?, - // Some(Either::Right(proxy_data)) => Ok((proxy_data.into_proxy)(self.0, lua)?), - // None => Ok(LuaReflectReference(self.0).into_lua(lua)?), - // }, - // )? - // } - - // pub fn set_with_lua_proxy(self, lua: &Lua, value: Value) -> Result<(), mlua::Error> { - // bevy::log::debug!("Setting lua reflect reference with value: {:?}", value); - - // let world = lua.get_world(); - - // let type_id = self.0.type_id_of(TypeIdSource::Tail, &world)?; - - // ReflectReference::map_type_data( - // type_id, - // &world.clone(), - // move |type_data: Option>| { - // // let world = world.clone(); // move copy into closure - // match type_data { - // Some(Either::Left(value_data)) => { - // let other = (value_data.from_value)(value, lua)?; - // self.0.with_reflect_mut(&world, |r| { - // r.try_apply(other.as_partial_reflect()) - // .map_err(ScriptError::new_reflection_error) - // })? - // } - // Some(Either::Right(proxy_data)) => { - // let other = (proxy_data.from_proxy)(value, lua)?; - // let other = other.with_reflect(&world, |r, _, _| r.clone_value())?; - // // now we can set it - // self.0.with_reflect_mut(&world, |r| { - // if let Some(set) = proxy_data.opt_set { - // set(r, other) - // } else { - // r.try_apply(other.as_partial_reflect()) - // .map_err(ScriptError::new_reflection_error)?; - // Ok(()) - // } - // })? - // } - // None => { - // Err(ScriptError::new_runtime_error(format!( - // "Invalid assignment `{}` = `{value:?}`. The left hand side does not support conversion from lua.", - // ReflectReferencePrinter::new(self.0).pretty_print(&world), - // ))) - // } - // } - // }, - // )??; - // Ok(()) - // } - - /// Adjusts all the numeric accesses in the path from 1-indexed to 0-indexed - pub fn to_host_index(path: &mut ParsedPath) { - path.0.iter_mut().for_each(|a| match a.access { - bevy::reflect::Access::FieldIndex(ref mut i) => *i -= 1, - bevy::reflect::Access::TupleIndex(ref mut i) => *i -= 1, - bevy::reflect::Access::ListIndex(ref mut i) => *i -= 1, - _ => {} - }); - } - - /// Adjusts all the numeric accesses in the path from 0-indexed to 1-indexed - pub fn from_host_index(path: &mut ParsedPath) { - path.0.iter_mut().for_each(|a| match a.access { - bevy::reflect::Access::FieldIndex(ref mut i) => *i += 1, - bevy::reflect::Access::TupleIndex(ref mut i) => *i += 1, - bevy::reflect::Access::ListIndex(ref mut i) => *i += 1, - _ => {} - }); - } - - pub fn parse_value_index(value: Value) -> Result { - if let Some(num) = value.as_usize() { - Ok(vec![OffsetAccess { - access: bevy::reflect::Access::ListIndex(num), - offset: Some(1), - }] - .into()) - } else if let Some(key) = value.as_str() { - if let Some(tuple_struct_index) = key.strip_prefix("_") { - if let Ok(index) = tuple_struct_index.parse::() { - return Ok(vec![OffsetAccess { - access: bevy::reflect::Access::TupleIndex(index), - offset: Some(1), - }] - .into()); - } - } - - ParsedPath::parse(key).map_err(|e| mlua::Error::external(e.to_string())) - } else { - Err(mlua::Error::external("Invalid index")) - } - } -} - -// impl<'lua> IntoLua<'lua> for LuaReflectReference { -// fn into_lua(self, lua: &'lua Lua) -> mlua::Result> { -// // if we are a primitive type, we can convert to lua directly -// let world = lua.get_world(); - -// let value = self.0.with_reflect(&world, |r| { -// let tail_type_id = r -// .get_represented_type_info() -// .map(|i| i.type_id()) -// .type_id_or_fake_id(); - -// if let Ok(v) = r.as_option() { -// if let Some(v) = v { -// return Ok(v); -// } -// } - -// into_lua_cases!( -// lua, -// world, -// self, -// r, -// [ -// // TODO: after update to mlua 10, we can use the new `IntoLua` impls for these types -// &'static str, -// &'static CStr, -// // &'static OsStr, -// // &'static Path, -// Cow<'static, str>, -// Cow<'static, CStr>, -// bool, -// f32, -// f64, -// i8, -// i16, -// i32, -// i64, -// i128, -// isize, -// u8, -// u16, -// u32, -// u64, -// u128, -// usize, -// Box, -// CString, -// String -// // OsString, -// // PathBuf -// ] -// ); -// }); -// } -// } - -// impl_userdata_from_lua!(LuaReflectReference); - -// impl LuaProxied for ReflectReference { -// type Proxy = LuaReflectReference; -// } - impl From for ReflectReference { fn from(value: LuaReflectReference) -> Self { value.0 @@ -281,87 +59,91 @@ impl From for LuaReflectReference { } } +/// Looks up a function in the registry on the given type id +fn lookup_function<'lua>( + lua: &'lua Lua, + key: &str, + type_id: TypeId, +) -> Option, mlua::Error>> { + let function = lookup_dynamic_function(lua, key, type_id); + + function.map(|function| { + lua.create_function(move |lua, args: Variadic| { + let world = lua.get_world(); + let out = function.dynamic_call(args.into_iter().map(Into::into), world)?; + + Ok(LuaScriptValue::from(out)) + }) + }) +} + +fn lookup_dynamic_function<'lua>( + lua: &'lua Lua, + key: &str, + type_id: TypeId, +) -> Option> { + let function_registry = lua + .get_world() + .with_resource(|registry: &AppFunctionRegistry| registry.clone()); + let registry = function_registry.read(); + + registry + .get_namespaced_function(key.to_string(), Namespace::OnType(type_id)) + .cloned() +} + +fn lookup_dynamic_function_typed<'lua, T: 'static + ?Sized>( + lua: &'lua Lua, + key: &str, +) -> Option, mlua::Error>> { + let type_id = TypeId::of::(); + let function = lookup_dynamic_function(lua, key, type_id); + + function.map(Ok) +} + impl UserData for LuaReflectReference { fn add_methods<'lua, T: UserDataMethods<'lua, Self>>(m: &mut T) { m.add_meta_function( MetaMethod::Index, |lua, (self_, key): (LuaReflectReference, LuaScriptValue)| { let world = lua.get_world(); - let mut self_: ReflectReference = self_.into(); + let self_: ReflectReference = self_.into(); let type_id = self_.tail_type_id(world.clone())?.type_id_or_fake_id(); let key: ScriptValue = key.into(); if let ScriptValue::String(ref key) = key { - let function_registry = - world.with_resource(|registry: &AppFunctionRegistry| registry.clone()); - let registry = function_registry.read(); - - if let Some(func) = - registry.get_namespaced_function(key.clone(), Namespace::OnType(type_id)) - { - let func = func.clone(); - let func = - lua.create_function(move |_, args: Variadic| { - let out = func.dynamic_call( - args.into_iter().map(Into::into), - world.clone(), - )?; - - Ok(LuaScriptValue::from(out)) - })?; - - return func.into_lua(lua); + if let Some(func) = lookup_function(lua, key, type_id) { + return func?.into_lua(lua); } }; - let mut reflect_path: ReflectionPathElem = key.try_into()?; - reflect_path.convert_to_0_indexed(); - self_.index_path(reflect_path); - let script_value = self_.with_reflect(world.clone(), |r| { - <&dyn PartialReflect>::into_script_value(r, world.clone()) - })??; - LuaScriptValue::from(script_value).into_lua(lua) + // lookup get function + let index_func = + lookup_dynamic_function_typed::(lua, "get_1_indexed") + .expect("No 'get' function registered for a ReflectReference")?; + + // call the function with the key + let out = index_func + .dynamic_call(vec![ScriptValue::Reference(self_), key], world.clone())?; + LuaScriptValue::from(out).into_lua(lua) }, ); m.add_meta_function( MetaMethod::NewIndex, |lua, (self_, key, value): (LuaReflectReference, LuaScriptValue, LuaScriptValue)| { - let mut self_: ReflectReference = self_.into(); + let self_: ReflectReference = self_.into(); let key: ScriptValue = key.into(); let value: ScriptValue = value.into(); - let mut reflect_path: ReflectionPathElem = key.try_into()?; - reflect_path.convert_to_0_indexed(); - - let world = lua.get_world(); - self_.index_path(reflect_path); - self_.with_reflect_mut(world.clone(), |r| { - let target_type_id = r - .get_represented_type_info() - .map(|i| i.type_id()) - .type_id_or_fake_id(); - let other = ::from_script_value( - value, - world.clone(), - target_type_id, - ) - .transpose()? - .ok_or_else(|| ValueConversionError::TypeMismatch { - expected_type: target_type_id.display_with_world(world.clone()).into(), - actual_type: Some( - r.get_represented_type_info() - .map(|i| i.type_id()) - .type_id_or_fake_id() - .display_with_world(world.clone()) - .into(), - ), - })?; - - r.try_apply(other.as_partial_reflect())?; - Ok::<_, ScriptError>(()) - })??; + lookup_dynamic_function_typed::(lua, "set_1_indexed") + .expect("No 'set' function registered for a ReflectReference")? + .dynamic_call( + vec![ScriptValue::Reference(self_), key, value], + lua.get_world(), + )?; Ok(()) }, From f10ad4cc263933e2ae769d2a8d7bd24c7faf786c Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 16:40:45 +0000 Subject: [PATCH 044/217] refactor errors considerably --- assets/scripts/bevy_api.lua | 2 +- crates/bevy_mod_scripting_core/src/asset.rs | 7 +- .../src/bindings/function.rs | 104 ++-- .../src/bindings/pretty_print.rs | 24 +- .../src/bindings/reference.rs | 369 ++++++------ .../src/bindings/script_val.rs | 395 +++++++------ .../src/bindings/world.rs | 226 ++++---- .../bevy_mod_scripting_core/src/commands.rs | 2 +- crates/bevy_mod_scripting_core/src/error.rs | 524 +++++++++++++++--- .../src/reflection_extensions.rs | 350 ++++++------ crates/bevy_mod_scripting_core/src/systems.rs | 19 +- .../bevy_mod_scripting_functions/src/core.rs | 24 +- .../src/bindings/reference.rs | 2 +- .../src/bindings/script_value.rs | 1 + .../src/bindings/world.rs | 25 +- 15 files changed, 1254 insertions(+), 820 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 4a623a36a5..2ceb9880b6 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -22,7 +22,7 @@ function on_event() print("\noption") -- print(comp:get("option_usize")) - print(comp.option_usize) + print(comp.option_usie) comp.option_usize = 69 print(comp.option_usize) comp.option_usize = nil diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index 0833c413db..721ed51d60 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -44,9 +44,10 @@ impl AssetLoader for ScriptAssetLoader { load_context: &mut bevy::asset::LoadContext<'_>, ) -> Result { let mut content = Vec::new(); - reader.read_to_end(&mut content).await.map_err(|e| { - ScriptError::new_lifecycle_error(e).with_context(load_context.asset_path()) - })?; + reader + .read_to_end(&mut content) + .await + .map_err(|e| ScriptError::new_error(e).with_context(load_context.asset_path()))?; if let Some(processor) = &self.preprocessor { processor(&mut content)?; } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index cb718f46e1..da51958420 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -3,12 +3,12 @@ use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; use bevy::reflect::{ func::{ args::{Arg, ArgInfo, Ownership}, - ArgList, ArgValue, DynamicFunction, FunctionResult, Return, + ArgList, ArgValue, DynamicFunction, FunctionInfo, FunctionResult, Return, }, PartialReflect, }; -use crate::error::{ScriptError, ScriptResult, ValueConversionError}; +use crate::error::{InteropError, ScriptError, ScriptResult}; use super::{ access_map::ReflectAccessId, @@ -26,19 +26,13 @@ pub trait CallableWithAccess { args: I, world: Arc, f: F, - ) -> ScriptResult; + ) -> Result; fn dynamic_call>( &self, args: I, world: Arc, - ) -> ScriptResult { - self.with_call(args, world.clone(), |r| match r { - Return::Owned(partial_reflect) => partial_reflect.as_ref().into_script_value(world), - Return::Ref(ref_) => ref_.into_script_value(world), - Return::Mut(mut_ref) => mut_ref.into_script_value(world), - })? - } + ) -> Result; } impl CallableWithAccess for DynamicFunction<'_> { @@ -47,7 +41,7 @@ impl CallableWithAccess for DynamicFunction<'_> { args: I, world: Arc, f: F, - ) -> ScriptResult { + ) -> Result { let info = self.info().args(); // We need to: @@ -68,9 +62,9 @@ impl CallableWithAccess for DynamicFunction<'_> { { std::iter::once(ScriptValue::World) .chain(arg_iter) - .into_args_list_with_access(info, world.clone())? + .into_args_list_with_access(self.info(), world.clone())? } else { - arg_iter.into_args_list_with_access(info, world.clone())? + arg_iter.into_args_list_with_access(self.info(), world.clone())? }; let mut final_args_list = ArgList::default(); @@ -101,7 +95,7 @@ impl CallableWithAccess for DynamicFunction<'_> { unsafe { world.release_access(id) }; }); - return Err(e.into()); + return Err(InteropError::function_call_error(e)); } }; @@ -114,6 +108,19 @@ impl CallableWithAccess for DynamicFunction<'_> { Ok(out) } + + fn dynamic_call>( + &self, + args: I, + world: Arc, + ) -> Result { + self.with_call(args, world.clone(), |r| match r { + Return::Owned(partial_reflect) => partial_reflect.as_ref().into_script_value(world), + Return::Ref(ref_) => ref_.into_script_value(world), + Return::Mut(mut_ref) => mut_ref.into_script_value(world), + })? + .map_err(|e| InteropError::function_interop_error(self.info(), None, e).into()) + } } /// Trait implementable by lists of things representing arguments which can be converted into an `ArgList`. @@ -122,9 +129,9 @@ impl CallableWithAccess for DynamicFunction<'_> { pub trait IntoArgsListWithAccess { fn into_args_list_with_access<'w>( self, - arg_info: &[ArgInfo], + function_info: &FunctionInfo, world: WorldGuard<'w>, - ) -> ScriptResult<(Vec>, Vec<(ReflectAccessId, Ownership)>)>; + ) -> Result<(Vec>, Vec<(ReflectAccessId, Ownership)>), InteropError>; } impl> IntoArgsListWithAccess for I { @@ -134,9 +141,10 @@ impl> IntoArgsListWithAccess for I { /// Meaning that only after releasing access is it possible to create unsafe aliases fn into_args_list_with_access<'w>( self, - arg_info: &[ArgInfo], + function_info: &FunctionInfo, world: WorldGuard<'w>, - ) -> ScriptResult<(Vec>, Vec<(ReflectAccessId, Ownership)>)> { + ) -> Result<(Vec>, Vec<(ReflectAccessId, Ownership)>), InteropError> { + let arg_info = function_info.args(); let mut accesses = Vec::default(); let mut arg_list = Vec::default(); @@ -147,23 +155,23 @@ impl> IntoArgsListWithAccess for I { }); }; - for (value, arg_info) in self.zip(arg_info.iter()) { + for (value, argument_info) in self.zip(arg_info.iter()) { match value { // TODO: I'd see the logic be a bit cleaner, this if is needed to support 'Raw' ScriptValue arguments // as we do not want to claim any access since we're not using the value yet ScriptValue::Reference(arg_ref) - if arg_info.type_id() != TypeId::of::() => + if argument_info.type_id() != TypeId::of::() => { - let access_id = - ReflectAccessId::for_reference(arg_ref.base.base_id.clone()).ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Could not call function, argument: {:?}, with type: {} is not a valid reference. Have you registered the type?", - arg_info.name().map(str::to_owned).unwrap_or_else(|| arg_info.index().to_string()), - arg_ref.display_with_world(world.clone()) - )) - })?; + let access_id = ReflectAccessId::for_reference(arg_ref.base.base_id.clone()) + .ok_or_else(|| { + InteropError::function_interop_error( + function_info, + Some(argument_info), + InteropError::unregistered_base(arg_ref.base.clone()), + ) + })?; - let is_write = matches!(arg_info.ownership(), Ownership::Mut); + let is_write = matches!(argument_info.ownership(), Ownership::Mut); let success = if is_write { world.claim_write_access(access_id) @@ -173,20 +181,27 @@ impl> IntoArgsListWithAccess for I { if !success { release_accesses(&mut accesses); - return Err(ScriptError::new_reflection_error(format!( - "Could not claim access for argument {}", - arg_ref.display_with_world(world.clone()) - ))); + return Err(InteropError::function_interop_error( + function_info, + Some(argument_info), + InteropError::cannot_claim_access(arg_ref.base.clone()), + ) + .into()); } - accesses.push((access_id, arg_info.ownership())); + accesses.push((access_id, argument_info.ownership())); - let val = unsafe { arg_ref.clone().into_arg_value(world.clone(), arg_info) }; + let val = + unsafe { arg_ref.clone().into_arg_value(world.clone(), argument_info) }; let val = match val { Ok(v) => v, Err(e) => { release_accesses(&mut accesses); - return Err(e); + return Err(InteropError::function_interop_error( + function_info, + Some(argument_info), + e, + )); } }; arg_list.push(val); @@ -200,7 +215,7 @@ impl> IntoArgsListWithAccess for I { let value = match ::from_script_value( value, world.clone(), - arg_info.type_id(), + argument_info.type_id(), ) { Some(Ok(v)) => v, Some(Err(e)) => { @@ -208,14 +223,19 @@ impl> IntoArgsListWithAccess for I { accesses.iter().for_each(|(id, _)| { unsafe { world.release_access(*id) }; }); - return Err(e); + return Err(InteropError::function_interop_error( + function_info, + Some(argument_info), + e, + )); } None => { release_accesses(&mut accesses); - return Err(ValueConversionError::TypeMismatch { - expected_type: arg_info.type_path().into(), - actual_type: None, - } + return Err(InteropError::function_interop_error( + function_info, + Some(argument_info), + InteropError::impossible_conversion(argument_info.type_id()), + ) .into()); } }; diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 3ed977dae0..bf6def8990 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -1,9 +1,6 @@ use crate::reflection_extensions::TypeIdExtensions; -use super::{ - script_val::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldAccessGuard, - WorldGuard, -}; +use super::{script_val::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldGuard}; use bevy::reflect::{PartialReflect, ReflectRef}; use itertools::Itertools; use std::{any::TypeId, borrow::Cow}; @@ -309,16 +306,30 @@ impl ReflectReferencePrinter { /// For types which can't be pretty printed without world access. /// Implementors should try to print the best value they can, and never panick. -pub trait DisplayWithWorld { +pub trait DisplayWithWorld: std::fmt::Debug { /// Display the `shallowest` representation of the type using world access. /// For references this is the type path and the type of the value they are pointing to. fn display_with_world(&self, world: WorldGuard) -> String; /// Display the most literal representation of the type using world access. /// I.e. for references this would be the pointed to value itself. - fn display_value_with_world(&self, world: WorldGuard) -> String; + fn display_value_with_world(&self, world: WorldGuard) -> String { + self.display_with_world(world) + } } +#[macro_export] +macro_rules! impl_dummy_display ( + ($t:ty) => { + impl std::fmt::Display for $t { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Displaying {} without world access: {:#?}", stringify!($t), self); + Ok(()) + } + } + }; +); + impl DisplayWithWorld for ReflectReference { fn display_with_world(&self, world: WorldGuard) -> String { ReflectReferencePrinter::new(self.clone()).pretty_print(world) @@ -377,6 +388,7 @@ impl DisplayWithWorld for ScriptValue { ScriptValue::Float(f) => f.to_string(), ScriptValue::String(cow) => cow.to_string(), ScriptValue::World => "World".to_owned(), + ScriptValue::Error(script_error) => script_error.to_string(), } } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 674547b506..0a08044573 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -4,37 +4,32 @@ //! reflection gives us access to `dyn PartialReflect` objects via their type name, //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. -use std::{ - any::TypeId, - fmt::Debug, - sync::Arc, +use super::{ + access_map::{AccessMapKey, ReflectAccessId}, + WorldAccessGuard, WorldCallbackAccess, WorldGuard, +}; +use crate::{ + bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, + error::InteropError, + prelude::{ReflectAllocator, ScriptResult}, + reflection_extensions::PartialReflectExt, + with_access_read, with_access_write, }; use bevy::{ ecs::{ - change_detection::MutUntyped, - component::ComponentId, - entity::Entity, + change_detection::MutUntyped, component::ComponentId, entity::Entity, world::unsafe_world_cell::UnsafeWorldCell, - }, prelude::{Component, Resource}, ptr::Ptr, reflect::{ + }, + prelude::{Component, Resource}, + ptr::Ptr, + reflect::{ func::{args::ArgInfo, ArgValue}, - ParsedPath, - PartialReflect, - ReflectFromPtr, - ReflectMut, - ReflectPath, - ReflectPathError, - ReflectRef, - TypeData, - } + ParsedPath, PartialReflect, ReflectFromPtr, ReflectMut, ReflectPath, ReflectPathError, + ReflectRef, TypeData, + }, }; use itertools::Either; -use crate::{ - bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, error::{ReflectReferenceError, ValueConversionError}, prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::PartialReflectExt, with_access_read, with_access_write -}; -use super::{ - access_map::{AccessMapKey, ReflectAccessId}, - WorldAccessGuard, WorldCallbackAccess, WorldGuard, -}; +use std::{any::TypeId, fmt::Debug, sync::Arc}; /// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path /// safe to build but to reflect on the value inside you need to ensure aliasing rules are upheld @@ -58,30 +53,25 @@ pub enum TypeIdSource { Key, } - impl ReflectReference { - /// Creates a new infinite iterator. This iterator will keep returning the next element reference forever. pub fn into_iter_infinite(self) -> ReflectRefIter { ReflectRefIter::new_indexed(self) } /// If this is a reference to something with a length accessible via reflection, returns that length. - pub fn len(&self, world: WorldGuard) -> ScriptResult> { - self - .with_reflect(world, |r| { - match r.reflect_ref() { - bevy::reflect::ReflectRef::Struct(s) => Some(s.field_len()), - bevy::reflect::ReflectRef::TupleStruct(ts) => Some(ts.field_len()), - bevy::reflect::ReflectRef::Tuple(t) => Some(t.field_len()), - bevy::reflect::ReflectRef::List(l) => Some(l.len()), - bevy::reflect::ReflectRef::Array(a) => Some(a.len()), - bevy::reflect::ReflectRef::Map(m) => Some(m.len( )), - bevy::reflect::ReflectRef::Set(s) => Some(s.len()), - bevy::reflect::ReflectRef::Enum(e) => Some(e.field_len()), - _ => None, - } - }) + pub fn len(&self, world: WorldGuard) -> Result, InteropError> { + self.with_reflect(world, |r| match r.reflect_ref() { + bevy::reflect::ReflectRef::Struct(s) => Some(s.field_len()), + bevy::reflect::ReflectRef::TupleStruct(ts) => Some(ts.field_len()), + bevy::reflect::ReflectRef::Tuple(t) => Some(t.field_len()), + bevy::reflect::ReflectRef::List(l) => Some(l.len()), + bevy::reflect::ReflectRef::Array(a) => Some(a.len()), + bevy::reflect::ReflectRef::Map(m) => Some(m.len()), + bevy::reflect::ReflectRef::Set(s) => Some(s.len()), + bevy::reflect::ReflectRef::Enum(e) => Some(e.field_len()), + _ => None, + }) } pub fn new_world() -> Self { @@ -98,7 +88,15 @@ impl ReflectReference { value: T, allocator: &mut ReflectAllocator, ) -> ReflectReference { - let type_id = value.get_represented_type_info().map(|i| i.type_id()).unwrap_or_else(|| panic!("Type '{}' has no represented type information to allocate with.", std::any::type_name::())); + let type_id = value + .get_represented_type_info() + .map(|i| i.type_id()) + .unwrap_or_else(|| { + panic!( + "Type '{}' has no represented type information to allocate with.", + std::any::type_name::() + ) + }); let (id, _) = allocator.allocate(value); ReflectReference { base: ReflectBaseType { @@ -113,7 +111,15 @@ impl ReflectReference { value: Box, allocator: &mut ReflectAllocator, ) -> ReflectReference { - let type_id = value.get_represented_type_info().map(|i| i.type_id()).unwrap_or_else(|| panic!("Type '{}' has no represented type information to allocate with.", std::any::type_name_of_val(value.as_ref()))); + let type_id = value + .get_represented_type_info() + .map(|i| i.type_id()) + .unwrap_or_else(|| { + panic!( + "Type '{}' has no represented type information to allocate with.", + std::any::type_name_of_val(value.as_ref()) + ) + }); let (id, _) = allocator.allocate_boxed(value); ReflectReference { base: ReflectBaseType { @@ -135,10 +141,7 @@ impl ReflectReference { }) } - pub fn new_component_ref( - entity: Entity, - world: WorldGuard, - ) -> Option { + pub fn new_component_ref(entity: Entity, world: WorldGuard) -> Option { let reflect_id = ReflectAccessId::for_component::(&world.as_unsafe_world_cell())?; Some(Self { base: ReflectBaseType { @@ -152,72 +155,84 @@ impl ReflectReference { /// Indexes into the reflect path inside this reference. /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. pub fn index_path>(&mut self, index: T) { - debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to index into a world reference. This will always fail"); + debug_assert!( + !matches!(self.base.base_id, ReflectBase::World), + "Trying to index into a world reference. This will always fail" + ); self.reflect_path.0.extend(index.into().0); } - /// Tries to downcast to the specified type and cloning the value if successful. - pub fn downcast(&self, world: WorldGuard) -> ScriptResult { + pub fn downcast( + &self, + world: WorldGuard, + ) -> Result { self.with_reflect(world, |r| { - r.try_downcast_ref::().cloned() - }).transpose().ok_or_else(|| ScriptError::new_reflection_error(ValueConversionError::TypeMismatch { - expected_type: std::any::type_name::().into(), - actual_type: None, - }))? + r.try_downcast_ref::() + .cloned() + .ok_or_else(|| InteropError::could_not_downcast(self.clone(), TypeId::of::())) + })? } /// Reflects into the value of the reference, cloning it using [`PartialReflect::clone_value`] or if it's a world reference, cloning the world access. - pub fn clone_value(&self, world: WorldGuard) -> ScriptResult> { + pub fn clone_value(&self, world: WorldGuard) -> Result, InteropError> { if matches!(self.base.base_id, ReflectBase::World) { return Ok(Box::new(WorldCallbackAccess::from_guard(world))); } - self.with_reflect(world, |r| { - r.clone_value() - }) + self.with_reflect(world, |r| r.clone_value()) } /// The way to access the value of the reference, that is the pointed-to value. /// This method is safe to use as it ensures no-one else has aliasing access to the value at the same time. - /// + /// /// # Panics /// - if the value is aliased and the access is not allowed pub fn with_reflect O>( &self, world: WorldGuard, f: F, - ) -> ScriptResult { - debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to access a world reference directly. This will always fail"); + ) -> Result { + debug_assert!( + !matches!(self.base.base_id, ReflectBase::World), + "Trying to access a world reference directly. This will always fail" + ); - let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ReflectReferenceError::InvalidBaseReference { reason: format!("For Reference: {}. Component or allocation id is invalid.", self.display_with_world(world.clone())).into() })?; - with_access_read!(world.0.accesses, access_id ,"could not access reflect reference",{ - unsafe { self.reflect_unsafe(world.clone()) } - .map(f) - }) + let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()) + .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; + with_access_read!( + world.0.accesses, + access_id, + "could not access reflect reference", + { unsafe { self.reflect_unsafe(world.clone()) }.map(f) } + ) } - /// The way to access the value of the reference, that is the pointed-to value. /// This method is safe to use as it ensures no-one else has aliasing access to the value at the same time. - /// + /// /// # Panics /// - if the value is aliased and the access is not allowed pub fn with_reflect_mut O>( &self, world: WorldGuard, f: F, - ) -> ScriptResult { - debug_assert!(!matches!(self.base.base_id, ReflectBase::World), "Trying to access a world reference directly. This will always fail"); + ) -> Result { + debug_assert!( + !matches!(self.base.base_id, ReflectBase::World), + "Trying to access a world reference directly. This will always fail" + ); - let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()).ok_or_else(|| ReflectReferenceError::InvalidBaseReference { reason: format!("For Reference: {}. Component or allocation id is invalid.", self.display_with_world(world.clone())).into() })?; - with_access_write!(world.0.accesses, access_id, "Could not access reflect reference mutably", { - unsafe { self.reflect_mut_unsafe(world.clone()) } - .map(f) - }) + let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()) + .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; + with_access_write!( + world.0.accesses, + access_id, + "Could not access reflect reference mutably", + { unsafe { self.reflect_mut_unsafe(world.clone()) }.map(f) } + ) } - - pub fn tail_type_id(&self, world: WorldGuard) -> ScriptResult> { + pub fn tail_type_id(&self, world: WorldGuard) -> Result, InteropError> { if self.reflect_path.is_empty() { return Ok(Some(self.base.type_id)); } @@ -226,19 +241,19 @@ impl ReflectReference { }) } - pub fn element_type_id(&self, world: WorldGuard) -> ScriptResult> { - self.with_reflect(world, |r| { - r.element_type_id() - }) + pub fn element_type_id(&self, world: WorldGuard) -> Result, InteropError> { + self.with_reflect(world, |r| r.element_type_id()) } - pub fn key_type_id(&self, world: WorldGuard) -> ScriptResult> { - self.with_reflect(world, |r| { - r.key_type_id() - }) + pub fn key_type_id(&self, world: WorldGuard) -> Result, InteropError> { + self.with_reflect(world, |r| r.key_type_id()) } - pub fn type_id_of(&self, source: TypeIdSource, world: WorldGuard) -> ScriptResult> { + pub fn type_id_of( + &self, + source: TypeIdSource, + world: WorldGuard, + ) -> Result, InteropError> { match source { TypeIdSource::Tail => self.tail_type_id(world), TypeIdSource::Element => self.element_type_id(world), @@ -246,56 +261,42 @@ impl ReflectReference { } } - pub fn map_type_data(type_id: Option, world: WorldGuard, map: F) -> ScriptResult - where - F: FnOnce(Option>) -> O, - D: TypeData + Clone, - D2: TypeData + Clone, - { - if let Some(type_id) = type_id { - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - if let Some(type_data) = type_registry.get_type_data::(type_id).cloned() { - drop(type_registry); - return Ok(map(Some(Either::Left(type_data)))); - } else if let Some(type_data) = type_registry.get_type_data::(type_id).cloned() { - drop(type_registry); - return Ok(map(Some(Either::Right(type_data)))); - } - } - - Ok(map(None)) - } - /// Converts the reference into an argument that can be consumed by a dynamic function. - /// + /// /// In the case that the underlying value is dynamic, this will convert to an [`ArgValue::Owned`] Which notably will not be directly usable by the function. /// To use the output you must make sure your calling mechanism is lenient enough to accept Owned variants in place of refs/muts. - /// + /// /// Or alternatively convert any non concrete types to concrete types using `from_reflect` before calling this function. - /// + /// /// # Safety /// - The caller must ensure this reference has permission to access the underlying value - pub unsafe fn into_arg_value<'w>(self, world: WorldGuard<'w>, arg_info: &ArgInfo) -> ScriptResult> { + pub unsafe fn into_arg_value<'w>( + self, + world: WorldGuard<'w>, + arg_info: &ArgInfo, + ) -> Result, InteropError> { if ReflectBase::World == self.base.base_id { // Safety: we already have an Arc> so creating a new one from the existing one is safe // as the caller of this function will make sure the Arc is dropped after the lifetime 'w is done. let new_guard = WorldCallbackAccess::from_guard(world.clone()); new_guard.read().unwrap(); - return Ok(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard(world)))); + return Ok(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard( + world, + )))); } match arg_info.ownership() { bevy::reflect::func::args::Ownership::Ref => { - - let mut ref_ = unsafe {self.reflect_unsafe(world.clone())?}; + let mut ref_ = unsafe { self.reflect_unsafe(world.clone())? }; if ref_.is_dynamic() { let allocator = world.allocator(); let mut allocator = allocator.write(); - - let boxed = ::from_reflect(ref_, world)?.into_partial_reflect(); - let (_, allocation) = allocator.allocate_boxed(boxed); + + let boxed = + ::from_reflect(ref_, world)? + .into_partial_reflect(); + let (_, allocation) = allocator.allocate_boxed(boxed); // Safety: // we are the only ones with this id, nobody else can touch this. // we only need to make sure this doesn't get dropped before we're done with it @@ -304,82 +305,72 @@ impl ReflectReference { ref_ = unsafe { &*allocation.get_ptr() }; } Ok(ArgValue::Ref(ref_)) - }, + } bevy::reflect::func::args::Ownership::Mut => { - - let mut mut_ = unsafe {self.reflect_mut_unsafe(world.clone())?}; + let mut mut_ = unsafe { self.reflect_mut_unsafe(world.clone())? }; if mut_.is_dynamic() { let allocator = world.allocator(); let mut allocator = allocator.write(); - - let boxed = ::from_reflect(mut_, world)?.into_partial_reflect(); - let (_, allocation) = allocator.allocate_boxed(boxed); + + let boxed = + ::from_reflect(mut_, world)? + .into_partial_reflect(); + let (_, allocation) = allocator.allocate_boxed(boxed); // Safety: // same as the ref branch mut_ = unsafe { &mut *allocation.get_ptr() }; } Ok(ArgValue::Mut(mut_)) - } _ => { - let ref_ = unsafe {self.reflect_unsafe(world.clone())?}; - Ok(ArgValue::Owned(::from_reflect(ref_, world)?.into_partial_reflect())) + let ref_ = unsafe { self.reflect_unsafe(world.clone())? }; + Ok(ArgValue::Owned( + ::from_reflect(ref_, world)? + .into_partial_reflect(), + )) } } - - } - /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell /// # Safety - /// + /// /// - The caller must ensure the cell has permission to access the underlying value /// - The caller must ensure no aliasing references to the same value exist at all at the same time - /// + /// /// To do this safely you need to use [`WorldAccessGuard::claim_read_access`] or [`WorldAccessGuard::claim_global_access`] to ensure nobody else is currently accessing the value. pub unsafe fn reflect_unsafe<'w>( &self, - world: WorldGuard<'w> - ) -> ScriptResult<&'w dyn PartialReflect> { - + world: WorldGuard<'w>, + ) -> Result<&'w dyn PartialReflect, InteropError> { if let ReflectBase::Owned(id) = &self.base.base_id { - let allocator = world.allocator(); let allocator = allocator.read(); - + let arc = allocator .get(id) - .ok_or_else(|| ScriptError::new_reflection_error("Missing allocation"))?; + .ok_or_else(|| InteropError::garbage_collected_allocation(self.clone()))?; // safety: caller promises it's fine :) return self.walk_path(unsafe { &*arc.get_ptr() }); } - let type_registry = world.type_registry(); let type_registry = type_registry.read(); - // all Reflect types should have this derived - let from_ptr_data: &ReflectFromPtr = - type_registry - .get_type_data(self.base.type_id) - .ok_or_else(|| ScriptError::new_reflection_error( - format!("FromPtr is not registered for {}", self.display_with_world(world.clone()))) - )?; + let from_ptr_data: &ReflectFromPtr = type_registry + .get_type_data(self.base.type_id) + .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; let ptr = self .base .base_id .clone() .into_ptr(world.as_unsafe_world_cell()) - .ok_or_else(|| - ScriptError::new_reflection_error( - format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_world(world))))?; - + .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; // (Ptr) Safety: we use the same type_id to both // 1) retrieve the ptr @@ -393,7 +384,6 @@ impl ReflectReference { ); let base = unsafe { from_ptr_data.as_reflect(ptr) }; - drop(type_registry); @@ -404,42 +394,37 @@ impl ReflectReference { /// # Safety /// - The caller must ensure the cell has permission to access the underlying value /// - The caller must ensure no other references to the same value exist at all at the same time (even if you have the correct access) - /// + /// /// To do this safely you need to use [`WorldAccessGuard::claim_write_access`] or [`WorldAccessGuard::claim_global_access`] to ensure nobody else is currently accessing the value. pub unsafe fn reflect_mut_unsafe<'w>( &self, - world: WorldGuard<'w> - ) -> ScriptResult<&'w mut dyn PartialReflect> { + world: WorldGuard<'w>, + ) -> Result<&'w mut dyn PartialReflect, InteropError> { if let ReflectBase::Owned(id) = &self.base.base_id { let allocator = world.allocator(); let allocator = allocator.read(); let arc = allocator .get_mut(id) - .ok_or_else(|| ScriptError::new_reflection_error("Missing allocation"))?; + .ok_or_else(|| InteropError::garbage_collected_allocation(self.clone()))?; // Safety: caller promises this is fine :) return self.walk_path_mut(unsafe { &mut *arc.get_ptr() }); }; - let type_registry = world.type_registry(); let type_registry = type_registry.read(); // all Reflect types should have this derived let from_ptr_data: &ReflectFromPtr = type_registry .get_type_data(self.base.type_id) - .ok_or_else(|| - ScriptError::new_reflection_error( - format!("Base reference is invalid, is the component/resource initialized? When accessing: `{}`", self.base.display_with_world(world.clone()))))?; + .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; let ptr = self - .base - .base_id - .clone() - .into_ptr_mut(world.as_unsafe_world_cell()) - .ok_or_else(|| - ScriptError::new_reflection_error( - format!("Base reference is invalid, is the component/resource initialized? does the entity exist?. When accessing: `{}`", self.base.display_with_world(world))))?; + .base + .base_id + .clone() + .into_ptr_mut(world.as_unsafe_world_cell()) + .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; // (Ptr) Safety: we use the same type_id to both // 1) retrieve the ptr @@ -456,15 +441,22 @@ impl ReflectReference { self.walk_path_mut(base.as_partial_reflect_mut()) } - fn walk_path<'a>(&self, root: &'a dyn PartialReflect) -> ScriptResult<&'a dyn PartialReflect> { - self.reflect_path.reflect_element(root).map_err(|e| ScriptError::new_reflection_error(e.to_string())) + fn walk_path<'a>( + &self, + root: &'a dyn PartialReflect, + ) -> Result<&'a dyn PartialReflect, InteropError> { + self.reflect_path + .reflect_element(root) + .map_err(|e| InteropError::reflection_path_error(e.to_string(), Some(self.clone()))) } fn walk_path_mut<'a>( &self, root: &'a mut dyn PartialReflect, - ) -> ScriptResult<&'a mut dyn PartialReflect> { - self.reflect_path.reflect_element_mut(root).map_err(|e| ScriptError::new_reflection_error(e.to_string())) + ) -> Result<&'a mut dyn PartialReflect, InteropError> { + self.reflect_path + .reflect_element_mut(root) + .map_err(|e| InteropError::reflection_path_error(e.to_string(), Some(self.clone()))) } } @@ -480,7 +472,7 @@ pub enum ReflectBase { Component(Entity, ComponentId), Resource(ComponentId), Owned(ReflectAllocationId), - World + World, } impl ReflectBase { @@ -524,18 +516,24 @@ impl ReflectBase { } fn map_key_to_concrete(key: &str, key_type_id: TypeId) -> Option> { - - match key_type_id { _ if key_type_id == std::any::TypeId::of::() => Some(Box::new(key.to_owned())), - _ if key_type_id == std::any::TypeId::of::() => key.parse::().ok().map(|u| Box::new(u) as Box), - _ if key_type_id == std::any::TypeId::of::() => key.parse::().ok().map(|f| Box::new(f) as Box), - _ if key_type_id == std::any::TypeId::of::() => key.parse::().ok().map(|b| Box::new(b) as Box), + _ if key_type_id == std::any::TypeId::of::() => key + .parse::() + .ok() + .map(|u| Box::new(u) as Box), + _ if key_type_id == std::any::TypeId::of::() => key + .parse::() + .ok() + .map(|f| Box::new(f) as Box), + _ if key_type_id == std::any::TypeId::of::() => key + .parse::() + .ok() + .map(|b| Box::new(b) as Box), _ => None, } } - pub trait ReflectionPathExt { fn convert_to_0_indexed(&mut self); @@ -545,9 +543,8 @@ pub trait ReflectionPathExt { } impl ReflectionPathExt for ParsedPath { - /// Assumes the accesses are 1 indexed and converts them to 0 indexed - fn convert_to_0_indexed(&mut self){ + fn convert_to_0_indexed(&mut self) { self.0.iter_mut().for_each(|a| match a.access { bevy::reflect::Access::FieldIndex(ref mut i) => *i -= 1, bevy::reflect::Access::TupleIndex(ref mut i) => *i -= 1, @@ -563,15 +560,13 @@ impl ReflectionPathExt for ParsedPath { fn iter(&self) -> impl Iterator { self.0.iter() } - } - /// A generic iterator over any reflected value. /// Unlike a normal iterator, this one does not have a halting condition, it will keep returning elements forever. /// The iterator does not try to access the value, it just works out the next index/key to access. /// You will know you've reached the end when you get an error when trying to access the next element. -#[derive(Debug,Clone)] +#[derive(Debug, Clone)] pub struct ReflectRefIter { pub(crate) base: ReflectReference, // TODO: support maps etc @@ -585,7 +580,10 @@ pub enum IterationKey { impl ReflectRefIter { pub fn new_indexed(base: ReflectReference) -> Self { - Self { base, index: IterationKey::Index(0) } + Self { + base, + index: IterationKey::Index(0), + } } pub fn index(&self) -> IterationKey { @@ -598,7 +596,8 @@ impl ReflectRefIter { let next = match &mut self.index { IterationKey::Index(i) => { let mut next = self.base.clone(); - let parsed_path = ParsedPath::parse(&format!("[{}]", *i)).expect("invariant violated"); + let parsed_path = + ParsedPath::parse(&format!("[{}]", *i)).expect("invariant violated"); next.index_path(parsed_path); *i += 1; next @@ -609,7 +608,7 @@ impl ReflectRefIter { } impl Iterator for ReflectRefIter { - type Item = Result; + type Item = Result; fn next(&mut self) -> Option { let result: Result<_, _> = { diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs index 40f1ee6523..d19902d882 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -11,7 +11,7 @@ use bevy::reflect::{ }; use crate::{ - error::{ScriptError, ScriptResult, ValueConversionError}, + error::{InteropError, ScriptError, ScriptResult}, reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, }; @@ -22,17 +22,100 @@ use super::{pretty_print::DisplayWithWorld, ReflectReference, WorldGuard}; #[derive(Debug, Clone, PartialEq, Reflect)] #[reflect(opaque)] pub enum ScriptValue { + /// Represents the absence of a value. Unit, + /// Represents a boolean value. Bool(bool), + /// Represents an integer value with at most 64 bits. Integer(i64), + /// Represents a floating point value with at most 64 bits. Float(f64), + /// Represents a string value. String(Cow<'static, str>), + /// Represents a reference to a value. Reference(ReflectReference), + /// Represents any error, will be thrown when returned to a script + Error(ScriptError), + /// A placeholder for a [`crate::bindings::WorldCallbackAccess`] value. World, } +// impl Into for ScriptResult<> + +impl From for ScriptValue { + fn from(value: bool) -> Self { + ScriptValue::Bool(value) + } +} + +impl From for ScriptValue { + fn from(value: i64) -> Self { + ScriptValue::Integer(value) + } +} + +impl From for ScriptValue { + fn from(value: f64) -> Self { + ScriptValue::Float(value) + } +} + +impl From<&'static str> for ScriptValue { + fn from(value: &'static str) -> Self { + ScriptValue::String(value.into()) + } +} + +impl From for ScriptValue { + fn from(value: String) -> Self { + ScriptValue::String(value.into()) + } +} + +impl From> for ScriptValue { + fn from(value: Cow<'static, str>) -> Self { + ScriptValue::String(value) + } +} + +impl From for ScriptValue { + fn from(value: ReflectReference) -> Self { + ScriptValue::Reference(value) + } +} + +impl From for ScriptValue { + fn from(value: ScriptError) -> Self { + ScriptValue::Error(value) + } +} + +impl From for ScriptValue { + fn from(value: InteropError) -> Self { + ScriptValue::Error(ScriptError::new(value)) + } +} + +impl> From> for ScriptValue { + fn from(value: Option) -> Self { + match value { + Some(v) => v.into(), + None => ScriptValue::Unit, + } + } +} + +impl, E: Into> From> for ScriptValue { + fn from(value: Result) -> Self { + match value { + Ok(v) => v.into(), + Err(e) => ScriptValue::Error(e.into()), + } + } +} + impl TryFrom for ParsedPath { - type Error = ScriptError; + type Error = InteropError; fn try_from(value: ScriptValue) -> Result { Ok(match value { ScriptValue::Integer(i) => ParsedPath::from(vec![OffsetAccess { @@ -40,11 +123,11 @@ impl TryFrom for ParsedPath { offset: Some(1), }]), ScriptValue::Float(v) => { - return Err(ValueConversionError::InvalidIndex { - index: v.to_string().into(), - base: None, - reason: Some("floating point numbers cannot be used as indices".into()), - })? + return Err(InteropError::invalid_index( + value, + "Floating point numbers cannot be used to index into reflected values" + .to_owned(), + )) } ScriptValue::String(cow) => { if let Some(tuple_struct_index) = cow.strip_prefix("_") { @@ -58,28 +141,17 @@ impl TryFrom for ParsedPath { } match cow { - Cow::Borrowed(v) => ParsedPath::parse_static(v).map_err(|e| { - ValueConversionError::InvalidIndex { - index: v.into(), - base: None, - reason: Some(e.to_string().into()), - } - })?, - Cow::Owned(o) => { - ParsedPath::parse(&o).map_err(|e| ValueConversionError::InvalidIndex { - index: o.clone().into(), - base: None, - reason: Some(e.to_string().into()), - })? - } + Cow::Borrowed(v) => ParsedPath::parse_static(v) + .map_err(|e| InteropError::reflection_path_error(e.to_string(), None))?, + Cow::Owned(o) => ParsedPath::parse(&o) + .map_err(|e| InteropError::reflection_path_error(e.to_string(), None))?, } } ScriptValue::Reference(reflect_reference) => { - return Err(ValueConversionError::InvalidIndex { - index: format!("{:?}", reflect_reference).into(), - base: None, - reason: Some("References cannot be used as indices".into()), - })? + return Err(InteropError::invalid_index( + ScriptValue::Reference(reflect_reference), + "References cannot be used to index into reflected values".to_owned(), + )) } _ => ParsedPath(vec![]), }) @@ -88,7 +160,7 @@ impl TryFrom for ParsedPath { /// A trait for converting a value into a [`ScriptVal`]. pub trait IntoScriptValue { - fn into_script_value(self, world: WorldGuard) -> ScriptResult; + fn into_script_value(self, world: WorldGuard) -> Result; } /// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. @@ -99,31 +171,26 @@ pub trait FromScriptValue { value: ScriptValue, world: WorldGuard, target_type_id: TypeId, - ) -> Option>>; + ) -> Option, InteropError>>; } macro_rules! into_script_value_downcast { ($self_:ident, $ty:ty, $world:ident $(, $($exp:tt)*)?) => {{ $self_ .try_downcast_ref::<$ty>() - .ok_or_else(|| ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(stringify!($ty).into()), - actual_type: Some( - $self_ + .ok_or_else(|| InteropError::type_mismatch( + std::any::TypeId::of::<$ty>(), + $self_ .get_represented_type_info() - .map(|ti| ti.type_id()) - .type_id_or_fake_id() - .display_with_world($world.clone()) - .into(), - ), - })? + .map(|ti| ti.type_id()), + ))? $($($exp)*)? .into_script_value($world.clone()) }}; } impl IntoScriptValue for &dyn PartialReflect { - fn into_script_value(self, world: WorldGuard) -> ScriptResult { + fn into_script_value(self, world: WorldGuard) -> Result { let target_type_id = self .get_represented_type_info() .map(|ti| ti.type_id()) @@ -135,17 +202,10 @@ impl IntoScriptValue for &dyn PartialReflect { match self.try_downcast_ref::() { Some(script_val) => return Ok(script_val.clone()), None => { - return Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned("ScriptValue".into()), - actual_type: Some( - self.get_represented_type_info() - .map(|ti| ti.type_id()) - .type_id_or_fake_id() - .display_with_world(world.clone()) - .into(), - ), - } - .into()) + return Err(InteropError::type_mismatch( + TypeId::of::(), + Some(target_type_id), + )) } } } @@ -248,7 +308,7 @@ impl IntoScriptValue for &dyn PartialReflect { } impl IntoScriptValue for Option<&dyn PartialReflect> { - fn into_script_value(self, world: WorldGuard) -> ScriptResult { + fn into_script_value(self, world: WorldGuard) -> Result { match self { Some(inner) => inner.into_script_value(world), None => Ok(ScriptValue::Unit), @@ -257,7 +317,7 @@ impl IntoScriptValue for Option<&dyn PartialReflect> { } impl IntoScriptValue for ReflectReference { - fn into_script_value(self, _world: WorldGuard) -> ScriptResult { + fn into_script_value(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Reference(self)) } } @@ -269,7 +329,7 @@ impl FromScriptValue for dyn PartialReflect { value: ScriptValue, world: WorldGuard, target_type_id: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { match target_type_id { // TODO: if these types ever support reflect, we can uncomment these lines // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script @@ -369,7 +429,7 @@ impl FromScriptValue for Option<&dyn PartialReflect> { value: ScriptValue, world: WorldGuard, target_type_id: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { let type_registry = world.type_registry(); let type_registry = type_registry.read(); let type_info = type_registry.get_type_info(target_type_id)?; @@ -413,7 +473,7 @@ impl FromScriptValue for ReflectReference { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { match value { ScriptValue::Reference(ref_) => Some(ref_.clone_value(world)), _ => None, @@ -422,43 +482,43 @@ impl FromScriptValue for ReflectReference { } impl IntoScriptValue for () { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::Unit) } } impl IntoScriptValue for &'static str { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.into())) } } impl IntoScriptValue for &'static CStr { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.to_string_lossy())) } } impl IntoScriptValue for &'static OsStr { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.to_string_lossy())) } } impl IntoScriptValue for &'static Path { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.to_string_lossy())) } } impl IntoScriptValue for Cow<'static, str> { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.into_owned().into())) } } impl IntoScriptValue for Cow<'static, CStr> { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String( self.to_string_lossy().into_owned().into(), )) @@ -466,19 +526,19 @@ impl IntoScriptValue for Cow<'static, CStr> { } impl IntoScriptValue for bool { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::Bool(self)) } } impl IntoScriptValue for f32 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::Float(self as f64)) } } impl IntoScriptValue for f64 { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::Float(self)) } } @@ -487,7 +547,7 @@ macro_rules! into_script_value_integers { ($($ty:ty),*) => { $( impl IntoScriptValue for $ty { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::Integer(self as i64)) } } @@ -498,13 +558,13 @@ macro_rules! into_script_value_integers { into_script_value_integers!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize); impl IntoScriptValue for Box { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.to_string().into())) } } impl IntoScriptValue for CString { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String( self.to_string_lossy().into_owned().into(), )) @@ -512,13 +572,13 @@ impl IntoScriptValue for CString { } impl IntoScriptValue for String { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String(self.into())) } } impl IntoScriptValue for OsString { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String( self.to_string_lossy().into_owned().into(), )) @@ -526,7 +586,7 @@ impl IntoScriptValue for OsString { } impl IntoScriptValue for PathBuf { - fn into_script_value(self, _: WorldGuard) -> ScriptResult { + fn into_script_value(self, _: WorldGuard) -> Result { Ok(ScriptValue::String( self.to_string_lossy().into_owned().into(), )) @@ -538,19 +598,14 @@ impl FromScriptValue for () { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::<()>() { Some(match value { ScriptValue::Unit => Ok(Box::new(())), ScriptValue::Reference(ref_) => ref_ .downcast::<()>(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)), }) } else { None @@ -563,19 +618,14 @@ impl FromScriptValue for bool { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::() { Some(match value { ScriptValue::Bool(v) => Ok(Box::new(v)), ScriptValue::Reference(ref_) => ref_ .downcast::(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)), }) } else { None @@ -588,19 +638,14 @@ impl FromScriptValue for &'static str { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::<&'static str>() { Some(match value { ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(s)), ScriptValue::Reference(ref_) => ref_ .downcast::<&'static str>(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), }) } else { None @@ -613,19 +658,14 @@ impl FromScriptValue for Cow<'static, str> { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::>() { Some(match value { ScriptValue::String(s) => Ok(Box::new(s)), ScriptValue::Reference(ref_) => ref_ .downcast::>(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), }) } else { None @@ -638,19 +678,14 @@ impl FromScriptValue for String { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::() { Some(match value { ScriptValue::String(s) => Ok(Box::new(s.into_owned())), ScriptValue::Reference(ref_) => ref_ .downcast::(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), }) } else { None @@ -663,20 +698,15 @@ impl FromScriptValue for f32 { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::() { Some(match value { ScriptValue::Float(v) => Ok(Box::new(v as f32)), ScriptValue::Integer(v) => Ok(Box::new(v as f32)), ScriptValue::Reference(ref_) => ref_ .downcast::(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), }) } else { None @@ -689,20 +719,15 @@ impl FromScriptValue for f64 { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::() { Some(match value { ScriptValue::Float(v) => Ok(Box::new(v)), ScriptValue::Integer(v) => Ok(Box::new(v as f64)), ScriptValue::Reference(ref_) => ref_ .downcast::(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), }) } else { None @@ -719,20 +744,18 @@ macro_rules! impl_from_script_value_integer { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::<$t>() { Some(match value { ScriptValue::Integer(v) => Ok(Box::new(v as $t)), ScriptValue::Float(v) => Ok(Box::new(v as $t)), ScriptValue::Reference(ref_) => ref_ .downcast::<$t>(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch( + target_type, + value, + )), }) } else { None @@ -751,15 +774,11 @@ impl FromScriptValue for &'static Path { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::<&'static Path>() { Some(match value { ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(Path::new(s))), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + _ => Err(InteropError::value_mismatch(target_type, value)), }) } else { None @@ -772,19 +791,14 @@ impl FromScriptValue for PathBuf { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::() { Some(match value { ScriptValue::String(s) => Ok(Box::new(PathBuf::from(s.into_owned()))), ScriptValue::Reference(ref_) => ref_ .downcast::(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)), }) } else { None @@ -803,14 +817,14 @@ impl FromScriptValue for PathBuf { // if target_type == TypeId::of::>() { // match value { // ScriptValue::String(s) => Ok(Box::new(s.into_owned().into_boxed_str())), -// _ => Err(ValueConversionError::TypeMismatch { +// _ => Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Owned(value.display_with_world(world))), // } // .into()), // } // } else { -// Err(ValueConversionError::TypeMismatch { +// Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Borrowed(type_name::>())), // } @@ -830,20 +844,20 @@ impl FromScriptValue for PathBuf { // ScriptValue::String(s) => CString::new(s.into_owned()) // .map(|cstr| Box::new(cstr) as Box) // .map_err(|e| { -// ValueConversionError::TypeMismatch { +// InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Owned(e.to_string())), // } // .into() // }), -// _ => Err(ValueConversionError::TypeMismatch { +// _ => Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Owned(value.display_with_world(world))), // } // .into()), // } // } else { -// Err(ValueConversionError::TypeMismatch { +// Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Borrowed(type_name::())), // } @@ -857,19 +871,14 @@ impl FromScriptValue for OsString { value: ScriptValue, world: WorldGuard, target_type: TypeId, - ) -> Option>> { + ) -> Option, InteropError>> { if target_type == TypeId::of::() { Some(match value { ScriptValue::String(s) => Ok(Box::new(OsString::from(s.into_owned()))), ScriptValue::Reference(ref_) => ref_ .downcast::(world) - .map(|v| Box::new(v) as Box) - .map_err(Into::into), - _ => Err(ValueConversionError::TypeMismatch { - expected_type: Cow::Owned(target_type.display_with_world(world.clone())), - actual_type: Some(Cow::Owned(value.display_with_world(world))), - } - .into()), + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), }) } else { None @@ -886,14 +895,14 @@ impl FromScriptValue for OsString { // if target_type == TypeId::of::<&'static OsStr>() { // match value { // ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(OsStr::new(s))), -// _ => Err(ValueConversionError::TypeMismatch { +// _ => Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Owned(value.display_with_world(world))), // } // .into()), // } // } else { -// Err(ValueConversionError::TypeMismatch { +// Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Borrowed(type_name::<&'static OsStr>())), // } @@ -915,21 +924,21 @@ impl FromScriptValue for OsString { // CStr::from_bytes_with_nul(bytes) // .map(|cstr| Box::new(cstr) as Box) // .map_err(|e| { -// ValueConversionError::TypeMismatch { +// InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Owned(e.to_string())), // } // .into() // }) // } -// _ => Err(ValueConversionError::TypeMismatch { +// _ => Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Owned(value.display_with_world(world))), // } // .into()), // } // } else { -// Err(ValueConversionError::TypeMismatch { +// Err(InteropError::TypeMismatch { // expected_type: Cow::Owned(target_type.display_with_world(world)), // actual_type: Some(Cow::Borrowed(type_name::<&'static CStr>())), // } @@ -1051,47 +1060,67 @@ mod test { let world = WorldGuard::new(world); assert_eq!( - usize_reference.clone().into_script_value(world.clone()), - Ok(ScriptValue::Integer(2)) + usize_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Integer(2) ); assert_eq!( - string_reference.clone().into_script_value(world.clone()), - Ok(ScriptValue::String("hello".into())) + string_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::String("hello".into()) ); assert_eq!( - option_reference.clone().into_script_value(world.clone()), - Ok(ScriptValue::Integer(2)) + option_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Integer(2) ); assert_eq!( - none_reference.clone().into_script_value(world.clone()), - Ok(ScriptValue::Unit) + none_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Unit ); assert_eq!( nested_option_reference .clone() - .into_script_value(world.clone()), - Ok(ScriptValue::Integer(2)) + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Integer(2) ); assert_eq!( nested_none_reference .clone() - .into_script_value(world.clone()), - Ok(ScriptValue::Unit) + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Unit ); assert_eq!( - vec_reference.clone().into_script_value(world.clone()), - Ok(ScriptValue::Reference(vec_reference)) + vec_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Reference(vec_reference) ); assert_eq!( - map_reference.clone().into_script_value(world.clone()), - Ok(ScriptValue::Reference(map_reference)) + map_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Reference(map_reference) ); } diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 2e0787104d..858829ed9e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -39,6 +39,7 @@ use smallvec::SmallVec; use crate::{ bindings::ReflectAllocationId, + error::InteropError, prelude::{ReflectAllocator, ScriptError, ScriptResult}, reflection_extensions::TypeIdExtensions, with_access_read, with_access_write, with_global_access, @@ -74,9 +75,8 @@ impl WorldCallbackAccess { ) -> T { // - the world cannot be dropped before the world drops since we have mutable reference to it in this entire function // - nothing can alias inappropriately WorldAccessGuard since it's only instance is behind the raw Arc - let world_guard = Arc::new(WorldAccessGuard::new(world)); - let world_guard = unsafe { WorldCallbackAccess::new(Arc::downgrade(&world_guard)) }; - + let world_guard_arc = Arc::new(WorldAccessGuard::new(world)); + let world_guard = unsafe { WorldCallbackAccess::new(Arc::downgrade(&world_guard_arc)) }; callback(&world_guard) } @@ -135,7 +135,7 @@ impl WorldCallbackAccess { &self, entity: Entity, registration: ScriptTypeRegistration, - ) -> ScriptResult<()> { + ) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.add_default_component(entity, registration) } @@ -144,12 +144,16 @@ impl WorldCallbackAccess { &self, entity: Entity, component_id: ComponentId, - ) -> ScriptResult> { + ) -> Result, InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.get_component(entity, component_id) } - pub fn has_component(&self, entity: Entity, component_id: ComponentId) -> ScriptResult { + pub fn has_component( + &self, + entity: Entity, + component_id: ComponentId, + ) -> Result { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.has_component(entity, component_id) } @@ -158,17 +162,23 @@ impl WorldCallbackAccess { &self, entity: Entity, registration: ScriptTypeRegistration, - ) -> ScriptResult<()> { + ) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.remove_component(entity, registration) } - pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult> { + pub fn get_resource( + &self, + resource_id: ComponentId, + ) -> Result, InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.get_resource(resource_id) } - pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { + pub fn remove_resource( + &self, + registration: ScriptTypeRegistration, + ) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.remove_resource(registration) } @@ -183,22 +193,22 @@ impl WorldCallbackAccess { world.has_entity(entity) } - pub fn get_children(&self, entity: Entity) -> ScriptResult> { + pub fn get_children(&self, entity: Entity) -> Result, InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.get_children(entity) } - pub fn get_parent(&self, entity: Entity) -> ScriptResult> { + pub fn get_parent(&self, entity: Entity) -> Result, InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.get_parent(entity) } - pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + pub fn push_children(&self, parent: Entity, children: &[Entity]) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.push_children(parent, children) } - pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.remove_children(parent, children) } @@ -208,22 +218,22 @@ impl WorldCallbackAccess { parent: Entity, index: usize, children: &[Entity], - ) -> ScriptResult<()> { + ) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.insert_children(parent, index, children) } - pub fn despawn_recursive(&self, entity: Entity) -> ScriptResult<()> { + pub fn despawn_recursive(&self, entity: Entity) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.despawn_recursive(entity) } - pub fn despawn(&self, entity: Entity) -> ScriptResult<()> { + pub fn despawn(&self, entity: Entity) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.despawn(entity) } - pub fn despawn_descendants(&self, entity: Entity) -> ScriptResult<()> { + pub fn despawn_descendants(&self, entity: Entity) -> Result<(), InteropError> { let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); world.despawn_descendants(entity) } @@ -628,11 +638,16 @@ impl<'w> WorldAccessGuard<'w> { &self, entity: Entity, registration: ScriptTypeRegistration, - ) -> ScriptResult<()> { - let component_data = registration.registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( - "Cannot add default component since type: `{}`, Does not have ReflectComponent data registered.", - registration.registration.type_info().type_path() - )))?; + ) -> Result<(), InteropError> { + let component_data = registration + .registration + .data::() + .ok_or_else(|| { + InteropError::missing_type_data( + registration.registration.type_id(), + "ReflectComponent".to_owned(), + ) + })?; // we look for ReflectDefault or ReflectFromWorld data then a ReflectComponent data let instance = if let Some(default_td) = registration.registration.data::() @@ -644,10 +659,10 @@ impl<'w> WorldAccessGuard<'w> { from_world_td.from_world(world) }) } else { - return Err(ScriptError::new_runtime_error(format!( - "Cannot add default component since type: `{}`, Does not have ReflectDefault or ReflectFromWorld data registered.", - registration.registration.type_info().type_path() - ))); + return Err(InteropError::missing_type_data( + registration.registration.type_id(), + "ReflectDefault or ReflectFromWorld".to_owned(), + )); }; // TODO: this shouldn't need entire world access it feels @@ -655,12 +670,9 @@ impl<'w> WorldAccessGuard<'w> { let type_registry = self.type_registry(); let world = unsafe { self.0.cell.world_mut() }; - let mut entity = world.get_entity_mut(entity).map_err(|e| { - ScriptError::new_runtime_error(format!( - "Could not retrieve entity: {:?}. {e}", - entity - )) - })?; + let mut entity = world + .get_entity_mut(entity) + .map_err(|e| InteropError::missing_entity(entity))?; { let registry = type_registry.read(); component_data.insert(&mut entity, instance.as_partial_reflect(), ®istry); @@ -673,22 +685,19 @@ impl<'w> WorldAccessGuard<'w> { &self, entity: Entity, component_id: ComponentId, - ) -> ScriptResult> { - let entity = self.0.cell.get_entity(entity).ok_or_else(|| { - ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) - })?; + ) -> Result, InteropError> { + let entity = self + .0 + .cell + .get_entity(entity) + .ok_or_else(|| InteropError::missing_entity(entity))?; let component_info = self .0 .cell .components() .get_info(component_id) - .ok_or_else(|| { - ScriptError::new_runtime_error(format!( - "Component does not exist: {:?}", - component_id - )) - })?; + .ok_or_else(|| InteropError::invalid_component(component_id))?; if entity.contains_id(component_id) { Ok(Some(ReflectReference { @@ -705,10 +714,16 @@ impl<'w> WorldAccessGuard<'w> { } } - pub fn has_component(&self, entity: Entity, component_id: ComponentId) -> ScriptResult { - let entity = self.0.cell.get_entity(entity).ok_or_else(|| { - ScriptError::new_runtime_error(format!("Entity does not exist: {:?}", entity)) - })?; + pub fn has_component( + &self, + entity: Entity, + component_id: ComponentId, + ) -> Result { + let entity = self + .0 + .cell + .get_entity(entity) + .ok_or_else(|| InteropError::missing_entity(entity))?; Ok(entity.contains_id(component_id)) } @@ -717,28 +732,32 @@ impl<'w> WorldAccessGuard<'w> { &self, entity: Entity, registration: ScriptTypeRegistration, - ) -> ScriptResult<()> { - let component_data = registration.registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( - "Cannot remove component since type: `{}`, Does not have ReflectComponent data registered.", - registration.registration.type_info().type_path() - )))?; + ) -> Result<(), InteropError> { + let component_data = registration + .registration + .data::() + .ok_or_else(|| { + InteropError::missing_type_data( + registration.registration.type_id(), + "ReflectComponent".to_owned(), + ) + })?; // TODO: this shouldn't need entire world access it feels with_global_access!(self.0.accesses, "Could not remove component", { let world = unsafe { self.0.cell.world_mut() }; - let mut entity = world.get_entity_mut(entity).map_err(|e| { - ScriptError::new_runtime_error(format!( - "Could not retrieve entity: {:?}. {e}", - entity - )) - })?; - + let mut entity = world + .get_entity_mut(entity) + .map_err(|e| InteropError::missing_entity(entity))?; component_data.remove(&mut entity); Ok(()) }) } - pub fn get_resource(&self, resource_id: ComponentId) -> ScriptResult> { + pub fn get_resource( + &self, + resource_id: ComponentId, + ) -> Result, InteropError> { let component_info = match self.0.cell.components().get_info(resource_id) { Some(info) => info, None => return Ok(None), @@ -755,11 +774,19 @@ impl<'w> WorldAccessGuard<'w> { })) } - pub fn remove_resource(&self, registration: ScriptTypeRegistration) -> ScriptResult<()> { - let component_data = registration.registration.data::().ok_or_else(|| ScriptError::new_runtime_error(format!( - "Cannot remove resource since type: `{}`, Does not have ReflectResource data registered.", - registration.registration.type_info().type_path() - )))?; + pub fn remove_resource( + &self, + registration: ScriptTypeRegistration, + ) -> Result<(), InteropError> { + let component_data = registration + .registration + .data::() + .ok_or_else(|| { + InteropError::missing_type_data( + registration.registration.type_id(), + "ReflectResource".to_owned(), + ) + })?; // TODO: this shouldn't need entire world access it feels with_global_access!(self.0.accesses, "Could not remove resource", { @@ -779,12 +806,9 @@ impl<'w> WorldAccessGuard<'w> { self.is_valid_entity(entity) } - pub fn get_children(&self, entity: Entity) -> ScriptResult> { + pub fn get_children(&self, entity: Entity) -> Result, InteropError> { if !self.is_valid_entity(entity) { - return Err(ScriptError::new_runtime_error(format!( - "Entity does not exist or is not valid: {:?}", - entity - ))); + return Err(InteropError::missing_entity(entity)); } self.with_component(entity, |c: Option<&Children>| { @@ -792,31 +816,22 @@ impl<'w> WorldAccessGuard<'w> { }) } - pub fn get_parent(&self, entity: Entity) -> ScriptResult> { + pub fn get_parent(&self, entity: Entity) -> Result, InteropError> { if !self.is_valid_entity(entity) { - return Err(ScriptError::new_runtime_error(format!( - "Entity does not exist or is not valid: {:?}", - entity - ))); + return Err(InteropError::missing_entity(entity)); } self.with_component(entity, |c: Option<&Parent>| Ok(c.map(|c| c.get()))) } - pub fn push_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + pub fn push_children(&self, parent: Entity, children: &[Entity]) -> Result<(), InteropError> { // verify entities exist if !self.is_valid_entity(parent) { - return Err(ScriptError::new_runtime_error(format!( - "The parent Entity does not exist or is not valid: {:?}", - parent - ))); + return Err(InteropError::missing_entity(parent)); } for c in children { if !self.is_valid_entity(*c) { - return Err(ScriptError::new_runtime_error(format!( - "the Entity does not exist or is not valid: {:?}", - c - ))); + return Err(InteropError::missing_entity(*c)); } } @@ -831,20 +846,14 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> ScriptResult<()> { + pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> Result<(), InteropError> { if !self.is_valid_entity(parent) { - return Err(ScriptError::new_runtime_error(format!( - "The parent Entity does not exist or is not valid: {:?}", - parent - ))); + return Err(InteropError::missing_entity(parent)); } for c in children { if !self.is_valid_entity(*c) { - return Err(ScriptError::new_runtime_error(format!( - "the Entity does not exist or is not valid: {:?}", - c - ))); + return Err(InteropError::missing_entity(*c)); } } @@ -864,20 +873,14 @@ impl<'w> WorldAccessGuard<'w> { parent: Entity, index: usize, children: &[Entity], - ) -> ScriptResult<()> { + ) -> Result<(), InteropError> { if !self.is_valid_entity(parent) { - return Err(ScriptError::new_runtime_error(format!( - "parent Entity does not exist or is not valid: {:?}", - parent - ))); + return Err(InteropError::missing_entity(parent)); } for c in children { if !self.is_valid_entity(*c) { - return Err(ScriptError::new_runtime_error(format!( - "the Entity does not exist or is not valid: {:?}", - c - ))); + return Err(InteropError::missing_entity(*c)); } } @@ -892,12 +895,9 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn despawn_recursive(&self, parent: Entity) -> ScriptResult<()> { + pub fn despawn_recursive(&self, parent: Entity) -> Result<(), InteropError> { if !self.is_valid_entity(parent) { - return Err(ScriptError::new_runtime_error(format!( - "parent Entity does not exist or is not valid: {:?}", - parent - ))); + return Err(InteropError::missing_entity(parent)); } with_global_access!(self.0.accesses, "Could not despawn entity", { @@ -911,12 +911,9 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn despawn(&self, entity: Entity) -> ScriptResult<()> { + pub fn despawn(&self, entity: Entity) -> Result<(), InteropError> { if !self.is_valid_entity(entity) { - return Err(ScriptError::new_runtime_error(format!( - "Entity does not exist or is not valid: {:?}", - entity - ))); + return Err(InteropError::missing_entity(entity)); } with_global_access!(self.0.accesses, "Could not despawn entity", { @@ -930,12 +927,9 @@ impl<'w> WorldAccessGuard<'w> { Ok(()) } - pub fn despawn_descendants(&self, parent: Entity) -> ScriptResult<()> { + pub fn despawn_descendants(&self, parent: Entity) -> Result<(), InteropError> { if !self.is_valid_entity(parent) { - return Err(ScriptError::new_runtime_error(format!( - "parent Entity does not exist or is not valid: {:?}", - parent - ))); + return Err(InteropError::missing_entity(parent)); } with_global_access!(self.0.accesses, "Could not despawn descendants", { diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index 2c5367b403..ccee1f8a3b 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -116,7 +116,7 @@ impl Command for CreateOrUpdateScript { match ctxt { Ok(ctxt) => contexts.insert(ctxt), Err(e) => { - handle_script_errors(world, &format!("Failed to load context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()), [e]); + handle_script_errors(world, &format!("Failed to load context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()), [e].into_iter()); return; } } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index b9f7b6d218..0b54a1bf6e 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -1,41 +1,32 @@ use std::{ any::TypeId, borrow::Cow, + fmt::{Debug, Display}, ops::{Deref, DerefMut}, sync::Arc, }; -use bevy::reflect::{ApplyError, Reflect}; +use bevy::{ + ecs::component::ComponentId, + prelude::Entity, + reflect::{ + func::{args::ArgInfo, FunctionError, FunctionInfo}, + ApplyError, PartialReflect, Reflect, ReflectPathError, + }, +}; use thiserror::Error; -use crate::{bindings::ReflectAllocationId, bindings::ReflectReference}; +use crate::{ + bindings::{ + pretty_print::DisplayWithWorld, ReflectAllocationId, ReflectBase, ReflectBaseType, + ReflectReference, + }, + impl_dummy_display, + prelude::ScriptValue, +}; pub type ScriptResult = Result; -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub enum ScriptErrorKind { - /// Any other error, default for script errors generated via Into conversions - Other, - /// Errors specifically to do with reflecting & reading/writing stuff from the world - ReflectionError, - /// Erorrs to do with invalid script API usage, invalid arguments etc. - RuntimeError, - /// Errors to do with the script lifecycle, loading, unloading etc. - Lifecycle, -} - -impl std::fmt::Display for ScriptErrorKind { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - ScriptErrorKind::ReflectionError => f.write_str("Reflection Error"), - ScriptErrorKind::Lifecycle => f.write_str("Script Lifecycle Error"), - ScriptErrorKind::Other => f.write_str("Error"), - ScriptErrorKind::RuntimeError => f.write_str("Runtime Error"), - }; - Ok(()) - } -} - #[derive(Error, Debug)] pub struct ScriptErrorWrapper(ScriptError); @@ -67,56 +58,80 @@ impl Deref for ScriptError { #[derive(Debug)] pub struct ScriptErrorInner { pub script: Option, - pub kind: ScriptErrorKind, pub context: String, - pub reason: Arc, + pub reason: ErrorKind, +} + +#[derive(Debug, Clone)] +pub enum ErrorKind { + Display(Arc), + WithWorld(Arc), +} + +impl DisplayWithWorld for ErrorKind { + fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { + match self { + ErrorKind::Display(e) => e.to_string(), + ErrorKind::WithWorld(e) => e.display_with_world(world), + } + } +} + +impl Display for ErrorKind { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ErrorKind::Display(e) => write!(f, "{}", e), + ErrorKind::WithWorld(e) => write!(f, "{:?}", e), + } + } } impl PartialEq for ScriptErrorInner { fn eq(&self, other: &Self) -> bool { - self.kind == other.kind - && self.context == other.context - && self.reason.to_string() == other.reason.to_string() + self.context == other.context } } -impl ScriptError { - pub fn new_reflection_error>>( - reason: E, - ) -> Self { - Self(Arc::new(ScriptErrorInner { - script: None, - kind: ScriptErrorKind::ReflectionError, - reason: Arc::from(reason.into()), - context: Default::default(), - })) - } +// impl From for ErrorKind { +// fn from(value: T) -> Self { +// ErrorKind::Display(Arc::new(value)) +// } +// } - pub fn new_generic_error>>(reason: E) -> Self { - Self(Arc::new(ScriptErrorInner { - script: None, - kind: ScriptErrorKind::Other, - reason: Arc::from(reason.into()), - context: Default::default(), - })) +// impl From for ErrorKind { +// fn from(val: Box) -> Self { +// ErrorKind::WithWorld(Arc::from(val)) +// } +// } + +impl ScriptError { + #[cfg(feature = "mlua_impls")] + /// Destructures mlua error into a script error, taking care to preserve as much information as possible + pub fn from_mlua_error(error: mlua::Error) -> Self { + match error { + mlua::Error::ExternalError(inner) => { + if let Some(script_error) = inner.downcast_ref::() { + Self::new(script_error.clone()) + } else { + Self::new_external(inner) + } + } + e => Self::new_external(e), + } } - pub fn new_lifecycle_error>>( - reason: E, - ) -> Self { + pub fn new_external(reason: impl std::error::Error + Send + Sync + 'static) -> Self { Self(Arc::new(ScriptErrorInner { script: None, - kind: ScriptErrorKind::Lifecycle, - reason: Arc::from(reason.into()), + reason: ErrorKind::Display(Arc::new(reason)), context: Default::default(), })) } - pub fn new_runtime_error>>(reason: E) -> Self { + pub fn new(reason: impl DisplayWithWorld + Send + Sync + 'static) -> Self { Self(Arc::new(ScriptErrorInner { script: None, - kind: ScriptErrorKind::RuntimeError, - reason: Arc::from(reason.into()), + reason: ErrorKind::WithWorld(Arc::new(reason)), context: Default::default(), })) } @@ -124,7 +139,6 @@ impl ScriptError { pub fn with_context(self, context: S) -> Self { Self(Arc::new(ScriptErrorInner { script: self.0.script.clone(), - kind: self.0.kind, context: context.to_string(), reason: self.0.reason.clone(), })) @@ -133,29 +147,46 @@ impl ScriptError { pub fn with_appended_context(self, context: S) -> Self { Self(Arc::new(ScriptErrorInner { script: self.0.script.clone(), - kind: self.0.kind, context: format!("{}. {}", self.0.context, context.to_string()), reason: self.0.reason.clone(), })) } } -impl From for ScriptError { - fn from(value: T) -> Self { - Self::new_generic_error(value) - } -} +// impl From for ScriptError { +// fn from(value: T) -> Self { +// let error_kind = ErrorKind::from(value); +// Self::new_external(error_kind) +// } +// } + +// impl From for ScriptError { +// fn from(value: T) -> Self { +// let error_kind = ErrorKind::WithWorld(Arc::new(value)); +// Self::new_error(error_kind) +// } +// } impl std::fmt::Display for ScriptError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if let Some(script) = &self.0.script { - write!( - f, - "{} in script `{}`: {}", - self.0.kind, script, self.0.reason + write!(f, "error in script `{}`: {}", script, self.0.reason) + } else { + write!(f, "error: {}", self.0.reason) + } + } +} + +impl DisplayWithWorld for ScriptError { + fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { + if let Some(script) = &self.0.script { + format!( + "error in script `{}`: {}", + script, + self.0.reason.display_with_world(world) ) } else { - write!(f, "{}: {}", self.0.kind, self.0.reason) + format!("error: {}", self.0.reason.display_with_world(world)) } } } @@ -167,34 +198,343 @@ impl From for mlua::Error { } } -#[derive(thiserror::Error, Debug)] -pub enum ValueConversionError { - #[error("Expected type: {expected_type}, got: {actual_type:?}")] +#[cfg(feature = "mlua_impls")] +impl From for mlua::Error { + fn from(value: InteropError) -> Self { + mlua::Error::external(value) + } +} + +#[derive(Debug, Clone)] +pub struct InteropError(Arc); + +impl std::error::Error for InteropError {} + +impl DisplayWithWorld for InteropError { + fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { + self.0.display_with_world(world) + } +} + +impl_dummy_display!(InteropError); + +impl InteropError { + pub fn missing_world() -> Self { + Self(Arc::new(InteropErrorInner::MissingWorld)) + } + + pub fn stale_world_access() -> Self { + Self(Arc::new(InteropErrorInner::StaleWorldAccess)) + } + + pub fn unregistered_base(base: ReflectBaseType) -> Self { + Self(Arc::new(InteropErrorInner::UnregisteredBase { base })) + } + + pub fn missing_type_data(type_id: TypeId, type_data: String) -> Self { + Self(Arc::new(InteropErrorInner::MissingTypeData { + type_id, + type_data, + })) + } + + pub fn failed_from_reflect(type_id: Option, reason: String) -> Self { + Self(Arc::new(InteropErrorInner::FailedFromReflect { + type_id, + reason, + })) + } + + pub fn cannot_claim_access(base: ReflectBaseType) -> Self { + Self(Arc::new(InteropErrorInner::CannotClaimAccess { base })) + } + + pub fn impossible_conversion(into: TypeId) -> Self { + Self(Arc::new(InteropErrorInner::ImpossibleConversion { into })) + } + + pub fn type_mismatch(expected: TypeId, got: Option) -> Self { + Self(Arc::new(InteropErrorInner::TypeMismatch { expected, got })) + } + + pub fn string_type_mismatch(expected: String, got: Option) -> Self { + Self(Arc::new(InteropErrorInner::StringTypeMismatch { + expected, + got, + })) + } + + pub fn value_mismatch(expected: TypeId, got: ScriptValue) -> Self { + Self(Arc::new(InteropErrorInner::ValueMismatch { expected, got })) + } + + pub fn could_not_downcast(from: ReflectReference, to: TypeId) -> Self { + Self(Arc::new(InteropErrorInner::CouldNotDowncast { from, to })) + } + + pub fn garbage_collected_allocation(reference: ReflectReference) -> Self { + Self(Arc::new(InteropErrorInner::GarbageCollectedAllocation { + reference, + })) + } + + pub fn reflection_path_error(error: String, reference: Option) -> Self { + Self(Arc::new(InteropErrorInner::ReflectionPathError { + error, + reference, + })) + } + + pub fn unsupported_operation( + base: Option, + value: Option>, + operation: String, + ) -> Self { + Self(Arc::new(InteropErrorInner::UnsupportedOperation { + base, + value, + operation, + })) + } + + pub fn invalid_index(value: ScriptValue, reason: String) -> Self { + Self(Arc::new(InteropErrorInner::InvalidIndex { value, reason })) + } + + pub fn missing_entity(entity: Entity) -> Self { + Self(Arc::new(InteropErrorInner::MissingEntity { entity })) + } + + pub fn invalid_component(component_id: ComponentId) -> Self { + Self(Arc::new(InteropErrorInner::InvalidComponent { + component_id, + })) + } + + pub fn function_interop_error( + function_info: &FunctionInfo, + argument_info: Option<&ArgInfo>, + error: InteropError, + ) -> Self { + Self(Arc::new(InteropErrorInner::FunctionInteropError { + function_name: function_info + .name() + .map(|s| s.to_string()) + .unwrap_or("".to_owned()), + argument: argument_info + .map(|a| { + format!( + "{}({}) {}", + a.index(), + a.ownership(), + a.name().unwrap_or("") + ) + }) + .unwrap_or("None".to_owned()), + error, + })) + } + + pub fn function_call_error(inner: FunctionError) -> Self { + Self(Arc::new(InteropErrorInner::FunctionCallError { inner })) + } + + pub fn inner(&self) -> &InteropErrorInner { + &self.0 + } +} + +#[derive(Debug)] +/// For errors to do with reflection, type conversions or other interop issues +pub enum InteropErrorInner { + StaleWorldAccess, + MissingWorld, + UnregisteredBase { + base: ReflectBaseType, + }, + MissingTypeData { + type_id: TypeId, + type_data: String, + }, + FailedFromReflect { + type_id: Option, + reason: String, + }, + CannotClaimAccess { + base: ReflectBaseType, + }, + ImpossibleConversion { + into: TypeId, + }, TypeMismatch { - expected_type: Cow<'static, str>, - actual_type: Option>, + expected: TypeId, + got: Option, + }, + StringTypeMismatch { + expected: String, + got: Option, + }, + ValueMismatch { + expected: TypeId, + got: ScriptValue, + }, + CouldNotDowncast { + from: ReflectReference, + to: TypeId, + }, + GarbageCollectedAllocation { + reference: ReflectReference, + }, + ReflectionPathError { + error: String, + reference: Option, + }, + UnsupportedOperation { + base: Option, + value: Option>, + operation: String, }, - #[error("Could not index script value {base:?} using index {index}. Reason: {reason:?}")] InvalidIndex { - index: Cow<'static, str>, - base: Option>, - reason: Option>, + value: ScriptValue, + reason: String, }, - #[error("Type was not registed with the type registry: {type_id:?}. Could not convert.")] - MissingTypeInformation { type_id: TypeId }, -} - -#[derive(thiserror::Error, Debug)] -pub enum FunctionError { - #[error("Function {function_name:?} not found in type registry for type {type_:?}")] - FunctionNotFound { - function_name: Cow<'static, str>, - type_: Option>, + MissingEntity { + entity: Entity, + }, + InvalidComponent { + component_id: ComponentId, + }, + FunctionCallError { + inner: FunctionError, + }, + FunctionInteropError { + function_name: String, + argument: String, + error: InteropError, }, } -#[derive(thiserror::Error, Debug)] -pub enum ReflectReferenceError { - #[error("Reference could not be reflected, due to missing component, entity or resource. {reason:?}")] - InvalidBaseReference { reason: Cow<'static, str> }, +impl DisplayWithWorld for InteropErrorInner { + fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { + match self { + InteropErrorInner::UnregisteredBase { base } => { + format!("Unregistered base type: {}", base.display_with_world(world)) + } + InteropErrorInner::CannotClaimAccess { base } => { + format!( + "Cannot claim access to base type: {}", + base.display_with_world(world) + ) + } + InteropErrorInner::ImpossibleConversion { into } => { + format!("Cannot convert to type: {}", into.display_with_world(world)) + } + InteropErrorInner::TypeMismatch { expected, got } => { + format!( + "Type mismatch, expected: {}, got: {}", + expected.display_with_world(world.clone()), + got.map(|t| t.display_with_world(world)) + .unwrap_or("None".to_owned()) + ) + } + InteropErrorInner::StringTypeMismatch { expected, got } => { + format!( + "Type mismatch, expected: {}, got: {}", + expected, + got.map(|t| t.display_with_world(world)) + .unwrap_or("None".to_owned()) + ) + } + InteropErrorInner::CouldNotDowncast { from, to } => { + format!( + "Could not downcast from: {} to: {}", + from.display_with_world(world.clone()), + to.display_with_world(world) + ) + } + InteropErrorInner::GarbageCollectedAllocation { reference } => { + format!( + "Allocation was garbage collected. Could not access reference: {} as a result.", + reference.display_with_world(world), + ) + } + InteropErrorInner::ReflectionPathError { error, reference } => { + format!( + "Error while reflecting path: {} on reference: {}", + error, + reference + .as_ref() + .map(|r| r.display_with_world(world)) + .unwrap_or("None".to_owned()), + ) + } + InteropErrorInner::MissingTypeData { type_id, type_data } => { + format!( + "Missing type data {} for type: {}. Did you register the type correctly?", + type_data, + type_id.display_with_world(world), + ) + } + InteropErrorInner::FailedFromReflect { type_id, reason } => { + format!( + "Failed to convert from reflect for type: {} with reason: {}", + type_id + .map(|t| t.display_with_world(world)) + .unwrap_or("None".to_owned()), + reason + ) + } + InteropErrorInner::ValueMismatch { expected, got } => { + format!( + "Value mismatch, expected: {}, got: {}", + expected.display_with_world(world.clone()), + got.display_with_world(world) + ) + } + InteropErrorInner::UnsupportedOperation { + base, + value, + operation, + } => { + format!( + "Unsupported operation: {} on base: {} with value: {:?}", + operation, + base.map(|t| t.display_with_world(world)) + .unwrap_or("None".to_owned()), + value + ) + } + InteropErrorInner::InvalidIndex { value, reason } => { + format!( + "Invalid index for value: {}: {}", + value.display_with_world(world), + reason + ) + } + InteropErrorInner::MissingEntity { entity } => { + format!("Missing or invalid entity: {}", entity) + } + InteropErrorInner::InvalidComponent { component_id } => { + format!("Invalid component: {:?}", component_id) + } + InteropErrorInner::StaleWorldAccess => { + "Stale world access. The world has been dropped and a script tried to access it. Do not try to store or copy the world." + .to_owned() + } + InteropErrorInner::MissingWorld => { + "Missing world. The world was not initialized in the script context.".to_owned() + }, + InteropErrorInner::FunctionInteropError { function_name, argument, error } => { + format!( + "Error in function: {} argument: {} error: {}", + function_name, + argument, + error.display_with_world(world) + ) + }, + InteropErrorInner::FunctionCallError { inner } => { + inner.to_string() + }, + } + } } diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 2429418518..3ff9b72263 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -1,10 +1,27 @@ -use std::{any::{Any, TypeId}, borrow::Cow, cmp::max, ffi::{CStr, CString, OsStr, OsString}, os::unix::ffi::OsStrExt, path::{Path, PathBuf}, str::FromStr}; - -use bevy::reflect::{FromType, List, PartialReflect, Reflect, ReflectFromReflect, TypeData, TypeInfo}; +use std::{ + any::{Any, TypeId}, + borrow::Cow, + cmp::max, + ffi::{CStr, CString, OsStr, OsString}, + os::unix::ffi::OsStrExt, + path::{Path, PathBuf}, + str::FromStr, +}; + +use bevy::reflect::{ + FromType, List, PartialReflect, Reflect, ReflectFromReflect, ReflectMut, TypeData, TypeInfo, +}; use itertools::Itertools; -use crate::{bindings::{pretty_print::DisplayWithWorld, script_val::{IntoScriptValue, ScriptValue}, ReflectReference, WorldAccessGuard, WorldGuard}, error::{ScriptError, ScriptResult}}; use crate::bindings::script_val::FromScriptValue; +use crate::{ + bindings::{ + pretty_print::DisplayWithWorld, + script_val::{IntoScriptValue, ScriptValue}, + ReflectReference, WorldAccessGuard, WorldGuard, + }, + error::InteropError, +}; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { fn allocate_cloned(&self, world: WorldGuard) -> ReflectReference; @@ -15,48 +32,50 @@ pub trait PartialReflectExt { fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool; /// Equivalent to [`PartialReflectExt::is_type`] but returns an appropriate error if the type is not the expected one. - fn expect_type(&self, crate_name: Option<&str>, type_ident: &str) -> Result<(), ScriptError>; + fn expect_type(&self, crate_name: Option<&str>, type_ident: &str) -> Result<(), InteropError>; /// If the type is an option, returns either the inner value or None if the option is None. /// Errors if the type is not an option. - fn as_option(&self) -> Result, ScriptError>; + fn as_option(&self) -> Result, InteropError>; /// Similar to [`PartialReflectExt::as_option`] but for mutable references. - fn as_option_mut(&mut self) -> Result, ScriptError>; + fn as_option_mut(&mut self) -> Result, InteropError>; /// If the type is an iterable list-like type, returns an iterator over the elements. - fn as_list(&self) -> Result, ScriptError>; + fn as_list(&self) -> Result, InteropError>; /// If the type is a usize, returns the value as a usize otherwise throws a convenient error - fn as_usize(&self) -> Result; + fn as_usize(&self) -> Result; /// If the type is an iterable list-like type, sets the elements of the list to the elements of the other list-like type. /// This acts as a set operation, so the left list will have the same length as the right list after this operation. fn set_as_list< - F: Fn(&mut dyn PartialReflect, &dyn PartialReflect) -> Result<(), ScriptError>, + F: Fn(&mut dyn PartialReflect, &dyn PartialReflect) -> Result<(), InteropError>, >( &mut self, other: Box, apply: F, - ) -> Result<(), ScriptError>; - + ) -> Result<(), InteropError>; /// Inserts into the type at the given key, if the type supports inserting with the given key - fn try_insert_boxed(&mut self, index: Box, value: Box) -> Result<(), ScriptError>; + fn try_insert_boxed( + &mut self, + index: Box, + value: Box, + ) -> Result<(), InteropError>; - /// Tries to insert the given value into the type, if the type is a container type. + /// Tries to insert the given value into the type, if the type is a container type. /// The insertion will happen at the natural `end` of the container. /// For lists, this is the length of the list. /// For sets, this will simply insert the value into the set. /// For maps, there is no natural `end`, so the push will error out - fn try_push_boxed(&mut self, value: Box) -> Result<(), ScriptError>; - + fn try_push_boxed(&mut self, value: Box) -> Result<(), InteropError>; // If the type has a natural last element to pop, pops the last element and returns it as a boxed value. - fn try_pop_boxed(&mut self) -> Result, ScriptError>; + fn try_pop_boxed(&mut self) -> Result, InteropError>; /// If the type is a container type, empties the contents - fn try_clear(&mut self) -> Result<(), ScriptError>; + fn try_clear(&mut self) -> Result<(), InteropError>; /// If the type is a container type, returns the type id of the elements in the container. /// For maps, this is the type id of the values. @@ -68,7 +87,10 @@ pub trait PartialReflectExt { fn key_type_id(&self) -> Option; /// Tries to construct the concrete underlying type from a possibly untyped reference - fn from_reflect(reflect: &dyn PartialReflect, world: WorldGuard) -> ScriptResult>; + fn from_reflect( + reflect: &dyn PartialReflect, + world: WorldGuard, + ) -> Result, InteropError>; } pub trait TypeIdExtensions { fn type_id_or_fake_id(&self) -> TypeId; @@ -92,23 +114,17 @@ impl PartialReflectExt for T { }) } - fn expect_type(&self, crate_name: Option<&str>, type_ident: &str) -> Result<(), ScriptError> { + fn expect_type(&self, crate_name: Option<&str>, type_ident: &str) -> Result<(), InteropError> { if !self.is_type(crate_name, type_ident) { - return Err(ScriptError::new_runtime_error(format!( - "Expected type {type_ident}{}, but got {}", - crate_name - .map(|s| format!(" from crate {s}")) - .unwrap_or_default(), - self.get_represented_type_info() - .map(|ti| ti.type_path()) - .unwrap_or_else(|| "dynamic type with no type information") - ))); + return Err(InteropError::string_type_mismatch( + type_ident.to_owned(), + self.get_represented_type_info().map(|ti| ti.type_id()), + )); } Ok(()) } - - fn as_option(&self) -> Result, ScriptError> { + fn as_option(&self) -> Result, InteropError> { if let bevy::reflect::ReflectRef::Enum(e) = self.reflect_ref() { if let Some(field) = e.field_at(0) { return Ok(Some(field)); @@ -117,15 +133,13 @@ impl PartialReflectExt for T { } } - Err(ScriptError::new_runtime_error(format!( - "Expected enum type, but got type which is not an enum: {}", - self.get_represented_type_info() - .map(|ti| ti.type_path()) - .unwrap_or_else(|| "dynamic type with no type information") - ))) + Err(InteropError::string_type_mismatch( + "Option".to_owned(), + self.get_represented_type_info().map(|ti| ti.type_id()), + )) } - fn as_option_mut(&mut self) -> Result, ScriptError> { + fn as_option_mut(&mut self) -> Result, InteropError> { let type_info = self.get_represented_type_info().map(|ti| ti.type_path()); match self.reflect_mut() { bevy::reflect::ReflectMut::Enum(e) => { @@ -135,36 +149,33 @@ impl PartialReflectExt for T { Ok(None) } } - _ => Err(ScriptError::new_runtime_error(format!( - "Expected enum type, but got type which is not an enum: {}", - type_info.unwrap_or("dynamic type with no type information") - ))), + _ => Err(InteropError::string_type_mismatch( + "Option".to_owned(), + type_info.map(|t| t.type_id()), + )), } } - fn as_list(&self) -> Result, ScriptError> { + fn as_list(&self) -> Result, InteropError> { if let bevy::reflect::ReflectRef::List(l) = self.reflect_ref() { Ok(l.iter()) } else { - Err(ScriptError::new_runtime_error(format!( - "Expected list-like type from crate core, but got {}", - self.get_represented_type_info() - .map(|ti| ti.type_path()) - .unwrap_or_else(|| "dynamic type with no type information") - ))) + Err(InteropError::string_type_mismatch( + "List".to_owned(), + self.get_represented_type_info().map(|ti| ti.type_id()), + )) } } fn set_as_list< - F: Fn(&mut dyn PartialReflect, &dyn PartialReflect) -> Result<(), ScriptError>, + F: Fn(&mut dyn PartialReflect, &dyn PartialReflect) -> Result<(), InteropError>, >( &mut self, mut other: Box, apply: F, - ) -> Result<(), ScriptError> { + ) -> Result<(), InteropError> { match (self.reflect_mut(), other.reflect_mut()) { - (bevy::reflect::ReflectMut::List(l), bevy::reflect::ReflectMut::List(r)) => { - + (ReflectMut::List(l), ReflectMut::List(r)) => { let to_be_inserted_elems = max(r.len() as isize - l.len() as isize, 0) as usize; let apply_range = 0..(r.len() - to_be_inserted_elems); @@ -174,9 +185,10 @@ impl PartialReflectExt for T { }); // pop then insert in reverse order of popping (last elem -> first elem to insert) - let to_insert = (0..to_be_inserted_elems).rev().map(|_| { - r.pop().expect("invariant") - }).collect::>(); + let to_insert = (0..to_be_inserted_elems) + .rev() + .map(|_| r.pop().expect("invariant")) + .collect::>(); to_insert.into_iter().rev().for_each(|e| { l.push(e); @@ -186,100 +198,119 @@ impl PartialReflectExt for T { // apply to existing elements in the list for i in apply_range { - apply(l.get_mut(i).expect("invariant"), r.get(i).expect("invariant"))?; - }; - + apply( + l.get_mut(i).expect("invariant"), + r.get(i).expect("invariant"), + )?; + } + Ok(()) } - _ => Err(ScriptError::new_reflection_error(format!( - "Could not set {} with {}. Both need to reflect as list types, but at least one does not.", - self.reflect_type_path(), - other.reflect_type_path() - ))), + (ReflectMut::List(_), _) => Err(InteropError::string_type_mismatch( + "List".to_owned(), + other.get_represented_type_info().map(|ti| ti.type_id()), + )), + (_, _) => Err(InteropError::string_type_mismatch( + "List".to_owned(), + self.get_represented_type_info().map(|ti| ti.type_id()), + )), } } - fn as_usize(&self) -> Result { - self.as_partial_reflect().try_downcast_ref::().copied() - .ok_or_else(|| ScriptError::new_runtime_error(format!( - "Expected type usize, but got {}", - self.get_represented_type_info() - .map(|ti| ti.type_path()) - .unwrap_or_else(|| "dynamic type with no type information") - ))) + fn as_usize(&self) -> Result { + self.as_partial_reflect() + .try_downcast_ref::() + .copied() + .ok_or_else(|| { + InteropError::type_mismatch( + TypeId::of::(), + self.get_represented_type_info().map(|ti| ti.type_id()), + ) + }) } - fn try_insert_boxed(&mut self, key: Box, value: Box) -> Result<(), ScriptError> { + fn try_insert_boxed( + &mut self, + key: Box, + value: Box, + ) -> Result<(), InteropError> { match self.reflect_mut() { bevy::reflect::ReflectMut::List(l) => { l.insert(key.as_usize()?, value); Ok(()) - }, + } bevy::reflect::ReflectMut::Map(m) => { m.insert_boxed(key, value); Ok(()) - }, + } bevy::reflect::ReflectMut::Set(s) => { s.insert_boxed(value); Ok(()) - }, - _ => Err(ScriptError::new_reflection_error(format!( - "Could not insert into {}. The type does not support insertion at a key.", - self.reflect_type_path() - ))), + } + _ => Err(InteropError::unsupported_operation( + self.get_represented_type_info().map(|ti| ti.type_id()), + Some(value), + "insert".to_owned(), + )), } } - fn try_push_boxed(&mut self, value: Box) -> Result<(), ScriptError> { + fn try_push_boxed(&mut self, value: Box) -> Result<(), InteropError> { match self.reflect_mut() { bevy::reflect::ReflectMut::List(l) => { l.push(value); Ok(()) - }, + } bevy::reflect::ReflectMut::Set(s) => { s.insert_boxed(value); Ok(()) - }, - _ => Err(ScriptError::new_reflection_error(format!( - "Could not push into {}. The type does not support pushing.", - self.reflect_type_path() - ))), + } + _ => Err(InteropError::unsupported_operation( + self.get_represented_type_info().map(|ti| ti.type_id()), + Some(value), + "push".to_owned(), + )), } } - fn try_clear(&mut self) -> Result<(), ScriptError> { + fn try_clear(&mut self) -> Result<(), InteropError> { match self.reflect_mut() { bevy::reflect::ReflectMut::List(l) => { let _ = l.drain(); Ok(()) - }, + } bevy::reflect::ReflectMut::Map(m) => { let _ = m.drain(); Ok(()) - }, + } bevy::reflect::ReflectMut::Set(s) => { let _ = s.drain(); Ok(()) - }, - _ => Err(ScriptError::new_reflection_error(format!( - "Could not clear {}. The type does not support clearing.", - self.reflect_type_path() - ))), + } + _ => Err(InteropError::unsupported_operation( + self.get_represented_type_info().map(|ti| ti.type_id()), + None, + "clear".to_owned(), + )), } } - - fn try_pop_boxed(&mut self) -> Result, ScriptError> { + fn try_pop_boxed(&mut self) -> Result, InteropError> { match self.reflect_mut() { - bevy::reflect::ReflectMut::List(l) => { - l.pop().ok_or_else(|| ScriptError::new_runtime_error("Tried to pop from an empty list")) - }, - _ => Err(ScriptError::new_reflection_error(format!( - "Could not pop from {}. The type does not support popping.", - self.reflect_type_path() - ))), + bevy::reflect::ReflectMut::List(l) => l.pop().ok_or_else(|| { + InteropError::unsupported_operation( + self.get_represented_type_info().map(|ti| ti.type_id()), + None, + "pop from empty list".to_owned(), + ) + }), + _ => Err(InteropError::unsupported_operation( + self.get_represented_type_info().map(|ti| ti.type_id()), + None, + "pop".to_owned(), + )), } - } + } fn element_type_id(&self) -> Option { let elem: TypeId = match self.get_represented_type_info()? { @@ -291,27 +322,44 @@ impl PartialReflectExt for T { }; Some(elem) } - + fn key_type_id(&self) -> Option { let key: TypeId = match self.get_represented_type_info()? { bevy::reflect::TypeInfo::Map(map_info) => map_info.key_ty().id(), - bevy::reflect::TypeInfo::List(_) | bevy::reflect::TypeInfo::Array(_) => TypeId::of::(), + bevy::reflect::TypeInfo::List(_) | bevy::reflect::TypeInfo::Array(_) => { + TypeId::of::() + } _ => return None, }; Some(key) } - fn from_reflect(reflect: &dyn PartialReflect, world: WorldGuard) -> ScriptResult> { - - let type_info = reflect.get_represented_type_info().ok_or_else(|| ScriptError::new_runtime_error("Could not construct concrete type as the reference does not contain type information."))?; + fn from_reflect( + reflect: &dyn PartialReflect, + world: WorldGuard, + ) -> Result, InteropError> { + let type_info = reflect.get_represented_type_info().ok_or_else(|| { + InteropError::failed_from_reflect( + None, + "tried to construct a concrete type from dynamic type with no type information" + .to_owned(), + ) + })?; let type_id = type_info.type_id(); let type_registry = world.type_registry(); let type_registry = type_registry.read(); - - let from_reflect_type_data: &ReflectFromReflect = type_registry.get_type_data(type_id).ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type id {} as it does not have a FromReflect type data registered.", type_id.display_with_world(world.clone()))))?; - from_reflect_type_data.from_reflect(reflect) - .ok_or_else(|| ScriptError::new_runtime_error(format!("Could not construct concrete type from type: {}. From Reflect implementation failed", type_id.display_with_world(world.clone())))) + + let from_reflect_type_data: &ReflectFromReflect = + type_registry.get_type_data(type_id).ok_or_else(|| { + InteropError::missing_type_data(type_id, "ReflectFromReflect".to_owned()) + })?; + from_reflect_type_data.from_reflect(reflect).ok_or_else(|| { + InteropError::failed_from_reflect( + Some(type_id), + "from_reflect returned None".to_owned(), + ) + }) } fn allocate(boxed: Box, world: WorldGuard) -> ReflectReference { @@ -324,8 +372,6 @@ impl PartialReflectExt for T { let boxed = self.clone_value(); Self::allocate(boxed, world) } - - } pub trait TypeInfoExtensions { @@ -338,7 +384,7 @@ impl TypeInfoExtensions for TypeInfo { fn is_option(&self) -> bool { self.is_type(Some("core"), "Option") } - + fn option_inner_type(&self) -> Option { if self.is_option() { self.generics().first().map(|g| g.type_id()) @@ -351,13 +397,14 @@ impl TypeInfoExtensions for TypeInfo { self.type_path_table().ident() == Some(type_ident) && self.type_path_table().crate_name() == crate_name } - } - #[cfg(test)] mod test { - use bevy::{prelude::{AppTypeRegistry, World}, reflect::{DynamicMap, Map}}; + use bevy::{ + prelude::{AppTypeRegistry, World}, + reflect::{DynamicMap, Map}, + }; use crate::prelude::AppReflectAllocator; @@ -442,27 +489,24 @@ mod test { let mut list = vec![1, 2, 3]; let other = vec![4, 5, 6]; let other_ref: Box = Box::new(other.clone()); - list - .set_as_list(other_ref, |l, r| { - *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); - Ok(()) - }) - .unwrap(); + list.set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); assert_eq!(other, list); } - #[test] fn test_set_as_list_shortening() { let mut list = vec![1, 2, 3]; let other = vec![4, 5]; let other_ref: Box = Box::new(other.clone()); - list - .set_as_list(other_ref, |l, r| { - *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); - Ok(()) - }) - .unwrap(); + list.set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); assert_eq!(other, list); } @@ -471,42 +515,37 @@ mod test { let mut list = vec![1, 2]; let other = vec![4, 5, 6]; let other_ref: Box = Box::new(other.clone()); - list - .set_as_list(other_ref, |l, r| { - *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); - Ok(()) - }) - .unwrap(); + list.set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); assert_eq!(other, list); } - #[test] fn test_set_as_list_empty() { let mut list = vec![1, 2]; let other = Vec::::default(); let other_ref: Box = Box::new(other.clone()); - list - .set_as_list(other_ref, |l, r| { - *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); - Ok(()) - }) - .unwrap(); + list.set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); assert_eq!(other, list); } - #[test] fn test_set_as_list_targe_empty() { let mut list = Vec::::default(); let other = vec![1]; let other_ref: Box = Box::new(other.clone()); - list - .set_as_list(other_ref, |l, r| { - *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); - Ok(()) - }) - .unwrap(); + list.set_as_list(other_ref, |l, r| { + *l.try_downcast_mut::().unwrap() = *r.try_downcast_ref::().unwrap(); + Ok(()) + }) + .unwrap(); assert_eq!(other, list); } @@ -545,7 +584,8 @@ mod test { #[test] fn test_try_insert_dynamic_map_into_map_of_maps() { - let mut map = std::collections::HashMap::>::default(); + let mut map = + std::collections::HashMap::>::default(); let value = DynamicMap::from_iter(vec![(1, 2), (2, 3), (3, 4)]); let value_ref: Box = Box::new(value.clone_dynamic()); map.insert(1, std::collections::HashMap::::default()); @@ -554,6 +594,4 @@ mod test { map.try_insert_boxed(Box::new(1), value_ref).unwrap(); assert!(value.reflect_partial_eq(&map[&1]).unwrap()); } - - } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 3f870bb029..7415cc8d54 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -3,7 +3,7 @@ use std::any::type_name; use crate::{ asset::{ScriptAsset, ScriptAssetSettings}, - bindings::ReflectAllocator, + bindings::{pretty_print::DisplayWithWorld, ReflectAllocator, WorldAccessGuard, WorldGuard}, commands::{CreateOrUpdateScript, DeleteScript}, context::{Context, ContextLoadingSettings, ScriptContexts}, error::{ScriptError, ScriptResult}, @@ -185,7 +185,10 @@ pub fn event_handler( &pre_handling_initializers, runtime, world, - ); + ) + .map_err(|e| { + e.with_appended_context(format!("Script: {}, Entity: {:?}", script.id, entity)) + }); push_err_and_continue!(errors, handler_result) } @@ -203,12 +206,12 @@ pub fn event_handler( type_name::(), type_name::() ), - errors, + errors.into_iter(), ); } /// Handles errors caused by script execution and sends them to the error event channel -pub(crate) fn handle_script_errors>( +pub(crate) fn handle_script_errors + Clone>( world: &mut World, context: &str, errors: I, @@ -217,10 +220,14 @@ pub(crate) fn handle_script_errors>( .get_resource_mut::>() .expect("Missing events resource"); - for error in errors { - bevy::log::error!("{}. {}", context, error.to_string()); + for error in errors.clone() { error_events.send(ScriptErrorEvent { error }); } + + for error in errors { + let arc_world = WorldGuard::new(WorldAccessGuard::new(world)); + bevy::log::error!("{}. {}", context, error.display_with_world(arc_world)); + } } #[cfg(test)] diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 0fbfd13b8c..1de9f5db8a 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -41,11 +41,12 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe ) .overwrite( "get_component", - |s: WorldCallbackAccess, entity: Entity, registration: ScriptTypeRegistration| { - let c = s - .get_component(entity, registration.component_id().unwrap()) - .unwrap(); - c.map(ScriptValue::Reference).unwrap_or(ScriptValue::Unit) + |world: WorldCallbackAccess, entity: Entity, registration: ScriptTypeRegistration| { + let s: ScriptValue = registration + .component_id() + .and_then(|id| world.get_component(entity, id).transpose()) + .into(); + s }, ) .overwrite("exit", |s: WorldCallbackAccess| s.exit()); @@ -58,12 +59,13 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let path: ParsedPath = key.try_into().unwrap(); r.index_path(path); let world = world.read().expect("Stale world"); - let script_val = r - .with_reflect(world.clone(), |r| r.into_script_value(world).unwrap()) - .unwrap(); + let script_val: ScriptValue = r + .with_reflect(world.clone(), |r| r.into_script_value(world)) + .into(); script_val } else { - ScriptValue::Unit + // ScriptValue::Error() + todo!() } }, ) @@ -76,8 +78,8 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe r.index_path(path); let world = world.read().expect("Stale world"); let script_val = r - .with_reflect(world.clone(), |r| r.into_script_value(world).unwrap()) - .unwrap(); + .with_reflect(world.clone(), |r| r.into_script_value(world)) + .into(); script_val } else { ScriptValue::Unit diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 2e5202f2c5..4eae1b6de8 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -22,7 +22,7 @@ use bevy_mod_scripting_core::{ ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, WorldCallbackAccess, }, - error::{FunctionError, ScriptError, ScriptResult, ValueConversionError}, + error::{FunctionError, ScriptError, ScriptResult, InteropError}, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, Either, }; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 83d12766df..1d6532e98d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -73,6 +73,7 @@ impl<'lua> IntoLua<'lua> for LuaScriptValue { LuaReflectReference::from(ReflectReference::new_world()).into_lua(lua)? } ScriptValue::Reference(r) => LuaReflectReference::from(r).into_lua(lua)?, + ScriptValue::Error(script_error) => return Err(mlua::Error::external(script_error)), }) } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 65ad7b1c7b..3c8b22fc4e 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -5,7 +5,7 @@ use bevy::prelude::{AppFunctionRegistry, Entity, World}; use bevy_mod_scripting_core::bindings::function::CallableWithAccess; use bevy_mod_scripting_core::bindings::WorldGuard; -use bevy_mod_scripting_core::error::FunctionError; +use bevy_mod_scripting_core::error::{FunctionError, InteropError}; use bevy_mod_scripting_core::{ bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, error::ScriptError, @@ -432,22 +432,13 @@ pub trait GetWorld { impl GetWorld for mlua::Lua { fn try_get_world(&self) -> Result>, mlua::Error> { - // self.globals() - // .get::<_, LuaWorld>("world")? - // .0 - // .read() - // .ok_or_else(|| ScriptError::new_reflection_error("Stale world access")) - // .map_err(mlua::Error::external) - let access = self.app_data_ref::().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error( - "World was not initialized", - )) - })?; - - access.read().ok_or_else(|| { - mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - }) - // todo!() + let access = self + .app_data_ref::() + .ok_or_else(InteropError::missing_world)?; + + let world = access.read().ok_or_else(InteropError::stale_world_access)?; + + Ok(world) } fn get_world(&self) -> WorldGuard<'static> { From fb9f71b2613488f4c06aeaf7e1c9685922b7f44c Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 16:44:29 +0000 Subject: [PATCH 045/217] fix errors --- crates/bevy_mod_scripting_core/src/asset.rs | 2 +- crates/bevy_mod_scripting_core/src/bindings/function.rs | 3 +-- crates/bevy_mod_scripting_core/src/error.rs | 8 +++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index 721ed51d60..109a5a9f6d 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -47,7 +47,7 @@ impl AssetLoader for ScriptAssetLoader { reader .read_to_end(&mut content) .await - .map_err(|e| ScriptError::new_error(e).with_context(load_context.asset_path()))?; + .map_err(|e| ScriptError::new_external(e).with_context(load_context.asset_path()))?; if let Some(processor) = &self.preprocessor { processor(&mut content)?; } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index da51958420..c9dcde9644 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -235,8 +235,7 @@ impl> IntoArgsListWithAccess for I { function_info, Some(argument_info), InteropError::impossible_conversion(argument_info.type_id()), - ) - .into()); + )); } }; diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 0b54a1bf6e..1d18cde3a0 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -111,7 +111,7 @@ impl ScriptError { match error { mlua::Error::ExternalError(inner) => { if let Some(script_error) = inner.downcast_ref::() { - Self::new(script_error.clone()) + script_error.clone().into() } else { Self::new_external(inner) } @@ -218,6 +218,12 @@ impl DisplayWithWorld for InteropError { impl_dummy_display!(InteropError); +impl From for ScriptError { + fn from(val: InteropError) -> Self { + ScriptError::new(val) + } +} + impl InteropError { pub fn missing_world() -> Self { Self(Arc::new(InteropErrorInner::MissingWorld)) From ffe244170b0361c99efe95597f48159ba7249a04 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 17:26:33 +0000 Subject: [PATCH 046/217] properly re-catch mlua errors --- .../src/bindings/pretty_print.rs | 10 ++ crates/bevy_mod_scripting_core/src/error.rs | 100 ++++++++---------- crates/bevy_mod_scripting_core/src/systems.rs | 3 +- .../bevy_mod_scripting_lua/src/assets.rs | 2 - .../src/bindings/reference.rs | 2 +- .../src/bindings/world.rs | 2 +- .../bevy_mod_scripting_lua/src/lib.rs | 28 +++-- 7 files changed, 78 insertions(+), 69 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index bf6def8990..946f50066d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -304,6 +304,10 @@ impl ReflectReferencePrinter { } } +/// Alais for [`DisplayWithWorldAndDummy`] + [`std::fmt::Display`], ideally display should warn that it's not the full representation. +pub trait DisplayWithWorldAndDummy: DisplayWithWorld + std::fmt::Display {} +impl DisplayWithWorldAndDummy for T {} + /// For types which can't be pretty printed without world access. /// Implementors should try to print the best value they can, and never panick. pub trait DisplayWithWorld: std::fmt::Debug { @@ -330,6 +334,8 @@ macro_rules! impl_dummy_display ( }; ); +impl_dummy_display!(ReflectReference); + impl DisplayWithWorld for ReflectReference { fn display_with_world(&self, world: WorldGuard) -> String { ReflectReferencePrinter::new(self.clone()).pretty_print(world) @@ -340,6 +346,8 @@ impl DisplayWithWorld for ReflectReference { } } +impl_dummy_display!(ReflectBaseType); + impl DisplayWithWorld for ReflectBaseType { fn display_with_world(&self, world: WorldGuard) -> String { let mut string = String::new(); @@ -371,6 +379,8 @@ impl DisplayWithWorld for TypeId { } } +impl_dummy_display!(ScriptValue); + impl DisplayWithWorld for ScriptValue { fn display_with_world(&self, world: WorldGuard) -> String { match self { diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 1d18cde3a0..8248675e16 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -18,8 +18,8 @@ use thiserror::Error; use crate::{ bindings::{ - pretty_print::DisplayWithWorld, ReflectAllocationId, ReflectBase, ReflectBaseType, - ReflectReference, + pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, + ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference, }, impl_dummy_display, prelude::ScriptValue, @@ -27,25 +27,13 @@ use crate::{ pub type ScriptResult = Result; -#[derive(Error, Debug)] -pub struct ScriptErrorWrapper(ScriptError); - -impl std::fmt::Display for ScriptErrorWrapper { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) - } -} - -impl From for Box { - fn from(val: ScriptError) -> Self { - ScriptErrorWrapper(val).into() - } -} /// An error with an optional script Context #[derive(Debug, Clone, PartialEq, Reflect)] #[reflect(opaque)] pub struct ScriptError(pub Arc); +impl std::error::Error for ScriptError {} + impl Deref for ScriptError { type Target = ScriptErrorInner; @@ -65,7 +53,7 @@ pub struct ScriptErrorInner { #[derive(Debug, Clone)] pub enum ErrorKind { Display(Arc), - WithWorld(Arc), + WithWorld(Arc), } impl DisplayWithWorld for ErrorKind { @@ -81,7 +69,7 @@ impl Display for ErrorKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { ErrorKind::Display(e) => write!(f, "{}", e), - ErrorKind::WithWorld(e) => write!(f, "{:?}", e), + ErrorKind::WithWorld(e) => write!(f, "{}", e), } } } @@ -92,31 +80,26 @@ impl PartialEq for ScriptErrorInner { } } -// impl From for ErrorKind { -// fn from(value: T) -> Self { -// ErrorKind::Display(Arc::new(value)) -// } -// } - -// impl From for ErrorKind { -// fn from(val: Box) -> Self { -// ErrorKind::WithWorld(Arc::from(val)) -// } -// } - impl ScriptError { #[cfg(feature = "mlua_impls")] /// Destructures mlua error into a script error, taking care to preserve as much information as possible pub fn from_mlua_error(error: mlua::Error) -> Self { match error { - mlua::Error::ExternalError(inner) => { - if let Some(script_error) = inner.downcast_ref::() { - script_error.clone().into() + mlua::Error::CallbackError { traceback, cause } + if matches!(cause.as_ref(), mlua::Error::ExternalError(_)) => + { + let inner = cause.deref().clone(); + Self::from_mlua_error(inner).with_context(traceback) + } + e => { + if let Some(inner) = e.downcast_ref::() { + Self::new(inner.clone()) + } else if let Some(inner) = e.downcast_ref::() { + inner.clone() } else { - Self::new_external(inner) + Self::new_external(e) } } - e => Self::new_external(e), } } @@ -128,7 +111,7 @@ impl ScriptError { })) } - pub fn new(reason: impl DisplayWithWorld + Send + Sync + 'static) -> Self { + pub fn new(reason: impl DisplayWithWorldAndDummy + Send + Sync + 'static) -> Self { Self(Arc::new(ScriptErrorInner { script: None, reason: ErrorKind::WithWorld(Arc::new(reason)), @@ -144,6 +127,14 @@ impl ScriptError { })) } + pub fn with_script(self, script: S) -> Self { + Self(Arc::new(ScriptErrorInner { + script: Some(script.to_string()), + context: self.0.context.clone(), + reason: self.0.reason.clone(), + })) + } + pub fn with_appended_context(self, context: S) -> Self { Self(Arc::new(ScriptErrorInner { script: self.0.script.clone(), @@ -153,26 +144,16 @@ impl ScriptError { } } -// impl From for ScriptError { -// fn from(value: T) -> Self { -// let error_kind = ErrorKind::from(value); -// Self::new_external(error_kind) -// } -// } - -// impl From for ScriptError { -// fn from(value: T) -> Self { -// let error_kind = ErrorKind::WithWorld(Arc::new(value)); -// Self::new_error(error_kind) -// } -// } - impl std::fmt::Display for ScriptError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { if let Some(script) = &self.0.script { - write!(f, "error in script `{}`: {}", script, self.0.reason) + write!( + f, + "error in script `{}`: {}.\n{}", + script, self.0.reason, self.0.context + ) } else { - write!(f, "error: {}", self.0.reason) + write!(f, "error: {}.\n{}", self.0.reason, self.0.context) } } } @@ -181,12 +162,17 @@ impl DisplayWithWorld for ScriptError { fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { if let Some(script) = &self.0.script { format!( - "error in script `{}`: {}", + "error in script `{}`: {}.\n{}", script, - self.0.reason.display_with_world(world) + self.0.reason.display_with_world(world), + self.0.context ) } else { - format!("error: {}", self.0.reason.display_with_world(world)) + format!( + "error: {}.\n{}", + self.0.reason.display_with_world(world), + self.0.context + ) } } } @@ -350,8 +336,10 @@ impl InteropError { } } -#[derive(Debug)] +impl_dummy_display!(InteropErrorInner); + /// For errors to do with reflection, type conversions or other interop issues +#[derive(Debug)] pub enum InteropErrorInner { StaleWorldAccess, MissingWorld, diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 7415cc8d54..67ebbdca30 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -187,7 +187,8 @@ pub fn event_handler( world, ) .map_err(|e| { - e.with_appended_context(format!("Script: {}, Entity: {:?}", script.id, entity)) + // println!("{e:?}"); + e.with_script(script.id.clone()) }); push_err_and_continue!(errors, handler_result) diff --git a/crates/languages/bevy_mod_scripting_lua/src/assets.rs b/crates/languages/bevy_mod_scripting_lua/src/assets.rs index 18644d9cf5..79352f5d45 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/assets.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/assets.rs @@ -4,7 +4,6 @@ // utils::BoxedFuture, // }; - // use anyhow::Error; // #[derive(Asset, TypePath, Debug)] @@ -146,7 +145,6 @@ // Ok(LuaFile { bytes }) // } - // #[cfg(feature = "teal")] // fn extensions(&self) -> &[&str] { // &["lua", "tl"] diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 4eae1b6de8..4fdb0c0254 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -22,7 +22,7 @@ use bevy_mod_scripting_core::{ ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, WorldCallbackAccess, }, - error::{FunctionError, ScriptError, ScriptResult, InteropError}, + error::{InteropError, ScriptError, ScriptResult}, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, Either, }; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 3c8b22fc4e..c0a7833fe6 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -5,7 +5,7 @@ use bevy::prelude::{AppFunctionRegistry, Entity, World}; use bevy_mod_scripting_core::bindings::function::CallableWithAccess; use bevy_mod_scripting_core::bindings::WorldGuard; -use bevy_mod_scripting_core::error::{FunctionError, InteropError}; +use bevy_mod_scripting_core::error::InteropError; use bevy_mod_scripting_core::{ bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, error::ScriptError, diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index c9f39eaae8..6082f12bf9 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -69,11 +69,17 @@ impl Plugin for LuaScriptingPlugin { // let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); // ::Proxy::from(reflect_reference) // }); - context.globals().set( - "entity", - LuaReflectReference(::allocate(Box::new(entity), world)), - )?; - context.globals().set("script_id", script_id.clone())?; + context + .globals() + .set( + "entity", + LuaReflectReference(::allocate(Box::new(entity), world)), + ) + .map_err(ScriptError::from_mlua_error)?; + context + .globals() + .set("script_id", script_id.clone()) + .map_err(ScriptError::from_mlua_error)?; // context.globals().set("entity", lua_entity)?; Ok(()) }); @@ -110,7 +116,10 @@ pub fn lua_context_load( .iter() .try_for_each(|init| init(script_id, Entity::from_raw(0), context))?; - context.load(content).exec()?; + context + .load(content) + .exec() + .map_err(ScriptError::from_mlua_error)?; Ok(()) })?; @@ -159,7 +168,9 @@ pub fn lua_handler IntoLuaMulti<'l>>( Err(_) => return Ok(()), }; - handler.call::<_, ()>(args)?; + handler + .call::<_, ()>(args) + .map_err(ScriptError::from_mlua_error)?; Ok(()) }) } @@ -173,7 +184,8 @@ pub fn with_world Result<(), ScriptError>>( WorldCallbackAccess::with_callback_access(world, |guard| { context .globals() - .set("world", LuaReflectReference(ReflectReference::new_world()))?; + .set("world", LuaReflectReference(ReflectReference::new_world())) + .map_err(ScriptError::from_mlua_error)?; context.set_app_data(guard.clone()); f(context) }) From 69a1344f843c32bda825f70195aef602888a1e30 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 18:31:11 +0000 Subject: [PATCH 047/217] add comments to error type --- .../bevy_mod_scripting_core/src/commands.rs | 2 +- crates/bevy_mod_scripting_core/src/error.rs | 48 +++++++++++++------ crates/bevy_mod_scripting_core/src/systems.rs | 22 ++++----- 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index ccee1f8a3b..a39f8d9f74 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -116,7 +116,7 @@ impl Command for CreateOrUpdateScript { match ctxt { Ok(ctxt) => contexts.insert(ctxt), Err(e) => { - handle_script_errors(world, &format!("Failed to load context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()), [e].into_iter()); + handle_script_errors(world, [e.with_context(format!("Loading context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()))].into_iter()); return; } } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 8248675e16..5e360d1e28 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -119,14 +119,6 @@ impl ScriptError { })) } - pub fn with_context(self, context: S) -> Self { - Self(Arc::new(ScriptErrorInner { - script: self.0.script.clone(), - context: context.to_string(), - reason: self.0.reason.clone(), - })) - } - pub fn with_script(self, script: S) -> Self { Self(Arc::new(ScriptErrorInner { script: Some(script.to_string()), @@ -135,10 +127,10 @@ impl ScriptError { })) } - pub fn with_appended_context(self, context: S) -> Self { + pub fn with_context(self, context: S) -> Self { Self(Arc::new(ScriptErrorInner { script: self.0.script.clone(), - context: format!("{}. {}", self.0.context, context.to_string()), + context: format!("{}\n{}", self.0.context, context.to_string()), reason: self.0.reason.clone(), })) } @@ -149,11 +141,11 @@ impl std::fmt::Display for ScriptError { if let Some(script) = &self.0.script { write!( f, - "error in script `{}`: {}.\n{}", + "error in script `{}`: {}.\nContext:{}", script, self.0.reason, self.0.context ) } else { - write!(f, "error: {}.\n{}", self.0.reason, self.0.context) + write!(f, "error: {}.\nContext:{}", self.0.reason, self.0.context) } } } @@ -162,14 +154,14 @@ impl DisplayWithWorld for ScriptError { fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { if let Some(script) = &self.0.script { format!( - "error in script `{}`: {}.\n{}", + "error in script `{}`: {}.\nContext:{}", script, self.0.reason.display_with_world(world), self.0.context ) } else { format!( - "error: {}.\n{}", + "error: {}.\nContext:{}", self.0.reason.display_with_world(world), self.0.context ) @@ -211,18 +203,26 @@ impl From for ScriptError { } impl InteropError { + /// Thrown if a callback requires world access, but is unable to do so due + /// to the world not being reachable at all via any mechanism. pub fn missing_world() -> Self { Self(Arc::new(InteropErrorInner::MissingWorld)) } + /// Thrown if a callback requires world access, but is unable to do so due + /// to the world being dropped. I.e. Symptom of a script trying to persist a world reference somewhere. pub fn stale_world_access() -> Self { Self(Arc::new(InteropErrorInner::StaleWorldAccess)) } + /// Thrown if a base type is not registered with the reflection system + /// and therefore the reference cannot be dereferenced pub fn unregistered_base(base: ReflectBaseType) -> Self { Self(Arc::new(InteropErrorInner::UnregisteredBase { base })) } + /// Thrown if a base type is not registered with the reflection system + /// with the specific type data. pub fn missing_type_data(type_id: TypeId, type_data: String) -> Self { Self(Arc::new(InteropErrorInner::MissingTypeData { type_id, @@ -230,6 +230,8 @@ impl InteropError { })) } + /// Thrown if a type cannot be converted from reflect, this can happen if the type was unable to + /// re-construct itself from a dynamic value. pub fn failed_from_reflect(type_id: Option, reason: String) -> Self { Self(Arc::new(InteropErrorInner::FailedFromReflect { type_id, @@ -237,18 +239,24 @@ impl InteropError { })) } + /// Thrown if access to the given reflection base is required but cannot be claimed. + /// This is likely due to some other script already claiming access to the base. pub fn cannot_claim_access(base: ReflectBaseType) -> Self { Self(Arc::new(InteropErrorInner::CannotClaimAccess { base })) } + /// Thrown if a conversion into the given type is impossible. + /// Should be thrown with context on the other type if possible. pub fn impossible_conversion(into: TypeId) -> Self { Self(Arc::new(InteropErrorInner::ImpossibleConversion { into })) } + /// Thrown if a value was expected to be of one type but was of another pub fn type_mismatch(expected: TypeId, got: Option) -> Self { Self(Arc::new(InteropErrorInner::TypeMismatch { expected, got })) } + /// Identical to [`InteropError::type_mismatch`] but for more abstract types pub fn string_type_mismatch(expected: String, got: Option) -> Self { Self(Arc::new(InteropErrorInner::StringTypeMismatch { expected, @@ -256,20 +264,24 @@ impl InteropError { })) } + /// Thrown if a [`ScriptValue`] could not be converted to the expected type pub fn value_mismatch(expected: TypeId, got: ScriptValue) -> Self { Self(Arc::new(InteropErrorInner::ValueMismatch { expected, got })) } + /// Thrown if a downcast from a reflect reference to a specific type failed pub fn could_not_downcast(from: ReflectReference, to: TypeId) -> Self { Self(Arc::new(InteropErrorInner::CouldNotDowncast { from, to })) } + /// Thrown if a garbage collected allocation was attempted to be accessed pub fn garbage_collected_allocation(reference: ReflectReference) -> Self { Self(Arc::new(InteropErrorInner::GarbageCollectedAllocation { reference, })) } + /// Thrown if a reflection path is invalid pub fn reflection_path_error(error: String, reference: Option) -> Self { Self(Arc::new(InteropErrorInner::ReflectionPathError { error, @@ -277,6 +289,7 @@ impl InteropError { })) } + /// Thrown if an operation is not supported on the given base type, optionally with a value argument that was used to carry it out pub fn unsupported_operation( base: Option, value: Option>, @@ -289,20 +302,24 @@ impl InteropError { })) } + /// Thrown if an invalid index operation was attempted on a value pub fn invalid_index(value: ScriptValue, reason: String) -> Self { Self(Arc::new(InteropErrorInner::InvalidIndex { value, reason })) } + /// Thrown if an entity was missing or invalid pub fn missing_entity(entity: Entity) -> Self { Self(Arc::new(InteropErrorInner::MissingEntity { entity })) } + /// Thrown if a component was invalid pub fn invalid_component(component_id: ComponentId) -> Self { Self(Arc::new(InteropErrorInner::InvalidComponent { component_id, })) } + /// Thrown when an error happens in a function call. The inner error provides details on the error. pub fn function_interop_error( function_info: &FunctionInfo, argument_info: Option<&ArgInfo>, @@ -327,6 +344,9 @@ impl InteropError { })) } + /// Thrown when the error happens after a function call, and an error is thrown by bevy. + /// + /// I.e. mismatch in args, or invalid number of arguments pub fn function_call_error(inner: FunctionError) -> Self { Self(Arc::new(InteropErrorInner::FunctionCallError { inner })) } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 67ebbdca30..6119d90aaf 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -187,8 +187,12 @@ pub fn event_handler( world, ) .map_err(|e| { - // println!("{e:?}"); - e.with_script(script.id.clone()) + e.with_script(script.id.clone()).with_context(&format!( + "Event handling for: Runtime {}, Context: {}, Args: {}", + type_name::(), + type_name::(), + type_name::() + )) }); push_err_and_continue!(errors, handler_result) @@ -199,22 +203,12 @@ pub fn event_handler( world.insert_non_send_resource(runtime_container); world.insert_non_send_resource(script_contexts); - handle_script_errors( - world, - &format!( - "Encountered error in event handling for: Runtime {}, Context: {}, Args: {}", - type_name::(), - type_name::(), - type_name::() - ), - errors.into_iter(), - ); + handle_script_errors(world, errors.into_iter()); } /// Handles errors caused by script execution and sends them to the error event channel pub(crate) fn handle_script_errors + Clone>( world: &mut World, - context: &str, errors: I, ) { let mut error_events = world @@ -227,7 +221,7 @@ pub(crate) fn handle_script_errors + Clone>( for error in errors { let arc_world = WorldGuard::new(WorldAccessGuard::new(world)); - bevy::log::error!("{}. {}", context, error.display_with_world(arc_world)); + bevy::log::error!("{}", error.display_with_world(arc_world)); } } From 05001fc0d31bc009697bdea14474e1c570428c5f Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 18:40:05 +0000 Subject: [PATCH 048/217] update to mlua 10.0 --- Cargo.toml | 1 + assets/scripts/bevy_api.lua | 5 +++-- crates/bevy_mod_scripting_core/Cargo.toml | 2 +- crates/languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_lua/src/bindings/reference.rs | 8 ++------ .../src/bindings/script_value.rs | 10 +++++----- .../bevy_mod_scripting_lua/src/bindings/world.rs | 2 +- crates/languages/bevy_mod_scripting_lua/src/lib.rs | 10 +++++----- 8 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ab670e0f95..1a6f1083c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,6 +65,7 @@ bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = " bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.2" } bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.8.0-alpha.2" } test_utils = { path = "crates/test_utils" } +mlua = { version = "0.10" } [dev-dependencies] bevy = { workspace = true, default-features = true } diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 2ceb9880b6..e4b87d38a7 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -6,8 +6,9 @@ function table_to_string(t) return result .. "]" end - + function on_event() + -- send exit event, to finish after one call world:exit() print(entity) @@ -22,7 +23,7 @@ function on_event() print("\noption") -- print(comp:get("option_usize")) - print(comp.option_usie) + print(comp.option_usize) comp.option_usize = 69 print(comp.option_usize) comp.option_usize = nil diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 04806b1ec6..1e47a8ee05 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -23,7 +23,7 @@ doc_always = [] mlua_impls = ["mlua"] [dependencies] -mlua = { version = "0.9", optional = true } +mlua = { optional = true, workspace = true } bevy = { workspace = true, default-features = false, features = [ "bevy_asset", "reflect_functions", diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 22931f6926..94a261292a 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -46,7 +46,7 @@ bevy_mod_scripting_functions = { workspace = true, features = [ "core_functions", ] } bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } -mlua = { version = "0.9", features = ["vendored", "send", "macros"] } +mlua = { workspace = true, features = ["vendored", "send", "macros"] } parking_lot = "0.12.1" serde_json = "1.0.81" anyhow = "1.0.75" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 4fdb0c0254..6efab1958e 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -60,11 +60,7 @@ impl From for LuaReflectReference { } /// Looks up a function in the registry on the given type id -fn lookup_function<'lua>( - lua: &'lua Lua, - key: &str, - type_id: TypeId, -) -> Option, mlua::Error>> { +fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option> { let function = lookup_dynamic_function(lua, key, type_id); function.map(|function| { @@ -103,7 +99,7 @@ fn lookup_dynamic_function_typed<'lua, T: 'static + ?Sized>( } impl UserData for LuaReflectReference { - fn add_methods<'lua, T: UserDataMethods<'lua, Self>>(m: &mut T) { + fn add_methods>(m: &mut T) { m.add_meta_function( MetaMethod::Index, |lua, (self_, key): (LuaReflectReference, LuaScriptValue)| { diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 1d6532e98d..d80d02ba2d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -28,8 +28,8 @@ impl From for LuaScriptValue { } } -impl<'lua> FromLua<'lua> for LuaScriptValue { - fn from_lua(value: mlua::Value<'lua>, lua: &'lua mlua::Lua) -> mlua::Result { +impl FromLua for LuaScriptValue { + fn from_lua(value: mlua::Value, _lua: &mlua::Lua) -> mlua::Result { Ok(match value { Value::Nil => ScriptValue::Unit, Value::Boolean(b) => ScriptValue::Bool(b), @@ -52,7 +52,7 @@ impl<'lua> FromLua<'lua> for LuaScriptValue { _ => { return Err(mlua::Error::FromLuaConversionError { from: value.type_name(), - to: "ScriptValue", + to: "ScriptValue".to_owned(), message: Some("unsupported value type".to_owned()), }) } @@ -61,8 +61,8 @@ impl<'lua> FromLua<'lua> for LuaScriptValue { } } -impl<'lua> IntoLua<'lua> for LuaScriptValue { - fn into_lua(self, lua: &'lua mlua::Lua) -> mlua::Result> { +impl IntoLua for LuaScriptValue { + fn into_lua(self, lua: &mlua::Lua) -> mlua::Result { Ok(match self.0 { ScriptValue::Unit => Value::Nil, ScriptValue::Bool(b) => Value::Boolean(b), diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index c0a7833fe6..02acf96297 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -29,7 +29,7 @@ impl LuaWorld { } impl UserData for LuaWorld { - fn add_methods<'lua, T: UserDataMethods<'lua, Self>>(methods: &mut T) { + fn add_methods>(methods: &mut T) { // methods.add_meta_function( // MetaMethod::Index, // |lua, (world, key): (LuaWorld, String)| { diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 6082f12bf9..fff6a6b5e8 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -35,10 +35,10 @@ pub mod prelude { pub use crate::mlua::{self, prelude::*, Value}; } -pub trait LuaEventArg: Args + for<'l> IntoLuaMulti<'l> {} -impl IntoLuaMulti<'l>> LuaEventArg for T {} +pub trait LuaEventArg: Args + IntoLuaMulti {} +impl LuaEventArg for T {} -pub struct LuaScriptingPlugin IntoLuaMulti<'l>> { +pub struct LuaScriptingPlugin { pub scripting_plugin: ScriptingPlugin, } @@ -147,7 +147,7 @@ pub fn lua_context_reload( } #[allow(clippy::too_many_arguments)] -pub fn lua_handler IntoLuaMulti<'l>>( +pub fn lua_handler( args: A, entity: bevy::ecs::entity::Entity, script_id: &ScriptId, @@ -169,7 +169,7 @@ pub fn lua_handler IntoLuaMulti<'l>>( }; handler - .call::<_, ()>(args) + .call::<()>(args) .map_err(ScriptError::from_mlua_error)?; Ok(()) }) From c805a2b68303757d44171e6ed4c3cb05ff20f957 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 23:09:21 +0000 Subject: [PATCH 049/217] add support for list --- assets/scripts/bevy_api.lua | 2 + .../src/bindings/allocator.rs | 90 +++++------ .../src/bindings/function.rs | 63 ++++---- .../src/bindings/pretty_print.rs | 16 +- .../src/bindings/reference.rs | 140 ++++++++---------- .../src/bindings/script_val.rs | 106 ++++++++++++- .../src/reflection_extensions.rs | 13 ++ .../bevy_mod_scripting_functions/src/core.rs | 4 + .../src/bindings/script_value.rs | 17 ++- examples/lua/bevy_api.rs | 3 + 10 files changed, 296 insertions(+), 158 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index e4b87d38a7..27e458e01e 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -15,6 +15,8 @@ function on_event() print(script) print(world) + print(world:test_vec({entity, entity})[1]) + local my_component_type = world:get_type_by_name("MyComponent") diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index 1f8d5cb01f..175d0270e8 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -5,6 +5,7 @@ use std::any::{Any, TypeId}; use std::cell::UnsafeCell; use std::collections::HashMap; use std::fmt::{Display, Formatter}; +use std::io::Read; use std::sync::Arc; #[derive(Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)] @@ -18,6 +19,10 @@ impl ReflectAllocationId { pub(crate) fn new(id: usize) -> Self { Self(Arc::new(id)) } + + pub fn strong_count(&self) -> usize { + Arc::strong_count(&self.0) + } } /// Pointer which owns the value it points to, and will deallocate it when dropped @@ -45,29 +50,28 @@ impl Drop for OwningPtr { } // yikes, the indirection. I need this to store boxed values too though -#[derive(Clone, Debug)] -pub enum ReflectAllocation { - Double(Arc>), - Single(Arc>), -} +#[derive(Debug)] +pub struct ReflectAllocation(Box>); -unsafe impl Send for ReflectAllocation {} +// unsafe impl Send for ReflectAllocation {} unsafe impl Sync for ReflectAllocation {} impl ReflectAllocation { pub fn get_ptr(&self) -> *mut dyn PartialReflect { - match self { - ReflectAllocation::Double(v) => v.ptr, - ReflectAllocation::Single(v) => v.get(), - } + self.0.as_ref().get() } - pub fn new(value: Arc>) -> Self { - Self::Single(value) + + pub fn new(value: Box) -> Self { + let value: Box> = unsafe { std::mem::transmute(value) }; + Self(value) } - pub fn new_boxed(value: Box) -> Self { - let ptr = Box::leak::<'static>(value); - Self::Double(Arc::new(unsafe { OwningPtr::new(ptr) })) + /// Takes the value out of the allocation. + /// + /// # Safety + /// - Must only be done if no other references to this allocation exist at the same time + pub unsafe fn take(self) -> Box { + std::mem::transmute(self.0) } } @@ -113,36 +117,21 @@ pub struct ReflectAllocator { impl ReflectAllocator { /// Allocates a new [`Reflect`] value and returns an [`AllocationId`] which can be used to access it later. /// Use [`Self::allocate_boxed`] if you already have an allocated boxed value. - pub fn allocate( - &mut self, - value: T, - ) -> (ReflectAllocationId, ReflectAllocation) { - let type_id = value.get_represented_type_info().map(|i| i.type_id()); - - let id = ReflectAllocationId::new(self.allocations.len()); - let index = id.id(); - let value = ReflectAllocation::new(Arc::new(UnsafeCell::new(value))); - self.allocations.insert(id.clone(), value.clone()); - if let Some(type_id) = type_id { - self.types.insert(index, type_id); - } - (id, value) + pub fn allocate(&mut self, value: T) -> ReflectAllocationId { + self.allocate_boxed(Box::new(value)) } - pub fn allocate_boxed( - &mut self, - value: Box, - ) -> (ReflectAllocationId, ReflectAllocation) { + pub fn allocate_boxed(&mut self, value: Box) -> ReflectAllocationId { let type_id = value.get_represented_type_info().map(|i| i.type_id()); let id = ReflectAllocationId::new(self.allocations.len()); let index = id.id(); - let value = ReflectAllocation::new_boxed(value); - self.allocations.insert(id.clone(), value.clone()); + let value = ReflectAllocation::new(value); + self.allocations.insert(id.clone(), value); if let Some(type_id) = type_id { self.types.insert(index, type_id); } - (id, value) + id } // /// Moves the given boxed [`PartialReflect`] value into the allocator, returning an [`AllocationId`] which can be used to access it later @@ -168,16 +157,33 @@ impl ReflectAllocator { // (id, allocation) // } - pub fn get(&self, id: &ReflectAllocationId) -> Option { - self.allocations.get(id).cloned() + // pub fn get(&self, id: &ReflectAllocationId) -> Option { + // self.allocations.get(id).cloned() + // } + + pub fn insert( + &mut self, + id: ReflectAllocationId, + value: ReflectAllocation, + ) -> Option { + self.allocations.insert(id, value) + } + + pub fn remove(&mut self, id: &ReflectAllocationId) -> Option { + println!("removing {:?}", id); + self.allocations.remove(id) } pub fn get_type_id(&self, id: &ReflectAllocationId) -> Option { self.types.get(&id.id()).cloned() } - pub fn get_mut(&self, id: &ReflectAllocationId) -> Option { - self.allocations.get(id).cloned() + pub fn get_mut(&mut self, id: &ReflectAllocationId) -> Option<&mut ReflectAllocation> { + self.allocations.get_mut(id) + } + + pub fn get(&self, id: &ReflectAllocationId) -> Option<&ReflectAllocation> { + self.allocations.get(id) } /// Deallocates the [`PartialReflect`] value with the given [`AllocationId`] @@ -199,7 +205,7 @@ mod test { #[test] fn test_reflect_allocator_garbage_clean() { let mut allocator = ReflectAllocator::default(); - let (id, _) = allocator.allocate(0); + let id = allocator.allocate(0); assert_eq!(allocator.allocations.len(), 1); drop(id); allocator.clean_garbage_allocations(); @@ -209,7 +215,7 @@ mod test { #[test] fn test_reflect_allocator_garbage_clean_no_garbage() { let mut allocator = ReflectAllocator::default(); - let (_id, _) = allocator.allocate(0); + let _id = allocator.allocate(0); assert_eq!(allocator.allocations.len(), 1); allocator.clean_garbage_allocations(); assert_eq!(allocator.allocations.len(), 1); diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index c9dcde9644..d0226dc675 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -119,7 +119,7 @@ impl CallableWithAccess for DynamicFunction<'_> { Return::Ref(ref_) => ref_.into_script_value(world), Return::Mut(mut_ref) => mut_ref.into_script_value(world), })? - .map_err(|e| InteropError::function_interop_error(self.info(), None, e).into()) + .map_err(|e| InteropError::function_interop_error(self.info(), None, e)) } } @@ -159,8 +159,12 @@ impl> IntoArgsListWithAccess for I { match value { // TODO: I'd see the logic be a bit cleaner, this if is needed to support 'Raw' ScriptValue arguments // as we do not want to claim any access since we're not using the value yet + + // for owned values the from_script_value impl for ReflectReferences will deal with the case + // here we try to make an actual reference, or otherwise clone the value ScriptValue::Reference(arg_ref) - if argument_info.type_id() != TypeId::of::() => + if argument_info.type_id() != TypeId::of::() + && matches!(argument_info.ownership(), Ownership::Mut | Ownership::Ref) => { let access_id = ReflectAccessId::for_reference(arg_ref.base.base_id.clone()) .ok_or_else(|| { @@ -171,30 +175,39 @@ impl> IntoArgsListWithAccess for I { ) })?; - let is_write = matches!(argument_info.ownership(), Ownership::Mut); - - let success = if is_write { - world.claim_write_access(access_id) - } else { - world.claim_read_access(access_id) + let arg = match argument_info.ownership() { + Ownership::Ref => { + if world.claim_read_access(access_id) { + accesses.push((access_id, Ownership::Ref)); + let ref_ = unsafe { arg_ref.reflect_unsafe(world.clone()) }; + if let Ok(ref_) = ref_ { + Ok(ArgValue::Ref(ref_)) + } else { + Err(ref_.expect_err("invariant")) + } + } else { + Err(InteropError::cannot_claim_access(arg_ref.base.clone())) + } + } + Ownership::Mut => { + if world.claim_write_access(access_id) { + accesses.push((access_id, Ownership::Mut)); + let mut_ref = unsafe { arg_ref.reflect_mut_unsafe(world.clone()) }; + if let Ok(mut_ref) = mut_ref { + Ok(ArgValue::Mut(mut_ref)) + } else { + Err(mut_ref.expect_err("invariant")) + } + } else { + Err(InteropError::cannot_claim_access(arg_ref.base.clone())) + } + } + _ => unreachable!(), }; - if !success { - release_accesses(&mut accesses); - return Err(InteropError::function_interop_error( - function_info, - Some(argument_info), - InteropError::cannot_claim_access(arg_ref.base.clone()), - ) - .into()); - } - - accesses.push((access_id, argument_info.ownership())); + // TODO: check if the value is actually a `dyn Reflect` and not a dynamic - let val = - unsafe { arg_ref.clone().into_arg_value(world.clone(), argument_info) }; - let val = match val { - Ok(v) => v, + match arg { Err(e) => { release_accesses(&mut accesses); return Err(InteropError::function_interop_error( @@ -203,8 +216,8 @@ impl> IntoArgsListWithAccess for I { e, )); } - }; - arg_list.push(val); + Ok(arg) => arg_list.push(arg), + } } ScriptValue::World => { arg_list.push(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard( diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 946f50066d..10f2f86ebe 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -293,10 +293,10 @@ impl ReflectReferencePrinter { ReflectRef::Function(f) => { output.push_str("Function("); output.push_str( - &f.info() + f.info() .name() .unwrap_or(&Cow::Borrowed("")) - .to_string(), + .as_ref(), ); output.push(')'); } @@ -327,7 +327,7 @@ macro_rules! impl_dummy_display ( ($t:ty) => { impl std::fmt::Display for $t { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "Displaying {} without world access: {:#?}", stringify!($t), self); + write!(f, "Displaying {} without world access: {:#?}", stringify!($t), self)?; Ok(()) } } @@ -399,6 +399,16 @@ impl DisplayWithWorld for ScriptValue { ScriptValue::String(cow) => cow.to_string(), ScriptValue::World => "World".to_owned(), ScriptValue::Error(script_error) => script_error.to_string(), + ScriptValue::List(vec) => { + let mut string = String::new(); + ReflectReferencePrinter::pretty_print_key_values( + BracketType::Square, + vec.iter() + .map(|v| (None::, v.display_value_with_world(world.clone()))), + &mut string, + ); + string + } } } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 0a08044573..3cbeb86a50 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -24,8 +24,8 @@ use bevy::{ ptr::Ptr, reflect::{ func::{args::ArgInfo, ArgValue}, - ParsedPath, PartialReflect, ReflectFromPtr, ReflectMut, ReflectPath, ReflectPathError, - ReflectRef, TypeData, + ParsedPath, PartialReflect, ReflectFromPtr, ReflectFromReflect, ReflectMut, ReflectPath, + ReflectPathError, ReflectRef, TypeData, }, }; use itertools::Either; @@ -97,7 +97,7 @@ impl ReflectReference { std::any::type_name::() ) }); - let (id, _) = allocator.allocate(value); + let id = allocator.allocate(value); ReflectReference { base: ReflectBaseType { type_id, @@ -120,7 +120,7 @@ impl ReflectReference { std::any::type_name_of_val(value.as_ref()) ) }); - let (id, _) = allocator.allocate_boxed(value); + let id = allocator.allocate_boxed(value); ReflectReference { base: ReflectBaseType { type_id, @@ -174,12 +174,63 @@ impl ReflectReference { })? } - /// Reflects into the value of the reference, cloning it using [`PartialReflect::clone_value`] or if it's a world reference, cloning the world access. - pub fn clone_value(&self, world: WorldGuard) -> Result, InteropError> { + /// Attempts to create a [`Box`] from the reference. This is possible using a few strategies: + /// - If the reference is to a world, a [`WorldCallbackAccess`] is created and boxed + /// - If the reference is to an allocation with no reflection path, the value is taken as is. + /// - If the reference has a [`bevy::reflect::ReflectFromReflect`] type data associated with it, the value is cloned using that impl. + /// - If all above fails, [`bevy::reflect::PartialReflect::clone_value`] is used to clone the value. + /// + pub fn to_owned_value( + &self, + world: WorldGuard, + ) -> Result, InteropError> { if matches!(self.base.base_id, ReflectBase::World) { return Ok(Box::new(WorldCallbackAccess::from_guard(world))); } - self.with_reflect(world, |r| r.clone_value()) + + if let ReflectBase::Owned(id) = &self.base.base_id { + if self.reflect_path.is_empty() && id.strong_count() == 0 { + println!( + "Trying to access allocation in owned value {}", + self.display_value_with_world(world.clone()) + ); + let allocator = world.allocator(); + let mut allocator = allocator.write(); + let arc = allocator + .remove(id) + .ok_or_else(|| InteropError::garbage_collected_allocation(self.clone()))?; + + let access_id = ReflectAccessId::for_allocation(id.clone()); + if world.claim_write_access(access_id) { + // Safety: we claim write access, nobody else is accessing this + if unsafe { &*arc.get_ptr() }.try_as_reflect().is_some() { + // Safety: the only accesses exist in this function + unsafe { world.release_access(access_id) }; + return Ok(unsafe { arc.take() }); + } else { + unsafe { world.release_access(access_id) }; + } + } + allocator.insert(id.clone(), arc); + } + } + + // try from reflect + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + let from_reflect: Option<&ReflectFromReflect> = + type_registry.get_type_data(self.base.type_id); + + self.with_reflect(world, |r| { + if let Some(from_reflect) = from_reflect { + let from_reflect = from_reflect.from_reflect(r); + if let Some(from_reflect) = from_reflect { + return from_reflect.into_partial_reflect(); + } + } + r.clone_value() + }) } /// The way to access the value of the reference, that is the pointed-to value. @@ -261,79 +312,6 @@ impl ReflectReference { } } - /// Converts the reference into an argument that can be consumed by a dynamic function. - /// - /// In the case that the underlying value is dynamic, this will convert to an [`ArgValue::Owned`] Which notably will not be directly usable by the function. - /// To use the output you must make sure your calling mechanism is lenient enough to accept Owned variants in place of refs/muts. - /// - /// Or alternatively convert any non concrete types to concrete types using `from_reflect` before calling this function. - /// - /// # Safety - /// - The caller must ensure this reference has permission to access the underlying value - pub unsafe fn into_arg_value<'w>( - self, - world: WorldGuard<'w>, - arg_info: &ArgInfo, - ) -> Result, InteropError> { - if ReflectBase::World == self.base.base_id { - // Safety: we already have an Arc> so creating a new one from the existing one is safe - // as the caller of this function will make sure the Arc is dropped after the lifetime 'w is done. - let new_guard = WorldCallbackAccess::from_guard(world.clone()); - new_guard.read().unwrap(); - return Ok(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard( - world, - )))); - } - - match arg_info.ownership() { - bevy::reflect::func::args::Ownership::Ref => { - let mut ref_ = unsafe { self.reflect_unsafe(world.clone())? }; - - if ref_.is_dynamic() { - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - let boxed = - ::from_reflect(ref_, world)? - .into_partial_reflect(); - let (_, allocation) = allocator.allocate_boxed(boxed); - // Safety: - // we are the only ones with this id, nobody else can touch this. - // we only need to make sure this doesn't get dropped before we're done with it - // the only time that will happen is when ReflectAllocator::clean_garbage_allocations is called - // this will not happen while script event handlers are running - ref_ = unsafe { &*allocation.get_ptr() }; - } - Ok(ArgValue::Ref(ref_)) - } - bevy::reflect::func::args::Ownership::Mut => { - let mut mut_ = unsafe { self.reflect_mut_unsafe(world.clone())? }; - - if mut_.is_dynamic() { - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - let boxed = - ::from_reflect(mut_, world)? - .into_partial_reflect(); - let (_, allocation) = allocator.allocate_boxed(boxed); - // Safety: - // same as the ref branch - mut_ = unsafe { &mut *allocation.get_ptr() }; - } - - Ok(ArgValue::Mut(mut_)) - } - _ => { - let ref_ = unsafe { self.reflect_unsafe(world.clone())? }; - Ok(ArgValue::Owned( - ::from_reflect(ref_, world)? - .into_partial_reflect(), - )) - } - } - } - /// Retrieves a reference to the underlying `dyn PartialReflect` type valid for the 'w lifetime of the world cell /// # Safety /// @@ -404,7 +382,7 @@ impl ReflectReference { let allocator = world.allocator(); let allocator = allocator.read(); let arc = allocator - .get_mut(id) + .get(id) .ok_or_else(|| InteropError::garbage_collected_allocation(self.clone()))?; // Safety: caller promises this is fine :) diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs index d19902d882..bdbf148bf9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -6,8 +6,8 @@ use std::{ }; use bevy::reflect::{ - Access, DynamicEnum, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, PartialReflect, - Reflect, + Access, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, + PartialReflect, Reflect, ReflectFromReflect, TypeData, }; use crate::{ @@ -32,6 +32,8 @@ pub enum ScriptValue { Float(f64), /// Represents a string value. String(Cow<'static, str>), + /// Represents a list of other things passed by value + List(Vec), /// Represents a reference to a value. Reference(ReflectReference), /// Represents any error, will be thrown when returned to a script @@ -78,6 +80,12 @@ impl From> for ScriptValue { } } +impl From> for ScriptValue { + fn from(value: Vec) -> Self { + ScriptValue::List(value) + } +} + impl From for ScriptValue { fn from(value: ReflectReference) -> Self { ScriptValue::Reference(value) @@ -301,6 +309,11 @@ impl IntoScriptValue for &dyn PartialReflect { return inner.into_script_value(world); } + if let Ok(list) = self.as_list() { + let list: Vec<_> = list.collect(); + return list.into_script_value(world); + } + // as a last resort we just allocate the value and return a reference to it let reflect_reference = self.allocate_cloned(world.clone()); ReflectReference::into_script_value(reflect_reference, world) @@ -316,6 +329,16 @@ impl IntoScriptValue for Option<&dyn PartialReflect> { } } +impl IntoScriptValue for Vec<&dyn PartialReflect> { + fn into_script_value(mut self, world: WorldGuard) -> Result { + let mut vec = Vec::with_capacity(self.len()); + for v in self.iter_mut() { + vec.push(v.into_script_value(world.clone())?); + } + Ok(ScriptValue::List(vec)) + } +} + impl IntoScriptValue for ReflectReference { fn into_script_value(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Reference(self)) @@ -418,6 +441,12 @@ impl FromScriptValue for dyn PartialReflect { target_type_id, ) { Some(opt) + } else if let Some(vec) = >::from_script_value( + value.clone(), + world.clone(), + target_type_id, + ) { + Some(vec) } else { ReflectReference::from_script_value(value, world.clone(), target_type_id) } @@ -440,11 +469,11 @@ impl FromScriptValue for Option<&dyn PartialReflect> { let inner_type_id = type_info.option_inner_type().expect("invariant"); - match value { + let dynamic = match value { ScriptValue::Unit => { let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); dynamic_none.set_represented_type(Some(type_info)); - Some(Ok(Box::new(dynamic_none))) + Box::new(dynamic_none) } v => { let inner = match ::from_script_value( @@ -462,8 +491,73 @@ impl FromScriptValue for Option<&dyn PartialReflect> { DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), ); dynamic_some.set_represented_type(Some(type_info)); - Some(Ok(Box::new(dynamic_some))) + Box::new(dynamic_some) + } + }; + + match type_registry.get_type_data::(target_type_id) { + Some(from_reflect) => from_reflect + .from_reflect(dynamic.as_partial_reflect()) + .map(|v| Ok(v.into_partial_reflect())), + None => Some(Err(InteropError::missing_type_data( + target_type_id, + "ReflectFromReflect".to_owned(), + ))), + } + } +} + +impl FromScriptValue for Vec<&dyn PartialReflect> { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type_id: TypeId, + ) -> Option, InteropError>> { + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + let type_info = type_registry.get_type_info(target_type_id)?; + + if !type_info.is_list() { + return None; + }; + + let inner_type_id = type_info.list_inner_type().expect("invariant"); + + let dynamic = match value { + ScriptValue::List(vec) => { + let mut dynamic_list = DynamicList::default(); + dynamic_list.set_represented_type(Some(type_info)); + + for v in vec.into_iter() { + let inner = match ::from_script_value( + v, + world.clone(), + inner_type_id, + ) { + Some(Ok(inner)) => inner, + Some(Err(e)) => return Some(Err(e)), + None => return None, + }; + + dynamic_list.push_box(inner); + } + Box::new(dynamic_list) } + ScriptValue::Reference(reflect_reference) => { + // for references we assume they point to a list already, we can safely + return Some(reflect_reference.to_owned_value(world)); + } + _ => return Some(Err(InteropError::value_mismatch(target_type_id, value))), + }; + + match type_registry.get_type_data::(target_type_id) { + Some(from_reflect) => from_reflect + .from_reflect(dynamic.as_partial_reflect()) + .map(|v| Ok(v.into_partial_reflect())), + None => Some(Err(InteropError::missing_type_data( + target_type_id, + "ReflectFromReflect".to_owned(), + ))), } } } @@ -475,7 +569,7 @@ impl FromScriptValue for ReflectReference { target_type: TypeId, ) -> Option, InteropError>> { match value { - ScriptValue::Reference(ref_) => Some(ref_.clone_value(world)), + ScriptValue::Reference(ref_) => Some(ref_.to_owned_value(world)), _ => None, } } diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 3ff9b72263..f02ceea7b1 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -375,6 +375,8 @@ impl PartialReflectExt for T { } pub trait TypeInfoExtensions { + fn list_inner_type(&self) -> Option; + fn is_list(&self) -> bool; fn is_option(&self) -> bool; fn option_inner_type(&self) -> Option; fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool; @@ -385,6 +387,13 @@ impl TypeInfoExtensions for TypeInfo { self.is_type(Some("core"), "Option") } + fn is_list(&self) -> bool { + match self { + TypeInfo::List(_) => true, + _ => false, + } + } + fn option_inner_type(&self) -> Option { if self.is_option() { self.generics().first().map(|g| g.type_id()) @@ -393,6 +402,10 @@ impl TypeInfoExtensions for TypeInfo { } } + fn list_inner_type(&self) -> Option { + Some(self.as_list().ok()?.item_ty().id()) + } + fn is_type(&self, crate_name: Option<&str>, type_ident: &str) -> bool { self.type_path_table().ident() == Some(type_ident) && self.type_path_table().crate_name() == crate_name diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 1de9f5db8a..cd56f52ad7 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -34,6 +34,10 @@ impl Plugin for CoreFunctionsPlugin { fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) + .overwrite( + "test_vec", + |s: WorldCallbackAccess, entities: Vec| entities, + ) .overwrite("spawn", |s: WorldCallbackAccess| s.spawn()) .overwrite( "get_type_by_name", diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index d80d02ba2d..1caa312150 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -37,7 +37,14 @@ impl FromLua for LuaScriptValue { Value::Integer(i) => ScriptValue::Integer(i), Value::Number(n) => ScriptValue::Float(n), Value::String(s) => ScriptValue::String(s.to_str()?.to_owned().into()), - // Value::Table(table) => todo!(), + Value::Table(table) => { + let mut vec = Vec::with_capacity(table.len()? as usize); + for i in table.sequence_values() { + let v: LuaScriptValue = i?; + vec.push(v.into()); + } + ScriptValue::List(vec) + } // Value::Function(function) => todo!(), // Value::Thread(thread) => todo!(), Value::UserData(ud) => { @@ -74,6 +81,14 @@ impl IntoLua for LuaScriptValue { } ScriptValue::Reference(r) => LuaReflectReference::from(r).into_lua(lua)?, ScriptValue::Error(script_error) => return Err(mlua::Error::external(script_error)), + ScriptValue::List(vec) => { + let table = lua.create_table_from( + vec.into_iter() + .enumerate() + .map(|(k, v)| (k + 1, LuaScriptValue::from(v))), + )?; + Value::Table(table) + } }) } } diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs index 073e3134cb..257e4e4aa1 100644 --- a/examples/lua/bevy_api.rs +++ b/examples/lua/bevy_api.rs @@ -71,6 +71,9 @@ pub fn send_event(mut writer: EventWriter>) { fn main() -> std::io::Result<()> { let mut app = App::new(); + app.register_type::>(); + app.register_type_data::, ReflectFromReflect>(); + app.add_plugins(DefaultPlugins) .add_plugins(LuaScriptingPlugin::<()>::default()) .add_plugins(BevyFunctionsPlugin) From 6c339ced125212c577902a18bb0cb9bd752c430a Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 15 Dec 2024 23:21:52 +0000 Subject: [PATCH 050/217] refactor a bit --- assets/scripts/bevy_api.lua | 2 ++ .../src/bindings/script_val.rs | 6 ++++- .../bevy_mod_scripting_functions/src/core.rs | 25 +++++++++---------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 27e458e01e..1cdfd3379c 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -33,6 +33,8 @@ function on_event() print("\nvec") -- print(table_to_string(comp.vec_of_usize)) comp.vec_of_usize = {42,69,72} + comp.vec_of_usize[1] = 612312312 + print(table_to_string(comp.vec_of_usize)) -- comp.vec_of_usize[1] = 0 -- print(comp.vec_of_usize[2]) -- print(table_to_string(comp.vec_of_usize)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs index bdbf148bf9..ebccab240e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs @@ -42,7 +42,11 @@ pub enum ScriptValue { World, } -// impl Into for ScriptResult<> +impl From<()> for ScriptValue { + fn from(_: ()) -> Self { + ScriptValue::Unit + } +} impl From for ScriptValue { fn from(value: bool) -> Self { diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index cd56f52ad7..c9a2ae4459 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -12,6 +12,7 @@ use bindings::{ ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }; +use error::InteropError; use reflection_extensions::TypeIdExtensions; use crate::namespaced_register::NamespaceBuilder; @@ -101,7 +102,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let path: ParsedPath = key.try_into().unwrap(); self_.index_path(path); - self_ + let r: ScriptValue = self_ .with_reflect_mut(world.clone(), |r| { let target_type_id = r .get_represented_type_info() @@ -112,14 +113,13 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe world.clone(), target_type_id, ) - .transpose() - .unwrap() - .unwrap(); + .ok_or_else(|| InteropError::impossible_conversion(target_type_id))??; r.try_apply(other.as_partial_reflect()).unwrap(); - ScriptValue::Unit + Ok::<_, InteropError>(()) }) - .unwrap(); + .into(); + return r; } ScriptValue::Unit }, @@ -134,9 +134,9 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let world = world.read().expect("stale world"); let mut path: ParsedPath = key.try_into().unwrap(); path.convert_to_0_indexed(); - self_.index_path(path); - self_ + + let r: ScriptValue = self_ .with_reflect_mut(world.clone(), |r| { let target_type_id = r .get_represented_type_info() @@ -147,14 +147,13 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe world.clone(), target_type_id, ) - .transpose() - .unwrap() - .unwrap(); + .ok_or_else(|| InteropError::impossible_conversion(target_type_id))??; r.try_apply(other.as_partial_reflect()).unwrap(); - ScriptValue::Unit + Ok::<_, InteropError>(()) }) - .unwrap(); + .into(); + return r; } ScriptValue::Unit }, From 6b1f0412625c3a73819080401e0aaeb9824b0d0b Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 16 Dec 2024 00:13:54 +0000 Subject: [PATCH 051/217] move script value things into another module --- .../src/bindings/function.rs | 2 +- .../src/bindings/mod.rs | 2 +- .../src/bindings/pretty_print.rs | 4 +- .../src/bindings/script_val.rs | 1620 ----------------- .../src/bindings/script_value/from.rs | 580 ++++++ .../src/bindings/script_value/into.rs | 293 +++ .../src/bindings/script_value/mod.rs | 785 ++++++++ crates/bevy_mod_scripting_core/src/lib.rs | 2 +- .../src/reflection_extensions.rs | 4 +- .../bevy_mod_scripting_functions/src/core.rs | 2 +- .../src/bindings/reference.rs | 2 +- .../src/bindings/script_value.rs | 2 +- 12 files changed, 1669 insertions(+), 1629 deletions(-) delete mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_val.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index d0226dc675..a1ad32357a 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -13,7 +13,7 @@ use crate::error::{InteropError, ScriptError, ScriptResult}; use super::{ access_map::ReflectAccessId, pretty_print::DisplayWithWorld, - script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, + script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectBase, ReflectReference, WorldAccessGuard, WorldCallbackAccess, WorldGuard, }; diff --git a/crates/bevy_mod_scripting_core/src/bindings/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/mod.rs index d96e5fc35d..4ce76e7276 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/mod.rs @@ -5,7 +5,7 @@ pub mod pretty_print; // pub mod proxy; pub mod query; pub mod reference; -pub mod script_val; +pub mod script_value; pub mod world; pub use {allocator::*, query::*, reference::*, world::*}; diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 10f2f86ebe..7ed86f7ad9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -1,6 +1,8 @@ use crate::reflection_extensions::TypeIdExtensions; -use super::{script_val::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldGuard}; +use super::{ + script_value::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldGuard, +}; use bevy::reflect::{PartialReflect, ReflectRef}; use itertools::Itertools; use std::{any::TypeId, borrow::Cow}; diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs b/crates/bevy_mod_scripting_core/src/bindings/script_val.rs deleted file mode 100644 index ebccab240e..0000000000 --- a/crates/bevy_mod_scripting_core/src/bindings/script_val.rs +++ /dev/null @@ -1,1620 +0,0 @@ -use std::{ - any::{type_name, TypeId}, - borrow::Cow, - ffi::{CStr, CString, OsStr, OsString}, - path::{Path, PathBuf}, -}; - -use bevy::reflect::{ - Access, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, - PartialReflect, Reflect, ReflectFromReflect, TypeData, -}; - -use crate::{ - error::{InteropError, ScriptError, ScriptResult}, - reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, -}; - -use super::{pretty_print::DisplayWithWorld, ReflectReference, WorldGuard}; - -/// An abstraction of values that can be passed to and from scripts. -/// This allows us to re-use logic between scripting languages. -#[derive(Debug, Clone, PartialEq, Reflect)] -#[reflect(opaque)] -pub enum ScriptValue { - /// Represents the absence of a value. - Unit, - /// Represents a boolean value. - Bool(bool), - /// Represents an integer value with at most 64 bits. - Integer(i64), - /// Represents a floating point value with at most 64 bits. - Float(f64), - /// Represents a string value. - String(Cow<'static, str>), - /// Represents a list of other things passed by value - List(Vec), - /// Represents a reference to a value. - Reference(ReflectReference), - /// Represents any error, will be thrown when returned to a script - Error(ScriptError), - /// A placeholder for a [`crate::bindings::WorldCallbackAccess`] value. - World, -} - -impl From<()> for ScriptValue { - fn from(_: ()) -> Self { - ScriptValue::Unit - } -} - -impl From for ScriptValue { - fn from(value: bool) -> Self { - ScriptValue::Bool(value) - } -} - -impl From for ScriptValue { - fn from(value: i64) -> Self { - ScriptValue::Integer(value) - } -} - -impl From for ScriptValue { - fn from(value: f64) -> Self { - ScriptValue::Float(value) - } -} - -impl From<&'static str> for ScriptValue { - fn from(value: &'static str) -> Self { - ScriptValue::String(value.into()) - } -} - -impl From for ScriptValue { - fn from(value: String) -> Self { - ScriptValue::String(value.into()) - } -} - -impl From> for ScriptValue { - fn from(value: Cow<'static, str>) -> Self { - ScriptValue::String(value) - } -} - -impl From> for ScriptValue { - fn from(value: Vec) -> Self { - ScriptValue::List(value) - } -} - -impl From for ScriptValue { - fn from(value: ReflectReference) -> Self { - ScriptValue::Reference(value) - } -} - -impl From for ScriptValue { - fn from(value: ScriptError) -> Self { - ScriptValue::Error(value) - } -} - -impl From for ScriptValue { - fn from(value: InteropError) -> Self { - ScriptValue::Error(ScriptError::new(value)) - } -} - -impl> From> for ScriptValue { - fn from(value: Option) -> Self { - match value { - Some(v) => v.into(), - None => ScriptValue::Unit, - } - } -} - -impl, E: Into> From> for ScriptValue { - fn from(value: Result) -> Self { - match value { - Ok(v) => v.into(), - Err(e) => ScriptValue::Error(e.into()), - } - } -} - -impl TryFrom for ParsedPath { - type Error = InteropError; - fn try_from(value: ScriptValue) -> Result { - Ok(match value { - ScriptValue::Integer(i) => ParsedPath::from(vec![OffsetAccess { - access: bevy::reflect::Access::ListIndex(i as usize), - offset: Some(1), - }]), - ScriptValue::Float(v) => { - return Err(InteropError::invalid_index( - value, - "Floating point numbers cannot be used to index into reflected values" - .to_owned(), - )) - } - ScriptValue::String(cow) => { - if let Some(tuple_struct_index) = cow.strip_prefix("_") { - if let Ok(index) = tuple_struct_index.parse::() { - let parsed_path = ParsedPath::from(vec![OffsetAccess { - access: bevy::reflect::Access::TupleIndex(index), - offset: Some(1), - }]); - return Ok(parsed_path); - } - } - - match cow { - Cow::Borrowed(v) => ParsedPath::parse_static(v) - .map_err(|e| InteropError::reflection_path_error(e.to_string(), None))?, - Cow::Owned(o) => ParsedPath::parse(&o) - .map_err(|e| InteropError::reflection_path_error(e.to_string(), None))?, - } - } - ScriptValue::Reference(reflect_reference) => { - return Err(InteropError::invalid_index( - ScriptValue::Reference(reflect_reference), - "References cannot be used to index into reflected values".to_owned(), - )) - } - _ => ParsedPath(vec![]), - }) - } -} - -/// A trait for converting a value into a [`ScriptVal`]. -pub trait IntoScriptValue { - fn into_script_value(self, world: WorldGuard) -> Result; -} - -/// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. -pub trait FromScriptValue { - /// Returning None is saying that the conversion is not possible. - /// Returning Some means that the conversion was possible and the result is the converted value or a failure. - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>>; -} - -macro_rules! into_script_value_downcast { - ($self_:ident, $ty:ty, $world:ident $(, $($exp:tt)*)?) => {{ - $self_ - .try_downcast_ref::<$ty>() - .ok_or_else(|| InteropError::type_mismatch( - std::any::TypeId::of::<$ty>(), - $self_ - .get_represented_type_info() - .map(|ti| ti.type_id()), - ))? - $($($exp)*)? - .into_script_value($world.clone()) - }}; -} - -impl IntoScriptValue for &dyn PartialReflect { - fn into_script_value(self, world: WorldGuard) -> Result { - let target_type_id = self - .get_represented_type_info() - .map(|ti| ti.type_id()) - .type_id_or_fake_id(); - - match target_type_id { - // for arbitrary result types we support ScriptValue returns - _ if TypeId::of::() == target_type_id => { - match self.try_downcast_ref::() { - Some(script_val) => return Ok(script_val.clone()), - None => { - return Err(InteropError::type_mismatch( - TypeId::of::(), - Some(target_type_id), - )) - } - } - } - _ if TypeId::of::<()>() == target_type_id => { - return into_script_value_downcast!(self, (), world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, bool, world); - } - _ if TypeId::of::<&'static str>() == target_type_id => { - return into_script_value_downcast!(self, &'static str, world); - } - _ if TypeId::of::<&'static CStr>() == target_type_id => { - return into_script_value_downcast!(self, &'static CStr, world); - } - _ if TypeId::of::<&'static OsStr>() == target_type_id => { - return into_script_value_downcast!(self, &'static OsStr, world); - } - _ if TypeId::of::<&'static Path>() == target_type_id => { - return into_script_value_downcast!(self, &'static Path, world); - } - _ if TypeId::of::>() == target_type_id => { - return into_script_value_downcast!(self, Cow<'static, str>, world, .clone()); - } - _ if TypeId::of::>() == target_type_id => { - return into_script_value_downcast!(self, Cow<'static, CStr>, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, f32, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, f64, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i8, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i16, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i32, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i64, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i128, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, isize, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u8, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u16, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u32, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u64, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u128, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, usize, world); - } - _ if TypeId::of::>() == target_type_id => { - return into_script_value_downcast!(self, Box, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, CString, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, String, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, OsString, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, PathBuf, world, .clone()); - } - _ => {} - }; - - // for options we want to convert to - // - the inner type if it's some - // - nil if it's none - // to retain the reference we need to return a reference pointing into the inner type - if let Ok(inner) = self.as_option() { - return inner.into_script_value(world); - } - - if let Ok(list) = self.as_list() { - let list: Vec<_> = list.collect(); - return list.into_script_value(world); - } - - // as a last resort we just allocate the value and return a reference to it - let reflect_reference = self.allocate_cloned(world.clone()); - ReflectReference::into_script_value(reflect_reference, world) - } -} - -impl IntoScriptValue for Option<&dyn PartialReflect> { - fn into_script_value(self, world: WorldGuard) -> Result { - match self { - Some(inner) => inner.into_script_value(world), - None => Ok(ScriptValue::Unit), - } - } -} - -impl IntoScriptValue for Vec<&dyn PartialReflect> { - fn into_script_value(mut self, world: WorldGuard) -> Result { - let mut vec = Vec::with_capacity(self.len()); - for v in self.iter_mut() { - vec.push(v.into_script_value(world.clone())?); - } - Ok(ScriptValue::List(vec)) - } -} - -impl IntoScriptValue for ReflectReference { - fn into_script_value(self, _world: WorldGuard) -> Result { - Ok(ScriptValue::Reference(self)) - } -} - -// macro_rules - -impl FromScriptValue for dyn PartialReflect { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>> { - match target_type_id { - // TODO: if these types ever support reflect, we can uncomment these lines - // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script - // we should instead allocate and leak perhaps. then garbage collect later - - // support for arbitrary arg types - t if t == TypeId::of::() => return Some(Ok(Box::new(value))), - - t if t == TypeId::of::<()>() => { - return <()>::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return bool::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return <&str>::from_script_value(value, world, target_type_id) - } - // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => { - return <&Path>::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::>() => { - return >::from_script_value(value, world, target_type_id) - } - // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => { - return f32::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return f64::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i8::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i16::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i32::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i64::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i128::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return isize::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u8::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u16::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u32::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u64::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u128::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return usize::from_script_value(value, world, target_type_id); - } - // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => { - return ::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return ::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return ::from_script_value(value, world, target_type_id) - } - _ => {} - }; - - if let Some(opt) = >::from_script_value( - value.clone(), - world.clone(), - target_type_id, - ) { - Some(opt) - } else if let Some(vec) = >::from_script_value( - value.clone(), - world.clone(), - target_type_id, - ) { - Some(vec) - } else { - ReflectReference::from_script_value(value, world.clone(), target_type_id) - } - } -} - -impl FromScriptValue for Option<&dyn PartialReflect> { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>> { - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - let type_info = type_registry.get_type_info(target_type_id)?; - - if !type_info.is_option() { - return None; - }; - - let inner_type_id = type_info.option_inner_type().expect("invariant"); - - let dynamic = match value { - ScriptValue::Unit => { - let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); - dynamic_none.set_represented_type(Some(type_info)); - Box::new(dynamic_none) - } - v => { - let inner = match ::from_script_value( - v, - world.clone(), - inner_type_id, - ) { - Some(Ok(inner)) => inner, - Some(Err(e)) => return Some(Err(e)), - None => return None, - }; - - let mut dynamic_some = DynamicEnum::new( - "Some", - DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), - ); - dynamic_some.set_represented_type(Some(type_info)); - Box::new(dynamic_some) - } - }; - - match type_registry.get_type_data::(target_type_id) { - Some(from_reflect) => from_reflect - .from_reflect(dynamic.as_partial_reflect()) - .map(|v| Ok(v.into_partial_reflect())), - None => Some(Err(InteropError::missing_type_data( - target_type_id, - "ReflectFromReflect".to_owned(), - ))), - } - } -} - -impl FromScriptValue for Vec<&dyn PartialReflect> { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>> { - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - let type_info = type_registry.get_type_info(target_type_id)?; - - if !type_info.is_list() { - return None; - }; - - let inner_type_id = type_info.list_inner_type().expect("invariant"); - - let dynamic = match value { - ScriptValue::List(vec) => { - let mut dynamic_list = DynamicList::default(); - dynamic_list.set_represented_type(Some(type_info)); - - for v in vec.into_iter() { - let inner = match ::from_script_value( - v, - world.clone(), - inner_type_id, - ) { - Some(Ok(inner)) => inner, - Some(Err(e)) => return Some(Err(e)), - None => return None, - }; - - dynamic_list.push_box(inner); - } - Box::new(dynamic_list) - } - ScriptValue::Reference(reflect_reference) => { - // for references we assume they point to a list already, we can safely - return Some(reflect_reference.to_owned_value(world)); - } - _ => return Some(Err(InteropError::value_mismatch(target_type_id, value))), - }; - - match type_registry.get_type_data::(target_type_id) { - Some(from_reflect) => from_reflect - .from_reflect(dynamic.as_partial_reflect()) - .map(|v| Ok(v.into_partial_reflect())), - None => Some(Err(InteropError::missing_type_data( - target_type_id, - "ReflectFromReflect".to_owned(), - ))), - } - } -} - -impl FromScriptValue for ReflectReference { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - match value { - ScriptValue::Reference(ref_) => Some(ref_.to_owned_value(world)), - _ => None, - } - } -} - -impl IntoScriptValue for () { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Unit) - } -} - -impl IntoScriptValue for &'static str { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.into())) - } -} - -impl IntoScriptValue for &'static CStr { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string_lossy())) - } -} - -impl IntoScriptValue for &'static OsStr { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string_lossy())) - } -} - -impl IntoScriptValue for &'static Path { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string_lossy())) - } -} - -impl IntoScriptValue for Cow<'static, str> { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.into_owned().into())) - } -} - -impl IntoScriptValue for Cow<'static, CStr> { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl IntoScriptValue for bool { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Bool(self)) - } -} - -impl IntoScriptValue for f32 { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Float(self as f64)) - } -} - -impl IntoScriptValue for f64 { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Float(self)) - } -} - -macro_rules! into_script_value_integers { - ($($ty:ty),*) => { - $( - impl IntoScriptValue for $ty { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Integer(self as i64)) - } - } - )* - }; -} - -into_script_value_integers!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize); - -impl IntoScriptValue for Box { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string().into())) - } -} - -impl IntoScriptValue for CString { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl IntoScriptValue for String { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.into())) - } -} - -impl IntoScriptValue for OsString { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl IntoScriptValue for PathBuf { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl FromScriptValue for () { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<()>() { - Some(match value { - ScriptValue::Unit => Ok(Box::new(())), - ScriptValue::Reference(ref_) => ref_ - .downcast::<()>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -impl FromScriptValue for bool { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::Bool(v) => Ok(Box::new(v)), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -impl FromScriptValue for &'static str { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<&'static str>() { - Some(match value { - ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(s)), - ScriptValue::Reference(ref_) => ref_ - .downcast::<&'static str>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for Cow<'static, str> { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::>() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(s)), - ScriptValue::Reference(ref_) => ref_ - .downcast::>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for String { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(s.into_owned())), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for f32 { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::Float(v) => Ok(Box::new(v as f32)), - ScriptValue::Integer(v) => Ok(Box::new(v as f32)), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for f64 { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::Float(v) => Ok(Box::new(v)), - ScriptValue::Integer(v) => Ok(Box::new(v as f64)), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -// Macro to implement FromScriptValue for integer types -macro_rules! impl_from_script_value_integer { - ($($t:ty),*) => { - $( - impl FromScriptValue for $t { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<$t>() { - Some(match value { - ScriptValue::Integer(v) => Ok(Box::new(v as $t)), - ScriptValue::Float(v) => Ok(Box::new(v as $t)), - ScriptValue::Reference(ref_) => ref_ - .downcast::<$t>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch( - target_type, - value, - )), - }) - } else { - None - } - } - } - )* - }; -} - -impl_from_script_value_integer!(i8, i16, i32, i64, i128, isize); -impl_from_script_value_integer!(u8, u16, u32, u64, u128, usize); - -impl FromScriptValue for &'static Path { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<&'static Path>() { - Some(match value { - ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(Path::new(s))), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -impl FromScriptValue for PathBuf { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(PathBuf::from(s.into_owned()))), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -// Implementations for additional types - -// impl FromScriptValue for Box { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::>() { -// match value { -// ScriptValue::String(s) => Ok(Box::new(s.into_owned().into_boxed_str())), -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::>())), -// } -// .into()) -// } -// } -// } - -// impl FromScriptValue for CString { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::() { -// match value { -// ScriptValue::String(s) => CString::new(s.into_owned()) -// .map(|cstr| Box::new(cstr) as Box) -// .map_err(|e| { -// InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(e.to_string())), -// } -// .into() -// }), -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::())), -// } -// .into()) -// } -// } -// } - -impl FromScriptValue for OsString { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(OsString::from(s.into_owned()))), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -// impl FromScriptValue for &'static OsStr { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::<&'static OsStr>() { -// match value { -// ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(OsStr::new(s))), -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::<&'static OsStr>())), -// } -// .into()) -// } -// } -// } - -// impl FromScriptValue for &'static CStr { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::<&'static CStr>() { -// match value { -// ScriptValue::String(Cow::Borrowed(s)) => { -// let bytes = s.as_bytes(); -// CStr::from_bytes_with_nul(bytes) -// .map(|cstr| Box::new(cstr) as Box) -// .map_err(|e| { -// InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(e.to_string())), -// } -// .into() -// }) -// } -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::<&'static CStr>())), -// } -// .into()) -// } -// } -// } - -#[cfg(test)] -mod test { - use std::any::Any; - - use bevy::{ - prelude::{AppTypeRegistry, World}, - utils::HashMap, - }; - - use crate::{bindings::WorldAccessGuard, prelude::AppReflectAllocator}; - - use super::*; - - #[test] - fn test_basic_into_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - let guard = WorldGuard::new(guard); - assert_eq!( - ().into_script_value(guard.clone()).unwrap(), - ScriptValue::Unit - ); - assert_eq!( - true.into_script_value(guard.clone()).unwrap(), - ScriptValue::Bool(true) - ); - assert_eq!( - false.into_script_value(guard.clone()).unwrap(), - ScriptValue::Bool(false) - ); - assert_eq!( - 0i64.into_script_value(guard.clone()).unwrap(), - ScriptValue::Integer(0) - ); - assert_eq!( - 0.0f64.into_script_value(guard.clone()).unwrap(), - ScriptValue::Float(0.0) - ); - assert_eq!( - "".into_script_value(guard.clone()).unwrap(), - ScriptValue::String("".into()) - ); - assert_eq!( - "hello".into_script_value(guard.clone()).unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - CString::new("hello") - .unwrap() - .into_script_value(guard.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - OsStr::new("hello") - .into_script_value(guard.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - Path::new("hello").into_script_value(guard.clone()).unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - Cow::Borrowed("hello") - .into_script_value(guard.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - Cow::::Owned("hello".to_string()) - .into_script_value(guard) - .unwrap(), - ScriptValue::String("hello".into()) - ); - } - - #[test] - fn test_reference_into_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let world = WorldAccessGuard::new(&mut world); - - let allocator = world.allocator(); - let mut allocator = allocator.write(); - let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); - let string_reference = ReflectReference::new_allocated("hello", &mut allocator); - let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); - let none_reference = ReflectReference::new_allocated(None::, &mut allocator); - let nested_option_reference = - ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); - let nested_none_reference = - ReflectReference::new_allocated(Some(None::), &mut allocator); - - let vec_reference = ReflectReference::new_allocated(vec![1, 2, 3], &mut allocator); - let map_reference = ReflectReference::new_allocated( - HashMap::from_iter(vec![(1, 2), (3, 4)]), - &mut allocator, - ); - - drop(allocator); - - let world = WorldGuard::new(world); - - assert_eq!( - usize_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Integer(2) - ); - - assert_eq!( - string_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - option_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Integer(2) - ); - - assert_eq!( - none_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Unit - ); - - assert_eq!( - nested_option_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Integer(2) - ); - - assert_eq!( - nested_none_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Unit - ); - - assert_eq!( - vec_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Reference(vec_reference) - ); - - assert_eq!( - map_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Reference(map_reference) - ); - } - - #[test] - fn test_basic_from_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - let guard = WorldGuard::new(guard); - - assert!( - <()>::from_script_value(ScriptValue::Unit, guard.clone(), TypeId::of::<()>()) - .unwrap() - .unwrap() - .reflect_partial_eq(&()) - .unwrap() - ); - - assert!(::from_script_value( - ScriptValue::Bool(true), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&true) - .unwrap()); - - assert!(<&'static str>::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::<&'static str>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&"hello") - .unwrap()); - - assert!(>::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Cow::Borrowed("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&"hello".to_string()) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Float(0.0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0.0f32) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Float(0.0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0.0f64) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i64) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i8) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i16) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i32) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i128) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0isize) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u8) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u16) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u32) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u64) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u128) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0usize) - .unwrap()); - - assert!(<&'static Path>::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::<&'static Path>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Path::new("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&PathBuf::from("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&OsString::from("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&OsString::from("hello")) - .unwrap()); - } - - #[test] - fn test_script_value_reference_from_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - - let allocator = guard.allocator(); - let mut allocator = allocator.write(); - let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); - let string_reference = ReflectReference::new_allocated("hello", &mut allocator); - let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); - let none_reference = ReflectReference::new_allocated(None::, &mut allocator); - let nested_option_reference = - ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); - let nested_none_reference = - ReflectReference::new_allocated(Some(None::), &mut allocator); - - let vec_option_reference = - ReflectReference::new_allocated(vec![Some(1usize), None, Some(3usize)], &mut allocator); - - let type_registry = guard.type_registry(); - let mut type_registry = type_registry.write(); - - type_registry.register::<&'static str>(); - type_registry.register::>(); - type_registry.register::>>(); - type_registry.register::>>(); - - drop(type_registry); - drop(allocator); - let guard = WorldGuard::new(guard); - - assert!(::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&2usize) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Reference(string_reference.clone()), - guard.clone(), - TypeId::of::<&'static str>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&"hello") - .unwrap()); - assert!(::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(2usize)) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&None::) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(Some(2usize))) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(None::)) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Reference(vec_option_reference.clone()), - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&vec![Some(1usize), None, Some(3usize)]) - .unwrap()); - } - - #[test] - pub fn test_script_value_other_from_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - - let type_registry = guard.type_registry(); - let mut type_registry = type_registry.write(); - type_registry.register::>(); - type_registry.register::>>(); - - drop(type_registry); - let guard = WorldGuard::new(guard); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some("hello".to_string())) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&None::) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&None::) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(Some("hello".to_string()))) - .unwrap()); - } -} diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs new file mode 100644 index 0000000000..e8af225790 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs @@ -0,0 +1,580 @@ +use std::{ + any::TypeId, + borrow::Cow, + ffi::OsString, + path::{Path, PathBuf}, +}; + +use bevy::reflect::{ + DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, PartialReflect, ReflectFromReflect, +}; + +use crate::{ + bindings::{ReflectReference, WorldGuard}, + error::InteropError, + reflection_extensions::TypeInfoExtensions, +}; + +use super::{FromScriptValue, ScriptValue}; + +impl FromScriptValue for dyn PartialReflect { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type_id: TypeId, + ) -> Option, InteropError>> { + match target_type_id { + // TODO: if these types ever support reflect, we can uncomment these lines + // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script + // we should instead allocate and leak perhaps. then garbage collect later + + // support for arbitrary arg types + t if t == TypeId::of::() => return Some(Ok(Box::new(value))), + + t if t == TypeId::of::<()>() => { + return <()>::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return bool::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return <&str>::from_script_value(value, world, target_type_id) + } + // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => { + return <&Path>::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::>() => { + return >::from_script_value(value, world, target_type_id) + } + // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => { + return f32::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return f64::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i8::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i16::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i32::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i64::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return i128::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return isize::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u8::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u16::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u32::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u64::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return u128::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return usize::from_script_value(value, world, target_type_id); + } + // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), + // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), + t if t == TypeId::of::() => { + return ::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return ::from_script_value(value, world, target_type_id) + } + t if t == TypeId::of::() => { + return ::from_script_value(value, world, target_type_id) + } + _ => {} + }; + + if let Some(opt) = >::from_script_value( + value.clone(), + world.clone(), + target_type_id, + ) { + Some(opt) + } else if let Some(vec) = >::from_script_value( + value.clone(), + world.clone(), + target_type_id, + ) { + Some(vec) + } else { + ReflectReference::from_script_value(value, world.clone(), target_type_id) + } + } +} + +impl FromScriptValue for Option<&dyn PartialReflect> { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type_id: TypeId, + ) -> Option, InteropError>> { + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + let type_info = type_registry.get_type_info(target_type_id)?; + + if !type_info.is_option() { + return None; + }; + + let inner_type_id = type_info.option_inner_type().expect("invariant"); + + let dynamic = match value { + ScriptValue::Unit => { + let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); + dynamic_none.set_represented_type(Some(type_info)); + Box::new(dynamic_none) + } + v => { + let inner = match ::from_script_value( + v, + world.clone(), + inner_type_id, + ) { + Some(Ok(inner)) => inner, + Some(Err(e)) => return Some(Err(e)), + None => return None, + }; + + let mut dynamic_some = DynamicEnum::new( + "Some", + DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), + ); + dynamic_some.set_represented_type(Some(type_info)); + Box::new(dynamic_some) + } + }; + + match type_registry.get_type_data::(target_type_id) { + Some(from_reflect) => from_reflect + .from_reflect(dynamic.as_partial_reflect()) + .map(|v| Ok(v.into_partial_reflect())), + None => Some(Err(InteropError::missing_type_data( + target_type_id, + "ReflectFromReflect".to_owned(), + ))), + } + } +} + +impl FromScriptValue for Vec<&dyn PartialReflect> { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type_id: TypeId, + ) -> Option, InteropError>> { + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + let type_info = type_registry.get_type_info(target_type_id)?; + + if !type_info.is_list() { + return None; + }; + + let inner_type_id = type_info.list_inner_type().expect("invariant"); + + let dynamic = match value { + ScriptValue::List(vec) => { + let mut dynamic_list = DynamicList::default(); + dynamic_list.set_represented_type(Some(type_info)); + + for v in vec.into_iter() { + let inner = match ::from_script_value( + v, + world.clone(), + inner_type_id, + ) { + Some(Ok(inner)) => inner, + Some(Err(e)) => return Some(Err(e)), + None => return None, + }; + + dynamic_list.push_box(inner); + } + Box::new(dynamic_list) + } + ScriptValue::Reference(reflect_reference) => { + // for references we assume they point to a list already, we can safely + return Some(reflect_reference.to_owned_value(world)); + } + _ => return Some(Err(InteropError::value_mismatch(target_type_id, value))), + }; + + match type_registry.get_type_data::(target_type_id) { + Some(from_reflect) => from_reflect + .from_reflect(dynamic.as_partial_reflect()) + .map(|v| Ok(v.into_partial_reflect())), + None => Some(Err(InteropError::missing_type_data( + target_type_id, + "ReflectFromReflect".to_owned(), + ))), + } + } +} + +impl FromScriptValue for ReflectReference { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + match value { + ScriptValue::Reference(ref_) => Some(ref_.to_owned_value(world)), + _ => None, + } + } +} + +impl FromScriptValue for bool { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::() { + Some(match value { + ScriptValue::Bool(v) => Ok(Box::new(v)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)), + }) + } else { + None + } + } +} + +impl FromScriptValue for &'static str { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::<&'static str>() { + Some(match value { + ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(s)), + ScriptValue::Reference(ref_) => ref_ + .downcast::<&'static str>(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), + }) + } else { + None + } + } +} + +impl FromScriptValue for Cow<'static, str> { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::>() { + Some(match value { + ScriptValue::String(s) => Ok(Box::new(s)), + ScriptValue::Reference(ref_) => ref_ + .downcast::>(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), + }) + } else { + None + } + } +} + +impl FromScriptValue for String { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::() { + Some(match value { + ScriptValue::String(s) => Ok(Box::new(s.into_owned())), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), + }) + } else { + None + } + } +} + +impl FromScriptValue for f32 { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::() { + Some(match value { + ScriptValue::Float(v) => Ok(Box::new(v as f32)), + ScriptValue::Integer(v) => Ok(Box::new(v as f32)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), + }) + } else { + None + } + } +} + +impl FromScriptValue for f64 { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::() { + Some(match value { + ScriptValue::Float(v) => Ok(Box::new(v)), + ScriptValue::Integer(v) => Ok(Box::new(v as f64)), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), + }) + } else { + None + } + } +} + +// Macro to implement FromScriptValue for integer types +macro_rules! impl_from_script_value_integer { + ($($t:ty),*) => { + $( + impl FromScriptValue for $t { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::<$t>() { + Some(match value { + ScriptValue::Integer(v) => Ok(Box::new(v as $t)), + ScriptValue::Float(v) => Ok(Box::new(v as $t)), + ScriptValue::Reference(ref_) => ref_ + .downcast::<$t>(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch( + target_type, + value, + )), + }) + } else { + None + } + } + } + )* + }; +} + +impl_from_script_value_integer!(i8, i16, i32, i64, i128, isize); +impl_from_script_value_integer!(u8, u16, u32, u64, u128, usize); + +impl FromScriptValue for &'static Path { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::<&'static Path>() { + Some(match value { + ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(Path::new(s))), + _ => Err(InteropError::value_mismatch(target_type, value)), + }) + } else { + None + } + } +} + +impl FromScriptValue for PathBuf { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::() { + Some(match value { + ScriptValue::String(s) => Ok(Box::new(PathBuf::from(s.into_owned()))), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)), + }) + } else { + None + } + } +} + +// Implementations for additional types + +// impl FromScriptValue for Box { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::>() { +// match value { +// ScriptValue::String(s) => Ok(Box::new(s.into_owned().into_boxed_str())), +// _ => Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::>())), +// } +// .into()) +// } +// } +// } + +// impl FromScriptValue for CString { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::() { +// match value { +// ScriptValue::String(s) => CString::new(s.into_owned()) +// .map(|cstr| Box::new(cstr) as Box) +// .map_err(|e| { +// InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(e.to_string())), +// } +// .into() +// }), +// _ => Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::())), +// } +// .into()) +// } +// } +// } + +impl FromScriptValue for OsString { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::() { + Some(match value { + ScriptValue::String(s) => Ok(Box::new(OsString::from(s.into_owned()))), + ScriptValue::Reference(ref_) => ref_ + .downcast::(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)).into(), + }) + } else { + None + } + } +} + +// impl FromScriptValue for &'static OsStr { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::<&'static OsStr>() { +// match value { +// ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(OsStr::new(s))), +// _ => Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::<&'static OsStr>())), +// } +// .into()) +// } +// } +// } + +// impl FromScriptValue for &'static CStr { +// fn from_script_value( +// target_type: TypeId, +// value: ScriptValue, +// world: WorldGuard, +// ) -> ScriptResult> { +// if target_type == TypeId::of::<&'static CStr>() { +// match value { +// ScriptValue::String(Cow::Borrowed(s)) => { +// let bytes = s.as_bytes(); +// CStr::from_bytes_with_nul(bytes) +// .map(|cstr| Box::new(cstr) as Box) +// .map_err(|e| { +// InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(e.to_string())), +// } +// .into() +// }) +// } +// _ => Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Owned(value.display_with_world(world))), +// } +// .into()), +// } +// } else { +// Err(InteropError::TypeMismatch { +// expected_type: Cow::Owned(target_type.display_with_world(world)), +// actual_type: Some(Cow::Borrowed(type_name::<&'static CStr>())), +// } +// .into()) +// } +// } +// } diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs new file mode 100644 index 0000000000..9d7ed1380e --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs @@ -0,0 +1,293 @@ +use std::{ + any::TypeId, + borrow::Cow, + ffi::{CStr, CString, OsStr, OsString}, + path::{Path, PathBuf}, +}; + +use bevy::reflect::{ + DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, PartialReflect, ReflectFromReflect, +}; + +use crate::{ + bindings::{ReflectReference, WorldGuard}, + error::InteropError, + reflection_extensions::{PartialReflectExt, TypeIdExtensions}, +}; + +use super::{FromScriptValue, IntoScriptValue, ScriptValue}; + +macro_rules! into_script_value_downcast { + ($self_:ident, $ty:ty, $world:ident $(, $($exp:tt)*)?) => {{ + $self_ + .try_downcast_ref::<$ty>() + .ok_or_else(|| InteropError::type_mismatch( + std::any::TypeId::of::<$ty>(), + $self_ + .get_represented_type_info() + .map(|ti| ti.type_id()), + ))? + $($($exp)*)? + .into_script_value($world.clone()) + }}; +} + +impl IntoScriptValue for &dyn PartialReflect { + fn into_script_value(self, world: WorldGuard) -> Result { + let target_type_id = self + .get_represented_type_info() + .map(|ti| ti.type_id()) + .type_id_or_fake_id(); + + match target_type_id { + // for arbitrary result types we support ScriptValue returns + _ if TypeId::of::() == target_type_id => { + match self.try_downcast_ref::() { + Some(script_val) => return Ok(script_val.clone()), + None => { + return Err(InteropError::type_mismatch( + TypeId::of::(), + Some(target_type_id), + )) + } + } + } + _ if TypeId::of::<()>() == target_type_id => { + return into_script_value_downcast!(self, (), world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, bool, world); + } + _ if TypeId::of::<&'static str>() == target_type_id => { + return into_script_value_downcast!(self, &'static str, world); + } + _ if TypeId::of::<&'static CStr>() == target_type_id => { + return into_script_value_downcast!(self, &'static CStr, world); + } + _ if TypeId::of::<&'static OsStr>() == target_type_id => { + return into_script_value_downcast!(self, &'static OsStr, world); + } + _ if TypeId::of::<&'static Path>() == target_type_id => { + return into_script_value_downcast!(self, &'static Path, world); + } + _ if TypeId::of::>() == target_type_id => { + return into_script_value_downcast!(self, Cow<'static, str>, world, .clone()); + } + _ if TypeId::of::>() == target_type_id => { + return into_script_value_downcast!(self, Cow<'static, CStr>, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, f32, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, f64, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i8, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i16, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i32, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i64, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, i128, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, isize, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u8, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u16, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u32, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u64, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, u128, world); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, usize, world); + } + _ if TypeId::of::>() == target_type_id => { + return into_script_value_downcast!(self, Box, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, CString, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, String, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, OsString, world, .clone()); + } + _ if TypeId::of::() == target_type_id => { + return into_script_value_downcast!(self, PathBuf, world, .clone()); + } + _ => {} + }; + + // for options we want to convert to + // - the inner type if it's some + // - nil if it's none + // to retain the reference we need to return a reference pointing into the inner type + if let Ok(inner) = self.as_option() { + return inner.into_script_value(world); + } + + if let Ok(list) = self.as_list() { + let list: Vec<_> = list.collect(); + return list.into_script_value(world); + } + + // as a last resort we just allocate the value and return a reference to it + let reflect_reference = self.allocate_cloned(world.clone()); + ReflectReference::into_script_value(reflect_reference, world) + } +} + +impl IntoScriptValue for Option<&dyn PartialReflect> { + fn into_script_value(self, world: WorldGuard) -> Result { + match self { + Some(inner) => inner.into_script_value(world), + None => Ok(ScriptValue::Unit), + } + } +} + +impl IntoScriptValue for Vec<&dyn PartialReflect> { + fn into_script_value(mut self, world: WorldGuard) -> Result { + let mut vec = Vec::with_capacity(self.len()); + for v in self.iter_mut() { + vec.push(v.into_script_value(world.clone())?); + } + Ok(ScriptValue::List(vec)) + } +} + +impl IntoScriptValue for ReflectReference { + fn into_script_value(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::Reference(self)) + } +} + +impl IntoScriptValue for () { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::Unit) + } +} + +impl IntoScriptValue for &'static str { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.into())) + } +} + +impl IntoScriptValue for &'static CStr { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.to_string_lossy())) + } +} + +impl IntoScriptValue for &'static OsStr { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.to_string_lossy())) + } +} + +impl IntoScriptValue for &'static Path { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.to_string_lossy())) + } +} + +impl IntoScriptValue for Cow<'static, str> { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.into_owned().into())) + } +} + +impl IntoScriptValue for Cow<'static, CStr> { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl IntoScriptValue for bool { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::Bool(self)) + } +} + +impl IntoScriptValue for f32 { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::Float(self as f64)) + } +} + +impl IntoScriptValue for f64 { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::Float(self)) + } +} + +macro_rules! into_script_value_integers { + ($($ty:ty),*) => { + $( + impl IntoScriptValue for $ty { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::Integer(self as i64)) + } + } + )* + }; +} + +into_script_value_integers!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize); + +impl IntoScriptValue for Box { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.to_string().into())) + } +} + +impl IntoScriptValue for CString { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl IntoScriptValue for String { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String(self.into())) + } +} + +impl IntoScriptValue for OsString { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} + +impl IntoScriptValue for PathBuf { + fn into_script_value(self, _: WorldGuard) -> Result { + Ok(ScriptValue::String( + self.to_string_lossy().into_owned().into(), + )) + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs new file mode 100644 index 0000000000..876ca06fcc --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -0,0 +1,785 @@ +use std::{ + any::{type_name, TypeId}, + borrow::Cow, + ffi::{CStr, CString, OsStr, OsString}, + path::{Path, PathBuf}, +}; + +use bevy::reflect::{ + Access, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, + PartialReflect, Reflect, ReflectFromReflect, TypeData, +}; + +use crate::{ + error::{InteropError, ScriptError, ScriptResult}, + reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, +}; + +mod from; +mod into; +pub use {from::*, into::*}; + +use super::{pretty_print::DisplayWithWorld, ReflectReference, WorldGuard}; + +/// An abstraction of values that can be passed to and from scripts. +/// This allows us to re-use logic between scripting languages. +#[derive(Debug, Clone, PartialEq, Reflect)] +#[reflect(opaque)] +pub enum ScriptValue { + /// Represents the absence of a value. + Unit, + /// Represents a boolean value. + Bool(bool), + /// Represents an integer value with at most 64 bits. + Integer(i64), + /// Represents a floating point value with at most 64 bits. + Float(f64), + /// Represents a string value. + String(Cow<'static, str>), + /// Represents a list of other things passed by value + List(Vec), + /// Represents a reference to a value. + Reference(ReflectReference), + /// Represents any error, will be thrown when returned to a script + Error(ScriptError), + /// A placeholder for a [`crate::bindings::WorldCallbackAccess`] value. + World, +} + +impl From<()> for ScriptValue { + fn from(_: ()) -> Self { + ScriptValue::Unit + } +} + +impl From for ScriptValue { + fn from(value: bool) -> Self { + ScriptValue::Bool(value) + } +} + +impl From for ScriptValue { + fn from(value: i64) -> Self { + ScriptValue::Integer(value) + } +} + +impl From for ScriptValue { + fn from(value: f64) -> Self { + ScriptValue::Float(value) + } +} + +impl From<&'static str> for ScriptValue { + fn from(value: &'static str) -> Self { + ScriptValue::String(value.into()) + } +} + +impl From for ScriptValue { + fn from(value: String) -> Self { + ScriptValue::String(value.into()) + } +} + +impl From> for ScriptValue { + fn from(value: Cow<'static, str>) -> Self { + ScriptValue::String(value) + } +} + +impl From> for ScriptValue { + fn from(value: Vec) -> Self { + ScriptValue::List(value) + } +} + +impl From for ScriptValue { + fn from(value: ReflectReference) -> Self { + ScriptValue::Reference(value) + } +} + +impl From for ScriptValue { + fn from(value: ScriptError) -> Self { + ScriptValue::Error(value) + } +} + +impl From for ScriptValue { + fn from(value: InteropError) -> Self { + ScriptValue::Error(ScriptError::new(value)) + } +} + +impl> From> for ScriptValue { + fn from(value: Option) -> Self { + match value { + Some(v) => v.into(), + None => ScriptValue::Unit, + } + } +} + +impl, E: Into> From> for ScriptValue { + fn from(value: Result) -> Self { + match value { + Ok(v) => v.into(), + Err(e) => ScriptValue::Error(e.into()), + } + } +} + +impl TryFrom for ParsedPath { + type Error = InteropError; + fn try_from(value: ScriptValue) -> Result { + Ok(match value { + ScriptValue::Integer(i) => ParsedPath::from(vec![OffsetAccess { + access: bevy::reflect::Access::ListIndex(i as usize), + offset: Some(1), + }]), + ScriptValue::Float(v) => { + return Err(InteropError::invalid_index( + value, + "Floating point numbers cannot be used to index into reflected values" + .to_owned(), + )) + } + ScriptValue::String(cow) => { + if let Some(tuple_struct_index) = cow.strip_prefix("_") { + if let Ok(index) = tuple_struct_index.parse::() { + let parsed_path = ParsedPath::from(vec![OffsetAccess { + access: bevy::reflect::Access::TupleIndex(index), + offset: Some(1), + }]); + return Ok(parsed_path); + } + } + + match cow { + Cow::Borrowed(v) => ParsedPath::parse_static(v) + .map_err(|e| InteropError::reflection_path_error(e.to_string(), None))?, + Cow::Owned(o) => ParsedPath::parse(&o) + .map_err(|e| InteropError::reflection_path_error(e.to_string(), None))?, + } + } + ScriptValue::Reference(reflect_reference) => { + return Err(InteropError::invalid_index( + ScriptValue::Reference(reflect_reference), + "References cannot be used to index into reflected values".to_owned(), + )) + } + _ => ParsedPath(vec![]), + }) + } +} + +/// A trait for converting a value into a [`ScriptVal`]. +pub trait IntoScriptValue { + fn into_script_value(self, world: WorldGuard) -> Result; +} + +/// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. +pub trait FromScriptValue { + /// Returning None is saying that the conversion is not possible. + /// Returning Some means that the conversion was possible and the result is the converted value or a failure. + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type_id: TypeId, + ) -> Option, InteropError>>; +} + +impl FromScriptValue for () { + fn from_script_value( + value: ScriptValue, + world: WorldGuard, + target_type: TypeId, + ) -> Option, InteropError>> { + if target_type == TypeId::of::<()>() { + Some(match value { + ScriptValue::Unit => Ok(Box::new(())), + ScriptValue::Reference(ref_) => ref_ + .downcast::<()>(world) + .map(|v| Box::new(v) as Box), + _ => Err(InteropError::value_mismatch(target_type, value)), + }) + } else { + None + } + } +} + +#[cfg(test)] +mod test { + use std::any::Any; + + use bevy::{ + prelude::{AppTypeRegistry, World}, + utils::HashMap, + }; + + use crate::{bindings::WorldAccessGuard, prelude::AppReflectAllocator}; + + use super::*; + + #[test] + fn test_basic_into_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + let guard = WorldGuard::new(guard); + assert_eq!( + ().into_script_value(guard.clone()).unwrap(), + ScriptValue::Unit + ); + assert_eq!( + true.into_script_value(guard.clone()).unwrap(), + ScriptValue::Bool(true) + ); + assert_eq!( + false.into_script_value(guard.clone()).unwrap(), + ScriptValue::Bool(false) + ); + assert_eq!( + 0i64.into_script_value(guard.clone()).unwrap(), + ScriptValue::Integer(0) + ); + assert_eq!( + 0.0f64.into_script_value(guard.clone()).unwrap(), + ScriptValue::Float(0.0) + ); + assert_eq!( + "".into_script_value(guard.clone()).unwrap(), + ScriptValue::String("".into()) + ); + assert_eq!( + "hello".into_script_value(guard.clone()).unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + CString::new("hello") + .unwrap() + .into_script_value(guard.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + OsStr::new("hello") + .into_script_value(guard.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + Path::new("hello").into_script_value(guard.clone()).unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + Cow::Borrowed("hello") + .into_script_value(guard.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + Cow::::Owned("hello".to_string()) + .into_script_value(guard) + .unwrap(), + ScriptValue::String("hello".into()) + ); + } + + #[test] + fn test_reference_into_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let world = WorldAccessGuard::new(&mut world); + + let allocator = world.allocator(); + let mut allocator = allocator.write(); + let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); + let string_reference = ReflectReference::new_allocated("hello", &mut allocator); + let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); + let none_reference = ReflectReference::new_allocated(None::, &mut allocator); + let nested_option_reference = + ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); + let nested_none_reference = + ReflectReference::new_allocated(Some(None::), &mut allocator); + + let vec_reference = ReflectReference::new_allocated(vec![1, 2, 3], &mut allocator); + let map_reference = ReflectReference::new_allocated( + HashMap::from_iter(vec![(1, 2), (3, 4)]), + &mut allocator, + ); + + drop(allocator); + + let world = WorldGuard::new(world); + + assert_eq!( + usize_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Integer(2) + ); + + assert_eq!( + string_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::String("hello".into()) + ); + + assert_eq!( + option_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Integer(2) + ); + + assert_eq!( + none_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Unit + ); + + assert_eq!( + nested_option_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Integer(2) + ); + + assert_eq!( + nested_none_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Unit + ); + + assert_eq!( + vec_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Reference(vec_reference) + ); + + assert_eq!( + map_reference + .clone() + .into_script_value(world.clone()) + .unwrap(), + ScriptValue::Reference(map_reference) + ); + } + + #[test] + fn test_basic_from_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + let guard = WorldGuard::new(guard); + + assert!( + <()>::from_script_value(ScriptValue::Unit, guard.clone(), TypeId::of::<()>()) + .unwrap() + .unwrap() + .reflect_partial_eq(&()) + .unwrap() + ); + + assert!(::from_script_value( + ScriptValue::Bool(true), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&true) + .unwrap()); + + assert!(<&'static str>::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::<&'static str>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&"hello") + .unwrap()); + + assert!(>::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Cow::Borrowed("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&"hello".to_string()) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Float(0.0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0.0f32) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Float(0.0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0.0f64) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0i64) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0i8) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0i16) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0i32) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0i128) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0isize) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0u8) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0u16) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0u32) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0u64) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0u128) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Integer(0), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&0usize) + .unwrap()); + + assert!(<&'static Path>::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::<&'static Path>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Path::new("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&PathBuf::from("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&OsString::from("hello")) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&OsString::from("hello")) + .unwrap()); + } + + #[test] + fn test_script_value_reference_from_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + + let allocator = guard.allocator(); + let mut allocator = allocator.write(); + let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); + let string_reference = ReflectReference::new_allocated("hello", &mut allocator); + let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); + let none_reference = ReflectReference::new_allocated(None::, &mut allocator); + let nested_option_reference = + ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); + let nested_none_reference = + ReflectReference::new_allocated(Some(None::), &mut allocator); + + let vec_option_reference = + ReflectReference::new_allocated(vec![Some(1usize), None, Some(3usize)], &mut allocator); + + let type_registry = guard.type_registry(); + let mut type_registry = type_registry.write(); + + type_registry.register::<&'static str>(); + type_registry.register::>(); + type_registry.register::>>(); + type_registry.register::>>(); + + drop(type_registry); + drop(allocator); + let guard = WorldGuard::new(guard); + + assert!(::from_script_value( + ScriptValue::Reference(usize_reference.clone()), + guard.clone(), + TypeId::of::() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&2usize) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(string_reference.clone()), + guard.clone(), + TypeId::of::<&'static str>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&"hello") + .unwrap()); + assert!(::from_script_value( + ScriptValue::Reference(usize_reference.clone()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Some(2usize)) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&None::) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(usize_reference.clone()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Some(Some(2usize))) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Some(None::)) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Reference(vec_option_reference.clone()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&vec![Some(1usize), None, Some(3usize)]) + .unwrap()); + } + + #[test] + pub fn test_script_value_other_from_conversions() { + let mut world = World::new(); + world.insert_resource(AppReflectAllocator::default()); + world.insert_resource(AppTypeRegistry::default()); + let guard = WorldAccessGuard::new(&mut world); + + let type_registry = guard.type_registry(); + let mut type_registry = type_registry.write(); + type_registry.register::>(); + type_registry.register::>>(); + + drop(type_registry); + let guard = WorldGuard::new(guard); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Some("hello".to_string())) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&None::) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::Unit, + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&None::) + .unwrap()); + + assert!(::from_script_value( + ScriptValue::String("hello".into()), + guard.clone(), + TypeId::of::>>() + ) + .unwrap() + .unwrap() + .reflect_partial_eq(&Some(Some("hello".to_string()))) + .unwrap()); + } +} diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index c1c69c21a7..b207afa444 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -4,7 +4,7 @@ use crate::event::ScriptErrorEvent; use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; use bindings::{ - script_val::ScriptValue, AppReflectAllocator, ReflectAllocator, ScriptTypeRegistration, + script_value::ScriptValue, AppReflectAllocator, ReflectAllocator, ScriptTypeRegistration, WorldCallbackAccess, }; use context::{ diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index f02ceea7b1..f0c5eafc26 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -13,11 +13,11 @@ use bevy::reflect::{ }; use itertools::Itertools; -use crate::bindings::script_val::FromScriptValue; +use crate::bindings::script_value::FromScriptValue; use crate::{ bindings::{ pretty_print::DisplayWithWorld, - script_val::{IntoScriptValue, ScriptValue}, + script_value::{IntoScriptValue, ScriptValue}, ReflectReference, WorldAccessGuard, WorldGuard, }, error::InteropError, diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index c9a2ae4459..8f4cabea6c 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -8,7 +8,7 @@ use bevy::{ }; use bevy_mod_scripting_core::*; use bindings::{ - script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, + script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 6efab1958e..a1a29074a1 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -18,7 +18,7 @@ use bevy_mod_scripting_core::{ bindings::{ function::CallableWithAccess, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, - script_val::{FromScriptValue, IntoScriptValue, ScriptValue}, + script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, WorldCallbackAccess, }, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 1caa312150..0f07c0e968 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -1,6 +1,6 @@ use std::ops::{Deref, DerefMut}; -use bevy_mod_scripting_core::bindings::{script_val::ScriptValue, ReflectBase, ReflectReference}; +use bevy_mod_scripting_core::bindings::{script_value::ScriptValue, ReflectBase, ReflectReference}; use mlua::{FromLua, IntoLua, IntoLuaMulti, MultiValue, Value}; use super::reference::LuaReflectReference; From defd0525179de40e53e41dc4deca0f16d321c5cc Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 16 Dec 2024 16:54:28 +0000 Subject: [PATCH 052/217] WIP --- assets/scripts/bevy_api.lua | 1 + .../src/bindings/function.rs | 67 +++++++++++++++++-- .../src/bindings/reference.rs | 19 +----- .../src/bindings/script_value/from.rs | 1 + .../src/bindings/script_value/into.rs | 18 +++-- .../src/bindings/script_value/mod.rs | 41 +++++++++--- crates/bevy_mod_scripting_core/src/error.rs | 49 +++++++++++++- .../src/reflection_extensions.rs | 33 ++++++++- .../bevy_mod_scripting_functions/src/core.rs | 15 ++--- 9 files changed, 193 insertions(+), 51 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 1cdfd3379c..216459edcb 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -19,6 +19,7 @@ function on_event() local my_component_type = world:get_type_by_name("MyComponent") + print("MyComponent type: ", my_component_type:print_value()) local comp = world:get_component(entity, my_component_type) print("Before script: ", comp:print_value()) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function.rs index a1ad32357a..ff2fe32d83 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function.rs @@ -8,7 +8,10 @@ use bevy::reflect::{ PartialReflect, }; -use crate::error::{InteropError, ScriptError, ScriptResult}; +use crate::{ + error::{FlattenError, InteropError, InteropErrorInner, ScriptError, ScriptResult}, + reflection_extensions::{PartialReflectExt, ReturnValExt}, +}; use super::{ access_map::ReflectAccessId, @@ -86,6 +89,12 @@ impl CallableWithAccess for DynamicFunction<'_> { final_args_list = final_args_list.push_arg(next_arg); } + bevy::log::trace!( + "Calling function: {:?} with args: {:?}", + self.info().name(), + final_args_list + ); + let return_val = match self.call(final_args_list) { Ok(return_val) => return_val, Err(e) => { @@ -99,6 +108,12 @@ impl CallableWithAccess for DynamicFunction<'_> { } }; + bevy::log::trace!( + "Function: {:?} returned: {:?}", + self.info().name(), + return_val + ); + let out = f(return_val); // Safety: we have not generated any unsafe aliases // - we are releasing only the access we have claimed @@ -114,11 +129,51 @@ impl CallableWithAccess for DynamicFunction<'_> { args: I, world: Arc, ) -> Result { - self.with_call(args, world.clone(), |r| match r { - Return::Owned(partial_reflect) => partial_reflect.as_ref().into_script_value(world), - Return::Ref(ref_) => ref_.into_script_value(world), - Return::Mut(mut_ref) => mut_ref.into_script_value(world), - })? + bevy::log::debug!("Dynamic call to function: {:?}", self.info().name()); + self.with_call(args, world.clone(), |r| { + let conversion = match r { + Return::Owned(partial_reflect) => { + match partial_reflect.as_ref().into_script_value(world.clone()) { + Err(e) + if matches!( + e.inner(), + InteropErrorInner::BetterConversionExists { .. } + ) => + { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + ReflectReference::new_allocated_boxed(partial_reflect, &mut allocator) + .into_script_value(world.clone()) + } + e => e, + } + } + v => { + let ref_ = v.as_ref(); + + match ref_.into_script_value(world.clone()) { + Err(e) + if matches!( + e.inner(), + InteropErrorInner::BetterConversionExists { .. } + ) => + { + let val = + ::from_reflect_or_clone(ref_, world.clone()); + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + ReflectReference::new_allocated_boxed(val, &mut allocator) + .into_script_value(world.clone()) + } + e => e, + } + } + }; + + conversion + }) + .flatten_interop_error() .map_err(|e| InteropError::function_interop_error(self.info(), None, e)) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 3cbeb86a50..241c224509 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -12,7 +12,7 @@ use crate::{ bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, error::InteropError, prelude::{ReflectAllocator, ScriptResult}, - reflection_extensions::PartialReflectExt, + reflection_extensions::{PartialReflectExt, TypeIdExtensions}, with_access_read, with_access_write, }; use bevy::{ @@ -215,21 +215,8 @@ impl ReflectReference { } } - // try from reflect - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - - let from_reflect: Option<&ReflectFromReflect> = - type_registry.get_type_data(self.base.type_id); - - self.with_reflect(world, |r| { - if let Some(from_reflect) = from_reflect { - let from_reflect = from_reflect.from_reflect(r); - if let Some(from_reflect) = from_reflect { - return from_reflect.into_partial_reflect(); - } - } - r.clone_value() + self.with_reflect(world.clone(), |r| { + ::from_reflect_or_clone(r, world.clone()) }) } diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs index e8af225790..c6d19cf066 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs @@ -129,6 +129,7 @@ impl FromScriptValue for Option<&dyn PartialReflect> { world: WorldGuard, target_type_id: TypeId, ) -> Option, InteropError>> { + println!("Option<&dyn PartialReflect>::from_script_value {:?}", value); let type_registry = world.type_registry(); let type_registry = type_registry.read(); let type_info = type_registry.get_type_info(target_type_id)?; diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs index 9d7ed1380e..c08a5104ee 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs @@ -34,6 +34,8 @@ macro_rules! into_script_value_downcast { impl IntoScriptValue for &dyn PartialReflect { fn into_script_value(self, world: WorldGuard) -> Result { + bevy::log::trace!("Converting {:?} to ScriptValue", self); + let target_type_id = self .get_represented_type_info() .map(|ti| ti.type_id()) @@ -43,6 +45,7 @@ impl IntoScriptValue for &dyn PartialReflect { // for arbitrary result types we support ScriptValue returns _ if TypeId::of::() == target_type_id => { match self.try_downcast_ref::() { + Some(ScriptValue::Error(e)) => return Err(e.clone()), Some(script_val) => return Ok(script_val.clone()), None => { return Err(InteropError::type_mismatch( @@ -144,19 +147,20 @@ impl IntoScriptValue for &dyn PartialReflect { return inner.into_script_value(world); } - if let Ok(list) = self.as_list() { - let list: Vec<_> = list.collect(); - return list.into_script_value(world); - } + // if let Ok(list) = self.as_list() { + // let list: Vec<_> = list.collect(); + // return list.into_script_value(world); + // } - // as a last resort we just allocate the value and return a reference to it - let reflect_reference = self.allocate_cloned(world.clone()); - ReflectReference::into_script_value(reflect_reference, world) + // this is us saying, we cannot convert this into a nice script value + // you're gonna have to allocate and ref to it + Err(InteropError::better_conversion_exists::()) } } impl IntoScriptValue for Option<&dyn PartialReflect> { fn into_script_value(self, world: WorldGuard) -> Result { + bevy::log::trace!("Converting Option {:?} to ScriptValue", self); match self { Some(inner) => inner.into_script_value(world), None => Ok(ScriptValue::Unit), diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs index 876ca06fcc..a26004730d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -11,7 +11,7 @@ use bevy::reflect::{ }; use crate::{ - error::{InteropError, ScriptError, ScriptResult}, + error::{InteropError, InteropErrorInner, ScriptError, ScriptResult}, reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, }; @@ -41,7 +41,7 @@ pub enum ScriptValue { /// Represents a reference to a value. Reference(ReflectReference), /// Represents any error, will be thrown when returned to a script - Error(ScriptError), + Error(InteropError), /// A placeholder for a [`crate::bindings::WorldCallbackAccess`] value. World, } @@ -100,15 +100,15 @@ impl From for ScriptValue { } } -impl From for ScriptValue { - fn from(value: ScriptError) -> Self { - ScriptValue::Error(value) - } -} +// impl From for ScriptValue { +// fn from(value: ScriptError) -> Self { +// ScriptValue::Error(value) +// } +// } impl From for ScriptValue { fn from(value: InteropError) -> Self { - ScriptValue::Error(ScriptError::new(value)) + ScriptValue::Error(value) } } @@ -121,7 +121,7 @@ impl> From> for ScriptValue { } } -impl, E: Into> From> for ScriptValue { +impl, E: Into> From> for ScriptValue { fn from(value: Result) -> Self { match value { Ok(v) => v.into(), @@ -174,9 +174,30 @@ impl TryFrom for ParsedPath { } } -/// A trait for converting a value into a [`ScriptVal`]. +/// A trait for converting a value into a [`ScriptValue`]. +/// +/// If a [`crate::error::InteropError::better_conversion_exists`] is thrown, the conversion is not possible and you should treat this as a sign to try another method. pub trait IntoScriptValue { + /// Converts the value into a [`ScriptValue`]. This conversion should: + /// - Ideally convert to a concrete instance of [`Self`] or at least a concrete type representing [`Self`]. + /// - If the value is not possible to convert nicely as a value throw a [`crate::error::InteropError::better_conversion_exists`] error so the caller can try another method. fn into_script_value(self, world: WorldGuard) -> Result; + + /// Some values are better represented as references returned to a script. + /// This method should be called when such values might be returned to a script. + /// By default this will call [`IntoScriptValue::into_script_value`] and convert the underlying [`&dyn PartialReflect`] + /// However if `into_script_value` throws a [`crate::error::InteropError::better_conversion_exists`] error, this method will directly return the reference instead. + fn reference_into_script_value( + self_ref: ReflectReference, + world: WorldGuard, + ) -> Result { + match self_ref.with_reflect(world.clone(), |r| r.into_script_value(world))? { + Err(e) if matches!(e.inner(), InteropErrorInner::BetterConversionExists { .. }) => { + Ok(ScriptValue::Reference(self_ref)) + } + e => e, + } + } } /// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 5e360d1e28..cd10c1871f 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -183,7 +183,7 @@ impl From for mlua::Error { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] pub struct InteropError(Arc); impl std::error::Error for InteropError {} @@ -202,6 +202,20 @@ impl From for ScriptError { } } +pub trait FlattenError { + fn flatten_interop_error(self) -> Result; +} + +impl FlattenError for Result, InteropError> { + fn flatten_interop_error(self) -> Result { + match self { + Ok(Ok(o)) => Ok(o), + Ok(Err(e)) => Err(e), + Err(e) => Err(e) + } + } +} + impl InteropError { /// Thrown if a callback requires world access, but is unable to do so due /// to the world not being reachable at all via any mechanism. @@ -251,6 +265,16 @@ impl InteropError { Self(Arc::new(InteropErrorInner::ImpossibleConversion { into })) } + /// Thrown if a conversion was not fully completed, as a better conversion exists. + /// If a function might throw this error it should be handled by the caller. + /// + /// A user seeing this error is evidence of unfinished logic. + pub fn better_conversion_exists() -> Self { + Self(Arc::new(InteropErrorInner::BetterConversionExists{ + context: std::any::type_name::().to_string() + })) + } + /// Thrown if a value was expected to be of one type but was of another pub fn type_mismatch(expected: TypeId, got: Option) -> Self { Self(Arc::new(InteropErrorInner::TypeMismatch { expected, got })) @@ -354,6 +378,16 @@ impl InteropError { pub fn inner(&self) -> &InteropErrorInner { &self.0 } + + /// Unwraps the inner error + /// + /// # Panics + /// - if there are multiple references to the inner error + pub fn into_inner(self) -> InteropErrorInner { + Arc::try_unwrap(self.0).unwrap_or_else(|a| { + Arc::try_unwrap(a).expect("tried to unwrap interop error while a copy exists") + }) + } } impl_dummy_display!(InteropErrorInner); @@ -380,6 +414,9 @@ pub enum InteropErrorInner { ImpossibleConversion { into: TypeId, }, + BetterConversionExists { + context: String + }, TypeMismatch { expected: TypeId, got: Option, @@ -428,9 +465,16 @@ pub enum InteropErrorInner { }, } +impl PartialEq for InteropErrorInner { + fn eq(&self, other: &Self) -> bool { + false + } +} + impl DisplayWithWorld for InteropErrorInner { fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { match self { + InteropErrorInner::UnregisteredBase { base } => { format!("Unregistered base type: {}", base.display_with_world(world)) } @@ -549,6 +593,9 @@ impl DisplayWithWorld for InteropErrorInner { InteropErrorInner::FunctionCallError { inner } => { inner.to_string() }, + InteropErrorInner::BetterConversionExists{ context } => { + format!("Unfinished conversion in context of: {}. A better conversion exists but caller didn't handle the case.", context) + }, } } } diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index f0c5eafc26..838839ea81 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -9,7 +9,8 @@ use std::{ }; use bevy::reflect::{ - FromType, List, PartialReflect, Reflect, ReflectFromReflect, ReflectMut, TypeData, TypeInfo, + func::Return, FromType, List, PartialReflect, Reflect, ReflectFromReflect, ReflectMut, + TypeData, TypeInfo, }; use itertools::Itertools; @@ -24,6 +25,10 @@ use crate::{ }; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { + fn from_reflect_or_clone( + reflect: &dyn PartialReflect, + world: WorldGuard, + ) -> Box; fn allocate_cloned(&self, world: WorldGuard) -> ReflectReference; fn allocate(boxed: Box, world: WorldGuard) -> ReflectReference; @@ -362,6 +367,18 @@ impl PartialReflectExt for T { }) } + /// Try creating an owned partial reflect from a reference. Will try using [`ReflectFromReflect`] first, and if that fails, will clone the value using [`PartialReflect::clone_value`]. + fn from_reflect_or_clone( + reflect: &dyn PartialReflect, + world: WorldGuard, + ) -> Box { + // try from reflect + match ::from_reflect(reflect, world.clone()) { + Ok(v) => v.into_partial_reflect(), + Err(_) => reflect.clone_value(), + } + } + fn allocate(boxed: Box, world: WorldGuard) -> ReflectReference { let allocator = world.allocator(); let mut allocator = allocator.write(); @@ -412,6 +429,20 @@ impl TypeInfoExtensions for TypeInfo { } } +pub trait ReturnValExt<'a> { + fn as_ref(&'a self) -> &'a dyn PartialReflect; +} + +impl<'a> ReturnValExt<'a> for Return<'a> { + fn as_ref(&'a self) -> &'a dyn PartialReflect { + match self { + Return::Owned(f) => f.as_partial_reflect(), + Return::Ref(r) => r.as_partial_reflect(), + Return::Mut(r) => r.as_partial_reflect(), + } + } +} + #[cfg(test)] mod test { use bevy::{ diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 8f4cabea6c..627072e01c 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -64,13 +64,10 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let path: ParsedPath = key.try_into().unwrap(); r.index_path(path); let world = world.read().expect("Stale world"); - let script_val: ScriptValue = r - .with_reflect(world.clone(), |r| r.into_script_value(world)) - .into(); - script_val + let script_val = <&dyn PartialReflect>::reference_into_script_value(r, world); + script_val.into() } else { - // ScriptValue::Error() - todo!() + ScriptValue::Unit } }, ) @@ -82,10 +79,8 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe path.convert_to_0_indexed(); r.index_path(path); let world = world.read().expect("Stale world"); - let script_val = r - .with_reflect(world.clone(), |r| r.into_script_value(world)) - .into(); - script_val + let script_val = <&dyn PartialReflect>::reference_into_script_value(r, world); + script_val.into() } else { ScriptValue::Unit } From d40838ba1b6a6a204762e960ba76ed67d6987c60 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 17 Dec 2024 02:24:06 +0000 Subject: [PATCH 053/217] Big things coming --- .../src/bindings/function/from.rs | 276 ++++++++++++++++++ .../src/bindings/function/into.rs | 106 +++++++ .../bindings/{function.rs => function/mod.rs} | 4 + .../src/bindings/function/script_function.rs | 227 ++++++++++++++ .../src/bindings/script_value/into.rs | 8 + .../src/bindings/script_value/mod.rs | 17 ++ crates/bevy_mod_scripting_core/src/error.rs | 10 +- .../bevy_mod_scripting_functions/src/core.rs | 24 ++ 8 files changed, 671 insertions(+), 1 deletion(-) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/function/from.rs create mode 100644 crates/bevy_mod_scripting_core/src/bindings/function/into.rs rename crates/bevy_mod_scripting_core/src/bindings/{function.rs => function/mod.rs} (99%) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs new file mode 100644 index 0000000000..a655787af0 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -0,0 +1,276 @@ +use crate::{ + bindings::{access_map::ReflectAccessId, ReflectReference, WorldGuard}, + error::InteropError, + prelude::ScriptValue, +}; +use bevy::reflect::FromReflect; +use std::{ + any::TypeId, + ffi::OsString, + ops::{Deref, DerefMut}, + path::PathBuf, +}; + +/// Describes the procedure for constructing a value of type `T` from a [`ScriptValue`]. +/// +/// The [`FromScript::This`] associated type is used to allow for the implementation of this trait to return +/// a type with the lifetime of the world guard. In 99% cases you can just use `Self` as the associated type. +pub trait FromScript { + type This<'w>; + fn from_script( + value: ScriptValue, + world: WorldGuard<'_>, + ) -> Result, InteropError> + where + Self: Sized; +} + +impl FromScript for ScriptValue { + type This<'w> = Self; + fn from_script(value: ScriptValue, _world: WorldGuard) -> Result { + Ok(value) + } +} + +macro_rules! impl_from_with_downcast { + ($($ty:ty),*) => { + $( + impl FromScript for $ty { + type This<'w> = Self; + fn from_script(value: ScriptValue, world: WorldGuard) -> Result { + match value { + ScriptValue::Integer(i) => Ok(i as $ty), + ScriptValue::Float(i) => Ok(i as $ty), + ScriptValue::Reference(r) => r.downcast::(world), + _ => Err(InteropError::value_mismatch(std::any::TypeId::of::(), value)), + } + } + } + )* + }; +} + +impl_from_with_downcast!(i8, i16, i32, i64, i128, u8, u16, u32, u64, u128, f32, f64, usize, isize); + +macro_rules! impl_from_stringlike { + ($($ty:ty),*) => { + $( + impl FromScript for $ty { + type This<'w> = Self; + fn from_script(value: ScriptValue, world: WorldGuard) -> Result { + match value { + ScriptValue::String(s) => Ok(s.to_string().into()), + ScriptValue::Reference(r) => r.downcast::(world), + _ => Err(InteropError::value_mismatch(std::any::TypeId::of::(), value)), + } + } + } + )* + }; +} + +impl_from_stringlike!(String, PathBuf, OsString); + +impl FromScript for ReflectReference { + type This<'w> = Self; + fn from_script(value: ScriptValue, _world: WorldGuard) -> Result { + match value { + ScriptValue::Reference(r) => Ok(r), + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::(), + value, + )), + } + } +} + +/// A wrapper around a value of type `T`. +/// +/// This can be used to retrieve a value out of a [`ScriptValue::Reference`] corresponding to the type `T`. +/// You can also use this to return values from a script function to be allocated directly as a [`ScriptValue::Reference`]. +pub struct Val(pub T); + +impl Deref for Val { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for Val { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +impl FromScript for Val { + type This<'w> = Self; + fn from_script(value: ScriptValue, world: WorldGuard) -> Result { + match value { + ScriptValue::Reference(reflect_reference) => Ok(Val(reflect_reference.with_reflect( + world.clone(), + |r| { + T::from_reflect(r).ok_or_else(|| { + InteropError::failed_from_reflect( + Some(TypeId::of::()), + "from reflect failed to produce output when converting to Val" + .to_owned(), + ) + }) + }, + )??)), + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::(), + value, + )), + } + } +} + +/// A wrapper around a reference to a value of type `T`. +/// +/// This can be used to retrieve a reference out of a [`ScriptValue::Reference`] corresponding to the type `T`. +/// Before downcasting the reference, it will claim write access to the object to ensure that the reference is valid. +/// +/// However, the access is NOT released when the `Mut` is dropped. This is not unsafe but can lead to deadlocks if not released later. +/// The [`ScriptFunction`] calling mechanism will take care of releasing all accesses claimed during the function call. +pub struct Ref<'w, T>(pub &'w T); + +impl Deref for Ref<'_, T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + self.0 + } +} + +impl FromScript for Ref<'_, T> { + type This<'w> = Ref<'w, T>; + + fn from_script( + value: ScriptValue, + world: WorldGuard<'_>, + ) -> Result, InteropError> { + match value { + ScriptValue::Reference(reflect_reference) => { + let raid = ReflectAccessId::for_reference(reflect_reference.base.base_id.clone()) + .ok_or_else(|| { + InteropError::unregistered_base(reflect_reference.base.clone()) + })?; + + if world.claim_read_access(raid) { + // Safety: we just claimed access + let ref_ = unsafe { reflect_reference.reflect_unsafe(world) }?; + let cast = ref_.try_downcast_ref::().ok_or_else(|| { + InteropError::type_mismatch( + std::any::TypeId::of::(), + ref_.get_represented_type_info().map(|i| i.type_id()), + ) + })?; + Ok(Ref(cast)) + } else { + Err(InteropError::cannot_claim_access(reflect_reference.base)) + } + } + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::(), + value, + )), + } + } +} + +/// A wrapper around a mutable reference to a value of type `T`. +/// +/// This can be used to retrieve a mutable reference out of a [`ScriptValue::Reference`] corresponding to the type `T`. +/// Before downcasting the reference, it will claim write access to the object to ensure that the reference is valid. +/// +/// However, the access is NOT released when the `Mut` is dropped. This is not unsafe but can lead to deadlocks if not released later. +/// The [`ScriptFunction`] calling mechanism will take care of releasing all accesses claimed during the function call. +pub struct Mut<'w, T>(pub &'w mut T); + +impl Deref for Mut<'_, T> { + type Target = T; + + fn deref(&self) -> &Self::Target { + self.0 + } +} + +impl DerefMut for Mut<'_, T> { + fn deref_mut(&mut self) -> &mut Self::Target { + self.0 + } +} + +impl FromScript for Mut<'_, T> { + type This<'w> = Mut<'w, T>; + + fn from_script( + value: ScriptValue, + world: WorldGuard<'_>, + ) -> Result, InteropError> { + match value { + ScriptValue::Reference(reflect_reference) => { + let raid = ReflectAccessId::for_reference(reflect_reference.base.base_id.clone()) + .ok_or_else(|| { + InteropError::unregistered_base(reflect_reference.base.clone()) + })?; + + if world.claim_write_access(raid) { + // Safety: we just claimed write access + let ref_ = unsafe { reflect_reference.reflect_mut_unsafe(world) }?; + let type_id = ref_.get_represented_type_info().map(|i| i.type_id()); + let cast = ref_.try_downcast_mut::().ok_or_else(|| { + InteropError::type_mismatch(std::any::TypeId::of::(), type_id) + })?; + Ok(Mut(cast)) + } else { + Err(InteropError::cannot_claim_access(reflect_reference.base)) + } + } + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::(), + value, + )), + } + } +} + +impl FromScript for Option +where + for<'w> T::This<'w>: Into, +{ + type This<'w> = Self; + + fn from_script(value: ScriptValue, world: WorldGuard) -> Result { + match value { + ScriptValue::Unit => Ok(None), + _ => Ok(Some(T::from_script(value, world)?.into())), + } + } +} + +impl FromScript for Vec +where + for<'w> T::This<'w>: Into, +{ + type This<'w> = Self; + + fn from_script(value: ScriptValue, world: WorldGuard) -> Result { + match value { + ScriptValue::List(list) => { + let mut vec = Vec::with_capacity(list.len()); + for item in list { + vec.push(T::from_script(item, world.clone())?.into()); + } + Ok(vec) + } + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::>(), + value, + )), + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs new file mode 100644 index 0000000000..da0f1dd62e --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -0,0 +1,106 @@ +use std::{ + ffi::OsString, + path::{Path, PathBuf}, +}; + +use bevy::reflect::{PartialReflect, ReflectRef}; + +use crate::{ + bindings::{ReflectReference, WorldGuard}, + error::InteropError, + prelude::ScriptValue, +}; + +use super::from::Val; + +pub trait IntoScript { + fn into_script(self, world: WorldGuard) -> Result; +} + +impl IntoScript for ScriptValue { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(self) + } +} + +macro_rules! impl_into_with_downcast { + ($variant:tt as $cast:ty [$($ty:ty),*]) => { + $( + impl IntoScript for $ty { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::$variant(self as $cast)) + } + } + )* + } + +} + +impl_into_with_downcast!(Integer as i64 [i8, i16, i32, i64, i128, u8, u16, u32, u64, u128, usize, isize]); +impl_into_with_downcast!(Float as f64 [f32, f64]); + +macro_rules! impl_into_stringlike { + ($id:ident,[ $(($ty:ty => $conversion:expr)),*]) => { + $( + impl IntoScript for $ty { + fn into_script(self, _world: WorldGuard) -> Result { + let $id = self; + let converted: String = $conversion; + Ok(ScriptValue::String(converted.into())) + } + } + )* + } +} + +impl_into_stringlike!( + s, + [ + (String => s), + (PathBuf => s.to_string_lossy().to_string()), + (OsString => s.into_string().map_err(|e| InteropError::unsupported_operation(None, Some(Box::new(e)), "Could not convert OsString to String".to_owned()))?) + ] +); + +impl IntoScript for ReflectReference { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::Reference(self)) + } +} + +impl IntoScript for Val { + fn into_script(self, world: WorldGuard) -> Result { + let boxed: Box = Box::new(self.0); + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + Ok(ScriptValue::Reference( + ReflectReference::new_allocated_boxed(boxed, &mut allocator), + )) + } +} + +impl IntoScript for Option { + fn into_script(self, world: WorldGuard) -> Result { + match self { + Some(val) => val.into_script(world), + None => Ok(ScriptValue::Unit), + } + } +} + +impl IntoScript for Vec { + fn into_script(self, world: WorldGuard) -> Result { + let mut values = Vec::with_capacity(self.len()); + for val in self { + values.push(val.into_script(world.clone())?); + } + Ok(ScriptValue::List(values)) + } +} + +impl IntoScript for InteropError { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::Error(self)) + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs similarity index 99% rename from crates/bevy_mod_scripting_core/src/bindings/function.rs rename to crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index ff2fe32d83..1b96beb972 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -1,5 +1,9 @@ use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; +pub mod from; +pub mod into; +pub mod script_function; + use bevy::reflect::{ func::{ args::{Arg, ArgInfo, Ownership}, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs new file mode 100644 index 0000000000..ffe0d47083 --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -0,0 +1,227 @@ +use bevy::{ + prelude::{AppFunctionRegistry, IntoFunction, World}, + reflect::{func::DynamicFunction, PartialReflect}, +}; + +use crate::{ + error::InteropError, + prelude::{ScriptValue, WorldCallbackAccess}, +}; + +use super::{from::FromScript, into::IntoScript}; + +#[diagnostic::on_unimplemented( + message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. use assert_impls_into_script!(MyArg) and assert_impls_from_script!(MyReturnType) to verify yours do.", + note = "If you're trying to return a non-primitive type, you might need to use Val Ref or Mut wrappers" +)] +pub trait ScriptFunction { + fn into_dynamic_function(self) -> DynamicFunction<'static>; +} + +macro_rules! impl_script_function { + + ($( $param:ident ),* ) => { + // fn(T1...Tn) -> O + impl_script_function!(@ $( $param ),* : -> O => O ); + // fn(WorldCallbackAccess, T1...Tn) -> O + impl_script_function!(@ $( $param ),* : (callback: WorldCallbackAccess) -> O => O); + // fn(T1...Tn) -> Result + impl_script_function!(@ $( $param ),* : -> O => Result where s); + // fn(WorldCallbackAccess, T1...Tn) -> Result + impl_script_function!(@ $( $param ),* : (callback: WorldCallbackAccess) -> O => Result where s); + }; + + (@ $( $param:ident ),* : $(($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { + #[allow(non_snake_case)] + impl< + $( $param: FromScript, )* + O, + F + > ScriptFunction< + fn( $( $callbackty, )? $($param ),* ) -> $res + > for F + where + O: IntoScript, + F: Fn( $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, + $( for<'a> $param::This<'a>: Into<$param>, )* + { + fn into_dynamic_function(self) -> DynamicFunction<'static> { + (move |world: WorldCallbackAccess, $( $param: ScriptValue ),* | { + let res: Result = (|| { + $( let $callback = world.clone(); )? + let world = world.read().ok_or_else(|| InteropError::stale_world_access())?; + $( let $param = <$param>::from_script($param, world.clone())?; )* + let out = self( $( $callback, )? $( $param.into(), )* ); + $( + let $out = out?; + let out = $out; + )? + out.into_script(world.clone()) + })(); + let script_value: ScriptValue = res.into(); + script_value + }).into_function() + } + } + }; +} + +bevy::utils::all_tuples!(impl_script_function, 0, 14, T); + +/// Utility for quickly checking your type can be used as an argument in a script function +/// +/// Usage: +/// ``` +/// assert_impls_into_script!(i32); +/// ``` +#[macro_export] +macro_rules! assert_impls_into_script { + ($ty:ty) => { + trait Check: $crate::bindings::function::into::IntoScript {} + impl Check for $ty {} + }; +} + +/// Utility for quickly checking your type can be used as a return value in a script function +/// +/// Usage: +/// ``` +/// assert_impls_from_script!(i32); +/// ``` +#[macro_export] +macro_rules! assert_impls_from_script { + ($ty:ty) => { + trait Check: $crate::bindings::function::from::FromScript {} + impl Check for $ty {} + }; + () => {}; +} + +/// Utility for quickly checking your function can be used as a script function +/// +/// Usage: +/// ``` +/// assert_is_script_function!(|a: i32, b: i32| a + b); +/// ``` +#[macro_export] +macro_rules! assert_is_script_function { + ($($tt:tt)*) => { + fn _check>(f: F) { + + } + + fn test() { + _check($($tt)*); + } + } +} + +#[cfg(test)] +mod test { + use crate::prelude::AppReflectAllocator; + + use super::*; + use bevy::reflect::func::{ArgList, ArgValue, Return}; + use test_utils::test_data::*; + + fn test_setup_world() -> World { + setup_world(|w, _| w.insert_resource(AppReflectAllocator::default())) + } + + macro_rules! call_script_function_with { + ($world:ident, $fun:expr, ($($args: expr),*)) => { + { + let f = $fun; + let f = f.into_dynamic_function(); + + let o = WorldCallbackAccess::with_callback_access(&mut $world, |world| { + let mut arg_list = ArgList::new(); + arg_list = arg_list.push_arg(ArgValue::Owned(Box::new(world.clone()))); + $( + arg_list = arg_list.push_arg($args); + )* + f.call(arg_list) + }).expect("Failed to call function"); + + match o { + Return::Owned(v) => v.try_take().expect("Failed to convert to target type"), + _ => panic!("Expected owned value") + } + } + }; + } + + #[test] + fn primitive_function_should_work() { + let mut world = test_setup_world(); + + let out: ScriptValue = call_script_function_with!( + world, + |a: usize, b: usize| a + b, + ( + ArgValue::Owned(Box::new(ScriptValue::Integer(1))), + ArgValue::Owned(Box::new(ScriptValue::Integer(1))) + ) + ); + assert_eq!(out, ScriptValue::Integer(2)); + } + + #[test] + fn primitive_result_function_should_work() { + let mut world = test_setup_world(); + + let out: ScriptValue = call_script_function_with!( + world, + |a: usize, b: usize| Ok(a + b), + ( + ArgValue::Owned(Box::new(ScriptValue::Integer(1))), + ArgValue::Owned(Box::new(ScriptValue::Integer(1))) + ) + ); + assert_eq!(out, ScriptValue::Integer(2)); + + let out: ScriptValue = call_script_function_with!( + world, + || Err::(InteropError::missing_world()), + () + ); + assert!(matches!(out, ScriptValue::Error(_))); + } + + #[test] + fn primitive_function_with_world_should_work() { + let mut world = test_setup_world(); + + let out: ScriptValue = call_script_function_with!( + world, + |_w: WorldCallbackAccess, a: usize, b: usize| a + b, + ( + ArgValue::Owned(Box::new(ScriptValue::Integer(1))), + ArgValue::Owned(Box::new(ScriptValue::Integer(1))) + ) + ); + assert_eq!(out, ScriptValue::Integer(2)); + } + + #[test] + fn primitive_result_function_with_world_should_work() { + let mut world = test_setup_world(); + + let out: ScriptValue = call_script_function_with!( + world, + |_w: WorldCallbackAccess, a: usize, b: usize| Ok(a + b), + ( + ArgValue::Owned(Box::new(ScriptValue::Integer(1))), + ArgValue::Owned(Box::new(ScriptValue::Integer(1))) + ) + ); + assert_eq!(out, ScriptValue::Integer(2)); + + let out: ScriptValue = call_script_function_with!( + world, + || Err::(InteropError::missing_world()), + () + ); + assert!(matches!(out, ScriptValue::Error(_))); + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs index c08a5104ee..37d8165ea5 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs @@ -156,6 +156,14 @@ impl IntoScriptValue for &dyn PartialReflect { // you're gonna have to allocate and ref to it Err(InteropError::better_conversion_exists::()) } + + // fn reference_into_script_value( + // type_id: TypeId, + // self_ref: ReflectReference, + // world: WorldGuard, + // ) -> Result { + + // } } impl IntoScriptValue for Option<&dyn PartialReflect> { diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs index a26004730d..d831a85bf8 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -46,6 +46,22 @@ pub enum ScriptValue { World, } +impl ScriptValue { + pub fn type_name(&self) -> String { + match self { + ScriptValue::Unit => "Unit".to_owned(), + ScriptValue::Bool(_) => "Bool".to_owned(), + ScriptValue::Integer(_) => "Integer".to_owned(), + ScriptValue::Float(_) => "Float".to_owned(), + ScriptValue::String(_) => "String".to_owned(), + ScriptValue::List(_) => "List".to_owned(), + ScriptValue::Reference(_) => "Reference".to_owned(), + ScriptValue::Error(_) => "Error".to_owned(), + ScriptValue::World => "World".to_owned(), + } + } +} + impl From<()> for ScriptValue { fn from(_: ()) -> Self { ScriptValue::Unit @@ -188,6 +204,7 @@ pub trait IntoScriptValue { /// By default this will call [`IntoScriptValue::into_script_value`] and convert the underlying [`&dyn PartialReflect`] /// However if `into_script_value` throws a [`crate::error::InteropError::better_conversion_exists`] error, this method will directly return the reference instead. fn reference_into_script_value( + // type_id: TypeId, self_ref: ReflectReference, world: WorldGuard, ) -> Result { diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index cd10c1871f..1f29deac95 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -375,6 +375,10 @@ impl InteropError { Self(Arc::new(InteropErrorInner::FunctionCallError { inner })) } + pub fn external_error(error: Box) -> Self { + Self(Arc::new(InteropErrorInner::OtherError { error })) + } + pub fn inner(&self) -> &InteropErrorInner { &self.0 } @@ -463,10 +467,13 @@ pub enum InteropErrorInner { argument: String, error: InteropError, }, + OtherError { + error: Box, + }, } impl PartialEq for InteropErrorInner { - fn eq(&self, other: &Self) -> bool { + fn eq(&self, _other: &Self) -> bool { false } } @@ -596,6 +603,7 @@ impl DisplayWithWorld for InteropErrorInner { InteropErrorInner::BetterConversionExists{ context } => { format!("Unfinished conversion in context of: {}. A better conversion exists but caller didn't handle the case.", context) }, + InteropErrorInner::OtherError { error } => error.to_string(), } } } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 627072e01c..5254b12f36 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -1,4 +1,6 @@ //! Contains functions defined by the [`bevy_mod_scripting_core`] crate +use std::borrow::Cow; + use bevy::{ prelude::*, reflect::{ @@ -8,6 +10,7 @@ use bevy::{ }; use bevy_mod_scripting_core::*; use bindings::{ + function::{from::Val, script_function::ScriptFunction}, script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, @@ -19,6 +22,23 @@ use crate::namespaced_register::NamespaceBuilder; pub struct CoreFunctionsPlugin; +pub trait RegisterScriptFunction { + fn overwrite_script_function>(&mut self, name: N, f: F) -> &mut Self + where + N: Into>; +} + +impl RegisterScriptFunction for NamespaceBuilder<'_, S> { + fn overwrite_script_function>(&mut self, name: N, f: F) -> &mut Self + where + N: Into>, + { + let dynamic_function = f.into_dynamic_function(); + self.overwrite(name, dynamic_function); + self + } +} + impl Plugin for CoreFunctionsPlugin { fn build(&self, app: &mut App) { let function_registry = app @@ -33,8 +53,12 @@ impl Plugin for CoreFunctionsPlugin { } } +assert_impls_from_script!(Val); +assert_is_script_function!(|a: Val| Ok(2)); + fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) + // .overwrite_script_function("hello", |a: Val| 2) .overwrite( "test_vec", |s: WorldCallbackAccess, entities: Vec| entities, From 811ef7512e7423c707b2e4afa049659d6336baba Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 17 Dec 2024 02:45:56 +0000 Subject: [PATCH 054/217] fix lifetime issue, allow refs --- assets/scripts/bevy_api.lua | 1 + .../bevy_mod_scripting_core/src/bindings/function/from.rs | 2 +- .../src/bindings/function/script_function.rs | 3 ++- crates/bevy_mod_scripting_functions/src/core.rs | 7 +++++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 216459edcb..8989ca288f 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -15,6 +15,7 @@ function on_event() print(script) print(world) + print(world:hello(entity)) print(world:test_vec({entity, entity})[1]) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index a655787af0..dd5285c545 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -146,7 +146,7 @@ impl Deref for Ref<'_, T> { } impl FromScript for Ref<'_, T> { - type This<'w> = Ref<'w, T>; + type This<'a> = Ref<'a, T>; fn from_script( value: ScriptValue, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index ffe0d47083..e8b1bdf11b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -34,6 +34,7 @@ macro_rules! impl_script_function { (@ $( $param:ident ),* : $(($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { #[allow(non_snake_case)] impl< + 'l, $( $param: FromScript, )* O, F @@ -43,7 +44,7 @@ macro_rules! impl_script_function { where O: IntoScript, F: Fn( $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, - $( for<'a> $param::This<'a>: Into<$param>, )* + $( $param::This<'l>: Into<$param>),* { fn into_dynamic_function(self) -> DynamicFunction<'static> { (move |world: WorldCallbackAccess, $( $param: ScriptValue ),* | { diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 5254b12f36..fc14465da1 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -10,7 +10,10 @@ use bevy::{ }; use bevy_mod_scripting_core::*; use bindings::{ - function::{from::Val, script_function::ScriptFunction}, + function::{ + from::{Ref, Val}, + script_function::ScriptFunction, + }, script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, @@ -58,7 +61,7 @@ assert_is_script_function!(|a: Val| Ok(2)); fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - // .overwrite_script_function("hello", |a: Val| 2) + .overwrite_script_function("hello", |b: Ref| None::) .overwrite( "test_vec", |s: WorldCallbackAccess, entities: Vec| entities, From 4af433151008f27cb92aad5f9b2b8c62388cd9b3 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 17 Dec 2024 08:59:29 +0000 Subject: [PATCH 055/217] refactor accesses slightly --- assets/scripts/bevy_api.lua | 2 +- .../src/bindings/access_map.rs | 122 ++++++++++++++---- .../src/bindings/function/from.rs | 10 +- .../src/bindings/function/mod.rs | 10 +- .../src/bindings/function/script_function.rs | 16 ++- .../src/bindings/world.rs | 6 +- crates/bevy_mod_scripting_core/src/error.rs | 15 ++- .../bevy_mod_scripting_functions/src/core.rs | 19 ++- 8 files changed, 149 insertions(+), 51 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 8989ca288f..ad601d2abc 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -15,7 +15,7 @@ function on_event() print(script) print(world) - print(world:hello(entity)) + print(world:hello(entity, entity)) print(world:test_vec({entity, entity})[1]) diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs index 4769f43f65..0ee28511f2 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -1,18 +1,29 @@ -use std::sync::atomic::{AtomicBool, AtomicUsize}; +use std::{ + sync::atomic::{AtomicBool, AtomicUsize}, + thread::ThreadId, +}; use bevy::{ ecs::{component::ComponentId, world::unsafe_world_cell::UnsafeWorldCell}, prelude::Resource, }; use dashmap::{try_result::TryResult, DashMap, Entry, Map}; +use smallvec::SmallVec; use super::{ReflectAllocationId, ReflectBase}; -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct ClaimOwner { + id: ThreadId, + location: std::panic::Location<'static>, +} + +#[derive(Debug, Clone, PartialEq, Eq)] pub struct AccessCount { - count: usize, - /// set if somebody is writing - written_by: Option>, + /// The number of readers including thread information + read_by: SmallVec<[ClaimOwner; 1]>, + /// If the current read is a write access, this will be set + written: bool, } impl Default for AccessCount { @@ -24,25 +35,25 @@ impl Default for AccessCount { impl AccessCount { fn new() -> Self { Self { - count: 0, - written_by: None, + read_by: Default::default(), + written: false, } } fn can_read(&self) -> bool { - self.written_by.is_none() + !self.written } fn can_write(&self) -> bool { - self.count == 0 && self.written_by.is_none() + self.read_by.is_empty() && !self.written } fn as_location(&self) -> Option> { - self.written_by + self.read_by.first().map(|o| o.location.clone()) } fn readers(&self) -> usize { - self.count + self.read_by.len() } } @@ -174,6 +185,7 @@ pub struct AccessMap { impl AccessMap { /// Tries to claim read access, will return false if somebody else is writing to the same key, or holding a global lock + #[track_caller] pub fn claim_read_access(&self, key: K) -> bool { if self.global_lock.load(std::sync::atomic::Ordering::Relaxed) { return false; @@ -182,7 +194,10 @@ impl AccessMap { let access = self.individual_accesses.try_entry(key); match access.map(Entry::or_default) { Some(mut entry) if entry.can_read() => { - entry.count += 1; + entry.read_by.push(ClaimOwner { + id: std::thread::current().id(), + location: *std::panic::Location::caller(), + }); true } _ => false, @@ -199,8 +214,11 @@ impl AccessMap { let access = self.individual_accesses.try_entry(key); match access.map(Entry::or_default) { Some(mut entry) if entry.can_write() => { - entry.count += 1; - entry.written_by = Some(*std::panic::Location::caller()); + entry.read_by.push(ClaimOwner { + id: std::thread::current().id(), + location: *std::panic::Location::caller(), + }); + entry.written = true; true } _ => false, @@ -210,7 +228,7 @@ impl AccessMap { /// Tries to claim global access. This type of access prevents any other access from happening simulatenously /// Will return false if anybody else is currently accessing any part of the map pub fn claim_global_access(&self) -> bool { - self.individual_accesses.len() == 0 + self.individual_accesses.is_empty() && self .global_lock .compare_exchange( @@ -222,17 +240,25 @@ impl AccessMap { .is_ok() } + /// Releases an access + /// + /// # Panics + /// if the access is released from a different thread than it was claimed from pub fn release_access(&self, key: K) { let key = key.as_usize(); let access = self.individual_accesses.entry(key); match access { dashmap::mapref::entry::Entry::Occupied(mut entry) => { let entry_mut = entry.get_mut(); - if entry_mut.written_by.is_some() { - entry_mut.written_by = None; + entry_mut.written = false; + if let Some(p) = entry_mut.read_by.pop() { + assert!( + p.id == std::thread::current().id(), + "Access released from wrong thread, claimed at {}", + p.location.display_location() + ); } - entry_mut.count -= 1; - if entry_mut.count == 0 { + if entry_mut.readers() == 0 { entry.remove(); } } @@ -253,6 +279,18 @@ impl AccessMap { .collect() } + pub fn count_thread_acceesses(&self) -> usize { + self.individual_accesses + .iter() + .filter(|e| { + e.value() + .read_by + .iter() + .any(|o| o.id == std::thread::current().id()) + }) + .count() + } + pub fn access_location( &self, key: K, @@ -260,8 +298,13 @@ impl AccessMap { self.individual_accesses .try_get(&key.as_usize()) .try_unwrap() - .map(|access| access.as_location()) - .flatten() + .and_then(|access| access.as_location()) + } + + pub fn access_first_location(&self) -> Option> { + self.individual_accesses + .iter() + .find_map(|e| e.value().as_location()) } } @@ -325,8 +368,11 @@ macro_rules! with_global_access { ($access_map:expr, $msg:expr, $body:block) => { if !$access_map.claim_global_access() { panic!( - "{}. Another access is held somewhere else preventing locking the world", - $msg + "{}. Another access is held somewhere else preventing locking the world: {}", + $msg, + $crate::bindings::access_map::DisplayCodeLocation::display_location( + $access_map.access_first_location() + ) ); } else { let result = (|| $body)(); @@ -355,8 +401,8 @@ mod test { assert_eq!(access_0.1.readers(), 1); assert_eq!(access_1.1.readers(), 1); - assert_eq!(access_0.1.written_by, None); - assert!(access_1.1.written_by.is_some()); + assert!(!access_0.1.written); + assert!(access_1.1.written); } #[test] @@ -403,4 +449,30 @@ mod test { assert!(access_map.claim_write_access(0)); assert!(!access_map.claim_global_access()); } + + #[test] + #[should_panic] + fn releasing_read_access_from_wrong_thread_panics() { + let access_map = AccessMap::default(); + + access_map.claim_read_access(0); + std::thread::spawn(move || { + access_map.release_access(0); + }) + .join() + .unwrap(); + } + + #[test] + #[should_panic] + fn releasing_write_access_from_wrong_thread_panics() { + let access_map = AccessMap::default(); + + access_map.claim_write_access(0); + std::thread::spawn(move || { + access_map.release_access(0); + }) + .join() + .unwrap(); + } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index dd5285c545..19b765647e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -170,7 +170,10 @@ impl FromScript for Ref<'_, T> { })?; Ok(Ref(cast)) } else { - Err(InteropError::cannot_claim_access(reflect_reference.base)) + Err(InteropError::cannot_claim_access( + reflect_reference.base, + world.get_access_location(raid), + )) } } _ => Err(InteropError::value_mismatch( @@ -227,7 +230,10 @@ impl FromScript for Mut<'_, T> { })?; Ok(Mut(cast)) } else { - Err(InteropError::cannot_claim_access(reflect_reference.base)) + Err(InteropError::cannot_claim_access( + reflect_reference.base, + world.get_access_location(raid), + )) } } _ => Err(InteropError::value_mismatch( diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index 1b96beb972..c7db114ce8 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -245,7 +245,10 @@ impl> IntoArgsListWithAccess for I { Err(ref_.expect_err("invariant")) } } else { - Err(InteropError::cannot_claim_access(arg_ref.base.clone())) + Err(InteropError::cannot_claim_access( + arg_ref.base.clone(), + world.get_access_location(access_id), + )) } } Ownership::Mut => { @@ -258,7 +261,10 @@ impl> IntoArgsListWithAccess for I { Err(mut_ref.expect_err("invariant")) } } else { - Err(InteropError::cannot_claim_access(arg_ref.base.clone())) + Err(InteropError::cannot_claim_access( + arg_ref.base.clone(), + world.get_access_location(access_id), + )) } } _ => unreachable!(), diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index e8b1bdf11b..164ec4fbf4 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -14,7 +14,7 @@ use super::{from::FromScript, into::IntoScript}; message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. use assert_impls_into_script!(MyArg) and assert_impls_from_script!(MyReturnType) to verify yours do.", note = "If you're trying to return a non-primitive type, you might need to use Val Ref or Mut wrappers" )] -pub trait ScriptFunction { +pub trait ScriptFunction<'env, Marker> { fn into_dynamic_function(self) -> DynamicFunction<'static>; } @@ -34,23 +34,24 @@ macro_rules! impl_script_function { (@ $( $param:ident ),* : $(($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { #[allow(non_snake_case)] impl< - 'l, + 'env, $( $param: FromScript, )* O, F - > ScriptFunction< + > ScriptFunction<'env, fn( $( $callbackty, )? $($param ),* ) -> $res > for F where O: IntoScript, F: Fn( $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, - $( $param::This<'l>: Into<$param>),* + $( $param::This<'env>: Into<$param>),* { fn into_dynamic_function(self) -> DynamicFunction<'static> { (move |world: WorldCallbackAccess, $( $param: ScriptValue ),* | { let res: Result = (|| { $( let $callback = world.clone(); )? let world = world.read().ok_or_else(|| InteropError::stale_world_access())?; + // TODO: snapshot the accesses and release them after $( let $param = <$param>::from_script($param, world.clone())?; )* let out = self( $( $callback, )? $( $param.into(), )* ); $( @@ -95,7 +96,10 @@ macro_rules! assert_impls_from_script { trait Check: $crate::bindings::function::from::FromScript {} impl Check for $ty {} }; - () => {}; + ($l:lifetime $ty:ty) => { + trait Check: $crate::bindings::function::from::FromScript {} + impl<$l> Check for $ty {} + }; } /// Utility for quickly checking your function can be used as a script function @@ -107,7 +111,7 @@ macro_rules! assert_impls_from_script { #[macro_export] macro_rules! assert_is_script_function { ($($tt:tt)*) => { - fn _check>(f: F) { + fn _check<'env,M,F: ScriptFunction<'env, M>>(f: F) { } diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 858829ed9e..3f4517e17f 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -309,10 +309,14 @@ impl<'w> WorldAccessGuard<'w> { self.0.cell.components().get_resource_id(id) } - pub fn get_access_location(&self, raid: ReflectAccessId) -> Option> { + pub fn get_access_location( + &self, + raid: ReflectAccessId, + ) -> Option> { self.0.accesses.access_location(raid) } + #[track_caller] pub fn claim_read_access(&self, raid: ReflectAccessId) -> bool { self.0.accesses.claim_read_access(raid) } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 1f29deac95..30ce739644 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -18,8 +18,7 @@ use thiserror::Error; use crate::{ bindings::{ - pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, - ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference, + access_map::DisplayCodeLocation, pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference }, impl_dummy_display, prelude::ScriptValue, @@ -255,8 +254,8 @@ impl InteropError { /// Thrown if access to the given reflection base is required but cannot be claimed. /// This is likely due to some other script already claiming access to the base. - pub fn cannot_claim_access(base: ReflectBaseType) -> Self { - Self(Arc::new(InteropErrorInner::CannotClaimAccess { base })) + pub fn cannot_claim_access(base: ReflectBaseType, location: Option>) -> Self { + Self(Arc::new(InteropErrorInner::CannotClaimAccess { base, location })) } /// Thrown if a conversion into the given type is impossible. @@ -414,6 +413,7 @@ pub enum InteropErrorInner { }, CannotClaimAccess { base: ReflectBaseType, + location: Option>, }, ImpossibleConversion { into: TypeId, @@ -485,10 +485,11 @@ impl DisplayWithWorld for InteropErrorInner { InteropErrorInner::UnregisteredBase { base } => { format!("Unregistered base type: {}", base.display_with_world(world)) } - InteropErrorInner::CannotClaimAccess { base } => { + InteropErrorInner::CannotClaimAccess { base, location } => { format!( - "Cannot claim access to base type: {}", - base.display_with_world(world) + "Cannot claim access to base type: {}. The base is already claimed by something else in a way which prevents safe access. Location: {}", + base.display_with_world(world), + location.display_location() ) } InteropErrorInner::ImpossibleConversion { into } => { diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index fc14465da1..e5d1f869ee 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -11,7 +11,7 @@ use bevy::{ use bevy_mod_scripting_core::*; use bindings::{ function::{ - from::{Ref, Val}, + from::{Mut, Ref, Val}, script_function::ScriptFunction, }, script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, @@ -26,13 +26,21 @@ use crate::namespaced_register::NamespaceBuilder; pub struct CoreFunctionsPlugin; pub trait RegisterScriptFunction { - fn overwrite_script_function>(&mut self, name: N, f: F) -> &mut Self + fn overwrite_script_function>( + &mut self, + name: N, + f: F, + ) -> &mut Self where N: Into>; } impl RegisterScriptFunction for NamespaceBuilder<'_, S> { - fn overwrite_script_function>(&mut self, name: N, f: F) -> &mut Self + fn overwrite_script_function>( + &mut self, + name: N, + f: F, + ) -> &mut Self where N: Into>, { @@ -56,12 +64,9 @@ impl Plugin for CoreFunctionsPlugin { } } -assert_impls_from_script!(Val); -assert_is_script_function!(|a: Val| Ok(2)); - fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - .overwrite_script_function("hello", |b: Ref| None::) + .overwrite_script_function("hello", |b: Ref, c: Mut| None::) .overwrite( "test_vec", |s: WorldCallbackAccess, entities: Vec| entities, From 56fa757b914df1536cd0851a7bfae64b19023a76 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 17 Dec 2024 17:16:29 +0000 Subject: [PATCH 056/217] change core functions to script functions --- assets/scripts/bevy_api.lua | 5 +-- .../src/bindings/function/from.rs | 7 ++++ .../src/bindings/function/into.rs | 6 ++++ .../bevy_mod_scripting_functions/src/core.rs | 36 ++++++++++--------- 4 files changed, 36 insertions(+), 18 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index ad601d2abc..993e37f90f 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -15,8 +15,8 @@ function on_event() print(script) print(world) - print(world:hello(entity, entity)) - print(world:test_vec({entity, entity})[1]) + -- print(world:hello(entity, entity)) + -- print(world:test_vec({entity, entity})[1]) local my_component_type = world:get_type_by_name("MyComponent") @@ -34,6 +34,7 @@ function on_event() print(comp.option_usize) print("\nvec") -- print(table_to_string(comp.vec_of_usize)) + print(comp.vec_of_usize) comp.vec_of_usize = {42,69,72} comp.vec_of_usize[1] = 612312312 print(table_to_string(comp.vec_of_usize)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index 19b765647e..cf8398fc8f 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -32,6 +32,13 @@ impl FromScript for ScriptValue { } } +impl FromScript for () { + type This<'w> = Self; + fn from_script(value: ScriptValue, _world: WorldGuard) -> Result { + Ok(()) + } +} + macro_rules! impl_from_with_downcast { ($($ty:ty),*) => { $( diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index da0f1dd62e..6149055631 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -23,6 +23,12 @@ impl IntoScript for ScriptValue { } } +impl IntoScript for () { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::Unit) + } +} + macro_rules! impl_into_with_downcast { ($variant:tt as $cast:ty [$($ty:ty),*]) => { $( diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index e5d1f869ee..1043e7175d 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -66,30 +66,34 @@ impl Plugin for CoreFunctionsPlugin { fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - .overwrite_script_function("hello", |b: Ref, c: Mut| None::) - .overwrite( - "test_vec", - |s: WorldCallbackAccess, entities: Vec| entities, - ) - .overwrite("spawn", |s: WorldCallbackAccess| s.spawn()) - .overwrite( + // .overwrite_script_function("hello", |b: Ref, c: Mut| None::) + // .overwrite( + // "test_vec", + // |s: WorldCallbackAccess, entities: Vec| entities, + // ) + .overwrite_script_function("spawn", |s: WorldCallbackAccess| Val(s.spawn())) + .overwrite_script_function( "get_type_by_name", - |world: WorldCallbackAccess, type_name: String| world.get_type_by_name(type_name), + |world: WorldCallbackAccess, type_name: String| { + world.get_type_by_name(type_name).map(Val) + }, ) - .overwrite( + .overwrite_script_function( "get_component", - |world: WorldCallbackAccess, entity: Entity, registration: ScriptTypeRegistration| { + |world: WorldCallbackAccess, + entity: Val, + registration: Val| { let s: ScriptValue = registration .component_id() - .and_then(|id| world.get_component(entity, id).transpose()) + .and_then(|id| world.get_component(*entity, id).transpose()) .into(); s }, ) - .overwrite("exit", |s: WorldCallbackAccess| s.exit()); + .overwrite_script_function("exit", |s: WorldCallbackAccess| s.exit()); NamespaceBuilder::::new(reg) - .overwrite( + .overwrite_script_function( "get", |world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue| { if let ScriptValue::Reference(mut r) = self_ { @@ -103,7 +107,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe } }, ) - .overwrite( + .overwrite_script_function( "get_1_indexed", |world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue| { if let ScriptValue::Reference(mut r) = self_ { @@ -118,7 +122,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe } }, ) - .overwrite( + .overwrite_script_function( "set", |world: WorldCallbackAccess, self_: ScriptValue, @@ -151,7 +155,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe ScriptValue::Unit }, ) - .overwrite( + .overwrite_script_function( "set_1_indexed", |world: WorldCallbackAccess, self_: ScriptValue, From e4cbb260a132f967c7a2c674741f5554e67dc967 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 17 Dec 2024 19:11:36 +0000 Subject: [PATCH 057/217] remove older stuff --- .../src/bindings/function/from.rs | 1 + .../src/bindings/function/into.rs | 7 + .../src/bindings/function/into_ref.rs | 87 +++ .../src/bindings/function/mod.rs | 5 +- .../src/bindings/pretty_print.rs | 2 +- .../src/bindings/script_value/from.rs | 581 ---------------- .../src/bindings/script_value/into.rs | 305 --------- .../src/bindings/script_value/mod.rs | 636 ------------------ .../src/reflection_extensions.rs | 4 +- .../bevy_mod_scripting_functions/src/core.rs | 4 +- .../src/bindings/reference.rs | 2 +- 11 files changed, 103 insertions(+), 1531 deletions(-) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs delete mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs delete mode 100644 crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index cf8398fc8f..8ddeae9fae 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -49,6 +49,7 @@ macro_rules! impl_from_with_downcast { ScriptValue::Integer(i) => Ok(i as $ty), ScriptValue::Float(i) => Ok(i as $ty), ScriptValue::Reference(r) => r.downcast::(world), + ScriptValue::Bool(b) => Ok(b as usize as $ty), _ => Err(InteropError::value_mismatch(std::any::TypeId::of::(), value)), } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index 6149055631..91a2de7c58 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -29,6 +29,12 @@ impl IntoScript for () { } } +impl IntoScript for bool { + fn into_script(self, world: WorldGuard) -> Result { + Ok(ScriptValue::Bool(self)) + } +} + macro_rules! impl_into_with_downcast { ($variant:tt as $cast:ty [$($ty:ty),*]) => { $( @@ -63,6 +69,7 @@ impl_into_stringlike!( s, [ (String => s), + (char => s.to_string()), (PathBuf => s.to_string_lossy().to_string()), (OsString => s.into_string().map_err(|e| InteropError::unsupported_operation(None, Some(Box::new(e)), "Could not convert OsString to String".to_owned()))?) ] diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs new file mode 100644 index 0000000000..21eb2f3bfe --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs @@ -0,0 +1,87 @@ +use std::{any::TypeId, ffi::OsString, path::PathBuf}; + +use crate::{ + bindings::{function::into::IntoScript, ReflectReference, WorldGuard}, + error::InteropError, + prelude::ScriptValue, + reflection_extensions::TypeIdExtensions, +}; + +/// Converts a value represented by a reference into a [`crate::bindings::function::ScriptValue`]. +/// Instead of a direct conversion, the trait tries to peek into the value behind the reference and find out the most suitable representation. +/// +/// - Primitives are converted to simple values +/// - Container types are converted to references (so the references persist after accesses inside them) +pub trait IntoScriptRef { + fn into_script_ref( + self_: ReflectReference, + world: WorldGuard, + ) -> Result; +} + +macro_rules! match_by_type { + (match $on:ident {$($id:ident : $ty:ty => $conv:expr),*}) => { + $( + let $id = std::any::TypeId::of::<$ty>(); + )* + + match $on { + $( + $id => {$conv}, + )* + _ => {}, + } + }; +} + +macro_rules! downcast_into_value { + ($r:ident, $ty:ty) => { + *$r.try_downcast_ref::<$ty>().ok_or_else(|| { + InteropError::type_mismatch( + std::any::TypeId::of::<$ty>(), + $r.get_represented_type_info().map(|i| i.type_id()), + ) + })? + }; +} + +impl IntoScriptRef for ReflectReference { + fn into_script_ref( + self_: ReflectReference, + world: WorldGuard, + ) -> Result { + self_.with_reflect(world.clone(), |r| { + let type_id = r + .get_represented_type_info() + .map(|i| i.type_id()) + .or_fake_id(); + + match_by_type! ( + match type_id { + ta : usize => return downcast_into_value!(r, usize).into_script(world), + tb : isize => return downcast_into_value!(r, isize).into_script(world), + tc : u8 => return downcast_into_value!(r, u8).into_script(world), + td : u16 => return downcast_into_value!(r, u16).into_script(world), + te : u32 => return downcast_into_value!(r, u32).into_script(world), + tf : u64 => return downcast_into_value!(r, u64).into_script(world), + tg : u128 => return downcast_into_value!(r, u128).into_script(world), + th : i8 => return downcast_into_value!(r, i8).into_script(world), + ti : i16 => return downcast_into_value!(r, i16).into_script(world), + tj : i32 => return downcast_into_value!(r, i32).into_script(world), + tk : i64 => return downcast_into_value!(r, i64).into_script(world), + tl : i128 => return downcast_into_value!(r, i128).into_script(world), + tm : f32 => return downcast_into_value!(r, f32).into_script(world), + tn : f64 => return downcast_into_value!(r, f64).into_script(world), + to : bool => return downcast_into_value!(r, bool).into_script(world), + tp : char => return downcast_into_value!(r, char).into_script(world), + tq : String => return downcast_into_value!(r, String).clone().into_script(world), + tr : PathBuf => return downcast_into_value!(r, PathBuf).clone().into_script(world), + ts : OsString=> return downcast_into_value!(r, OsString).clone().into_script(world), + tn : () => return Ok(ScriptValue::Unit) + } + ); + + Ok(ScriptValue::Unit) + })? + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index c7db114ce8..afbca6fa5b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -2,6 +2,7 @@ use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; pub mod from; pub mod into; +pub mod into_ref; pub mod script_function; use bevy::reflect::{ @@ -18,9 +19,7 @@ use crate::{ }; use super::{ - access_map::ReflectAccessId, - pretty_print::DisplayWithWorld, - script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, + access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectBase, ReflectReference, WorldAccessGuard, WorldCallbackAccess, WorldGuard, }; diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 7ed86f7ad9..ec85579c99 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -117,7 +117,7 @@ impl ReflectReferencePrinter { let type_id = v .get_represented_type_info() .map(|t| t.type_id()) - .type_id_or_fake_id(); + .or_fake_id(); output.push_str("Reflect("); match type_id { diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs deleted file mode 100644 index c6d19cf066..0000000000 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/from.rs +++ /dev/null @@ -1,581 +0,0 @@ -use std::{ - any::TypeId, - borrow::Cow, - ffi::OsString, - path::{Path, PathBuf}, -}; - -use bevy::reflect::{ - DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, PartialReflect, ReflectFromReflect, -}; - -use crate::{ - bindings::{ReflectReference, WorldGuard}, - error::InteropError, - reflection_extensions::TypeInfoExtensions, -}; - -use super::{FromScriptValue, ScriptValue}; - -impl FromScriptValue for dyn PartialReflect { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>> { - match target_type_id { - // TODO: if these types ever support reflect, we can uncomment these lines - // For some of these we specifically require the borrowed static variant, this will never let you use a dynamically created string from the script - // we should instead allocate and leak perhaps. then garbage collect later - - // support for arbitrary arg types - t if t == TypeId::of::() => return Some(Ok(Box::new(value))), - - t if t == TypeId::of::<()>() => { - return <()>::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return bool::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return <&str>::from_script_value(value, world, target_type_id) - } - // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => { - return <&Path>::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::>() => { - return >::from_script_value(value, world, target_type_id) - } - // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => { - return f32::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return f64::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i8::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i16::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i32::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i64::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return i128::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return isize::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u8::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u16::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u32::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u64::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return u128::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return usize::from_script_value(value, world, target_type_id); - } - // t if t == TypeId::of::>() => return >::from_script_value(value, world, target_type_id), - // t if t == TypeId::of::() => return ::from_script_value(value, world, target_type_id), - t if t == TypeId::of::() => { - return ::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return ::from_script_value(value, world, target_type_id) - } - t if t == TypeId::of::() => { - return ::from_script_value(value, world, target_type_id) - } - _ => {} - }; - - if let Some(opt) = >::from_script_value( - value.clone(), - world.clone(), - target_type_id, - ) { - Some(opt) - } else if let Some(vec) = >::from_script_value( - value.clone(), - world.clone(), - target_type_id, - ) { - Some(vec) - } else { - ReflectReference::from_script_value(value, world.clone(), target_type_id) - } - } -} - -impl FromScriptValue for Option<&dyn PartialReflect> { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>> { - println!("Option<&dyn PartialReflect>::from_script_value {:?}", value); - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - let type_info = type_registry.get_type_info(target_type_id)?; - - if !type_info.is_option() { - return None; - }; - - let inner_type_id = type_info.option_inner_type().expect("invariant"); - - let dynamic = match value { - ScriptValue::Unit => { - let mut dynamic_none = DynamicEnum::new("None", DynamicVariant::Unit); - dynamic_none.set_represented_type(Some(type_info)); - Box::new(dynamic_none) - } - v => { - let inner = match ::from_script_value( - v, - world.clone(), - inner_type_id, - ) { - Some(Ok(inner)) => inner, - Some(Err(e)) => return Some(Err(e)), - None => return None, - }; - - let mut dynamic_some = DynamicEnum::new( - "Some", - DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), - ); - dynamic_some.set_represented_type(Some(type_info)); - Box::new(dynamic_some) - } - }; - - match type_registry.get_type_data::(target_type_id) { - Some(from_reflect) => from_reflect - .from_reflect(dynamic.as_partial_reflect()) - .map(|v| Ok(v.into_partial_reflect())), - None => Some(Err(InteropError::missing_type_data( - target_type_id, - "ReflectFromReflect".to_owned(), - ))), - } - } -} - -impl FromScriptValue for Vec<&dyn PartialReflect> { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>> { - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - let type_info = type_registry.get_type_info(target_type_id)?; - - if !type_info.is_list() { - return None; - }; - - let inner_type_id = type_info.list_inner_type().expect("invariant"); - - let dynamic = match value { - ScriptValue::List(vec) => { - let mut dynamic_list = DynamicList::default(); - dynamic_list.set_represented_type(Some(type_info)); - - for v in vec.into_iter() { - let inner = match ::from_script_value( - v, - world.clone(), - inner_type_id, - ) { - Some(Ok(inner)) => inner, - Some(Err(e)) => return Some(Err(e)), - None => return None, - }; - - dynamic_list.push_box(inner); - } - Box::new(dynamic_list) - } - ScriptValue::Reference(reflect_reference) => { - // for references we assume they point to a list already, we can safely - return Some(reflect_reference.to_owned_value(world)); - } - _ => return Some(Err(InteropError::value_mismatch(target_type_id, value))), - }; - - match type_registry.get_type_data::(target_type_id) { - Some(from_reflect) => from_reflect - .from_reflect(dynamic.as_partial_reflect()) - .map(|v| Ok(v.into_partial_reflect())), - None => Some(Err(InteropError::missing_type_data( - target_type_id, - "ReflectFromReflect".to_owned(), - ))), - } - } -} - -impl FromScriptValue for ReflectReference { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - match value { - ScriptValue::Reference(ref_) => Some(ref_.to_owned_value(world)), - _ => None, - } - } -} - -impl FromScriptValue for bool { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::Bool(v) => Ok(Box::new(v)), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -impl FromScriptValue for &'static str { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<&'static str>() { - Some(match value { - ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(s)), - ScriptValue::Reference(ref_) => ref_ - .downcast::<&'static str>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for Cow<'static, str> { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::>() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(s)), - ScriptValue::Reference(ref_) => ref_ - .downcast::>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for String { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(s.into_owned())), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for f32 { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::Float(v) => Ok(Box::new(v as f32)), - ScriptValue::Integer(v) => Ok(Box::new(v as f32)), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -impl FromScriptValue for f64 { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::Float(v) => Ok(Box::new(v)), - ScriptValue::Integer(v) => Ok(Box::new(v as f64)), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -// Macro to implement FromScriptValue for integer types -macro_rules! impl_from_script_value_integer { - ($($t:ty),*) => { - $( - impl FromScriptValue for $t { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<$t>() { - Some(match value { - ScriptValue::Integer(v) => Ok(Box::new(v as $t)), - ScriptValue::Float(v) => Ok(Box::new(v as $t)), - ScriptValue::Reference(ref_) => ref_ - .downcast::<$t>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch( - target_type, - value, - )), - }) - } else { - None - } - } - } - )* - }; -} - -impl_from_script_value_integer!(i8, i16, i32, i64, i128, isize); -impl_from_script_value_integer!(u8, u16, u32, u64, u128, usize); - -impl FromScriptValue for &'static Path { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<&'static Path>() { - Some(match value { - ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(Path::new(s))), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -impl FromScriptValue for PathBuf { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(PathBuf::from(s.into_owned()))), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -// Implementations for additional types - -// impl FromScriptValue for Box { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::>() { -// match value { -// ScriptValue::String(s) => Ok(Box::new(s.into_owned().into_boxed_str())), -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::>())), -// } -// .into()) -// } -// } -// } - -// impl FromScriptValue for CString { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::() { -// match value { -// ScriptValue::String(s) => CString::new(s.into_owned()) -// .map(|cstr| Box::new(cstr) as Box) -// .map_err(|e| { -// InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(e.to_string())), -// } -// .into() -// }), -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::())), -// } -// .into()) -// } -// } -// } - -impl FromScriptValue for OsString { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::() { - Some(match value { - ScriptValue::String(s) => Ok(Box::new(OsString::from(s.into_owned()))), - ScriptValue::Reference(ref_) => ref_ - .downcast::(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)).into(), - }) - } else { - None - } - } -} - -// impl FromScriptValue for &'static OsStr { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::<&'static OsStr>() { -// match value { -// ScriptValue::String(Cow::Borrowed(s)) => Ok(Box::new(OsStr::new(s))), -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::<&'static OsStr>())), -// } -// .into()) -// } -// } -// } - -// impl FromScriptValue for &'static CStr { -// fn from_script_value( -// target_type: TypeId, -// value: ScriptValue, -// world: WorldGuard, -// ) -> ScriptResult> { -// if target_type == TypeId::of::<&'static CStr>() { -// match value { -// ScriptValue::String(Cow::Borrowed(s)) => { -// let bytes = s.as_bytes(); -// CStr::from_bytes_with_nul(bytes) -// .map(|cstr| Box::new(cstr) as Box) -// .map_err(|e| { -// InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(e.to_string())), -// } -// .into() -// }) -// } -// _ => Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Owned(value.display_with_world(world))), -// } -// .into()), -// } -// } else { -// Err(InteropError::TypeMismatch { -// expected_type: Cow::Owned(target_type.display_with_world(world)), -// actual_type: Some(Cow::Borrowed(type_name::<&'static CStr>())), -// } -// .into()) -// } -// } -// } diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs deleted file mode 100644 index 37d8165ea5..0000000000 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/into.rs +++ /dev/null @@ -1,305 +0,0 @@ -use std::{ - any::TypeId, - borrow::Cow, - ffi::{CStr, CString, OsStr, OsString}, - path::{Path, PathBuf}, -}; - -use bevy::reflect::{ - DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, PartialReflect, ReflectFromReflect, -}; - -use crate::{ - bindings::{ReflectReference, WorldGuard}, - error::InteropError, - reflection_extensions::{PartialReflectExt, TypeIdExtensions}, -}; - -use super::{FromScriptValue, IntoScriptValue, ScriptValue}; - -macro_rules! into_script_value_downcast { - ($self_:ident, $ty:ty, $world:ident $(, $($exp:tt)*)?) => {{ - $self_ - .try_downcast_ref::<$ty>() - .ok_or_else(|| InteropError::type_mismatch( - std::any::TypeId::of::<$ty>(), - $self_ - .get_represented_type_info() - .map(|ti| ti.type_id()), - ))? - $($($exp)*)? - .into_script_value($world.clone()) - }}; -} - -impl IntoScriptValue for &dyn PartialReflect { - fn into_script_value(self, world: WorldGuard) -> Result { - bevy::log::trace!("Converting {:?} to ScriptValue", self); - - let target_type_id = self - .get_represented_type_info() - .map(|ti| ti.type_id()) - .type_id_or_fake_id(); - - match target_type_id { - // for arbitrary result types we support ScriptValue returns - _ if TypeId::of::() == target_type_id => { - match self.try_downcast_ref::() { - Some(ScriptValue::Error(e)) => return Err(e.clone()), - Some(script_val) => return Ok(script_val.clone()), - None => { - return Err(InteropError::type_mismatch( - TypeId::of::(), - Some(target_type_id), - )) - } - } - } - _ if TypeId::of::<()>() == target_type_id => { - return into_script_value_downcast!(self, (), world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, bool, world); - } - _ if TypeId::of::<&'static str>() == target_type_id => { - return into_script_value_downcast!(self, &'static str, world); - } - _ if TypeId::of::<&'static CStr>() == target_type_id => { - return into_script_value_downcast!(self, &'static CStr, world); - } - _ if TypeId::of::<&'static OsStr>() == target_type_id => { - return into_script_value_downcast!(self, &'static OsStr, world); - } - _ if TypeId::of::<&'static Path>() == target_type_id => { - return into_script_value_downcast!(self, &'static Path, world); - } - _ if TypeId::of::>() == target_type_id => { - return into_script_value_downcast!(self, Cow<'static, str>, world, .clone()); - } - _ if TypeId::of::>() == target_type_id => { - return into_script_value_downcast!(self, Cow<'static, CStr>, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, f32, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, f64, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i8, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i16, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i32, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i64, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, i128, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, isize, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u8, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u16, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u32, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u64, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, u128, world); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, usize, world); - } - _ if TypeId::of::>() == target_type_id => { - return into_script_value_downcast!(self, Box, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, CString, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, String, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, OsString, world, .clone()); - } - _ if TypeId::of::() == target_type_id => { - return into_script_value_downcast!(self, PathBuf, world, .clone()); - } - _ => {} - }; - - // for options we want to convert to - // - the inner type if it's some - // - nil if it's none - // to retain the reference we need to return a reference pointing into the inner type - if let Ok(inner) = self.as_option() { - return inner.into_script_value(world); - } - - // if let Ok(list) = self.as_list() { - // let list: Vec<_> = list.collect(); - // return list.into_script_value(world); - // } - - // this is us saying, we cannot convert this into a nice script value - // you're gonna have to allocate and ref to it - Err(InteropError::better_conversion_exists::()) - } - - // fn reference_into_script_value( - // type_id: TypeId, - // self_ref: ReflectReference, - // world: WorldGuard, - // ) -> Result { - - // } -} - -impl IntoScriptValue for Option<&dyn PartialReflect> { - fn into_script_value(self, world: WorldGuard) -> Result { - bevy::log::trace!("Converting Option {:?} to ScriptValue", self); - match self { - Some(inner) => inner.into_script_value(world), - None => Ok(ScriptValue::Unit), - } - } -} - -impl IntoScriptValue for Vec<&dyn PartialReflect> { - fn into_script_value(mut self, world: WorldGuard) -> Result { - let mut vec = Vec::with_capacity(self.len()); - for v in self.iter_mut() { - vec.push(v.into_script_value(world.clone())?); - } - Ok(ScriptValue::List(vec)) - } -} - -impl IntoScriptValue for ReflectReference { - fn into_script_value(self, _world: WorldGuard) -> Result { - Ok(ScriptValue::Reference(self)) - } -} - -impl IntoScriptValue for () { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Unit) - } -} - -impl IntoScriptValue for &'static str { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.into())) - } -} - -impl IntoScriptValue for &'static CStr { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string_lossy())) - } -} - -impl IntoScriptValue for &'static OsStr { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string_lossy())) - } -} - -impl IntoScriptValue for &'static Path { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string_lossy())) - } -} - -impl IntoScriptValue for Cow<'static, str> { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.into_owned().into())) - } -} - -impl IntoScriptValue for Cow<'static, CStr> { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl IntoScriptValue for bool { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Bool(self)) - } -} - -impl IntoScriptValue for f32 { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Float(self as f64)) - } -} - -impl IntoScriptValue for f64 { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Float(self)) - } -} - -macro_rules! into_script_value_integers { - ($($ty:ty),*) => { - $( - impl IntoScriptValue for $ty { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::Integer(self as i64)) - } - } - )* - }; -} - -into_script_value_integers!(i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize); - -impl IntoScriptValue for Box { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.to_string().into())) - } -} - -impl IntoScriptValue for CString { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl IntoScriptValue for String { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String(self.into())) - } -} - -impl IntoScriptValue for OsString { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} - -impl IntoScriptValue for PathBuf { - fn into_script_value(self, _: WorldGuard) -> Result { - Ok(ScriptValue::String( - self.to_string_lossy().into_owned().into(), - )) - } -} diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs index d831a85bf8..b23b067fe3 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -15,10 +15,6 @@ use crate::{ reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, }; -mod from; -mod into; -pub use {from::*, into::*}; - use super::{pretty_print::DisplayWithWorld, ReflectReference, WorldGuard}; /// An abstraction of values that can be passed to and from scripts. @@ -189,635 +185,3 @@ impl TryFrom for ParsedPath { }) } } - -/// A trait for converting a value into a [`ScriptValue`]. -/// -/// If a [`crate::error::InteropError::better_conversion_exists`] is thrown, the conversion is not possible and you should treat this as a sign to try another method. -pub trait IntoScriptValue { - /// Converts the value into a [`ScriptValue`]. This conversion should: - /// - Ideally convert to a concrete instance of [`Self`] or at least a concrete type representing [`Self`]. - /// - If the value is not possible to convert nicely as a value throw a [`crate::error::InteropError::better_conversion_exists`] error so the caller can try another method. - fn into_script_value(self, world: WorldGuard) -> Result; - - /// Some values are better represented as references returned to a script. - /// This method should be called when such values might be returned to a script. - /// By default this will call [`IntoScriptValue::into_script_value`] and convert the underlying [`&dyn PartialReflect`] - /// However if `into_script_value` throws a [`crate::error::InteropError::better_conversion_exists`] error, this method will directly return the reference instead. - fn reference_into_script_value( - // type_id: TypeId, - self_ref: ReflectReference, - world: WorldGuard, - ) -> Result { - match self_ref.with_reflect(world.clone(), |r| r.into_script_value(world))? { - Err(e) if matches!(e.inner(), InteropErrorInner::BetterConversionExists { .. }) => { - Ok(ScriptValue::Reference(self_ref)) - } - e => e, - } - } -} - -/// Targeted conversion from a [`ScriptValue`] to a specific type. Can create dynamic types as well as concrete types depending on the implementation. -pub trait FromScriptValue { - /// Returning None is saying that the conversion is not possible. - /// Returning Some means that the conversion was possible and the result is the converted value or a failure. - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type_id: TypeId, - ) -> Option, InteropError>>; -} - -impl FromScriptValue for () { - fn from_script_value( - value: ScriptValue, - world: WorldGuard, - target_type: TypeId, - ) -> Option, InteropError>> { - if target_type == TypeId::of::<()>() { - Some(match value { - ScriptValue::Unit => Ok(Box::new(())), - ScriptValue::Reference(ref_) => ref_ - .downcast::<()>(world) - .map(|v| Box::new(v) as Box), - _ => Err(InteropError::value_mismatch(target_type, value)), - }) - } else { - None - } - } -} - -#[cfg(test)] -mod test { - use std::any::Any; - - use bevy::{ - prelude::{AppTypeRegistry, World}, - utils::HashMap, - }; - - use crate::{bindings::WorldAccessGuard, prelude::AppReflectAllocator}; - - use super::*; - - #[test] - fn test_basic_into_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - let guard = WorldGuard::new(guard); - assert_eq!( - ().into_script_value(guard.clone()).unwrap(), - ScriptValue::Unit - ); - assert_eq!( - true.into_script_value(guard.clone()).unwrap(), - ScriptValue::Bool(true) - ); - assert_eq!( - false.into_script_value(guard.clone()).unwrap(), - ScriptValue::Bool(false) - ); - assert_eq!( - 0i64.into_script_value(guard.clone()).unwrap(), - ScriptValue::Integer(0) - ); - assert_eq!( - 0.0f64.into_script_value(guard.clone()).unwrap(), - ScriptValue::Float(0.0) - ); - assert_eq!( - "".into_script_value(guard.clone()).unwrap(), - ScriptValue::String("".into()) - ); - assert_eq!( - "hello".into_script_value(guard.clone()).unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - CString::new("hello") - .unwrap() - .into_script_value(guard.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - OsStr::new("hello") - .into_script_value(guard.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - Path::new("hello").into_script_value(guard.clone()).unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - Cow::Borrowed("hello") - .into_script_value(guard.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - Cow::::Owned("hello".to_string()) - .into_script_value(guard) - .unwrap(), - ScriptValue::String("hello".into()) - ); - } - - #[test] - fn test_reference_into_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let world = WorldAccessGuard::new(&mut world); - - let allocator = world.allocator(); - let mut allocator = allocator.write(); - let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); - let string_reference = ReflectReference::new_allocated("hello", &mut allocator); - let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); - let none_reference = ReflectReference::new_allocated(None::, &mut allocator); - let nested_option_reference = - ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); - let nested_none_reference = - ReflectReference::new_allocated(Some(None::), &mut allocator); - - let vec_reference = ReflectReference::new_allocated(vec![1, 2, 3], &mut allocator); - let map_reference = ReflectReference::new_allocated( - HashMap::from_iter(vec![(1, 2), (3, 4)]), - &mut allocator, - ); - - drop(allocator); - - let world = WorldGuard::new(world); - - assert_eq!( - usize_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Integer(2) - ); - - assert_eq!( - string_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::String("hello".into()) - ); - - assert_eq!( - option_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Integer(2) - ); - - assert_eq!( - none_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Unit - ); - - assert_eq!( - nested_option_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Integer(2) - ); - - assert_eq!( - nested_none_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Unit - ); - - assert_eq!( - vec_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Reference(vec_reference) - ); - - assert_eq!( - map_reference - .clone() - .into_script_value(world.clone()) - .unwrap(), - ScriptValue::Reference(map_reference) - ); - } - - #[test] - fn test_basic_from_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - let guard = WorldGuard::new(guard); - - assert!( - <()>::from_script_value(ScriptValue::Unit, guard.clone(), TypeId::of::<()>()) - .unwrap() - .unwrap() - .reflect_partial_eq(&()) - .unwrap() - ); - - assert!(::from_script_value( - ScriptValue::Bool(true), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&true) - .unwrap()); - - assert!(<&'static str>::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::<&'static str>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&"hello") - .unwrap()); - - assert!(>::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Cow::Borrowed("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&"hello".to_string()) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Float(0.0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0.0f32) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Float(0.0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0.0f64) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i64) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i8) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i16) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i32) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0i128) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0isize) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u8) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u16) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u32) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u64) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0u128) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Integer(0), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&0usize) - .unwrap()); - - assert!(<&'static Path>::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::<&'static Path>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Path::new("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&PathBuf::from("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&OsString::from("hello")) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&OsString::from("hello")) - .unwrap()); - } - - #[test] - fn test_script_value_reference_from_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - - let allocator = guard.allocator(); - let mut allocator = allocator.write(); - let usize_reference = ReflectReference::new_allocated(2usize, &mut allocator); - let string_reference = ReflectReference::new_allocated("hello", &mut allocator); - let option_reference = ReflectReference::new_allocated(Some(2usize), &mut allocator); - let none_reference = ReflectReference::new_allocated(None::, &mut allocator); - let nested_option_reference = - ReflectReference::new_allocated(Some(Some(2usize)), &mut allocator); - let nested_none_reference = - ReflectReference::new_allocated(Some(None::), &mut allocator); - - let vec_option_reference = - ReflectReference::new_allocated(vec![Some(1usize), None, Some(3usize)], &mut allocator); - - let type_registry = guard.type_registry(); - let mut type_registry = type_registry.write(); - - type_registry.register::<&'static str>(); - type_registry.register::>(); - type_registry.register::>>(); - type_registry.register::>>(); - - drop(type_registry); - drop(allocator); - let guard = WorldGuard::new(guard); - - assert!(::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&2usize) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Reference(string_reference.clone()), - guard.clone(), - TypeId::of::<&'static str>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&"hello") - .unwrap()); - assert!(::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(2usize)) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&None::) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Reference(usize_reference.clone()), - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(Some(2usize))) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(None::)) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Reference(vec_option_reference.clone()), - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&vec![Some(1usize), None, Some(3usize)]) - .unwrap()); - } - - #[test] - pub fn test_script_value_other_from_conversions() { - let mut world = World::new(); - world.insert_resource(AppReflectAllocator::default()); - world.insert_resource(AppTypeRegistry::default()); - let guard = WorldAccessGuard::new(&mut world); - - let type_registry = guard.type_registry(); - let mut type_registry = type_registry.write(); - type_registry.register::>(); - type_registry.register::>>(); - - drop(type_registry); - let guard = WorldGuard::new(guard); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some("hello".to_string())) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&None::) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::Unit, - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&None::) - .unwrap()); - - assert!(::from_script_value( - ScriptValue::String("hello".into()), - guard.clone(), - TypeId::of::>>() - ) - .unwrap() - .unwrap() - .reflect_partial_eq(&Some(Some("hello".to_string()))) - .unwrap()); - } -} diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 838839ea81..f325d78eba 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -98,11 +98,11 @@ pub trait PartialReflectExt { ) -> Result, InteropError>; } pub trait TypeIdExtensions { - fn type_id_or_fake_id(&self) -> TypeId; + fn or_fake_id(&self) -> TypeId; } impl TypeIdExtensions for Option { - fn type_id_or_fake_id(&self) -> TypeId { + fn or_fake_id(&self) -> TypeId { struct UknownType; match self { Some(t) => *t, diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 1043e7175d..ed10324d44 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -138,7 +138,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let target_type_id = r .get_represented_type_info() .map(|i| i.type_id()) - .type_id_or_fake_id(); + .or_fake_id(); let other = ::from_script_value( value, world.clone(), @@ -172,7 +172,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let target_type_id = r .get_represented_type_info() .map(|i| i.type_id()) - .type_id_or_fake_id(); + .or_fake_id(); let other = ::from_script_value( value, world.clone(), diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index a1a29074a1..5236f8517b 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -105,7 +105,7 @@ impl UserData for LuaReflectReference { |lua, (self_, key): (LuaReflectReference, LuaScriptValue)| { let world = lua.get_world(); let self_: ReflectReference = self_.into(); - let type_id = self_.tail_type_id(world.clone())?.type_id_or_fake_id(); + let type_id = self_.tail_type_id(world.clone())?.or_fake_id(); let key: ScriptValue = key.into(); From db825a56e0f49fa53f6d9b53d7546ce910634fe2 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 17 Dec 2024 23:41:21 +0000 Subject: [PATCH 058/217] shift to bakery paradigm --- .../src/bindings/function/from_ref.rs | 35 + .../src/bindings/function/into_ref.rs | 88 ++- .../src/bindings/function/mod.rs | 685 +++++------------- .../src/reflection_extensions.rs | 25 +- .../bevy_mod_scripting_functions/src/core.rs | 80 +- .../src/bindings/reference.rs | 2 +- .../src/bindings/world.rs | 2 +- 7 files changed, 315 insertions(+), 602 deletions(-) create mode 100644 crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs new file mode 100644 index 0000000000..1bebf2d71b --- /dev/null +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs @@ -0,0 +1,35 @@ +use std::any::TypeId; + +use bevy::reflect::PartialReflect; + +use crate::{ + bindings::{ReflectReference, WorldGuard}, + error::InteropError, + prelude::ScriptValue, +}; + +/// Converts from a [`ScriptValue`] to a value equivalent to the given [`TypeId`]. +/// +/// Type Erased version of [`super::from::FromScript`]. +pub trait FromScriptRef { + fn from_script_ref( + target: TypeId, + value: ScriptValue, + world: WorldGuard, + ) -> Result + where + Self: Sized; +} + +impl FromScriptRef for Box { + fn from_script_ref( + target: TypeId, + value: ScriptValue, + world: WorldGuard, + ) -> Result + where + Self: Sized, + { + todo!() + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs index 21eb2f3bfe..cbc79831a3 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs @@ -1,15 +1,22 @@ use std::{any::TypeId, ffi::OsString, path::PathBuf}; +use bevy::{ + reflect::{ParsedPath, PartialReflect}, + text::cosmic_text::rustybuzz::Script, +}; + use crate::{ bindings::{function::into::IntoScript, ReflectReference, WorldGuard}, error::InteropError, prelude::ScriptValue, - reflection_extensions::TypeIdExtensions, + reflection_extensions::{PartialReflectExt, TypeIdExtensions}, }; /// Converts a value represented by a reference into a [`crate::bindings::function::ScriptValue`]. /// Instead of a direct conversion, the trait tries to peek into the value behind the reference and find out the most suitable representation. /// +/// Type Erased version of [`super::from::FromScript`]. +/// /// - Primitives are converted to simple values /// - Container types are converted to references (so the references persist after accesses inside them) pub trait IntoScriptRef { @@ -22,12 +29,13 @@ pub trait IntoScriptRef { macro_rules! match_by_type { (match $on:ident {$($id:ident : $ty:ty => $conv:expr),*}) => { $( + #[allow(unused_variables)] let $id = std::any::TypeId::of::<$ty>(); )* match $on { $( - $id => {$conv}, + $id if $id == std::any::TypeId::of::<$ty>() => {$conv}, )* _ => {}, } @@ -50,38 +58,54 @@ impl IntoScriptRef for ReflectReference { self_: ReflectReference, world: WorldGuard, ) -> Result { - self_.with_reflect(world.clone(), |r| { - let type_id = r - .get_represented_type_info() - .map(|i| i.type_id()) - .or_fake_id(); + self_.with_reflect(world.clone(), |r| into_script_ref(self_.clone(), r, world))? + } +} - match_by_type! ( - match type_id { - ta : usize => return downcast_into_value!(r, usize).into_script(world), - tb : isize => return downcast_into_value!(r, isize).into_script(world), - tc : u8 => return downcast_into_value!(r, u8).into_script(world), - td : u16 => return downcast_into_value!(r, u16).into_script(world), - te : u32 => return downcast_into_value!(r, u32).into_script(world), - tf : u64 => return downcast_into_value!(r, u64).into_script(world), - tg : u128 => return downcast_into_value!(r, u128).into_script(world), - th : i8 => return downcast_into_value!(r, i8).into_script(world), - ti : i16 => return downcast_into_value!(r, i16).into_script(world), - tj : i32 => return downcast_into_value!(r, i32).into_script(world), - tk : i64 => return downcast_into_value!(r, i64).into_script(world), - tl : i128 => return downcast_into_value!(r, i128).into_script(world), - tm : f32 => return downcast_into_value!(r, f32).into_script(world), - tn : f64 => return downcast_into_value!(r, f64).into_script(world), - to : bool => return downcast_into_value!(r, bool).into_script(world), - tp : char => return downcast_into_value!(r, char).into_script(world), - tq : String => return downcast_into_value!(r, String).clone().into_script(world), - tr : PathBuf => return downcast_into_value!(r, PathBuf).clone().into_script(world), - ts : OsString=> return downcast_into_value!(r, OsString).clone().into_script(world), - tn : () => return Ok(ScriptValue::Unit) - } - ); +fn into_script_ref( + mut self_: ReflectReference, + r: &dyn PartialReflect, + world: WorldGuard, +) -> Result { + let type_id = r + .get_represented_type_info() + .map(|i| i.type_id()) + .or_fake_id(); + match_by_type! ( + match type_id { + ta : usize => return downcast_into_value!(r, usize).into_script(world), + tb : isize => return downcast_into_value!(r, isize).into_script(world), + tc : u8 => return downcast_into_value!(r, u8).into_script(world), + td : u16 => return downcast_into_value!(r, u16).into_script(world), + te : u32 => return downcast_into_value!(r, u32).into_script(world), + tf : u64 => return downcast_into_value!(r, u64).into_script(world), + tg : u128 => return downcast_into_value!(r, u128).into_script(world), + th : i8 => return downcast_into_value!(r, i8).into_script(world), + ti : i16 => return downcast_into_value!(r, i16).into_script(world), + tj : i32 => return downcast_into_value!(r, i32).into_script(world), + tk : i64 => return downcast_into_value!(r, i64).into_script(world), + tl : i128 => return downcast_into_value!(r, i128).into_script(world), + tm : f32 => return downcast_into_value!(r, f32).into_script(world), + tn : f64 => return downcast_into_value!(r, f64).into_script(world), + to : bool => return downcast_into_value!(r, bool).into_script(world), + tp : char => return downcast_into_value!(r, char).into_script(world), + tq : String => return downcast_into_value!(r, String).clone().into_script(world), + tr : PathBuf => return downcast_into_value!(r, PathBuf).clone().into_script(world), + ts : OsString=> return downcast_into_value!(r, OsString).clone().into_script(world), + tn : () => return Ok(ScriptValue::Unit) + } + ); + + // either return nil or ref into + if let Ok(as_option) = r.as_option() { + return if let Some(s) = as_option { + self_.index_path(ParsedPath::parse_static(".0").expect("invariant")); + into_script_ref(self_, s, world) + } else { Ok(ScriptValue::Unit) - })? + }; } + + Ok(ScriptValue::Reference(self_)) } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index afbca6fa5b..265ca374f7 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -1,6 +1,7 @@ use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; pub mod from; +pub mod from_ref; pub mod into; pub mod into_ref; pub mod script_function; @@ -26,302 +27,169 @@ use super::{ /// Can be implemented for callables which require dynamic access to the world to be called. /// /// The claim and release functions must be used to scope the access to the world such that function output . -pub trait CallableWithAccess { - fn with_call O, I: IntoIterator>( +pub trait CallScriptFunction { + fn call_script_function>( &self, args: I, - world: Arc, - f: F, - ) -> Result; - - fn dynamic_call>( - &self, - args: I, - world: Arc, + world: WorldGuard, ) -> Result; + + // fn with_call O, I: IntoIterator>( + // &self, + // args: I, + // world: Arc, + // f: F, + // ) -> Result; + + // fn dynamic_call>( + // &self, + // args: I, + // world: Arc, + // ) -> Result; } -impl CallableWithAccess for DynamicFunction<'_> { - fn with_call O, I: IntoIterator>( +// impl CallAsScriptFunction for DynamicFunction<'_> { +// fn with_call O, I: IntoIterator>( +// &self, +// args: I, +// world: Arc, +// f: F, +// ) -> Result { +// let info = self.info().args(); + +// let mut arg_iter = args.into_iter().peekable(); + +// // we also want to add the world arg if it's required as the first arg but not present +// // let (mut args_list, mut accesses) = if self.first_arg_is_world() +// // && !arg_iter +// // .peek() +// // .map(|a| a == &ScriptValue::World) +// // .unwrap_or(false) +// // { +// // std::iter::once(ScriptValue::World) +// // .chain(arg_iter) +// // .a(self.info(), world.clone())? +// // } else { +// // arg_iter.into_args_list_with_access(self.info(), world.clone())? +// // }; + +// // let mut final_args_list = ArgList::default(); + +// // // we sometimes want to use the boxed value in the arg instead of allocating and refing to it. +// // // for this reason let's be lenient in calling functions. Allow passing owned values as refs +// // for (arg, info) in args_list.iter_mut().zip(info.iter()) { +// // let next_arg = match (arg, info.ownership()) { +// // (ArgValue::Owned(r), Ownership::Ref) => { +// // ArgValue::Ref((r as &Box).as_ref()) +// // } +// // (ArgValue::Owned(r), Ownership::Mut) => ArgValue::Mut(r.as_mut()), +// // (v, _) => { +// // // muahaha, shouldn't allocate due to ZST +// // let a = std::mem::replace(v, ArgValue::Owned(Box::new(()))); +// // a +// // } +// // }; +// // final_args_list = final_args_list.push_arg(next_arg); +// // } + +// // bevy::log::trace!( +// // "Calling function: {:?} with args: {:?}", +// // self.info().name(), +// // final_args_list +// // ); + +// // let return_val = match self.call(final_args_list) { +// // Ok(return_val) => return_val, +// // Err(e) => { +// // // Safety: we have not generated any unsafe aliases +// // // - we are releasing only the access we have claimed +// // accesses.drain(..).for_each(|(id, _)| { +// // unsafe { world.release_access(id) }; +// // }); + +// // return Err(InteropError::function_call_error(e)); +// // } +// // }; + +// bevy::log::trace!( +// "Function: {:?} returned: {:?}", +// self.info().name(), +// return_val +// ); + +// let out = f(return_val); +// // Safety: we have not generated any unsafe aliases +// // - we are releasing only the access we have claimed +// accesses.drain(..).for_each(|(id, _)| { +// unsafe { world.release_access(id) }; +// }); + +// Ok(out) +// } + +// fn dynamic_call>( +// &self, +// args: I, +// world: Arc, +// ) -> Result { +// bevy::log::debug!("Dynamic call to function: {:?}", self.info().name()); +// self.with_call(args, world.clone(), |r| { +// match r.try_into_or_boxed::() { +// Ok(script_val) => Ok(script_val), +// Err(e) => { +// let allocator = world.allocator(); +// let mut allocator = allocator.write(); + +// Ok(ReflectReference::new_allocated_boxed(e, &mut allocator).into()) +// } +// } +// }) +// .flatten_interop_error() +// .map_err(|e| InteropError::function_interop_error(self.info(), None, e)) +// } +// } + +impl CallScriptFunction for DynamicFunction<'_> { + fn call_script_function>( &self, args: I, - world: Arc, - f: F, - ) -> Result { - let info = self.info().args(); - - // We need to: - // 1. Claim the correct access for each argument - // 2. Convert to ArgsList for the function call - // 3. Call the function - // 4. Relinquish access to the caller for the return value - // 5. Release the access for each argument - // 6. Return the result - let mut arg_iter = args.into_iter().peekable(); - - // we also want to add the world arg if it's required as the first arg but not present - let (mut args_list, mut accesses) = if self.first_arg_is_world() - && !arg_iter - .peek() - .map(|a| a == &ScriptValue::World) - .unwrap_or(false) - { - std::iter::once(ScriptValue::World) - .chain(arg_iter) - .into_args_list_with_access(self.info(), world.clone())? - } else { - arg_iter.into_args_list_with_access(self.info(), world.clone())? - }; - - let mut final_args_list = ArgList::default(); - - // we sometimes want to use the boxed value in the arg instead of allocating and refing to it. - // for this reason let's be lenient in calling functions. Allow passing owned values as refs - for (arg, info) in args_list.iter_mut().zip(info.iter()) { - let next_arg = match (arg, info.ownership()) { - (ArgValue::Owned(r), Ownership::Ref) => { - ArgValue::Ref((r as &Box).as_ref()) - } - (ArgValue::Owned(r), Ownership::Mut) => ArgValue::Mut(r.as_mut()), - (v, _) => { - // muahaha, shouldn't allocate due to ZST - let a = std::mem::replace(v, ArgValue::Owned(Box::new(()))); - a - } - }; - final_args_list = final_args_list.push_arg(next_arg); - } + world: WorldGuard, + ) -> Result { + let mut args = args.into_iter().peekable(); - bevy::log::trace!( - "Calling function: {:?} with args: {:?}", - self.info().name(), - final_args_list - ); - - let return_val = match self.call(final_args_list) { - Ok(return_val) => return_val, - Err(e) => { - // Safety: we have not generated any unsafe aliases - // - we are releasing only the access we have claimed - accesses.drain(..).for_each(|(id, _)| { - unsafe { world.release_access(id) }; - }); - - return Err(InteropError::function_call_error(e)); - } - }; - - bevy::log::trace!( - "Function: {:?} returned: {:?}", - self.info().name(), - return_val - ); - - let out = f(return_val); - // Safety: we have not generated any unsafe aliases - // - we are releasing only the access we have claimed - accesses.drain(..).for_each(|(id, _)| { - unsafe { world.release_access(id) }; - }); - - Ok(out) - } + let add_world = + self.first_arg_is_world() && args.peek().map_or(true, |a| a != &ScriptValue::World); - fn dynamic_call>( - &self, - args: I, - world: Arc, - ) -> Result { - bevy::log::debug!("Dynamic call to function: {:?}", self.info().name()); - self.with_call(args, world.clone(), |r| { - let conversion = match r { - Return::Owned(partial_reflect) => { - match partial_reflect.as_ref().into_script_value(world.clone()) { - Err(e) - if matches!( - e.inner(), - InteropErrorInner::BetterConversionExists { .. } - ) => - { - let allocator = world.allocator(); - let mut allocator = allocator.write(); - ReflectReference::new_allocated_boxed(partial_reflect, &mut allocator) - .into_script_value(world.clone()) - } - e => e, - } - } - v => { - let ref_ = v.as_ref(); - - match ref_.into_script_value(world.clone()) { - Err(e) - if matches!( - e.inner(), - InteropErrorInner::BetterConversionExists { .. } - ) => - { - let val = - ::from_reflect_or_clone(ref_, world.clone()); - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - ReflectReference::new_allocated_boxed(val, &mut allocator) - .into_script_value(world.clone()) - } - e => e, - } - } - }; - - conversion - }) - .flatten_interop_error() - .map_err(|e| InteropError::function_interop_error(self.info(), None, e)) - } -} + let mut args_list = ArgList::new(); -/// Trait implementable by lists of things representing arguments which can be converted into an `ArgList`. -/// -/// The call needs to collect the correct access id's and types for each argument. -pub trait IntoArgsListWithAccess { - fn into_args_list_with_access<'w>( - self, - function_info: &FunctionInfo, - world: WorldGuard<'w>, - ) -> Result<(Vec>, Vec<(ReflectAccessId, Ownership)>), InteropError>; -} + if add_world { + args_list = args_list.push_arg(ArgValue::Owned(Box::new( + WorldCallbackAccess::from_guard(world.clone()), + ))); + } -impl> IntoArgsListWithAccess for I { - /// Converts a list of references into an `ArgList` and collects the access id's and types for each argument. - /// - /// This is actually safe to call, since we are not actually releasing the access here. - /// Meaning that only after releasing access is it possible to create unsafe aliases - fn into_args_list_with_access<'w>( - self, - function_info: &FunctionInfo, - world: WorldGuard<'w>, - ) -> Result<(Vec>, Vec<(ReflectAccessId, Ownership)>), InteropError> { - let arg_info = function_info.args(); - let mut accesses = Vec::default(); - let mut arg_list = Vec::default(); - - let release_accesses = |accesses: &mut Vec<(ReflectAccessId, Ownership)>| { - accesses.iter().for_each(|(id, _)| { - // Safety: we have not generated any unsafe aliases - unsafe { world.release_access(*id) }; + for arg in args { + let arg_val = ArgValue::Owned(match arg { + ScriptValue::World => Box::new(WorldCallbackAccess::from_guard(world.clone())), + _ => Box::new(arg), }); - }; - - for (value, argument_info) in self.zip(arg_info.iter()) { - match value { - // TODO: I'd see the logic be a bit cleaner, this if is needed to support 'Raw' ScriptValue arguments - // as we do not want to claim any access since we're not using the value yet - - // for owned values the from_script_value impl for ReflectReferences will deal with the case - // here we try to make an actual reference, or otherwise clone the value - ScriptValue::Reference(arg_ref) - if argument_info.type_id() != TypeId::of::() - && matches!(argument_info.ownership(), Ownership::Mut | Ownership::Ref) => - { - let access_id = ReflectAccessId::for_reference(arg_ref.base.base_id.clone()) - .ok_or_else(|| { - InteropError::function_interop_error( - function_info, - Some(argument_info), - InteropError::unregistered_base(arg_ref.base.clone()), - ) - })?; - - let arg = match argument_info.ownership() { - Ownership::Ref => { - if world.claim_read_access(access_id) { - accesses.push((access_id, Ownership::Ref)); - let ref_ = unsafe { arg_ref.reflect_unsafe(world.clone()) }; - if let Ok(ref_) = ref_ { - Ok(ArgValue::Ref(ref_)) - } else { - Err(ref_.expect_err("invariant")) - } - } else { - Err(InteropError::cannot_claim_access( - arg_ref.base.clone(), - world.get_access_location(access_id), - )) - } - } - Ownership::Mut => { - if world.claim_write_access(access_id) { - accesses.push((access_id, Ownership::Mut)); - let mut_ref = unsafe { arg_ref.reflect_mut_unsafe(world.clone()) }; - if let Ok(mut_ref) = mut_ref { - Ok(ArgValue::Mut(mut_ref)) - } else { - Err(mut_ref.expect_err("invariant")) - } - } else { - Err(InteropError::cannot_claim_access( - arg_ref.base.clone(), - world.get_access_location(access_id), - )) - } - } - _ => unreachable!(), - }; - - // TODO: check if the value is actually a `dyn Reflect` and not a dynamic - - match arg { - Err(e) => { - release_accesses(&mut accesses); - return Err(InteropError::function_interop_error( - function_info, - Some(argument_info), - e, - )); - } - Ok(arg) => arg_list.push(arg), - } - } - ScriptValue::World => { - arg_list.push(ArgValue::Owned(Box::new(WorldCallbackAccess::from_guard( - world.clone(), - )))); - } - value => { - let value = match ::from_script_value( - value, - world.clone(), - argument_info.type_id(), - ) { - Some(Ok(v)) => v, - Some(Err(e)) => { - // Safety: Same as above - accesses.iter().for_each(|(id, _)| { - unsafe { world.release_access(*id) }; - }); - return Err(InteropError::function_interop_error( - function_info, - Some(argument_info), - e, - )); - } - None => { - release_accesses(&mut accesses); - return Err(InteropError::function_interop_error( - function_info, - Some(argument_info), - InteropError::impossible_conversion(argument_info.type_id()), - )); - } - }; - - arg_list.push(ArgValue::Owned(value)); - } - } + + args_list = args_list.push_arg(arg_val); } - Ok((arg_list, accesses)) + let return_val = self + .call(args_list) + .map_err(InteropError::function_call_error)?; + + match return_val.try_into_or_boxed::() { + Ok(v) => Ok(v), + Err(b) => { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + Ok(ReflectReference::new_allocated_boxed(b, &mut allocator).into()) + } + } } } @@ -337,237 +205,22 @@ impl DynamicFunctionExt for DynamicFunction<'_> { } } -pub trait ArgValueExt { - fn is_type_id(&self, type_id: std::any::TypeId) -> bool; -} - -impl ArgValueExt for ArgValue<'_> { - fn is_type_id(&self, type_id: std::any::TypeId) -> bool { - match self { - ArgValue::Owned(r) => r - .get_represented_type_info() - .map_or(false, |t| t.type_id() == type_id), - ArgValue::Ref(r) => r - .get_represented_type_info() - .map_or(false, |t| t.type_id() == type_id), - ArgValue::Mut(r) => r - .get_represented_type_info() - .map_or(false, |t| t.type_id() == type_id), - } - } -} - -#[cfg(test)] -mod test { - use bevy::{ - prelude::{Entity, IntoFunction, World}, - reflect::{DynamicList, ParsedPath, ReflectFromReflect}, - }; - use test_utils::test_data::TestResourceWithVariousFields; - - use crate::prelude::AppReflectAllocator; - - use super::*; - - fn setup_world() -> World { - test_utils::test_data::setup_world(|world, t| { - world.insert_resource(AppReflectAllocator::default()); - t.register::() - }) - } - - #[test] - fn call_t_owned() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - - let function = (|usize: usize| usize).into_function(); - - let allocator = world.allocator(); - let mut allocator = allocator.write(); - let arg_ref = ReflectReference::new_allocated(2usize, &mut allocator); - drop(allocator); - - let arc_world = Arc::new(world); - - function - .with_call(vec![ScriptValue::Reference(arg_ref)], arc_world, |r| { - assert!(r.unwrap_owned().reflect_partial_eq(&2usize).unwrap()); - }) - .unwrap(); - } - - #[test] - fn call_t_ref() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - let function = (|usize: &usize| *usize).into_function(); - - let mut arg_ref = - ReflectReference::new_resource_ref::(world.clone()) - .unwrap(); - arg_ref.index_path(ParsedPath::parse_static("usize").unwrap()); - - function - .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { - assert!(r.unwrap_owned().reflect_partial_eq(&22usize).unwrap()); - }) - .unwrap(); - } - - #[test] - fn call_t_mut() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - - let function = (|usize: &mut usize| { - *usize = 42; - *usize - }) - .into_function(); - - let mut arg_ref = - ReflectReference::new_resource_ref::(world.clone()) - .unwrap(); - - arg_ref.index_path(ParsedPath::parse_static("usize").unwrap()); - - function - .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { - assert!(r.unwrap_owned().reflect_partial_eq(&42usize).unwrap()); - }) - .unwrap(); - } - - #[test] - fn call_dynamic_t_owned() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - - let type_registry = world.type_registry(); - let mut type_registry = type_registry.write(); - type_registry.register::>(); - type_registry.register_type_data::, ReflectFromReflect>(); - - let function = (|arr: Vec| arr).into_function(); - - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - let mut dynamic = DynamicList::from_iter(vec![2usize]); - dynamic.set_represented_type( - type_registry.get_type_info(std::any::TypeId::of::>()), - ); - - let arg_ref = ReflectReference::new_allocated(dynamic, &mut allocator); - drop(type_registry); - drop(allocator); - - function - .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { - assert!(r.unwrap_owned().reflect_partial_eq(&vec![2usize]).unwrap()); - }) - .unwrap(); - } - - #[test] - fn call_dynamic_t_ref() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - - let type_registry = world.type_registry(); - let mut type_registry = type_registry.write(); - type_registry.register::>(); - type_registry.register_type_data::, ReflectFromReflect>(); - - let function = (|arr: &Vec| arr.clone()).into_function(); - - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - let mut dynamic = DynamicList::from_iter(vec![2usize]); - dynamic.set_represented_type( - type_registry.get_type_info(std::any::TypeId::of::>()), - ); - - let arg_ref = ReflectReference::new_allocated(dynamic, &mut allocator); - drop(type_registry); - drop(allocator); - - function - .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { - assert!(r.unwrap_owned().reflect_partial_eq(&vec![2usize]).unwrap()); - }) - .unwrap(); - } - - #[test] - fn call_dynamic_t_mut() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - let world = WorldGuard::new(world); - - let type_registry = world.type_registry(); - let mut type_registry = type_registry.write(); - type_registry.register::>(); - type_registry.register_type_data::, ReflectFromReflect>(); - - let function = (|arr: &mut Vec| { - arr.push(42); - arr.clone() - }) - .into_function(); - - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - let mut dynamic = DynamicList::from_iter(vec![2usize]); - dynamic.set_represented_type( - type_registry.get_type_info(std::any::TypeId::of::>()), - ); - - let arg_ref = ReflectReference::new_allocated(dynamic, &mut allocator); - drop(type_registry); - drop(allocator); - - function - .with_call(vec![ScriptValue::Reference(arg_ref)], world, |r| { - assert!(r - .unwrap_owned() - .reflect_partial_eq(&vec![2usize, 42usize]) - .unwrap()); - }) - .unwrap(); - } - - #[test] - pub fn call_world_access_callback() { - let mut world = setup_world(); - - let world = WorldAccessGuard::new(&mut world); - - let function = (|world: WorldCallbackAccess| world.spawn()).into_function(); - - let arc_world = Arc::new(world); - let cloned_world = arc_world.clone(); - drop(arc_world); - function - .with_call(vec![ScriptValue::World], cloned_world, |r| { - assert!(r - .unwrap_owned() - .reflect_partial_eq(&Entity::from_raw(5)) - .unwrap()); - }) - .unwrap(); - } -} +// pub trait ArgValueExt { +// fn is_type_id(&self, type_id: std::any::TypeId) -> bool; +// } + +// impl ArgValueExt for ArgValue<'_> { +// fn is_type_id(&self, type_id: std::any::TypeId) -> bool { +// match self { +// ArgValue::Owned(r) => r +// .get_represented_type_info() +// .map_or(false, |t| t.type_id() == type_id), +// ArgValue::Ref(r) => r +// .get_represented_type_info() +// .map_or(false, |t| t.type_id() == type_id), +// ArgValue::Mut(r) => r +// .get_represented_type_info() +// .map_or(false, |t| t.type_id() == type_id), +// } +// } +// } diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index f325d78eba..3675775dd8 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -9,17 +9,15 @@ use std::{ }; use bevy::reflect::{ - func::Return, FromType, List, PartialReflect, Reflect, ReflectFromReflect, ReflectMut, - TypeData, TypeInfo, + func::Return, FromReflect, FromType, List, PartialReflect, Reflect, ReflectFromReflect, + ReflectMut, TypeData, TypeInfo, }; use itertools::Itertools; -use crate::bindings::script_value::FromScriptValue; use crate::{ bindings::{ - pretty_print::DisplayWithWorld, - script_value::{IntoScriptValue, ScriptValue}, - ReflectReference, WorldAccessGuard, WorldGuard, + pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, + WorldAccessGuard, WorldGuard, }, error::InteropError, }; @@ -430,6 +428,11 @@ impl TypeInfoExtensions for TypeInfo { } pub trait ReturnValExt<'a> { + fn try_into_or_boxed( + self, + ) -> Result> + where + T: PartialReflect; fn as_ref(&'a self) -> &'a dyn PartialReflect; } @@ -441,6 +444,16 @@ impl<'a> ReturnValExt<'a> for Return<'a> { Return::Mut(r) => r.as_partial_reflect(), } } + + fn try_into_or_boxed( + self, + ) -> Result> { + match self { + Return::Owned(partial_reflect) => partial_reflect.try_take::(), + Return::Ref(r) => T::from_reflect(r).ok_or_else(|| r.clone_value()), + Return::Mut(r) => T::from_reflect(r).ok_or_else(|| r.clone_value()), + } + } } #[cfg(test)] diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index ed10324d44..9b38c5cdd1 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -12,6 +12,7 @@ use bevy_mod_scripting_core::*; use bindings::{ function::{ from::{Mut, Ref, Val}, + into_ref::IntoScriptRef, script_function::ScriptFunction, }, script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, @@ -95,31 +96,21 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe NamespaceBuilder::::new(reg) .overwrite_script_function( "get", - |world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue| { - if let ScriptValue::Reference(mut r) = self_ { - let path: ParsedPath = key.try_into().unwrap(); - r.index_path(path); - let world = world.read().expect("Stale world"); - let script_val = <&dyn PartialReflect>::reference_into_script_value(r, world); - script_val.into() - } else { - ScriptValue::Unit - } + |world: WorldCallbackAccess, self_: ReflectReference, key: ScriptValue| { + let mut path: ParsedPath = key.try_into()?; + self_.index_path(path); + let world = world.read().expect("Stale world"); + ReflectReference::into_script_ref(self_, world) }, ) .overwrite_script_function( "get_1_indexed", - |world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue| { - if let ScriptValue::Reference(mut r) = self_ { - let mut path: ParsedPath = key.try_into().unwrap(); - path.convert_to_0_indexed(); - r.index_path(path); - let world = world.read().expect("Stale world"); - let script_val = <&dyn PartialReflect>::reference_into_script_value(r, world); - script_val.into() - } else { - ScriptValue::Unit - } + |world: WorldCallbackAccess, self_: ReflectReference, key: ScriptValue| { + let mut path: ParsedPath = key.try_into()?; + path.convert_to_0_indexed(); + self_.index_path(path); + let world = world.read().expect("Stale world"); + ReflectReference::into_script_ref(self_, world) }, ) .overwrite_script_function( @@ -158,35 +149,32 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe .overwrite_script_function( "set_1_indexed", |world: WorldCallbackAccess, - self_: ScriptValue, + self_: ReflectReference, key: ScriptValue, value: ScriptValue| { - if let ScriptValue::Reference(mut self_) = self_ { - let world = world.read().expect("stale world"); - let mut path: ParsedPath = key.try_into().unwrap(); - path.convert_to_0_indexed(); - self_.index_path(path); + let world = world.read().expect("stale world"); + let mut path: ParsedPath = key.try_into()?; + path.convert_to_0_indexed(); + self_.index_path(path); - let r: ScriptValue = self_ - .with_reflect_mut(world.clone(), |r| { - let target_type_id = r - .get_represented_type_info() - .map(|i| i.type_id()) - .or_fake_id(); - let other = ::from_script_value( - value, - world.clone(), - target_type_id, - ) - .ok_or_else(|| InteropError::impossible_conversion(target_type_id))??; + let r: ScriptValue = self_ + .with_reflect_mut(world.clone(), |r| { + let target_type_id = r + .get_represented_type_info() + .map(|i| i.type_id()) + .or_fake_id(); + let other = ::from_script_value( + value, + world.clone(), + target_type_id, + ) + .ok_or_else(|| InteropError::impossible_conversion(target_type_id))??; - r.try_apply(other.as_partial_reflect()).unwrap(); - Ok::<_, InteropError>(()) - }) - .into(); - return r; - } - ScriptValue::Unit + r.try_apply(other.as_partial_reflect()).unwrap(); + Ok::<_, InteropError>(()) + }) + .into(); + Ok(r) }, ); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 5236f8517b..5f984d1bba 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -16,7 +16,7 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - function::CallableWithAccess, + function::CallAsScriptFunction, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 02acf96297..2764a3742a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; use bevy::prelude::{AppFunctionRegistry, Entity, World}; -use bevy_mod_scripting_core::bindings::function::CallableWithAccess; +use bevy_mod_scripting_core::bindings::function::CallAsScriptFunction; use bevy_mod_scripting_core::bindings::WorldGuard; use bevy_mod_scripting_core::error::InteropError; use bevy_mod_scripting_core::{ From b5f85e7b4e12b8eeca55162054e30d2cc687c3b5 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Fri, 20 Dec 2024 01:51:15 +0000 Subject: [PATCH 059/217] initial from_script_ref --- .../src/bindings/function/from.rs | 43 +++++++++++ .../src/bindings/function/from_ref.rs | 71 +++++++++++++++++-- .../src/bindings/function/into_ref.rs | 7 +- .../src/bindings/reference.rs | 2 +- .../src/reflection_extensions.rs | 1 - .../bevy_mod_scripting_functions/src/core.rs | 24 +++---- .../src/bindings/reference.rs | 14 ++-- .../src/bindings/world.rs | 1 - 8 files changed, 133 insertions(+), 30 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index 8ddeae9fae..c6c5742660 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -39,6 +39,27 @@ impl FromScript for () { } } +impl FromScript for bool { + type This<'w> = Self; + + fn from_script( + value: ScriptValue, + world: WorldGuard<'_>, + ) -> Result, InteropError> + where + Self: Sized, + { + match value { + ScriptValue::Bool(b) => Ok(b), + ScriptValue::Reference(r) => r.downcast::(world), + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::(), + value, + )), + } + } +} + macro_rules! impl_from_with_downcast { ($($ty:ty),*) => { $( @@ -79,6 +100,28 @@ macro_rules! impl_from_stringlike { impl_from_stringlike!(String, PathBuf, OsString); +impl FromScript for char { + type This<'w> = Self; + + fn from_script( + value: ScriptValue, + world: WorldGuard<'_>, + ) -> Result, InteropError> + where + Self: Sized, + { + match value { + ScriptValue::Integer(i) => Ok(i as u8 as char), + ScriptValue::String(c) if c.len() == 1 => Ok(c.chars().next().expect("invariant")), + ScriptValue::Reference(r) => r.downcast::(world), + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::(), + value, + )), + } + } +} + impl FromScript for ReflectReference { type This<'w> = Self; fn from_script(value: ScriptValue, _world: WorldGuard) -> Result { diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs index 1bebf2d71b..0dfb073105 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs @@ -1,11 +1,14 @@ -use std::any::TypeId; +use std::{any::TypeId, ffi::OsString, path::PathBuf}; -use bevy::reflect::PartialReflect; +use bevy::reflect::{DynamicEnum, DynamicTuple, DynamicVariant, PartialReflect}; use crate::{ - bindings::{ReflectReference, WorldGuard}, + bindings::{function::from::FromScript, ReflectReference, WorldGuard}, + downcast_into_value, error::InteropError, + match_by_type, prelude::ScriptValue, + reflection_extensions::TypeInfoExtensions, }; /// Converts from a [`ScriptValue`] to a value equivalent to the given [`TypeId`]. @@ -30,6 +33,66 @@ impl FromScriptRef for Box { where Self: Sized, { - todo!() + match_by_type! ( + match target { + ta : usize => return ::from_script(value, world).map(|a| Box::new(a) as _), + tb : isize => return ::from_script(value, world).map(|a| Box::new(a) as _), + tc : u8 => return ::from_script(value, world).map(|a| Box::new(a) as _), + td : u16 => return ::from_script(value, world).map(|a| Box::new(a) as _), + te : u32 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tf : u64 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tg : u128 => return ::from_script(value, world).map(|a| Box::new(a) as _), + th : i8 => return ::from_script(value, world).map(|a| Box::new(a) as _), + ti : i16 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tj : i32 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tk : i64 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tl : i128 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tm : f32 => return ::from_script(value, world).map(|a| Box::new(a) as _), + tn : f64 => return ::from_script(value, world).map(|a| Box::new(a) as _), + to : bool => return ::from_script(value, world).map(|a| Box::new(a) as _), + tp : char => return ::from_script(value, world).map(|a| Box::new(a) as _), + tq : String => return ::from_script(value, world).map(|a| Box::new(a) as _), + tr : PathBuf => return ::from_script(value, world).map(|a| Box::new(a) as _), + ts : OsString=> return ::from_script(value, world).map(|a| Box::new(a) as _), + tn : () => return <()>::from_script(value, world).map(|a| Box::new(a) as _) + } + ); + + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + let type_info = type_registry.get_type_info(target).ok_or_else(|| { + InteropError::missing_type_data( + target, + "Type was not registered, could not determine conversion strategy.".to_owned(), + ) + })?; + + if type_info.is_option() { + let inner_type = type_info.option_inner_type().expect("invariant"); + let mut dynamic_enum = match value { + ScriptValue::Unit => { + // build none variant + let mut dynamic_enum = DynamicEnum::new("None", DynamicVariant::Unit); + dynamic_enum + } + _ => { + let inner = Self::from_script_ref(inner_type, value, world)?; + let mut dynamic_enum = DynamicEnum::new( + "Some", + DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), + ); + dynamic_enum + } + }; + + dynamic_enum.set_represented_type(Some(type_info)); + return Ok(Box::new(dynamic_enum)); + } + + match value { + ScriptValue::Reference(reflect_reference) => reflect_reference.to_owned_value(world), + value => Err(InteropError::value_mismatch(target, value)), + } } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs index cbc79831a3..e71d191bc1 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs @@ -1,9 +1,6 @@ use std::{any::TypeId, ffi::OsString, path::PathBuf}; -use bevy::{ - reflect::{ParsedPath, PartialReflect}, - text::cosmic_text::rustybuzz::Script, -}; +use bevy::reflect::{ParsedPath, PartialReflect}; use crate::{ bindings::{function::into::IntoScript, ReflectReference, WorldGuard}, @@ -26,6 +23,7 @@ pub trait IntoScriptRef { ) -> Result; } +#[macro_export] macro_rules! match_by_type { (match $on:ident {$($id:ident : $ty:ty => $conv:expr),*}) => { $( @@ -42,6 +40,7 @@ macro_rules! match_by_type { }; } +#[macro_export] macro_rules! downcast_into_value { ($r:ident, $ty:ty) => { *$r.try_downcast_ref::<$ty>().ok_or_else(|| { diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 241c224509..bb19984da4 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -176,7 +176,7 @@ impl ReflectReference { /// Attempts to create a [`Box`] from the reference. This is possible using a few strategies: /// - If the reference is to a world, a [`WorldCallbackAccess`] is created and boxed - /// - If the reference is to an allocation with no reflection path, the value is taken as is. + /// - If the reference is to an allocation with no reflection path and references to it, the value is taken as is. /// - If the reference has a [`bevy::reflect::ReflectFromReflect`] type data associated with it, the value is cloned using that impl. /// - If all above fails, [`bevy::reflect::PartialReflect::clone_value`] is used to clone the value. /// diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 3675775dd8..d2b75a553b 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -3,7 +3,6 @@ use std::{ borrow::Cow, cmp::max, ffi::{CStr, CString, OsStr, OsString}, - os::unix::ffi::OsStrExt, path::{Path, PathBuf}, str::FromStr, }; diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 9b38c5cdd1..680012e851 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -12,10 +12,11 @@ use bevy_mod_scripting_core::*; use bindings::{ function::{ from::{Mut, Ref, Val}, + from_ref::FromScriptRef, into_ref::IntoScriptRef, script_function::ScriptFunction, }, - script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, + script_value::ScriptValue, ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }; @@ -96,7 +97,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe NamespaceBuilder::::new(reg) .overwrite_script_function( "get", - |world: WorldCallbackAccess, self_: ReflectReference, key: ScriptValue| { + |world: WorldCallbackAccess, mut self_: ReflectReference, key: ScriptValue| { let mut path: ParsedPath = key.try_into()?; self_.index_path(path); let world = world.read().expect("Stale world"); @@ -105,7 +106,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe ) .overwrite_script_function( "get_1_indexed", - |world: WorldCallbackAccess, self_: ReflectReference, key: ScriptValue| { + |world: WorldCallbackAccess, mut self_: ReflectReference, key: ScriptValue| { let mut path: ParsedPath = key.try_into()?; path.convert_to_0_indexed(); self_.index_path(path); @@ -130,13 +131,11 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe .get_represented_type_info() .map(|i| i.type_id()) .or_fake_id(); - let other = ::from_script_value( + let other = >::from_script_ref( + target_type_id, value, world.clone(), - target_type_id, - ) - .ok_or_else(|| InteropError::impossible_conversion(target_type_id))??; - + )?; r.try_apply(other.as_partial_reflect()).unwrap(); Ok::<_, InteropError>(()) }) @@ -149,7 +148,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe .overwrite_script_function( "set_1_indexed", |world: WorldCallbackAccess, - self_: ReflectReference, + mut self_: ReflectReference, key: ScriptValue, value: ScriptValue| { let world = world.read().expect("stale world"); @@ -163,12 +162,11 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe .get_represented_type_info() .map(|i| i.type_id()) .or_fake_id(); - let other = ::from_script_value( + let other = >::from_script_ref( + target_type_id, value, world.clone(), - target_type_id, - ) - .ok_or_else(|| InteropError::impossible_conversion(target_type_id))??; + )?; r.try_apply(other.as_partial_reflect()).unwrap(); Ok::<_, InteropError>(()) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 5f984d1bba..f3614ad95a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -16,9 +16,9 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - function::CallAsScriptFunction, + function::CallScriptFunction, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, - script_value::{FromScriptValue, IntoScriptValue, ScriptValue}, + script_value::ScriptValue, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, WorldCallbackAccess, }, @@ -66,7 +66,7 @@ fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option| { let world = lua.get_world(); - let out = function.dynamic_call(args.into_iter().map(Into::into), world)?; + let out = function.call_script_function(args.into_iter().map(Into::into), world)?; Ok(LuaScriptValue::from(out)) }) @@ -121,8 +121,10 @@ impl UserData for LuaReflectReference { .expect("No 'get' function registered for a ReflectReference")?; // call the function with the key - let out = index_func - .dynamic_call(vec![ScriptValue::Reference(self_), key], world.clone())?; + let out = index_func.call_script_function( + vec![ScriptValue::Reference(self_), key], + world.clone(), + )?; LuaScriptValue::from(out).into_lua(lua) }, ); @@ -136,7 +138,7 @@ impl UserData for LuaReflectReference { lookup_dynamic_function_typed::(lua, "set_1_indexed") .expect("No 'set' function registered for a ReflectReference")? - .dynamic_call( + .call_script_function( vec![ScriptValue::Reference(self_), key, value], lua.get_world(), )?; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 2764a3742a..2672c6c4d0 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -3,7 +3,6 @@ use std::sync::Arc; use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; use bevy::prelude::{AppFunctionRegistry, Entity, World}; -use bevy_mod_scripting_core::bindings::function::CallAsScriptFunction; use bevy_mod_scripting_core::bindings::WorldGuard; use bevy_mod_scripting_core::error::InteropError; use bevy_mod_scripting_core::{ From 290127327f4a2137211e237a27f22d88bd37c2b1 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Fri, 20 Dec 2024 02:08:34 +0000 Subject: [PATCH 060/217] handle errors properly --- assets/scripts/bevy_api.lua | 5 +++-- crates/bevy_mod_scripting_core/src/bindings/function/mod.rs | 3 +++ crates/bevy_mod_scripting_functions/src/core.rs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 993e37f90f..8b8d7cc03d 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -34,10 +34,11 @@ function on_event() print(comp.option_usize) print("\nvec") -- print(table_to_string(comp.vec_of_usize)) - print(comp.vec_of_usize) comp.vec_of_usize = {42,69,72} + print(comp.vec_of_usize:print_value()) comp.vec_of_usize[1] = 612312312 - print(table_to_string(comp.vec_of_usize)) + print(comp.vec_of_usize:print_value()) + -- print(table_to_string(comp.vec_of_usize)) -- comp.vec_of_usize[1] = 0 -- print(comp.vec_of_usize[2]) -- print(table_to_string(comp.vec_of_usize)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index 265ca374f7..e39e1876ad 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -182,6 +182,9 @@ impl CallScriptFunction for DynamicFunction<'_> { .map_err(InteropError::function_call_error)?; match return_val.try_into_or_boxed::() { + Ok(ScriptValue::Error(e)) => { + Err(InteropError::function_interop_error(self.info(), None, e)) + } Ok(v) => Ok(v), Err(b) => { let allocator = world.allocator(); diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 680012e851..3c1d5ec292 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -167,6 +167,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe value, world.clone(), )?; + println!("Applying {:?} to {:?}", other, r); r.try_apply(other.as_partial_reflect()).unwrap(); Ok::<_, InteropError>(()) From 7f1c7f531f9cf0e24436602c7ee7b20b71741812 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Fri, 20 Dec 2024 10:23:12 +0000 Subject: [PATCH 061/217] re-enable list applies --- .../src/bindings/allocator.rs | 1 - .../src/bindings/function/from_ref.rs | 28 +++++++++++++------ .../src/bindings/reference.rs | 4 --- .../bevy_mod_scripting_functions/src/core.rs | 1 - 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index 175d0270e8..437f163853 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -170,7 +170,6 @@ impl ReflectAllocator { } pub fn remove(&mut self, id: &ReflectAllocationId) -> Option { - println!("removing {:?}", id); self.allocations.remove(id) } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs index 0dfb073105..b72974b447 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs @@ -1,6 +1,6 @@ use std::{any::TypeId, ffi::OsString, path::PathBuf}; -use bevy::reflect::{DynamicEnum, DynamicTuple, DynamicVariant, PartialReflect}; +use bevy::reflect::{DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, PartialReflect}; use crate::{ bindings::{function::from::FromScript, ReflectReference, WorldGuard}, @@ -71,18 +71,13 @@ impl FromScriptRef for Box { if type_info.is_option() { let inner_type = type_info.option_inner_type().expect("invariant"); let mut dynamic_enum = match value { - ScriptValue::Unit => { - // build none variant - let mut dynamic_enum = DynamicEnum::new("None", DynamicVariant::Unit); - dynamic_enum - } + ScriptValue::Unit => DynamicEnum::new("None", DynamicVariant::Unit), _ => { let inner = Self::from_script_ref(inner_type, value, world)?; - let mut dynamic_enum = DynamicEnum::new( + DynamicEnum::new( "Some", DynamicVariant::Tuple(DynamicTuple::from_iter(vec![inner])), - ); - dynamic_enum + ) } }; @@ -90,6 +85,21 @@ impl FromScriptRef for Box { return Ok(Box::new(dynamic_enum)); } + if type_info.is_list() { + let inner_type = type_info.list_inner_type().expect("invariant"); + + if let ScriptValue::List(vec) = value { + let mut dynamic_list = DynamicList::default(); + for item in vec { + let inner = Self::from_script_ref(inner_type, item, world.clone())?; + dynamic_list.push_box(inner); + } + + dynamic_list.set_represented_type(Some(type_info)); + return Ok(Box::new(dynamic_list)); + } + } + match value { ScriptValue::Reference(reflect_reference) => reflect_reference.to_owned_value(world), value => Err(InteropError::value_mismatch(target, value)), diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index bb19984da4..a75eadfaa7 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -190,10 +190,6 @@ impl ReflectReference { if let ReflectBase::Owned(id) = &self.base.base_id { if self.reflect_path.is_empty() && id.strong_count() == 0 { - println!( - "Trying to access allocation in owned value {}", - self.display_value_with_world(world.clone()) - ); let allocator = world.allocator(); let mut allocator = allocator.write(); let arc = allocator diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 3c1d5ec292..680012e851 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -167,7 +167,6 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe value, world.clone(), )?; - println!("Applying {:?} to {:?}", other, r); r.try_apply(other.as_partial_reflect()).unwrap(); Ok::<_, InteropError>(()) From cfa9a016cb155229417834583140960ad886d0ad Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Fri, 20 Dec 2024 17:40:57 +0000 Subject: [PATCH 062/217] WIP --- assets/scripts/bevy_api.lua | 2 +- .../src/bindings/function/from.rs | 14 +- .../src/bindings/function/into.rs | 9 +- .../src/bindings/function/mod.rs | 134 ----------- .../src/bindings/function/script_function.rs | 75 +++++- .../src/bindings/query.rs | 32 ++- .../src/bindings/reference.rs | 7 +- .../src/bindings/world.rs | 68 +++--- crates/bevy_mod_scripting_core/src/error.rs | 3 +- .../bevy_mod_scripting_functions/src/core.rs | 225 +++++++++++++++--- .../src/namespaced_register.rs | 28 ++- .../src/bindings/world.rs | 2 +- .../bevy_mod_scripting_lua/src/lib.rs | 5 - ...t_no_default_or_from_world_data_errors.lua | 2 +- ..._with_default_no_component_data_errors.lua | 2 +- ...th_from_world_no_component_data_errors.lua | 2 +- .../data/get_parent/has_parent_returns_it.lua | 2 +- .../registered_type_returns_correct_type.lua | 9 +- .../query/empty_query_returns_nothing.lua | 2 +- .../query_returns_all_entities_matching.lua | 2 +- .../no_component_data_errors.lua | 2 +- .../no_resource_data_errors.lua | 2 +- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 75 +++--- 23 files changed, 427 insertions(+), 277 deletions(-) diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 8b8d7cc03d..08dec460d2 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -20,7 +20,7 @@ function on_event() local my_component_type = world:get_type_by_name("MyComponent") - print("MyComponent type: ", my_component_type:print_value()) + print("MyComponent type: ", my_component_type:short_name()) local comp = world:get_component(entity, my_component_type) print("Before script: ", comp:print_value()) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index c6c5742660..8e89b20cfd 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -3,7 +3,7 @@ use crate::{ error::InteropError, prelude::ScriptValue, }; -use bevy::reflect::FromReflect; +use bevy::reflect::{FromReflect, GetTypeRegistration}; use std::{ any::TypeId, ffi::OsString, @@ -141,6 +141,16 @@ impl FromScript for ReflectReference { /// You can also use this to return values from a script function to be allocated directly as a [`ScriptValue::Reference`]. pub struct Val(pub T); +impl Val { + pub fn new(value: T) -> Self { + Val(value) + } + + pub fn into_inner(self) -> T { + self.0 + } +} + impl Deref for Val { type Target = T; @@ -165,7 +175,7 @@ impl FromScript for Val { T::from_reflect(r).ok_or_else(|| { InteropError::failed_from_reflect( Some(TypeId::of::()), - "from reflect failed to produce output when converting to Val" + format!("from reflect failed to produce output when converting to Val from: {r:?}") .to_owned(), ) }) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index 91a2de7c58..d22606b4ec 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -1,9 +1,10 @@ use std::{ + borrow::Cow, ffi::OsString, path::{Path, PathBuf}, }; -use bevy::reflect::{PartialReflect, ReflectRef}; +use bevy::reflect::{GetTypeRegistration, PartialReflect, ReflectRef}; use crate::{ bindings::{ReflectReference, WorldGuard}, @@ -75,6 +76,12 @@ impl_into_stringlike!( ] ); +impl IntoScript for &'static str { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::String(Cow::Borrowed(self))) + } +} + impl IntoScript for ReflectReference { fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Reference(self)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index e39e1876ad..28aaa64d36 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -33,122 +33,8 @@ pub trait CallScriptFunction { args: I, world: WorldGuard, ) -> Result; - - // fn with_call O, I: IntoIterator>( - // &self, - // args: I, - // world: Arc, - // f: F, - // ) -> Result; - - // fn dynamic_call>( - // &self, - // args: I, - // world: Arc, - // ) -> Result; } -// impl CallAsScriptFunction for DynamicFunction<'_> { -// fn with_call O, I: IntoIterator>( -// &self, -// args: I, -// world: Arc, -// f: F, -// ) -> Result { -// let info = self.info().args(); - -// let mut arg_iter = args.into_iter().peekable(); - -// // we also want to add the world arg if it's required as the first arg but not present -// // let (mut args_list, mut accesses) = if self.first_arg_is_world() -// // && !arg_iter -// // .peek() -// // .map(|a| a == &ScriptValue::World) -// // .unwrap_or(false) -// // { -// // std::iter::once(ScriptValue::World) -// // .chain(arg_iter) -// // .a(self.info(), world.clone())? -// // } else { -// // arg_iter.into_args_list_with_access(self.info(), world.clone())? -// // }; - -// // let mut final_args_list = ArgList::default(); - -// // // we sometimes want to use the boxed value in the arg instead of allocating and refing to it. -// // // for this reason let's be lenient in calling functions. Allow passing owned values as refs -// // for (arg, info) in args_list.iter_mut().zip(info.iter()) { -// // let next_arg = match (arg, info.ownership()) { -// // (ArgValue::Owned(r), Ownership::Ref) => { -// // ArgValue::Ref((r as &Box).as_ref()) -// // } -// // (ArgValue::Owned(r), Ownership::Mut) => ArgValue::Mut(r.as_mut()), -// // (v, _) => { -// // // muahaha, shouldn't allocate due to ZST -// // let a = std::mem::replace(v, ArgValue::Owned(Box::new(()))); -// // a -// // } -// // }; -// // final_args_list = final_args_list.push_arg(next_arg); -// // } - -// // bevy::log::trace!( -// // "Calling function: {:?} with args: {:?}", -// // self.info().name(), -// // final_args_list -// // ); - -// // let return_val = match self.call(final_args_list) { -// // Ok(return_val) => return_val, -// // Err(e) => { -// // // Safety: we have not generated any unsafe aliases -// // // - we are releasing only the access we have claimed -// // accesses.drain(..).for_each(|(id, _)| { -// // unsafe { world.release_access(id) }; -// // }); - -// // return Err(InteropError::function_call_error(e)); -// // } -// // }; - -// bevy::log::trace!( -// "Function: {:?} returned: {:?}", -// self.info().name(), -// return_val -// ); - -// let out = f(return_val); -// // Safety: we have not generated any unsafe aliases -// // - we are releasing only the access we have claimed -// accesses.drain(..).for_each(|(id, _)| { -// unsafe { world.release_access(id) }; -// }); - -// Ok(out) -// } - -// fn dynamic_call>( -// &self, -// args: I, -// world: Arc, -// ) -> Result { -// bevy::log::debug!("Dynamic call to function: {:?}", self.info().name()); -// self.with_call(args, world.clone(), |r| { -// match r.try_into_or_boxed::() { -// Ok(script_val) => Ok(script_val), -// Err(e) => { -// let allocator = world.allocator(); -// let mut allocator = allocator.write(); - -// Ok(ReflectReference::new_allocated_boxed(e, &mut allocator).into()) -// } -// } -// }) -// .flatten_interop_error() -// .map_err(|e| InteropError::function_interop_error(self.info(), None, e)) -// } -// } - impl CallScriptFunction for DynamicFunction<'_> { fn call_script_function>( &self, @@ -207,23 +93,3 @@ impl DynamicFunctionExt for DynamicFunction<'_> { }) } } - -// pub trait ArgValueExt { -// fn is_type_id(&self, type_id: std::any::TypeId) -> bool; -// } - -// impl ArgValueExt for ArgValue<'_> { -// fn is_type_id(&self, type_id: std::any::TypeId) -> bool { -// match self { -// ArgValue::Owned(r) => r -// .get_represented_type_info() -// .map_or(false, |t| t.type_id() == type_id), -// ArgValue::Ref(r) => r -// .get_represented_type_info() -// .map_or(false, |t| t.type_id() == type_id), -// ArgValue::Mut(r) => r -// .get_represented_type_info() -// .map_or(false, |t| t.type_id() == type_id), -// } -// } -// } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 164ec4fbf4..ce209ad012 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -1,14 +1,20 @@ -use bevy::{ - prelude::{AppFunctionRegistry, IntoFunction, World}, - reflect::{func::DynamicFunction, PartialReflect}, -}; - +use super::{from::FromScript, into::IntoScript}; use crate::{ + bindings::{ + function::from::{Mut, Ref, Val}, + ReflectReference, + }, error::InteropError, prelude::{ScriptValue, WorldCallbackAccess}, }; - -use super::{from::FromScript, into::IntoScript}; +use bevy::{ + prelude::{AppFunctionRegistry, IntoFunction, World}, + reflect::{ + func::{DynamicFunction, FunctionInfo}, + GetTypeRegistration, PartialReflect, TypeRegistration, TypeRegistry, + }, +}; +use std::sync::Arc; #[diagnostic::on_unimplemented( message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. use assert_impls_into_script!(MyArg) and assert_impls_from_script!(MyReturnType) to verify yours do.", @@ -18,6 +24,42 @@ pub trait ScriptFunction<'env, Marker> { fn into_dynamic_function(self) -> DynamicFunction<'static>; } +pub trait GetInnerTypeDependencies { + fn register_type_dependencies(registry: &mut TypeRegistry); +} + +impl GetInnerTypeDependencies for T { + fn register_type_dependencies(registry: &mut TypeRegistry) { + registry.register::(); + } +} + +macro_rules! recursive_type_dependencies { + ($(T: $path:path),*) => { + $( + impl GetInnerTypeDependencies for $path { + fn register_type_dependencies(registry: &mut TypeRegistry) { + T::register_type_dependencies(registry); + } + } + )* + }; +} + +recursive_type_dependencies!(T: Val, T: Ref<'_, T>, T: Mut<'_, T>); + +pub trait GetFunctionTypeDependencies { + fn register_type_dependencies(registry: &mut TypeRegistry); +} + +/// The Script Function equivalent for dynamic functions +/// TODO: have a separate function registry to avoid the need for boxing script args every time +pub struct DynamicScriptFunction { + pub info: FunctionInfo, + pub func: + Arc) -> Result>, +} + macro_rules! impl_script_function { ($( $param:ident ),* ) => { @@ -50,7 +92,7 @@ macro_rules! impl_script_function { (move |world: WorldCallbackAccess, $( $param: ScriptValue ),* | { let res: Result = (|| { $( let $callback = world.clone(); )? - let world = world.read().ok_or_else(|| InteropError::stale_world_access())?; + let world = world.try_read()?; // TODO: snapshot the accesses and release them after $( let $param = <$param>::from_script($param, world.clone())?; )* let out = self( $( $callback, )? $( $param.into(), )* ); @@ -68,7 +110,24 @@ macro_rules! impl_script_function { }; } +macro_rules! impl_script_function_type_dependencies{ + ($( $param:ident ),* ) => { + impl GetFunctionTypeDependencies O> for F + where F: Fn( $( $param ),* ) -> O + { + fn register_type_dependencies(registry: &mut TypeRegistry) { + $( + $param::register_type_dependencies(registry); + )* + + O::register_type_dependencies(registry); + } + } + }; +} + bevy::utils::all_tuples!(impl_script_function, 0, 14, T); +bevy::utils::all_tuples!(impl_script_function_type_dependencies, 0, 14, T); /// Utility for quickly checking your type can be used as an argument in a script function /// diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 76461e355b..875602831e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -1,7 +1,7 @@ use super::{ReflectReference, WorldAccessGuard, WorldCallbackAccess}; use crate::{ bindings::{CONCURRENT_WORLD_ACCESS_MSG, STALE_WORLD_MSG}, - prelude::ScriptResult, + error::InteropError, with_global_access, }; use bevy::{ @@ -36,7 +36,7 @@ impl ScriptTypeRegistration { } #[inline(always)] - pub fn short_name(&self) -> &str { + pub fn short_name(&self) -> &'static str { self.registration.type_info().type_path_table().short_path() } @@ -50,11 +50,17 @@ impl ScriptTypeRegistration { self.registration.type_info().type_id() } - /// Returns the [`ComponentId`] for this type, if it is a component or a resource. + /// Returns the [`ComponentId`] for this type, if it is a component. #[inline(always)] pub fn component_id(&self) -> Option { self.component_id } + + /// Returns the [`ComponentId`] for this type, if it is a resource. + #[inline(always)] + pub fn resource_id(&self) -> Option { + self.resource_id + } } impl std::fmt::Debug for ScriptTypeRegistration { @@ -71,7 +77,8 @@ impl std::fmt::Display for ScriptTypeRegistration { } } -#[derive(Clone, Default)] +#[derive(Clone, Default, Reflect)] +#[reflect(opaque)] pub struct ScriptQueryBuilder { components: Vec, with: Vec, @@ -95,20 +102,25 @@ impl ScriptQueryBuilder { } } -#[derive(Clone)] +#[derive(Clone, Reflect)] +#[reflect(opaque)] pub struct ScriptQueryResult(pub Entity, pub Vec); impl WorldCallbackAccess { - pub fn query(&self, query: ScriptQueryBuilder) -> ScriptResult> { + pub fn query( + &self, + query: ScriptQueryBuilder, + ) -> Result, InteropError> { // find the set of components - self.read() - .unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")) - .query(query) + self.try_read().and_then(|world| world.query(query)) } } impl<'w> WorldAccessGuard<'w> { - pub fn query(&self, query: ScriptQueryBuilder) -> ScriptResult> { + pub fn query( + &self, + query: ScriptQueryBuilder, + ) -> Result, InteropError> { with_global_access!(self.0.accesses, "Could not query", { let world = unsafe { self.as_unsafe_world_cell().world_mut() }; let mut dynamic_query = QueryBuilder::::new(world); diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index a75eadfaa7..6faeff2101 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -24,8 +24,8 @@ use bevy::{ ptr::Ptr, reflect::{ func::{args::ArgInfo, ArgValue}, - ParsedPath, PartialReflect, ReflectFromPtr, ReflectFromReflect, ReflectMut, ReflectPath, - ReflectPathError, ReflectRef, TypeData, + ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectFromReflect, ReflectMut, + ReflectPath, ReflectPathError, ReflectRef, TypeData, }, }; use itertools::Either; @@ -33,7 +33,8 @@ use std::{any::TypeId, fmt::Debug, sync::Arc}; /// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path /// safe to build but to reflect on the value inside you need to ensure aliasing rules are upheld -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, Reflect)] +#[reflect(opaque)] pub struct ReflectReference { pub base: ReflectBaseType, // TODO: experiment with Fixed capacity vec, boxed array etc, compromise between heap allocation and runtime cost diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 3f4517e17f..98a2f0692f 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -106,8 +106,10 @@ impl WorldCallbackAccess { } /// Attempts to read the world access guard, if it still exists - pub fn read(&self) -> Option> { - self.0.upgrade() + pub fn try_read(&self) -> Result, InteropError> { + self.0 + .upgrade() + .ok_or_else(|| InteropError::stale_world_access()) } } @@ -120,15 +122,18 @@ pub(crate) const CONCURRENT_ACCESS_MSG: &str = /// common world methods, see: /// - [`crate::bindings::query`] for query related functionality impl WorldCallbackAccess { - pub fn spawn(&self) -> Entity { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - world.spawn() + pub fn spawn(&self) -> Result { + let world = self.try_read()?; + Ok(world.spawn()) } // TODO: uses `String` for type_name to avoid lifetime issues with types proxying this via macros - pub fn get_type_by_name(&self, type_name: String) -> Option { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - world.get_type_by_name(type_name) + pub fn get_type_by_name( + &self, + type_name: String, + ) -> Result, InteropError> { + let world = self.try_read()?; + Ok(world.get_type_by_name(type_name)) } pub fn add_default_component( @@ -136,7 +141,7 @@ impl WorldCallbackAccess { entity: Entity, registration: ScriptTypeRegistration, ) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.add_default_component(entity, registration) } @@ -145,7 +150,7 @@ impl WorldCallbackAccess { entity: Entity, component_id: ComponentId, ) -> Result, InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.get_component(entity, component_id) } @@ -154,7 +159,7 @@ impl WorldCallbackAccess { entity: Entity, component_id: ComponentId, ) -> Result { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.has_component(entity, component_id) } @@ -163,7 +168,7 @@ impl WorldCallbackAccess { entity: Entity, registration: ScriptTypeRegistration, ) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.remove_component(entity, registration) } @@ -171,7 +176,7 @@ impl WorldCallbackAccess { &self, resource_id: ComponentId, ) -> Result, InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.get_resource(resource_id) } @@ -179,37 +184,37 @@ impl WorldCallbackAccess { &self, registration: ScriptTypeRegistration, ) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.remove_resource(registration) } - pub fn has_resource(&self, resource_id: ComponentId) -> bool { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - world.has_resource(resource_id) + pub fn has_resource(&self, resource_id: ComponentId) -> Result { + let world = self.try_read()?; + Ok(world.has_resource(resource_id)) } - pub fn has_entity(&self, entity: Entity) -> bool { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - world.has_entity(entity) + pub fn has_entity(&self, entity: Entity) -> Result { + let world = self.try_read()?; + Ok(world.has_entity(entity)) } pub fn get_children(&self, entity: Entity) -> Result, InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.get_children(entity) } pub fn get_parent(&self, entity: Entity) -> Result, InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.get_parent(entity) } pub fn push_children(&self, parent: Entity, children: &[Entity]) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.push_children(parent, children) } pub fn remove_children(&self, parent: Entity, children: &[Entity]) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.remove_children(parent, children) } @@ -219,28 +224,29 @@ impl WorldCallbackAccess { index: usize, children: &[Entity], ) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.insert_children(parent, index, children) } pub fn despawn_recursive(&self, entity: Entity) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.despawn_recursive(entity) } pub fn despawn(&self, entity: Entity) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.despawn(entity) } pub fn despawn_descendants(&self, entity: Entity) -> Result<(), InteropError> { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); + let world = self.try_read()?; world.despawn_descendants(entity) } - pub fn exit(&self) { - let world = self.read().unwrap_or_else(|| panic!("{STALE_WORLD_MSG}")); - world.exit() + pub fn exit(&self) -> Result<(), InteropError> { + let world = self.try_read()?; + world.exit(); + Ok(()) } } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 30ce739644..20faf3d74f 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -182,7 +182,8 @@ impl From for mlua::Error { } } -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Reflect)] +#[reflect(opaque)] pub struct InteropError(Arc); impl std::error::Error for InteropError {} diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 680012e851..6716c9b2b7 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -14,11 +14,12 @@ use bindings::{ from::{Mut, Ref, Val}, from_ref::FromScriptRef, into_ref::IntoScriptRef, - script_function::ScriptFunction, + script_function::{GetFunctionTypeDependencies, ScriptFunction}, }, + pretty_print::DisplayWithWorld, script_value::ScriptValue, - ReflectReference, ReflectionPathExt, ScriptTypeRegistration, WorldAccessGuard, - WorldCallbackAccess, + ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, + ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }; use error::InteropError; use reflection_extensions::TypeIdExtensions; @@ -28,24 +29,26 @@ use crate::namespaced_register::NamespaceBuilder; pub struct CoreFunctionsPlugin; pub trait RegisterScriptFunction { - fn overwrite_script_function>( - &mut self, - name: N, - f: F, - ) -> &mut Self + fn overwrite_script_function(&mut self, name: N, f: F) -> &mut Self where - N: Into>; + N: Into>, + F: ScriptFunction<'static, M> + GetFunctionTypeDependencies; } impl RegisterScriptFunction for NamespaceBuilder<'_, S> { - fn overwrite_script_function>( - &mut self, - name: N, - f: F, - ) -> &mut Self + fn overwrite_script_function(&mut self, name: N, f: F) -> &mut Self where N: Into>, + F: ScriptFunction<'static, M> + GetFunctionTypeDependencies, { + { + let registry = self + .world + .get_resource_mut::() + .expect("AppTypeRegistry resource not found"); + let mut registry = registry.write(); + F::register_type_dependencies(&mut registry); + } let dynamic_function = f.into_dynamic_function(); self.overwrite(name, dynamic_function); self @@ -60,24 +63,28 @@ impl Plugin for CoreFunctionsPlugin { let mut function_registry = function_registry.write(); - // function_registry.register_with_name("spawn", || Entity::from_bits(2)); register_world_functions(&mut function_registry) .expect("Failed to register world functions"); + + register_reflect_reference_functions(&mut function_registry) + .expect("Failed to register reflect reference functions"); + + register_script_type_registration_functions(&mut function_registry) + .expect("Failed to register script type registration functions"); + + register_script_query_builder_functions(&mut function_registry) + .expect("Failed to register script query builder functions"); } } -fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRegistrationError> { +fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - // .overwrite_script_function("hello", |b: Ref, c: Mut| None::) - // .overwrite( - // "test_vec", - // |s: WorldCallbackAccess, entities: Vec| entities, - // ) - .overwrite_script_function("spawn", |s: WorldCallbackAccess| Val(s.spawn())) + .overwrite_script_function("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) .overwrite_script_function( "get_type_by_name", |world: WorldCallbackAccess, type_name: String| { - world.get_type_by_name(type_name).map(Val) + let val = world.get_type_by_name(type_name)?; + Ok(val.map(Val)) }, ) .overwrite_script_function( @@ -85,22 +92,120 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe |world: WorldCallbackAccess, entity: Val, registration: Val| { - let s: ScriptValue = registration + registration .component_id() .and_then(|id| world.get_component(*entity, id).transpose()) - .into(); - s + .transpose() + }, + ) + .overwrite_script_function( + "has_component", + |s: WorldCallbackAccess, + entity: Val, + registration: Val| { + match registration.component_id() { + Some(id) => s.has_component(*entity, id), + None => Ok(false), + } + }, + ) + .overwrite_script_function( + "remove_component", + |s: WorldCallbackAccess, e: Val, r: Val| { + s.remove_component(*e, r.clone()) + }, + ) + .overwrite_script_function( + "get_resource", + |world: WorldCallbackAccess, registration: Val| { + match registration.resource_id() { + Some(id) => Ok(world.get_resource(id)?), + None => Ok(None), + } + }, + ) + .overwrite_script_function( + "has_resource", + |s: WorldCallbackAccess, registration: Val| match registration + .resource_id() + { + Some(id) => s.has_resource(id), + None => Ok(false), + }, + ) + .overwrite_script_function( + "remove_resource", + |s: WorldCallbackAccess, r: Val| s.remove_resource(r.clone()), + ) + .overwrite_script_function( + "add_default_component", + |w: WorldCallbackAccess, e: Val, r: Val| { + w.add_default_component(*e, r.clone()) + }, + ) + .overwrite_script_function( + "insert_children", + |w: WorldCallbackAccess, e: Val, index: usize, c: Vec>| { + w.insert_children(*e, index, &c.into_iter().map(|v| *v).collect::>()) + }, + ) + .overwrite_script_function( + "push_children", + |w: WorldCallbackAccess, e: Val, c: Vec>| { + w.push_children(*e, &c.into_iter().map(|v| *v).collect::>()) + }, + ) + .overwrite_script_function("get_children", |w: WorldCallbackAccess, e: Val| { + let children = w.get_children(*e)?; + Ok(children.into_iter().map(Val).collect::>()) + }) + .overwrite_script_function("get_parent", |w: WorldCallbackAccess, e: Val| { + let parent = w.get_parent(*e)?; + Ok(parent.map(Val)) + }) + .overwrite_script_function("despawn", |s: WorldCallbackAccess, e: Val| { + s.despawn(*e) + }) + .overwrite_script_function( + "despawn_descendants", + |s: WorldCallbackAccess, e: Val| s.despawn_descendants(*e), + ) + .overwrite_script_function( + "despawn_recursive", + |s: WorldCallbackAccess, e: Val| s.despawn_recursive(*e), + ) + .overwrite_script_function("has_entity", |s: WorldCallbackAccess, e: Val| { + s.has_entity(*e) + }) + .overwrite_script_function( + "query", + |s: WorldCallbackAccess, components: Vec>| { + let mut query_builder = ScriptQueryBuilder::default(); + query_builder.components(components.into_iter().map(|v| v.into_inner()).collect()); + Ok(Val(query_builder)) }, ) .overwrite_script_function("exit", |s: WorldCallbackAccess| s.exit()); + Ok(()) +} +fn register_reflect_reference_functions( + reg: &mut FunctionRegistry, +) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) + .overwrite_script_function( + "display_ref", + |w: WorldCallbackAccess, s: ReflectReference| { + let world = w.try_read().expect("Stale world"); + s.display_with_world(world) + }, + ) .overwrite_script_function( "get", |world: WorldCallbackAccess, mut self_: ReflectReference, key: ScriptValue| { - let mut path: ParsedPath = key.try_into()?; + let path: ParsedPath = key.try_into()?; self_.index_path(path); - let world = world.read().expect("Stale world"); + let world = world.try_read().expect("Stale world"); ReflectReference::into_script_ref(self_, world) }, ) @@ -110,7 +215,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe let mut path: ParsedPath = key.try_into()?; path.convert_to_0_indexed(); self_.index_path(path); - let world = world.read().expect("Stale world"); + let world = world.try_read().expect("Stale world"); ReflectReference::into_script_ref(self_, world) }, ) @@ -121,7 +226,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe key: ScriptValue, value: ScriptValue| { if let ScriptValue::Reference(mut self_) = self_ { - let world = world.read().expect("stale world"); + let world = world.try_read().expect("stale world"); let path: ParsedPath = key.try_into().unwrap(); self_.index_path(path); @@ -151,7 +256,7 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe mut self_: ReflectReference, key: ScriptValue, value: ScriptValue| { - let world = world.read().expect("stale world"); + let world = world.try_read().expect("stale world"); let mut path: ParsedPath = key.try_into()?; path.convert_to_0_indexed(); self_.index_path(path); @@ -178,3 +283,61 @@ fn register_world_functions(reg: &mut FunctionRegistry) -> Result<(), FunctionRe Ok(()) } + +fn register_script_type_registration_functions( + registry: &mut FunctionRegistry, +) -> Result<(), FunctionRegistrationError> { + NamespaceBuilder::::new(registry) + .overwrite_script_function("type_name", |s: Ref| s.type_name()) + .overwrite_script_function("short_name", |s: Ref| { + s.short_name() + }) + .overwrite_script_function("is_resource", |s: Ref| { + s.resource_id().is_some() + }) + .overwrite_script_function("is_component", |s: Ref| { + s.component_id().is_some() + }); + Ok(()) +} + +fn register_script_query_builder_functions( + registry: &mut FunctionRegistry, +) -> Result<(), FunctionRegistrationError> { + NamespaceBuilder::::new(registry) + .overwrite_script_function( + "with", + |s: Val, with: Val| { + let mut builder = s.into_inner(); + builder.with(vec![with.into_inner()]); + Val(builder) + }, + ) + .overwrite_script_function( + "without", + |s: Val, without: Val| { + let mut builder = s.into_inner(); + builder.without(vec![without.into_inner()]); + Val(builder) + }, + ) + .overwrite_script_function( + "build", + |world: WorldCallbackAccess, s: Val| { + let builder = s.into_inner(); + let result = world.query(builder)?; + let result = result.into_iter().map(Val).collect::>(); + Ok(result) + }, + ); + Ok(()) +} + +// fn register_script_query_result_functions( +// registry: &mut FunctionRegistry, +// ) -> Result<(), FunctionRegistrationError> { +// NamespaceBuilder::::new(registry) +// .overwrite_script_function("entity", |s: Ref| s.entity()) +// .overwrite_script_function("components", |s: Ref| s.components()); +// Ok(()) +// } diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 96a495fdb8..7ae236e7f7 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -1,7 +1,7 @@ use std::{any::TypeId, borrow::Cow, marker::PhantomData}; use bevy::{ - prelude::IntoFunction, + prelude::{AppFunctionRegistry, IntoFunction, World}, reflect::func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, }; @@ -134,14 +134,14 @@ impl GetNamespacedFunction for FunctionRegistry { pub struct NamespaceBuilder<'a, N> { namespace: PhantomData, - registry: &'a mut FunctionRegistry, + pub world: &'a mut World, } impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { - pub fn new(registry: &'a mut FunctionRegistry) -> Self { + pub fn new(world: &'a mut World) -> Self { Self { namespace: Default::default(), - registry, + world, } } @@ -154,8 +154,14 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { N: Into>, F: IntoFunction<'static, M> + 'static, { - self.registry - .register_namespaced_function::(name, function)?; + { + let registry = self + .world + .get_resource_mut::() + .expect("AppFunctionRegistry resource not found"); + let mut registry = registry.write(); + registry.register_namespaced_function::(name, function)?; + } Ok(self) } @@ -164,8 +170,14 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { N: Into>, F: IntoFunction<'static, M> + 'static, { - self.registry - .overwrite_namespaced_function::(name, function); + { + let registry = self + .world + .get_resource_mut::() + .expect("AppFunctionRegistry resource not found"); + let mut registry = registry.write(); + registry.overwrite_namespaced_function::(name, function); + } self } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 2672c6c4d0..8c86ad713c 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -435,7 +435,7 @@ impl GetWorld for mlua::Lua { .app_data_ref::() .ok_or_else(InteropError::missing_world)?; - let world = access.read().ok_or_else(InteropError::stale_world_access)?; + let world = access.try_read()?; Ok(world) } diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index fff6a6b5e8..c4ddf46b9c 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -65,10 +65,6 @@ impl Plugin for LuaScriptingPlugin { // register_lua_values(app); app.add_context_pre_handling_initializer::<()>(|script_id, entity, context: &mut Lua| { let world = context.get_world(); - // let lua_entity = world.with_resource::(|_, mut allocator| { - // let reflect_reference = ReflectReference::new_allocated(entity, &mut allocator); - // ::Proxy::from(reflect_reference) - // }); context .globals() .set( @@ -80,7 +76,6 @@ impl Plugin for LuaScriptingPlugin { .globals() .set("script_id", script_id.clone()) .map_err(ScriptError::from_mlua_error)?; - // context.globals().set("entity", lua_entity)?; Ok(()) }); } diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua index aa31351705..f5d3299b4a 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua @@ -4,4 +4,4 @@ local type = world:get_type_by_name('TestComponent') assert_throws(function() world:add_default_component(entity, type) -end, "Does not have ReflectDefault or ReflectFromWorld data registered") \ No newline at end of file +end, "Missing type data ReflectDefault or ReflectFromWorld for type: .*TestComponent.*") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua index bf4ba3d294..3c00d91e8f 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua @@ -3,4 +3,4 @@ local _type = world:get_type_by_name('CompWithDefault') assert_throws(function() world:add_default_component(entity, _type) -end, "Does not have ReflectComponent") +end, "Missing type data ReflectComponent for type: .*CompWithDefault.*") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua index 6f4f467703..2a1744b0ee 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua @@ -3,4 +3,4 @@ local _type = world:get_type_by_name('CompWithFromWorld') assert_throws(function() world:add_default_component(entity, _type) -end, 'Does not have ReflectComponent data registered') \ No newline at end of file +end, 'Missing type data ReflectComponent for type: .*CompWithFromWorld.*') \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua index 955a467b13..2945131ca2 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua @@ -1,5 +1,5 @@ local entity = world:spawn() -local child = world:spawn(entity) +local child = world:spawn() world:push_children(entity, {child}) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua index d46f9ad774..76fb82c0f0 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua @@ -5,6 +5,11 @@ local expected = { short_name = 'TestComponent', } +local received = { + type_name = type:type_name(), + short_name = type:short_name(), +} + assert(type ~= nil, 'Type not found') -assert(type.type_name == expected.type_name, 'type_name mismatch, expected: ' .. expected.type_name .. ', got: ' .. type.type_name) -assert(type.short_name == expected.short_name, 'short_name mismatch, expected: ' .. expected.short_name .. ', got: ' .. type.short_name) +assert(received.type_name == expected.type_name, 'type_name mismatch, expected: ' .. expected.type_name .. ', got: ' .. received.type_name) +assert(received.short_name == expected.short_name, 'short_name mismatch, expected: ' .. expected.short_name .. ', got: ' .. received.short_name) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua index d31939bdb9..bbf6b9d9ce 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua @@ -1,5 +1,5 @@ local component_a = world:get_type_by_name("TestComponent") -for entity,_ in world:query(component_a):with(component_a):without(component_a):iter() do +for entity in pairs(world:query({component_a}):with(component_a):without(component_a):build()) do assert(false, "This should not be reached") end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua index b624260ed7..c5ffd407e8 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua @@ -13,7 +13,7 @@ world:add_default_component(entity_c, component_with) world:add_default_component(entity_b, component_without) local found_entities = {} -for entity, comp in world:query(component_with):with(component_with):without(component_without):iter() do +for entity, comp in pairs(world:query(component_with):with(component_with):without(component_without):build()) do table.insert(found_entities, entity) end diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua index 572cddd599..721418acb3 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua @@ -4,4 +4,4 @@ local component = world:get_type_by_name("CompWithDefault") assert_throws(function () world:remove_component(entity, component) -end, "Does not have ReflectComponent data registered") +end, "Missing type data ReflectComponent for type: .*CompWithDefault.*") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua index 03f456e7ff..3e868e7f68 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua @@ -3,4 +3,4 @@ local type = _get_mock_type() assert_throws(function () world:remove_resource(type) -end, "Does not have ReflectResource data registered") +end, "Missing type data ReflectResource for type: Unregistered TypeId.*") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 778bb8c3ef..53afa442a9 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -7,8 +7,8 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - Proxy, ReflectAllocator, ReflectReference, ReflectValProxy, ScriptTypeRegistration, - WorldCallbackAccess, + pretty_print::DisplayWithWorld, ReflectAllocator, ReflectReference, ScriptTypeRegistration, + WorldAccessGuard, WorldCallbackAccess, }, context::ContextLoadingSettings, error::ScriptError, @@ -17,13 +17,11 @@ use bevy_mod_scripting_core::{ }; use bevy_mod_scripting_lua::{ bindings::{ - providers::bevy_ecs::LuaEntity, - proxy::{LuaProxied, LuaReflectValProxy}, + reference::LuaReflectReference, world::{GetWorld, LuaWorld}, }, lua_context_load, lua_handler, prelude::{Lua, LuaFunction, LuaHookTriggers}, - type_data::{register_lua_values, ReflectLuaValue}, LuaScriptingPlugin, }; use libtest_mimic::{Arguments, Failed, Trial}; @@ -49,7 +47,7 @@ fn init_app() -> App { app.add_plugins(AssetPlugin::default()) .add_plugins(HierarchyPlugin) .add_plugins(LuaScriptingPlugin::<()>::default()) - .add_plugins(bevy_mod_scripting_lua::bindings::providers::LuaBevyScriptingPlugin); + .add_plugins(bevy_mod_scripting_functions::BevyFunctionsPlugin); // for some reason hierarchy plugin doesn't register the children component app.world_mut().register_component::(); @@ -62,54 +60,57 @@ fn init_app() -> App { fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Result<(), ScriptError> { let _get_mock_type = lua - .create_function(|_, ()| { + .create_function(|l, ()| { + let world = l.get_world(); #[derive(Reflect)] struct Dummy; let reg = ScriptTypeRegistration::new(Arc::new(TypeRegistration::of::()), None, None); - Ok(::Proxy::from(reg)) + let allocator = world.allocator(); + let mut allocator = allocator.write(); + let reference = ReflectReference::new_allocated(reg, &mut allocator); + Ok(LuaReflectReference::from(reference)) }) .unwrap(); let _get_entity_with_test_component = lua .create_function(|l, s: String| { let world = l.get_world(); - let opt_entity = world.with_resource::(|_, mut allocator| { - let a = World::enumerate_test_components() - .iter() - .find(|(name, _, _)| name.contains(&s)) - .map(|(_, _, c)| { - let reference = ReflectReference::new_allocated( - c.unwrap_or(Entity::from_raw(9999)), - &mut allocator, - ); - <::Proxy>::from(reference) - }); - - a - }); - - Ok(opt_entity) + + Ok(World::enumerate_test_components() + .iter() + .find(|(name, _, _)| name.contains(&s)) + .map(|(_, _, c)| { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + + let reference = ReflectReference::new_allocated( + c.unwrap_or(Entity::from_raw(9999)), + &mut allocator, + ); + LuaReflectReference::from(reference) + })) }) .unwrap(); let assert_throws = lua - .create_function(|_, (f, regex): (LuaFunction, String)| { - let result = f.call::<(), ()>(()); + .create_function(|lua, (f, regex): (LuaFunction, String)| { + let world = lua.get_world(); + let result = f.call::<()>(()); let err = match result { Ok(_) => { - return Err(tealr::mlu::mlua::Error::RuntimeError( + return Err(mlua::Error::RuntimeError( "Expected function to throw error, but it did not.".into(), )) } - Err(e) => e.to_string(), + Err(e) => ScriptError::from_mlua_error(e).display_with_world(world), }; let regex = regex::Regex::new(®ex).unwrap(); if regex.is_match(&err) { Ok(()) } else { - Err(tealr::mlu::mlua::Error::RuntimeError(format!( + Err(mlua::Error::RuntimeError(format!( "Expected error message to match the regex: \n{}\n\nBut got:\n{}", regex.as_str(), err @@ -157,7 +158,13 @@ impl Test { &context_settings.context_pre_handling_initializers, app.world_mut(), &mut (), - )?; + ) + .map_err(|e| { + let world = app.world_mut(); + let world = WorldAccessGuard::new(world); + let msg = e.display_with_world(Arc::new(world)); + Failed::from(msg) + })?; lua_handler( (), @@ -168,7 +175,13 @@ impl Test { &context_settings.context_pre_handling_initializers, &mut (), app.world_mut(), - )?; + ) + .map_err(|e| { + let world = app.world_mut(); + let world = WorldAccessGuard::new(world); + let msg = e.display_with_world(Arc::new(world)); + Failed::from(msg) + })?; // WorldCallbackAccess::with_callback_access(app.world_mut(), |world| { // lua.globals().set("world", LuaWorld(world.clone())).unwrap(); From 06c6d00535fed9401d9a59b77cc6c9a3a36325d7 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sat, 21 Dec 2024 17:48:35 +0000 Subject: [PATCH 063/217] work out function type dependency registration basics --- .../src/bindings/function/from.rs | 3 +- .../src/bindings/function/into.rs | 15 +++++- .../src/bindings/function/script_function.rs | 51 ++++++++++++++++--- .../src/bindings/reference.rs | 18 ++++++- crates/bevy_mod_scripting_core/src/error.rs | 10 +++- .../bevy_mod_scripting_functions/src/core.rs | 24 +++------ 6 files changed, 91 insertions(+), 30 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index 8e89b20cfd..75b286c418 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -3,7 +3,7 @@ use crate::{ error::InteropError, prelude::ScriptValue, }; -use bevy::reflect::{FromReflect, GetTypeRegistration}; +use bevy::reflect::{FromReflect, GetTypeRegistration, Reflect}; use std::{ any::TypeId, ffi::OsString, @@ -139,6 +139,7 @@ impl FromScript for ReflectReference { /// /// This can be used to retrieve a value out of a [`ScriptValue::Reference`] corresponding to the type `T`. /// You can also use this to return values from a script function to be allocated directly as a [`ScriptValue::Reference`]. +#[derive(Reflect)] pub struct Val(pub T); impl Val { diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index d22606b4ec..96c28fd439 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -10,6 +10,7 @@ use crate::{ bindings::{ReflectReference, WorldGuard}, error::InteropError, prelude::ScriptValue, + self_type_dependency_only, }; use super::from::Val; @@ -24,17 +25,22 @@ impl IntoScript for ScriptValue { } } +self_type_dependency_only!(ScriptValue); + impl IntoScript for () { fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Unit) } } +self_type_dependency_only!(()); + impl IntoScript for bool { - fn into_script(self, world: WorldGuard) -> Result { + fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Bool(self)) } } +self_type_dependency_only!(bool); macro_rules! impl_into_with_downcast { ($variant:tt as $cast:ty [$($ty:ty),*]) => { @@ -51,6 +57,9 @@ macro_rules! impl_into_with_downcast { impl_into_with_downcast!(Integer as i64 [i8, i16, i32, i64, i128, u8, u16, u32, u64, u128, usize, isize]); impl_into_with_downcast!(Float as f64 [f32, f64]); +self_type_dependency_only!( + i8, i16, i32, i64, i128, u8, u16, u32, u64, u128, usize, isize, f32, f64 +); macro_rules! impl_into_stringlike { ($id:ident,[ $(($ty:ty => $conversion:expr)),*]) => { @@ -76,12 +85,16 @@ impl_into_stringlike!( ] ); +self_type_dependency_only!(String, char, PathBuf, OsString); + impl IntoScript for &'static str { fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::String(Cow::Borrowed(self))) } } +self_type_dependency_only!(&'static str); + impl IntoScript for ReflectReference { fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Reference(self)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index ce209ad012..eb73806d30 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -14,6 +14,7 @@ use bevy::{ GetTypeRegistration, PartialReflect, TypeRegistration, TypeRegistry, }, }; +use std::collections::HashMap; use std::sync::Arc; #[diagnostic::on_unimplemented( @@ -28,25 +29,59 @@ pub trait GetInnerTypeDependencies { fn register_type_dependencies(registry: &mut TypeRegistry); } -impl GetInnerTypeDependencies for T { - fn register_type_dependencies(registry: &mut TypeRegistry) { - registry.register::(); - } +#[macro_export] +macro_rules! no_type_dependencies { + ($($path:path),*) => { + $( + impl GetInnerTypeDependencies for $path { + fn register_type_dependencies(_registry: &mut TypeRegistry) {} + } + )* + }; +} + +#[macro_export] +macro_rules! self_type_dependency_only { + ($($path:ty),*) => { + $( + impl $crate::bindings::function::script_function::GetInnerTypeDependencies for $path { + fn register_type_dependencies(registry: &mut bevy::reflect::TypeRegistry) { + registry.register::<$path>(); + } + } + )* + }; } macro_rules! recursive_type_dependencies { - ($(T: $path:path),*) => { + ($(($path:path where $($bound:ident : $bound_val:path),*)),*) => { $( - impl GetInnerTypeDependencies for $path { + impl<$($bound : $bound_val),*> GetInnerTypeDependencies for $path { fn register_type_dependencies(registry: &mut TypeRegistry) { - T::register_type_dependencies(registry); + $( + registry.register::<$bound>(); + )* } } )* }; } -recursive_type_dependencies!(T: Val, T: Ref<'_, T>, T: Mut<'_, T>); +no_type_dependencies!(ReflectReference, InteropError); +self_type_dependency_only!(WorldCallbackAccess); + +recursive_type_dependencies!( + (Val where T: GetTypeRegistration), + (Ref<'_, T> where T: GetTypeRegistration), + (Mut<'_, T> where T: GetTypeRegistration), + (Result where T: GetTypeRegistration), + (Option where T: GetTypeRegistration), + (Vec where T: GetTypeRegistration) +); + +recursive_type_dependencies!( + (HashMap where K: GetTypeRegistration, V: GetTypeRegistration) +); pub trait GetFunctionTypeDependencies { fn register_type_dependencies(registry: &mut TypeRegistry); diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 6faeff2101..ab9720fca4 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -20,7 +20,7 @@ use bevy::{ change_detection::MutUntyped, component::ComponentId, entity::Entity, world::unsafe_world_cell::UnsafeWorldCell, }, - prelude::{Component, Resource}, + prelude::{Component, ReflectDefault, Resource}, ptr::Ptr, reflect::{ func::{args::ArgInfo, ArgValue}, @@ -34,15 +34,29 @@ use std::{any::TypeId, fmt::Debug, sync::Arc}; /// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path /// safe to build but to reflect on the value inside you need to ensure aliasing rules are upheld #[derive(Debug, Clone, PartialEq, Eq, Reflect)] -#[reflect(opaque)] +#[reflect(Default)] pub struct ReflectReference { + #[reflect(ignore)] pub base: ReflectBaseType, // TODO: experiment with Fixed capacity vec, boxed array etc, compromise between heap allocation and runtime cost // needs benchmarks first though /// The path from the top level type to the actual value we want to access + #[reflect(ignore)] pub reflect_path: ParsedPath, } +impl Default for ReflectReference { + fn default() -> Self { + Self { + base: ReflectBaseType { + type_id: TypeId::of::(), + base_id: ReflectBase::World, + }, + reflect_path: ParsedPath(vec![]), + } + } +} + /// Specifies where we should source the type id from when reflecting a ReflectReference #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum TypeIdSource { diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 20faf3d74f..0ac8d38c7a 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -183,8 +183,7 @@ impl From for mlua::Error { } #[derive(Debug, Clone, PartialEq, Reflect)] -#[reflect(opaque)] -pub struct InteropError(Arc); +pub struct InteropError(#[reflect(ignore)] Arc); impl std::error::Error for InteropError {} @@ -609,3 +608,10 @@ impl DisplayWithWorld for InteropErrorInner { } } } + +/// Purely for purposes of the automatic [`GetTypeRegistration`] impl. +impl Default for InteropErrorInner { + fn default() -> Self { + InteropErrorInner::StaleWorldAccess + } +} \ No newline at end of file diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 6716c9b2b7..472c34b5a3 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -57,22 +57,16 @@ impl RegisterScriptFunction for NamespaceBuilder<'_, S> { impl Plugin for CoreFunctionsPlugin { fn build(&self, app: &mut App) { - let function_registry = app - .world_mut() - .get_resource_or_init::(); + let world = app.world_mut(); + register_world_functions(world).expect("Failed to register world functions"); - let mut function_registry = function_registry.write(); - - register_world_functions(&mut function_registry) - .expect("Failed to register world functions"); - - register_reflect_reference_functions(&mut function_registry) + register_reflect_reference_functions(world) .expect("Failed to register reflect reference functions"); - register_script_type_registration_functions(&mut function_registry) + register_script_type_registration_functions(world) .expect("Failed to register script type registration functions"); - register_script_query_builder_functions(&mut function_registry) + register_script_query_builder_functions(world) .expect("Failed to register script query builder functions"); } } @@ -189,9 +183,7 @@ fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationE Ok(()) } -fn register_reflect_reference_functions( - reg: &mut FunctionRegistry, -) -> Result<(), FunctionRegistrationError> { +fn register_reflect_reference_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) .overwrite_script_function( "display_ref", @@ -285,7 +277,7 @@ fn register_reflect_reference_functions( } fn register_script_type_registration_functions( - registry: &mut FunctionRegistry, + registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) .overwrite_script_function("type_name", |s: Ref| s.type_name()) @@ -302,7 +294,7 @@ fn register_script_type_registration_functions( } fn register_script_query_builder_functions( - registry: &mut FunctionRegistry, + registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) .overwrite_script_function( From 5de0fec9a27da074b383f5b059e1c05c68948888 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sat, 21 Dec 2024 18:47:45 +0000 Subject: [PATCH 064/217] properly register the top level types too --- .../src/bindings/function/mod.rs | 4 +-- .../src/bindings/function/script_function.rs | 25 +++++++++----- .../src/bindings/pretty_print.rs | 6 +++- crates/bevy_mod_scripting_core/src/error.rs | 33 +++++++++++-------- .../src/reflection_extensions.rs | 5 +-- .../bevy_mod_scripting_functions/src/core.rs | 5 +-- .../src/namespaced_register.rs | 11 ++----- .../query_returns_all_entities_matching.lua | 2 +- 8 files changed, 50 insertions(+), 41 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index 28aaa64d36..dc86c98535 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -68,9 +68,7 @@ impl CallScriptFunction for DynamicFunction<'_> { .map_err(InteropError::function_call_error)?; match return_val.try_into_or_boxed::() { - Ok(ScriptValue::Error(e)) => { - Err(InteropError::function_interop_error(self.info(), None, e)) - } + Ok(ScriptValue::Error(e)) => Err(InteropError::function_interop_error(self.info(), e)), Ok(v) => Ok(v), Err(b) => { let allocator = world.allocator(); diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index eb73806d30..aab708cabd 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -11,14 +11,14 @@ use bevy::{ prelude::{AppFunctionRegistry, IntoFunction, World}, reflect::{ func::{DynamicFunction, FunctionInfo}, - GetTypeRegistration, PartialReflect, TypeRegistration, TypeRegistry, + FromReflect, GetTypeRegistration, PartialReflect, TypeRegistration, TypeRegistry, Typed, }, }; use std::collections::HashMap; use std::sync::Arc; #[diagnostic::on_unimplemented( - message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. use assert_impls_into_script!(MyArg) and assert_impls_from_script!(MyReturnType) to verify yours do.", + message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. Registering functions also requires they implement GetInnerTypeDependencies", note = "If you're trying to return a non-primitive type, you might need to use Val Ref or Mut wrappers" )] pub trait ScriptFunction<'env, Marker> { @@ -54,13 +54,16 @@ macro_rules! self_type_dependency_only { } macro_rules! recursive_type_dependencies { - ($(($path:path where $($bound:ident : $bound_val:path),*)),*) => { + ($( ($path:path where $($bound:ident : $($bound_val:path);*),* $(=> with $self_:ident)?) ),* ) => { $( - impl<$($bound : $bound_val),*> GetInnerTypeDependencies for $path { + impl<$($bound : $($bound_val +)*),*> GetInnerTypeDependencies for $path { fn register_type_dependencies(registry: &mut TypeRegistry) { $( registry.register::<$bound>(); )* + $( + registry.register::<$self_>(); + )? } } )* @@ -75,8 +78,8 @@ recursive_type_dependencies!( (Ref<'_, T> where T: GetTypeRegistration), (Mut<'_, T> where T: GetTypeRegistration), (Result where T: GetTypeRegistration), - (Option where T: GetTypeRegistration), - (Vec where T: GetTypeRegistration) + (Option where T: GetTypeRegistration;FromReflect;Typed => with Self), + (Vec where T: GetTypeRegistration;FromReflect;Typed => with Self) ); recursive_type_dependencies!( @@ -129,13 +132,19 @@ macro_rules! impl_script_function { $( let $callback = world.clone(); )? let world = world.try_read()?; // TODO: snapshot the accesses and release them after - $( let $param = <$param>::from_script($param, world.clone())?; )* + #[allow(unused_mut,unused_variables)] + let mut current_arg = 0; + $( + current_arg += 1; + let $param = <$param>::from_script($param, world.clone()) + .map_err(|e| InteropError::function_arg_conversion_error(current_arg.to_string(), e))?; + )* let out = self( $( $callback, )? $( $param.into(), )* ); $( let $out = out?; let out = $out; )? - out.into_script(world.clone()) + out.into_script(world.clone()).map_err(|e| InteropError::function_arg_conversion_error("return value".to_owned(), e)) })(); let script_value: ScriptValue = res.into(); script_value diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index ec85579c99..29a7240cbd 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -1,4 +1,4 @@ -use crate::reflection_extensions::TypeIdExtensions; +use crate::reflection_extensions::{FakeType, TypeIdExtensions}; use super::{ script_value::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldGuard, @@ -364,6 +364,10 @@ impl DisplayWithWorld for ReflectBaseType { impl DisplayWithWorld for TypeId { fn display_with_world(&self, world: WorldGuard) -> String { + if *self == TypeId::of::() { + return "Dynamic Type".to_owned(); + } + let type_registry = world.type_registry(); let type_registry = type_registry.read(); diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 0ac8d38c7a..c93a8d00a7 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -345,7 +345,6 @@ impl InteropError { /// Thrown when an error happens in a function call. The inner error provides details on the error. pub fn function_interop_error( function_info: &FunctionInfo, - argument_info: Option<&ArgInfo>, error: InteropError, ) -> Self { Self(Arc::new(InteropErrorInner::FunctionInteropError { @@ -353,16 +352,6 @@ impl InteropError { .name() .map(|s| s.to_string()) .unwrap_or("".to_owned()), - argument: argument_info - .map(|a| { - format!( - "{}({}) {}", - a.index(), - a.ownership(), - a.name().unwrap_or("") - ) - }) - .unwrap_or("None".to_owned()), error, })) } @@ -374,6 +363,13 @@ impl InteropError { Self(Arc::new(InteropErrorInner::FunctionCallError { inner })) } + pub fn function_arg_conversion_error(argument: String, error: InteropError) -> Self { + Self(Arc::new(InteropErrorInner::FunctionArgConversionError { + argument, + error + })) + } + pub fn external_error(error: Box) -> Self { Self(Arc::new(InteropErrorInner::OtherError { error })) } @@ -464,9 +460,12 @@ pub enum InteropErrorInner { }, FunctionInteropError { function_name: String, - argument: String, error: InteropError, }, + FunctionArgConversionError { + argument: String, + error: InteropError + }, OtherError { error: Box, }, @@ -590,10 +589,16 @@ impl DisplayWithWorld for InteropErrorInner { InteropErrorInner::MissingWorld => { "Missing world. The world was not initialized in the script context.".to_owned() }, - InteropErrorInner::FunctionInteropError { function_name, argument, error } => { + InteropErrorInner::FunctionInteropError { function_name, error } => { format!( - "Error in function: {} argument: {} error: {}", + "Error in function {}: {}", function_name, + error.display_with_world(world) + ) + }, + InteropErrorInner::FunctionArgConversionError { argument, error } => { + format!( + "Error converting argument {}: {}", argument, error.display_with_world(world) ) diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index d2b75a553b..49cb1975f3 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -98,12 +98,13 @@ pub trait TypeIdExtensions { fn or_fake_id(&self) -> TypeId; } +pub(crate) struct FakeType; + impl TypeIdExtensions for Option { fn or_fake_id(&self) -> TypeId { - struct UknownType; match self { Some(t) => *t, - None => TypeId::of::(), + None => TypeId::of::(), } } } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 472c34b5a3..fa3431f3a8 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -42,10 +42,7 @@ impl RegisterScriptFunction for NamespaceBuilder<'_, S> { F: ScriptFunction<'static, M> + GetFunctionTypeDependencies, { { - let registry = self - .world - .get_resource_mut::() - .expect("AppTypeRegistry resource not found"); + let registry = self.world.get_resource_or_init::(); let mut registry = registry.write(); F::register_type_dependencies(&mut registry); } diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 7ae236e7f7..024bfc4d09 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -155,10 +155,7 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { F: IntoFunction<'static, M> + 'static, { { - let registry = self - .world - .get_resource_mut::() - .expect("AppFunctionRegistry resource not found"); + let registry = self.world.get_resource_or_init::(); let mut registry = registry.write(); registry.register_namespaced_function::(name, function)?; } @@ -171,10 +168,8 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { F: IntoFunction<'static, M> + 'static, { { - let registry = self - .world - .get_resource_mut::() - .expect("AppFunctionRegistry resource not found"); + let registry = self.world.get_resource_or_init::(); + let mut registry = registry.write(); registry.overwrite_namespaced_function::(name, function); } diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua index c5ffd407e8..72fcdd2f22 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua @@ -13,7 +13,7 @@ world:add_default_component(entity_c, component_with) world:add_default_component(entity_b, component_without) local found_entities = {} -for entity, comp in pairs(world:query(component_with):with(component_with):without(component_without):build()) do +for entity, comp in pairs(world:query({component_with}):with(component_with):without(component_without):build()) do table.insert(found_entities, entity) end From ef60be3deac0ee84be5772360d9a85e92d18257c Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Sun, 22 Dec 2024 15:35:11 +0000 Subject: [PATCH 065/217] bump bevy api gen --- crates/bevy_api_gen/Cargo.bootstrap.toml | 4 +- crates/bevy_api_gen/Cargo.toml | 2 +- crates/bevy_api_gen/rust-toolchain.toml | 2 +- crates/bevy_api_gen/src/callback.rs | 61 +++++++++---------- .../src/passes/find_methods_and_fields.rs | 31 +++++----- .../src/passes/find_trait_impls.rs | 9 ++- .../src/passes/populate_template_data.rs | 24 ++++---- crates/bevy_api_gen/src/plugin.rs | 9 +-- makefile | 8 +-- 9 files changed, 76 insertions(+), 74 deletions(-) diff --git a/crates/bevy_api_gen/Cargo.bootstrap.toml b/crates/bevy_api_gen/Cargo.bootstrap.toml index b7557099fc..7a61c4ae4e 100644 --- a/crates/bevy_api_gen/Cargo.bootstrap.toml +++ b/crates/bevy_api_gen/Cargo.bootstrap.toml @@ -5,8 +5,8 @@ version = "0.1.0" edition = "2021" [dependencies] -mlua = { version = "0.9.2", features = ["lua54", "vendored", "send", "macros"] } -bevy_reflect = { version = "0.15.0-rc.3", features = [ +mlua = { version = "0.10", features = ["lua54", "vendored", "send", "macros"] } +bevy_reflect = { version = "0.15.0", features = [ "bevy", "glam", "petgraph", diff --git a/crates/bevy_api_gen/Cargo.toml b/crates/bevy_api_gen/Cargo.toml index 341c534079..25d12e945b 100644 --- a/crates/bevy_api_gen/Cargo.toml +++ b/crates/bevy_api_gen/Cargo.toml @@ -39,7 +39,7 @@ rustc_private = true [dependencies] log = "0.4" env_logger = "0.11" -rustc_plugin = { git = "https://github.com/makspll/rustc_plugin", branch = "feature/rust-1.82.0" } +rustc_plugin = "0.12.0-nightly-2024-12-15" indexmap = "2" tempdir = "0.3" cargo_metadata = "0.18" diff --git a/crates/bevy_api_gen/rust-toolchain.toml b/crates/bevy_api_gen/rust-toolchain.toml index 0d5ae08dc0..6b75379add 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-11-05" +channel = "nightly-2024-12-15" diff --git a/crates/bevy_api_gen/src/callback.rs b/crates/bevy_api_gen/src/callback.rs index 71f0a9f91a..f1b87ab8ce 100644 --- a/crates/bevy_api_gen/src/callback.rs +++ b/crates/bevy_api_gen/src/callback.rs @@ -19,12 +19,10 @@ impl rustc_driver::Callbacks for BevyAnalyzerCallbacks { fn after_expansion<'tcx>( &mut self, compiler: &rustc_interface::interface::Compiler, - queries: &'tcx rustc_interface::Queries<'tcx>, + tcx: rustc_middle::ty::TyCtxt<'tcx>, ) -> rustc_driver::Compilation { trace!("After expansion callback"); - let Ok(mut gcx) = queries.global_ctxt() else { - FatalError.raise() - }; + let sess = &compiler.sess; if sess.dcx().has_errors().is_some() { @@ -59,37 +57,36 @@ impl rustc_driver::Callbacks for BevyAnalyzerCallbacks { _ => false, }; - gcx.enter(|tcx| { - // tera environment for import processor - let tera = crate::configure_tera(tcx.crate_name(LOCAL_CRATE).as_str(), &templates_dir); + // tera environment for import processor + let tera = crate::configure_tera(tcx.crate_name(LOCAL_CRATE).as_str(), &templates_dir); - let mut ctxt = crate::BevyCtxt::new( - tcx, - &meta_dirs, - WorkspaceMeta::from_env(), - include_private, - Some(Box::new(move |import_path| { - let mut ctxt = Context::new(); - ctxt.insert("import", import_path); - tera.render(&TemplateKind::ImportProcessor.to_string(), &ctxt) - .unwrap() - })), - ); + let mut ctxt = crate::BevyCtxt::new( + tcx, + &meta_dirs, + WorkspaceMeta::from_env(), + include_private, + Some(Box::new(move |import_path| { + let mut ctxt = Context::new(); + ctxt.insert("import", import_path); + tera.render(&TemplateKind::ImportProcessor.to_string(), &ctxt) + .unwrap() + })), + ); - trace!("Running all passes"); - for p in ALL_PASSES { - info!( - "{}, in crate: {}", - p.description, - tcx.crate_name(LOCAL_CRATE), - ); - let continue_ = tcx.sess.time(p.name, || (p.cb)(&mut ctxt, &self.args)); - if !continue_ { - break; - } - trace!("Finished pass, continuing"); + trace!("Running all passes"); + for p in ALL_PASSES { + info!( + "{}, in crate: {}", + p.description, + tcx.crate_name(LOCAL_CRATE), + ); + let continue_ = tcx.sess.time(p.name, || (p.cb)(&mut ctxt, &self.args)); + if !continue_ { + break; } - }); + trace!("Finished pass, continuing"); + } + rustc_driver::Compilation::Continue } } 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 f23a874b42..150f4e7701 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 @@ -7,7 +7,7 @@ use rustc_hir::{ }; use rustc_infer::infer::TyCtxtInferExt; use rustc_middle::ty::{ - AdtKind, AssocKind, FieldDef, FnSig, ParamEnv, Ty, TyCtxt, TyKind, TypingMode, + AdtKind, AssocKind, FieldDef, FnSig, ParamEnv, Ty, TyCtxt, TyKind, TypingEnv, TypingMode, }; use rustc_span::Symbol; use rustc_trait_selection::infer::InferCtxtExt; @@ -36,8 +36,8 @@ pub(crate) fn find_methods_and_fields(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> info!("ignoring enum variant: {}::{} due to 'reflect(ignore)' attribute", ctxt.tcx.item_name(def_id), variant.name); todo!(); } - - process_fields(ctxt.tcx, &ctxt.meta_loader, &ctxt.reflect_types, &ctxt.cached_traits, variant.fields.iter(), ctxt.tcx.param_env(variant.def_id)) + let param_env = TypingEnv::non_body_analysis(ctxt.tcx, variant.def_id); + process_fields(ctxt.tcx, &ctxt.meta_loader, &ctxt.reflect_types, &ctxt.cached_traits, variant.fields.iter(), param_env) }).collect::>(); strats.iter().for_each(|(f_did, strat)| match strat { @@ -52,7 +52,8 @@ pub(crate) fn find_methods_and_fields(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> }, AdtKind::Struct => { - let fields = process_fields(ctxt.tcx, &ctxt.meta_loader, &ctxt.reflect_types,&ctxt.cached_traits, adt_def.all_fields(), ctxt.tcx.param_env(def_id)); + let param_env = TypingEnv::non_body_analysis(ctxt.tcx, def_id); + let fields = process_fields(ctxt.tcx, &ctxt.meta_loader, &ctxt.reflect_types,&ctxt.cached_traits, adt_def.all_fields(), param_env); fields.iter().for_each(|(f_did, strat)| match strat { ReflectionStrategy::Reflection => report_field_not_supported(ctxt.tcx, *f_did, def_id, None, "type is neither a proxy nor a type expressible as lua primitive"), ReflectionStrategy::Filtered => report_field_not_supported(ctxt.tcx, *f_did, def_id, None, "field has a 'reflect(ignore)' attribute"), @@ -118,7 +119,8 @@ pub(crate) fn find_methods_and_fields(ctxt: &mut BevyCtxt<'_>, _args: &Args) -> ctxt.tcx.item_name(def_id) ); - let param_env = ctxt.tcx.param_env(fn_did); + // let param_env = ctxt.tcx.param_env(fn_did); + let param_env = TypingEnv::non_body_analysis(ctxt.tcx, def_id); let sig: FnSig = ctxt.tcx.normalize_erasing_late_bound_regions( param_env, ctxt.tcx.fn_sig(fn_did).instantiate_identity(), @@ -238,10 +240,9 @@ fn report_field_not_supported( variant_did: Option, reason: &'static str, ) { - let normalised_ty = tcx.normalize_erasing_regions( - tcx.param_env(type_did), - tcx.type_of(f_did).instantiate_identity(), - ); + let param_env = TypingEnv::non_body_analysis(tcx, type_did); + let normalised_ty = + tcx.normalize_erasing_regions(param_env, tcx.type_of(f_did).instantiate_identity()); info!( "Ignoring field: `{}:{}` on type: `{}` in variant: `{}` as it is not supported: `{}`", tcx.item_name(f_did), @@ -259,7 +260,7 @@ fn process_fields<'tcx, 'f, I: Iterator>( reflect_types: &IndexMap>, cached_traits: &CachedTraits, fields: I, - param_env: ParamEnv<'tcx>, + param_env: TypingEnv<'tcx>, ) -> Vec<(DefId, ReflectionStrategy)> { fields .map(move |f| { @@ -364,7 +365,7 @@ fn type_is_adt_and_reflectable<'tcx>( /// Checks if the type can be used directly as a lua function argument, by checking if it implements the FromLua trait fn type_is_supported_as_non_proxy_arg<'tcx>( tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, + param_env: TypingEnv<'tcx>, cached_traits: &CachedTraits, ty: Ty<'tcx>, ) -> bool { @@ -380,7 +381,7 @@ fn type_is_supported_as_non_proxy_arg<'tcx>( /// Checks if the type can be used directly as a lua function output fn type_is_supported_as_non_proxy_return_val<'tcx>( tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, + param_env: TypingEnv<'tcx>, cached_traits: &CachedTraits, ty: Ty<'tcx>, ) -> bool { @@ -401,12 +402,12 @@ fn type_is_supported_as_non_proxy_return_val<'tcx>( pub(crate) fn impls_trait<'tcx>( tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, + param_env: TypingEnv<'tcx>, ty: Ty<'tcx>, trait_did: DefId, ) -> bool { tcx.infer_ctxt() - .build(TypingMode::non_body_analysis()) - .type_implements_trait(trait_did, [ty], param_env) + .build(param_env.typing_mode) + .type_implements_trait(trait_did, [ty], param_env.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 ba542ab9e4..72a5a1620e 100644 --- a/crates/bevy_api_gen/src/passes/find_trait_impls.rs +++ b/crates/bevy_api_gen/src/passes/find_trait_impls.rs @@ -6,9 +6,9 @@ use rustc_infer::{ infer::{InferCtxt, TyCtxtInferExt}, traits::{Obligation, ObligationCause}, }; -use rustc_middle::ty::{Ty, TypingMode}; +use rustc_middle::ty::{Ty, TypingEnv, TypingMode}; use rustc_span::DUMMY_SP; -use rustc_trait_selection::traits::ObligationCtxt; +use rustc_trait_selection::{regions::InferCtxtRegionExt, traits::ObligationCtxt}; use crate::{Args, BevyCtxt}; @@ -134,7 +134,10 @@ fn impl_matches<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>, impl_def_id: DefId) let impl_may_apply = |impl_def_id| { let ocx = ObligationCtxt::new(infcx); - let param_env = tcx.param_env_reveal_all_normalized(impl_def_id); + // let param_env = infcx.resolve_regions(impl_def_id); + // let param_env = tcx.param_env_reveal_all_normalized(impl_def_id); + let typing_env = TypingEnv::non_body_analysis(tcx, impl_def_id); + let param_env = typing_env.with_post_analysis_normalized(tcx).param_env; let impl_args = infcx.fresh_args_for_item(DUMMY_SP, impl_def_id); let impl_trait_ref = tcx diff --git a/crates/bevy_api_gen/src/passes/populate_template_data.rs b/crates/bevy_api_gen/src/passes/populate_template_data.rs index 0254ee73b7..9af1a3e89a 100644 --- a/crates/bevy_api_gen/src/passes/populate_template_data.rs +++ b/crates/bevy_api_gen/src/passes/populate_template_data.rs @@ -5,7 +5,7 @@ use rustc_ast::Attribute; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_middle::ty::{ print::Print, AdtDef, FieldDef, GenericArg, GenericParamDefKind, ParamTy, TraitRef, Ty, TyKind, - TypeFoldable, + TypeFoldable, TypingEnv, }; use rustc_span::Symbol; @@ -148,9 +148,10 @@ pub(crate) fn process_functions(ctxt: &BevyCtxt, fns: &[FunctionContext]) -> Vec .zip(fn_sig.inputs()) .enumerate() .map(|(idx, (ident, ty))| { - let normalized_ty = ctxt - .tcx - .normalize_erasing_regions(ctxt.tcx.param_env(fn_ctxt.def_id), *ty); + let normalized_ty = ctxt.tcx.normalize_erasing_regions( + TypingEnv::non_body_analysis(ctxt.tcx, fn_ctxt.def_id), + *ty, + ); Arg { ident: ident.to_string(), ty: ty_to_string(ctxt, normalized_ty, false), @@ -160,9 +161,10 @@ pub(crate) fn process_functions(ctxt: &BevyCtxt, fns: &[FunctionContext]) -> Vec }) .collect(); - let out_ty = ctxt - .tcx - .normalize_erasing_regions(ctxt.tcx.param_env(fn_ctxt.def_id), fn_sig.output()); + let out_ty = ctxt.tcx.normalize_erasing_regions( + TypingEnv::non_body_analysis(ctxt.tcx, fn_ctxt.def_id), + fn_sig.output(), + ); let output = Output { ty: ty_to_string(ctxt, out_ty, false), @@ -288,16 +290,14 @@ pub(crate) enum ProxyType { Ref, RefMut, Val, - NonReflectVal, } impl ProxyType { pub fn to_ident_str(self) -> &'static str { match self { - ProxyType::Ref => "LuaReflectRefProxy", - ProxyType::RefMut => "LuaReflectRefMutProxy", - ProxyType::Val => "LuaReflectValProxy", - ProxyType::NonReflectVal => "LuaValProxy", + ProxyType::Ref => "Ref", + ProxyType::RefMut => "Mut", + ProxyType::Val => "Val", } } } diff --git a/crates/bevy_api_gen/src/plugin.rs b/crates/bevy_api_gen/src/plugin.rs index 1e0d73a245..ec45cf896f 100644 --- a/crates/bevy_api_gen/src/plugin.rs +++ b/crates/bevy_api_gen/src/plugin.rs @@ -1,9 +1,9 @@ +use std::env; + use clap::Parser; use log::debug; use rustc_plugin::{CrateFilter, RustcPlugin, RustcPluginArgs, Utf8Path}; -use std::env; - use crate::{modifying_file_loader::ModifyingFileLoader, BevyAnalyzerCallbacks, WorkspaceMeta}; pub struct BevyAnalyzer; @@ -47,7 +47,8 @@ impl RustcPlugin for BevyAnalyzer { struct DefaultCallbacks; impl rustc_driver::Callbacks for DefaultCallbacks {} - return rustc_driver::RunCompiler::new(&compiler_args, &mut DefaultCallbacks).run(); + rustc_driver::RunCompiler::new(&compiler_args, &mut DefaultCallbacks).run(); + return Ok(()); } } let mut callbacks = BevyAnalyzerCallbacks::new(plugin_args); @@ -55,7 +56,7 @@ impl RustcPlugin for BevyAnalyzer { compiler.set_file_loader(Some(Box::new(ModifyingFileLoader))); let out = compiler.run(); log::trace!("Finished compiling with plugin"); - out + Ok(()) } fn modify_cargo(&self, cmd: &mut std::process::Command, args: &Self::Args) { diff --git a/makefile b/makefile index 9f845f56d6..3cb3fd83a9 100644 --- a/makefile +++ b/makefile @@ -21,21 +21,21 @@ PACKAGE=bevy_mod_scripting TEST_NAME= # # valgrind outputs a callgrind.out.. We can analyze this with kcachegrind # kcachegrind -NIGHTLY_VERSION=nightly-2024-11-05 +NIGHTLY_VERSION=nightly-2024-12-15 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/languages/bevy_mod_scripting_lua/src/bindings/providers +GENERATED_SRC_PATH=./crates/bevy_mod_scripting_functions/src/bevy/ 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: @RUSTFLAGS=-g cargo test --no-run --all-targets --features ${TEST_FEATURES} --package ${PACKAGE} $(TEST_NAME) --message-format=json | jq -r 'first(select(.executable != null and .target.kind == ["test"])) | .executable' | xargs -I@ ln -fs @ ./target/debug/test_binary run_lua_tests: - cargo test --features=lua54 --package bevy_mod_scripting_lua --test lua_tests + cargo test --features=lua54 --package bevy_mod_scripting_lua --test lua_tests -- $(TEST_NAME) comp_benches: @@ -63,7 +63,7 @@ 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_bms_lua": true}' --features ${GEN_BEVY_FEATURES} + cd ${BEVY_PATH} && cargo +${NIGHTLY_VERSION} bevy-api-gen generate --output ${OUTPUT_PATH} --template-args '{ "self_is_bms_lua": 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_bms_lua": true}' From ccb56d5b93657046834de1330ce6208a4d3002ee Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Fri, 27 Dec 2024 21:47:09 +0000 Subject: [PATCH 066/217] move bindings gen to actions --- .github/workflows/generate_bindings.yml | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/generate_bindings.yml diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml new file mode 100644 index 0000000000..e92788a0e4 --- /dev/null +++ b/.github/workflows/generate_bindings.yml @@ -0,0 +1,58 @@ +name: Generate Bindings (Bevy, Glam) + +on: + workflow_call: + # inputs: + # config-path: + # required: true + # type: string + # secrets: + # token: + # required: true + workflow_dispatch: + +env: + RUST_TOOLCHAIN: nightly-2024-12-15 + BEVY_API_GEN_PATH: ./crates/bevy_api_gen + CODEGEN_PATH: ./target/codegen + OUTPUT_PATH: ./crates/bevy_mod_scripting_functions/src/bevy/ + BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded +jobs: + generate_bindings: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN }} + components: rust-src, rustc-dev, llvm-tools-preview + override: true + - name: Install bevy_api_gen binaries + run: cargo install --path ${{ env.BEVY_API_GEN_PATH }} + - name: read bevy workspace version + uses: SebRollen/toml-action@v1.2.0 + id: read_toml + with: + file: 'Cargo.toml' + field: 'workspace.dependencies.bevy.version' + - name: Clone Bevy + run: + mkdir ${{ env.CODEGEN_PATH }} || true + git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.CODEGEN_PATH }}/bevy + cd ${{ env.CODEGEN_PATH }}/bevy && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} + - name: Generate bevy bindings + working-directory: ${{ env.CODEGEN_PATH }}/bevy + run: > + cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv + cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' + - name: Commit changes + run: | + git checkout -b update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT + git add -A + git commit -m "chore(codegen): update bevy bindings" + git push -u origin update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT + - name: Create PR + run: | + gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings" --base ${{ github.ref }} --head update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT \ No newline at end of file From d0f5ce61a646e3ae62cec1ac7f440472b4c091bb Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 21:56:27 +0000 Subject: [PATCH 067/217] call bindgen in bevy_api_gen workflow --- .github/workflows/bevy_api_gen.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/bevy_api_gen.yml b/.github/workflows/bevy_api_gen.yml index 2a916bce8f..015bad2ff8 100644 --- a/.github/workflows/bevy_api_gen.yml +++ b/.github/workflows/bevy_api_gen.yml @@ -131,3 +131,7 @@ jobs: with: command: doc args: --profile=ephemeral-build + bindings: + name: Generate Bindings - bevy_api_gen + uses: ./.github/workflows/generate_bindings.yml + secrets: inherit \ No newline at end of file From c8f36902abfbfb4b6c55929f3e52c4c49b18b837 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 21:59:55 +0000 Subject: [PATCH 068/217] fix typo --- .github/workflows/generate_bindings.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index e92788a0e4..fe6db526e2 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -39,7 +39,7 @@ jobs: field: 'workspace.dependencies.bevy.version' - name: Clone Bevy run: - mkdir ${{ env.CODEGEN_PATH }} || true + mkdir -p ${{ env.CODEGEN_PATH }} || true git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.CODEGEN_PATH }}/bevy cd ${{ env.CODEGEN_PATH }}/bevy && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} - name: Generate bevy bindings @@ -49,10 +49,10 @@ jobs: cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' - name: Commit changes run: | - git checkout -b update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT + git checkout -b update-bevy-bindings-${{ github.run_id }} git add -A git commit -m "chore(codegen): update bevy bindings" - git push -u origin update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT + git push -u origin update-bevy-bindings-${{ github.run_id }} - name: Create PR run: | gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings" --base ${{ github.ref }} --head update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT \ No newline at end of file From 063c80482f694f70a38225f7c6c8c9f679c6e665 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:01:54 +0000 Subject: [PATCH 069/217] change deps --- .github/workflows/bevy_api_gen.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/bevy_api_gen.yml b/.github/workflows/bevy_api_gen.yml index 015bad2ff8..96564290bd 100644 --- a/.github/workflows/bevy_api_gen.yml +++ b/.github/workflows/bevy_api_gen.yml @@ -5,6 +5,8 @@ on: paths: - "crates/bevy_api_gen/**" - ".github/workflows/bevy_api_gen.yml" + - ".github/workflows/generate_bindings.yml" + name: Check and Lint - bevy_api_gen From 33ad952a089bc508b009947133b8c7e2348be3dd Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:05:02 +0000 Subject: [PATCH 070/217] fix missing dir --- .github/workflows/generate_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index fe6db526e2..650060569e 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -39,7 +39,7 @@ jobs: field: 'workspace.dependencies.bevy.version' - name: Clone Bevy run: - mkdir -p ${{ env.CODEGEN_PATH }} || true + mkdir -p ${{ env.CODEGEN_PATH }}/bevy git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.CODEGEN_PATH }}/bevy cd ${{ env.CODEGEN_PATH }}/bevy && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} - name: Generate bevy bindings From 5c9abd8ba7fd46baab55223802ceda49106f8856 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:05:24 +0000 Subject: [PATCH 071/217] more fix --- .github/workflows/generate_bindings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 650060569e..2eeb6773e5 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -45,6 +45,7 @@ jobs: - name: Generate bevy bindings working-directory: ${{ env.CODEGEN_PATH }}/bevy run: > + mkdir -p ${{ env.OUTPUT_PATH }} cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' - name: Commit changes From fc6af0489088dfb3910b1ea8726503102ec141f8 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:08:00 +0000 Subject: [PATCH 072/217] fix typos --- .github/workflows/generate_bindings.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 2eeb6773e5..8703c2d883 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -38,13 +38,13 @@ jobs: file: 'Cargo.toml' field: 'workspace.dependencies.bevy.version' - name: Clone Bevy - run: + run: | mkdir -p ${{ env.CODEGEN_PATH }}/bevy git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.CODEGEN_PATH }}/bevy cd ${{ env.CODEGEN_PATH }}/bevy && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} - name: Generate bevy bindings working-directory: ${{ env.CODEGEN_PATH }}/bevy - run: > + run: | mkdir -p ${{ env.OUTPUT_PATH }} cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' From 405763f92129c938f008e6badfe2f3d58266222f Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:12:03 +0000 Subject: [PATCH 073/217] fix dirs --- .github/workflows/generate_bindings.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 8703c2d883..3c0a7fcf92 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -14,7 +14,7 @@ on: env: RUST_TOOLCHAIN: nightly-2024-12-15 BEVY_API_GEN_PATH: ./crates/bevy_api_gen - CODEGEN_PATH: ./target/codegen + BEVY_PATH: ./target/codegen/bevy OUTPUT_PATH: ./crates/bevy_mod_scripting_functions/src/bevy/ BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded jobs: @@ -39,15 +39,14 @@ jobs: field: 'workspace.dependencies.bevy.version' - name: Clone Bevy run: | - mkdir -p ${{ env.CODEGEN_PATH }}/bevy - git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.CODEGEN_PATH }}/bevy - cd ${{ env.CODEGEN_PATH }}/bevy && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} + mkdir -p ${{ env.BEVY_PATH }} + git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} + cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} - name: Generate bevy bindings - working-directory: ${{ env.CODEGEN_PATH }}/bevy run: | mkdir -p ${{ env.OUTPUT_PATH }} - cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv - cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' + cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv + cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' - name: Commit changes run: | git checkout -b update-bevy-bindings-${{ github.run_id }} From 63d39f8c2f3648192337767a40954293ac2440eb Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:18:51 +0000 Subject: [PATCH 074/217] split steps --- .github/workflows/generate_bindings.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 3c0a7fcf92..c4de79d39d 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -37,15 +37,19 @@ jobs: with: file: 'Cargo.toml' field: 'workspace.dependencies.bevy.version' - - name: Clone Bevy + - name: Prepare Directories run: | + mkdir -p ${{ env.OUTPUT_PATH }} mkdir -p ${{ env.BEVY_PATH }} + - name: Clone Bevy + run: | git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} - name: Generate bevy bindings run: | - mkdir -p ${{ env.OUTPUT_PATH }} cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv + - name: Collect bevy bindings + run: | cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' - name: Commit changes run: | From c9e6a9ce9c1113352e93ea19de7cde887a88f965 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:25:13 +0000 Subject: [PATCH 075/217] git clone into folder --- .github/workflows/generate_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index c4de79d39d..f74b711c18 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -43,7 +43,7 @@ jobs: mkdir -p ${{ env.BEVY_PATH }} - name: Clone Bevy run: | - git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} + git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} . cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} - name: Generate bevy bindings run: | From 9bb68ac3b0c242f113e3d31e151cf8325949731f Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:25:52 +0000 Subject: [PATCH 076/217] print more --- .github/workflows/generate_bindings.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index f74b711c18..ae3fd35cef 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -45,11 +45,13 @@ jobs: run: | git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} . cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} + ls -la ${{ env.BEVY_PATH }} - name: Generate bevy bindings run: | cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv - name: Collect bevy bindings run: | + ls -la ${{ env.BEVY_PATH }} cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' - name: Commit changes run: | From 857f801a5edf1aff0e1ea05c7939e57b0c2185d3 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:28:31 +0000 Subject: [PATCH 077/217] fix tpyo --- .github/workflows/generate_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index ae3fd35cef..d163e69a39 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -43,7 +43,7 @@ jobs: mkdir -p ${{ env.BEVY_PATH }} - name: Clone Bevy run: | - git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} . + git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} ls -la ${{ env.BEVY_PATH }} - name: Generate bevy bindings From eb6b8885d0fb31120c4af9ceff22941781456437 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:31:48 +0000 Subject: [PATCH 078/217] fix relative things --- .github/workflows/generate_bindings.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index d163e69a39..bb8b11c196 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -13,9 +13,9 @@ on: env: RUST_TOOLCHAIN: nightly-2024-12-15 - BEVY_API_GEN_PATH: ./crates/bevy_api_gen - BEVY_PATH: ./target/codegen/bevy - OUTPUT_PATH: ./crates/bevy_mod_scripting_functions/src/bevy/ + BEVY_API_GEN_PATH: ${{ github.workspace }}/crates/bevy_api_gen + BEVY_PATH: ${{ github.workspace }}/target/codegen/bevy + OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy/ BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded jobs: generate_bindings: From e0f85a8c5da639072f31e92865d2bae28afad484 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:40:13 +0000 Subject: [PATCH 079/217] fix ci creds --- .github/workflows/generate_bindings.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index bb8b11c196..44e1ff456a 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -17,19 +17,24 @@ env: BEVY_PATH: ${{ github.workspace }}/target/codegen/bevy OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy/ BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded + BRANCH_NAME: update-bevy-bindings-${{ github.run_id }} jobs: generate_bindings: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Install toolchain + - name: Setup Bot GitHub Credentials + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Install Rust Toolchain uses: actions-rs/toolchain@v1 with: toolchain: ${{ env.RUST_TOOLCHAIN }} components: rust-src, rustc-dev, llvm-tools-preview override: true - - name: Install bevy_api_gen binaries + - name: Install bevy_api_gen Binaries run: cargo install --path ${{ env.BEVY_API_GEN_PATH }} - name: read bevy workspace version uses: SebRollen/toml-action@v1.2.0 @@ -46,19 +51,19 @@ jobs: git clone https://github.com/bevyengine/bevy --branch v${{ steps.read_toml.outputs.value }} --depth 1 ${{ env.BEVY_PATH }} cd ${{ env.BEVY_PATH }} && git fetch --tags && git checkout v${{ steps.read_toml.outputs.value }} ls -la ${{ env.BEVY_PATH }} - - name: Generate bevy bindings + - name: Generate Bevy Bindings run: | cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen generate --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' --features ${{ env.BEVY_FEATURES }} -vv - - name: Collect bevy bindings + - name: Collect Bevy Bindings run: | ls -la ${{ env.BEVY_PATH }} cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' - - name: Commit changes + - name: Commit Changes run: | - git checkout -b update-bevy-bindings-${{ github.run_id }} + git checkout -b ${{ env.BRANCH_NAME }} || git checkout ${{ env.BRANCH_NAME }} git add -A git commit -m "chore(codegen): update bevy bindings" - git push -u origin update-bevy-bindings-${{ github.run_id }} - - name: Create PR + git push -u origin ${{ env.BRANCH_NAME }} --force + - name: Create Or Update PR run: | - gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings" --base ${{ github.ref }} --head update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT \ No newline at end of file + gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings" --base ${{ github.ref }} --head update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT || true \ No newline at end of file From d1392bfb712cea60d8167574a9a7765503509f45 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:46:33 +0000 Subject: [PATCH 080/217] permissions write --- .github/workflows/bevy_api_gen.yml | 2 ++ .github/workflows/generate_bindings.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/bevy_api_gen.yml b/.github/workflows/bevy_api_gen.yml index 96564290bd..d1f0270119 100644 --- a/.github/workflows/bevy_api_gen.yml +++ b/.github/workflows/bevy_api_gen.yml @@ -134,6 +134,8 @@ jobs: command: doc args: --profile=ephemeral-build bindings: + permissions: + contents: write name: Generate Bindings - bevy_api_gen uses: ./.github/workflows/generate_bindings.yml secrets: inherit \ No newline at end of file diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 44e1ff456a..7d2ae6fad0 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -20,6 +20,8 @@ env: BRANCH_NAME: update-bevy-bindings-${{ github.run_id }} jobs: generate_bindings: + permissions: + contents: write runs-on: ubuntu-latest steps: - name: Checkout From f75443f2e45bffe328d99f1325d4283c85695662 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 22:56:53 +0000 Subject: [PATCH 081/217] change pr logic --- .github/workflows/generate_bindings.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 7d2ae6fad0..43e1f02657 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -18,6 +18,7 @@ env: OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy/ BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded BRANCH_NAME: update-bevy-bindings-${{ github.run_id }} + GH_TOKEN: ${{ github.token }} jobs: generate_bindings: permissions: @@ -68,4 +69,4 @@ jobs: git push -u origin ${{ env.BRANCH_NAME }} --force - name: Create Or Update PR run: | - gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings" --base ${{ github.ref }} --head update-bevy-bindings-${{ github.run_id }}-$GITHUB_RUN_ATTEMPT || true \ No newline at end of file + gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings. #${{ github.event.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true \ No newline at end of file From 52043ae86c4f9dd26b7dcd293bcb6d859402c7e5 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 23:03:05 +0000 Subject: [PATCH 082/217] pull request write perms --- .github/workflows/bevy_api_gen.yml | 1 + .github/workflows/generate_bindings.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/bevy_api_gen.yml b/.github/workflows/bevy_api_gen.yml index d1f0270119..a14bb7767d 100644 --- a/.github/workflows/bevy_api_gen.yml +++ b/.github/workflows/bevy_api_gen.yml @@ -136,6 +136,7 @@ jobs: bindings: permissions: contents: write + pull-requests: write name: Generate Bindings - bevy_api_gen uses: ./.github/workflows/generate_bindings.yml secrets: inherit \ No newline at end of file diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 43e1f02657..a182d3ecbb 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -23,6 +23,7 @@ jobs: generate_bindings: permissions: contents: write + pull-requests: write runs-on: ubuntu-latest steps: - name: Checkout From 7a8737aeb387eedb45f65b3d86e0f0350b094fb9 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 23:13:44 +0000 Subject: [PATCH 083/217] update pr logic --- .github/workflows/generate_bindings.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index a182d3ecbb..7a76fa0ad4 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -68,6 +68,11 @@ jobs: git add -A git commit -m "chore(codegen): update bevy bindings" git push -u origin ${{ env.BRANCH_NAME }} --force + - uses: jwalton/gh-find-current-pr@master + id: findPR + with: + state: all - name: Create Or Update PR + if: success() && steps.findPR.outputs.number run: | - gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings. #${{ github.event.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true \ No newline at end of file + gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings. #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true \ No newline at end of file From fe57c1ea96505d984ac7cef5645f8f9d188c6dba Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 23:18:45 +0000 Subject: [PATCH 084/217] prune json files --- .github/workflows/generate_bindings.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 7a76fa0ad4..2683843ee5 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -62,6 +62,9 @@ jobs: run: | ls -la ${{ env.BEVY_PATH }} cd ${{ env.BEVY_PATH }} && cargo bevy-api-gen collect --output ${{ env.OUTPUT_PATH }} --template-args '{ "self_is_bms_lua": true}' + - name: Prune Output + run: | + find ${{ env.OUTPUT_PATH }} -type f ! -name "*.rs" -delete - name: Commit Changes run: | git checkout -b ${{ env.BRANCH_NAME }} || git checkout ${{ env.BRANCH_NAME }} From 08da08a2e969bf73f4aa43b7584e3d13bdefc457 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 23:28:17 +0000 Subject: [PATCH 085/217] update pr opening logic --- .github/workflows/generate_bindings.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 2683843ee5..5d6395002e 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -17,7 +17,7 @@ env: BEVY_PATH: ${{ github.workspace }}/target/codegen/bevy OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy/ BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded - BRANCH_NAME: update-bevy-bindings-${{ github.run_id }} + BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }} GH_TOKEN: ${{ github.token }} jobs: generate_bindings: @@ -78,4 +78,7 @@ jobs: - name: Create Or Update PR if: success() && steps.findPR.outputs.number run: | - gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings. #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true \ No newline at end of file + gh pr list --base feature/bevy-system-refactor --search "chore(codegen): update bevy bindings" --json number > prs.json + if [ $(jq '. | length' prs.json) -eq 0 ]; then + gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings. #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true + fi \ No newline at end of file From ff95931b4eef3146e8af7591d33414276e459948 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 23:28:42 +0000 Subject: [PATCH 086/217] change description --- .github/workflows/generate_bindings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 5d6395002e..64591432c3 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -80,5 +80,5 @@ jobs: run: | gh pr list --base feature/bevy-system-refactor --search "chore(codegen): update bevy bindings" --json number > prs.json if [ $(jq '. | length' prs.json) -eq 0 ]; then - gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings. #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true + gh pr create --title "chore(codegen): update bevy bindings" --body "This PR updates the bevy bindings for #${{ steps.findPR.outputs.number }}" --base ${{ github.ref }} --head ${{ env.BRANCH_NAME }} || true fi \ No newline at end of file From ec1b1018ba1086e6b933510a0ff1d3bd0b83e503 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 27 Dec 2024 23:35:34 +0000 Subject: [PATCH 087/217] don't do anything if no changes --- .github/workflows/generate_bindings.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 64591432c3..426cb896e0 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -65,18 +65,26 @@ jobs: - name: Prune Output run: | find ${{ env.OUTPUT_PATH }} -type f ! -name "*.rs" -delete + - name: Check for changes + id: check_changes + run: | + if [[ -n $(git status --porcelain) ]]; then + echo "changes=true" >> "$GITHUB_OUTPUT"; + fi - name: Commit Changes + if: steps.check_changes.outputs.changes run: | git checkout -b ${{ env.BRANCH_NAME }} || git checkout ${{ env.BRANCH_NAME }} git add -A git commit -m "chore(codegen): update bevy bindings" git push -u origin ${{ env.BRANCH_NAME }} --force - uses: jwalton/gh-find-current-pr@master + if: steps.check_changes.outputs.changes id: findPR with: state: all - name: Create Or Update PR - if: success() && steps.findPR.outputs.number + if: steps.check_changes.outputs.changes && success() && steps.findPR.outputs.number run: | gh pr list --base feature/bevy-system-refactor --search "chore(codegen): update bevy bindings" --json number > prs.json if [ $(jq '. | length' prs.json) -eq 0 ]; then From 6110b504ee7a12283de84cad88a8b5134be730a3 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 00:10:40 +0000 Subject: [PATCH 088/217] modify templates --- crates/bevy_api_gen/templates/crate.tera | 4 -- crates/bevy_api_gen/templates/footer.tera | 64 +++++++++-------------- crates/bevy_api_gen/templates/header.tera | 5 +- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/crates/bevy_api_gen/templates/crate.tera b/crates/bevy_api_gen/templates/crate.tera index 58bba6f222..bd2fbc71e1 100644 --- a/crates/bevy_api_gen/templates/crate.tera +++ b/crates/bevy_api_gen/templates/crate.tera @@ -2,9 +2,5 @@ {% filter prettyplease -%} {% include "header.tera" %} -{% for item in items %} - {% include "item.tera" %} -{% endfor %} - {% include "footer.tera" %} {%- endfilter -%} \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 0009ff8855..d8c64b2964 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -4,50 +4,38 @@ {% set bms_lua_path="bevy_mod_scripting::lua"%} {% endif %} -#[derive(Default)] -pub(crate) struct Globals; - -impl {{bms_lua_path}}::tealr::mlu::ExportInstances for Globals { - fn add_instances<'lua, T: {{bms_lua_path}}::tealr::mlu::InstanceCollector<'lua>>( - self, - instances: &mut T, - ) -> {{bms_lua_path}}::tealr::mlu::mlua::Result<()> { - {% for item in items %} - {% if item.has_static_methods %} - instances.add_instance("{{ item.ident }}", - {{bms_lua_path}}::tealr::mlu::UserDataProxy::<{{item.ident | prefix_lua}}>::new)?; - {% endif %} - {% endfor %} - Ok(()) - } -} - - -fn {{ "ContextInitializer" | prefix_cratename | convert_case(case="snake") }} (_: &bevy_mod_scripting_core::script::ScriptId, ctx: &mut {{bms_lua_path}}::prelude::Lua) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - {{bms_lua_path}}::tealr::mlu::set_global_env(Globals, ctx)?; - Ok(()) -} pub struct {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}}; impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}} { fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + {% for item in items %} - app.register_lua_proxy::<{{ item.import_path }}>(); + NamespaceBuilder::<{{ item.ident }}>::new(world) + {%- for function in item.functions -%} + .overwrite_script_function("{{ function.ident }}", | + {%- for arg in function.args -%} + {%- if arg.ident != "self" -%} + {{- arg.ident -}} + {%- else -%} + _{{- arg.ident -}} + {%- endif -%} + : {{- arg.proxy_ty -}}, + {%- endfor -%} + | { + let output: {{ function.output.proxy_ty }} = {{ item.ident }}::{{ function.ident }}( + {%- for arg in function.args -%} + {%- if arg.ident != "self" -%} + {{- arg.ident -}} + {%- else -%} + _{{- arg.ident -}} + {%- endif -%} + {%- endfor -%} + ).into(); + output + }) + {%- endfor -%}; {% endfor %} - app.add_context_initializer::<()>({{ "ContextInitializer" | prefix_cratename | convert_case(case="snake") }}); - app.add_documentation_fragment( - {{bms_lua_path}}::docs::LuaDocumentationFragment::new("{{ "A P I" | prefix_cratename | convert_case(case="upper_camel") }}", |tw| { - tw - .document_global_instance::().expect("Something went wrong documenting globals") - {% for item in items %} - .process_type::<{{ item.ident | prefix_lua }}>() - {% if item.has_static_methods %} - .process_type::<{{bms_lua_path}}::tealr::mlu::UserDataProxy<{{ item.ident | prefix_lua }}>>() - {% endif %} - {% endfor %} - } - ) - ); } } \ No newline at end of file diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index 02f0fa1b81..9d7674d1ec 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -10,9 +10,10 @@ use super::{{crate}}::*; use bevy_mod_scripting_core::{AddContextInitializer, StoreDocumentation, bindings::ReflectReference}; +use bevy_mod_scripting_functions::RegisterScriptFunction; {% if args.self_is_bms_lua %} -use crate::{bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy},type_data::RegisterLua, tealr::mlu::mlua::IntoLua}; +use crate::*; {% else %} -use bevy_mod_scripting::{lua::bindings::proxy::{LuaReflectRefProxy,LuaReflectRefMutProxy,LuaReflectValProxy,LuaValProxy,LuaIdentityProxy}, type_data::RegisterLua, tealr::mlu::mlua::IntoLua}; +use bevy_mod_scripting_lua::*; {% endif %} \ No newline at end of file From 2d01122c31b166a74400bf225623eb72446435fc Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 00:18:02 +0000 Subject: [PATCH 089/217] fix commas --- crates/bevy_api_gen/templates/footer.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index d8c64b2964..a7d06da62d 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -30,7 +30,7 @@ impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_cas {{- arg.ident -}} {%- else -%} _{{- arg.ident -}} - {%- endif -%} + {%- endif -%}, {%- endfor -%} ).into(); output From 76a2443acc9065899ba4821527339e160734f4b9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 00:25:35 +0000 Subject: [PATCH 090/217] chore(codegen): update bevy bindings (#170) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy/bevy_core.rs | 36 + .../src/bevy/bevy_ecs.rs | 319 + .../src/bevy/bevy_hierarchy.rs | 77 + .../src/bevy/bevy_input.rs | 1174 ++ .../src/bevy/bevy_math.rs | 2977 +++ .../src/bevy/bevy_reflect.rs | 17248 ++++++++++++++++ .../src/bevy/bevy_time.rs | 285 + .../src/bevy/bevy_transform.rs | 243 + .../src/bevy/mod.rs | 25 + 9 files changed, 22384 insertions(+) create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy/mod.rs diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs new file mode 100644 index 0000000000..8a6dbf6656 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs @@ -0,0 +1,36 @@ +// @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::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyCoreScriptingPlugin; +impl bevy::app::Plugin for BevyCoreScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Name::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Name::clone(_self) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs new file mode 100644 index 0000000000..18232a843b --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs @@ -0,0 +1,319 @@ +// @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_reflect::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyEcsScriptingPlugin; +impl bevy::app::Plugin for BevyEcsScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_raw", + |index: u32| { + let output: Val = Entity::from_raw(index) + .into(); + output + }, + ) + .overwrite_script_function( + "to_bits", + |_self: Val| { + let output: u64 = Entity::to_bits(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_bits", + |bits: u64| { + let output: Val = Entity::from_bits(bits) + .into(); + output + }, + ) + .overwrite_script_function( + "index", + |_self: Val| { + let output: u32 = Entity::index(_self).into(); + output + }, + ) + .overwrite_script_function( + "generation", + |_self: Val| { + let output: u32 = Entity::generation(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Entity::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Entity::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ComponentId::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ComponentId::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |index: usize| { + let output: Val = ComponentId::new( + index, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "index", + |_self: Val| { + let output: usize = ComponentId::index(_self).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ComponentId::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Tick::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Tick::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Tick::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |tick: u32| { + let output: Val = Tick::new(tick).into(); + output + }, + ) + .overwrite_script_function( + "get", + |_self: Val| { + let output: u32 = Tick::get(_self).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, tick: u32| { + let output: () = Tick::set(_self, tick).into(); + output + }, + ) + .overwrite_script_function( + "is_newer_than", + | + _self: Val, + last_run: Val, + this_run: Val| + { + let output: bool = Tick::is_newer_than(_self, last_run, this_run) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ComponentTicks::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_added", + | + _self: Ref, + last_run: Val, + this_run: Val| + { + let output: bool = ComponentTicks::is_added( + _self, + last_run, + this_run, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_changed", + | + _self: Ref, + last_run: Val, + this_run: Val| + { + let output: bool = ComponentTicks::is_changed( + _self, + last_run, + this_run, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |change_tick: Val| { + let output: Val = ComponentTicks::new( + change_tick, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_changed", + | + _self: Mut, + change_tick: Val| + { + let output: () = ComponentTicks::set_changed(_self, change_tick) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Identifier::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "low", + |_self: Val| { + let output: u32 = Identifier::low(_self).into(); + output + }, + ) + .overwrite_script_function( + "masked_high", + |_self: Val| { + let output: u32 = Identifier::masked_high(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_bits", + |_self: Val| { + let output: u64 = Identifier::to_bits(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_bits", + |value: u64| { + let output: Val = Identifier::from_bits( + value, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Identifier::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = EntityHash::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::ecs::removal_detection::RemovedComponentEntity, + > = RemovedComponentEntity::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs new file mode 100644 index 0000000000..7c7e0da299 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs @@ -0,0 +1,77 @@ +// @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::*; +use super::bevy_core::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyHierarchyScriptingPlugin; +impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "swap", + | + _self: Mut, + a_index: usize, + b_index: usize| + { + let output: () = Children::swap(_self, a_index, b_index).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Parent::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Parent::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = HierarchyEvent::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = HierarchyEvent::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = HierarchyEvent::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs new file mode 100644 index 0000000000..b69275f5a6 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs @@ -0,0 +1,1174 @@ +// @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::*; +use super::bevy_core::*; +use super::bevy_math::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyInputScriptingPlugin; +impl bevy::app::Plugin for BevyInputScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "vendor_id", + |_self: Ref| { + let output: std::option::Option = Gamepad::vendor_id(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "product_id", + |_self: Ref| { + let output: std::option::Option = Gamepad::product_id(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "pressed", + | + _self: Ref, + button_type: Val| + { + let output: bool = Gamepad::pressed(_self, button_type).into(); + output + }, + ) + .overwrite_script_function( + "just_pressed", + | + _self: Ref, + button_type: Val| + { + let output: bool = Gamepad::just_pressed(_self, button_type).into(); + output + }, + ) + .overwrite_script_function( + "just_released", + | + _self: Ref, + button_type: Val| + { + let output: bool = Gamepad::just_released(_self, button_type).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = GamepadAxis::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadAxis::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadAxis::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadButton::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadButton::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = GamepadButton::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadSettings::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = KeyCode::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = KeyCode::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = KeyCode::assert_receiver_is_total_eq(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = MouseButton::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = MouseButton::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = MouseButton::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = TouchInput::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = TouchInput::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = KeyboardFocusLost::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = KeyboardFocusLost::assert_receiver_is_total_eq( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = KeyboardFocusLost::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = KeyboardInput::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = KeyboardInput::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = KeyboardInput::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = AccumulatedMouseMotion::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = AccumulatedMouseMotion::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = AccumulatedMouseScroll::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = AccumulatedMouseScroll::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = MouseButtonInput::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = MouseButtonInput::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = MouseButtonInput::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = MouseMotion::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = MouseMotion::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = MouseWheel::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = MouseWheel::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadAxisChangedEvent::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadAxisChangedEvent::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadButtonChangedEvent::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadButtonChangedEvent::eq(_self, other) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::input::gamepad::GamepadButtonStateChangedEvent, + > = GamepadButtonStateChangedEvent::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadButtonStateChangedEvent::eq(_self, other) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadConnection::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadConnection::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "connected", + |_self: Ref| { + let output: bool = GamepadConnectionEvent::connected(_self).into(); + output + }, + ) + .overwrite_script_function( + "disconnected", + |_self: Ref| { + let output: bool = GamepadConnectionEvent::disconnected(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadConnectionEvent::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadConnectionEvent::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadEvent::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadEvent::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = GamepadInput::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadInput::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadInput::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadRumbleRequest::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = RawGamepadAxisChangedEvent::eq(_self, other) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RawGamepadAxisChangedEvent::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::input::gamepad::RawGamepadButtonChangedEvent, + > = RawGamepadButtonChangedEvent::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = RawGamepadButtonChangedEvent::eq(_self, other) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RawGamepadEvent::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = RawGamepadEvent::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = PinchGesture::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = PinchGesture::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RotationGesture::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = RotationGesture::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = DoubleTapGesture::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DoubleTapGesture::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = PanGesture::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = PanGesture::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ButtonState::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "is_pressed", + |_self: Ref| { + let output: bool = ButtonState::is_pressed(_self).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ButtonState::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ButtonState::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ButtonSettings::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ButtonSettings::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_pressed", + |_self: Ref, value: f32| { + let output: bool = ButtonSettings::is_pressed(_self, value).into(); + output + }, + ) + .overwrite_script_function( + "is_released", + |_self: Ref, value: f32| { + let output: bool = ButtonSettings::is_released(_self, value).into(); + output + }, + ) + .overwrite_script_function( + "press_threshold", + |_self: Ref| { + let output: f32 = ButtonSettings::press_threshold(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_press_threshold", + |_self: Mut, value: f32| { + let output: f32 = ButtonSettings::set_press_threshold(_self, value) + .into(); + output + }, + ) + .overwrite_script_function( + "release_threshold", + |_self: Ref| { + let output: f32 = ButtonSettings::release_threshold(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_release_threshold", + |_self: Mut, value: f32| { + let output: f32 = ButtonSettings::set_release_threshold(_self, value) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = AxisSettings::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "livezone_upperbound", + |_self: Ref| { + let output: f32 = AxisSettings::livezone_upperbound(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_livezone_upperbound", + |_self: Mut, value: f32| { + let output: f32 = AxisSettings::set_livezone_upperbound(_self, value) + .into(); + output + }, + ) + .overwrite_script_function( + "deadzone_upperbound", + |_self: Ref| { + let output: f32 = AxisSettings::deadzone_upperbound(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_deadzone_upperbound", + |_self: Mut, value: f32| { + let output: f32 = AxisSettings::set_deadzone_upperbound(_self, value) + .into(); + output + }, + ) + .overwrite_script_function( + "livezone_lowerbound", + |_self: Ref| { + let output: f32 = AxisSettings::livezone_lowerbound(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_livezone_lowerbound", + |_self: Mut, value: f32| { + let output: f32 = AxisSettings::set_livezone_lowerbound(_self, value) + .into(); + output + }, + ) + .overwrite_script_function( + "deadzone_lowerbound", + |_self: Ref| { + let output: f32 = AxisSettings::deadzone_lowerbound(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_deadzone_lowerbound", + |_self: Mut, value: f32| { + let output: f32 = AxisSettings::set_deadzone_lowerbound(_self, value) + .into(); + output + }, + ) + .overwrite_script_function( + "threshold", + |_self: Ref| { + let output: f32 = AxisSettings::threshold(_self).into(); + output + }, + ) + .overwrite_script_function( + "set_threshold", + |_self: Mut, value: f32| { + let output: f32 = AxisSettings::set_threshold(_self, value).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + |_self: Ref, new_value: f32| { + let output: f32 = AxisSettings::clamp(_self, new_value).into(); + output + }, + ) + .overwrite_script_function( + "filter", + | + _self: Ref, + new_value: f32, + old_value: std::option::Option| + { + let output: std::option::Option = AxisSettings::filter( + _self, + new_value, + old_value, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = AxisSettings::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "filter", + | + _self: Ref, + new_value: f32, + old_value: std::option::Option| + { + let output: std::option::Option = ButtonAxisSettings::filter( + _self, + new_value, + old_value, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ButtonAxisSettings::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "weak_motor", + |intensity: f32| { + let output: Val = GamepadRumbleIntensity::weak_motor( + intensity, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "strong_motor", + |intensity: f32| { + let output: Val = GamepadRumbleIntensity::strong_motor( + intensity, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GamepadRumbleIntensity::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GamepadRumbleIntensity::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Key::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Key::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Key::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = NativeKeyCode::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = NativeKeyCode::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = NativeKeyCode::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = NativeKey::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = NativeKey::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = NativeKey::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = MouseScrollUnit::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = MouseScrollUnit::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = MouseScrollUnit::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = TouchPhase::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = TouchPhase::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = TouchPhase::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ForceTouch::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ForceTouch::eq(_self, other).into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs new file mode 100644 index 0000000000..8135ba028d --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs @@ -0,0 +1,2977 @@ +// @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_reflect::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyMathScriptingPlugin; +impl bevy::app::Plugin for BevyMathScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = AspectRatio::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "ratio", + |_self: Ref| { + let output: f32 = AspectRatio::ratio(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = AspectRatio::inverse( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_landscape", + |_self: Ref| { + let output: bool = AspectRatio::is_landscape(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_portrait", + |_self: Ref| { + let output: bool = AspectRatio::is_portrait(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_square", + |_self: Ref| { + let output: bool = AspectRatio::is_square(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = AspectRatio::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = CompassOctant::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = CompassOctant::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = CompassOctant::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = CompassQuadrant::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = CompassQuadrant::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = CompassQuadrant::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + | + _self: Val, + rhs: Val| + { + let output: Val = Isometry2d::mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation", + |rotation: Val| { + let output: Val = Isometry2d::from_rotation( + rotation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xy", + |x: f32, y: f32| { + let output: Val = Isometry2d::from_xy(x, y) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Isometry2d::inverse(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse_mul", + |_self: Ref, rhs: Val| { + let output: Val = Isometry2d::inverse_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Isometry2d::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Isometry2d::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Isometry2d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_xyz", + |x: f32, y: f32, z: f32| { + let output: Val = Isometry3d::from_xyz( + x, + y, + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Isometry3d::inverse(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse_mul", + |_self: Ref, rhs: Val| { + let output: Val = Isometry3d::inverse_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Isometry3d::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Isometry3d::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + rhs: Val| + { + let output: Val = Isometry3d::mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Isometry3d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Ray2d::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Ray2d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Ray3d::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Ray3d::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Rot2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "radians", + |radians: f32| { + let output: Val = Rot2::radians(radians).into(); + output + }, + ) + .overwrite_script_function( + "degrees", + |degrees: f32| { + let output: Val = Rot2::degrees(degrees).into(); + output + }, + ) + .overwrite_script_function( + "turn_fraction", + |fraction: f32| { + let output: Val = Rot2::turn_fraction(fraction) + .into(); + output + }, + ) + .overwrite_script_function( + "from_sin_cos", + |sin: f32, cos: f32| { + let output: Val = Rot2::from_sin_cos(sin, cos) + .into(); + output + }, + ) + .overwrite_script_function( + "as_radians", + |_self: Val| { + let output: f32 = Rot2::as_radians(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_degrees", + |_self: Val| { + let output: f32 = Rot2::as_degrees(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_turn_fraction", + |_self: Val| { + let output: f32 = Rot2::as_turn_fraction(_self).into(); + output + }, + ) + .overwrite_script_function( + "sin_cos", + |_self: Val| { + let output: (f32, f32) = Rot2::sin_cos(_self).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Rot2::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = Rot2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = Rot2::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = Rot2::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = Rot2::fast_renormalize(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = Rot2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = Rot2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = Rot2::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_near_identity", + |_self: Val| { + let output: bool = Rot2::is_near_identity(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, other: Val| { + let output: f32 = Rot2::angle_between(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "angle_to", + |_self: Val, other: Val| { + let output: f32 = Rot2::angle_to(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Val| { + let output: Val = Rot2::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "nlerp", + |_self: Val, end: Val, s: f32| { + let output: Val = Rot2::nlerp(_self, end, s) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + |_self: Val, end: Val, s: f32| { + let output: Val = Rot2::slerp(_self, end, s) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + direction: Val| + { + let output: Val = Rot2::mul( + _self, + direction, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Rot2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Rot2::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Dir2::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xy_unchecked", + |x: f32, y: f32| { + let output: Val = Dir2::from_xy_unchecked( + x, + y, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + | + _self: Val, + rhs: Val, + s: f32| + { + let output: Val = Dir2::slerp( + _self, + rhs, + s, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_to", + | + _self: Val, + other: Val| + { + let output: Val = Dir2::rotation_to(_self, other) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_from", + | + _self: Val, + other: Val| + { + let output: Val = Dir2::rotation_from(_self, other) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_from_x", + |_self: Val| { + let output: Val = Dir2::rotation_from_x(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_to_x", + |_self: Val| { + let output: Val = Dir2::rotation_to_x(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_from_y", + |_self: Val| { + let output: Val = Dir2::rotation_from_y(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_to_y", + |_self: Val| { + let output: Val = Dir2::rotation_to_y(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = Dir2::fast_renormalize( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Dir2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Dir2::neg(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Dir3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Dir3::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Dir3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "from_xyz_unchecked", + |x: f32, y: f32, z: f32| { + let output: Val = Dir3::from_xyz_unchecked( + x, + y, + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + | + _self: Val, + rhs: Val, + s: f32| + { + let output: Val = Dir3::slerp( + _self, + rhs, + s, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = Dir3::fast_renormalize( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Dir3A::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Dir3A::neg(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Dir3A::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "from_xyz_unchecked", + |x: f32, y: f32, z: f32| { + let output: Val = Dir3A::from_xyz_unchecked( + x, + y, + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + | + _self: Val, + rhs: Val, + s: f32| + { + let output: Val = Dir3A::slerp( + _self, + rhs, + s, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = Dir3A::fast_renormalize( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = IRect::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = IRect::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = IRect::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x0: i32, y0: i32, x1: i32, y1: i32| { + let output: Val = IRect::new( + x0, + y0, + x1, + y1, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = IRect::is_empty(_self).into(); + output + }, + ) + .overwrite_script_function( + "width", + |_self: Ref| { + let output: i32 = IRect::width(_self).into(); + output + }, + ) + .overwrite_script_function( + "height", + |_self: Ref| { + let output: i32 = IRect::height(_self).into(); + output + }, + ) + .overwrite_script_function( + "union", + | + _self: Ref, + other: Val| + { + let output: Val = IRect::union( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "intersect", + | + _self: Ref, + other: Val| + { + let output: Val = IRect::intersect( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inflate", + |_self: Ref, expansion: i32| { + let output: Val = IRect::inflate( + _self, + expansion, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_rect", + |_self: Ref| { + let output: Val = IRect::as_rect(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_urect", + |_self: Ref| { + let output: Val = IRect::as_urect(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Rect::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x0: f32, y0: f32, x1: f32, y1: f32| { + let output: Val = Rect::new( + x0, + y0, + x1, + y1, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = Rect::is_empty(_self).into(); + output + }, + ) + .overwrite_script_function( + "width", + |_self: Ref| { + let output: f32 = Rect::width(_self).into(); + output + }, + ) + .overwrite_script_function( + "height", + |_self: Ref| { + let output: f32 = Rect::height(_self).into(); + output + }, + ) + .overwrite_script_function( + "union", + | + _self: Ref, + other: Val| + { + let output: Val = Rect::union( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "intersect", + | + _self: Ref, + other: Val| + { + let output: Val = Rect::intersect( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inflate", + |_self: Ref, expansion: f32| { + let output: Val = Rect::inflate( + _self, + expansion, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + | + _self: Ref, + other: Val| + { + let output: Val = Rect::normalize( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_irect", + |_self: Ref| { + let output: Val = Rect::as_irect(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_urect", + |_self: Ref| { + let output: Val = Rect::as_urect(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Rect::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = URect::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x0: u32, y0: u32, x1: u32, y1: u32| { + let output: Val = URect::new( + x0, + y0, + x1, + y1, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = URect::is_empty(_self).into(); + output + }, + ) + .overwrite_script_function( + "width", + |_self: Ref| { + let output: u32 = URect::width(_self).into(); + output + }, + ) + .overwrite_script_function( + "height", + |_self: Ref| { + let output: u32 = URect::height(_self).into(); + output + }, + ) + .overwrite_script_function( + "union", + | + _self: Ref, + other: Val| + { + let output: Val = URect::union( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "intersect", + | + _self: Ref, + other: Val| + { + let output: Val = URect::intersect( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inflate", + |_self: Ref, expansion: i32| { + let output: Val = URect::inflate( + _self, + expansion, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_rect", + |_self: Ref| { + let output: Val = URect::as_rect(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_irect", + |_self: Ref| { + let output: Val = URect::as_irect(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = URect::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = URect::assert_receiver_is_total_eq(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "bounding_circle", + |_self: Ref| { + let output: Val = Aabb2d::bounding_circle( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Aabb2d::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = BoundingCircle::radius(_self).into(); + output + }, + ) + .overwrite_script_function( + "aabb_2d", + |_self: Ref| { + let output: Val = BoundingCircle::aabb_2d( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BoundingCircle::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Circle::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32| { + let output: Val = Circle::new(radius) + .into(); + output + }, + ) + .overwrite_script_function( + "diameter", + |_self: Ref| { + let output: f32 = Circle::diameter(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Circle::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Annulus::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Annulus::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |inner_radius: f32, outer_radius: f32| { + let output: Val = Annulus::new( + inner_radius, + outer_radius, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "diameter", + |_self: Ref| { + let output: f32 = Annulus::diameter(_self).into(); + output + }, + ) + .overwrite_script_function( + "thickness", + |_self: Ref| { + let output: f32 = Annulus::thickness(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |radius: f32, half_angle: f32| { + let output: Val = Arc2d::new( + radius, + half_angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_radians", + |radius: f32, angle: f32| { + let output: Val = Arc2d::from_radians( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_degrees", + |radius: f32, angle: f32| { + let output: Val = Arc2d::from_degrees( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_turns", + |radius: f32, fraction: f32| { + let output: Val = Arc2d::from_turns( + radius, + fraction, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle", + |_self: Ref| { + let output: f32 = Arc2d::angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Ref| { + let output: f32 = Arc2d::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "half_chord_length", + |_self: Ref| { + let output: f32 = Arc2d::half_chord_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "chord_length", + |_self: Ref| { + let output: f32 = Arc2d::chord_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "apothem", + |_self: Ref| { + let output: f32 = Arc2d::apothem(_self).into(); + output + }, + ) + .overwrite_script_function( + "sagitta", + |_self: Ref| { + let output: f32 = Arc2d::sagitta(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_minor", + |_self: Ref| { + let output: bool = Arc2d::is_minor(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_major", + |_self: Ref| { + let output: bool = Arc2d::is_major(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Arc2d::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Arc2d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |radius: f32, length: f32| { + let output: Val = Capsule2d::new( + radius, + length, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_inner_rectangle", + |_self: Ref| { + let output: Val = Capsule2d::to_inner_rectangle( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Capsule2d::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Capsule2d::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = CircularSector::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32, angle: f32| { + let output: Val = CircularSector::new( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_radians", + |radius: f32, angle: f32| { + let output: Val = CircularSector::from_radians( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_degrees", + |radius: f32, angle: f32| { + let output: Val = CircularSector::from_degrees( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_turns", + |radius: f32, fraction: f32| { + let output: Val = CircularSector::from_turns( + radius, + fraction, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_angle", + |_self: Ref| { + let output: f32 = CircularSector::half_angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle", + |_self: Ref| { + let output: f32 = CircularSector::angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = CircularSector::radius(_self).into(); + output + }, + ) + .overwrite_script_function( + "arc_length", + |_self: Ref| { + let output: f32 = CircularSector::arc_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "half_chord_length", + |_self: Ref| { + let output: f32 = CircularSector::half_chord_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "chord_length", + |_self: Ref| { + let output: f32 = CircularSector::chord_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "apothem", + |_self: Ref| { + let output: f32 = CircularSector::apothem(_self).into(); + output + }, + ) + .overwrite_script_function( + "sagitta", + |_self: Ref| { + let output: f32 = CircularSector::sagitta(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = CircularSector::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |radius: f32, angle: f32| { + let output: Val = CircularSegment::new( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_radians", + |radius: f32, angle: f32| { + let output: Val = CircularSegment::from_radians( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_degrees", + |radius: f32, angle: f32| { + let output: Val = CircularSegment::from_degrees( + radius, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_turns", + |radius: f32, fraction: f32| { + let output: Val = CircularSegment::from_turns( + radius, + fraction, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_angle", + |_self: Ref| { + let output: f32 = CircularSegment::half_angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle", + |_self: Ref| { + let output: f32 = CircularSegment::angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = CircularSegment::radius(_self).into(); + output + }, + ) + .overwrite_script_function( + "arc_length", + |_self: Ref| { + let output: f32 = CircularSegment::arc_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "half_chord_length", + |_self: Ref| { + let output: f32 = CircularSegment::half_chord_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "chord_length", + |_self: Ref| { + let output: f32 = CircularSegment::chord_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "apothem", + |_self: Ref| { + let output: f32 = CircularSegment::apothem(_self).into(); + output + }, + ) + .overwrite_script_function( + "sagitta", + |_self: Ref| { + let output: f32 = CircularSegment::sagitta(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = CircularSegment::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = CircularSegment::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Ellipse::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |half_width: f32, half_height: f32| { + let output: Val = Ellipse::new( + half_width, + half_height, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eccentricity", + |_self: Ref| { + let output: f32 = Ellipse::eccentricity(_self).into(); + output + }, + ) + .overwrite_script_function( + "focal_length", + |_self: Ref| { + let output: f32 = Ellipse::focal_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "semi_major", + |_self: Ref| { + let output: f32 = Ellipse::semi_major(_self).into(); + output + }, + ) + .overwrite_script_function( + "semi_minor", + |_self: Ref| { + let output: f32 = Ellipse::semi_minor(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Ellipse::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Line2d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Line2d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Plane2d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Plane2d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Rectangle::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |width: f32, height: f32| { + let output: Val = Rectangle::new( + width, + height, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_length", + |length: f32| { + let output: Val = Rectangle::from_length( + length, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Rectangle::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RegularPolygon::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |circumradius: f32, sides: u32| { + let output: Val = RegularPolygon::new( + circumradius, + sides, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circumradius", + |_self: Ref| { + let output: f32 = RegularPolygon::circumradius(_self).into(); + output + }, + ) + .overwrite_script_function( + "inradius", + |_self: Ref| { + let output: f32 = RegularPolygon::inradius(_self).into(); + output + }, + ) + .overwrite_script_function( + "side_length", + |_self: Ref| { + let output: f32 = RegularPolygon::side_length(_self).into(); + output + }, + ) + .overwrite_script_function( + "internal_angle_degrees", + |_self: Ref| { + let output: f32 = RegularPolygon::internal_angle_degrees(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "internal_angle_radians", + |_self: Ref| { + let output: f32 = RegularPolygon::internal_angle_radians(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "external_angle_degrees", + |_self: Ref| { + let output: f32 = RegularPolygon::external_angle_degrees(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "external_angle_radians", + |_self: Ref| { + let output: f32 = RegularPolygon::external_angle_radians(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = RegularPolygon::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Rhombus::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |horizontal_diagonal: f32, vertical_diagonal: f32| { + let output: Val = Rhombus::new( + horizontal_diagonal, + vertical_diagonal, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_side", + |side: f32| { + let output: Val = Rhombus::from_side( + side, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_inradius", + |inradius: f32| { + let output: Val = Rhombus::from_inradius( + inradius, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "side", + |_self: Ref| { + let output: f32 = Rhombus::side(_self).into(); + output + }, + ) + .overwrite_script_function( + "circumradius", + |_self: Ref| { + let output: f32 = Rhombus::circumradius(_self).into(); + output + }, + ) + .overwrite_script_function( + "inradius", + |_self: Ref| { + let output: f32 = Rhombus::inradius(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Rhombus::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Segment2d::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |direction: Val, length: f32| { + let output: Val = Segment2d::new( + direction, + length, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Segment2d::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "is_degenerate", + |_self: Ref| { + let output: bool = Triangle2d::is_degenerate(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_acute", + |_self: Ref| { + let output: bool = Triangle2d::is_acute(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_obtuse", + |_self: Ref| { + let output: bool = Triangle2d::is_obtuse(_self).into(); + output + }, + ) + .overwrite_script_function( + "reverse", + |_self: Mut| { + let output: () = Triangle2d::reverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "reversed", + |_self: Val| { + let output: Val = Triangle2d::reversed( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Triangle2d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Triangle2d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Aabb3d::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "bounding_sphere", + |_self: Ref| { + let output: Val = Aabb3d::bounding_sphere( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = BoundingSphere::radius(_self).into(); + output + }, + ) + .overwrite_script_function( + "aabb_3d", + |_self: Ref| { + let output: Val = BoundingSphere::aabb_3d( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BoundingSphere::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Sphere::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Sphere::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32| { + let output: Val = Sphere::new(radius) + .into(); + output + }, + ) + .overwrite_script_function( + "diameter", + |_self: Ref| { + let output: f32 = Sphere::diameter(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Cuboid::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Cuboid::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x_length: f32, y_length: f32, z_length: f32| { + let output: Val = Cuboid::new( + x_length, + y_length, + z_length, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_length", + |length: f32| { + let output: Val = Cuboid::from_length( + length, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Cylinder::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Cylinder::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32, height: f32| { + let output: Val = Cylinder::new( + radius, + height, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "base", + |_self: Ref| { + let output: Val = Cylinder::base( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lateral_area", + |_self: Ref| { + let output: f32 = Cylinder::lateral_area(_self).into(); + output + }, + ) + .overwrite_script_function( + "base_area", + |_self: Ref| { + let output: f32 = Cylinder::base_area(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Capsule3d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Capsule3d::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32, length: f32| { + let output: Val = Capsule3d::new( + radius, + length, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cylinder", + |_self: Ref| { + let output: Val = Capsule3d::to_cylinder( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |radius: f32, height: f32| { + let output: Val = Cone::new( + radius, + height, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "base", + |_self: Ref| { + let output: Val = Cone::base(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "slant_height", + |_self: Ref| { + let output: f32 = Cone::slant_height(_self).into(); + output + }, + ) + .overwrite_script_function( + "lateral_area", + |_self: Ref| { + let output: f32 = Cone::lateral_area(_self).into(); + output + }, + ) + .overwrite_script_function( + "base_area", + |_self: Ref| { + let output: f32 = Cone::base_area(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Cone::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Cone::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ConicalFrustum::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ConicalFrustum::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = InfinitePlane3d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = InfinitePlane3d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Line3d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Line3d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |direction: Val, length: f32| { + let output: Val = Segment3d::new( + direction, + length, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Segment3d::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Segment3d::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Torus::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Torus::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |inner_radius: f32, outer_radius: f32| { + let output: Val = Torus::new( + inner_radius, + outer_radius, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inner_radius", + |_self: Ref| { + let output: f32 = Torus::inner_radius(_self).into(); + output + }, + ) + .overwrite_script_function( + "outer_radius", + |_self: Ref| { + let output: f32 = Torus::outer_radius(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Triangle3d::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "is_degenerate", + |_self: Ref| { + let output: bool = Triangle3d::is_degenerate(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_acute", + |_self: Ref| { + let output: bool = Triangle3d::is_acute(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_obtuse", + |_self: Ref| { + let output: bool = Triangle3d::is_obtuse(_self).into(); + output + }, + ) + .overwrite_script_function( + "reverse", + |_self: Mut| { + let output: () = Triangle3d::reverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "reversed", + |_self: Val| { + let output: Val = Triangle3d::reversed( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Triangle3d::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RayCast2d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_ray", + |ray: Val, max: f32| { + let output: Val = RayCast2d::from_ray( + ray, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_intersection_at", + | + _self: Ref, + aabb: Ref| + { + let output: std::option::Option = RayCast2d::aabb_intersection_at( + _self, + aabb, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circle_intersection_at", + | + _self: Ref, + circle: Ref| + { + let output: std::option::Option = RayCast2d::circle_intersection_at( + _self, + circle, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_ray", + | + aabb: Val, + ray: Val, + max: f32| + { + let output: Val = AabbCast2d::from_ray( + aabb, + ray, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_collision_at", + | + _self: Ref, + aabb: Val| + { + let output: std::option::Option = AabbCast2d::aabb_collision_at( + _self, + aabb, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = AabbCast2d::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_ray", + | + circle: Val, + ray: Val, + max: f32| + { + let output: Val = BoundingCircleCast::from_ray( + circle, + ray, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circle_collision_at", + | + _self: Ref, + circle: Val| + { + let output: std::option::Option = BoundingCircleCast::circle_collision_at( + _self, + circle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BoundingCircleCast::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RayCast3d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_ray", + |ray: Val, max: f32| { + let output: Val = RayCast3d::from_ray( + ray, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_intersection_at", + | + _self: Ref, + aabb: Ref| + { + let output: std::option::Option = RayCast3d::aabb_intersection_at( + _self, + aabb, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sphere_intersection_at", + | + _self: Ref, + sphere: Ref| + { + let output: std::option::Option = RayCast3d::sphere_intersection_at( + _self, + sphere, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_ray", + | + aabb: Val, + ray: Val, + max: f32| + { + let output: Val = AabbCast3d::from_ray( + aabb, + ray, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_collision_at", + | + _self: Ref, + aabb: Val| + { + let output: std::option::Option = AabbCast3d::aabb_collision_at( + _self, + aabb, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = AabbCast3d::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_ray", + | + sphere: Val, + ray: Val, + max: f32| + { + let output: Val = BoundingSphereCast::from_ray( + sphere, + ray, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sphere_collision_at", + | + _self: Ref, + sphere: Val| + { + let output: std::option::Option = BoundingSphereCast::sphere_collision_at( + _self, + sphere, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BoundingSphereCast::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Interval::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "start", + |_self: Val| { + let output: f32 = Interval::start(_self).into(); + output + }, + ) + .overwrite_script_function( + "end", + |_self: Val| { + let output: f32 = Interval::end(_self).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Interval::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_bounded", + |_self: Val| { + let output: bool = Interval::is_bounded(_self).into(); + output + }, + ) + .overwrite_script_function( + "has_finite_start", + |_self: Val| { + let output: bool = Interval::has_finite_start(_self).into(); + output + }, + ) + .overwrite_script_function( + "has_finite_end", + |_self: Val| { + let output: bool = Interval::has_finite_end(_self).into(); + output + }, + ) + .overwrite_script_function( + "contains", + |_self: Val, item: f32| { + let output: bool = Interval::contains(_self, item).into(); + output + }, + ) + .overwrite_script_function( + "contains_interval", + | + _self: Val, + other: Val| + { + let output: bool = Interval::contains_interval(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + |_self: Val, value: f32| { + let output: f32 = Interval::clamp(_self, value).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Interval::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = FloatOrd::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = FloatOrd::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = FloatOrd::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "lt", + |_self: Ref, other: Ref| { + let output: bool = FloatOrd::lt(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "le", + |_self: Ref, other: Ref| { + let output: bool = FloatOrd::le(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "gt", + |_self: Ref, other: Ref| { + let output: bool = FloatOrd::gt(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "ge", + |_self: Ref, other: Ref| { + let output: bool = FloatOrd::ge(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Plane3d::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Plane3d::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "signed_volume", + |_self: Ref| { + let output: f32 = Tetrahedron::signed_volume(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Tetrahedron::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Tetrahedron::clone( + _self, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = EaseFunction::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = EaseFunction::eq(_self, other).into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs new file mode 100644 index 0000000000..0f8da2a073 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs @@ -0,0 +1,17248 @@ +// @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 bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyReflectScriptingPlugin; +impl bevy::app::Plugin for BevyReflectScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: bool| { + let output: Val = AtomicBool::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: bool = AtomicBool::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: i16| { + let output: Val = AtomicI16::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i16 = AtomicI16::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: i32| { + let output: Val = AtomicI32::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i32 = AtomicI32::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: i64| { + let output: Val = AtomicI64::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i64 = AtomicI64::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: i8| { + let output: Val = AtomicI8::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i8 = AtomicI8::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: isize| { + let output: Val = AtomicIsize::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: isize = AtomicIsize::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: u16| { + let output: Val = AtomicU16::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u16 = AtomicU16::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: u32| { + let output: Val = AtomicU32::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u32 = AtomicU32::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: u64| { + let output: Val = AtomicU64::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u64 = AtomicU64::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: u8| { + let output: Val = AtomicU8::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u8 = AtomicU8::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |v: usize| { + let output: Val = AtomicUsize::new(v) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: usize = AtomicUsize::into_inner(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = Duration::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Duration::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Duration::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Duration::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Duration::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Duration::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = Duration::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |secs: u64, nanos: u32| { + let output: Val = Duration::new(secs, nanos) + .into(); + output + }, + ) + .overwrite_script_function( + "from_secs", + |secs: u64| { + let output: Val = Duration::from_secs(secs) + .into(); + output + }, + ) + .overwrite_script_function( + "from_millis", + |millis: u64| { + let output: Val = Duration::from_millis( + millis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_micros", + |micros: u64| { + let output: Val = Duration::from_micros( + micros, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_nanos", + |nanos: u64| { + let output: Val = Duration::from_nanos(nanos) + .into(); + output + }, + ) + .overwrite_script_function( + "is_zero", + |_self: Ref| { + let output: bool = Duration::is_zero(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_secs", + |_self: Ref| { + let output: u64 = Duration::as_secs(_self).into(); + output + }, + ) + .overwrite_script_function( + "subsec_millis", + |_self: Ref| { + let output: u32 = Duration::subsec_millis(_self).into(); + output + }, + ) + .overwrite_script_function( + "subsec_micros", + |_self: Ref| { + let output: u32 = Duration::subsec_micros(_self).into(); + output + }, + ) + .overwrite_script_function( + "subsec_nanos", + |_self: Ref| { + let output: u32 = Duration::subsec_nanos(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_millis", + |_self: Ref| { + let output: u128 = Duration::as_millis(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_micros", + |_self: Ref| { + let output: u128 = Duration::as_micros(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_nanos", + |_self: Ref| { + let output: u128 = Duration::as_nanos(_self).into(); + output + }, + ) + .overwrite_script_function( + "abs_diff", + |_self: Val, other: Val| { + let output: Val = Duration::abs_diff( + _self, + other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = Duration::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = Duration::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: u32| { + let output: Val = Duration::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_secs_f64", + |_self: Ref| { + let output: f64 = Duration::as_secs_f64(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_secs_f32", + |_self: Ref| { + let output: f32 = Duration::as_secs_f32(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_secs_f64", + |secs: f64| { + let output: Val = Duration::from_secs_f64( + secs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_secs_f32", + |secs: f32| { + let output: Val = Duration::from_secs_f32( + secs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_f64", + |_self: Val, rhs: f64| { + let output: Val = Duration::mul_f64( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_f32", + |_self: Val, rhs: f32| { + let output: Val = Duration::mul_f32( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_f64", + |_self: Val, rhs: f64| { + let output: Val = Duration::div_f64( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_f32", + |_self: Val, rhs: f32| { + let output: Val = Duration::div_f32( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_duration_f64", + |_self: Val, rhs: Val| { + let output: f64 = Duration::div_duration_f64(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_duration_f32", + |_self: Val, rhs: Val| { + let output: f32 = Duration::div_duration_f32(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Instant::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Instant::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, other: Val| { + let output: Val = Instant::sub(_self, other) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, other: Val| { + let output: Val = Instant::sub(_self, other) + .into(); + output + }, + ) + .overwrite_script_function( + "now", + || { + let output: Val = Instant::now().into(); + output + }, + ) + .overwrite_script_function( + "duration_since", + |_self: Ref, earlier: Val| { + let output: Val = Instant::duration_since( + _self, + earlier, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_duration_since", + |_self: Ref, earlier: Val| { + let output: Val = Instant::saturating_duration_since( + _self, + earlier, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "elapsed", + |_self: Ref| { + let output: Val = Instant::elapsed(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Instant::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, other: Val| { + let output: Val = Instant::add(_self, other) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = RangeFull::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = RangeFull::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = RangeFull::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Quat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Quat::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Quat::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Quat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Quat::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_xyzw", + |x: f32, y: f32, z: f32, w: f32| { + let output: Val = Quat::from_xyzw(x, y, z, w) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 4]| { + let output: Val = Quat::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "from_vec4", + |v: Val| { + let output: Val = Quat::from_vec4(v).into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = Quat::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scaled_axis", + |v: Val| { + let output: Val = Quat::from_scaled_axis(v).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = Quat::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = Quat::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = Quat::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |euler: Val, a: f32, b: f32, c: f32| { + let output: Val = Quat::from_euler(euler, a, b, c) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat: Ref| { + let output: Val = Quat::from_mat3(mat).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |mat: Ref| { + let output: Val = Quat::from_mat3a(mat).into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |mat: Ref| { + let output: Val = Quat::from_mat4(mat).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc", + |from: Val, to: Val| { + let output: Val = Quat::from_rotation_arc(from, to) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_colinear", + |from: Val, to: Val| { + let output: Val = Quat::from_rotation_arc_colinear( + from, + to, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_2d", + |from: Val, to: Val| { + let output: Val = Quat::from_rotation_arc_2d( + from, + to, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_scaled_axis", + |_self: Val| { + let output: Val = Quat::to_scaled_axis(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Val, order: Val| { + let output: (f32, f32, f32) = Quat::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 4] = Quat::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "xyz", + |_self: Val| { + let output: Val = Quat::xyz(_self).into(); + output + }, + ) + .overwrite_script_function( + "conjugate", + |_self: Val| { + let output: Val = Quat::conjugate(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Val| { + let output: Val = Quat::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = Quat::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Quat::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = Quat::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = Quat::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = Quat::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = Quat::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = Quat::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = Quat::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_near_identity", + |_self: Val| { + let output: bool = Quat::is_near_identity(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = Quat::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f32| + { + let output: Val = Quat::rotate_towards( + _self, + rhs, + max_angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Quat::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, end: Val, s: f32| { + let output: Val = Quat::lerp(_self, end, s).into(); + output + }, + ) + .overwrite_script_function( + "slerp", + |_self: Val, end: Val, s: f32| { + let output: Val = Quat::slerp(_self, end, s) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Val, rhs: Val| { + let output: Val = Quat::mul_vec3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_quat", + |_self: Val, rhs: Val| { + let output: Val = Quat::mul_quat(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "from_affine3", + |a: Ref| { + let output: Val = Quat::from_affine3(a).into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3a", + |_self: Val, rhs: Val| { + let output: Val = Quat::mul_vec3a(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dquat", + |_self: Val| { + let output: Val = Quat::as_dquat(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Quat::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Quat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Quat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Quat::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Quat::add(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = Vec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = Vec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Vec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Vec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Vec3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = Vec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = Vec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Vec3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Vec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = Vec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = Vec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = Vec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = Vec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = Vec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Vec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32| { + let output: Val = Vec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = Vec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = Vec3::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 3]| { + let output: Val = Vec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 3] = Vec3::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: f32| { + let output: Val = Vec3::extend(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = Vec3::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = Vec3::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = Vec3::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f32| { + let output: Val = Vec3::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = Vec3::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = Vec3::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cross(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = Vec3::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = Vec3::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = Vec3::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = Vec3::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = Vec3::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = Vec3::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = Vec3::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = Vec3::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = Vec3::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = Vec3::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = Vec3::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = Vec3::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = Vec3::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = Vec3::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = Vec3::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = Vec3::is_nan_mask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Vec3::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = Vec3::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = Vec3::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = Vec3::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = Vec3::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec3::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec3::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = Vec3::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = Vec3::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = Vec3::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = Vec3::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = Vec3::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = Vec3::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec3::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec3::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = Vec3::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = Vec3::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = Vec3::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = Vec3::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = Vec3::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = Vec3::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = Vec3::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = Vec3::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = Vec3::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = Vec3::lerp(_self, rhs, s).into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = Vec3::move_towards(_self, rhs, d) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = Vec3::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Vec3::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = Vec3::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = Vec3::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = Vec3::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = Vec3::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = Vec3::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + |_self: Val, normal: Val, eta: f32| { + let output: Val = Vec3::refract(_self, normal, eta) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = Vec3::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = Vec3::any_orthogonal_vector( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = Vec3::any_orthonormal_vector( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = Vec3::as_dvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = Vec3::as_ivec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = Vec3::as_uvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = Vec3::as_i64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = Vec3::as_u64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Vec3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = Vec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Vec3::sub(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = IVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = IVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = IVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i32| { + let output: Val = IVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = IVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = IVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i32| { + let output: Val = IVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = IVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = IVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = IVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = IVec2::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i32| { + let output: Val = IVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = IVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = IVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = IVec2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i32| { + let output: Val = IVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = IVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32| { + let output: Val = IVec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = IVec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = IVec2::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 2]| { + let output: Val = IVec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 2] = IVec2::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: i32| { + let output: Val = IVec2::extend(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = IVec2::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = IVec2::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = IVec2::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = IVec2::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = IVec2::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = IVec2::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = IVec2::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i32 = IVec2::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i32 = IVec2::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i32 = IVec2::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i32 = IVec2::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = IVec2::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = IVec2::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = IVec2::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = IVec2::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = IVec2::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = IVec2::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = IVec2::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = IVec2::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = IVec2::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i32 = IVec2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i32 = IVec2::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = IVec2::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = IVec2::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = IVec2::perp(_self).into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: i32 = IVec2::perp_dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = IVec2::rotate(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = IVec2::as_vec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = IVec2::as_dvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = IVec2::as_uvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = IVec2::as_i64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = IVec2::as_u64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = IVec2::wrapping_add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = IVec2::wrapping_sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = IVec2::wrapping_mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = IVec2::wrapping_div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = IVec2::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = IVec2::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = IVec2::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = IVec2::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec2::wrapping_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec2::wrapping_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec2::saturating_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec2::saturating_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = IVec2::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = IVec2::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i32| { + let output: Val = IVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = IVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = IVec3::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = IVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32, z: i32| { + let output: Val = IVec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = IVec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = IVec3::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 3]| { + let output: Val = IVec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 3] = IVec3::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: i32| { + let output: Val = IVec3::extend(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = IVec3::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = IVec3::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = IVec3::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i32| { + let output: Val = IVec3::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = IVec3::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = IVec3::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cross(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = IVec3::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = IVec3::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = IVec3::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i32 = IVec3::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i32 = IVec3::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i32 = IVec3::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i32 = IVec3::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = IVec3::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = IVec3::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = IVec3::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = IVec3::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i32 = IVec3::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i32 = IVec3::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = IVec3::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = IVec3::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = IVec3::as_vec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = IVec3::as_vec3a(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = IVec3::as_dvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = IVec3::as_uvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = IVec3::as_i64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = IVec3::as_u64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = IVec3::wrapping_add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = IVec3::wrapping_sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = IVec3::wrapping_mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = IVec3::wrapping_div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = IVec3::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = IVec3::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = IVec3::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = IVec3::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec3::wrapping_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec3::wrapping_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec3::saturating_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec3::saturating_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = IVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i32| { + let output: Val = IVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = IVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i32| { + let output: Val = IVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = IVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i32| { + let output: Val = IVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = IVec3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = IVec3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = IVec3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = IVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = IVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = IVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = IVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = IVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = IVec3::rem(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "add", + |_self: Val, rhs: i32| { + let output: Val = IVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = IVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = IVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = IVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32, z: i32, w: i32| { + let output: Val = IVec4::new(x, y, z, w).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = IVec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = IVec4::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 4]| { + let output: Val = IVec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 4] = IVec4::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = IVec4::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = IVec4::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = IVec4::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i32| { + let output: Val = IVec4::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: i32| { + let output: Val = IVec4::with_w(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = IVec4::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = IVec4::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = IVec4::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = IVec4::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = IVec4::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i32 = IVec4::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i32 = IVec4::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i32 = IVec4::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i32 = IVec4::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = IVec4::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = IVec4::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = IVec4::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = IVec4::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = IVec4::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = IVec4::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = IVec4::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = IVec4::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = IVec4::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i32 = IVec4::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i32 = IVec4::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = IVec4::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = IVec4::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = IVec4::as_vec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = IVec4::as_dvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = IVec4::as_uvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = IVec4::as_i64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = IVec4::as_u64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = IVec4::wrapping_add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = IVec4::wrapping_sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = IVec4::wrapping_mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = IVec4::wrapping_div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = IVec4::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = IVec4::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = IVec4::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = IVec4::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec4::wrapping_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec4::wrapping_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec4::saturating_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = IVec4::saturating_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = IVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i32| { + let output: Val = IVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = IVec4::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = IVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = IVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = IVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i32| { + let output: Val = IVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = IVec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = IVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = IVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = IVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = IVec4::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = IVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = IVec4::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i32| { + let output: Val = IVec4::rem(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = I64Vec2::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i64| { + let output: Val = I64Vec2::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec2::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = I64Vec2::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec2::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = I64Vec2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = I64Vec2::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec2::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = I64Vec2::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = I64Vec2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i64, y: i64| { + let output: Val = I64Vec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i64| { + let output: Val = I64Vec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = I64Vec2::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i64; 2]| { + let output: Val = I64Vec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i64; 2] = I64Vec2::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: i64| { + let output: Val = I64Vec2::extend(_self, z) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i64| { + let output: Val = I64Vec2::with_x(_self, x) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i64| { + let output: Val = I64Vec2::with_y(_self, y) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec2::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::dot_into_vec( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::min(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::max(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = I64Vec2::clamp( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i64 = I64Vec2::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i64 = I64Vec2::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i64 = I64Vec2::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i64 = I64Vec2::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = I64Vec2::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = I64Vec2::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = I64Vec2::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i64 = I64Vec2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec2::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::div_euclid( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::rem_euclid( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = I64Vec2::perp(_self).into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec2::perp_dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::rotate(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = I64Vec2::as_vec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = I64Vec2::as_dvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = I64Vec2::as_ivec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = I64Vec2::as_uvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = I64Vec2::as_u64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::wrapping_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::wrapping_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::wrapping_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::wrapping_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::wrapping_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::wrapping_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::saturating_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::saturating_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = I64Vec2::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = I64Vec2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec2::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec2::div(_self, rhs) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec3::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec3::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = I64Vec3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = I64Vec3::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = I64Vec3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = I64Vec3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec3::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i64| { + let output: Val = I64Vec3::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = I64Vec3::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = I64Vec3::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = I64Vec3::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i64, y: i64, z: i64| { + let output: Val = I64Vec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i64| { + let output: Val = I64Vec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = I64Vec3::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i64; 3]| { + let output: Val = I64Vec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i64; 3] = I64Vec3::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: i64| { + let output: Val = I64Vec3::extend(_self, w) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = I64Vec3::truncate(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i64| { + let output: Val = I64Vec3::with_x(_self, x) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i64| { + let output: Val = I64Vec3::with_y(_self, y) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i64| { + let output: Val = I64Vec3::with_z(_self, z) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec3::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::dot_into_vec( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cross(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::min(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::max(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = I64Vec3::clamp( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i64 = I64Vec3::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i64 = I64Vec3::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i64 = I64Vec3::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i64 = I64Vec3::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = I64Vec3::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = I64Vec3::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = I64Vec3::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i64 = I64Vec3::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec3::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::div_euclid( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::rem_euclid( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = I64Vec3::as_vec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = I64Vec3::as_vec3a(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = I64Vec3::as_dvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = I64Vec3::as_ivec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = I64Vec3::as_uvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = I64Vec3::as_u64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::wrapping_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::wrapping_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::wrapping_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::wrapping_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::wrapping_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::wrapping_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::saturating_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec3::saturating_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec3::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = I64Vec3::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec4::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = I64Vec4::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec4::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec4::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = I64Vec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec4::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = I64Vec4::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = I64Vec4::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = I64Vec4::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = I64Vec4::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = I64Vec4::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i64| { + let output: Val = I64Vec4::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i64, y: i64, z: i64, w: i64| { + let output: Val = I64Vec4::new(x, y, z, w) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i64| { + let output: Val = I64Vec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = I64Vec4::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i64; 4]| { + let output: Val = I64Vec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i64; 4] = I64Vec4::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = I64Vec4::truncate(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i64| { + let output: Val = I64Vec4::with_x(_self, x) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i64| { + let output: Val = I64Vec4::with_y(_self, y) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i64| { + let output: Val = I64Vec4::with_z(_self, z) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: i64| { + let output: Val = I64Vec4::with_w(_self, w) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec4::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::dot_into_vec( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::min(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::max(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = I64Vec4::clamp( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i64 = I64Vec4::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i64 = I64Vec4::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i64 = I64Vec4::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i64 = I64Vec4::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = I64Vec4::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = I64Vec4::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = I64Vec4::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i64 = I64Vec4::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i64 = I64Vec4::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::div_euclid( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::rem_euclid( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = I64Vec4::as_vec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = I64Vec4::as_dvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = I64Vec4::as_ivec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = I64Vec4::as_uvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = I64Vec4::as_u64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::wrapping_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::wrapping_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::wrapping_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::wrapping_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::wrapping_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::wrapping_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::saturating_add_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::saturating_sub_unsigned( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = I64Vec4::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = I64Vec4::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = I64Vec4::div(_self, rhs) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = UVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = UVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = UVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = UVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u32| { + let output: Val = UVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = UVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u32| { + let output: Val = UVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = UVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = UVec2::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = UVec2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u32, y: u32| { + let output: Val = UVec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u32| { + let output: Val = UVec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = UVec2::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u32; 2]| { + let output: Val = UVec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u32; 2] = UVec2::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: u32| { + let output: Val = UVec2::extend(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u32| { + let output: Val = UVec2::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u32| { + let output: Val = UVec2::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u32 = UVec2::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = UVec2::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = UVec2::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = UVec2::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = UVec2::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u32 = UVec2::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u32 = UVec2::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u32 = UVec2::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u32 = UVec2::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = UVec2::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = UVec2::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = UVec2::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = UVec2::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = UVec2::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = UVec2::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u32 = UVec2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = UVec2::as_vec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = UVec2::as_dvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = UVec2::as_ivec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = UVec2::as_i64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = UVec2::as_u64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = UVec2::wrapping_add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = UVec2::wrapping_sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = UVec2::wrapping_mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = UVec2::wrapping_div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = UVec2::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = UVec2::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = UVec2::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = UVec2::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = UVec2::wrapping_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = UVec2::saturating_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = UVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = UVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = UVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = UVec2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = UVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = UVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = UVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = UVec2::sub(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = UVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = UVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = UVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u32, y: u32, z: u32| { + let output: Val = UVec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u32| { + let output: Val = UVec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = UVec3::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u32; 3]| { + let output: Val = UVec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u32; 3] = UVec3::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: u32| { + let output: Val = UVec3::extend(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = UVec3::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u32| { + let output: Val = UVec3::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u32| { + let output: Val = UVec3::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u32| { + let output: Val = UVec3::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u32 = UVec3::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = UVec3::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cross(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = UVec3::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = UVec3::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = UVec3::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u32 = UVec3::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u32 = UVec3::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u32 = UVec3::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u32 = UVec3::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = UVec3::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u32 = UVec3::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = UVec3::as_vec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = UVec3::as_vec3a(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = UVec3::as_dvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = UVec3::as_ivec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = UVec3::as_i64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = UVec3::as_u64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = UVec3::wrapping_add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = UVec3::wrapping_sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = UVec3::wrapping_mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = UVec3::wrapping_div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = UVec3::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = UVec3::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = UVec3::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = UVec3::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = UVec3::wrapping_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = UVec3::saturating_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = UVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = UVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = UVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = UVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = UVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = UVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u32| { + let output: Val = UVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = UVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = UVec3::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u32| { + let output: Val = UVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = UVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = UVec3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = UVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = UVec3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = UVec3::div(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = UVec4::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = UVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = UVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u32, y: u32, z: u32, w: u32| { + let output: Val = UVec4::new(x, y, z, w).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u32| { + let output: Val = UVec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = UVec4::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u32; 4]| { + let output: Val = UVec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u32; 4] = UVec4::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = UVec4::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u32| { + let output: Val = UVec4::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u32| { + let output: Val = UVec4::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u32| { + let output: Val = UVec4::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: u32| { + let output: Val = UVec4::with_w(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u32 = UVec4::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = UVec4::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = UVec4::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = UVec4::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = UVec4::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u32 = UVec4::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u32 = UVec4::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u32 = UVec4::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u32 = UVec4::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = UVec4::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = UVec4::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = UVec4::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = UVec4::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = UVec4::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = UVec4::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u32 = UVec4::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = UVec4::as_vec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = UVec4::as_dvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = UVec4::as_ivec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = UVec4::as_i64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = UVec4::as_u64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = UVec4::wrapping_add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = UVec4::wrapping_sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = UVec4::wrapping_mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = UVec4::wrapping_div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = UVec4::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = UVec4::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = UVec4::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = UVec4::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = UVec4::wrapping_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = UVec4::saturating_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = UVec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = UVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = UVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = UVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = UVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = UVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = UVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = UVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = UVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = UVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = UVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u32| { + let output: Val = UVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = UVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = UVec4::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u32| { + let output: Val = UVec4::add(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = U64Vec2::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = U64Vec2::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = U64Vec2::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec2::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u64| { + let output: Val = U64Vec2::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec2::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec2::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u64| { + let output: Val = U64Vec2::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = U64Vec2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u64, y: u64| { + let output: Val = U64Vec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u64| { + let output: Val = U64Vec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = U64Vec2::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u64; 2]| { + let output: Val = U64Vec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u64; 2] = U64Vec2::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: u64| { + let output: Val = U64Vec2::extend(_self, z) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u64| { + let output: Val = U64Vec2::with_x(_self, x) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u64| { + let output: Val = U64Vec2::with_y(_self, y) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u64 = U64Vec2::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::dot_into_vec( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::min(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::max(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = U64Vec2::clamp( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u64 = U64Vec2::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u64 = U64Vec2::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u64 = U64Vec2::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u64 = U64Vec2::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u64 = U64Vec2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = U64Vec2::as_vec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = U64Vec2::as_dvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = U64Vec2::as_ivec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = U64Vec2::as_uvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = U64Vec2::as_i64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::wrapping_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::wrapping_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::wrapping_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::wrapping_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::wrapping_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::saturating_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = U64Vec2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = U64Vec2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = U64Vec2::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec2::add(_self, rhs) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec3::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec3::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u64| { + let output: Val = U64Vec3::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = U64Vec3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec3::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = U64Vec3::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u64| { + let output: Val = U64Vec3::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u64, y: u64, z: u64| { + let output: Val = U64Vec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u64| { + let output: Val = U64Vec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = U64Vec3::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u64; 3]| { + let output: Val = U64Vec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u64; 3] = U64Vec3::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: u64| { + let output: Val = U64Vec3::extend(_self, w) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = U64Vec3::truncate(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u64| { + let output: Val = U64Vec3::with_x(_self, x) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u64| { + let output: Val = U64Vec3::with_y(_self, y) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u64| { + let output: Val = U64Vec3::with_z(_self, z) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u64 = U64Vec3::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::dot_into_vec( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cross(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::min(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::max(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = U64Vec3::clamp( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u64 = U64Vec3::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u64 = U64Vec3::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u64 = U64Vec3::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u64 = U64Vec3::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u64 = U64Vec3::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = U64Vec3::as_vec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = U64Vec3::as_vec3a(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = U64Vec3::as_dvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = U64Vec3::as_ivec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = U64Vec3::as_uvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = U64Vec3::as_i64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::wrapping_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::wrapping_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::wrapping_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::wrapping_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::wrapping_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = U64Vec3::saturating_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = U64Vec3::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec3::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = U64Vec3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = U64Vec3::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = U64Vec3::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec4::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec4::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = U64Vec4::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = U64Vec4::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = U64Vec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u64| { + let output: Val = U64Vec4::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = U64Vec4::rem(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = U64Vec4::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec4::add(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec4::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = U64Vec4::div(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u64, y: u64, z: u64, w: u64| { + let output: Val = U64Vec4::new(x, y, z, w) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u64| { + let output: Val = U64Vec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = U64Vec4::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u64; 4]| { + let output: Val = U64Vec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u64; 4] = U64Vec4::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = U64Vec4::truncate(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u64| { + let output: Val = U64Vec4::with_x(_self, x) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u64| { + let output: Val = U64Vec4::with_y(_self, y) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u64| { + let output: Val = U64Vec4::with_z(_self, z) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: u64| { + let output: Val = U64Vec4::with_w(_self, w) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u64 = U64Vec4::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::dot_into_vec( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::min(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::max(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = U64Vec4::clamp( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u64 = U64Vec4::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u64 = U64Vec4::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u64 = U64Vec4::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u64 = U64Vec4::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u64 = U64Vec4::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = U64Vec4::as_vec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = U64Vec4::as_dvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = U64Vec4::as_ivec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = U64Vec4::as_uvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = U64Vec4::as_i64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::wrapping_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::wrapping_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::wrapping_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::wrapping_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::saturating_add( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::saturating_sub( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::saturating_mul( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::saturating_div( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::wrapping_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = U64Vec4::saturating_add_signed( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u64| { + let output: Val = U64Vec4::sub(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = U64Vec4::add(_self, rhs) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Vec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Vec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = Vec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Vec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = Vec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Vec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = Vec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32| { + let output: Val = Vec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = Vec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = Vec2::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 2]| { + let output: Val = Vec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 2] = Vec2::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: f32| { + let output: Val = Vec2::extend(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = Vec2::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = Vec2::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = Vec2::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = Vec2::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = Vec2::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = Vec2::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = Vec2::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = Vec2::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = Vec2::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = Vec2::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = Vec2::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = Vec2::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = Vec2::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = Vec2::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = Vec2::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = Vec2::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = Vec2::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = Vec2::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = Vec2::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = Vec2::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = Vec2::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = Vec2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = Vec2::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = Vec2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = Vec2::is_nan_mask(_self).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Vec2::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = Vec2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = Vec2::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = Vec2::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = Vec2::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec2::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec2::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = Vec2::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = Vec2::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = Vec2::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = Vec2::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = Vec2::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = Vec2::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec2::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec2::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = Vec2::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = Vec2::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = Vec2::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = Vec2::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = Vec2::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = Vec2::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = Vec2::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = Vec2::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = Vec2::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = Vec2::lerp(_self, rhs, s).into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = Vec2::move_towards(_self, rhs, d) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = Vec2::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Vec2::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = Vec2::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = Vec2::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = Vec2::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = Vec2::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = Vec2::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + |_self: Val, normal: Val, eta: f32| { + let output: Val = Vec2::refract(_self, normal, eta) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = Vec2::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "to_angle", + |_self: Val| { + let output: f32 = Vec2::to_angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = Vec2::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "angle_to", + |_self: Val, rhs: Val| { + let output: f32 = Vec2::angle_to(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = Vec2::perp(_self).into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: f32 = Vec2::perp_dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = Vec2::rotate(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f32| + { + let output: Val = Vec2::rotate_towards( + _self, + rhs, + max_angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = Vec2::as_dvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = Vec2::as_ivec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = Vec2::as_uvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = Vec2::as_i64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = Vec2::as_u64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Vec2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Vec2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = Vec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = Vec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = Vec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = Vec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = Vec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Vec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Vec2::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = Vec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = Vec2::div(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = Vec3A::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = Vec3A::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Vec3A::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = Vec3A::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32| { + let output: Val = Vec3A::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = Vec3A::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = Vec3A::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 3]| { + let output: Val = Vec3A::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 3] = Vec3A::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_vec4", + |v: Val| { + let output: Val = Vec3A::from_vec4(v).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: f32| { + let output: Val = Vec3A::extend(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = Vec3A::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = Vec3A::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = Vec3A::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f32| { + let output: Val = Vec3A::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = Vec3A::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cross(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = Vec3A::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = Vec3A::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = Vec3A::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = Vec3A::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = Vec3A::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cmpeq(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cmpne(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cmpge(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cmpgt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cmple(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::cmplt(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = Vec3A::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = Vec3A::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = Vec3A::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = Vec3A::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = Vec3A::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = Vec3A::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = Vec3A::is_nan_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Vec3A::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = Vec3A::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = Vec3A::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = Vec3A::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = Vec3A::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = Vec3A::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = Vec3A::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = Vec3A::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = Vec3A::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = Vec3A::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = Vec3A::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = Vec3A::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = Vec3A::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = Vec3A::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = Vec3A::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = Vec3A::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = Vec3A::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = Vec3A::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = Vec3A::lerp(_self, rhs, s) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = Vec3A::move_towards( + _self, + rhs, + d, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Vec3A::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = Vec3A::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = Vec3A::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = Vec3A::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = Vec3A::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = Vec3A::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f32| + { + let output: Val = Vec3A::refract( + _self, + normal, + eta, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = Vec3A::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = Vec3A::any_orthogonal_vector( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = Vec3A::any_orthonormal_vector( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = Vec3A::as_dvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = Vec3A::as_ivec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = Vec3A::as_uvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = Vec3A::as_i64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = Vec3A::as_u64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Vec3A::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = Vec3A::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Vec3A::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = Vec3A::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = Vec3A::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Vec3A::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = Vec3A::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = Vec3A::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Vec3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = Vec3A::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32, w: f32| { + let output: Val = Vec4::new(x, y, z, w).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = Vec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = Vec4::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 4]| { + let output: Val = Vec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 4] = Vec4::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = Vec4::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = Vec4::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = Vec4::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f32| { + let output: Val = Vec4::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: f32| { + let output: Val = Vec4::with_w(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = Vec4::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = Vec4::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = Vec4::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = Vec4::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = Vec4::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = Vec4::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = Vec4::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = Vec4::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = Vec4::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = Vec4::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = Vec4::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = Vec4::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = Vec4::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = Vec4::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = Vec4::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = Vec4::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = Vec4::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = Vec4::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = Vec4::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = Vec4::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = Vec4::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = Vec4::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = Vec4::is_nan_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = Vec4::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = Vec4::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = Vec4::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = Vec4::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = Vec4::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec4::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = Vec4::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = Vec4::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = Vec4::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = Vec4::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = Vec4::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = Vec4::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = Vec4::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec4::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = Vec4::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = Vec4::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = Vec4::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = Vec4::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = Vec4::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = Vec4::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = Vec4::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = Vec4::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = Vec4::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = Vec4::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = Vec4::lerp(_self, rhs, s).into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = Vec4::move_towards(_self, rhs, d) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = Vec4::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Vec4::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = Vec4::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = Vec4::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = Vec4::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = Vec4::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = Vec4::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + |_self: Val, normal: Val, eta: f32| { + let output: Val = Vec4::refract(_self, normal, eta) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = Vec4::as_dvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = Vec4::as_ivec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = Vec4::as_uvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = Vec4::as_i64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = Vec4::as_u64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = Vec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = Vec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = Vec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = Vec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Vec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = Vec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Vec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = Vec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Vec4::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = Vec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Vec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Vec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Vec4::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = Vec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = Vec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Vec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Vec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = Vec4::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = BVec2::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: bool, y: bool| { + let output: Val = BVec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = BVec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 2]| { + let output: Val = BVec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = BVec2::bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = BVec2::any(_self).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = BVec2::all(_self).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = BVec2::test(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = BVec2::set(_self, index, value).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BVec2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = BVec2::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = BVec3::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool| { + let output: Val = BVec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = BVec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 3]| { + let output: Val = BVec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = BVec3::bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = BVec3::any(_self).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = BVec3::all(_self).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = BVec3::test(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = BVec3::set(_self, index, value).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BVec3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = BVec3::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BVec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = BVec4::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = BVec4::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool, w: bool| { + let output: Val = BVec4::new(x, y, z, w).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = BVec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 4]| { + let output: Val = BVec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = BVec4::bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = BVec4::any(_self).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = BVec4::all(_self).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = BVec4::test(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = BVec4::set(_self, index, value).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = DVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f64, y: f64| { + let output: Val = DVec2::new(x, y).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f64| { + let output: Val = DVec2::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = DVec2::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 2]| { + let output: Val = DVec2::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 2] = DVec2::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: f64| { + let output: Val = DVec2::extend(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f64| { + let output: Val = DVec2::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f64| { + let output: Val = DVec2::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = DVec2::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = DVec2::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = DVec2::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = DVec2::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = DVec2::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f64 = DVec2::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f64 = DVec2::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f64 = DVec2::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f64 = DVec2::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = DVec2::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = DVec2::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = DVec2::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = DVec2::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = DVec2::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = DVec2::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = DVec2::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = DVec2::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = DVec2::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = DVec2::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = DVec2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = DVec2::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = DVec2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = DVec2::is_nan_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = DVec2::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = DVec2::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = DVec2::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f64 = DVec2::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f64 = DVec2::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = DVec2::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = DVec2::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = DVec2::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = DVec2::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = DVec2::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = DVec2::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = DVec2::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = DVec2::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = DVec2::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = DVec2::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = DVec2::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = DVec2::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = DVec2::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = DVec2::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = DVec2::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = DVec2::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = DVec2::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f64| { + let output: Val = DVec2::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = DVec2::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f64| { + let output: Val = DVec2::lerp(_self, rhs, s) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f64| { + let output: Val = DVec2::move_towards( + _self, + rhs, + d, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = DVec2::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DVec2::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f64, max: f64| { + let output: Val = DVec2::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f64| { + let output: Val = DVec2::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f64| { + let output: Val = DVec2::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = DVec2::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = DVec2::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f64| + { + let output: Val = DVec2::refract( + _self, + normal, + eta, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = DVec2::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "to_angle", + |_self: Val| { + let output: f64 = DVec2::to_angle(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f64 = DVec2::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "angle_to", + |_self: Val, rhs: Val| { + let output: f64 = DVec2::angle_to(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = DVec2::perp(_self).into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: f64 = DVec2::perp_dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = DVec2::rotate(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f64| + { + let output: Val = DVec2::rotate_towards( + _self, + rhs, + max_angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = DVec2::as_vec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = DVec2::as_ivec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = DVec2::as_uvec2(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = DVec2::as_i64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = DVec2::as_u64vec2(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = DVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = DVec2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = DVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = DVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = DVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DVec2::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = DVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = DVec2::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = DVec2::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = DVec2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DVec2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = DVec2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DVec2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DVec2::div(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = DVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = DVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = DVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DVec3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = DVec3::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = DVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = DVec3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = DVec3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = DVec3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = DVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = DVec3::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f64, y: f64, z: f64| { + let output: Val = DVec3::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f64| { + let output: Val = DVec3::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = DVec3::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 3]| { + let output: Val = DVec3::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 3] = DVec3::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: f64| { + let output: Val = DVec3::extend(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = DVec3::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f64| { + let output: Val = DVec3::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f64| { + let output: Val = DVec3::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f64| { + let output: Val = DVec3::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = DVec3::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = DVec3::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cross(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = DVec3::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = DVec3::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = DVec3::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f64 = DVec3::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f64 = DVec3::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f64 = DVec3::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f64 = DVec3::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = DVec3::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = DVec3::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = DVec3::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = DVec3::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = DVec3::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = DVec3::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = DVec3::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = DVec3::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = DVec3::is_nan_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = DVec3::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = DVec3::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = DVec3::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f64 = DVec3::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f64 = DVec3::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = DVec3::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = DVec3::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = DVec3::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = DVec3::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = DVec3::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = DVec3::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = DVec3::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = DVec3::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = DVec3::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = DVec3::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = DVec3::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = DVec3::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = DVec3::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = DVec3::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = DVec3::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = DVec3::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = DVec3::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f64| { + let output: Val = DVec3::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = DVec3::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f64| { + let output: Val = DVec3::lerp(_self, rhs, s) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f64| { + let output: Val = DVec3::move_towards( + _self, + rhs, + d, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = DVec3::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DVec3::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f64, max: f64| { + let output: Val = DVec3::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f64| { + let output: Val = DVec3::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f64| { + let output: Val = DVec3::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = DVec3::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = DVec3::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f64| + { + let output: Val = DVec3::refract( + _self, + normal, + eta, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f64 = DVec3::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = DVec3::any_orthogonal_vector( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = DVec3::any_orthonormal_vector( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = DVec3::as_vec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = DVec3::as_vec3a(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = DVec3::as_ivec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = DVec3::as_uvec3(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = DVec3::as_i64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = DVec3::as_u64vec3(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DVec3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = DVec3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DVec3::sub(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = DVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DVec4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DVec4::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f64, y: f64, z: f64, w: f64| { + let output: Val = DVec4::new(x, y, z, w).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f64| { + let output: Val = DVec4::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = DVec4::select( + mask, + if_true, + if_false, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 4]| { + let output: Val = DVec4::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 4] = DVec4::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = DVec4::truncate(_self).into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f64| { + let output: Val = DVec4::with_x(_self, x).into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f64| { + let output: Val = DVec4::with_y(_self, y).into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f64| { + let output: Val = DVec4::with_z(_self, z).into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: f64| { + let output: Val = DVec4::with_w(_self, w).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = DVec4::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = DVec4::dot_into_vec(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = DVec4::min(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = DVec4::max(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = DVec4::clamp(_self, min, max) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f64 = DVec4::min_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f64 = DVec4::max_element(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f64 = DVec4::element_sum(_self).into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f64 = DVec4::element_product(_self).into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = DVec4::cmpeq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = DVec4::cmpne(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = DVec4::cmpge(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = DVec4::cmpgt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = DVec4::cmple(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = DVec4::cmplt(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = DVec4::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = DVec4::signum(_self).into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = DVec4::copysign(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = DVec4::is_negative_bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = DVec4::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = DVec4::is_finite_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = DVec4::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = DVec4::is_nan_mask(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = DVec4::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = DVec4::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = DVec4::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f64 = DVec4::distance(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f64 = DVec4::distance_squared(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = DVec4::div_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = DVec4::rem_euclid(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = DVec4::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = DVec4::normalize_or( + _self, + fallback, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = DVec4::normalize_or_zero(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = DVec4::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = DVec4::project_onto(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = DVec4::reject_from(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = DVec4::project_onto_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = DVec4::reject_from_normalized( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = DVec4::round(_self).into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = DVec4::floor(_self).into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = DVec4::ceil(_self).into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = DVec4::trunc(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = DVec4::fract(_self).into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = DVec4::fract_gl(_self).into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = DVec4::exp(_self).into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f64| { + let output: Val = DVec4::powf(_self, n).into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = DVec4::recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f64| { + let output: Val = DVec4::lerp(_self, rhs, s) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f64| { + let output: Val = DVec4::move_towards( + _self, + rhs, + d, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = DVec4::midpoint(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DVec4::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f64, max: f64| { + let output: Val = DVec4::clamp_length( + _self, + min, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f64| { + let output: Val = DVec4::clamp_length_max( + _self, + max, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f64| { + let output: Val = DVec4::clamp_length_min( + _self, + min, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = DVec4::mul_add(_self, a, b) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = DVec4::reflect(_self, normal) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f64| + { + let output: Val = DVec4::refract( + _self, + normal, + eta, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = DVec4::as_vec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = DVec4::as_ivec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = DVec4::as_uvec4(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = DVec4::as_i64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = DVec4::as_u64vec4(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = DVec4::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = DVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = DVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = DVec4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = DVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = DVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DVec4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = DVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = DVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DVec4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = DVec4::rem(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = DVec4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DVec4::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Mat2::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Mat2::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Mat2::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Mat2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + |x_axis: Val, y_axis: Val| { + let output: Val = Mat2::from_cols(x_axis, y_axis) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 4] = Mat2::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 2]; 2] = Mat2::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = Mat2::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle", + |scale: Val, angle: f32| { + let output: Val = Mat2::from_scale_angle( + scale, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = Mat2::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = Mat2::from_mat3(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_minor", + |m: Val, i: usize, j: usize| { + let output: Val = Mat2::from_mat3_minor(m, i, j) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |m: Val| { + let output: Val = Mat2::from_mat3a(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a_minor", + |m: Val, i: usize, j: usize| { + let output: Val = Mat2::from_mat3a_minor(m, i, j) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = Mat2::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = Mat2::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Mat2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = Mat2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = Mat2::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = Mat2::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Mat2::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul_vec2", + |_self: Ref, rhs: Val| { + let output: Val = Mat2::mul_vec2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = Mat2::mul_mat2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = Mat2::add_mat2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = Mat2::sub_mat2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat2::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat2::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Mat2::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = Mat2::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dmat2", + |_self: Ref| { + let output: Val = Mat2::as_dmat2(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Mat2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Mat2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Mat2::add(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Mat3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Mat3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Mat3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = Mat3::from_cols( + x_axis, + y_axis, + z_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 9] = Mat3::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 3]; 3] = Mat3::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = Mat3::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = Mat3::from_mat4(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat4_minor", + |m: Val, i: usize, j: usize| { + let output: Val = Mat3::from_mat4_minor(m, i, j) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = Mat3::from_quat(rotation).into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = Mat3::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f32, b: f32, c: f32| { + let output: Val = Mat3::from_euler(order, a, b, c) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f32, f32, f32) = Mat3::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = Mat3::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = Mat3::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = Mat3::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = Mat3::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = Mat3::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f32, + translation: Val| + { + let output: Val = Mat3::from_scale_angle_translation( + scale, + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = Mat3::from_scale(scale).into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |m: Val| { + let output: Val = Mat3::from_mat2(m).into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = Mat3::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = Mat3::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Mat3::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = Mat3::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = Mat3::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = Mat3::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Mat3::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = Mat3::transform_point2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = Mat3::transform_vector2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Ref, rhs: Val| { + let output: Val = Mat3::mul_vec3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3a", + |_self: Ref, rhs: Val| { + let output: Val = Mat3::mul_vec3a(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = Mat3::mul_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = Mat3::add_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = Mat3::sub_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat3::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat3::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Mat3::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = Mat3::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dmat3", + |_self: Ref| { + let output: Val = Mat3::as_dmat3(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Mat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Mat3::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Mat3::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Mat3::sub(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Mat3A::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Mat3A::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Mat3A::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Mat3A::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Mat3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Mat3A::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat3A::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Mat3A::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = Mat3A::from_cols( + x_axis, + y_axis, + z_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 9] = Mat3A::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 3]; 3] = Mat3A::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = Mat3A::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = Mat3A::from_mat4(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat4_minor", + |m: Val, i: usize, j: usize| { + let output: Val = Mat3A::from_mat4_minor(m, i, j) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = Mat3A::from_quat(rotation) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = Mat3A::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f32, b: f32, c: f32| { + let output: Val = Mat3A::from_euler( + order, + a, + b, + c, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f32, f32, f32) = Mat3A::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = Mat3A::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = Mat3A::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = Mat3A::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = Mat3A::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = Mat3A::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f32, + translation: Val| + { + let output: Val = Mat3A::from_scale_angle_translation( + scale, + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = Mat3A::from_scale(scale).into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |m: Val| { + let output: Val = Mat3A::from_mat2(m).into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = Mat3A::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = Mat3A::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Mat3A::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = Mat3A::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = Mat3A::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = Mat3A::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Mat3A::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = Mat3A::transform_point2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = Mat3A::transform_vector2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Ref, rhs: Val| { + let output: Val = Mat3A::mul_vec3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3a", + |_self: Ref, rhs: Val| { + let output: Val = Mat3A::mul_vec3a(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = Mat3A::mul_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = Mat3A::add_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = Mat3A::sub_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat3A::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat3A::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Mat3A::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = Mat3A::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dmat3", + |_self: Ref| { + let output: Val = Mat3A::as_dmat3(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = Mat4::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Mat4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = Mat4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = Mat4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Mat4::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = Mat4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = Mat4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = Mat4::from_cols( + x_axis, + y_axis, + z_axis, + w_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 16] = Mat4::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 4]; 4] = Mat4::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = Mat4::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = Mat4::from_scale_rotation_translation( + scale, + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = Mat4::from_rotation_translation( + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = Mat4::from_quat(rotation).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = Mat4::from_mat3(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |m: Val| { + let output: Val = Mat4::from_mat3a(m).into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = Mat4::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = Mat4::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f32, b: f32, c: f32| { + let output: Val = Mat4::from_euler(order, a, b, c) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f32, f32, f32) = Mat4::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = Mat4::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = Mat4::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = Mat4::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = Mat4::from_scale(scale).into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = Mat4::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = Mat4::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Mat4::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = Mat4::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = Mat4::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = Mat4::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Mat4::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = Mat4::look_to_lh(eye, dir, up) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = Mat4::look_to_rh(eye, dir, up) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = Mat4::look_at_lh(eye, center, up) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = Mat4::look_at_rh(eye, center, up) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh_gl", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { + let output: Val = Mat4::perspective_rh_gl( + fov_y_radians, + aspect_ratio, + z_near, + z_far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_lh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { + let output: Val = Mat4::perspective_lh( + fov_y_radians, + aspect_ratio, + z_near, + z_far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { + let output: Val = Mat4::perspective_rh( + fov_y_radians, + aspect_ratio, + z_near, + z_far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_lh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = Mat4::perspective_infinite_lh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_lh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = Mat4::perspective_infinite_reverse_lh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_rh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = Mat4::perspective_infinite_rh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_rh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = Mat4::perspective_infinite_reverse_rh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh_gl", + |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { + let output: Val = Mat4::orthographic_rh_gl( + left, + right, + bottom, + top, + near, + far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_lh", + |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { + let output: Val = Mat4::orthographic_lh( + left, + right, + bottom, + top, + near, + far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh", + |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { + let output: Val = Mat4::orthographic_rh( + left, + right, + bottom, + top, + near, + far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_point3", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::project_point3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::transform_point3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::transform_vector3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_point3a", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::project_point3a( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3a", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::transform_point3a( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3a", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::transform_vector3a( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec4", + |_self: Ref, rhs: Val| { + let output: Val = Mat4::mul_vec4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = Mat4::mul_mat4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = Mat4::add_mat4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = Mat4::sub_mat4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat4::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = Mat4::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Mat4::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = Mat4::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_dmat4", + |_self: Ref| { + let output: Val = Mat4::as_dmat4(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Mat4::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = DMat2::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DMat2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DMat2::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DMat2::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DMat2::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + |x_axis: Val, y_axis: Val| { + let output: Val = DMat2::from_cols(x_axis, y_axis) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 4] = DMat2::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 2]; 2] = DMat2::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = DMat2::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle", + |scale: Val, angle: f64| { + let output: Val = DMat2::from_scale_angle( + scale, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = DMat2::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = DMat2::from_mat3(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_minor", + |m: Val, i: usize, j: usize| { + let output: Val = DMat2::from_mat3_minor(m, i, j) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = DMat2::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = DMat2::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = DMat2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = DMat2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = DMat2::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f64 = DMat2::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = DMat2::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul_vec2", + |_self: Ref, rhs: Val| { + let output: Val = DMat2::mul_vec2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = DMat2::mul_mat2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = DMat2::add_mat2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = DMat2::sub_mat2(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = DMat2::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = DMat2::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DMat2::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = DMat2::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_mat2", + |_self: Ref| { + let output: Val = DMat2::as_mat2(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DMat2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DMat2::div(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DMat3::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = DMat3::from_cols( + x_axis, + y_axis, + z_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 9] = DMat3::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 3]; 3] = DMat3::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = DMat3::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = DMat3::from_mat4(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat4_minor", + |m: Val, i: usize, j: usize| { + let output: Val = DMat3::from_mat4_minor(m, i, j) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = DMat3::from_quat(rotation) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = DMat3::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f64, b: f64, c: f64| { + let output: Val = DMat3::from_euler( + order, + a, + b, + c, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f64, f64, f64) = DMat3::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = DMat3::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = DMat3::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = DMat3::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = DMat3::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = DMat3::from_angle(angle).into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f64, + translation: Val| + { + let output: Val = DMat3::from_scale_angle_translation( + scale, + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = DMat3::from_scale(scale).into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |m: Val| { + let output: Val = DMat3::from_mat2(m).into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = DMat3::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = DMat3::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = DMat3::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = DMat3::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = DMat3::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f64 = DMat3::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = DMat3::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = DMat3::transform_point2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = DMat3::transform_vector2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Ref, rhs: Val| { + let output: Val = DMat3::mul_vec3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = DMat3::mul_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = DMat3::add_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = DMat3::sub_mat3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = DMat3::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = DMat3::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DMat3::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = DMat3::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_mat3", + |_self: Ref| { + let output: Val = DMat3::as_mat3(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = DMat3::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DMat3::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DMat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DMat3::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DMat3::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat3::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DMat3::div(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = DMat4::from_cols( + x_axis, + y_axis, + z_axis, + w_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 16] = DMat4::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 4]; 4] = DMat4::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = DMat4::from_diagonal(diagonal) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = DMat4::from_scale_rotation_translation( + scale, + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = DMat4::from_rotation_translation( + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = DMat4::from_quat(rotation) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = DMat4::from_mat3(m).into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = DMat4::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = DMat4::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f64, b: f64, c: f64| { + let output: Val = DMat4::from_euler( + order, + a, + b, + c, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f64, f64, f64) = DMat4::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = DMat4::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = DMat4::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = DMat4::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = DMat4::from_scale(scale).into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = DMat4::col(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = DMat4::row(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = DMat4::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = DMat4::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = DMat4::transpose(_self).into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f64 = DMat4::determinant(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = DMat4::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = DMat4::look_to_lh(eye, dir, up) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = DMat4::look_to_rh(eye, dir, up) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = DMat4::look_at_lh( + eye, + center, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = DMat4::look_at_rh( + eye, + center, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh_gl", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { + let output: Val = DMat4::perspective_rh_gl( + fov_y_radians, + aspect_ratio, + z_near, + z_far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_lh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { + let output: Val = DMat4::perspective_lh( + fov_y_radians, + aspect_ratio, + z_near, + z_far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { + let output: Val = DMat4::perspective_rh( + fov_y_radians, + aspect_ratio, + z_near, + z_far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_lh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = DMat4::perspective_infinite_lh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_lh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = DMat4::perspective_infinite_reverse_lh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_rh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = DMat4::perspective_infinite_rh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_rh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = DMat4::perspective_infinite_reverse_rh( + fov_y_radians, + aspect_ratio, + z_near, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh_gl", + |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { + let output: Val = DMat4::orthographic_rh_gl( + left, + right, + bottom, + top, + near, + far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_lh", + |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { + let output: Val = DMat4::orthographic_lh( + left, + right, + bottom, + top, + near, + far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh", + |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { + let output: Val = DMat4::orthographic_rh( + left, + right, + bottom, + top, + near, + far, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_point3", + |_self: Ref, rhs: Val| { + let output: Val = DMat4::project_point3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = DMat4::transform_point3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = DMat4::transform_vector3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec4", + |_self: Ref, rhs: Val| { + let output: Val = DMat4::mul_vec4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = DMat4::mul_mat4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = DMat4::add_mat4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = DMat4::sub_mat4(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = DMat4::mul_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = DMat4::div_scalar(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DMat4::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = DMat4::abs(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_mat4", + |_self: Ref| { + let output: Val = DMat4::as_mat4(_self).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DMat4::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DMat4::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DMat4::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DMat4::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = DMat4::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DMat4::add(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DMat4::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DMat4::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Affine2::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Affine2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Affine2::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = Affine2::from_cols( + x_axis, + y_axis, + z_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 6] = Affine2::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 2]; 3] = Affine2::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = Affine2::from_scale(scale) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = Affine2::from_angle(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = Affine2::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |matrix2: Val| { + let output: Val = Affine2::from_mat2(matrix2) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2_translation", + |matrix2: Val, translation: Val| { + let output: Val = Affine2::from_mat2_translation( + matrix2, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f32, + translation: Val| + { + let output: Val = Affine2::from_scale_angle_translation( + scale, + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle_translation", + |angle: f32, translation: Val| { + let output: Val = Affine2::from_angle_translation( + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = Affine2::from_mat3(m).into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |m: Val| { + let output: Val = Affine2::from_mat3a(m).into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = Affine2::transform_point2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = Affine2::transform_vector2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Affine2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = Affine2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Affine2::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Affine2::inverse(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Affine2::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Affine2::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = Affine3A::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Affine3A::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = Affine3A::from_cols( + x_axis, + y_axis, + z_axis, + w_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 12] = Affine3A::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 3]; 4] = Affine3A::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = Affine3A::from_scale(scale) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = Affine3A::from_quat(rotation) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = Affine3A::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = Affine3A::from_rotation_x( + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = Affine3A::from_rotation_y( + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = Affine3A::from_rotation_z( + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = Affine3A::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat3: Val| { + let output: Val = Affine3A::from_mat3(mat3) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_translation", + |mat3: Val, translation: Val| { + let output: Val = Affine3A::from_mat3_translation( + mat3, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = Affine3A::from_scale_rotation_translation( + scale, + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = Affine3A::from_rotation_translation( + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = Affine3A::from_mat4(m) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = Affine3A::look_to_lh( + eye, + dir, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = Affine3A::look_to_rh( + eye, + dir, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = Affine3A::look_at_lh( + eye, + center, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = Affine3A::look_at_rh( + eye, + center, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = Affine3A::transform_point3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = Affine3A::transform_vector3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3a", + |_self: Ref, rhs: Val| { + let output: Val = Affine3A::transform_point3a( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3a", + |_self: Ref, rhs: Val| { + let output: Val = Affine3A::transform_vector3a( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Affine3A::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = Affine3A::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = Affine3A::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = Affine3A::inverse(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Affine3A::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = Affine3A::mul(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = DAffine2::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = DAffine2::from_cols( + x_axis, + y_axis, + z_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 6] = DAffine2::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 2]; 3] = DAffine2::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = DAffine2::from_scale(scale) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = DAffine2::from_angle(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = DAffine2::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |matrix2: Val| { + let output: Val = DAffine2::from_mat2(matrix2) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2_translation", + |matrix2: Val, translation: Val| { + let output: Val = DAffine2::from_mat2_translation( + matrix2, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f64, + translation: Val| + { + let output: Val = DAffine2::from_scale_angle_translation( + scale, + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle_translation", + |angle: f64, translation: Val| { + let output: Val = DAffine2::from_angle_translation( + angle, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = DAffine2::from_mat3(m) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = DAffine2::transform_point2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = DAffine2::transform_vector2( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = DAffine2::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = DAffine2::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DAffine2::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = DAffine2::inverse(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DAffine2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DAffine2::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DAffine2::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = DAffine3::from_cols( + x_axis, + y_axis, + z_axis, + w_axis, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 12] = DAffine3::to_cols_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 3]; 4] = DAffine3::to_cols_array_2d(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = DAffine3::from_scale(scale) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = DAffine3::from_quat(rotation) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = DAffine3::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = DAffine3::from_rotation_x( + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = DAffine3::from_rotation_y( + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = DAffine3::from_rotation_z( + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = DAffine3::from_translation( + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat3: Val| { + let output: Val = DAffine3::from_mat3(mat3) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_translation", + |mat3: Val, translation: Val| { + let output: Val = DAffine3::from_mat3_translation( + mat3, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = DAffine3::from_scale_rotation_translation( + scale, + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = DAffine3::from_rotation_translation( + rotation, + translation, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = DAffine3::from_mat4(m) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = DAffine3::look_to_lh( + eye, + dir, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = DAffine3::look_to_rh( + eye, + dir, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = DAffine3::look_at_lh( + eye, + center, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = DAffine3::look_at_rh( + eye, + center, + up, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = DAffine3::transform_point3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = DAffine3::transform_vector3( + _self, + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = DAffine3::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = DAffine3::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DAffine3::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = DAffine3::inverse(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = DAffine3::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DAffine3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DAffine3::mul(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DAffine3::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = DQuat::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = DQuat::div(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "from_xyzw", + |x: f64, y: f64, z: f64, w: f64| { + let output: Val = DQuat::from_xyzw(x, y, z, w) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 4]| { + let output: Val = DQuat::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "from_vec4", + |v: Val| { + let output: Val = DQuat::from_vec4(v).into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = DQuat::from_axis_angle( + axis, + angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scaled_axis", + |v: Val| { + let output: Val = DQuat::from_scaled_axis(v) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = DQuat::from_rotation_x(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = DQuat::from_rotation_y(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = DQuat::from_rotation_z(angle) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |euler: Val, a: f64, b: f64, c: f64| { + let output: Val = DQuat::from_euler( + euler, + a, + b, + c, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat: Ref| { + let output: Val = DQuat::from_mat3(mat).into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |mat: Ref| { + let output: Val = DQuat::from_mat4(mat).into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc", + |from: Val, to: Val| { + let output: Val = DQuat::from_rotation_arc( + from, + to, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_colinear", + |from: Val, to: Val| { + let output: Val = DQuat::from_rotation_arc_colinear( + from, + to, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_2d", + |from: Val, to: Val| { + let output: Val = DQuat::from_rotation_arc_2d( + from, + to, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_scaled_axis", + |_self: Val| { + let output: Val = DQuat::to_scaled_axis(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Val, order: Val| { + let output: (f64, f64, f64) = DQuat::to_euler(_self, order).into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 4] = DQuat::to_array(_self).into(); + output + }, + ) + .overwrite_script_function( + "xyz", + |_self: Val| { + let output: Val = DQuat::xyz(_self).into(); + output + }, + ) + .overwrite_script_function( + "conjugate", + |_self: Val| { + let output: Val = DQuat::conjugate(_self).into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Val| { + let output: Val = DQuat::inverse(_self).into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = DQuat::dot(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = DQuat::length(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = DQuat::length_squared(_self).into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = DQuat::length_recip(_self).into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = DQuat::normalize(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = DQuat::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = DQuat::is_nan(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = DQuat::is_normalized(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_near_identity", + |_self: Val| { + let output: bool = DQuat::is_near_identity(_self).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f64 = DQuat::angle_between(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f64| + { + let output: Val = DQuat::rotate_towards( + _self, + rhs, + max_angle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = DQuat::abs_diff_eq(_self, rhs, max_abs_diff) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, end: Val, s: f64| { + let output: Val = DQuat::lerp(_self, end, s) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + |_self: Val, end: Val, s: f64| { + let output: Val = DQuat::slerp(_self, end, s) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Val, rhs: Val| { + let output: Val = DQuat::mul_vec3(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_quat", + |_self: Val, rhs: Val| { + let output: Val = DQuat::mul_quat(_self, rhs) + .into(); + output + }, + ) + .overwrite_script_function( + "from_affine3", + |a: Ref| { + let output: Val = DQuat::from_affine3(a).into(); + output + }, + ) + .overwrite_script_function( + "as_quat", + |_self: Val| { + let output: Val = DQuat::as_quat(_self).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DQuat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = DQuat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = DQuat::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = DQuat::sub(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = DQuat::mul(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = DQuat::neg(_self).into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = DQuat::add(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = EulerRot::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = EulerRot::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = EulerRot::assert_receiver_is_total_eq(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool| { + let output: Val = BVec3A::new(x, y, z).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = BVec3A::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 3]| { + let output: Val = BVec3A::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = BVec3A::bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = BVec3A::any(_self).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = BVec3A::all(_self).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = BVec3A::test(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = BVec3A::set(_self, index, value).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BVec3A::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = BVec3A::eq(_self, rhs).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool, w: bool| { + let output: Val = BVec4A::new(x, y, z, w).into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = BVec4A::splat(v).into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 4]| { + let output: Val = BVec4A::from_array(a).into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = BVec4A::bitmask(_self).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = BVec4A::any(_self).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = BVec4A::all(_self).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = BVec4A::test(_self, index).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = BVec4A::set(_self, index, value).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = BVec4A::eq(_self, rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = BVec4A::clone(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = SmolStr::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = SmolStr::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "to_string", + |_self: Ref| { + let output: std::string::String = SmolStr::to_string(_self).into(); + output + }, + ) + .overwrite_script_function( + "len", + |_self: Ref| { + let output: usize = SmolStr::len(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = SmolStr::is_empty(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_heap_allocated", + |_self: Ref| { + let output: bool = SmolStr::is_heap_allocated(_self).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "get_version_num", + |_self: Ref| { + let output: usize = Uuid::get_version_num(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_u128", + |_self: Ref| { + let output: u128 = Uuid::as_u128(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_u128_le", + |_self: Ref| { + let output: u128 = Uuid::to_u128_le(_self).into(); + output + }, + ) + .overwrite_script_function( + "as_u64_pair", + |_self: Ref| { + let output: (u64, u64) = Uuid::as_u64_pair(_self).into(); + output + }, + ) + .overwrite_script_function( + "into_bytes", + |_self: Val| { + let output: [u8; 16] = Uuid::into_bytes(_self).into(); + output + }, + ) + .overwrite_script_function( + "to_bytes_le", + |_self: Ref| { + let output: [u8; 16] = Uuid::to_bytes_le(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_nil", + |_self: Ref| { + let output: bool = Uuid::is_nil(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_max", + |_self: Ref| { + let output: bool = Uuid::is_max(_self).into(); + output + }, + ) + .overwrite_script_function( + "encode_buffer", + || { + let output: [u8; 45] = Uuid::encode_buffer().into(); + output + }, + ) + .overwrite_script_function( + "get_node_id", + |_self: Ref| { + let output: bevy::reflect::erased_serde::__private::serde::__private::Option< + [u8; 6], + > = Uuid::get_node_id(_self).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Uuid::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "nil", + || { + let output: Val = Uuid::nil().into(); + output + }, + ) + .overwrite_script_function( + "max", + || { + let output: Val = Uuid::max().into(); + output + }, + ) + .overwrite_script_function( + "from_u128", + |v: u128| { + let output: Val = Uuid::from_u128(v).into(); + output + }, + ) + .overwrite_script_function( + "from_u128_le", + |v: u128| { + let output: Val = Uuid::from_u128_le(v).into(); + output + }, + ) + .overwrite_script_function( + "from_u64_pair", + |high_bits: u64, low_bits: u64| { + let output: Val = Uuid::from_u64_pair( + high_bits, + low_bits, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_bytes", + |bytes: [u8; 16]| { + let output: Val = Uuid::from_bytes(bytes).into(); + output + }, + ) + .overwrite_script_function( + "from_bytes_le", + |b: [u8; 16]| { + let output: Val = Uuid::from_bytes_le(b).into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Uuid::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Uuid::clone(_self).into(); + output + }, + ) + .overwrite_script_function( + "new_v4", + || { + let output: Val = Uuid::new_v4().into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs new file mode 100644 index 0000000000..b310c16014 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs @@ -0,0 +1,285 @@ +// @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::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyTimeScriptingPlugin; +impl bevy::app::Plugin for BevyTimeScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Fixed::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Real::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Timer::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Timer::assert_receiver_is_total_eq(_self).into(); + output + }, + ) + .overwrite_script_function( + "from_seconds", + |duration: f32, mode: Val| { + let output: Val = Timer::from_seconds( + duration, + mode, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "finished", + |_self: Ref| { + let output: bool = Timer::finished(_self).into(); + output + }, + ) + .overwrite_script_function( + "just_finished", + |_self: Ref| { + let output: bool = Timer::just_finished(_self).into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs", + |_self: Ref| { + let output: f32 = Timer::elapsed_secs(_self).into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs_f64", + |_self: Ref| { + let output: f64 = Timer::elapsed_secs_f64(_self).into(); + output + }, + ) + .overwrite_script_function( + "mode", + |_self: Ref| { + let output: Val = Timer::mode(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "set_mode", + | + _self: Mut, + mode: Val| + { + let output: () = Timer::set_mode(_self, mode).into(); + output + }, + ) + .overwrite_script_function( + "pause", + |_self: Mut| { + let output: () = Timer::pause(_self).into(); + output + }, + ) + .overwrite_script_function( + "unpause", + |_self: Mut| { + let output: () = Timer::unpause(_self).into(); + output + }, + ) + .overwrite_script_function( + "paused", + |_self: Ref| { + let output: bool = Timer::paused(_self).into(); + output + }, + ) + .overwrite_script_function( + "reset", + |_self: Mut| { + let output: () = Timer::reset(_self).into(); + output + }, + ) + .overwrite_script_function( + "fraction", + |_self: Ref| { + let output: f32 = Timer::fraction(_self).into(); + output + }, + ) + .overwrite_script_function( + "fraction_remaining", + |_self: Ref| { + let output: f32 = Timer::fraction_remaining(_self).into(); + output + }, + ) + .overwrite_script_function( + "remaining_secs", + |_self: Ref| { + let output: f32 = Timer::remaining_secs(_self).into(); + output + }, + ) + .overwrite_script_function( + "times_finished_this_tick", + |_self: Ref| { + let output: u32 = Timer::times_finished_this_tick(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Timer::eq(_self, other).into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = TimerMode::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = TimerMode::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = TimerMode::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Virtual::clone(_self) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "new", + || { + let output: Val = Stopwatch::new().into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs", + |_self: Ref| { + let output: f32 = Stopwatch::elapsed_secs(_self).into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs_f64", + |_self: Ref| { + let output: f64 = Stopwatch::elapsed_secs_f64(_self).into(); + output + }, + ) + .overwrite_script_function( + "pause", + |_self: Mut| { + let output: () = Stopwatch::pause(_self).into(); + output + }, + ) + .overwrite_script_function( + "unpause", + |_self: Mut| { + let output: () = Stopwatch::unpause(_self).into(); + output + }, + ) + .overwrite_script_function( + "is_paused", + |_self: Ref| { + let output: bool = Stopwatch::is_paused(_self).into(); + output + }, + ) + .overwrite_script_function( + "reset", + |_self: Mut| { + let output: () = Stopwatch::reset(_self).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = Stopwatch::assert_receiver_is_total_eq(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Stopwatch::clone(_self) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = Stopwatch::eq(_self, other).into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs new file mode 100644 index 0000000000..32fa0c402c --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs @@ -0,0 +1,243 @@ +// @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::*; +use super::bevy_core::*; +use super::bevy_math::*; +use super::bevy_hierarchy::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, bindings::ReflectReference, +}; +use bevy_mod_scripting_functions::RegisterScriptFunction; +use crate::*; +pub struct BevyTransformScriptingPlugin; +impl bevy::app::Plugin for BevyTransformScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = GlobalTransform::clone( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + global_transform: Val| + { + let output: Val = GlobalTransform::mul( + _self, + global_transform, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + transform: Val| + { + let output: Val = GlobalTransform::mul( + _self, + transform, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = GlobalTransform::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "from_xyz", + |x: f32, y: f32, z: f32| { + let output: Val = GlobalTransform::from_xyz( + x, + y, + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "compute_transform", + |_self: Ref| { + let output: Val = GlobalTransform::compute_transform( + _self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reparented_to", + | + _self: Ref, + parent: Ref| + { + let output: Val = GlobalTransform::reparented_to( + _self, + parent, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_transform", + | + _self: Ref, + transform: Val| + { + let output: Val = GlobalTransform::mul_transform( + _self, + transform, + ) + .into(); + output + }, + ); + NamespaceBuilder::::new(world) + .overwrite_script_function( + "from_xyz", + |x: f32, y: f32, z: f32| { + let output: Val = Transform::from_xyz( + x, + y, + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_x", + |_self: Mut, angle: f32| { + let output: () = Transform::rotate_x(_self, angle).into(); + output + }, + ) + .overwrite_script_function( + "rotate_y", + |_self: Mut, angle: f32| { + let output: () = Transform::rotate_y(_self, angle).into(); + output + }, + ) + .overwrite_script_function( + "rotate_z", + |_self: Mut, angle: f32| { + let output: () = Transform::rotate_z(_self, angle).into(); + output + }, + ) + .overwrite_script_function( + "rotate_local_x", + |_self: Mut, angle: f32| { + let output: () = Transform::rotate_local_x(_self, angle).into(); + output + }, + ) + .overwrite_script_function( + "rotate_local_y", + |_self: Mut, angle: f32| { + let output: () = Transform::rotate_local_y(_self, angle).into(); + output + }, + ) + .overwrite_script_function( + "rotate_local_z", + |_self: Mut, angle: f32| { + let output: () = Transform::rotate_local_z(_self, angle).into(); + output + }, + ) + .overwrite_script_function( + "mul_transform", + | + _self: Ref, + transform: Val| + { + let output: Val = Transform::mul_transform( + _self, + transform, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = Transform::is_finite(_self).into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = Transform::eq(_self, other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + transform: Val| + { + let output: Val = Transform::mul( + _self, + transform, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + global_transform: Val| + { + let output: Val = Transform::mul( + _self, + global_transform, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = Transform::clone( + _self, + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/mod.rs b/crates/bevy_mod_scripting_functions/src/bevy/mod.rs new file mode 100644 index 0000000000..94eef83506 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy/mod.rs @@ -0,0 +1,25 @@ +// @generated by cargo bevy-api-gen collect, modify the templates not this file +#![allow(clippy::all)] +#![allow(unused, deprecated, dead_code)] +#![cfg_attr(rustfmt, rustfmt_skip)] +pub mod bevy_reflect; +pub mod bevy_math; +pub mod bevy_input; +pub mod bevy_transform; +pub mod bevy_core; +pub mod bevy_hierarchy; +pub mod bevy_ecs; +pub mod bevy_time; +pub struct LuaBevyScriptingPlugin; +impl bevy::app::Plugin for LuaBevyScriptingPlugin { + fn build(&self, app: &mut bevy::prelude::App) { + bevy_reflect::BevyReflectScriptingPlugin.build(app); + bevy_math::BevyMathScriptingPlugin.build(app); + bevy_input::BevyInputScriptingPlugin.build(app); + bevy_transform::BevyTransformScriptingPlugin.build(app); + bevy_core::BevyCoreScriptingPlugin.build(app); + bevy_hierarchy::BevyHierarchyScriptingPlugin.build(app); + bevy_ecs::BevyEcsScriptingPlugin.build(app); + bevy_time::BevyTimeScriptingPlugin.build(app); + } +} From 4d92a587494b702268657ae8f4e5a021d2d6499e Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 00:42:13 +0000 Subject: [PATCH 091/217] fix small issues --- crates/bevy_api_gen/templates/footer.tera | 4 ++-- crates/bevy_api_gen/templates/header.tera | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index a7d06da62d..21131852b6 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -12,7 +12,7 @@ impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_cas let mut world = app.world_mut(); {% for item in items %} - NamespaceBuilder::<{{ item.ident }}>::new(world) + NamespaceBuilder::<{{ item.import_path }}>::new(world) {%- for function in item.functions -%} .overwrite_script_function("{{ function.ident }}", | {%- for arg in function.args -%} @@ -24,7 +24,7 @@ impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_cas : {{- arg.proxy_ty -}}, {%- endfor -%} | { - let output: {{ function.output.proxy_ty }} = {{ item.ident }}::{{ function.ident }}( + let output: {{ function.output.proxy_ty }} = {{ item.import_path }}::{{ function.ident }}( {%- for arg in function.args -%} {%- if arg.ident != "self" -%} {{- arg.ident -}} diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index 9d7674d1ec..4afba72e84 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -9,7 +9,14 @@ use super::{{crate}}::*; {% endfor %} -use bevy_mod_scripting_core::{AddContextInitializer, StoreDocumentation, bindings::ReflectReference}; +use bevy_mod_scripting_core::{ + AddContextInitializer, + StoreDocumentation, + bindings::{ + ReflectReference, + function::from::{Ref, Mut, Val} + } +}; use bevy_mod_scripting_functions::RegisterScriptFunction; {% if args.self_is_bms_lua %} From 675ae8059c889f11f6b2e79d181444b85ead7581 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 00:47:35 +0000 Subject: [PATCH 092/217] chore(codegen): update bevy bindings (#171) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy/bevy_core.rs | 12 +- .../src/bevy/bevy_ecs.rs | 136 +- .../src/bevy/bevy_hierarchy.rs | 33 +- .../src/bevy/bevy_input.rs | 547 +- .../src/bevy/bevy_math.rs | 1110 ++- .../src/bevy/bevy_reflect.rs | 8269 ++++++++++++----- .../src/bevy/bevy_time.rs | 118 +- .../src/bevy/bevy_transform.rs | 84 +- 8 files changed, 7484 insertions(+), 2825 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs index 8a6dbf6656..a1dca75e81 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs @@ -5,7 +5,8 @@ use super::bevy_ecs::*; use super::bevy_reflect::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -13,21 +14,24 @@ pub struct BevyCoreScriptingPlugin; impl bevy::app::Plugin for BevyCoreScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Name::eq(_self, other).into(); + let output: bool = bevy::core::prelude::Name::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Name::clone(_self) + let output: Val = bevy::core::prelude::Name::clone( + _self, + ) .into(); output }, diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs index 18232a843b..d011cc0da4 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs @@ -4,7 +4,8 @@ #![cfg_attr(rustfmt, rustfmt_skip)] use super::bevy_reflect::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -12,11 +13,13 @@ pub struct BevyEcsScriptingPlugin; impl bevy::app::Plugin for BevyEcsScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_raw", |index: u32| { - let output: Val = Entity::from_raw(index) + let output: Val = bevy::ecs::entity::Entity::from_raw( + index, + ) .into(); output }, @@ -24,14 +27,16 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = Entity::to_bits(_self).into(); + let output: u64 = bevy::ecs::entity::Entity::to_bits(_self).into(); output }, ) .overwrite_script_function( "from_bits", |bits: u64| { - let output: Val = Entity::from_bits(bits) + let output: Val = bevy::ecs::entity::Entity::from_bits( + bits, + ) .into(); output }, @@ -39,14 +44,15 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: u32 = Entity::index(_self).into(); + let output: u32 = bevy::ecs::entity::Entity::index(_self).into(); output }, ) .overwrite_script_function( "generation", |_self: Val| { - let output: u32 = Entity::generation(_self).into(); + let output: u32 = bevy::ecs::entity::Entity::generation(_self) + .into(); output }, ) @@ -56,37 +62,44 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Entity::eq(_self, other).into(); + let output: bool = bevy::ecs::entity::Entity::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Entity::clone(_self) + let output: Val = bevy::ecs::entity::Entity::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ComponentId::eq(_self, other).into(); + let output: bool = bevy::ecs::component::ComponentId::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ComponentId::clone( + let output: Val = bevy::ecs::component::ComponentId::clone( _self, ) .into(); @@ -96,7 +109,7 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |index: usize| { - let output: Val = ComponentId::new( + let output: Val = bevy::ecs::component::ComponentId::new( index, ) .into(); @@ -106,23 +119,29 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: usize = ComponentId::index(_self).into(); + let output: usize = bevy::ecs::component::ComponentId::index(_self) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ComponentId::assert_receiver_is_total_eq(_self) + let output: () = bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Tick::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::ecs::component::Tick::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) @@ -132,14 +151,17 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Tick::eq(_self, other).into(); + let output: bool = bevy::ecs::component::Tick::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Tick::clone(_self) + let output: Val = bevy::ecs::component::Tick::clone( + _self, + ) .into(); output }, @@ -147,21 +169,24 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |tick: u32| { - let output: Val = Tick::new(tick).into(); + let output: Val = bevy::ecs::component::Tick::new( + tick, + ) + .into(); output }, ) .overwrite_script_function( "get", |_self: Val| { - let output: u32 = Tick::get(_self).into(); + let output: u32 = bevy::ecs::component::Tick::get(_self).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, tick: u32| { - let output: () = Tick::set(_self, tick).into(); + let output: () = bevy::ecs::component::Tick::set(_self, tick).into(); output }, ) @@ -172,16 +197,20 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = Tick::is_newer_than(_self, last_run, this_run) + let output: bool = bevy::ecs::component::Tick::is_newer_than( + _self, + last_run, + this_run, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ComponentTicks::clone( + let output: Val = bevy::ecs::component::ComponentTicks::clone( _self, ) .into(); @@ -195,7 +224,7 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = ComponentTicks::is_added( + let output: bool = bevy::ecs::component::ComponentTicks::is_added( _self, last_run, this_run, @@ -211,7 +240,7 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = ComponentTicks::is_changed( + let output: bool = bevy::ecs::component::ComponentTicks::is_changed( _self, last_run, this_run, @@ -223,7 +252,7 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |change_tick: Val| { - let output: Val = ComponentTicks::new( + let output: Val = bevy::ecs::component::ComponentTicks::new( change_tick, ) .into(); @@ -236,16 +265,19 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Mut, change_tick: Val| { - let output: () = ComponentTicks::set_changed(_self, change_tick) + let output: () = bevy::ecs::component::ComponentTicks::set_changed( + _self, + change_tick, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Identifier::clone( + let output: Val = bevy::ecs::identifier::Identifier::clone( _self, ) .into(); @@ -255,28 +287,33 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "low", |_self: Val| { - let output: u32 = Identifier::low(_self).into(); + let output: u32 = bevy::ecs::identifier::Identifier::low(_self) + .into(); output }, ) .overwrite_script_function( "masked_high", |_self: Val| { - let output: u32 = Identifier::masked_high(_self).into(); + let output: u32 = bevy::ecs::identifier::Identifier::masked_high( + _self, + ) + .into(); output }, ) .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = Identifier::to_bits(_self).into(); + let output: u64 = bevy::ecs::identifier::Identifier::to_bits(_self) + .into(); output }, ) .overwrite_script_function( "from_bits", |value: u64| { - let output: Val = Identifier::from_bits( + let output: Val = bevy::ecs::identifier::Identifier::from_bits( value, ) .into(); @@ -289,31 +326,40 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Identifier::eq(_self, other).into(); + let output: bool = bevy::ecs::identifier::Identifier::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = EntityHash::clone( + let output: Val = bevy::ecs::entity::EntityHash::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::< + bevy::ecs::removal_detection::RemovedComponentEntity, + >::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val< bevy::ecs::removal_detection::RemovedComponentEntity, - > = RemovedComponentEntity::clone(_self).into(); + > = bevy::ecs::removal_detection::RemovedComponentEntity::clone( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world); } } diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs index 7c7e0da299..411831626e 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs @@ -6,7 +6,8 @@ use super::bevy_ecs::*; use super::bevy_reflect::*; use super::bevy_core::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -14,7 +15,7 @@ pub struct BevyHierarchyScriptingPlugin; impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "swap", | @@ -22,15 +23,23 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { a_index: usize, b_index: usize| { - let output: () = Children::swap(_self, a_index, b_index).into(); + let output: () = bevy::hierarchy::prelude::Children::swap( + _self, + a_index, + b_index, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Parent::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) @@ -40,15 +49,16 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Parent::eq(_self, other).into(); + let output: bool = bevy::hierarchy::prelude::Parent::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = HierarchyEvent::clone( + let output: Val = bevy::hierarchy::HierarchyEvent::clone( _self, ) .into(); @@ -61,14 +71,17 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = HierarchyEvent::eq(_self, other).into(); + let output: bool = bevy::hierarchy::HierarchyEvent::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = HierarchyEvent::assert_receiver_is_total_eq(_self) + let output: () = bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( + _self, + ) .into(); output }, diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs index b69275f5a6..2072c0731c 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs @@ -7,7 +7,8 @@ use super::bevy_reflect::*; use super::bevy_core::*; use super::bevy_math::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -15,11 +16,13 @@ pub struct BevyInputScriptingPlugin; impl bevy::app::Plugin for BevyInputScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "vendor_id", |_self: Ref| { - let output: std::option::Option = Gamepad::vendor_id(_self) + let output: std::option::Option = bevy::input::gamepad::Gamepad::vendor_id( + _self, + ) .into(); output }, @@ -27,7 +30,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "product_id", |_self: Ref| { - let output: std::option::Option = Gamepad::product_id(_self) + let output: std::option::Option = bevy::input::gamepad::Gamepad::product_id( + _self, + ) .into(); output }, @@ -38,7 +43,11 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = Gamepad::pressed(_self, button_type).into(); + let output: bool = bevy::input::gamepad::Gamepad::pressed( + _self, + button_type, + ) + .into(); output }, ) @@ -48,7 +57,11 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = Gamepad::just_pressed(_self, button_type).into(); + let output: bool = bevy::input::gamepad::Gamepad::just_pressed( + _self, + button_type, + ) + .into(); output }, ) @@ -58,15 +71,21 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = Gamepad::just_released(_self, button_type).into(); + let output: bool = bevy::input::gamepad::Gamepad::just_released( + _self, + button_type, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = GamepadAxis::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -77,35 +96,43 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadAxis::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadAxis::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadAxis::clone( + let output: Val = bevy::input::gamepad::GamepadAxis::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = GamepadButton::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadButton::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadButton::clone( + let output: Val = bevy::input::gamepad::GamepadButton::clone( _self, ) .into(); @@ -115,37 +142,40 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = GamepadButton::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadSettings::clone( + let output: Val = bevy::input::gamepad::GamepadSettings::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = KeyCode::eq(_self, other).into(); + let output: bool = bevy::input::keyboard::KeyCode::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = KeyCode::clone( + let output: Val = bevy::input::keyboard::KeyCode::clone( _self, ) .into(); @@ -155,15 +185,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = KeyCode::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = MouseButton::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -174,25 +209,26 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = MouseButton::eq(_self, other).into(); + let output: bool = bevy::input::mouse::MouseButton::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = MouseButton::clone( + let output: Val = bevy::input::mouse::MouseButton::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = TouchInput::clone( + let output: Val = bevy::input::touch::TouchInput::clone( _self, ) .into(); @@ -205,15 +241,16 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = TouchInput::eq(_self, other).into(); + let output: bool = bevy::input::touch::TouchInput::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = KeyboardFocusLost::clone( + let output: Val = bevy::input::keyboard::KeyboardFocusLost::clone( _self, ) .into(); @@ -223,7 +260,7 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = KeyboardFocusLost::assert_receiver_is_total_eq( + let output: () = bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( _self, ) .into(); @@ -236,25 +273,33 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = KeyboardFocusLost::eq(_self, other).into(); + let output: bool = bevy::input::keyboard::KeyboardFocusLost::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = KeyboardInput::eq(_self, other).into(); + let output: bool = bevy::input::keyboard::KeyboardInput::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = KeyboardInput::clone( + let output: Val = bevy::input::keyboard::KeyboardInput::clone( _self, ) .into(); @@ -264,37 +309,43 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = KeyboardInput::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = AccumulatedMouseMotion::eq(_self, other).into(); + let output: bool = bevy::input::mouse::AccumulatedMouseMotion::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = AccumulatedMouseMotion::clone( + let output: Val = bevy::input::mouse::AccumulatedMouseMotion::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = AccumulatedMouseScroll::clone( + let output: Val = bevy::input::mouse::AccumulatedMouseScroll::clone( _self, ) .into(); @@ -307,25 +358,33 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = AccumulatedMouseScroll::eq(_self, other).into(); + let output: bool = bevy::input::mouse::AccumulatedMouseScroll::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = MouseButtonInput::eq(_self, other).into(); + let output: bool = bevy::input::mouse::MouseButtonInput::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = MouseButtonInput::clone( + let output: Val = bevy::input::mouse::MouseButtonInput::clone( _self, ) .into(); @@ -335,37 +394,40 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = MouseButtonInput::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = MouseMotion::eq(_self, other).into(); + let output: bool = bevy::input::mouse::MouseMotion::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = MouseMotion::clone( + let output: Val = bevy::input::mouse::MouseMotion::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = MouseWheel::clone( + let output: Val = bevy::input::mouse::MouseWheel::clone( _self, ) .into(); @@ -378,15 +440,16 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = MouseWheel::eq(_self, other).into(); + let output: bool = bevy::input::mouse::MouseWheel::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadAxisChangedEvent::clone( + let output: Val = bevy::input::gamepad::GamepadAxisChangedEvent::clone( _self, ) .into(); @@ -399,15 +462,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadAxisChangedEvent::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadAxisChangedEvent::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadButtonChangedEvent::clone( + let output: Val = bevy::input::gamepad::GamepadButtonChangedEvent::clone( _self, ) .into(); @@ -420,18 +487,26 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadButtonChangedEvent::eq(_self, other) + let output: bool = bevy::input::gamepad::GamepadButtonChangedEvent::eq( + _self, + other, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::< + bevy::input::gamepad::GamepadButtonStateChangedEvent, + >::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val< bevy::input::gamepad::GamepadButtonStateChangedEvent, - > = GamepadButtonStateChangedEvent::clone(_self).into(); + > = bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( + _self, + ) + .into(); output }, ) @@ -441,7 +516,10 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadButtonStateChangedEvent::eq(_self, other) + let output: bool = bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( + _self, + other, + ) .into(); output }, @@ -449,46 +527,55 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( + let output: () = bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = GamepadConnection::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadConnection::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadConnection::clone( + let output: Val = bevy::input::gamepad::GamepadConnection::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "connected", |_self: Ref| { - let output: bool = GamepadConnectionEvent::connected(_self).into(); + let output: bool = bevy::input::gamepad::GamepadConnectionEvent::connected( + _self, + ) + .into(); output }, ) .overwrite_script_function( "disconnected", |_self: Ref| { - let output: bool = GamepadConnectionEvent::disconnected(_self) + let output: bool = bevy::input::gamepad::GamepadConnectionEvent::disconnected( + _self, + ) .into(); output }, @@ -499,46 +586,56 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadConnectionEvent::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadConnectionEvent::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadConnectionEvent::clone( + let output: Val = bevy::input::gamepad::GamepadConnectionEvent::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = GamepadEvent::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadEvent::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadEvent::clone( + let output: Val = bevy::input::gamepad::GamepadEvent::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = GamepadInput::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -546,7 +643,7 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadInput::clone( + let output: Val = bevy::input::gamepad::GamepadInput::clone( _self, ) .into(); @@ -559,29 +656,36 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadInput::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadInput::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadRumbleRequest::clone( + let output: Val = bevy::input::gamepad::GamepadRumbleRequest::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = RawGamepadAxisChangedEvent::eq(_self, other) + let output: bool = bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( + _self, + other, + ) .into(); output }, @@ -589,20 +693,23 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RawGamepadAxisChangedEvent::clone( + let output: Val = bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::< + bevy::input::gamepad::RawGamepadButtonChangedEvent, + >::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val< bevy::input::gamepad::RawGamepadButtonChangedEvent, - > = RawGamepadButtonChangedEvent::clone(_self).into(); + > = bevy::input::gamepad::RawGamepadButtonChangedEvent::clone(_self) + .into(); output }, ) @@ -612,16 +719,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = RawGamepadButtonChangedEvent::eq(_self, other) + let output: bool = bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( + _self, + other, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RawGamepadEvent::clone( + let output: Val = bevy::input::gamepad::RawGamepadEvent::clone( _self, ) .into(); @@ -634,15 +744,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = RawGamepadEvent::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::RawGamepadEvent::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = PinchGesture::clone( + let output: Val = bevy::input::gestures::PinchGesture::clone( _self, ) .into(); @@ -655,15 +769,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = PinchGesture::eq(_self, other).into(); + let output: bool = bevy::input::gestures::PinchGesture::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RotationGesture::clone( + let output: Val = bevy::input::gestures::RotationGesture::clone( _self, ) .into(); @@ -676,36 +794,44 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = RotationGesture::eq(_self, other).into(); + let output: bool = bevy::input::gestures::RotationGesture::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = DoubleTapGesture::eq(_self, other).into(); + let output: bool = bevy::input::gestures::DoubleTapGesture::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DoubleTapGesture::clone( + let output: Val = bevy::input::gestures::DoubleTapGesture::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = PanGesture::clone( + let output: Val = bevy::input::gestures::PanGesture::clone( _self, ) .into(); @@ -718,32 +844,39 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = PanGesture::eq(_self, other).into(); + let output: bool = bevy::input::gestures::PanGesture::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ButtonState::eq(_self, other).into(); + let output: bool = bevy::input::ButtonState::eq(_self, other).into(); output }, ) .overwrite_script_function( "is_pressed", |_self: Ref| { - let output: bool = ButtonState::is_pressed(_self).into(); + let output: bool = bevy::input::ButtonState::is_pressed(_self) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ButtonState::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::ButtonState::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -751,26 +884,32 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ButtonState::clone(_self) + let output: Val = bevy::input::ButtonState::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ButtonSettings::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::ButtonSettings::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ButtonSettings::clone( + let output: Val = bevy::input::gamepad::ButtonSettings::clone( _self, ) .into(); @@ -780,28 +919,42 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "is_pressed", |_self: Ref, value: f32| { - let output: bool = ButtonSettings::is_pressed(_self, value).into(); + let output: bool = bevy::input::gamepad::ButtonSettings::is_pressed( + _self, + value, + ) + .into(); output }, ) .overwrite_script_function( "is_released", |_self: Ref, value: f32| { - let output: bool = ButtonSettings::is_released(_self, value).into(); + let output: bool = bevy::input::gamepad::ButtonSettings::is_released( + _self, + value, + ) + .into(); output }, ) .overwrite_script_function( "press_threshold", |_self: Ref| { - let output: f32 = ButtonSettings::press_threshold(_self).into(); + let output: f32 = bevy::input::gamepad::ButtonSettings::press_threshold( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_press_threshold", |_self: Mut, value: f32| { - let output: f32 = ButtonSettings::set_press_threshold(_self, value) + let output: f32 = bevy::input::gamepad::ButtonSettings::set_press_threshold( + _self, + value, + ) .into(); output }, @@ -809,40 +962,56 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "release_threshold", |_self: Ref| { - let output: f32 = ButtonSettings::release_threshold(_self).into(); + let output: f32 = bevy::input::gamepad::ButtonSettings::release_threshold( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_release_threshold", |_self: Mut, value: f32| { - let output: f32 = ButtonSettings::set_release_threshold(_self, value) + let output: f32 = bevy::input::gamepad::ButtonSettings::set_release_threshold( + _self, + value, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = AxisSettings::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::AxisSettings::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "livezone_upperbound", |_self: Ref| { - let output: f32 = AxisSettings::livezone_upperbound(_self).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::livezone_upperbound( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_livezone_upperbound", |_self: Mut, value: f32| { - let output: f32 = AxisSettings::set_livezone_upperbound(_self, value) + let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_upperbound( + _self, + value, + ) .into(); output }, @@ -850,14 +1019,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "deadzone_upperbound", |_self: Ref| { - let output: f32 = AxisSettings::deadzone_upperbound(_self).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_upperbound( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_deadzone_upperbound", |_self: Mut, value: f32| { - let output: f32 = AxisSettings::set_deadzone_upperbound(_self, value) + let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( + _self, + value, + ) .into(); output }, @@ -865,14 +1040,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "livezone_lowerbound", |_self: Ref| { - let output: f32 = AxisSettings::livezone_lowerbound(_self).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::livezone_lowerbound( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_livezone_lowerbound", |_self: Mut, value: f32| { - let output: f32 = AxisSettings::set_livezone_lowerbound(_self, value) + let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( + _self, + value, + ) .into(); output }, @@ -880,14 +1061,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "deadzone_lowerbound", |_self: Ref| { - let output: f32 = AxisSettings::deadzone_lowerbound(_self).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_lowerbound( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_deadzone_lowerbound", |_self: Mut, value: f32| { - let output: f32 = AxisSettings::set_deadzone_lowerbound(_self, value) + let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( + _self, + value, + ) .into(); output }, @@ -895,21 +1082,32 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "threshold", |_self: Ref| { - let output: f32 = AxisSettings::threshold(_self).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::threshold( + _self, + ) + .into(); output }, ) .overwrite_script_function( "set_threshold", |_self: Mut, value: f32| { - let output: f32 = AxisSettings::set_threshold(_self, value).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::set_threshold( + _self, + value, + ) + .into(); output }, ) .overwrite_script_function( "clamp", |_self: Ref, new_value: f32| { - let output: f32 = AxisSettings::clamp(_self, new_value).into(); + let output: f32 = bevy::input::gamepad::AxisSettings::clamp( + _self, + new_value, + ) + .into(); output }, ) @@ -920,7 +1118,7 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { new_value: f32, old_value: std::option::Option| { - let output: std::option::Option = AxisSettings::filter( + let output: std::option::Option = bevy::input::gamepad::AxisSettings::filter( _self, new_value, old_value, @@ -932,14 +1130,14 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = AxisSettings::clone( + let output: Val = bevy::input::gamepad::AxisSettings::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "filter", | @@ -947,7 +1145,7 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { new_value: f32, old_value: std::option::Option| { - let output: std::option::Option = ButtonAxisSettings::filter( + let output: std::option::Option = bevy::input::gamepad::ButtonAxisSettings::filter( _self, new_value, old_value, @@ -959,18 +1157,18 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ButtonAxisSettings::clone( + let output: Val = bevy::input::gamepad::ButtonAxisSettings::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "weak_motor", |intensity: f32| { - let output: Val = GamepadRumbleIntensity::weak_motor( + let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( intensity, ) .into(); @@ -980,7 +1178,7 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "strong_motor", |intensity: f32| { - let output: Val = GamepadRumbleIntensity::strong_motor( + let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( intensity, ) .into(); @@ -990,7 +1188,7 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GamepadRumbleIntensity::clone( + let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::clone( _self, ) .into(); @@ -1003,22 +1201,31 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GamepadRumbleIntensity::eq(_self, other).into(); + let output: bool = bevy::input::gamepad::GamepadRumbleIntensity::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Key::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::input::keyboard::Key::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Key::clone(_self) + let output: Val = bevy::input::keyboard::Key::clone( + _self, + ) .into(); output }, @@ -1029,25 +1236,30 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Key::eq(_self, other).into(); + let output: bool = bevy::input::keyboard::Key::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = NativeKeyCode::eq(_self, other).into(); + let output: bool = bevy::input::keyboard::NativeKeyCode::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = NativeKeyCode::clone( + let output: Val = bevy::input::keyboard::NativeKeyCode::clone( _self, ) .into(); @@ -1057,26 +1269,31 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = NativeKeyCode::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = NativeKey::eq(_self, other).into(); + let output: bool = bevy::input::keyboard::NativeKey::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = NativeKey::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -1084,18 +1301,18 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = NativeKey::clone( + let output: Val = bevy::input::keyboard::NativeKey::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = MouseScrollUnit::clone( + let output: Val = bevy::input::mouse::MouseScrollUnit::clone( _self, ) .into(); @@ -1105,7 +1322,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = MouseScrollUnit::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -1116,15 +1335,21 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = MouseScrollUnit::eq(_self, other).into(); + let output: bool = bevy::input::mouse::MouseScrollUnit::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = TouchPhase::assert_receiver_is_total_eq(_self) + let output: () = bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -1135,25 +1360,26 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = TouchPhase::eq(_self, other).into(); + let output: bool = bevy::input::touch::TouchPhase::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = TouchPhase::clone( + let output: Val = bevy::input::touch::TouchPhase::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ForceTouch::clone( + let output: Val = bevy::input::touch::ForceTouch::clone( _self, ) .into(); @@ -1166,7 +1392,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ForceTouch::eq(_self, other).into(); + let output: bool = bevy::input::touch::ForceTouch::eq(_self, other) + .into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs index 8135ba028d..2bf9766268 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs @@ -4,7 +4,8 @@ #![cfg_attr(rustfmt, rustfmt_skip)] use super::bevy_reflect::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -12,28 +13,28 @@ pub struct BevyMathScriptingPlugin; impl bevy::app::Plugin for BevyMathScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = AspectRatio::eq(_self, other).into(); + let output: bool = bevy::math::AspectRatio::eq(_self, other).into(); output }, ) .overwrite_script_function( "ratio", |_self: Ref| { - let output: f32 = AspectRatio::ratio(_self).into(); + let output: f32 = bevy::math::AspectRatio::ratio(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = AspectRatio::inverse( + let output: Val = bevy::math::AspectRatio::inverse( _self, ) .into(); @@ -43,37 +44,43 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_landscape", |_self: Ref| { - let output: bool = AspectRatio::is_landscape(_self).into(); + let output: bool = bevy::math::AspectRatio::is_landscape(_self) + .into(); output }, ) .overwrite_script_function( "is_portrait", |_self: Ref| { - let output: bool = AspectRatio::is_portrait(_self).into(); + let output: bool = bevy::math::AspectRatio::is_portrait(_self) + .into(); output }, ) .overwrite_script_function( "is_square", |_self: Ref| { - let output: bool = AspectRatio::is_square(_self).into(); + let output: bool = bevy::math::AspectRatio::is_square(_self).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = AspectRatio::clone(_self) + let output: Val = bevy::math::AspectRatio::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = CompassOctant::assert_receiver_is_total_eq(_self) + let output: () = bevy::math::CompassOctant::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -81,7 +88,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = CompassOctant::clone( + let output: Val = bevy::math::CompassOctant::clone( _self, ) .into(); @@ -94,15 +101,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = CompassOctant::eq(_self, other).into(); + let output: bool = bevy::math::CompassOctant::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = CompassQuadrant::assert_receiver_is_total_eq(_self) + let output: () = bevy::math::CompassQuadrant::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -113,28 +123,29 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = CompassQuadrant::eq(_self, other).into(); + let output: bool = bevy::math::CompassQuadrant::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = CompassQuadrant::clone( + let output: Val = bevy::math::CompassQuadrant::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", | _self: Val, rhs: Val| { - let output: Val = Isometry2d::mul( + let output: Val = bevy::math::Isometry2d::mul( _self, rhs, ) @@ -145,7 +156,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_rotation", |rotation: Val| { - let output: Val = Isometry2d::from_rotation( + let output: Val = bevy::math::Isometry2d::from_rotation( rotation, ) .into(); @@ -155,7 +166,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xy", |x: f32, y: f32| { - let output: Val = Isometry2d::from_xy(x, y) + let output: Val = bevy::math::Isometry2d::from_xy( + x, + y, + ) .into(); output }, @@ -163,7 +177,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Isometry2d::inverse(_self) + let output: Val = bevy::math::Isometry2d::inverse( + _self, + ) .into(); output }, @@ -171,7 +187,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse_mul", |_self: Ref, rhs: Val| { - let output: Val = Isometry2d::inverse_mul( + let output: Val = bevy::math::Isometry2d::inverse_mul( _self, rhs, ) @@ -182,7 +198,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Isometry2d::clone(_self) + let output: Val = bevy::math::Isometry2d::clone( + _self, + ) .into(); output }, @@ -190,7 +208,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Isometry2d::mul(_self, rhs) + let output: Val = bevy::math::Isometry2d::mul( + _self, + rhs, + ) .into(); output }, @@ -198,15 +219,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Isometry2d::eq(_self, other).into(); + let output: bool = bevy::math::Isometry2d::eq(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = Isometry3d::from_xyz( + let output: Val = bevy::math::Isometry3d::from_xyz( x, y, z, @@ -218,7 +239,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Isometry3d::inverse(_self) + let output: Val = bevy::math::Isometry3d::inverse( + _self, + ) .into(); output }, @@ -226,7 +249,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse_mul", |_self: Ref, rhs: Val| { - let output: Val = Isometry3d::inverse_mul( + let output: Val = bevy::math::Isometry3d::inverse_mul( _self, rhs, ) @@ -237,7 +260,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Isometry3d::clone(_self) + let output: Val = bevy::math::Isometry3d::clone( + _self, + ) .into(); output }, @@ -245,7 +270,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Isometry3d::mul(_self, rhs) + let output: Val = bevy::math::Isometry3d::mul( + _self, + rhs, + ) .into(); output }, @@ -256,7 +284,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, rhs: Val| { - let output: Val = Isometry3d::mul( + let output: Val = bevy::math::Isometry3d::mul( _self, rhs, ) @@ -267,66 +295,77 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Isometry3d::eq(_self, other).into(); + let output: bool = bevy::math::Isometry3d::eq(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Ray2d::clone(_self).into(); + let output: Val = bevy::math::Ray2d::clone(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Ray2d::eq(_self, other).into(); + let output: bool = bevy::math::Ray2d::eq(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Ray3d::eq(_self, other).into(); + let output: bool = bevy::math::Ray3d::eq(_self, other).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Ray3d::clone(_self).into(); + let output: Val = bevy::math::Ray3d::clone(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Rot2::mul(_self, rhs).into(); + let output: Val = bevy::math::Rot2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "radians", |radians: f32| { - let output: Val = Rot2::radians(radians).into(); + let output: Val = bevy::math::Rot2::radians( + radians, + ) + .into(); output }, ) .overwrite_script_function( "degrees", |degrees: f32| { - let output: Val = Rot2::degrees(degrees).into(); + let output: Val = bevy::math::Rot2::degrees( + degrees, + ) + .into(); output }, ) .overwrite_script_function( "turn_fraction", |fraction: f32| { - let output: Val = Rot2::turn_fraction(fraction) + let output: Val = bevy::math::Rot2::turn_fraction( + fraction, + ) .into(); output }, @@ -334,7 +373,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_sin_cos", |sin: f32, cos: f32| { - let output: Val = Rot2::from_sin_cos(sin, cos) + let output: Val = bevy::math::Rot2::from_sin_cos( + sin, + cos, + ) .into(); output }, @@ -342,63 +384,68 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_radians", |_self: Val| { - let output: f32 = Rot2::as_radians(_self).into(); + let output: f32 = bevy::math::Rot2::as_radians(_self).into(); output }, ) .overwrite_script_function( "as_degrees", |_self: Val| { - let output: f32 = Rot2::as_degrees(_self).into(); + let output: f32 = bevy::math::Rot2::as_degrees(_self).into(); output }, ) .overwrite_script_function( "as_turn_fraction", |_self: Val| { - let output: f32 = Rot2::as_turn_fraction(_self).into(); + let output: f32 = bevy::math::Rot2::as_turn_fraction(_self).into(); output }, ) .overwrite_script_function( "sin_cos", |_self: Val| { - let output: (f32, f32) = Rot2::sin_cos(_self).into(); + let output: (f32, f32) = bevy::math::Rot2::sin_cos(_self).into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Rot2::length(_self).into(); + let output: f32 = bevy::math::Rot2::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = Rot2::length_squared(_self).into(); + let output: f32 = bevy::math::Rot2::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = Rot2::length_recip(_self).into(); + let output: f32 = bevy::math::Rot2::length_recip(_self).into(); output }, ) .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = Rot2::normalize(_self).into(); + let output: Val = bevy::math::Rot2::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = Rot2::fast_renormalize(_self) + let output: Val = bevy::math::Rot2::fast_renormalize( + _self, + ) .into(); output }, @@ -406,56 +453,62 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = Rot2::is_finite(_self).into(); + let output: bool = bevy::math::Rot2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = Rot2::is_nan(_self).into(); + let output: bool = bevy::math::Rot2::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = Rot2::is_normalized(_self).into(); + let output: bool = bevy::math::Rot2::is_normalized(_self).into(); output }, ) .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = Rot2::is_near_identity(_self).into(); + let output: bool = bevy::math::Rot2::is_near_identity(_self).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, other: Val| { - let output: f32 = Rot2::angle_between(_self, other).into(); + let output: f32 = bevy::math::Rot2::angle_between(_self, other) + .into(); output }, ) .overwrite_script_function( "angle_to", |_self: Val, other: Val| { - let output: f32 = Rot2::angle_to(_self, other).into(); + let output: f32 = bevy::math::Rot2::angle_to(_self, other).into(); output }, ) .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = Rot2::inverse(_self).into(); + let output: Val = bevy::math::Rot2::inverse(_self) + .into(); output }, ) .overwrite_script_function( "nlerp", |_self: Val, end: Val, s: f32| { - let output: Val = Rot2::nlerp(_self, end, s) + let output: Val = bevy::math::Rot2::nlerp( + _self, + end, + s, + ) .into(); output }, @@ -463,7 +516,11 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f32| { - let output: Val = Rot2::slerp(_self, end, s) + let output: Val = bevy::math::Rot2::slerp( + _self, + end, + s, + ) .into(); output }, @@ -474,7 +531,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, direction: Val| { - let output: Val = Rot2::mul( + let output: Val = bevy::math::Rot2::mul( _self, direction, ) @@ -485,22 +542,25 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Rot2::eq(_self, other).into(); + let output: bool = bevy::math::Rot2::eq(_self, other).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Rot2::clone(_self).into(); + let output: Val = bevy::math::Rot2::clone(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Dir2::clone(_self) + let output: Val = bevy::math::prelude::Dir2::clone( + _self, + ) .into(); output }, @@ -508,7 +568,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xy_unchecked", |x: f32, y: f32| { - let output: Val = Dir2::from_xy_unchecked( + let output: Val = bevy::math::prelude::Dir2::from_xy_unchecked( x, y, ) @@ -523,7 +583,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = Dir2::slerp( + let output: Val = bevy::math::prelude::Dir2::slerp( _self, rhs, s, @@ -538,7 +598,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: Val = Dir2::rotation_to(_self, other) + let output: Val = bevy::math::prelude::Dir2::rotation_to( + _self, + other, + ) .into(); output }, @@ -549,7 +612,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: Val = Dir2::rotation_from(_self, other) + let output: Val = bevy::math::prelude::Dir2::rotation_from( + _self, + other, + ) .into(); output }, @@ -557,7 +623,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_from_x", |_self: Val| { - let output: Val = Dir2::rotation_from_x(_self) + let output: Val = bevy::math::prelude::Dir2::rotation_from_x( + _self, + ) .into(); output }, @@ -565,7 +633,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_to_x", |_self: Val| { - let output: Val = Dir2::rotation_to_x(_self) + let output: Val = bevy::math::prelude::Dir2::rotation_to_x( + _self, + ) .into(); output }, @@ -573,7 +643,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_from_y", |_self: Val| { - let output: Val = Dir2::rotation_from_y(_self) + let output: Val = bevy::math::prelude::Dir2::rotation_from_y( + _self, + ) .into(); output }, @@ -581,7 +653,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_to_y", |_self: Val| { - let output: Val = Dir2::rotation_to_y(_self) + let output: Val = bevy::math::prelude::Dir2::rotation_to_y( + _self, + ) .into(); output }, @@ -589,7 +663,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = Dir2::fast_renormalize( + let output: Val = bevy::math::prelude::Dir2::fast_renormalize( _self, ) .into(); @@ -602,29 +676,38 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Dir2::eq(_self, other).into(); + let output: bool = bevy::math::prelude::Dir2::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Dir2::neg(_self).into(); + let output: Val = bevy::math::prelude::Dir2::neg( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Dir3::neg(_self).into(); + let output: Val = bevy::math::prelude::Dir3::neg( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Dir3::clone(_self) + let output: Val = bevy::math::prelude::Dir3::clone( + _self, + ) .into(); output }, @@ -635,14 +718,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Dir3::eq(_self, other).into(); + let output: bool = bevy::math::prelude::Dir3::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { - let output: Val = Dir3::from_xyz_unchecked( + let output: Val = bevy::math::prelude::Dir3::from_xyz_unchecked( x, y, z, @@ -658,7 +742,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = Dir3::slerp( + let output: Val = bevy::math::prelude::Dir3::slerp( _self, rhs, s, @@ -670,18 +754,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = Dir3::fast_renormalize( + let output: Val = bevy::math::prelude::Dir3::fast_renormalize( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Dir3A::clone(_self) + let output: Val = bevy::math::prelude::Dir3A::clone( + _self, + ) .into(); output }, @@ -689,7 +775,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Dir3A::neg(_self) + let output: Val = bevy::math::prelude::Dir3A::neg( + _self, + ) .into(); output }, @@ -700,14 +788,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Dir3A::eq(_self, other).into(); + let output: bool = bevy::math::prelude::Dir3A::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { - let output: Val = Dir3A::from_xyz_unchecked( + let output: Val = bevy::math::prelude::Dir3A::from_xyz_unchecked( x, y, z, @@ -723,7 +812,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = Dir3A::slerp( + let output: Val = bevy::math::prelude::Dir3A::slerp( _self, rhs, s, @@ -735,35 +824,41 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = Dir3A::fast_renormalize( + let output: Val = bevy::math::prelude::Dir3A::fast_renormalize( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = IRect::eq(_self, other).into(); + let output: bool = bevy::math::prelude::IRect::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = IRect::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::prelude::IRect::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = IRect::clone(_self) + let output: Val = bevy::math::prelude::IRect::clone( + _self, + ) .into(); output }, @@ -771,7 +866,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: i32, y0: i32, x1: i32, y1: i32| { - let output: Val = IRect::new( + let output: Val = bevy::math::prelude::IRect::new( x0, y0, x1, @@ -784,21 +879,22 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = IRect::is_empty(_self).into(); + let output: bool = bevy::math::prelude::IRect::is_empty(_self) + .into(); output }, ) .overwrite_script_function( "width", |_self: Ref| { - let output: i32 = IRect::width(_self).into(); + let output: i32 = bevy::math::prelude::IRect::width(_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: i32 = IRect::height(_self).into(); + let output: i32 = bevy::math::prelude::IRect::height(_self).into(); output }, ) @@ -808,7 +904,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = IRect::union( + let output: Val = bevy::math::prelude::IRect::union( _self, other, ) @@ -822,7 +918,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = IRect::intersect( + let output: Val = bevy::math::prelude::IRect::intersect( _self, other, ) @@ -833,7 +929,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: i32| { - let output: Val = IRect::inflate( + let output: Val = bevy::math::prelude::IRect::inflate( _self, expansion, ) @@ -844,7 +940,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_rect", |_self: Ref| { - let output: Val = IRect::as_rect(_self) + let output: Val = bevy::math::prelude::IRect::as_rect( + _self, + ) .into(); output }, @@ -852,26 +950,29 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_urect", |_self: Ref| { - let output: Val = IRect::as_urect(_self) + let output: Val = bevy::math::prelude::IRect::as_urect( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Rect::eq(_self, other).into(); + let output: bool = bevy::math::prelude::Rect::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |x0: f32, y0: f32, x1: f32, y1: f32| { - let output: Val = Rect::new( + let output: Val = bevy::math::prelude::Rect::new( x0, y0, x1, @@ -884,21 +985,21 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = Rect::is_empty(_self).into(); + let output: bool = bevy::math::prelude::Rect::is_empty(_self).into(); output }, ) .overwrite_script_function( "width", |_self: Ref| { - let output: f32 = Rect::width(_self).into(); + let output: f32 = bevy::math::prelude::Rect::width(_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: f32 = Rect::height(_self).into(); + let output: f32 = bevy::math::prelude::Rect::height(_self).into(); output }, ) @@ -908,7 +1009,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = Rect::union( + let output: Val = bevy::math::prelude::Rect::union( _self, other, ) @@ -922,7 +1023,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = Rect::intersect( + let output: Val = bevy::math::prelude::Rect::intersect( _self, other, ) @@ -933,7 +1034,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: f32| { - let output: Val = Rect::inflate( + let output: Val = bevy::math::prelude::Rect::inflate( _self, expansion, ) @@ -947,7 +1048,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = Rect::normalize( + let output: Val = bevy::math::prelude::Rect::normalize( _self, other, ) @@ -958,7 +1059,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_irect", |_self: Ref| { - let output: Val = Rect::as_irect(_self) + let output: Val = bevy::math::prelude::Rect::as_irect( + _self, + ) .into(); output }, @@ -966,7 +1069,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_urect", |_self: Ref| { - let output: Val = Rect::as_urect(_self) + let output: Val = bevy::math::prelude::Rect::as_urect( + _self, + ) .into(); output }, @@ -974,26 +1079,29 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Rect::clone(_self) + let output: Val = bevy::math::prelude::Rect::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = URect::eq(_self, other).into(); + let output: bool = bevy::math::prelude::URect::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |x0: u32, y0: u32, x1: u32, y1: u32| { - let output: Val = URect::new( + let output: Val = bevy::math::prelude::URect::new( x0, y0, x1, @@ -1006,21 +1114,22 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = URect::is_empty(_self).into(); + let output: bool = bevy::math::prelude::URect::is_empty(_self) + .into(); output }, ) .overwrite_script_function( "width", |_self: Ref| { - let output: u32 = URect::width(_self).into(); + let output: u32 = bevy::math::prelude::URect::width(_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: u32 = URect::height(_self).into(); + let output: u32 = bevy::math::prelude::URect::height(_self).into(); output }, ) @@ -1030,7 +1139,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = URect::union( + let output: Val = bevy::math::prelude::URect::union( _self, other, ) @@ -1044,7 +1153,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = URect::intersect( + let output: Val = bevy::math::prelude::URect::intersect( _self, other, ) @@ -1055,7 +1164,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: i32| { - let output: Val = URect::inflate( + let output: Val = bevy::math::prelude::URect::inflate( _self, expansion, ) @@ -1066,7 +1175,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_rect", |_self: Ref| { - let output: Val = URect::as_rect(_self) + let output: Val = bevy::math::prelude::URect::as_rect( + _self, + ) .into(); output }, @@ -1074,7 +1185,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_irect", |_self: Ref| { - let output: Val = URect::as_irect(_self) + let output: Val = bevy::math::prelude::URect::as_irect( + _self, + ) .into(); output }, @@ -1082,7 +1195,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = URect::clone(_self) + let output: Val = bevy::math::prelude::URect::clone( + _self, + ) .into(); output }, @@ -1090,16 +1205,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = URect::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::prelude::URect::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world); + NamespaceBuilder::::new(world) .overwrite_script_function( "bounding_circle", |_self: Ref| { - let output: Val = Aabb2d::bounding_circle( + let output: Val = bevy::math::bounding::Aabb2d::bounding_circle( _self, ) .into(); @@ -1109,23 +1227,26 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Aabb2d::clone(_self) + let output: Val = bevy::math::bounding::Aabb2d::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = BoundingCircle::radius(_self).into(); + let output: f32 = bevy::math::bounding::BoundingCircle::radius(_self) + .into(); output }, ) .overwrite_script_function( "aabb_2d", |_self: Ref| { - let output: Val = BoundingCircle::aabb_2d( + let output: Val = bevy::math::bounding::BoundingCircle::aabb_2d( _self, ) .into(); @@ -1135,28 +1256,31 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BoundingCircle::clone( + let output: Val = bevy::math::bounding::BoundingCircle::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Circle::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Circle::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |radius: f32| { - let output: Val = Circle::new(radius) + let output: Val = bevy::math::primitives::Circle::new( + radius, + ) .into(); output }, @@ -1164,25 +1288,26 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = Circle::diameter(_self).into(); + let output: f32 = bevy::math::primitives::Circle::diameter(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Circle::clone( + let output: Val = bevy::math::primitives::Circle::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Annulus::clone( + let output: Val = bevy::math::primitives::Annulus::clone( _self, ) .into(); @@ -1195,14 +1320,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Annulus::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Annulus::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |inner_radius: f32, outer_radius: f32| { - let output: Val = Annulus::new( + let output: Val = bevy::math::primitives::Annulus::new( inner_radius, outer_radius, ) @@ -1213,22 +1339,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = Annulus::diameter(_self).into(); + let output: f32 = bevy::math::primitives::Annulus::diameter(_self) + .into(); output }, ) .overwrite_script_function( "thickness", |_self: Ref| { - let output: f32 = Annulus::thickness(_self).into(); + let output: f32 = bevy::math::primitives::Annulus::thickness(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |radius: f32, half_angle: f32| { - let output: Val = Arc2d::new( + let output: Val = bevy::math::primitives::Arc2d::new( radius, half_angle, ) @@ -1239,7 +1367,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = Arc2d::from_radians( + let output: Val = bevy::math::primitives::Arc2d::from_radians( radius, angle, ) @@ -1250,7 +1378,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = Arc2d::from_degrees( + let output: Val = bevy::math::primitives::Arc2d::from_degrees( radius, angle, ) @@ -1261,7 +1389,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = Arc2d::from_turns( + let output: Val = bevy::math::primitives::Arc2d::from_turns( radius, fraction, ) @@ -1272,63 +1400,74 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = Arc2d::angle(_self).into(); + let output: f32 = bevy::math::primitives::Arc2d::angle(_self).into(); output }, ) .overwrite_script_function( "length", |_self: Ref| { - let output: f32 = Arc2d::length(_self).into(); + let output: f32 = bevy::math::primitives::Arc2d::length(_self) + .into(); output }, ) .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = Arc2d::half_chord_length(_self).into(); + let output: f32 = bevy::math::primitives::Arc2d::half_chord_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = Arc2d::chord_length(_self).into(); + let output: f32 = bevy::math::primitives::Arc2d::chord_length(_self) + .into(); output }, ) .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = Arc2d::apothem(_self).into(); + let output: f32 = bevy::math::primitives::Arc2d::apothem(_self) + .into(); output }, ) .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = Arc2d::sagitta(_self).into(); + let output: f32 = bevy::math::primitives::Arc2d::sagitta(_self) + .into(); output }, ) .overwrite_script_function( "is_minor", |_self: Ref| { - let output: bool = Arc2d::is_minor(_self).into(); + let output: bool = bevy::math::primitives::Arc2d::is_minor(_self) + .into(); output }, ) .overwrite_script_function( "is_major", |_self: Ref| { - let output: bool = Arc2d::is_major(_self).into(); + let output: bool = bevy::math::primitives::Arc2d::is_major(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Arc2d::clone(_self) + let output: Val = bevy::math::primitives::Arc2d::clone( + _self, + ) .into(); output }, @@ -1339,15 +1478,16 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Arc2d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Arc2d::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |radius: f32, length: f32| { - let output: Val = Capsule2d::new( + let output: Val = bevy::math::primitives::Capsule2d::new( radius, length, ) @@ -1358,7 +1498,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "to_inner_rectangle", |_self: Ref| { - let output: Val = Capsule2d::to_inner_rectangle( + let output: Val = bevy::math::primitives::Capsule2d::to_inner_rectangle( _self, ) .into(); @@ -1371,35 +1511,43 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Capsule2d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Capsule2d::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Capsule2d::clone( + let output: Val = bevy::math::primitives::Capsule2d::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = CircularSector::eq(_self, other).into(); + let output: bool = bevy::math::primitives::CircularSector::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "new", |radius: f32, angle: f32| { - let output: Val = CircularSector::new( + let output: Val = bevy::math::primitives::CircularSector::new( radius, angle, ) @@ -1410,7 +1558,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = CircularSector::from_radians( + let output: Val = bevy::math::primitives::CircularSector::from_radians( radius, angle, ) @@ -1421,7 +1569,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = CircularSector::from_degrees( + let output: Val = bevy::math::primitives::CircularSector::from_degrees( radius, angle, ) @@ -1432,7 +1580,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = CircularSector::from_turns( + let output: Val = bevy::math::primitives::CircularSector::from_turns( radius, fraction, ) @@ -1443,74 +1591,98 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_angle", |_self: Ref| { - let output: f32 = CircularSector::half_angle(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::half_angle( + _self, + ) + .into(); output }, ) .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = CircularSector::angle(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::angle( + _self, + ) + .into(); output }, ) .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = CircularSector::radius(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::radius( + _self, + ) + .into(); output }, ) .overwrite_script_function( "arc_length", |_self: Ref| { - let output: f32 = CircularSector::arc_length(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::arc_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = CircularSector::half_chord_length(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::half_chord_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = CircularSector::chord_length(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::chord_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = CircularSector::apothem(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::apothem( + _self, + ) + .into(); output }, ) .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = CircularSector::sagitta(_self).into(); + let output: f32 = bevy::math::primitives::CircularSector::sagitta( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = CircularSector::clone( + let output: Val = bevy::math::primitives::CircularSector::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |radius: f32, angle: f32| { - let output: Val = CircularSegment::new( + let output: Val = bevy::math::primitives::CircularSegment::new( radius, angle, ) @@ -1521,7 +1693,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = CircularSegment::from_radians( + let output: Val = bevy::math::primitives::CircularSegment::from_radians( radius, angle, ) @@ -1532,7 +1704,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = CircularSegment::from_degrees( + let output: Val = bevy::math::primitives::CircularSegment::from_degrees( radius, angle, ) @@ -1543,7 +1715,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = CircularSegment::from_turns( + let output: Val = bevy::math::primitives::CircularSegment::from_turns( radius, fraction, ) @@ -1554,63 +1726,87 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_angle", |_self: Ref| { - let output: f32 = CircularSegment::half_angle(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::half_angle( + _self, + ) + .into(); output }, ) .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = CircularSegment::angle(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::angle( + _self, + ) + .into(); output }, ) .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = CircularSegment::radius(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::radius( + _self, + ) + .into(); output }, ) .overwrite_script_function( "arc_length", |_self: Ref| { - let output: f32 = CircularSegment::arc_length(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::arc_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = CircularSegment::half_chord_length(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::half_chord_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = CircularSegment::chord_length(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::chord_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = CircularSegment::apothem(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::apothem( + _self, + ) + .into(); output }, ) .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = CircularSegment::sagitta(_self).into(); + let output: f32 = bevy::math::primitives::CircularSegment::sagitta( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = CircularSegment::clone( + let output: Val = bevy::math::primitives::CircularSegment::clone( _self, ) .into(); @@ -1623,25 +1819,30 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = CircularSegment::eq(_self, other).into(); + let output: bool = bevy::math::primitives::CircularSegment::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Ellipse::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Ellipse::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |half_width: f32, half_height: f32| { - let output: Val = Ellipse::new( + let output: Val = bevy::math::primitives::Ellipse::new( half_width, half_height, ) @@ -1652,46 +1853,54 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eccentricity", |_self: Ref| { - let output: f32 = Ellipse::eccentricity(_self).into(); + let output: f32 = bevy::math::primitives::Ellipse::eccentricity( + _self, + ) + .into(); output }, ) .overwrite_script_function( "focal_length", |_self: Ref| { - let output: f32 = Ellipse::focal_length(_self).into(); + let output: f32 = bevy::math::primitives::Ellipse::focal_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "semi_major", |_self: Ref| { - let output: f32 = Ellipse::semi_major(_self).into(); + let output: f32 = bevy::math::primitives::Ellipse::semi_major(_self) + .into(); output }, ) .overwrite_script_function( "semi_minor", |_self: Ref| { - let output: f32 = Ellipse::semi_minor(_self).into(); + let output: f32 = bevy::math::primitives::Ellipse::semi_minor(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Ellipse::clone( + let output: Val = bevy::math::primitives::Ellipse::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Line2d::clone( + let output: Val = bevy::math::primitives::Line2d::clone( _self, ) .into(); @@ -1704,15 +1913,16 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Line2d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Line2d::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Plane2d::clone( + let output: Val = bevy::math::primitives::Plane2d::clone( _self, ) .into(); @@ -1725,25 +1935,30 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Plane2d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Plane2d::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Rectangle::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Rectangle::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "new", |width: f32, height: f32| { - let output: Val = Rectangle::new( + let output: Val = bevy::math::primitives::Rectangle::new( width, height, ) @@ -1754,7 +1969,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_length", |length: f32| { - let output: Val = Rectangle::from_length( + let output: Val = bevy::math::primitives::Rectangle::from_length( length, ) .into(); @@ -1764,18 +1979,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Rectangle::clone( + let output: Val = bevy::math::primitives::Rectangle::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RegularPolygon::clone( + let output: Val = bevy::math::primitives::RegularPolygon::clone( _self, ) .into(); @@ -1785,7 +2000,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |circumradius: f32, sides: u32| { - let output: Val = RegularPolygon::new( + let output: Val = bevy::math::primitives::RegularPolygon::new( circumradius, sides, ) @@ -1796,28 +2011,39 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "circumradius", |_self: Ref| { - let output: f32 = RegularPolygon::circumradius(_self).into(); + let output: f32 = bevy::math::primitives::RegularPolygon::circumradius( + _self, + ) + .into(); output }, ) .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = RegularPolygon::inradius(_self).into(); + let output: f32 = bevy::math::primitives::RegularPolygon::inradius( + _self, + ) + .into(); output }, ) .overwrite_script_function( "side_length", |_self: Ref| { - let output: f32 = RegularPolygon::side_length(_self).into(); + let output: f32 = bevy::math::primitives::RegularPolygon::side_length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "internal_angle_degrees", |_self: Ref| { - let output: f32 = RegularPolygon::internal_angle_degrees(_self) + let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_degrees( + _self, + ) .into(); output }, @@ -1825,7 +2051,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "internal_angle_radians", |_self: Ref| { - let output: f32 = RegularPolygon::internal_angle_radians(_self) + let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_radians( + _self, + ) .into(); output }, @@ -1833,7 +2061,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "external_angle_degrees", |_self: Ref| { - let output: f32 = RegularPolygon::external_angle_degrees(_self) + let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_degrees( + _self, + ) .into(); output }, @@ -1841,7 +2071,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "external_angle_radians", |_self: Ref| { - let output: f32 = RegularPolygon::external_angle_radians(_self) + let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_radians( + _self, + ) .into(); output }, @@ -1852,25 +2084,30 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = RegularPolygon::eq(_self, other).into(); + let output: bool = bevy::math::primitives::RegularPolygon::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Rhombus::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Rhombus::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |horizontal_diagonal: f32, vertical_diagonal: f32| { - let output: Val = Rhombus::new( + let output: Val = bevy::math::primitives::Rhombus::new( horizontal_diagonal, vertical_diagonal, ) @@ -1881,7 +2118,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_side", |side: f32| { - let output: Val = Rhombus::from_side( + let output: Val = bevy::math::primitives::Rhombus::from_side( side, ) .into(); @@ -1891,7 +2128,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_inradius", |inradius: f32| { - let output: Val = Rhombus::from_inradius( + let output: Val = bevy::math::primitives::Rhombus::from_inradius( inradius, ) .into(); @@ -1901,49 +2138,58 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "side", |_self: Ref| { - let output: f32 = Rhombus::side(_self).into(); + let output: f32 = bevy::math::primitives::Rhombus::side(_self) + .into(); output }, ) .overwrite_script_function( "circumradius", |_self: Ref| { - let output: f32 = Rhombus::circumradius(_self).into(); + let output: f32 = bevy::math::primitives::Rhombus::circumradius( + _self, + ) + .into(); output }, ) .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = Rhombus::inradius(_self).into(); + let output: f32 = bevy::math::primitives::Rhombus::inradius(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Rhombus::clone( + let output: Val = bevy::math::primitives::Rhombus::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Segment2d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Segment2d::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "new", |direction: Val, length: f32| { - let output: Val = Segment2d::new( + let output: Val = bevy::math::primitives::Segment2d::new( direction, length, ) @@ -1954,46 +2200,56 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Segment2d::clone( + let output: Val = bevy::math::primitives::Segment2d::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "is_degenerate", |_self: Ref| { - let output: bool = Triangle2d::is_degenerate(_self).into(); + let output: bool = bevy::math::primitives::Triangle2d::is_degenerate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_acute", |_self: Ref| { - let output: bool = Triangle2d::is_acute(_self).into(); + let output: bool = bevy::math::primitives::Triangle2d::is_acute( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_obtuse", |_self: Ref| { - let output: bool = Triangle2d::is_obtuse(_self).into(); + let output: bool = bevy::math::primitives::Triangle2d::is_obtuse( + _self, + ) + .into(); output }, ) .overwrite_script_function( "reverse", |_self: Mut| { - let output: () = Triangle2d::reverse(_self).into(); + let output: () = bevy::math::primitives::Triangle2d::reverse(_self) + .into(); output }, ) .overwrite_script_function( "reversed", |_self: Val| { - let output: Val = Triangle2d::reversed( + let output: Val = bevy::math::primitives::Triangle2d::reversed( _self, ) .into(); @@ -2003,7 +2259,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Triangle2d::clone( + let output: Val = bevy::math::primitives::Triangle2d::clone( _self, ) .into(); @@ -2016,15 +2272,21 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Triangle2d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Triangle2d::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Aabb3d::clone(_self) + let output: Val = bevy::math::bounding::Aabb3d::clone( + _self, + ) .into(); output }, @@ -2032,25 +2294,26 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "bounding_sphere", |_self: Ref| { - let output: Val = Aabb3d::bounding_sphere( + let output: Val = bevy::math::bounding::Aabb3d::bounding_sphere( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = BoundingSphere::radius(_self).into(); + let output: f32 = bevy::math::bounding::BoundingSphere::radius(_self) + .into(); output }, ) .overwrite_script_function( "aabb_3d", |_self: Ref| { - let output: Val = BoundingSphere::aabb_3d( + let output: Val = bevy::math::bounding::BoundingSphere::aabb_3d( _self, ) .into(); @@ -2060,28 +2323,29 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BoundingSphere::clone( + let output: Val = bevy::math::bounding::BoundingSphere::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Sphere::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Sphere::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Sphere::clone( + let output: Val = bevy::math::primitives::Sphere::clone( _self, ) .into(); @@ -2091,7 +2355,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32| { - let output: Val = Sphere::new(radius) + let output: Val = bevy::math::primitives::Sphere::new( + radius, + ) .into(); output }, @@ -2099,15 +2365,16 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = Sphere::diameter(_self).into(); + let output: f32 = bevy::math::primitives::Sphere::diameter(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Cuboid::clone( + let output: Val = bevy::math::primitives::Cuboid::clone( _self, ) .into(); @@ -2120,14 +2387,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Cuboid::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Cuboid::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |x_length: f32, y_length: f32, z_length: f32| { - let output: Val = Cuboid::new( + let output: Val = bevy::math::primitives::Cuboid::new( x_length, y_length, z_length, @@ -2139,18 +2407,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_length", |length: f32| { - let output: Val = Cuboid::from_length( + let output: Val = bevy::math::primitives::Cuboid::from_length( length, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Cylinder::clone( + let output: Val = bevy::math::primitives::Cylinder::clone( _self, ) .into(); @@ -2163,14 +2431,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Cylinder::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Cylinder::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |radius: f32, height: f32| { - let output: Val = Cylinder::new( + let output: Val = bevy::math::primitives::Cylinder::new( radius, height, ) @@ -2181,7 +2450,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base", |_self: Ref| { - let output: Val = Cylinder::base( + let output: Val = bevy::math::primitives::Cylinder::base( _self, ) .into(); @@ -2191,22 +2460,26 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "lateral_area", |_self: Ref| { - let output: f32 = Cylinder::lateral_area(_self).into(); + let output: f32 = bevy::math::primitives::Cylinder::lateral_area( + _self, + ) + .into(); output }, ) .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = Cylinder::base_area(_self).into(); + let output: f32 = bevy::math::primitives::Cylinder::base_area(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Capsule3d::clone( + let output: Val = bevy::math::primitives::Capsule3d::clone( _self, ) .into(); @@ -2219,14 +2492,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Capsule3d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Capsule3d::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "new", |radius: f32, length: f32| { - let output: Val = Capsule3d::new( + let output: Val = bevy::math::primitives::Capsule3d::new( radius, length, ) @@ -2237,18 +2514,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "to_cylinder", |_self: Ref| { - let output: Val = Capsule3d::to_cylinder( + let output: Val = bevy::math::primitives::Capsule3d::to_cylinder( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |radius: f32, height: f32| { - let output: Val = Cone::new( + let output: Val = bevy::math::primitives::Cone::new( radius, height, ) @@ -2259,7 +2536,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base", |_self: Ref| { - let output: Val = Cone::base(_self) + let output: Val = bevy::math::primitives::Cone::base( + _self, + ) .into(); output }, @@ -2267,28 +2546,33 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "slant_height", |_self: Ref| { - let output: f32 = Cone::slant_height(_self).into(); + let output: f32 = bevy::math::primitives::Cone::slant_height(_self) + .into(); output }, ) .overwrite_script_function( "lateral_area", |_self: Ref| { - let output: f32 = Cone::lateral_area(_self).into(); + let output: f32 = bevy::math::primitives::Cone::lateral_area(_self) + .into(); output }, ) .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = Cone::base_area(_self).into(); + let output: f32 = bevy::math::primitives::Cone::base_area(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Cone::clone(_self) + let output: Val = bevy::math::primitives::Cone::clone( + _self, + ) .into(); output }, @@ -2299,36 +2583,41 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Cone::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Cone::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ConicalFrustum::eq(_self, other).into(); + let output: bool = bevy::math::primitives::ConicalFrustum::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ConicalFrustum::clone( + let output: Val = bevy::math::primitives::ConicalFrustum::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = InfinitePlane3d::clone( + let output: Val = bevy::math::primitives::InfinitePlane3d::clone( _self, ) .into(); @@ -2341,15 +2630,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = InfinitePlane3d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::InfinitePlane3d::eq( + _self, + other, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Line3d::clone( + let output: Val = bevy::math::primitives::Line3d::clone( _self, ) .into(); @@ -2362,15 +2655,16 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Line3d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Line3d::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |direction: Val, length: f32| { - let output: Val = Segment3d::new( + let output: Val = bevy::math::primitives::Segment3d::new( direction, length, ) @@ -2384,25 +2678,31 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Segment3d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Segment3d::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Segment3d::clone( + let output: Val = bevy::math::primitives::Segment3d::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Torus::clone(_self) + let output: Val = bevy::math::primitives::Torus::clone( + _self, + ) .into(); output }, @@ -2413,14 +2713,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Torus::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Torus::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "new", |inner_radius: f32, outer_radius: f32| { - let output: Val = Torus::new( + let output: Val = bevy::math::primitives::Torus::new( inner_radius, outer_radius, ) @@ -2431,60 +2732,76 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inner_radius", |_self: Ref| { - let output: f32 = Torus::inner_radius(_self).into(); + let output: f32 = bevy::math::primitives::Torus::inner_radius(_self) + .into(); output }, ) .overwrite_script_function( "outer_radius", |_self: Ref| { - let output: f32 = Torus::outer_radius(_self).into(); + let output: f32 = bevy::math::primitives::Torus::outer_radius(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Triangle3d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Triangle3d::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "is_degenerate", |_self: Ref| { - let output: bool = Triangle3d::is_degenerate(_self).into(); + let output: bool = bevy::math::primitives::Triangle3d::is_degenerate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_acute", |_self: Ref| { - let output: bool = Triangle3d::is_acute(_self).into(); + let output: bool = bevy::math::primitives::Triangle3d::is_acute( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_obtuse", |_self: Ref| { - let output: bool = Triangle3d::is_obtuse(_self).into(); + let output: bool = bevy::math::primitives::Triangle3d::is_obtuse( + _self, + ) + .into(); output }, ) .overwrite_script_function( "reverse", |_self: Mut| { - let output: () = Triangle3d::reverse(_self).into(); + let output: () = bevy::math::primitives::Triangle3d::reverse(_self) + .into(); output }, ) .overwrite_script_function( "reversed", |_self: Val| { - let output: Val = Triangle3d::reversed( + let output: Val = bevy::math::primitives::Triangle3d::reversed( _self, ) .into(); @@ -2494,18 +2811,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Triangle3d::clone( + let output: Val = bevy::math::primitives::Triangle3d::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RayCast2d::clone( + let output: Val = bevy::math::bounding::RayCast2d::clone( _self, ) .into(); @@ -2515,7 +2832,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_ray", |ray: Val, max: f32| { - let output: Val = RayCast2d::from_ray( + let output: Val = bevy::math::bounding::RayCast2d::from_ray( ray, max, ) @@ -2529,7 +2846,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Ref| { - let output: std::option::Option = RayCast2d::aabb_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast2d::aabb_intersection_at( _self, aabb, ) @@ -2543,7 +2860,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, circle: Ref| { - let output: std::option::Option = RayCast2d::circle_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast2d::circle_intersection_at( _self, circle, ) @@ -2551,7 +2868,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_ray", | @@ -2559,7 +2876,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = AabbCast2d::from_ray( + let output: Val = bevy::math::bounding::AabbCast2d::from_ray( aabb, ray, max, @@ -2574,7 +2891,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Val| { - let output: std::option::Option = AabbCast2d::aabb_collision_at( + let output: std::option::Option = bevy::math::bounding::AabbCast2d::aabb_collision_at( _self, aabb, ) @@ -2585,14 +2902,14 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = AabbCast2d::clone( + let output: Val = bevy::math::bounding::AabbCast2d::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_ray", | @@ -2600,7 +2917,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = BoundingCircleCast::from_ray( + let output: Val = bevy::math::bounding::BoundingCircleCast::from_ray( circle, ray, max, @@ -2615,7 +2932,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, circle: Val| { - let output: std::option::Option = BoundingCircleCast::circle_collision_at( + let output: std::option::Option = bevy::math::bounding::BoundingCircleCast::circle_collision_at( _self, circle, ) @@ -2626,18 +2943,18 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BoundingCircleCast::clone( + let output: Val = bevy::math::bounding::BoundingCircleCast::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RayCast3d::clone( + let output: Val = bevy::math::bounding::RayCast3d::clone( _self, ) .into(); @@ -2647,7 +2964,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_ray", |ray: Val, max: f32| { - let output: Val = RayCast3d::from_ray( + let output: Val = bevy::math::bounding::RayCast3d::from_ray( ray, max, ) @@ -2661,7 +2978,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Ref| { - let output: std::option::Option = RayCast3d::aabb_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast3d::aabb_intersection_at( _self, aabb, ) @@ -2675,7 +2992,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, sphere: Ref| { - let output: std::option::Option = RayCast3d::sphere_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast3d::sphere_intersection_at( _self, sphere, ) @@ -2683,7 +3000,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_ray", | @@ -2691,7 +3008,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = AabbCast3d::from_ray( + let output: Val = bevy::math::bounding::AabbCast3d::from_ray( aabb, ray, max, @@ -2706,7 +3023,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Val| { - let output: std::option::Option = AabbCast3d::aabb_collision_at( + let output: std::option::Option = bevy::math::bounding::AabbCast3d::aabb_collision_at( _self, aabb, ) @@ -2717,14 +3034,14 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = AabbCast3d::clone( + let output: Val = bevy::math::bounding::AabbCast3d::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_ray", | @@ -2732,7 +3049,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = BoundingSphereCast::from_ray( + let output: Val = bevy::math::bounding::BoundingSphereCast::from_ray( sphere, ray, max, @@ -2747,7 +3064,7 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, sphere: Val| { - let output: std::option::Option = BoundingSphereCast::sphere_collision_at( + let output: std::option::Option = bevy::math::bounding::BoundingSphereCast::sphere_collision_at( _self, sphere, ) @@ -2758,70 +3075,92 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BoundingSphereCast::clone( + let output: Val = bevy::math::bounding::BoundingSphereCast::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = Interval::eq(_self, other).into(); + let output: bool = bevy::math::curve::interval::Interval::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "start", |_self: Val| { - let output: f32 = Interval::start(_self).into(); + let output: f32 = bevy::math::curve::interval::Interval::start(_self) + .into(); output }, ) .overwrite_script_function( "end", |_self: Val| { - let output: f32 = Interval::end(_self).into(); + let output: f32 = bevy::math::curve::interval::Interval::end(_self) + .into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Interval::length(_self).into(); + let output: f32 = bevy::math::curve::interval::Interval::length( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_bounded", |_self: Val| { - let output: bool = Interval::is_bounded(_self).into(); + let output: bool = bevy::math::curve::interval::Interval::is_bounded( + _self, + ) + .into(); output }, ) .overwrite_script_function( "has_finite_start", |_self: Val| { - let output: bool = Interval::has_finite_start(_self).into(); + let output: bool = bevy::math::curve::interval::Interval::has_finite_start( + _self, + ) + .into(); output }, ) .overwrite_script_function( "has_finite_end", |_self: Val| { - let output: bool = Interval::has_finite_end(_self).into(); + let output: bool = bevy::math::curve::interval::Interval::has_finite_end( + _self, + ) + .into(); output }, ) .overwrite_script_function( "contains", |_self: Val, item: f32| { - let output: bool = Interval::contains(_self, item).into(); + let output: bool = bevy::math::curve::interval::Interval::contains( + _self, + item, + ) + .into(); output }, ) @@ -2831,39 +3170,52 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: bool = Interval::contains_interval(_self, other).into(); + let output: bool = bevy::math::curve::interval::Interval::contains_interval( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clamp", |_self: Val, value: f32| { - let output: f32 = Interval::clamp(_self, value).into(); + let output: f32 = bevy::math::curve::interval::Interval::clamp( + _self, + value, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Interval::clone( + let output: Val = bevy::math::curve::interval::Interval::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = FloatOrd::neg(_self).into(); + let output: Val = bevy::math::FloatOrd::neg( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = FloatOrd::clone(_self) + let output: Val = bevy::math::FloatOrd::clone( + _self, + ) .into(); output }, @@ -2871,43 +3223,43 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = FloatOrd::eq(_self, other).into(); + let output: bool = bevy::math::FloatOrd::eq(_self, other).into(); output }, ) .overwrite_script_function( "lt", |_self: Ref, other: Ref| { - let output: bool = FloatOrd::lt(_self, other).into(); + let output: bool = bevy::math::FloatOrd::lt(_self, other).into(); output }, ) .overwrite_script_function( "le", |_self: Ref, other: Ref| { - let output: bool = FloatOrd::le(_self, other).into(); + let output: bool = bevy::math::FloatOrd::le(_self, other).into(); output }, ) .overwrite_script_function( "gt", |_self: Ref, other: Ref| { - let output: bool = FloatOrd::gt(_self, other).into(); + let output: bool = bevy::math::FloatOrd::gt(_self, other).into(); output }, ) .overwrite_script_function( "ge", |_self: Ref, other: Ref| { - let output: bool = FloatOrd::ge(_self, other).into(); + let output: bool = bevy::math::FloatOrd::ge(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Plane3d::clone( + let output: Val = bevy::math::primitives::Plane3d::clone( _self, ) .into(); @@ -2920,15 +3272,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Plane3d::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Plane3d::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "signed_volume", |_self: Ref| { - let output: f32 = Tetrahedron::signed_volume(_self).into(); + let output: f32 = bevy::math::primitives::Tetrahedron::signed_volume( + _self, + ) + .into(); output }, ) @@ -2938,25 +3294,29 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Tetrahedron::eq(_self, other).into(); + let output: bool = bevy::math::primitives::Tetrahedron::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Tetrahedron::clone( + let output: Val = bevy::math::primitives::Tetrahedron::clone( _self, ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = EaseFunction::clone( + let output: Val = bevy::math::curve::easing::EaseFunction::clone( _self, ) .into(); @@ -2969,7 +3329,11 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = EaseFunction::eq(_self, other).into(); + let output: bool = bevy::math::curve::easing::EaseFunction::eq( + _self, + other, + ) + .into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs index 0f8da2a073..41273ac2a1 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs @@ -3,7 +3,8 @@ #![allow(unused, deprecated, dead_code)] #![cfg_attr(rustfmt, rustfmt_skip)] use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -11,11 +12,13 @@ pub struct BevyReflectScriptingPlugin; impl bevy::app::Plugin for BevyReflectScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: bool| { - let output: Val = AtomicBool::new(v) + let output: Val = std::sync::atomic::AtomicBool::new( + v, + ) .into(); output }, @@ -23,15 +26,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: bool = AtomicBool::into_inner(_self).into(); + let output: bool = std::sync::atomic::AtomicBool::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: i16| { - let output: Val = AtomicI16::new(v) + let output: Val = std::sync::atomic::AtomicI16::new( + v, + ) .into(); output }, @@ -39,15 +45,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i16 = AtomicI16::into_inner(_self).into(); + let output: i16 = std::sync::atomic::AtomicI16::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: i32| { - let output: Val = AtomicI32::new(v) + let output: Val = std::sync::atomic::AtomicI32::new( + v, + ) .into(); output }, @@ -55,15 +64,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i32 = AtomicI32::into_inner(_self).into(); + let output: i32 = std::sync::atomic::AtomicI32::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: i64| { - let output: Val = AtomicI64::new(v) + let output: Val = std::sync::atomic::AtomicI64::new( + v, + ) .into(); output }, @@ -71,15 +83,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i64 = AtomicI64::into_inner(_self).into(); + let output: i64 = std::sync::atomic::AtomicI64::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: i8| { - let output: Val = AtomicI8::new(v) + let output: Val = std::sync::atomic::AtomicI8::new( + v, + ) .into(); output }, @@ -87,15 +102,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i8 = AtomicI8::into_inner(_self).into(); + let output: i8 = std::sync::atomic::AtomicI8::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: isize| { - let output: Val = AtomicIsize::new(v) + let output: Val = std::sync::atomic::AtomicIsize::new( + v, + ) .into(); output }, @@ -103,15 +121,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: isize = AtomicIsize::into_inner(_self).into(); + let output: isize = std::sync::atomic::AtomicIsize::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: u16| { - let output: Val = AtomicU16::new(v) + let output: Val = std::sync::atomic::AtomicU16::new( + v, + ) .into(); output }, @@ -119,15 +140,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u16 = AtomicU16::into_inner(_self).into(); + let output: u16 = std::sync::atomic::AtomicU16::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: u32| { - let output: Val = AtomicU32::new(v) + let output: Val = std::sync::atomic::AtomicU32::new( + v, + ) .into(); output }, @@ -135,15 +159,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u32 = AtomicU32::into_inner(_self).into(); + let output: u32 = std::sync::atomic::AtomicU32::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: u64| { - let output: Val = AtomicU64::new(v) + let output: Val = std::sync::atomic::AtomicU64::new( + v, + ) .into(); output }, @@ -151,15 +178,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u64 = AtomicU64::into_inner(_self).into(); + let output: u64 = std::sync::atomic::AtomicU64::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: u8| { - let output: Val = AtomicU8::new(v) + let output: Val = std::sync::atomic::AtomicU8::new( + v, + ) .into(); output }, @@ -167,15 +197,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u8 = AtomicU8::into_inner(_self).into(); + let output: u8 = std::sync::atomic::AtomicU8::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |v: usize| { - let output: Val = AtomicUsize::new(v) + let output: Val = std::sync::atomic::AtomicUsize::new( + v, + ) .into(); output }, @@ -183,15 +216,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: usize = AtomicUsize::into_inner(_self).into(); + let output: usize = std::sync::atomic::AtomicUsize::into_inner(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = Duration::mul(_self, rhs) + let output: Val = bevy::utils::Duration::mul( + _self, + rhs, + ) .into(); output }, @@ -199,14 +236,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Duration::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::utils::Duration::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Duration::clone(_self) + let output: Val = bevy::utils::Duration::clone( + _self, + ) .into(); output }, @@ -214,7 +256,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Duration::sub(_self, rhs) + let output: Val = bevy::utils::Duration::sub( + _self, + rhs, + ) .into(); output }, @@ -222,7 +267,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Duration::add(_self, rhs) + let output: Val = bevy::utils::Duration::add( + _self, + rhs, + ) .into(); output }, @@ -230,14 +278,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Duration::eq(_self, other).into(); + let output: bool = bevy::utils::Duration::eq(_self, other).into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = Duration::div(_self, rhs) + let output: Val = bevy::utils::Duration::div( + _self, + rhs, + ) .into(); output }, @@ -245,7 +296,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |secs: u64, nanos: u32| { - let output: Val = Duration::new(secs, nanos) + let output: Val = bevy::utils::Duration::new( + secs, + nanos, + ) .into(); output }, @@ -253,7 +307,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_secs", |secs: u64| { - let output: Val = Duration::from_secs(secs) + let output: Val = bevy::utils::Duration::from_secs( + secs, + ) .into(); output }, @@ -261,7 +317,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_millis", |millis: u64| { - let output: Val = Duration::from_millis( + let output: Val = bevy::utils::Duration::from_millis( millis, ) .into(); @@ -271,7 +327,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_micros", |micros: u64| { - let output: Val = Duration::from_micros( + let output: Val = bevy::utils::Duration::from_micros( micros, ) .into(); @@ -281,7 +337,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_nanos", |nanos: u64| { - let output: Val = Duration::from_nanos(nanos) + let output: Val = bevy::utils::Duration::from_nanos( + nanos, + ) .into(); output }, @@ -289,63 +347,63 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_zero", |_self: Ref| { - let output: bool = Duration::is_zero(_self).into(); + let output: bool = bevy::utils::Duration::is_zero(_self).into(); output }, ) .overwrite_script_function( "as_secs", |_self: Ref| { - let output: u64 = Duration::as_secs(_self).into(); + let output: u64 = bevy::utils::Duration::as_secs(_self).into(); output }, ) .overwrite_script_function( "subsec_millis", |_self: Ref| { - let output: u32 = Duration::subsec_millis(_self).into(); + let output: u32 = bevy::utils::Duration::subsec_millis(_self).into(); output }, ) .overwrite_script_function( "subsec_micros", |_self: Ref| { - let output: u32 = Duration::subsec_micros(_self).into(); + let output: u32 = bevy::utils::Duration::subsec_micros(_self).into(); output }, ) .overwrite_script_function( "subsec_nanos", |_self: Ref| { - let output: u32 = Duration::subsec_nanos(_self).into(); + let output: u32 = bevy::utils::Duration::subsec_nanos(_self).into(); output }, ) .overwrite_script_function( "as_millis", |_self: Ref| { - let output: u128 = Duration::as_millis(_self).into(); + let output: u128 = bevy::utils::Duration::as_millis(_self).into(); output }, ) .overwrite_script_function( "as_micros", |_self: Ref| { - let output: u128 = Duration::as_micros(_self).into(); + let output: u128 = bevy::utils::Duration::as_micros(_self).into(); output }, ) .overwrite_script_function( "as_nanos", |_self: Ref| { - let output: u128 = Duration::as_nanos(_self).into(); + let output: u128 = bevy::utils::Duration::as_nanos(_self).into(); output }, ) .overwrite_script_function( "abs_diff", |_self: Val, other: Val| { - let output: Val = Duration::abs_diff( + let output: Val = bevy::utils::Duration::abs_diff( _self, other, ) @@ -356,7 +414,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = Duration::saturating_add( + let output: Val = bevy::utils::Duration::saturating_add( _self, rhs, ) @@ -367,7 +425,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = Duration::saturating_sub( + let output: Val = bevy::utils::Duration::saturating_sub( _self, rhs, ) @@ -378,7 +436,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: u32| { - let output: Val = Duration::saturating_mul( + let output: Val = bevy::utils::Duration::saturating_mul( _self, rhs, ) @@ -389,21 +447,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_secs_f64", |_self: Ref| { - let output: f64 = Duration::as_secs_f64(_self).into(); + let output: f64 = bevy::utils::Duration::as_secs_f64(_self).into(); output }, ) .overwrite_script_function( "as_secs_f32", |_self: Ref| { - let output: f32 = Duration::as_secs_f32(_self).into(); + let output: f32 = bevy::utils::Duration::as_secs_f32(_self).into(); output }, ) .overwrite_script_function( "from_secs_f64", |secs: f64| { - let output: Val = Duration::from_secs_f64( + let output: Val = bevy::utils::Duration::from_secs_f64( secs, ) .into(); @@ -413,7 +471,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_secs_f32", |secs: f32| { - let output: Val = Duration::from_secs_f32( + let output: Val = bevy::utils::Duration::from_secs_f32( secs, ) .into(); @@ -423,7 +481,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_f64", |_self: Val, rhs: f64| { - let output: Val = Duration::mul_f64( + let output: Val = bevy::utils::Duration::mul_f64( _self, rhs, ) @@ -434,7 +492,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_f32", |_self: Val, rhs: f32| { - let output: Val = Duration::mul_f32( + let output: Val = bevy::utils::Duration::mul_f32( _self, rhs, ) @@ -445,7 +503,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_f64", |_self: Val, rhs: f64| { - let output: Val = Duration::div_f64( + let output: Val = bevy::utils::Duration::div_f64( _self, rhs, ) @@ -456,7 +514,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_f32", |_self: Val, rhs: f32| { - let output: Val = Duration::div_f32( + let output: Val = bevy::utils::Duration::div_f32( _self, rhs, ) @@ -467,36 +525,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_duration_f64", |_self: Val, rhs: Val| { - let output: f64 = Duration::div_duration_f64(_self, rhs).into(); + let output: f64 = bevy::utils::Duration::div_duration_f64(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_duration_f32", |_self: Val, rhs: Val| { - let output: f32 = Duration::div_duration_f32(_self, rhs).into(); + let output: f32 = bevy::utils::Duration::div_duration_f32(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Instant::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::utils::Instant::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Instant::eq(_self, other).into(); + let output: bool = bevy::utils::Instant::eq(_self, other).into(); output }, ) .overwrite_script_function( "sub", |_self: Val, other: Val| { - let output: Val = Instant::sub(_self, other) + let output: Val = bevy::utils::Instant::sub( + _self, + other, + ) .into(); output }, @@ -504,7 +570,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, other: Val| { - let output: Val = Instant::sub(_self, other) + let output: Val = bevy::utils::Instant::sub( + _self, + other, + ) .into(); output }, @@ -512,14 +581,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "now", || { - let output: Val = Instant::now().into(); + let output: Val = bevy::utils::Instant::now() + .into(); output }, ) .overwrite_script_function( "duration_since", |_self: Ref, earlier: Val| { - let output: Val = Instant::duration_since( + let output: Val = bevy::utils::Instant::duration_since( _self, earlier, ) @@ -530,7 +600,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_duration_since", |_self: Ref, earlier: Val| { - let output: Val = Instant::saturating_duration_since( + let output: Val = bevy::utils::Instant::saturating_duration_since( _self, earlier, ) @@ -541,7 +611,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "elapsed", |_self: Ref| { - let output: Val = Instant::elapsed(_self) + let output: Val = bevy::utils::Instant::elapsed( + _self, + ) .into(); output }, @@ -549,23 +621,31 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Instant::clone(_self).into(); + let output: Val = bevy::utils::Instant::clone( + _self, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, other: Val| { - let output: Val = Instant::add(_self, other) + let output: Val = bevy::utils::Instant::add( + _self, + other, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = RangeFull::clone(_self) + let output: Val = std::ops::RangeFull::clone( + _self, + ) .into(); output }, @@ -573,7 +653,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = RangeFull::assert_receiver_is_total_eq(_self) + let output: () = std::ops::RangeFull::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -581,50 +663,63 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = RangeFull::eq(_self, other).into(); + let output: bool = std::ops::RangeFull::eq(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Quat::mul(_self, rhs).into(); + let output: Val = bevy::math::Quat::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Quat::sub(_self, rhs).into(); + let output: Val = bevy::math::Quat::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Quat::neg(_self).into(); + let output: Val = bevy::math::Quat::neg(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Quat::mul(_self, rhs).into(); + let output: Val = bevy::math::Quat::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Quat::clone(_self).into(); + let output: Val = bevy::math::Quat::clone(_self) + .into(); output }, ) .overwrite_script_function( "from_xyzw", |x: f32, y: f32, z: f32, w: f32| { - let output: Val = Quat::from_xyzw(x, y, z, w) + let output: Val = bevy::math::Quat::from_xyzw( + x, + y, + z, + w, + ) .into(); output }, @@ -632,21 +727,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = Quat::from_array(a).into(); + let output: Val = bevy::math::Quat::from_array(a) + .into(); output }, ) .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = Quat::from_vec4(v).into(); + let output: Val = bevy::math::Quat::from_vec4(v) + .into(); output }, ) .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = Quat::from_axis_angle( + let output: Val = bevy::math::Quat::from_axis_angle( axis, angle, ) @@ -657,14 +754,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scaled_axis", |v: Val| { - let output: Val = Quat::from_scaled_axis(v).into(); + let output: Val = bevy::math::Quat::from_scaled_axis( + v, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = Quat::from_rotation_x(angle) + let output: Val = bevy::math::Quat::from_rotation_x( + angle, + ) .into(); output }, @@ -672,7 +774,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = Quat::from_rotation_y(angle) + let output: Val = bevy::math::Quat::from_rotation_y( + angle, + ) .into(); output }, @@ -680,7 +784,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = Quat::from_rotation_z(angle) + let output: Val = bevy::math::Quat::from_rotation_z( + angle, + ) .into(); output }, @@ -688,7 +794,12 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |euler: Val, a: f32, b: f32, c: f32| { - let output: Val = Quat::from_euler(euler, a, b, c) + let output: Val = bevy::math::Quat::from_euler( + euler, + a, + b, + c, + ) .into(); output }, @@ -696,28 +807,34 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat: Ref| { - let output: Val = Quat::from_mat3(mat).into(); + let output: Val = bevy::math::Quat::from_mat3(mat) + .into(); output }, ) .overwrite_script_function( "from_mat3a", |mat: Ref| { - let output: Val = Quat::from_mat3a(mat).into(); + let output: Val = bevy::math::Quat::from_mat3a(mat) + .into(); output }, ) .overwrite_script_function( "from_mat4", |mat: Ref| { - let output: Val = Quat::from_mat4(mat).into(); + let output: Val = bevy::math::Quat::from_mat4(mat) + .into(); output }, ) .overwrite_script_function( "from_rotation_arc", |from: Val, to: Val| { - let output: Val = Quat::from_rotation_arc(from, to) + let output: Val = bevy::math::Quat::from_rotation_arc( + from, + to, + ) .into(); output }, @@ -725,7 +842,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_colinear", |from: Val, to: Val| { - let output: Val = Quat::from_rotation_arc_colinear( + let output: Val = bevy::math::Quat::from_rotation_arc_colinear( from, to, ) @@ -736,7 +853,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_2d", |from: Val, to: Val| { - let output: Val = Quat::from_rotation_arc_2d( + let output: Val = bevy::math::Quat::from_rotation_arc_2d( from, to, ) @@ -747,7 +864,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_scaled_axis", |_self: Val| { - let output: Val = Quat::to_scaled_axis(_self) + let output: Val = bevy::math::Quat::to_scaled_axis( + _self, + ) .into(); output }, @@ -755,105 +874,117 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Val, order: Val| { - let output: (f32, f32, f32) = Quat::to_euler(_self, order).into(); + let output: (f32, f32, f32) = bevy::math::Quat::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = Quat::to_array(_self).into(); + let output: [f32; 4] = bevy::math::Quat::to_array(_self).into(); output }, ) .overwrite_script_function( "xyz", |_self: Val| { - let output: Val = Quat::xyz(_self).into(); + let output: Val = bevy::math::Quat::xyz(_self) + .into(); output }, ) .overwrite_script_function( "conjugate", |_self: Val| { - let output: Val = Quat::conjugate(_self).into(); + let output: Val = bevy::math::Quat::conjugate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = Quat::inverse(_self).into(); + let output: Val = bevy::math::Quat::inverse(_self) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = Quat::dot(_self, rhs).into(); + let output: f32 = bevy::math::Quat::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Quat::length(_self).into(); + let output: f32 = bevy::math::Quat::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = Quat::length_squared(_self).into(); + let output: f32 = bevy::math::Quat::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = Quat::length_recip(_self).into(); + let output: f32 = bevy::math::Quat::length_recip(_self).into(); output }, ) .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = Quat::normalize(_self).into(); + let output: Val = bevy::math::Quat::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = Quat::is_finite(_self).into(); + let output: bool = bevy::math::Quat::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = Quat::is_nan(_self).into(); + let output: bool = bevy::math::Quat::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = Quat::is_normalized(_self).into(); + let output: bool = bevy::math::Quat::is_normalized(_self).into(); output }, ) .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = Quat::is_near_identity(_self).into(); + let output: bool = bevy::math::Quat::is_near_identity(_self).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = Quat::angle_between(_self, rhs).into(); + let output: f32 = bevy::math::Quat::angle_between(_self, rhs).into(); output }, ) @@ -864,7 +995,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f32| { - let output: Val = Quat::rotate_towards( + let output: Val = bevy::math::Quat::rotate_towards( _self, rhs, max_angle, @@ -880,7 +1011,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Quat::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Quat::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -888,14 +1023,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, end: Val, s: f32| { - let output: Val = Quat::lerp(_self, end, s).into(); + let output: Val = bevy::math::Quat::lerp( + _self, + end, + s, + ) + .into(); output }, ) .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f32| { - let output: Val = Quat::slerp(_self, end, s) + let output: Val = bevy::math::Quat::slerp( + _self, + end, + s, + ) .into(); output }, @@ -903,7 +1047,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Val, rhs: Val| { - let output: Val = Quat::mul_vec3(_self, rhs) + let output: Val = bevy::math::Quat::mul_vec3( + _self, + rhs, + ) .into(); output }, @@ -911,7 +1058,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_quat", |_self: Val, rhs: Val| { - let output: Val = Quat::mul_quat(_self, rhs) + let output: Val = bevy::math::Quat::mul_quat( + _self, + rhs, + ) .into(); output }, @@ -919,14 +1069,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_affine3", |a: Ref| { - let output: Val = Quat::from_affine3(a).into(); + let output: Val = bevy::math::Quat::from_affine3(a) + .into(); output }, ) .overwrite_script_function( "mul_vec3a", |_self: Val, rhs: Val| { - let output: Val = Quat::mul_vec3a(_self, rhs) + let output: Val = bevy::math::Quat::mul_vec3a( + _self, + rhs, + ) .into(); output }, @@ -934,162 +1088,186 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dquat", |_self: Val| { - let output: Val = Quat::as_dquat(_self).into(); + let output: Val = bevy::math::Quat::as_dquat( + _self, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Quat::eq(_self, rhs).into(); + let output: bool = bevy::math::Quat::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Quat::mul(_self, rhs).into(); + let output: Val = bevy::math::Quat::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Quat::mul(_self, rhs).into(); + let output: Val = bevy::math::Quat::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Quat::div(_self, rhs).into(); + let output: Val = bevy::math::Quat::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Quat::add(_self, rhs).into(); + let output: Val = bevy::math::Quat::add(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = Vec3::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = Vec3::div(_self, rhs).into(); + let output: Val = bevy::math::Vec3::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Vec3::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Vec3::add(_self, rhs).into(); + let output: Val = bevy::math::Vec3::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Vec3::clone(_self).into(); + let output: Val = bevy::math::Vec3::clone(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = Vec3::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec3::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = Vec3::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec3::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Vec3::neg(_self).into(); + let output: Val = bevy::math::Vec3::neg(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Vec3::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = Vec3::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec3::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = Vec3::div(_self, rhs).into(); + let output: Val = bevy::math::Vec3::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = Vec3::add(_self, rhs).into(); + let output: Val = bevy::math::Vec3::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = Vec3::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec3::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = Vec3::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec3::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Vec3::div(_self, rhs).into(); + let output: Val = bevy::math::Vec3::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "new", |x: f32, y: f32, z: f32| { - let output: Val = Vec3::new(x, y, z).into(); + let output: Val = bevy::math::Vec3::new(x, y, z) + .into(); output }, ) .overwrite_script_function( "splat", |v: f32| { - let output: Val = Vec3::splat(v).into(); + let output: Val = bevy::math::Vec3::splat(v) + .into(); output }, ) @@ -1100,7 +1278,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = Vec3::select( + let output: Val = bevy::math::Vec3::select( mask, if_true, if_false, @@ -1112,63 +1290,84 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 3]| { - let output: Val = Vec3::from_array(a).into(); + let output: Val = bevy::math::Vec3::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = Vec3::to_array(_self).into(); + let output: [f32; 3] = bevy::math::Vec3::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f32| { - let output: Val = Vec3::extend(_self, w).into(); + let output: Val = bevy::math::Vec3::extend( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = Vec3::truncate(_self).into(); + let output: Val = bevy::math::Vec3::truncate(_self) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = Vec3::with_x(_self, x).into(); + let output: Val = bevy::math::Vec3::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = Vec3::with_y(_self, y).into(); + let output: Val = bevy::math::Vec3::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = Vec3::with_z(_self, z).into(); + let output: Val = bevy::math::Vec3::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = Vec3::dot(_self, rhs).into(); + let output: f32 = bevy::math::Vec3::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = Vec3::dot_into_vec(_self, rhs) + let output: Val = bevy::math::Vec3::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -1176,21 +1375,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = Vec3::cross(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cross( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = Vec3::min(_self, rhs).into(); + let output: Val = bevy::math::Vec3::min(_self, rhs) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = Vec3::max(_self, rhs).into(); + let output: Val = bevy::math::Vec3::max(_self, rhs) + .into(); output }, ) @@ -1201,7 +1406,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = Vec3::clamp(_self, min, max) + let output: Val = bevy::math::Vec3::clamp( + _self, + min, + max, + ) .into(); output }, @@ -1209,91 +1418,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = Vec3::min_element(_self).into(); + let output: f32 = bevy::math::Vec3::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = Vec3::max_element(_self).into(); + let output: f32 = bevy::math::Vec3::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = Vec3::element_sum(_self).into(); + let output: f32 = bevy::math::Vec3::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = Vec3::element_product(_self).into(); + let output: f32 = bevy::math::Vec3::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = Vec3::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = Vec3::cmpne(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = Vec3::cmpge(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = Vec3::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = Vec3::cmple(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = Vec3::cmplt(_self, rhs).into(); + let output: Val = bevy::math::Vec3::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = Vec3::abs(_self).into(); + let output: Val = bevy::math::Vec3::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = Vec3::signum(_self).into(); + let output: Val = bevy::math::Vec3::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = Vec3::copysign(_self, rhs) + let output: Val = bevy::math::Vec3::copysign( + _self, + rhs, + ) .into(); output }, @@ -1301,21 +1539,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = Vec3::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::Vec3::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = Vec3::is_finite(_self).into(); + let output: bool = bevy::math::Vec3::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = Vec3::is_finite_mask(_self) + let output: Val = bevy::math::Vec3::is_finite_mask( + _self, + ) .into(); output }, @@ -1323,56 +1564,63 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = Vec3::is_nan(_self).into(); + let output: bool = bevy::math::Vec3::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = Vec3::is_nan_mask(_self).into(); + let output: Val = bevy::math::Vec3::is_nan_mask( + _self, + ) + .into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Vec3::length(_self).into(); + let output: f32 = bevy::math::Vec3::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = Vec3::length_squared(_self).into(); + let output: f32 = bevy::math::Vec3::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = Vec3::length_recip(_self).into(); + let output: f32 = bevy::math::Vec3::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = Vec3::distance(_self, rhs).into(); + let output: f32 = bevy::math::Vec3::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = Vec3::distance_squared(_self, rhs).into(); + let output: f32 = bevy::math::Vec3::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec3::div_euclid(_self, rhs) + let output: Val = bevy::math::Vec3::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -1380,7 +1628,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec3::rem_euclid(_self, rhs) + let output: Val = bevy::math::Vec3::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -1388,14 +1639,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = Vec3::normalize(_self).into(); + let output: Val = bevy::math::Vec3::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = Vec3::normalize_or( + let output: Val = bevy::math::Vec3::normalize_or( _self, fallback, ) @@ -1406,7 +1660,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = Vec3::normalize_or_zero(_self) + let output: Val = bevy::math::Vec3::normalize_or_zero( + _self, + ) .into(); output }, @@ -1414,14 +1670,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = Vec3::is_normalized(_self).into(); + let output: bool = bevy::math::Vec3::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = Vec3::project_onto(_self, rhs) + let output: Val = bevy::math::Vec3::project_onto( + _self, + rhs, + ) .into(); output }, @@ -1429,7 +1688,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = Vec3::reject_from(_self, rhs) + let output: Val = bevy::math::Vec3::reject_from( + _self, + rhs, + ) .into(); output }, @@ -1437,7 +1699,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec3::project_onto_normalized( + let output: Val = bevy::math::Vec3::project_onto_normalized( _self, rhs, ) @@ -1448,7 +1710,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec3::reject_from_normalized( + let output: Val = bevy::math::Vec3::reject_from_normalized( _self, rhs, ) @@ -1459,77 +1721,95 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = Vec3::round(_self).into(); + let output: Val = bevy::math::Vec3::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = Vec3::floor(_self).into(); + let output: Val = bevy::math::Vec3::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = Vec3::ceil(_self).into(); + let output: Val = bevy::math::Vec3::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = Vec3::trunc(_self).into(); + let output: Val = bevy::math::Vec3::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = Vec3::fract(_self).into(); + let output: Val = bevy::math::Vec3::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = Vec3::fract_gl(_self).into(); + let output: Val = bevy::math::Vec3::fract_gl(_self) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = Vec3::exp(_self).into(); + let output: Val = bevy::math::Vec3::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = Vec3::powf(_self, n).into(); + let output: Val = bevy::math::Vec3::powf(_self, n) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = Vec3::recip(_self).into(); + let output: Val = bevy::math::Vec3::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = Vec3::lerp(_self, rhs, s).into(); + let output: Val = bevy::math::Vec3::lerp( + _self, + rhs, + s, + ) + .into(); output }, ) .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = Vec3::move_towards(_self, rhs, d) + let output: Val = bevy::math::Vec3::move_towards( + _self, + rhs, + d, + ) .into(); output }, @@ -1537,7 +1817,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = Vec3::midpoint(_self, rhs) + let output: Val = bevy::math::Vec3::midpoint( + _self, + rhs, + ) .into(); output }, @@ -1549,15 +1832,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Vec3::abs_diff_eq(_self, rhs, max_abs_diff) - .into(); - output + let output: bool = bevy::math::Vec3::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) + .into(); + output }, ) .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = Vec3::clamp_length( + let output: Val = bevy::math::Vec3::clamp_length( _self, min, max, @@ -1569,7 +1856,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = Vec3::clamp_length_max( + let output: Val = bevy::math::Vec3::clamp_length_max( _self, max, ) @@ -1580,7 +1867,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = Vec3::clamp_length_min( + let output: Val = bevy::math::Vec3::clamp_length_min( _self, min, ) @@ -1595,7 +1882,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = Vec3::mul_add(_self, a, b) + let output: Val = bevy::math::Vec3::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -1603,7 +1894,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = Vec3::reflect(_self, normal) + let output: Val = bevy::math::Vec3::reflect( + _self, + normal, + ) .into(); output }, @@ -1611,7 +1905,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = Vec3::refract(_self, normal, eta) + let output: Val = bevy::math::Vec3::refract( + _self, + normal, + eta, + ) .into(); output }, @@ -1619,14 +1917,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = Vec3::angle_between(_self, rhs).into(); + let output: f32 = bevy::math::Vec3::angle_between(_self, rhs).into(); output }, ) .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = Vec3::any_orthogonal_vector( + let output: Val = bevy::math::Vec3::any_orthogonal_vector( _self, ) .into(); @@ -1636,7 +1934,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = Vec3::any_orthonormal_vector( + let output: Val = bevy::math::Vec3::any_orthonormal_vector( _self, ) .into(); @@ -1646,28 +1944,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = Vec3::as_dvec3(_self).into(); + let output: Val = bevy::math::Vec3::as_dvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = Vec3::as_ivec3(_self).into(); + let output: Val = bevy::math::Vec3::as_ivec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = Vec3::as_uvec3(_self).into(); + let output: Val = bevy::math::Vec3::as_uvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = Vec3::as_i64vec3(_self) + let output: Val = bevy::math::Vec3::as_i64vec3( + _self, + ) .into(); output }, @@ -1675,7 +1984,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = Vec3::as_u64vec3(_self) + let output: Val = bevy::math::Vec3::as_u64vec3( + _self, + ) .into(); output }, @@ -1683,155 +1994,222 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Vec3::eq(_self, other).into(); + let output: bool = bevy::math::Vec3::eq(_self, other).into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = Vec3::add(_self, rhs).into(); + let output: Val = bevy::math::Vec3::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Vec3::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec3::sub(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = IVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = IVec2::add(_self, rhs).into(); + let output: Val = bevy::math::IVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = IVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = IVec2::add(_self, rhs).into(); + let output: Val = bevy::math::IVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = IVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = IVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = IVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = IVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = IVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = IVec2::div(_self, rhs).into(); + let output: Val = bevy::math::IVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = IVec2::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::IVec2::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = IVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = IVec2::add(_self, rhs).into(); + let output: Val = bevy::math::IVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = IVec2::div(_self, rhs).into(); + let output: Val = bevy::math::IVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = IVec2::eq(_self, other).into(); + let output: bool = bevy::math::IVec2::eq(_self, other).into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = IVec2::div(_self, rhs).into(); + let output: Val = bevy::math::IVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = IVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: i32, y: i32| { - let output: Val = IVec2::new(x, y).into(); + let output: Val = bevy::math::IVec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: i32| { - let output: Val = IVec2::splat(v).into(); + let output: Val = bevy::math::IVec2::splat(v) + .into(); output }, ) @@ -1842,7 +2220,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = IVec2::select( + let output: Val = bevy::math::IVec2::select( mask, if_true, if_false, @@ -1854,49 +2232,65 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 2]| { - let output: Val = IVec2::from_array(a).into(); + let output: Val = bevy::math::IVec2::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 2] = IVec2::to_array(_self).into(); + let output: [i32; 2] = bevy::math::IVec2::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: i32| { - let output: Val = IVec2::extend(_self, z).into(); + let output: Val = bevy::math::IVec2::extend( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = IVec2::with_x(_self, x).into(); + let output: Val = bevy::math::IVec2::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = IVec2::with_y(_self, y).into(); + let output: Val = bevy::math::IVec2::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = IVec2::dot(_self, rhs).into(); + let output: i32 = bevy::math::IVec2::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = IVec2::dot_into_vec(_self, rhs) + let output: Val = bevy::math::IVec2::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -1904,14 +2298,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = IVec2::min(_self, rhs).into(); + let output: Val = bevy::math::IVec2::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = IVec2::max(_self, rhs).into(); + let output: Val = bevy::math::IVec2::max( + _self, + rhs, + ) + .into(); output }, ) @@ -1922,7 +2324,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = IVec2::clamp(_self, min, max) + let output: Val = bevy::math::IVec2::clamp( + _self, + min, + max, + ) .into(); output }, @@ -1930,112 +2336,143 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = IVec2::min_element(_self).into(); + let output: i32 = bevy::math::IVec2::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = IVec2::max_element(_self).into(); + let output: i32 = bevy::math::IVec2::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = IVec2::element_sum(_self).into(); + let output: i32 = bevy::math::IVec2::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = IVec2::element_product(_self).into(); + let output: i32 = bevy::math::IVec2::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = IVec2::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::IVec2::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = IVec2::cmpne(_self, rhs).into(); + let output: Val = bevy::math::IVec2::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = IVec2::cmpge(_self, rhs).into(); + let output: Val = bevy::math::IVec2::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = IVec2::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::IVec2::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = IVec2::cmple(_self, rhs).into(); + let output: Val = bevy::math::IVec2::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = IVec2::cmplt(_self, rhs).into(); + let output: Val = bevy::math::IVec2::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = IVec2::abs(_self).into(); + let output: Val = bevy::math::IVec2::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = IVec2::signum(_self).into(); + let output: Val = bevy::math::IVec2::signum(_self) + .into(); output }, ) .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = IVec2::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::IVec2::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = IVec2::length_squared(_self).into(); + let output: i32 = bevy::math::IVec2::length_squared(_self).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = IVec2::distance_squared(_self, rhs).into(); + let output: i32 = bevy::math::IVec2::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = IVec2::div_euclid(_self, rhs) + let output: Val = bevy::math::IVec2::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -2043,7 +2480,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = IVec2::rem_euclid(_self, rhs) + let output: Val = bevy::math::IVec2::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -2051,21 +2491,25 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = IVec2::perp(_self).into(); + let output: Val = bevy::math::IVec2::perp(_self) + .into(); output }, ) .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: i32 = IVec2::perp_dot(_self, rhs).into(); + let output: i32 = bevy::math::IVec2::perp_dot(_self, rhs).into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = IVec2::rotate(_self, rhs) + let output: Val = bevy::math::IVec2::rotate( + _self, + rhs, + ) .into(); output }, @@ -2073,28 +2517,37 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = IVec2::as_vec2(_self).into(); + let output: Val = bevy::math::IVec2::as_vec2(_self) + .into(); output }, ) .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = IVec2::as_dvec2(_self).into(); + let output: Val = bevy::math::IVec2::as_dvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = IVec2::as_uvec2(_self).into(); + let output: Val = bevy::math::IVec2::as_uvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = IVec2::as_i64vec2(_self) + let output: Val = bevy::math::IVec2::as_i64vec2( + _self, + ) .into(); output }, @@ -2102,7 +2555,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = IVec2::as_u64vec2(_self) + let output: Val = bevy::math::IVec2::as_u64vec2( + _self, + ) .into(); output }, @@ -2110,7 +2565,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = IVec2::wrapping_add(_self, rhs) + let output: Val = bevy::math::IVec2::wrapping_add( + _self, + rhs, + ) .into(); output }, @@ -2118,7 +2576,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = IVec2::wrapping_sub(_self, rhs) + let output: Val = bevy::math::IVec2::wrapping_sub( + _self, + rhs, + ) .into(); output }, @@ -2126,7 +2587,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = IVec2::wrapping_mul(_self, rhs) + let output: Val = bevy::math::IVec2::wrapping_mul( + _self, + rhs, + ) .into(); output }, @@ -2134,7 +2598,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = IVec2::wrapping_div(_self, rhs) + let output: Val = bevy::math::IVec2::wrapping_div( + _self, + rhs, + ) .into(); output }, @@ -2142,7 +2609,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = IVec2::saturating_add( + let output: Val = bevy::math::IVec2::saturating_add( _self, rhs, ) @@ -2153,7 +2620,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = IVec2::saturating_sub( + let output: Val = bevy::math::IVec2::saturating_sub( _self, rhs, ) @@ -2164,7 +2631,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = IVec2::saturating_mul( + let output: Val = bevy::math::IVec2::saturating_mul( _self, rhs, ) @@ -2175,7 +2642,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = IVec2::saturating_div( + let output: Val = bevy::math::IVec2::saturating_div( _self, rhs, ) @@ -2186,7 +2653,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec2::wrapping_add_unsigned( + let output: Val = bevy::math::IVec2::wrapping_add_unsigned( _self, rhs, ) @@ -2197,7 +2664,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec2::wrapping_sub_unsigned( + let output: Val = bevy::math::IVec2::wrapping_sub_unsigned( _self, rhs, ) @@ -2208,7 +2675,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec2::saturating_add_unsigned( + let output: Val = bevy::math::IVec2::saturating_add_unsigned( _self, rhs, ) @@ -2219,7 +2686,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec2::saturating_sub_unsigned( + let output: Val = bevy::math::IVec2::saturating_sub_unsigned( _self, rhs, ) @@ -2230,57 +2697,76 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = IVec2::neg(_self).into(); + let output: Val = bevy::math::IVec2::neg(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = IVec2::clone(_self).into(); + let output: Val = bevy::math::IVec2::clone(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = IVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = IVec3::div(_self, rhs).into(); + let output: Val = bevy::math::IVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = IVec3::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::IVec3::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = IVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: i32, y: i32, z: i32| { - let output: Val = IVec3::new(x, y, z).into(); + let output: Val = bevy::math::IVec3::new(x, y, z) + .into(); output }, ) .overwrite_script_function( "splat", |v: i32| { - let output: Val = IVec3::splat(v).into(); + let output: Val = bevy::math::IVec3::splat(v) + .into(); output }, ) @@ -2291,7 +2777,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = IVec3::select( + let output: Val = bevy::math::IVec3::select( mask, if_true, if_false, @@ -2303,63 +2789,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 3]| { - let output: Val = IVec3::from_array(a).into(); + let output: Val = bevy::math::IVec3::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 3] = IVec3::to_array(_self).into(); + let output: [i32; 3] = bevy::math::IVec3::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: i32| { - let output: Val = IVec3::extend(_self, w).into(); + let output: Val = bevy::math::IVec3::extend( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = IVec3::truncate(_self).into(); + let output: Val = bevy::math::IVec3::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = IVec3::with_x(_self, x).into(); + let output: Val = bevy::math::IVec3::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = IVec3::with_y(_self, y).into(); + let output: Val = bevy::math::IVec3::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: i32| { - let output: Val = IVec3::with_z(_self, z).into(); + let output: Val = bevy::math::IVec3::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = IVec3::dot(_self, rhs).into(); + let output: i32 = bevy::math::IVec3::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = IVec3::dot_into_vec(_self, rhs) + let output: Val = bevy::math::IVec3::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -2367,21 +2876,33 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = IVec3::cross(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cross( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = IVec3::min(_self, rhs).into(); + let output: Val = bevy::math::IVec3::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = IVec3::max(_self, rhs).into(); + let output: Val = bevy::math::IVec3::max( + _self, + rhs, + ) + .into(); output }, ) @@ -2392,7 +2913,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = IVec3::clamp(_self, min, max) + let output: Val = bevy::math::IVec3::clamp( + _self, + min, + max, + ) .into(); output }, @@ -2400,112 +2925,143 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = IVec3::min_element(_self).into(); + let output: i32 = bevy::math::IVec3::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = IVec3::max_element(_self).into(); + let output: i32 = bevy::math::IVec3::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = IVec3::element_sum(_self).into(); + let output: i32 = bevy::math::IVec3::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = IVec3::element_product(_self).into(); + let output: i32 = bevy::math::IVec3::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = IVec3::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = IVec3::cmpne(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = IVec3::cmpge(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = IVec3::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = IVec3::cmple(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = IVec3::cmplt(_self, rhs).into(); + let output: Val = bevy::math::IVec3::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = IVec3::abs(_self).into(); + let output: Val = bevy::math::IVec3::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = IVec3::signum(_self).into(); + let output: Val = bevy::math::IVec3::signum(_self) + .into(); output }, ) .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = IVec3::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::IVec3::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = IVec3::length_squared(_self).into(); + let output: i32 = bevy::math::IVec3::length_squared(_self).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = IVec3::distance_squared(_self, rhs).into(); + let output: i32 = bevy::math::IVec3::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = IVec3::div_euclid(_self, rhs) + let output: Val = bevy::math::IVec3::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -2513,7 +3069,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = IVec3::rem_euclid(_self, rhs) + let output: Val = bevy::math::IVec3::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -2521,35 +3080,47 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = IVec3::as_vec3(_self).into(); + let output: Val = bevy::math::IVec3::as_vec3(_self) + .into(); output }, ) .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = IVec3::as_vec3a(_self).into(); + let output: Val = bevy::math::IVec3::as_vec3a( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = IVec3::as_dvec3(_self).into(); + let output: Val = bevy::math::IVec3::as_dvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = IVec3::as_uvec3(_self).into(); + let output: Val = bevy::math::IVec3::as_uvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = IVec3::as_i64vec3(_self) + let output: Val = bevy::math::IVec3::as_i64vec3( + _self, + ) .into(); output }, @@ -2557,7 +3128,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = IVec3::as_u64vec3(_self) + let output: Val = bevy::math::IVec3::as_u64vec3( + _self, + ) .into(); output }, @@ -2565,7 +3138,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = IVec3::wrapping_add(_self, rhs) + let output: Val = bevy::math::IVec3::wrapping_add( + _self, + rhs, + ) .into(); output }, @@ -2573,7 +3149,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = IVec3::wrapping_sub(_self, rhs) + let output: Val = bevy::math::IVec3::wrapping_sub( + _self, + rhs, + ) .into(); output }, @@ -2581,7 +3160,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = IVec3::wrapping_mul(_self, rhs) + let output: Val = bevy::math::IVec3::wrapping_mul( + _self, + rhs, + ) .into(); output }, @@ -2589,7 +3171,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = IVec3::wrapping_div(_self, rhs) + let output: Val = bevy::math::IVec3::wrapping_div( + _self, + rhs, + ) .into(); output }, @@ -2597,7 +3182,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = IVec3::saturating_add( + let output: Val = bevy::math::IVec3::saturating_add( _self, rhs, ) @@ -2608,7 +3193,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = IVec3::saturating_sub( + let output: Val = bevy::math::IVec3::saturating_sub( _self, rhs, ) @@ -2619,7 +3204,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = IVec3::saturating_mul( + let output: Val = bevy::math::IVec3::saturating_mul( _self, rhs, ) @@ -2630,7 +3215,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = IVec3::saturating_div( + let output: Val = bevy::math::IVec3::saturating_div( _self, rhs, ) @@ -2641,7 +3226,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec3::wrapping_add_unsigned( + let output: Val = bevy::math::IVec3::wrapping_add_unsigned( _self, rhs, ) @@ -2652,7 +3237,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec3::wrapping_sub_unsigned( + let output: Val = bevy::math::IVec3::wrapping_sub_unsigned( _self, rhs, ) @@ -2663,7 +3248,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec3::saturating_add_unsigned( + let output: Val = bevy::math::IVec3::saturating_add_unsigned( _self, rhs, ) @@ -2674,7 +3259,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec3::saturating_sub_unsigned( + let output: Val = bevy::math::IVec3::saturating_sub_unsigned( _self, rhs, ) @@ -2685,148 +3270,221 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = IVec3::div(_self, rhs).into(); + let output: Val = bevy::math::IVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = IVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = IVec3::add(_self, rhs).into(); + let output: Val = bevy::math::IVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = IVec3::div(_self, rhs).into(); + let output: Val = bevy::math::IVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = IVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = IVec3::add(_self, rhs).into(); + let output: Val = bevy::math::IVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = IVec3::neg(_self).into(); + let output: Val = bevy::math::IVec3::neg(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = IVec3::clone(_self).into(); + let output: Val = bevy::math::IVec3::clone(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = IVec3::eq(_self, other).into(); + let output: bool = bevy::math::IVec3::eq(_self, other).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = IVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = IVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = IVec3::add(_self, rhs).into(); + let output: Val = bevy::math::IVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = IVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = IVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = IVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec3::rem( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = IVec4::add(_self, rhs).into(); + let output: Val = bevy::math::IVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = IVec4::add(_self, rhs).into(); + let output: Val = bevy::math::IVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = IVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = IVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: i32, y: i32, z: i32, w: i32| { - let output: Val = IVec4::new(x, y, z, w).into(); + let output: Val = bevy::math::IVec4::new( + x, + y, + z, + w, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: i32| { - let output: Val = IVec4::splat(v).into(); + let output: Val = bevy::math::IVec4::splat(v) + .into(); output }, ) @@ -2837,7 +3495,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = IVec4::select( + let output: Val = bevy::math::IVec4::select( mask, if_true, if_false, @@ -2849,63 +3507,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 4]| { - let output: Val = IVec4::from_array(a).into(); + let output: Val = bevy::math::IVec4::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 4] = IVec4::to_array(_self).into(); + let output: [i32; 4] = bevy::math::IVec4::to_array(_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = IVec4::truncate(_self).into(); + let output: Val = bevy::math::IVec4::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = IVec4::with_x(_self, x).into(); + let output: Val = bevy::math::IVec4::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = IVec4::with_y(_self, y).into(); + let output: Val = bevy::math::IVec4::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: i32| { - let output: Val = IVec4::with_z(_self, z).into(); + let output: Val = bevy::math::IVec4::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_w", |_self: Val, w: i32| { - let output: Val = IVec4::with_w(_self, w).into(); + let output: Val = bevy::math::IVec4::with_w( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = IVec4::dot(_self, rhs).into(); + let output: i32 = bevy::math::IVec4::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = IVec4::dot_into_vec(_self, rhs) + let output: Val = bevy::math::IVec4::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -2913,14 +3594,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = IVec4::min(_self, rhs).into(); + let output: Val = bevy::math::IVec4::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = IVec4::max(_self, rhs).into(); + let output: Val = bevy::math::IVec4::max( + _self, + rhs, + ) + .into(); output }, ) @@ -2931,7 +3620,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = IVec4::clamp(_self, min, max) + let output: Val = bevy::math::IVec4::clamp( + _self, + min, + max, + ) .into(); output }, @@ -2939,112 +3632,143 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = IVec4::min_element(_self).into(); + let output: i32 = bevy::math::IVec4::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = IVec4::max_element(_self).into(); + let output: i32 = bevy::math::IVec4::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = IVec4::element_sum(_self).into(); + let output: i32 = bevy::math::IVec4::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = IVec4::element_product(_self).into(); + let output: i32 = bevy::math::IVec4::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = IVec4::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::IVec4::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = IVec4::cmpne(_self, rhs).into(); + let output: Val = bevy::math::IVec4::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = IVec4::cmpge(_self, rhs).into(); + let output: Val = bevy::math::IVec4::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = IVec4::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::IVec4::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = IVec4::cmple(_self, rhs).into(); + let output: Val = bevy::math::IVec4::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = IVec4::cmplt(_self, rhs).into(); + let output: Val = bevy::math::IVec4::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = IVec4::abs(_self).into(); + let output: Val = bevy::math::IVec4::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = IVec4::signum(_self).into(); + let output: Val = bevy::math::IVec4::signum(_self) + .into(); output }, ) .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = IVec4::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::IVec4::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = IVec4::length_squared(_self).into(); + let output: i32 = bevy::math::IVec4::length_squared(_self).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = IVec4::distance_squared(_self, rhs).into(); + let output: i32 = bevy::math::IVec4::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = IVec4::div_euclid(_self, rhs) + let output: Val = bevy::math::IVec4::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -3052,7 +3776,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = IVec4::rem_euclid(_self, rhs) + let output: Val = bevy::math::IVec4::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -3060,28 +3787,37 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = IVec4::as_vec4(_self).into(); + let output: Val = bevy::math::IVec4::as_vec4(_self) + .into(); output }, ) .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = IVec4::as_dvec4(_self).into(); + let output: Val = bevy::math::IVec4::as_dvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = IVec4::as_uvec4(_self).into(); + let output: Val = bevy::math::IVec4::as_uvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = IVec4::as_i64vec4(_self) + let output: Val = bevy::math::IVec4::as_i64vec4( + _self, + ) .into(); output }, @@ -3089,7 +3825,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = IVec4::as_u64vec4(_self) + let output: Val = bevy::math::IVec4::as_u64vec4( + _self, + ) .into(); output }, @@ -3097,7 +3835,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = IVec4::wrapping_add(_self, rhs) + let output: Val = bevy::math::IVec4::wrapping_add( + _self, + rhs, + ) .into(); output }, @@ -3105,7 +3846,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = IVec4::wrapping_sub(_self, rhs) + let output: Val = bevy::math::IVec4::wrapping_sub( + _self, + rhs, + ) .into(); output }, @@ -3113,7 +3857,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = IVec4::wrapping_mul(_self, rhs) + let output: Val = bevy::math::IVec4::wrapping_mul( + _self, + rhs, + ) .into(); output }, @@ -3121,7 +3868,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = IVec4::wrapping_div(_self, rhs) + let output: Val = bevy::math::IVec4::wrapping_div( + _self, + rhs, + ) .into(); output }, @@ -3129,7 +3879,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = IVec4::saturating_add( + let output: Val = bevy::math::IVec4::saturating_add( _self, rhs, ) @@ -3140,7 +3890,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = IVec4::saturating_sub( + let output: Val = bevy::math::IVec4::saturating_sub( _self, rhs, ) @@ -3151,7 +3901,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = IVec4::saturating_mul( + let output: Val = bevy::math::IVec4::saturating_mul( _self, rhs, ) @@ -3162,7 +3912,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = IVec4::saturating_div( + let output: Val = bevy::math::IVec4::saturating_div( _self, rhs, ) @@ -3173,7 +3923,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec4::wrapping_add_unsigned( + let output: Val = bevy::math::IVec4::wrapping_add_unsigned( _self, rhs, ) @@ -3184,7 +3934,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec4::wrapping_sub_unsigned( + let output: Val = bevy::math::IVec4::wrapping_sub_unsigned( _self, rhs, ) @@ -3195,7 +3945,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec4::saturating_add_unsigned( + let output: Val = bevy::math::IVec4::saturating_add_unsigned( _self, rhs, ) @@ -3206,7 +3956,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = IVec4::saturating_sub_unsigned( + let output: Val = bevy::math::IVec4::saturating_sub_unsigned( _self, rhs, ) @@ -3217,120 +3967,175 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = IVec4::add(_self, rhs).into(); + let output: Val = bevy::math::IVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = IVec4::div(_self, rhs).into(); + let output: Val = bevy::math::IVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = IVec4::eq(_self, other).into(); + let output: bool = bevy::math::IVec4::eq(_self, other).into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = IVec4::div(_self, rhs).into(); + let output: Val = bevy::math::IVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = IVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = IVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = IVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = IVec4::clone(_self).into(); + let output: Val = bevy::math::IVec4::clone(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = IVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::IVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = IVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = IVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::IVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = IVec4::neg(_self).into(); + let output: Val = bevy::math::IVec4::neg(_self) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = IVec4::div(_self, rhs).into(); + let output: Val = bevy::math::IVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = IVec4::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::IVec4::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = IVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::IVec4::rem( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = I64Vec2::neg(_self).into(); + let output: Val = bevy::math::I64Vec2::neg( + _self, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = I64Vec2::rem(_self, rhs) + let output: Val = bevy::math::I64Vec2::rem( + _self, + rhs, + ) .into(); output }, @@ -3338,7 +4143,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::div(_self, rhs) + let output: Val = bevy::math::I64Vec2::div( + _self, + rhs, + ) .into(); output }, @@ -3346,15 +4154,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = I64Vec2::rem(_self, rhs) - .into(); + let output: Val = bevy::math::I64Vec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = I64Vec2::sub(_self, rhs) + let output: Val = bevy::math::I64Vec2::sub( + _self, + rhs, + ) .into(); output }, @@ -3362,7 +4176,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = I64Vec2::sub(_self, rhs) + let output: Val = bevy::math::I64Vec2::sub( + _self, + rhs, + ) .into(); output }, @@ -3370,14 +4187,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = I64Vec2::eq(_self, other).into(); + let output: bool = bevy::math::I64Vec2::eq(_self, other).into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::rem(_self, rhs) + let output: Val = bevy::math::I64Vec2::rem( + _self, + rhs, + ) .into(); output }, @@ -3385,14 +4205,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = I64Vec2::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::I64Vec2::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = I64Vec2::add(_self, rhs) + let output: Val = bevy::math::I64Vec2::add( + _self, + rhs, + ) .into(); output }, @@ -3400,7 +4226,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = I64Vec2::add(_self, rhs) + let output: Val = bevy::math::I64Vec2::add( + _self, + rhs, + ) .into(); output }, @@ -3408,14 +4237,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = I64Vec2::clone(_self).into(); + let output: Val = bevy::math::I64Vec2::clone( + _self, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::add(_self, rhs) + let output: Val = bevy::math::I64Vec2::add( + _self, + rhs, + ) .into(); output }, @@ -3423,7 +4258,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::mul(_self, rhs) + let output: Val = bevy::math::I64Vec2::mul( + _self, + rhs, + ) .into(); output }, @@ -3431,14 +4269,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64| { - let output: Val = I64Vec2::new(x, y).into(); + let output: Val = bevy::math::I64Vec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: i64| { - let output: Val = I64Vec2::splat(v).into(); + let output: Val = bevy::math::I64Vec2::splat(v) + .into(); output }, ) @@ -3449,7 +4289,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = I64Vec2::select( + let output: Val = bevy::math::I64Vec2::select( mask, if_true, if_false, @@ -3461,21 +4301,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 2]| { - let output: Val = I64Vec2::from_array(a).into(); + let output: Val = bevy::math::I64Vec2::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 2] = I64Vec2::to_array(_self).into(); + let output: [i64; 2] = bevy::math::I64Vec2::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: i64| { - let output: Val = I64Vec2::extend(_self, z) + let output: Val = bevy::math::I64Vec2::extend( + _self, + z, + ) .into(); output }, @@ -3483,7 +4329,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = I64Vec2::with_x(_self, x) + let output: Val = bevy::math::I64Vec2::with_x( + _self, + x, + ) .into(); output }, @@ -3491,7 +4340,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = I64Vec2::with_y(_self, y) + let output: Val = bevy::math::I64Vec2::with_y( + _self, + y, + ) .into(); output }, @@ -3499,14 +4351,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = I64Vec2::dot(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec2::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::dot_into_vec( + let output: Val = bevy::math::I64Vec2::dot_into_vec( _self, rhs, ) @@ -3517,7 +4369,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::min(_self, rhs) + let output: Val = bevy::math::I64Vec2::min( + _self, + rhs, + ) .into(); output }, @@ -3525,7 +4380,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::max(_self, rhs) + let output: Val = bevy::math::I64Vec2::max( + _self, + rhs, + ) .into(); output }, @@ -3537,7 +4395,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = I64Vec2::clamp( + let output: Val = bevy::math::I64Vec2::clamp( _self, min, max, @@ -3549,35 +4407,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = I64Vec2::min_element(_self).into(); + let output: i64 = bevy::math::I64Vec2::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = I64Vec2::max_element(_self).into(); + let output: i64 = bevy::math::I64Vec2::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = I64Vec2::element_sum(_self).into(); + let output: i64 = bevy::math::I64Vec2::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = I64Vec2::element_product(_self).into(); + let output: i64 = bevy::math::I64Vec2::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::cmpeq(_self, rhs) + let output: Val = bevy::math::I64Vec2::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -3585,7 +4446,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::cmpne(_self, rhs) + let output: Val = bevy::math::I64Vec2::cmpne( + _self, + rhs, + ) .into(); output }, @@ -3593,7 +4457,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::cmpge(_self, rhs) + let output: Val = bevy::math::I64Vec2::cmpge( + _self, + rhs, + ) .into(); output }, @@ -3601,7 +4468,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::cmpgt(_self, rhs) + let output: Val = bevy::math::I64Vec2::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -3609,7 +4479,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::cmple(_self, rhs) + let output: Val = bevy::math::I64Vec2::cmple( + _self, + rhs, + ) .into(); output }, @@ -3617,7 +4490,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::cmplt(_self, rhs) + let output: Val = bevy::math::I64Vec2::cmplt( + _self, + rhs, + ) .into(); output }, @@ -3625,42 +4501,50 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = I64Vec2::abs(_self).into(); + let output: Val = bevy::math::I64Vec2::abs( + _self, + ) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = I64Vec2::signum(_self).into(); + let output: Val = bevy::math::I64Vec2::signum( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = I64Vec2::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::I64Vec2::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = I64Vec2::length_squared(_self).into(); + let output: i64 = bevy::math::I64Vec2::length_squared(_self).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = I64Vec2::distance_squared(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec2::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::div_euclid( + let output: Val = bevy::math::I64Vec2::div_euclid( _self, rhs, ) @@ -3671,7 +4555,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::rem_euclid( + let output: Val = bevy::math::I64Vec2::rem_euclid( _self, rhs, ) @@ -3682,21 +4566,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = I64Vec2::perp(_self).into(); + let output: Val = bevy::math::I64Vec2::perp( + _self, + ) + .into(); output }, ) .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: i64 = I64Vec2::perp_dot(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec2::perp_dot(_self, rhs).into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::rotate(_self, rhs) + let output: Val = bevy::math::I64Vec2::rotate( + _self, + rhs, + ) .into(); output }, @@ -3704,35 +4594,49 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = I64Vec2::as_vec2(_self).into(); + let output: Val = bevy::math::I64Vec2::as_vec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = I64Vec2::as_dvec2(_self).into(); + let output: Val = bevy::math::I64Vec2::as_dvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = I64Vec2::as_ivec2(_self).into(); + let output: Val = bevy::math::I64Vec2::as_ivec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = I64Vec2::as_uvec2(_self).into(); + let output: Val = bevy::math::I64Vec2::as_uvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = I64Vec2::as_u64vec2(_self) + let output: Val = bevy::math::I64Vec2::as_u64vec2( + _self, + ) .into(); output }, @@ -3740,7 +4644,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::wrapping_add( + let output: Val = bevy::math::I64Vec2::wrapping_add( _self, rhs, ) @@ -3751,7 +4655,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::wrapping_sub( + let output: Val = bevy::math::I64Vec2::wrapping_sub( _self, rhs, ) @@ -3762,7 +4666,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::wrapping_mul( + let output: Val = bevy::math::I64Vec2::wrapping_mul( _self, rhs, ) @@ -3773,7 +4677,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::wrapping_div( + let output: Val = bevy::math::I64Vec2::wrapping_div( _self, rhs, ) @@ -3784,7 +4688,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::saturating_add( + let output: Val = bevy::math::I64Vec2::saturating_add( _self, rhs, ) @@ -3795,7 +4699,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::saturating_sub( + let output: Val = bevy::math::I64Vec2::saturating_sub( _self, rhs, ) @@ -3806,7 +4710,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::saturating_mul( + let output: Val = bevy::math::I64Vec2::saturating_mul( _self, rhs, ) @@ -3817,7 +4721,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::saturating_div( + let output: Val = bevy::math::I64Vec2::saturating_div( _self, rhs, ) @@ -3828,7 +4732,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::wrapping_add_unsigned( + let output: Val = bevy::math::I64Vec2::wrapping_add_unsigned( _self, rhs, ) @@ -3839,7 +4743,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::wrapping_sub_unsigned( + let output: Val = bevy::math::I64Vec2::wrapping_sub_unsigned( _self, rhs, ) @@ -3850,7 +4754,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::saturating_add_unsigned( + let output: Val = bevy::math::I64Vec2::saturating_add_unsigned( _self, rhs, ) @@ -3861,7 +4765,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::saturating_sub_unsigned( + let output: Val = bevy::math::I64Vec2::saturating_sub_unsigned( _self, rhs, ) @@ -3872,7 +4776,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = I64Vec2::div(_self, rhs) + let output: Val = bevy::math::I64Vec2::div( + _self, + rhs, + ) .into(); output }, @@ -3880,7 +4787,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = I64Vec2::mul(_self, rhs) + let output: Val = bevy::math::I64Vec2::mul( + _self, + rhs, + ) .into(); output }, @@ -3888,7 +4798,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = I64Vec2::mul(_self, rhs) + let output: Val = bevy::math::I64Vec2::mul( + _self, + rhs, + ) .into(); output }, @@ -3896,7 +4809,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec2::sub(_self, rhs) + let output: Val = bevy::math::I64Vec2::sub( + _self, + rhs, + ) .into(); output }, @@ -3904,16 +4820,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = I64Vec2::div(_self, rhs) + let output: Val = bevy::math::I64Vec2::div( + _self, + rhs, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = I64Vec3::add(_self, rhs) + let output: Val = bevy::math::I64Vec3::add( + _self, + rhs, + ) .into(); output }, @@ -3921,7 +4843,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = I64Vec3::div(_self, rhs) + let output: Val = bevy::math::I64Vec3::div( + _self, + rhs, + ) .into(); output }, @@ -3929,7 +4854,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::div(_self, rhs) + let output: Val = bevy::math::I64Vec3::div( + _self, + rhs, + ) .into(); output }, @@ -3937,7 +4865,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::add(_self, rhs) + let output: Val = bevy::math::I64Vec3::add( + _self, + rhs, + ) .into(); output }, @@ -3945,21 +4876,30 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = I64Vec3::neg(_self).into(); + let output: Val = bevy::math::I64Vec3::neg( + _self, + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = I64Vec3::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::I64Vec3::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = I64Vec3::mul(_self, rhs) + let output: Val = bevy::math::I64Vec3::mul( + _self, + rhs, + ) .into(); output }, @@ -3967,14 +4907,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = I64Vec3::eq(_self, other).into(); + let output: bool = bevy::math::I64Vec3::eq(_self, other).into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = I64Vec3::rem(_self, rhs) + let output: Val = bevy::math::I64Vec3::rem( + _self, + rhs, + ) .into(); output }, @@ -3982,7 +4925,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = I64Vec3::mul(_self, rhs) + let output: Val = bevy::math::I64Vec3::mul( + _self, + rhs, + ) .into(); output }, @@ -3990,7 +4936,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::sub(_self, rhs) + let output: Val = bevy::math::I64Vec3::sub( + _self, + rhs, + ) .into(); output }, @@ -3998,7 +4947,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = I64Vec3::rem(_self, rhs) + let output: Val = bevy::math::I64Vec3::rem( + _self, + rhs, + ) .into(); output }, @@ -4006,7 +4958,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::rem(_self, rhs) + let output: Val = bevy::math::I64Vec3::rem( + _self, + rhs, + ) .into(); output }, @@ -4014,7 +4969,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = I64Vec3::add(_self, rhs) + let output: Val = bevy::math::I64Vec3::add( + _self, + rhs, + ) .into(); output }, @@ -4022,7 +4980,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = I64Vec3::sub(_self, rhs) + let output: Val = bevy::math::I64Vec3::sub( + _self, + rhs, + ) .into(); output }, @@ -4030,7 +4991,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = I64Vec3::div(_self, rhs) + let output: Val = bevy::math::I64Vec3::div( + _self, + rhs, + ) .into(); output }, @@ -4038,7 +5002,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::mul(_self, rhs) + let output: Val = bevy::math::I64Vec3::mul( + _self, + rhs, + ) .into(); output }, @@ -4046,14 +5013,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64, z: i64| { - let output: Val = I64Vec3::new(x, y, z).into(); + let output: Val = bevy::math::I64Vec3::new( + x, + y, + z, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: i64| { - let output: Val = I64Vec3::splat(v).into(); + let output: Val = bevy::math::I64Vec3::splat(v) + .into(); output }, ) @@ -4064,7 +5037,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = I64Vec3::select( + let output: Val = bevy::math::I64Vec3::select( mask, if_true, if_false, @@ -4076,21 +5049,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 3]| { - let output: Val = I64Vec3::from_array(a).into(); + let output: Val = bevy::math::I64Vec3::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 3] = I64Vec3::to_array(_self).into(); + let output: [i64; 3] = bevy::math::I64Vec3::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: i64| { - let output: Val = I64Vec3::extend(_self, w) + let output: Val = bevy::math::I64Vec3::extend( + _self, + w, + ) .into(); output }, @@ -4098,7 +5077,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = I64Vec3::truncate(_self) + let output: Val = bevy::math::I64Vec3::truncate( + _self, + ) .into(); output }, @@ -4106,7 +5087,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = I64Vec3::with_x(_self, x) + let output: Val = bevy::math::I64Vec3::with_x( + _self, + x, + ) .into(); output }, @@ -4114,7 +5098,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = I64Vec3::with_y(_self, y) + let output: Val = bevy::math::I64Vec3::with_y( + _self, + y, + ) .into(); output }, @@ -4122,7 +5109,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i64| { - let output: Val = I64Vec3::with_z(_self, z) + let output: Val = bevy::math::I64Vec3::with_z( + _self, + z, + ) .into(); output }, @@ -4130,14 +5120,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = I64Vec3::dot(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec3::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::dot_into_vec( + let output: Val = bevy::math::I64Vec3::dot_into_vec( _self, rhs, ) @@ -4148,7 +5138,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cross(_self, rhs) + let output: Val = bevy::math::I64Vec3::cross( + _self, + rhs, + ) .into(); output }, @@ -4156,7 +5149,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::min(_self, rhs) + let output: Val = bevy::math::I64Vec3::min( + _self, + rhs, + ) .into(); output }, @@ -4164,7 +5160,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::max(_self, rhs) + let output: Val = bevy::math::I64Vec3::max( + _self, + rhs, + ) .into(); output }, @@ -4176,7 +5175,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = I64Vec3::clamp( + let output: Val = bevy::math::I64Vec3::clamp( _self, min, max, @@ -4188,35 +5187,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = I64Vec3::min_element(_self).into(); + let output: i64 = bevy::math::I64Vec3::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = I64Vec3::max_element(_self).into(); + let output: i64 = bevy::math::I64Vec3::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = I64Vec3::element_sum(_self).into(); + let output: i64 = bevy::math::I64Vec3::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = I64Vec3::element_product(_self).into(); + let output: i64 = bevy::math::I64Vec3::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cmpeq(_self, rhs) + let output: Val = bevy::math::I64Vec3::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -4224,7 +5226,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cmpne(_self, rhs) + let output: Val = bevy::math::I64Vec3::cmpne( + _self, + rhs, + ) .into(); output }, @@ -4232,7 +5237,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cmpge(_self, rhs) + let output: Val = bevy::math::I64Vec3::cmpge( + _self, + rhs, + ) .into(); output }, @@ -4240,7 +5248,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cmpgt(_self, rhs) + let output: Val = bevy::math::I64Vec3::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -4248,7 +5259,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cmple(_self, rhs) + let output: Val = bevy::math::I64Vec3::cmple( + _self, + rhs, + ) .into(); output }, @@ -4256,7 +5270,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::cmplt(_self, rhs) + let output: Val = bevy::math::I64Vec3::cmplt( + _self, + rhs, + ) .into(); output }, @@ -4264,42 +5281,50 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = I64Vec3::abs(_self).into(); + let output: Val = bevy::math::I64Vec3::abs( + _self, + ) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = I64Vec3::signum(_self).into(); + let output: Val = bevy::math::I64Vec3::signum( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = I64Vec3::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::I64Vec3::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = I64Vec3::length_squared(_self).into(); + let output: i64 = bevy::math::I64Vec3::length_squared(_self).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = I64Vec3::distance_squared(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec3::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::div_euclid( + let output: Val = bevy::math::I64Vec3::div_euclid( _self, rhs, ) @@ -4310,7 +5335,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::rem_euclid( + let output: Val = bevy::math::I64Vec3::rem_euclid( _self, rhs, ) @@ -4321,42 +5346,59 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = I64Vec3::as_vec3(_self).into(); + let output: Val = bevy::math::I64Vec3::as_vec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = I64Vec3::as_vec3a(_self).into(); + let output: Val = bevy::math::I64Vec3::as_vec3a( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = I64Vec3::as_dvec3(_self).into(); + let output: Val = bevy::math::I64Vec3::as_dvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = I64Vec3::as_ivec3(_self).into(); + let output: Val = bevy::math::I64Vec3::as_ivec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = I64Vec3::as_uvec3(_self).into(); + let output: Val = bevy::math::I64Vec3::as_uvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = I64Vec3::as_u64vec3(_self) + let output: Val = bevy::math::I64Vec3::as_u64vec3( + _self, + ) .into(); output }, @@ -4364,7 +5406,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::wrapping_add( + let output: Val = bevy::math::I64Vec3::wrapping_add( _self, rhs, ) @@ -4375,7 +5417,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::wrapping_sub( + let output: Val = bevy::math::I64Vec3::wrapping_sub( _self, rhs, ) @@ -4386,7 +5428,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::wrapping_mul( + let output: Val = bevy::math::I64Vec3::wrapping_mul( _self, rhs, ) @@ -4397,7 +5439,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::wrapping_div( + let output: Val = bevy::math::I64Vec3::wrapping_div( _self, rhs, ) @@ -4408,7 +5450,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::saturating_add( + let output: Val = bevy::math::I64Vec3::saturating_add( _self, rhs, ) @@ -4419,7 +5461,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::saturating_sub( + let output: Val = bevy::math::I64Vec3::saturating_sub( _self, rhs, ) @@ -4430,7 +5472,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::saturating_mul( + let output: Val = bevy::math::I64Vec3::saturating_mul( _self, rhs, ) @@ -4441,7 +5483,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::saturating_div( + let output: Val = bevy::math::I64Vec3::saturating_div( _self, rhs, ) @@ -4452,7 +5494,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::wrapping_add_unsigned( + let output: Val = bevy::math::I64Vec3::wrapping_add_unsigned( _self, rhs, ) @@ -4463,7 +5505,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::wrapping_sub_unsigned( + let output: Val = bevy::math::I64Vec3::wrapping_sub_unsigned( _self, rhs, ) @@ -4474,7 +5516,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::saturating_add_unsigned( + let output: Val = bevy::math::I64Vec3::saturating_add_unsigned( _self, rhs, ) @@ -4485,7 +5527,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec3::saturating_sub_unsigned( + let output: Val = bevy::math::I64Vec3::saturating_sub_unsigned( _self, rhs, ) @@ -4496,7 +5538,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = I64Vec3::sub(_self, rhs) + let output: Val = bevy::math::I64Vec3::sub( + _self, + rhs, + ) .into(); output }, @@ -4504,15 +5549,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = I64Vec3::clone(_self).into(); + let output: Val = bevy::math::I64Vec3::clone( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = I64Vec4::sub(_self, rhs) + let output: Val = bevy::math::I64Vec4::sub( + _self, + rhs, + ) .into(); output }, @@ -4520,14 +5571,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = I64Vec4::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::I64Vec4::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = I64Vec4::add(_self, rhs) + let output: Val = bevy::math::I64Vec4::add( + _self, + rhs, + ) .into(); output }, @@ -4535,7 +5592,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = I64Vec4::rem(_self, rhs) + let output: Val = bevy::math::I64Vec4::rem( + _self, + rhs, + ) .into(); output }, @@ -4543,7 +5603,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::add(_self, rhs) + let output: Val = bevy::math::I64Vec4::add( + _self, + rhs, + ) .into(); output }, @@ -4551,14 +5614,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = I64Vec4::clone(_self).into(); + let output: Val = bevy::math::I64Vec4::clone( + _self, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = I64Vec4::div(_self, rhs) + let output: Val = bevy::math::I64Vec4::div( + _self, + rhs, + ) .into(); output }, @@ -4566,7 +5635,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = I64Vec4::sub(_self, rhs) + let output: Val = bevy::math::I64Vec4::sub( + _self, + rhs, + ) .into(); output }, @@ -4574,15 +5646,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::div(_self, rhs) - .into(); + let output: Val = bevy::math::I64Vec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = I64Vec4::add(_self, rhs) + let output: Val = bevy::math::I64Vec4::add( + _self, + rhs, + ) .into(); output }, @@ -4590,14 +5668,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = I64Vec4::eq(_self, other).into(); + let output: bool = bevy::math::I64Vec4::eq(_self, other).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = I64Vec4::mul(_self, rhs) + let output: Val = bevy::math::I64Vec4::mul( + _self, + rhs, + ) .into(); output }, @@ -4605,7 +5686,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = I64Vec4::mul(_self, rhs) + let output: Val = bevy::math::I64Vec4::mul( + _self, + rhs, + ) .into(); output }, @@ -4613,7 +5697,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::mul(_self, rhs) + let output: Val = bevy::math::I64Vec4::mul( + _self, + rhs, + ) .into(); output }, @@ -4621,7 +5708,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = I64Vec4::rem(_self, rhs) + let output: Val = bevy::math::I64Vec4::rem( + _self, + rhs, + ) .into(); output }, @@ -4629,7 +5719,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::rem(_self, rhs) + let output: Val = bevy::math::I64Vec4::rem( + _self, + rhs, + ) .into(); output }, @@ -4637,7 +5730,12 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64, z: i64, w: i64| { - let output: Val = I64Vec4::new(x, y, z, w) + let output: Val = bevy::math::I64Vec4::new( + x, + y, + z, + w, + ) .into(); output }, @@ -4645,7 +5743,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = I64Vec4::splat(v).into(); + let output: Val = bevy::math::I64Vec4::splat(v) + .into(); output }, ) @@ -4656,7 +5755,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = I64Vec4::select( + let output: Val = bevy::math::I64Vec4::select( mask, if_true, if_false, @@ -4668,21 +5767,26 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 4]| { - let output: Val = I64Vec4::from_array(a).into(); + let output: Val = bevy::math::I64Vec4::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 4] = I64Vec4::to_array(_self).into(); + let output: [i64; 4] = bevy::math::I64Vec4::to_array(_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = I64Vec4::truncate(_self) + let output: Val = bevy::math::I64Vec4::truncate( + _self, + ) .into(); output }, @@ -4690,7 +5794,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = I64Vec4::with_x(_self, x) + let output: Val = bevy::math::I64Vec4::with_x( + _self, + x, + ) .into(); output }, @@ -4698,7 +5805,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = I64Vec4::with_y(_self, y) + let output: Val = bevy::math::I64Vec4::with_y( + _self, + y, + ) .into(); output }, @@ -4706,7 +5816,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i64| { - let output: Val = I64Vec4::with_z(_self, z) + let output: Val = bevy::math::I64Vec4::with_z( + _self, + z, + ) .into(); output }, @@ -4714,7 +5827,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: i64| { - let output: Val = I64Vec4::with_w(_self, w) + let output: Val = bevy::math::I64Vec4::with_w( + _self, + w, + ) .into(); output }, @@ -4722,14 +5838,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = I64Vec4::dot(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec4::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::dot_into_vec( + let output: Val = bevy::math::I64Vec4::dot_into_vec( _self, rhs, ) @@ -4740,7 +5856,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::min(_self, rhs) + let output: Val = bevy::math::I64Vec4::min( + _self, + rhs, + ) .into(); output }, @@ -4748,7 +5867,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::max(_self, rhs) + let output: Val = bevy::math::I64Vec4::max( + _self, + rhs, + ) .into(); output }, @@ -4760,7 +5882,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = I64Vec4::clamp( + let output: Val = bevy::math::I64Vec4::clamp( _self, min, max, @@ -4772,35 +5894,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = I64Vec4::min_element(_self).into(); + let output: i64 = bevy::math::I64Vec4::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = I64Vec4::max_element(_self).into(); + let output: i64 = bevy::math::I64Vec4::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = I64Vec4::element_sum(_self).into(); + let output: i64 = bevy::math::I64Vec4::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = I64Vec4::element_product(_self).into(); + let output: i64 = bevy::math::I64Vec4::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::cmpeq(_self, rhs) + let output: Val = bevy::math::I64Vec4::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -4808,7 +5933,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::cmpne(_self, rhs) + let output: Val = bevy::math::I64Vec4::cmpne( + _self, + rhs, + ) .into(); output }, @@ -4816,7 +5944,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::cmpge(_self, rhs) + let output: Val = bevy::math::I64Vec4::cmpge( + _self, + rhs, + ) .into(); output }, @@ -4824,7 +5955,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::cmpgt(_self, rhs) + let output: Val = bevy::math::I64Vec4::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -4832,7 +5966,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::cmple(_self, rhs) + let output: Val = bevy::math::I64Vec4::cmple( + _self, + rhs, + ) .into(); output }, @@ -4840,7 +5977,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::cmplt(_self, rhs) + let output: Val = bevy::math::I64Vec4::cmplt( + _self, + rhs, + ) .into(); output }, @@ -4848,42 +5988,50 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = I64Vec4::abs(_self).into(); + let output: Val = bevy::math::I64Vec4::abs( + _self, + ) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = I64Vec4::signum(_self).into(); + let output: Val = bevy::math::I64Vec4::signum( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = I64Vec4::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::I64Vec4::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = I64Vec4::length_squared(_self).into(); + let output: i64 = bevy::math::I64Vec4::length_squared(_self).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = I64Vec4::distance_squared(_self, rhs).into(); + let output: i64 = bevy::math::I64Vec4::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::div_euclid( + let output: Val = bevy::math::I64Vec4::div_euclid( _self, rhs, ) @@ -4894,7 +6042,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::rem_euclid( + let output: Val = bevy::math::I64Vec4::rem_euclid( _self, rhs, ) @@ -4905,35 +6053,49 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = I64Vec4::as_vec4(_self).into(); + let output: Val = bevy::math::I64Vec4::as_vec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = I64Vec4::as_dvec4(_self).into(); + let output: Val = bevy::math::I64Vec4::as_dvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = I64Vec4::as_ivec4(_self).into(); + let output: Val = bevy::math::I64Vec4::as_ivec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = I64Vec4::as_uvec4(_self).into(); + let output: Val = bevy::math::I64Vec4::as_uvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = I64Vec4::as_u64vec4(_self) + let output: Val = bevy::math::I64Vec4::as_u64vec4( + _self, + ) .into(); output }, @@ -4941,7 +6103,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::wrapping_add( + let output: Val = bevy::math::I64Vec4::wrapping_add( _self, rhs, ) @@ -4952,7 +6114,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::wrapping_sub( + let output: Val = bevy::math::I64Vec4::wrapping_sub( _self, rhs, ) @@ -4963,7 +6125,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::wrapping_mul( + let output: Val = bevy::math::I64Vec4::wrapping_mul( _self, rhs, ) @@ -4974,7 +6136,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::wrapping_div( + let output: Val = bevy::math::I64Vec4::wrapping_div( _self, rhs, ) @@ -4985,7 +6147,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::saturating_add( + let output: Val = bevy::math::I64Vec4::saturating_add( _self, rhs, ) @@ -4996,7 +6158,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::saturating_sub( + let output: Val = bevy::math::I64Vec4::saturating_sub( _self, rhs, ) @@ -5007,7 +6169,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::saturating_mul( + let output: Val = bevy::math::I64Vec4::saturating_mul( _self, rhs, ) @@ -5018,7 +6180,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::saturating_div( + let output: Val = bevy::math::I64Vec4::saturating_div( _self, rhs, ) @@ -5029,7 +6191,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::wrapping_add_unsigned( + let output: Val = bevy::math::I64Vec4::wrapping_add_unsigned( _self, rhs, ) @@ -5040,7 +6202,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::wrapping_sub_unsigned( + let output: Val = bevy::math::I64Vec4::wrapping_sub_unsigned( _self, rhs, ) @@ -5051,7 +6213,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::saturating_add_unsigned( + let output: Val = bevy::math::I64Vec4::saturating_add_unsigned( _self, rhs, ) @@ -5062,7 +6224,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::saturating_sub_unsigned( + let output: Val = bevy::math::I64Vec4::saturating_sub_unsigned( _self, rhs, ) @@ -5073,14 +6235,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = I64Vec4::neg(_self).into(); + let output: Val = bevy::math::I64Vec4::neg( + _self, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = I64Vec4::sub(_self, rhs) + let output: Val = bevy::math::I64Vec4::sub( + _self, + rhs, + ) .into(); output }, @@ -5088,93 +6256,133 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = I64Vec4::div(_self, rhs) + let output: Val = bevy::math::I64Vec4::div( + _self, + rhs, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = UVec2::div(_self, rhs).into(); + let output: Val = bevy::math::UVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = UVec2::add(_self, rhs).into(); + let output: Val = bevy::math::UVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = UVec2::div(_self, rhs).into(); + let output: Val = bevy::math::UVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = UVec2::add(_self, rhs).into(); + let output: Val = bevy::math::UVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = UVec2::add(_self, rhs).into(); + let output: Val = bevy::math::UVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = UVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = UVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = UVec2::div(_self, rhs).into(); + let output: Val = bevy::math::UVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = UVec2::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::UVec2::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = UVec2::eq(_self, other).into(); + let output: bool = bevy::math::UVec2::eq(_self, other).into(); output }, ) .overwrite_script_function( "new", |x: u32, y: u32| { - let output: Val = UVec2::new(x, y).into(); + let output: Val = bevy::math::UVec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: u32| { - let output: Val = UVec2::splat(v).into(); + let output: Val = bevy::math::UVec2::splat(v) + .into(); output }, ) @@ -5185,7 +6393,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = UVec2::select( + let output: Val = bevy::math::UVec2::select( mask, if_true, if_false, @@ -5197,49 +6405,65 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 2]| { - let output: Val = UVec2::from_array(a).into(); + let output: Val = bevy::math::UVec2::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 2] = UVec2::to_array(_self).into(); + let output: [u32; 2] = bevy::math::UVec2::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: u32| { - let output: Val = UVec2::extend(_self, z).into(); + let output: Val = bevy::math::UVec2::extend( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = UVec2::with_x(_self, x).into(); + let output: Val = bevy::math::UVec2::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = UVec2::with_y(_self, y).into(); + let output: Val = bevy::math::UVec2::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = UVec2::dot(_self, rhs).into(); + let output: u32 = bevy::math::UVec2::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = UVec2::dot_into_vec(_self, rhs) + let output: Val = bevy::math::UVec2::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -5247,14 +6471,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = UVec2::min(_self, rhs).into(); + let output: Val = bevy::math::UVec2::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = UVec2::max(_self, rhs).into(); + let output: Val = bevy::math::UVec2::max( + _self, + rhs, + ) + .into(); output }, ) @@ -5265,7 +6497,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = UVec2::clamp(_self, min, max) + let output: Val = bevy::math::UVec2::clamp( + _self, + min, + max, + ) .into(); output }, @@ -5273,105 +6509,138 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = UVec2::min_element(_self).into(); + let output: u32 = bevy::math::UVec2::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = UVec2::max_element(_self).into(); + let output: u32 = bevy::math::UVec2::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = UVec2::element_sum(_self).into(); + let output: u32 = bevy::math::UVec2::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = UVec2::element_product(_self).into(); + let output: u32 = bevy::math::UVec2::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = UVec2::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::UVec2::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = UVec2::cmpne(_self, rhs).into(); + let output: Val = bevy::math::UVec2::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = UVec2::cmpge(_self, rhs).into(); + let output: Val = bevy::math::UVec2::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = UVec2::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::UVec2::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = UVec2::cmple(_self, rhs).into(); + let output: Val = bevy::math::UVec2::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = UVec2::cmplt(_self, rhs).into(); + let output: Val = bevy::math::UVec2::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = UVec2::length_squared(_self).into(); + let output: u32 = bevy::math::UVec2::length_squared(_self).into(); output }, ) .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = UVec2::as_vec2(_self).into(); + let output: Val = bevy::math::UVec2::as_vec2(_self) + .into(); output }, ) .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = UVec2::as_dvec2(_self).into(); + let output: Val = bevy::math::UVec2::as_dvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = UVec2::as_ivec2(_self).into(); + let output: Val = bevy::math::UVec2::as_ivec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = UVec2::as_i64vec2(_self) + let output: Val = bevy::math::UVec2::as_i64vec2( + _self, + ) .into(); output }, @@ -5379,7 +6648,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = UVec2::as_u64vec2(_self) + let output: Val = bevy::math::UVec2::as_u64vec2( + _self, + ) .into(); output }, @@ -5387,7 +6658,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = UVec2::wrapping_add(_self, rhs) + let output: Val = bevy::math::UVec2::wrapping_add( + _self, + rhs, + ) .into(); output }, @@ -5395,7 +6669,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = UVec2::wrapping_sub(_self, rhs) + let output: Val = bevy::math::UVec2::wrapping_sub( + _self, + rhs, + ) .into(); output }, @@ -5403,7 +6680,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = UVec2::wrapping_mul(_self, rhs) + let output: Val = bevy::math::UVec2::wrapping_mul( + _self, + rhs, + ) .into(); output }, @@ -5411,7 +6691,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = UVec2::wrapping_div(_self, rhs) + let output: Val = bevy::math::UVec2::wrapping_div( + _self, + rhs, + ) .into(); output }, @@ -5419,7 +6702,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = UVec2::saturating_add( + let output: Val = bevy::math::UVec2::saturating_add( _self, rhs, ) @@ -5430,7 +6713,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = UVec2::saturating_sub( + let output: Val = bevy::math::UVec2::saturating_sub( _self, rhs, ) @@ -5441,7 +6724,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = UVec2::saturating_mul( + let output: Val = bevy::math::UVec2::saturating_mul( _self, rhs, ) @@ -5452,7 +6735,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = UVec2::saturating_div( + let output: Val = bevy::math::UVec2::saturating_div( _self, rhs, ) @@ -5463,7 +6746,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = UVec2::wrapping_add_signed( + let output: Val = bevy::math::UVec2::wrapping_add_signed( _self, rhs, ) @@ -5474,7 +6757,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = UVec2::saturating_add_signed( + let output: Val = bevy::math::UVec2::saturating_add_signed( _self, rhs, ) @@ -5485,92 +6768,135 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = UVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = UVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = UVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = UVec2::clone(_self).into(); + let output: Val = bevy::math::UVec2::clone(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = UVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = UVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = UVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = UVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec2::sub( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = UVec3::div(_self, rhs).into(); + let output: Val = bevy::math::UVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = UVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = UVec3::add(_self, rhs).into(); + let output: Val = bevy::math::UVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: u32, y: u32, z: u32| { - let output: Val = UVec3::new(x, y, z).into(); + let output: Val = bevy::math::UVec3::new(x, y, z) + .into(); output }, ) .overwrite_script_function( "splat", |v: u32| { - let output: Val = UVec3::splat(v).into(); + let output: Val = bevy::math::UVec3::splat(v) + .into(); output }, ) @@ -5581,7 +6907,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = UVec3::select( + let output: Val = bevy::math::UVec3::select( mask, if_true, if_false, @@ -5593,63 +6919,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 3]| { - let output: Val = UVec3::from_array(a).into(); + let output: Val = bevy::math::UVec3::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 3] = UVec3::to_array(_self).into(); + let output: [u32; 3] = bevy::math::UVec3::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: u32| { - let output: Val = UVec3::extend(_self, w).into(); + let output: Val = bevy::math::UVec3::extend( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = UVec3::truncate(_self).into(); + let output: Val = bevy::math::UVec3::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = UVec3::with_x(_self, x).into(); + let output: Val = bevy::math::UVec3::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = UVec3::with_y(_self, y).into(); + let output: Val = bevy::math::UVec3::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: u32| { - let output: Val = UVec3::with_z(_self, z).into(); + let output: Val = bevy::math::UVec3::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = UVec3::dot(_self, rhs).into(); + let output: u32 = bevy::math::UVec3::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = UVec3::dot_into_vec(_self, rhs) + let output: Val = bevy::math::UVec3::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -5657,21 +7006,33 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = UVec3::cross(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cross( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = UVec3::min(_self, rhs).into(); + let output: Val = bevy::math::UVec3::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = UVec3::max(_self, rhs).into(); + let output: Val = bevy::math::UVec3::max( + _self, + rhs, + ) + .into(); output }, ) @@ -5682,7 +7043,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = UVec3::clamp(_self, min, max) + let output: Val = bevy::math::UVec3::clamp( + _self, + min, + max, + ) .into(); output }, @@ -5690,112 +7055,148 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = UVec3::min_element(_self).into(); + let output: u32 = bevy::math::UVec3::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = UVec3::max_element(_self).into(); + let output: u32 = bevy::math::UVec3::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = UVec3::element_sum(_self).into(); + let output: u32 = bevy::math::UVec3::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = UVec3::element_product(_self).into(); + let output: u32 = bevy::math::UVec3::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = UVec3::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = UVec3::cmpne(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = UVec3::cmpge(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = UVec3::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = UVec3::cmple(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = UVec3::cmplt(_self, rhs).into(); + let output: Val = bevy::math::UVec3::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = UVec3::length_squared(_self).into(); + let output: u32 = bevy::math::UVec3::length_squared(_self).into(); output }, ) .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = UVec3::as_vec3(_self).into(); + let output: Val = bevy::math::UVec3::as_vec3(_self) + .into(); output }, ) .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = UVec3::as_vec3a(_self).into(); + let output: Val = bevy::math::UVec3::as_vec3a( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = UVec3::as_dvec3(_self).into(); + let output: Val = bevy::math::UVec3::as_dvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = UVec3::as_ivec3(_self).into(); + let output: Val = bevy::math::UVec3::as_ivec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = UVec3::as_i64vec3(_self) + let output: Val = bevy::math::UVec3::as_i64vec3( + _self, + ) .into(); output }, @@ -5803,7 +7204,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = UVec3::as_u64vec3(_self) + let output: Val = bevy::math::UVec3::as_u64vec3( + _self, + ) .into(); output }, @@ -5811,7 +7214,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = UVec3::wrapping_add(_self, rhs) + let output: Val = bevy::math::UVec3::wrapping_add( + _self, + rhs, + ) .into(); output }, @@ -5819,7 +7225,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = UVec3::wrapping_sub(_self, rhs) + let output: Val = bevy::math::UVec3::wrapping_sub( + _self, + rhs, + ) .into(); output }, @@ -5827,7 +7236,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = UVec3::wrapping_mul(_self, rhs) + let output: Val = bevy::math::UVec3::wrapping_mul( + _self, + rhs, + ) .into(); output }, @@ -5835,7 +7247,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = UVec3::wrapping_div(_self, rhs) + let output: Val = bevy::math::UVec3::wrapping_div( + _self, + rhs, + ) .into(); output }, @@ -5843,7 +7258,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = UVec3::saturating_add( + let output: Val = bevy::math::UVec3::saturating_add( _self, rhs, ) @@ -5854,7 +7269,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = UVec3::saturating_sub( + let output: Val = bevy::math::UVec3::saturating_sub( _self, rhs, ) @@ -5865,7 +7280,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = UVec3::saturating_mul( + let output: Val = bevy::math::UVec3::saturating_mul( _self, rhs, ) @@ -5876,7 +7291,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = UVec3::saturating_div( + let output: Val = bevy::math::UVec3::saturating_div( _self, rhs, ) @@ -5887,7 +7302,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = UVec3::wrapping_add_signed( + let output: Val = bevy::math::UVec3::wrapping_add_signed( _self, rhs, ) @@ -5898,7 +7313,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = UVec3::saturating_add_signed( + let output: Val = bevy::math::UVec3::saturating_add_signed( _self, rhs, ) @@ -5909,141 +7324,211 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = UVec3::add(_self, rhs).into(); + let output: Val = bevy::math::UVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = UVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = UVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = UVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = UVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = UVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = UVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = UVec3::div(_self, rhs).into(); + let output: Val = bevy::math::UVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = UVec3::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::UVec3::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = UVec3::add(_self, rhs).into(); + let output: Val = bevy::math::UVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = UVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = UVec3::clone(_self).into(); + let output: Val = bevy::math::UVec3::clone(_self) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = UVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = UVec3::eq(_self, other).into(); + let output: bool = bevy::math::UVec3::eq(_self, other).into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = UVec3::div(_self, rhs).into(); + let output: Val = bevy::math::UVec3::div( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = UVec4::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::UVec4::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = UVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = UVec4::add(_self, rhs).into(); + let output: Val = bevy::math::UVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: u32, y: u32, z: u32, w: u32| { - let output: Val = UVec4::new(x, y, z, w).into(); + let output: Val = bevy::math::UVec4::new( + x, + y, + z, + w, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: u32| { - let output: Val = UVec4::splat(v).into(); + let output: Val = bevy::math::UVec4::splat(v) + .into(); output }, ) @@ -6054,7 +7539,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = UVec4::select( + let output: Val = bevy::math::UVec4::select( mask, if_true, if_false, @@ -6066,63 +7551,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 4]| { - let output: Val = UVec4::from_array(a).into(); + let output: Val = bevy::math::UVec4::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 4] = UVec4::to_array(_self).into(); + let output: [u32; 4] = bevy::math::UVec4::to_array(_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = UVec4::truncate(_self).into(); + let output: Val = bevy::math::UVec4::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = UVec4::with_x(_self, x).into(); + let output: Val = bevy::math::UVec4::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = UVec4::with_y(_self, y).into(); + let output: Val = bevy::math::UVec4::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: u32| { - let output: Val = UVec4::with_z(_self, z).into(); + let output: Val = bevy::math::UVec4::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_w", |_self: Val, w: u32| { - let output: Val = UVec4::with_w(_self, w).into(); + let output: Val = bevy::math::UVec4::with_w( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = UVec4::dot(_self, rhs).into(); + let output: u32 = bevy::math::UVec4::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = UVec4::dot_into_vec(_self, rhs) + let output: Val = bevy::math::UVec4::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -6130,14 +7638,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = UVec4::min(_self, rhs).into(); + let output: Val = bevy::math::UVec4::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = UVec4::max(_self, rhs).into(); + let output: Val = bevy::math::UVec4::max( + _self, + rhs, + ) + .into(); output }, ) @@ -6148,7 +7664,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = UVec4::clamp(_self, min, max) + let output: Val = bevy::math::UVec4::clamp( + _self, + min, + max, + ) .into(); output }, @@ -6156,105 +7676,138 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = UVec4::min_element(_self).into(); + let output: u32 = bevy::math::UVec4::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = UVec4::max_element(_self).into(); + let output: u32 = bevy::math::UVec4::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = UVec4::element_sum(_self).into(); + let output: u32 = bevy::math::UVec4::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = UVec4::element_product(_self).into(); + let output: u32 = bevy::math::UVec4::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = UVec4::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::UVec4::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = UVec4::cmpne(_self, rhs).into(); + let output: Val = bevy::math::UVec4::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = UVec4::cmpge(_self, rhs).into(); + let output: Val = bevy::math::UVec4::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = UVec4::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::UVec4::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = UVec4::cmple(_self, rhs).into(); + let output: Val = bevy::math::UVec4::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = UVec4::cmplt(_self, rhs).into(); + let output: Val = bevy::math::UVec4::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = UVec4::length_squared(_self).into(); + let output: u32 = bevy::math::UVec4::length_squared(_self).into(); output }, ) .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = UVec4::as_vec4(_self).into(); + let output: Val = bevy::math::UVec4::as_vec4(_self) + .into(); output }, ) .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = UVec4::as_dvec4(_self).into(); + let output: Val = bevy::math::UVec4::as_dvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = UVec4::as_ivec4(_self).into(); + let output: Val = bevy::math::UVec4::as_ivec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = UVec4::as_i64vec4(_self) + let output: Val = bevy::math::UVec4::as_i64vec4( + _self, + ) .into(); output }, @@ -6262,7 +7815,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = UVec4::as_u64vec4(_self) + let output: Val = bevy::math::UVec4::as_u64vec4( + _self, + ) .into(); output }, @@ -6270,7 +7825,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = UVec4::wrapping_add(_self, rhs) + let output: Val = bevy::math::UVec4::wrapping_add( + _self, + rhs, + ) .into(); output }, @@ -6278,7 +7836,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = UVec4::wrapping_sub(_self, rhs) + let output: Val = bevy::math::UVec4::wrapping_sub( + _self, + rhs, + ) .into(); output }, @@ -6286,7 +7847,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = UVec4::wrapping_mul(_self, rhs) + let output: Val = bevy::math::UVec4::wrapping_mul( + _self, + rhs, + ) .into(); output }, @@ -6294,7 +7858,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = UVec4::wrapping_div(_self, rhs) + let output: Val = bevy::math::UVec4::wrapping_div( + _self, + rhs, + ) .into(); output }, @@ -6302,7 +7869,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = UVec4::saturating_add( + let output: Val = bevy::math::UVec4::saturating_add( _self, rhs, ) @@ -6313,7 +7880,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = UVec4::saturating_sub( + let output: Val = bevy::math::UVec4::saturating_sub( _self, rhs, ) @@ -6324,7 +7891,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = UVec4::saturating_mul( + let output: Val = bevy::math::UVec4::saturating_mul( _self, rhs, ) @@ -6335,7 +7902,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = UVec4::saturating_div( + let output: Val = bevy::math::UVec4::saturating_div( _self, rhs, ) @@ -6346,7 +7913,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = UVec4::wrapping_add_signed( + let output: Val = bevy::math::UVec4::wrapping_add_signed( _self, rhs, ) @@ -6357,7 +7924,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = UVec4::saturating_add_signed( + let output: Val = bevy::math::UVec4::saturating_add_signed( _self, rhs, ) @@ -6368,120 +7935,179 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = UVec4::clone(_self).into(); + let output: Val = bevy::math::UVec4::clone(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = UVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = UVec4::div(_self, rhs).into(); + let output: Val = bevy::math::UVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = UVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = UVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = UVec4::add(_self, rhs).into(); + let output: Val = bevy::math::UVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = UVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = UVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::UVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = UVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::UVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = UVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = UVec4::div(_self, rhs).into(); + let output: Val = bevy::math::UVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = UVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::UVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = UVec4::div(_self, rhs).into(); + let output: Val = bevy::math::UVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = UVec4::eq(_self, other).into(); + let output: bool = bevy::math::UVec4::eq(_self, other).into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = UVec4::add(_self, rhs).into(); + let output: Val = bevy::math::UVec4::add( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = U64Vec2::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::U64Vec2::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::sub(_self, rhs) + let output: Val = bevy::math::U64Vec2::sub( + _self, + rhs, + ) .into(); output }, @@ -6489,7 +8115,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = U64Vec2::add(_self, rhs) + let output: Val = bevy::math::U64Vec2::add( + _self, + rhs, + ) .into(); output }, @@ -6497,7 +8126,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = U64Vec2::rem(_self, rhs) + let output: Val = bevy::math::U64Vec2::rem( + _self, + rhs, + ) .into(); output }, @@ -6505,7 +8137,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = U64Vec2::sub(_self, rhs) + let output: Val = bevy::math::U64Vec2::sub( + _self, + rhs, + ) .into(); output }, @@ -6513,7 +8148,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = U64Vec2::div(_self, rhs) + let output: Val = bevy::math::U64Vec2::div( + _self, + rhs, + ) .into(); output }, @@ -6521,7 +8159,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = U64Vec2::div(_self, rhs) + let output: Val = bevy::math::U64Vec2::div( + _self, + rhs, + ) .into(); output }, @@ -6529,7 +8170,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::div(_self, rhs) + let output: Val = bevy::math::U64Vec2::div( + _self, + rhs, + ) .into(); output }, @@ -6537,7 +8181,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = U64Vec2::rem(_self, rhs) + let output: Val = bevy::math::U64Vec2::rem( + _self, + rhs, + ) .into(); output }, @@ -6545,7 +8192,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = U64Vec2::sub(_self, rhs) + let output: Val = bevy::math::U64Vec2::sub( + _self, + rhs, + ) .into(); output }, @@ -6553,7 +8203,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = U64Vec2::mul(_self, rhs) + let output: Val = bevy::math::U64Vec2::mul( + _self, + rhs, + ) .into(); output }, @@ -6561,21 +8214,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = U64Vec2::eq(_self, other).into(); + let output: bool = bevy::math::U64Vec2::eq(_self, other).into(); output }, ) .overwrite_script_function( "new", |x: u64, y: u64| { - let output: Val = U64Vec2::new(x, y).into(); + let output: Val = bevy::math::U64Vec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: u64| { - let output: Val = U64Vec2::splat(v).into(); + let output: Val = bevy::math::U64Vec2::splat(v) + .into(); output }, ) @@ -6586,7 +8241,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = U64Vec2::select( + let output: Val = bevy::math::U64Vec2::select( mask, if_true, if_false, @@ -6598,21 +8253,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 2]| { - let output: Val = U64Vec2::from_array(a).into(); + let output: Val = bevy::math::U64Vec2::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 2] = U64Vec2::to_array(_self).into(); + let output: [u64; 2] = bevy::math::U64Vec2::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: u64| { - let output: Val = U64Vec2::extend(_self, z) + let output: Val = bevy::math::U64Vec2::extend( + _self, + z, + ) .into(); output }, @@ -6620,7 +8281,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = U64Vec2::with_x(_self, x) + let output: Val = bevy::math::U64Vec2::with_x( + _self, + x, + ) .into(); output }, @@ -6628,7 +8292,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = U64Vec2::with_y(_self, y) + let output: Val = bevy::math::U64Vec2::with_y( + _self, + y, + ) .into(); output }, @@ -6636,14 +8303,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = U64Vec2::dot(_self, rhs).into(); + let output: u64 = bevy::math::U64Vec2::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::dot_into_vec( + let output: Val = bevy::math::U64Vec2::dot_into_vec( _self, rhs, ) @@ -6654,7 +8321,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::min(_self, rhs) + let output: Val = bevy::math::U64Vec2::min( + _self, + rhs, + ) .into(); output }, @@ -6662,7 +8332,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::max(_self, rhs) + let output: Val = bevy::math::U64Vec2::max( + _self, + rhs, + ) .into(); output }, @@ -6674,7 +8347,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = U64Vec2::clamp( + let output: Val = bevy::math::U64Vec2::clamp( _self, min, max, @@ -6686,35 +8359,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = U64Vec2::min_element(_self).into(); + let output: u64 = bevy::math::U64Vec2::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = U64Vec2::max_element(_self).into(); + let output: u64 = bevy::math::U64Vec2::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = U64Vec2::element_sum(_self).into(); + let output: u64 = bevy::math::U64Vec2::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = U64Vec2::element_product(_self).into(); + let output: u64 = bevy::math::U64Vec2::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::cmpeq(_self, rhs) + let output: Val = bevy::math::U64Vec2::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -6722,7 +8398,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::cmpne(_self, rhs) + let output: Val = bevy::math::U64Vec2::cmpne( + _self, + rhs, + ) .into(); output }, @@ -6730,7 +8409,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::cmpge(_self, rhs) + let output: Val = bevy::math::U64Vec2::cmpge( + _self, + rhs, + ) .into(); output }, @@ -6738,7 +8420,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::cmpgt(_self, rhs) + let output: Val = bevy::math::U64Vec2::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -6746,7 +8431,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::cmple(_self, rhs) + let output: Val = bevy::math::U64Vec2::cmple( + _self, + rhs, + ) .into(); output }, @@ -6754,7 +8442,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::cmplt(_self, rhs) + let output: Val = bevy::math::U64Vec2::cmplt( + _self, + rhs, + ) .into(); output }, @@ -6762,42 +8453,56 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = U64Vec2::length_squared(_self).into(); + let output: u64 = bevy::math::U64Vec2::length_squared(_self).into(); output }, ) .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = U64Vec2::as_vec2(_self).into(); + let output: Val = bevy::math::U64Vec2::as_vec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = U64Vec2::as_dvec2(_self).into(); + let output: Val = bevy::math::U64Vec2::as_dvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = U64Vec2::as_ivec2(_self).into(); + let output: Val = bevy::math::U64Vec2::as_ivec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = U64Vec2::as_uvec2(_self).into(); + let output: Val = bevy::math::U64Vec2::as_uvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = U64Vec2::as_i64vec2(_self) + let output: Val = bevy::math::U64Vec2::as_i64vec2( + _self, + ) .into(); output }, @@ -6805,7 +8510,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::wrapping_add( + let output: Val = bevy::math::U64Vec2::wrapping_add( _self, rhs, ) @@ -6816,7 +8521,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::wrapping_sub( + let output: Val = bevy::math::U64Vec2::wrapping_sub( _self, rhs, ) @@ -6827,7 +8532,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::wrapping_mul( + let output: Val = bevy::math::U64Vec2::wrapping_mul( _self, rhs, ) @@ -6838,7 +8543,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::wrapping_div( + let output: Val = bevy::math::U64Vec2::wrapping_div( _self, rhs, ) @@ -6849,7 +8554,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::saturating_add( + let output: Val = bevy::math::U64Vec2::saturating_add( _self, rhs, ) @@ -6860,7 +8565,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::saturating_sub( + let output: Val = bevy::math::U64Vec2::saturating_sub( _self, rhs, ) @@ -6871,7 +8576,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::saturating_mul( + let output: Val = bevy::math::U64Vec2::saturating_mul( _self, rhs, ) @@ -6882,7 +8587,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::saturating_div( + let output: Val = bevy::math::U64Vec2::saturating_div( _self, rhs, ) @@ -6893,7 +8598,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::wrapping_add_signed( + let output: Val = bevy::math::U64Vec2::wrapping_add_signed( _self, rhs, ) @@ -6904,7 +8609,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::saturating_add_signed( + let output: Val = bevy::math::U64Vec2::saturating_add_signed( _self, rhs, ) @@ -6915,7 +8620,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = U64Vec2::mul(_self, rhs) + let output: Val = bevy::math::U64Vec2::mul( + _self, + rhs, + ) .into(); output }, @@ -6923,14 +8631,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = U64Vec2::clone(_self).into(); + let output: Val = bevy::math::U64Vec2::clone( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::mul(_self, rhs) + let output: Val = bevy::math::U64Vec2::mul( + _self, + rhs, + ) .into(); output }, @@ -6938,7 +8652,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::add(_self, rhs) + let output: Val = bevy::math::U64Vec2::add( + _self, + rhs, + ) .into(); output }, @@ -6946,7 +8663,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = U64Vec2::rem(_self, rhs) + let output: Val = bevy::math::U64Vec2::rem( + _self, + rhs, + ) .into(); output }, @@ -6954,16 +8674,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = U64Vec2::add(_self, rhs) + let output: Val = bevy::math::U64Vec2::add( + _self, + rhs, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::mul(_self, rhs) + let output: Val = bevy::math::U64Vec3::mul( + _self, + rhs, + ) .into(); output }, @@ -6971,7 +8697,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = U64Vec3::sub(_self, rhs) + let output: Val = bevy::math::U64Vec3::sub( + _self, + rhs, + ) .into(); output }, @@ -6979,7 +8708,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = U64Vec3::div(_self, rhs) + let output: Val = bevy::math::U64Vec3::div( + _self, + rhs, + ) .into(); output }, @@ -6987,7 +8719,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::rem(_self, rhs) + let output: Val = bevy::math::U64Vec3::rem( + _self, + rhs, + ) .into(); output }, @@ -6995,7 +8730,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::div(_self, rhs) + let output: Val = bevy::math::U64Vec3::div( + _self, + rhs, + ) .into(); output }, @@ -7003,7 +8741,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = U64Vec3::div(_self, rhs) + let output: Val = bevy::math::U64Vec3::div( + _self, + rhs, + ) .into(); output }, @@ -7011,7 +8752,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = U64Vec3::mul(_self, rhs) + let output: Val = bevy::math::U64Vec3::mul( + _self, + rhs, + ) .into(); output }, @@ -7019,7 +8763,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = U64Vec3::mul(_self, rhs) + let output: Val = bevy::math::U64Vec3::mul( + _self, + rhs, + ) .into(); output }, @@ -7027,7 +8774,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = U64Vec3::rem(_self, rhs) + let output: Val = bevy::math::U64Vec3::rem( + _self, + rhs, + ) .into(); output }, @@ -7035,7 +8785,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::add(_self, rhs) + let output: Val = bevy::math::U64Vec3::add( + _self, + rhs, + ) .into(); output }, @@ -7043,7 +8796,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = U64Vec3::add(_self, rhs) + let output: Val = bevy::math::U64Vec3::add( + _self, + rhs, + ) .into(); output }, @@ -7051,7 +8807,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::sub(_self, rhs) + let output: Val = bevy::math::U64Vec3::sub( + _self, + rhs, + ) .into(); output }, @@ -7059,7 +8818,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = U64Vec3::sub(_self, rhs) + let output: Val = bevy::math::U64Vec3::sub( + _self, + rhs, + ) .into(); output }, @@ -7067,14 +8829,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64, z: u64| { - let output: Val = U64Vec3::new(x, y, z).into(); + let output: Val = bevy::math::U64Vec3::new( + x, + y, + z, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: u64| { - let output: Val = U64Vec3::splat(v).into(); + let output: Val = bevy::math::U64Vec3::splat(v) + .into(); output }, ) @@ -7085,7 +8853,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = U64Vec3::select( + let output: Val = bevy::math::U64Vec3::select( mask, if_true, if_false, @@ -7097,21 +8865,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 3]| { - let output: Val = U64Vec3::from_array(a).into(); + let output: Val = bevy::math::U64Vec3::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 3] = U64Vec3::to_array(_self).into(); + let output: [u64; 3] = bevy::math::U64Vec3::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: u64| { - let output: Val = U64Vec3::extend(_self, w) + let output: Val = bevy::math::U64Vec3::extend( + _self, + w, + ) .into(); output }, @@ -7119,7 +8893,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = U64Vec3::truncate(_self) + let output: Val = bevy::math::U64Vec3::truncate( + _self, + ) .into(); output }, @@ -7127,7 +8903,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = U64Vec3::with_x(_self, x) + let output: Val = bevy::math::U64Vec3::with_x( + _self, + x, + ) .into(); output }, @@ -7135,7 +8914,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = U64Vec3::with_y(_self, y) + let output: Val = bevy::math::U64Vec3::with_y( + _self, + y, + ) .into(); output }, @@ -7143,7 +8925,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u64| { - let output: Val = U64Vec3::with_z(_self, z) + let output: Val = bevy::math::U64Vec3::with_z( + _self, + z, + ) .into(); output }, @@ -7151,14 +8936,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = U64Vec3::dot(_self, rhs).into(); + let output: u64 = bevy::math::U64Vec3::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::dot_into_vec( + let output: Val = bevy::math::U64Vec3::dot_into_vec( _self, rhs, ) @@ -7169,7 +8954,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cross(_self, rhs) + let output: Val = bevy::math::U64Vec3::cross( + _self, + rhs, + ) .into(); output }, @@ -7177,7 +8965,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::min(_self, rhs) + let output: Val = bevy::math::U64Vec3::min( + _self, + rhs, + ) .into(); output }, @@ -7185,7 +8976,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::max(_self, rhs) + let output: Val = bevy::math::U64Vec3::max( + _self, + rhs, + ) .into(); output }, @@ -7197,7 +8991,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = U64Vec3::clamp( + let output: Val = bevy::math::U64Vec3::clamp( _self, min, max, @@ -7209,35 +9003,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = U64Vec3::min_element(_self).into(); + let output: u64 = bevy::math::U64Vec3::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = U64Vec3::max_element(_self).into(); + let output: u64 = bevy::math::U64Vec3::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = U64Vec3::element_sum(_self).into(); + let output: u64 = bevy::math::U64Vec3::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = U64Vec3::element_product(_self).into(); + let output: u64 = bevy::math::U64Vec3::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cmpeq(_self, rhs) + let output: Val = bevy::math::U64Vec3::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -7245,7 +9042,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cmpne(_self, rhs) + let output: Val = bevy::math::U64Vec3::cmpne( + _self, + rhs, + ) .into(); output }, @@ -7253,7 +9053,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cmpge(_self, rhs) + let output: Val = bevy::math::U64Vec3::cmpge( + _self, + rhs, + ) .into(); output }, @@ -7261,7 +9064,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cmpgt(_self, rhs) + let output: Val = bevy::math::U64Vec3::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -7269,7 +9075,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cmple(_self, rhs) + let output: Val = bevy::math::U64Vec3::cmple( + _self, + rhs, + ) .into(); output }, @@ -7277,7 +9086,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::cmplt(_self, rhs) + let output: Val = bevy::math::U64Vec3::cmplt( + _self, + rhs, + ) .into(); output }, @@ -7285,49 +9097,66 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = U64Vec3::length_squared(_self).into(); + let output: u64 = bevy::math::U64Vec3::length_squared(_self).into(); output }, ) .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = U64Vec3::as_vec3(_self).into(); + let output: Val = bevy::math::U64Vec3::as_vec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = U64Vec3::as_vec3a(_self).into(); + let output: Val = bevy::math::U64Vec3::as_vec3a( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = U64Vec3::as_dvec3(_self).into(); + let output: Val = bevy::math::U64Vec3::as_dvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = U64Vec3::as_ivec3(_self).into(); + let output: Val = bevy::math::U64Vec3::as_ivec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = U64Vec3::as_uvec3(_self).into(); + let output: Val = bevy::math::U64Vec3::as_uvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = U64Vec3::as_i64vec3(_self) + let output: Val = bevy::math::U64Vec3::as_i64vec3( + _self, + ) .into(); output }, @@ -7335,7 +9164,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::wrapping_add( + let output: Val = bevy::math::U64Vec3::wrapping_add( _self, rhs, ) @@ -7346,7 +9175,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::wrapping_sub( + let output: Val = bevy::math::U64Vec3::wrapping_sub( _self, rhs, ) @@ -7357,7 +9186,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::wrapping_mul( + let output: Val = bevy::math::U64Vec3::wrapping_mul( _self, rhs, ) @@ -7368,7 +9197,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::wrapping_div( + let output: Val = bevy::math::U64Vec3::wrapping_div( _self, rhs, ) @@ -7379,7 +9208,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::saturating_add( + let output: Val = bevy::math::U64Vec3::saturating_add( _self, rhs, ) @@ -7390,7 +9219,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::saturating_sub( + let output: Val = bevy::math::U64Vec3::saturating_sub( _self, rhs, ) @@ -7401,7 +9230,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::saturating_mul( + let output: Val = bevy::math::U64Vec3::saturating_mul( _self, rhs, ) @@ -7412,7 +9241,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::saturating_div( + let output: Val = bevy::math::U64Vec3::saturating_div( _self, rhs, ) @@ -7423,7 +9252,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::wrapping_add_signed( + let output: Val = bevy::math::U64Vec3::wrapping_add_signed( _self, rhs, ) @@ -7434,7 +9263,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = U64Vec3::saturating_add_signed( + let output: Val = bevy::math::U64Vec3::saturating_add_signed( _self, rhs, ) @@ -7445,7 +9274,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = U64Vec3::rem(_self, rhs) + let output: Val = bevy::math::U64Vec3::rem( + _self, + rhs, + ) .into(); output }, @@ -7453,7 +9285,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = U64Vec3::add(_self, rhs) + let output: Val = bevy::math::U64Vec3::add( + _self, + rhs, + ) .into(); output }, @@ -7461,29 +9296,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = U64Vec3::eq(_self, other).into(); + let output: bool = bevy::math::U64Vec3::eq(_self, other).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = U64Vec3::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::U64Vec3::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = U64Vec3::clone(_self).into(); + let output: Val = bevy::math::U64Vec3::clone( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::rem(_self, rhs) + let output: Val = bevy::math::U64Vec4::rem( + _self, + rhs, + ) .into(); output }, @@ -7491,7 +9335,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = U64Vec4::mul(_self, rhs) + let output: Val = bevy::math::U64Vec4::mul( + _self, + rhs, + ) .into(); output }, @@ -7499,7 +9346,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::sub(_self, rhs) + let output: Val = bevy::math::U64Vec4::sub( + _self, + rhs, + ) .into(); output }, @@ -7507,7 +9357,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = U64Vec4::rem(_self, rhs) + let output: Val = bevy::math::U64Vec4::rem( + _self, + rhs, + ) .into(); output }, @@ -7515,28 +9368,37 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = U64Vec4::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::U64Vec4::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = U64Vec4::eq(_self, other).into(); + let output: bool = bevy::math::U64Vec4::eq(_self, other).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = U64Vec4::clone(_self).into(); + let output: Val = bevy::math::U64Vec4::clone( + _self, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::div(_self, rhs) + let output: Val = bevy::math::U64Vec4::div( + _self, + rhs, + ) .into(); output }, @@ -7544,7 +9406,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = U64Vec4::div(_self, rhs) + let output: Val = bevy::math::U64Vec4::div( + _self, + rhs, + ) .into(); output }, @@ -7552,7 +9417,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::add(_self, rhs) + let output: Val = bevy::math::U64Vec4::add( + _self, + rhs, + ) .into(); output }, @@ -7560,7 +9428,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::mul(_self, rhs) + let output: Val = bevy::math::U64Vec4::mul( + _self, + rhs, + ) .into(); output }, @@ -7568,7 +9439,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = U64Vec4::rem(_self, rhs) + let output: Val = bevy::math::U64Vec4::rem( + _self, + rhs, + ) .into(); output }, @@ -7576,7 +9450,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = U64Vec4::mul(_self, rhs) + let output: Val = bevy::math::U64Vec4::mul( + _self, + rhs, + ) .into(); output }, @@ -7584,7 +9461,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = U64Vec4::add(_self, rhs) + let output: Val = bevy::math::U64Vec4::add( + _self, + rhs, + ) .into(); output }, @@ -7592,7 +9472,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = U64Vec4::sub(_self, rhs) + let output: Val = bevy::math::U64Vec4::sub( + _self, + rhs, + ) .into(); output }, @@ -7600,7 +9483,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = U64Vec4::div(_self, rhs) + let output: Val = bevy::math::U64Vec4::div( + _self, + rhs, + ) .into(); output }, @@ -7608,7 +9494,12 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64, z: u64, w: u64| { - let output: Val = U64Vec4::new(x, y, z, w) + let output: Val = bevy::math::U64Vec4::new( + x, + y, + z, + w, + ) .into(); output }, @@ -7616,7 +9507,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = U64Vec4::splat(v).into(); + let output: Val = bevy::math::U64Vec4::splat(v) + .into(); output }, ) @@ -7627,7 +9519,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = U64Vec4::select( + let output: Val = bevy::math::U64Vec4::select( mask, if_true, if_false, @@ -7639,21 +9531,26 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 4]| { - let output: Val = U64Vec4::from_array(a).into(); + let output: Val = bevy::math::U64Vec4::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 4] = U64Vec4::to_array(_self).into(); + let output: [u64; 4] = bevy::math::U64Vec4::to_array(_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = U64Vec4::truncate(_self) + let output: Val = bevy::math::U64Vec4::truncate( + _self, + ) .into(); output }, @@ -7661,7 +9558,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = U64Vec4::with_x(_self, x) + let output: Val = bevy::math::U64Vec4::with_x( + _self, + x, + ) .into(); output }, @@ -7669,7 +9569,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = U64Vec4::with_y(_self, y) + let output: Val = bevy::math::U64Vec4::with_y( + _self, + y, + ) .into(); output }, @@ -7677,7 +9580,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u64| { - let output: Val = U64Vec4::with_z(_self, z) + let output: Val = bevy::math::U64Vec4::with_z( + _self, + z, + ) .into(); output }, @@ -7685,7 +9591,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: u64| { - let output: Val = U64Vec4::with_w(_self, w) + let output: Val = bevy::math::U64Vec4::with_w( + _self, + w, + ) .into(); output }, @@ -7693,14 +9602,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = U64Vec4::dot(_self, rhs).into(); + let output: u64 = bevy::math::U64Vec4::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::dot_into_vec( + let output: Val = bevy::math::U64Vec4::dot_into_vec( _self, rhs, ) @@ -7711,7 +9620,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::min(_self, rhs) + let output: Val = bevy::math::U64Vec4::min( + _self, + rhs, + ) .into(); output }, @@ -7719,7 +9631,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::max(_self, rhs) + let output: Val = bevy::math::U64Vec4::max( + _self, + rhs, + ) .into(); output }, @@ -7731,7 +9646,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = U64Vec4::clamp( + let output: Val = bevy::math::U64Vec4::clamp( _self, min, max, @@ -7743,35 +9658,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = U64Vec4::min_element(_self).into(); + let output: u64 = bevy::math::U64Vec4::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = U64Vec4::max_element(_self).into(); + let output: u64 = bevy::math::U64Vec4::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = U64Vec4::element_sum(_self).into(); + let output: u64 = bevy::math::U64Vec4::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = U64Vec4::element_product(_self).into(); + let output: u64 = bevy::math::U64Vec4::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::cmpeq(_self, rhs) + let output: Val = bevy::math::U64Vec4::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -7779,7 +9697,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::cmpne(_self, rhs) + let output: Val = bevy::math::U64Vec4::cmpne( + _self, + rhs, + ) .into(); output }, @@ -7787,7 +9708,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::cmpge(_self, rhs) + let output: Val = bevy::math::U64Vec4::cmpge( + _self, + rhs, + ) .into(); output }, @@ -7795,7 +9719,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::cmpgt(_self, rhs) + let output: Val = bevy::math::U64Vec4::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -7803,7 +9730,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::cmple(_self, rhs) + let output: Val = bevy::math::U64Vec4::cmple( + _self, + rhs, + ) .into(); output }, @@ -7811,7 +9741,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::cmplt(_self, rhs) + let output: Val = bevy::math::U64Vec4::cmplt( + _self, + rhs, + ) .into(); output }, @@ -7819,42 +9752,56 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = U64Vec4::length_squared(_self).into(); + let output: u64 = bevy::math::U64Vec4::length_squared(_self).into(); output }, ) .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = U64Vec4::as_vec4(_self).into(); + let output: Val = bevy::math::U64Vec4::as_vec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = U64Vec4::as_dvec4(_self).into(); + let output: Val = bevy::math::U64Vec4::as_dvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = U64Vec4::as_ivec4(_self).into(); + let output: Val = bevy::math::U64Vec4::as_ivec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = U64Vec4::as_uvec4(_self).into(); + let output: Val = bevy::math::U64Vec4::as_uvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = U64Vec4::as_i64vec4(_self) + let output: Val = bevy::math::U64Vec4::as_i64vec4( + _self, + ) .into(); output }, @@ -7862,7 +9809,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::wrapping_add( + let output: Val = bevy::math::U64Vec4::wrapping_add( _self, rhs, ) @@ -7873,7 +9820,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::wrapping_sub( + let output: Val = bevy::math::U64Vec4::wrapping_sub( _self, rhs, ) @@ -7884,7 +9831,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::wrapping_mul( + let output: Val = bevy::math::U64Vec4::wrapping_mul( _self, rhs, ) @@ -7895,7 +9842,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::wrapping_div( + let output: Val = bevy::math::U64Vec4::wrapping_div( _self, rhs, ) @@ -7906,7 +9853,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::saturating_add( + let output: Val = bevy::math::U64Vec4::saturating_add( _self, rhs, ) @@ -7917,7 +9864,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::saturating_sub( + let output: Val = bevy::math::U64Vec4::saturating_sub( _self, rhs, ) @@ -7928,7 +9875,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::saturating_mul( + let output: Val = bevy::math::U64Vec4::saturating_mul( _self, rhs, ) @@ -7939,7 +9886,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::saturating_div( + let output: Val = bevy::math::U64Vec4::saturating_div( _self, rhs, ) @@ -7950,7 +9897,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::wrapping_add_signed( + let output: Val = bevy::math::U64Vec4::wrapping_add_signed( _self, rhs, ) @@ -7961,7 +9908,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = U64Vec4::saturating_add_signed( + let output: Val = bevy::math::U64Vec4::saturating_add_signed( _self, rhs, ) @@ -7972,7 +9919,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = U64Vec4::sub(_self, rhs) + let output: Val = bevy::math::U64Vec4::sub( + _self, + rhs, + ) .into(); output }, @@ -7980,72 +9930,84 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = U64Vec4::add(_self, rhs) + let output: Val = bevy::math::U64Vec4::add( + _self, + rhs, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Vec2::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Vec2::add(_self, rhs).into(); + let output: Val = bevy::math::Vec2::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = Vec2::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Vec2::div(_self, rhs).into(); + let output: Val = bevy::math::Vec2::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = Vec2::add(_self, rhs).into(); + let output: Val = bevy::math::Vec2::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Vec2::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec2::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = Vec2::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec2::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "new", |x: f32, y: f32| { - let output: Val = Vec2::new(x, y).into(); + let output: Val = bevy::math::Vec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: f32| { - let output: Val = Vec2::splat(v).into(); + let output: Val = bevy::math::Vec2::splat(v) + .into(); output }, ) @@ -8056,7 +10018,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = Vec2::select( + let output: Val = bevy::math::Vec2::select( mask, if_true, if_false, @@ -8068,49 +10030,65 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 2]| { - let output: Val = Vec2::from_array(a).into(); + let output: Val = bevy::math::Vec2::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 2] = Vec2::to_array(_self).into(); + let output: [f32; 2] = bevy::math::Vec2::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: f32| { - let output: Val = Vec2::extend(_self, z).into(); + let output: Val = bevy::math::Vec2::extend( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = Vec2::with_x(_self, x).into(); + let output: Val = bevy::math::Vec2::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = Vec2::with_y(_self, y).into(); + let output: Val = bevy::math::Vec2::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = Vec2::dot(_self, rhs).into(); + let output: f32 = bevy::math::Vec2::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = Vec2::dot_into_vec(_self, rhs) + let output: Val = bevy::math::Vec2::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -8118,14 +10096,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = Vec2::min(_self, rhs).into(); + let output: Val = bevy::math::Vec2::min(_self, rhs) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = Vec2::max(_self, rhs).into(); + let output: Val = bevy::math::Vec2::max(_self, rhs) + .into(); output }, ) @@ -8136,7 +10116,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = Vec2::clamp(_self, min, max) + let output: Val = bevy::math::Vec2::clamp( + _self, + min, + max, + ) .into(); output }, @@ -8144,91 +10128,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = Vec2::min_element(_self).into(); + let output: f32 = bevy::math::Vec2::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = Vec2::max_element(_self).into(); + let output: f32 = bevy::math::Vec2::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = Vec2::element_sum(_self).into(); + let output: f32 = bevy::math::Vec2::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = Vec2::element_product(_self).into(); + let output: f32 = bevy::math::Vec2::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = Vec2::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::Vec2::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = Vec2::cmpne(_self, rhs).into(); + let output: Val = bevy::math::Vec2::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = Vec2::cmpge(_self, rhs).into(); + let output: Val = bevy::math::Vec2::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = Vec2::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::Vec2::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = Vec2::cmple(_self, rhs).into(); + let output: Val = bevy::math::Vec2::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = Vec2::cmplt(_self, rhs).into(); + let output: Val = bevy::math::Vec2::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = Vec2::abs(_self).into(); + let output: Val = bevy::math::Vec2::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = Vec2::signum(_self).into(); + let output: Val = bevy::math::Vec2::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = Vec2::copysign(_self, rhs) + let output: Val = bevy::math::Vec2::copysign( + _self, + rhs, + ) .into(); output }, @@ -8236,21 +10249,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = Vec2::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::Vec2::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = Vec2::is_finite(_self).into(); + let output: bool = bevy::math::Vec2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = Vec2::is_finite_mask(_self) + let output: Val = bevy::math::Vec2::is_finite_mask( + _self, + ) .into(); output }, @@ -8258,56 +10274,63 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = Vec2::is_nan(_self).into(); + let output: bool = bevy::math::Vec2::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = Vec2::is_nan_mask(_self).into(); + let output: Val = bevy::math::Vec2::is_nan_mask( + _self, + ) + .into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Vec2::length(_self).into(); + let output: f32 = bevy::math::Vec2::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = Vec2::length_squared(_self).into(); + let output: f32 = bevy::math::Vec2::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = Vec2::length_recip(_self).into(); + let output: f32 = bevy::math::Vec2::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = Vec2::distance(_self, rhs).into(); + let output: f32 = bevy::math::Vec2::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = Vec2::distance_squared(_self, rhs).into(); + let output: f32 = bevy::math::Vec2::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec2::div_euclid(_self, rhs) + let output: Val = bevy::math::Vec2::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -8315,7 +10338,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec2::rem_euclid(_self, rhs) + let output: Val = bevy::math::Vec2::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -8323,14 +10349,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = Vec2::normalize(_self).into(); + let output: Val = bevy::math::Vec2::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = Vec2::normalize_or( + let output: Val = bevy::math::Vec2::normalize_or( _self, fallback, ) @@ -8341,7 +10370,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = Vec2::normalize_or_zero(_self) + let output: Val = bevy::math::Vec2::normalize_or_zero( + _self, + ) .into(); output }, @@ -8349,14 +10380,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = Vec2::is_normalized(_self).into(); + let output: bool = bevy::math::Vec2::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = Vec2::project_onto(_self, rhs) + let output: Val = bevy::math::Vec2::project_onto( + _self, + rhs, + ) .into(); output }, @@ -8364,7 +10398,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = Vec2::reject_from(_self, rhs) + let output: Val = bevy::math::Vec2::reject_from( + _self, + rhs, + ) .into(); output }, @@ -8372,7 +10409,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec2::project_onto_normalized( + let output: Val = bevy::math::Vec2::project_onto_normalized( _self, rhs, ) @@ -8383,7 +10420,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec2::reject_from_normalized( + let output: Val = bevy::math::Vec2::reject_from_normalized( _self, rhs, ) @@ -8394,77 +10431,95 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = Vec2::round(_self).into(); + let output: Val = bevy::math::Vec2::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = Vec2::floor(_self).into(); + let output: Val = bevy::math::Vec2::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = Vec2::ceil(_self).into(); + let output: Val = bevy::math::Vec2::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = Vec2::trunc(_self).into(); + let output: Val = bevy::math::Vec2::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = Vec2::fract(_self).into(); + let output: Val = bevy::math::Vec2::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = Vec2::fract_gl(_self).into(); + let output: Val = bevy::math::Vec2::fract_gl(_self) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = Vec2::exp(_self).into(); + let output: Val = bevy::math::Vec2::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = Vec2::powf(_self, n).into(); + let output: Val = bevy::math::Vec2::powf(_self, n) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = Vec2::recip(_self).into(); + let output: Val = bevy::math::Vec2::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = Vec2::lerp(_self, rhs, s).into(); + let output: Val = bevy::math::Vec2::lerp( + _self, + rhs, + s, + ) + .into(); output }, ) .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = Vec2::move_towards(_self, rhs, d) + let output: Val = bevy::math::Vec2::move_towards( + _self, + rhs, + d, + ) .into(); output }, @@ -8472,7 +10527,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = Vec2::midpoint(_self, rhs) + let output: Val = bevy::math::Vec2::midpoint( + _self, + rhs, + ) .into(); output }, @@ -8484,7 +10542,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Vec2::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Vec2::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -8492,7 +10554,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = Vec2::clamp_length( + let output: Val = bevy::math::Vec2::clamp_length( _self, min, max, @@ -8504,7 +10566,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = Vec2::clamp_length_max( + let output: Val = bevy::math::Vec2::clamp_length_max( _self, max, ) @@ -8515,7 +10577,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = Vec2::clamp_length_min( + let output: Val = bevy::math::Vec2::clamp_length_min( _self, min, ) @@ -8530,7 +10592,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = Vec2::mul_add(_self, a, b) + let output: Val = bevy::math::Vec2::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -8538,7 +10604,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = Vec2::reflect(_self, normal) + let output: Val = bevy::math::Vec2::reflect( + _self, + normal, + ) .into(); output }, @@ -8546,7 +10615,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = Vec2::refract(_self, normal, eta) + let output: Val = bevy::math::Vec2::refract( + _self, + normal, + eta, + ) .into(); output }, @@ -8554,49 +10627,57 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = Vec2::from_angle(angle).into(); + let output: Val = bevy::math::Vec2::from_angle( + angle, + ) + .into(); output }, ) .overwrite_script_function( "to_angle", |_self: Val| { - let output: f32 = Vec2::to_angle(_self).into(); + let output: f32 = bevy::math::Vec2::to_angle(_self).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = Vec2::angle_between(_self, rhs).into(); + let output: f32 = bevy::math::Vec2::angle_between(_self, rhs).into(); output }, ) .overwrite_script_function( "angle_to", |_self: Val, rhs: Val| { - let output: f32 = Vec2::angle_to(_self, rhs).into(); + let output: f32 = bevy::math::Vec2::angle_to(_self, rhs).into(); output }, ) .overwrite_script_function( "perp", |_self: Val| { - let output: Val = Vec2::perp(_self).into(); + let output: Val = bevy::math::Vec2::perp(_self) + .into(); output }, ) .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: f32 = Vec2::perp_dot(_self, rhs).into(); + let output: f32 = bevy::math::Vec2::perp_dot(_self, rhs).into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = Vec2::rotate(_self, rhs).into(); + let output: Val = bevy::math::Vec2::rotate( + _self, + rhs, + ) + .into(); output }, ) @@ -8607,7 +10688,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f32| { - let output: Val = Vec2::rotate_towards( + let output: Val = bevy::math::Vec2::rotate_towards( _self, rhs, max_angle, @@ -8619,28 +10700,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = Vec2::as_dvec2(_self).into(); + let output: Val = bevy::math::Vec2::as_dvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = Vec2::as_ivec2(_self).into(); + let output: Val = bevy::math::Vec2::as_ivec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = Vec2::as_uvec2(_self).into(); + let output: Val = bevy::math::Vec2::as_uvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = Vec2::as_i64vec2(_self) + let output: Val = bevy::math::Vec2::as_i64vec2( + _self, + ) .into(); output }, @@ -8648,7 +10740,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = Vec2::as_u64vec2(_self) + let output: Val = bevy::math::Vec2::as_u64vec2( + _self, + ) .into(); output }, @@ -8656,127 +10750,159 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Vec2::eq(_self, other).into(); + let output: bool = bevy::math::Vec2::eq(_self, other).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Vec2::clone(_self).into(); + let output: Val = bevy::math::Vec2::clone(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = Vec2::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec2::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = Vec2::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec2::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = Vec2::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec2::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = Vec2::div(_self, rhs).into(); + let output: Val = bevy::math::Vec2::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = Vec2::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec2::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Vec2::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Vec2::neg(_self).into(); + let output: Val = bevy::math::Vec2::neg(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = Vec2::add(_self, rhs).into(); + let output: Val = bevy::math::Vec2::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = Vec2::div(_self, rhs).into(); + let output: Val = bevy::math::Vec2::div(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = Vec3A::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Vec3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = Vec3A::div(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Vec3A::div(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = Vec3A::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: f32, y: f32, z: f32| { - let output: Val = Vec3A::new(x, y, z).into(); + let output: Val = bevy::math::Vec3A::new(x, y, z) + .into(); output }, ) .overwrite_script_function( "splat", |v: f32| { - let output: Val = Vec3A::splat(v).into(); + let output: Val = bevy::math::Vec3A::splat(v) + .into(); output }, ) @@ -8787,7 +10913,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = Vec3A::select( + let output: Val = bevy::math::Vec3A::select( mask, if_true, if_false, @@ -8799,70 +10925,94 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 3]| { - let output: Val = Vec3A::from_array(a).into(); + let output: Val = bevy::math::Vec3A::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = Vec3A::to_array(_self).into(); + let output: [f32; 3] = bevy::math::Vec3A::to_array(_self).into(); output }, ) .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = Vec3A::from_vec4(v).into(); + let output: Val = bevy::math::Vec3A::from_vec4(v) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f32| { - let output: Val = Vec3A::extend(_self, w).into(); + let output: Val = bevy::math::Vec3A::extend( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = Vec3A::truncate(_self).into(); + let output: Val = bevy::math::Vec3A::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = Vec3A::with_x(_self, x).into(); + let output: Val = bevy::math::Vec3A::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = Vec3A::with_y(_self, y).into(); + let output: Val = bevy::math::Vec3A::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = Vec3A::with_z(_self, z).into(); + let output: Val = bevy::math::Vec3A::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = Vec3A::dot(_self, rhs).into(); + let output: f32 = bevy::math::Vec3A::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = Vec3A::dot_into_vec(_self, rhs) + let output: Val = bevy::math::Vec3A::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -8870,21 +11020,33 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cross(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::cross( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = Vec3A::min(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = Vec3A::max(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::max( + _self, + rhs, + ) + .into(); output }, ) @@ -8895,7 +11057,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = Vec3A::clamp(_self, min, max) + let output: Val = bevy::math::Vec3A::clamp( + _self, + min, + max, + ) .into(); output }, @@ -8903,35 +11069,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = Vec3A::min_element(_self).into(); + let output: f32 = bevy::math::Vec3A::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = Vec3A::max_element(_self).into(); + let output: f32 = bevy::math::Vec3A::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = Vec3A::element_sum(_self).into(); + let output: f32 = bevy::math::Vec3A::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = Vec3A::element_product(_self).into(); + let output: f32 = bevy::math::Vec3A::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cmpeq(_self, rhs) + let output: Val = bevy::math::Vec3A::cmpeq( + _self, + rhs, + ) .into(); output }, @@ -8939,7 +11108,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cmpne(_self, rhs) + let output: Val = bevy::math::Vec3A::cmpne( + _self, + rhs, + ) .into(); output }, @@ -8947,7 +11119,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cmpge(_self, rhs) + let output: Val = bevy::math::Vec3A::cmpge( + _self, + rhs, + ) .into(); output }, @@ -8955,7 +11130,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cmpgt(_self, rhs) + let output: Val = bevy::math::Vec3A::cmpgt( + _self, + rhs, + ) .into(); output }, @@ -8963,7 +11141,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cmple(_self, rhs) + let output: Val = bevy::math::Vec3A::cmple( + _self, + rhs, + ) .into(); output }, @@ -8971,7 +11152,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = Vec3A::cmplt(_self, rhs) + let output: Val = bevy::math::Vec3A::cmplt( + _self, + rhs, + ) .into(); output }, @@ -8979,21 +11163,26 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = Vec3A::abs(_self).into(); + let output: Val = bevy::math::Vec3A::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = Vec3A::signum(_self).into(); + let output: Val = bevy::math::Vec3A::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = Vec3A::copysign(_self, rhs) + let output: Val = bevy::math::Vec3A::copysign( + _self, + rhs, + ) .into(); output }, @@ -9001,21 +11190,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = Vec3A::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::Vec3A::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = Vec3A::is_finite(_self).into(); + let output: bool = bevy::math::Vec3A::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = Vec3A::is_finite_mask(_self) + let output: Val = bevy::math::Vec3A::is_finite_mask( + _self, + ) .into(); output }, @@ -9023,14 +11215,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = Vec3A::is_nan(_self).into(); + let output: bool = bevy::math::Vec3A::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = Vec3A::is_nan_mask(_self) + let output: Val = bevy::math::Vec3A::is_nan_mask( + _self, + ) .into(); output }, @@ -9038,42 +11232,46 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Vec3A::length(_self).into(); + let output: f32 = bevy::math::Vec3A::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = Vec3A::length_squared(_self).into(); + let output: f32 = bevy::math::Vec3A::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = Vec3A::length_recip(_self).into(); + let output: f32 = bevy::math::Vec3A::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = Vec3A::distance(_self, rhs).into(); + let output: f32 = bevy::math::Vec3A::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = Vec3A::distance_squared(_self, rhs).into(); + let output: f32 = bevy::math::Vec3A::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec3A::div_euclid(_self, rhs) + let output: Val = bevy::math::Vec3A::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -9081,7 +11279,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec3A::rem_euclid(_self, rhs) + let output: Val = bevy::math::Vec3A::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -9089,14 +11290,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = Vec3A::normalize(_self).into(); + let output: Val = bevy::math::Vec3A::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = Vec3A::normalize_or( + let output: Val = bevy::math::Vec3A::normalize_or( _self, fallback, ) @@ -9107,7 +11311,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = Vec3A::normalize_or_zero(_self) + let output: Val = bevy::math::Vec3A::normalize_or_zero( + _self, + ) .into(); output }, @@ -9115,14 +11321,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = Vec3A::is_normalized(_self).into(); + let output: bool = bevy::math::Vec3A::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = Vec3A::project_onto(_self, rhs) + let output: Val = bevy::math::Vec3A::project_onto( + _self, + rhs, + ) .into(); output }, @@ -9130,7 +11339,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = Vec3A::reject_from(_self, rhs) + let output: Val = bevy::math::Vec3A::reject_from( + _self, + rhs, + ) .into(); output }, @@ -9138,7 +11350,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec3A::project_onto_normalized( + let output: Val = bevy::math::Vec3A::project_onto_normalized( _self, rhs, ) @@ -9149,7 +11361,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec3A::reject_from_normalized( + let output: Val = bevy::math::Vec3A::reject_from_normalized( _self, rhs, ) @@ -9160,70 +11372,88 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = Vec3A::round(_self).into(); + let output: Val = bevy::math::Vec3A::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = Vec3A::floor(_self).into(); + let output: Val = bevy::math::Vec3A::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = Vec3A::ceil(_self).into(); + let output: Val = bevy::math::Vec3A::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = Vec3A::trunc(_self).into(); + let output: Val = bevy::math::Vec3A::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = Vec3A::fract(_self).into(); + let output: Val = bevy::math::Vec3A::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = Vec3A::fract_gl(_self).into(); + let output: Val = bevy::math::Vec3A::fract_gl( + _self, + ) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = Vec3A::exp(_self).into(); + let output: Val = bevy::math::Vec3A::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = Vec3A::powf(_self, n).into(); + let output: Val = bevy::math::Vec3A::powf( + _self, + n, + ) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = Vec3A::recip(_self).into(); + let output: Val = bevy::math::Vec3A::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = Vec3A::lerp(_self, rhs, s) + let output: Val = bevy::math::Vec3A::lerp( + _self, + rhs, + s, + ) .into(); output }, @@ -9231,7 +11461,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = Vec3A::move_towards( + let output: Val = bevy::math::Vec3A::move_towards( _self, rhs, d, @@ -9243,7 +11473,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = Vec3A::midpoint(_self, rhs) + let output: Val = bevy::math::Vec3A::midpoint( + _self, + rhs, + ) .into(); output }, @@ -9255,7 +11488,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Vec3A::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Vec3A::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -9263,7 +11500,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = Vec3A::clamp_length( + let output: Val = bevy::math::Vec3A::clamp_length( _self, min, max, @@ -9275,7 +11512,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = Vec3A::clamp_length_max( + let output: Val = bevy::math::Vec3A::clamp_length_max( _self, max, ) @@ -9286,7 +11523,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = Vec3A::clamp_length_min( + let output: Val = bevy::math::Vec3A::clamp_length_min( _self, min, ) @@ -9301,7 +11538,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = Vec3A::mul_add(_self, a, b) + let output: Val = bevy::math::Vec3A::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -9309,7 +11550,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = Vec3A::reflect(_self, normal) + let output: Val = bevy::math::Vec3A::reflect( + _self, + normal, + ) .into(); output }, @@ -9321,7 +11565,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f32| { - let output: Val = Vec3A::refract( + let output: Val = bevy::math::Vec3A::refract( _self, normal, eta, @@ -9333,14 +11577,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = Vec3A::angle_between(_self, rhs).into(); + let output: f32 = bevy::math::Vec3A::angle_between(_self, rhs) + .into(); output }, ) .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = Vec3A::any_orthogonal_vector( + let output: Val = bevy::math::Vec3A::any_orthogonal_vector( _self, ) .into(); @@ -9350,7 +11595,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = Vec3A::any_orthonormal_vector( + let output: Val = bevy::math::Vec3A::any_orthonormal_vector( _self, ) .into(); @@ -9360,28 +11605,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = Vec3A::as_dvec3(_self).into(); + let output: Val = bevy::math::Vec3A::as_dvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = Vec3A::as_ivec3(_self).into(); + let output: Val = bevy::math::Vec3A::as_ivec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = Vec3A::as_uvec3(_self).into(); + let output: Val = bevy::math::Vec3A::as_uvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = Vec3A::as_i64vec3(_self) + let output: Val = bevy::math::Vec3A::as_i64vec3( + _self, + ) .into(); output }, @@ -9389,7 +11645,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = Vec3A::as_u64vec3(_self) + let output: Val = bevy::math::Vec3A::as_u64vec3( + _self, + ) .into(); output }, @@ -9397,106 +11655,150 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Vec3A::neg(_self).into(); + let output: Val = bevy::math::Vec3A::neg(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = Vec3A::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Vec3A::clone(_self).into(); + let output: Val = bevy::math::Vec3A::clone(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = Vec3A::add(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = Vec3A::add(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Vec3A::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = Vec3A::div(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Vec3A::add(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Vec3A::eq(_self, rhs).into(); + let output: bool = bevy::math::Vec3A::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = Vec3A::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = Vec3A::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Vec3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = Vec3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec3A::mul( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |x: f32, y: f32, z: f32, w: f32| { - let output: Val = Vec4::new(x, y, z, w).into(); + let output: Val = bevy::math::Vec4::new(x, y, z, w) + .into(); output }, ) .overwrite_script_function( "splat", |v: f32| { - let output: Val = Vec4::splat(v).into(); + let output: Val = bevy::math::Vec4::splat(v) + .into(); output }, ) @@ -9507,7 +11809,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = Vec4::select( + let output: Val = bevy::math::Vec4::select( mask, if_true, if_false, @@ -9519,63 +11821,84 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = Vec4::from_array(a).into(); + let output: Val = bevy::math::Vec4::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = Vec4::to_array(_self).into(); + let output: [f32; 4] = bevy::math::Vec4::to_array(_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = Vec4::truncate(_self).into(); + let output: Val = bevy::math::Vec4::truncate(_self) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = Vec4::with_x(_self, x).into(); + let output: Val = bevy::math::Vec4::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = Vec4::with_y(_self, y).into(); + let output: Val = bevy::math::Vec4::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = Vec4::with_z(_self, z).into(); + let output: Val = bevy::math::Vec4::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_w", |_self: Val, w: f32| { - let output: Val = Vec4::with_w(_self, w).into(); + let output: Val = bevy::math::Vec4::with_w( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = Vec4::dot(_self, rhs).into(); + let output: f32 = bevy::math::Vec4::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = Vec4::dot_into_vec(_self, rhs) + let output: Val = bevy::math::Vec4::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -9583,14 +11906,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = Vec4::min(_self, rhs).into(); + let output: Val = bevy::math::Vec4::min(_self, rhs) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = Vec4::max(_self, rhs).into(); + let output: Val = bevy::math::Vec4::max(_self, rhs) + .into(); output }, ) @@ -9601,7 +11926,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = Vec4::clamp(_self, min, max) + let output: Val = bevy::math::Vec4::clamp( + _self, + min, + max, + ) .into(); output }, @@ -9609,91 +11938,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = Vec4::min_element(_self).into(); + let output: f32 = bevy::math::Vec4::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = Vec4::max_element(_self).into(); + let output: f32 = bevy::math::Vec4::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = Vec4::element_sum(_self).into(); + let output: f32 = bevy::math::Vec4::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = Vec4::element_product(_self).into(); + let output: f32 = bevy::math::Vec4::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = Vec4::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::Vec4::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = Vec4::cmpne(_self, rhs).into(); + let output: Val = bevy::math::Vec4::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = Vec4::cmpge(_self, rhs).into(); + let output: Val = bevy::math::Vec4::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = Vec4::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::Vec4::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = Vec4::cmple(_self, rhs).into(); + let output: Val = bevy::math::Vec4::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = Vec4::cmplt(_self, rhs).into(); + let output: Val = bevy::math::Vec4::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = Vec4::abs(_self).into(); + let output: Val = bevy::math::Vec4::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = Vec4::signum(_self).into(); + let output: Val = bevy::math::Vec4::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = Vec4::copysign(_self, rhs) + let output: Val = bevy::math::Vec4::copysign( + _self, + rhs, + ) .into(); output }, @@ -9701,21 +12059,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = Vec4::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::Vec4::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = Vec4::is_finite(_self).into(); + let output: bool = bevy::math::Vec4::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = Vec4::is_finite_mask(_self) + let output: Val = bevy::math::Vec4::is_finite_mask( + _self, + ) .into(); output }, @@ -9723,14 +12084,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = Vec4::is_nan(_self).into(); + let output: bool = bevy::math::Vec4::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = Vec4::is_nan_mask(_self) + let output: Val = bevy::math::Vec4::is_nan_mask( + _self, + ) .into(); output }, @@ -9738,42 +12101,46 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = Vec4::length(_self).into(); + let output: f32 = bevy::math::Vec4::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = Vec4::length_squared(_self).into(); + let output: f32 = bevy::math::Vec4::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = Vec4::length_recip(_self).into(); + let output: f32 = bevy::math::Vec4::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = Vec4::distance(_self, rhs).into(); + let output: f32 = bevy::math::Vec4::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = Vec4::distance_squared(_self, rhs).into(); + let output: f32 = bevy::math::Vec4::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec4::div_euclid(_self, rhs) + let output: Val = bevy::math::Vec4::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -9781,7 +12148,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = Vec4::rem_euclid(_self, rhs) + let output: Val = bevy::math::Vec4::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -9789,14 +12159,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = Vec4::normalize(_self).into(); + let output: Val = bevy::math::Vec4::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = Vec4::normalize_or( + let output: Val = bevy::math::Vec4::normalize_or( _self, fallback, ) @@ -9807,7 +12180,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = Vec4::normalize_or_zero(_self) + let output: Val = bevy::math::Vec4::normalize_or_zero( + _self, + ) .into(); output }, @@ -9815,14 +12190,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = Vec4::is_normalized(_self).into(); + let output: bool = bevy::math::Vec4::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = Vec4::project_onto(_self, rhs) + let output: Val = bevy::math::Vec4::project_onto( + _self, + rhs, + ) .into(); output }, @@ -9830,7 +12208,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = Vec4::reject_from(_self, rhs) + let output: Val = bevy::math::Vec4::reject_from( + _self, + rhs, + ) .into(); output }, @@ -9838,7 +12219,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec4::project_onto_normalized( + let output: Val = bevy::math::Vec4::project_onto_normalized( _self, rhs, ) @@ -9849,7 +12230,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = Vec4::reject_from_normalized( + let output: Val = bevy::math::Vec4::reject_from_normalized( _self, rhs, ) @@ -9860,77 +12241,95 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = Vec4::round(_self).into(); + let output: Val = bevy::math::Vec4::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = Vec4::floor(_self).into(); + let output: Val = bevy::math::Vec4::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = Vec4::ceil(_self).into(); + let output: Val = bevy::math::Vec4::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = Vec4::trunc(_self).into(); + let output: Val = bevy::math::Vec4::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = Vec4::fract(_self).into(); + let output: Val = bevy::math::Vec4::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = Vec4::fract_gl(_self).into(); + let output: Val = bevy::math::Vec4::fract_gl(_self) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = Vec4::exp(_self).into(); + let output: Val = bevy::math::Vec4::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = Vec4::powf(_self, n).into(); + let output: Val = bevy::math::Vec4::powf(_self, n) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = Vec4::recip(_self).into(); + let output: Val = bevy::math::Vec4::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = Vec4::lerp(_self, rhs, s).into(); + let output: Val = bevy::math::Vec4::lerp( + _self, + rhs, + s, + ) + .into(); output }, ) .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = Vec4::move_towards(_self, rhs, d) + let output: Val = bevy::math::Vec4::move_towards( + _self, + rhs, + d, + ) .into(); output }, @@ -9938,7 +12337,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = Vec4::midpoint(_self, rhs) + let output: Val = bevy::math::Vec4::midpoint( + _self, + rhs, + ) .into(); output }, @@ -9950,7 +12352,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Vec4::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Vec4::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -9958,7 +12364,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = Vec4::clamp_length( + let output: Val = bevy::math::Vec4::clamp_length( _self, min, max, @@ -9970,7 +12376,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = Vec4::clamp_length_max( + let output: Val = bevy::math::Vec4::clamp_length_max( _self, max, ) @@ -9981,7 +12387,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = Vec4::clamp_length_min( + let output: Val = bevy::math::Vec4::clamp_length_min( _self, min, ) @@ -9996,7 +12402,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = Vec4::mul_add(_self, a, b) + let output: Val = bevy::math::Vec4::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -10004,7 +12414,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = Vec4::reflect(_self, normal) + let output: Val = bevy::math::Vec4::reflect( + _self, + normal, + ) .into(); output }, @@ -10012,7 +12425,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = Vec4::refract(_self, normal, eta) + let output: Val = bevy::math::Vec4::refract( + _self, + normal, + eta, + ) .into(); output }, @@ -10020,28 +12437,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = Vec4::as_dvec4(_self).into(); + let output: Val = bevy::math::Vec4::as_dvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = Vec4::as_ivec4(_self).into(); + let output: Val = bevy::math::Vec4::as_ivec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = Vec4::as_uvec4(_self).into(); + let output: Val = bevy::math::Vec4::as_uvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = Vec4::as_i64vec4(_self) + let output: Val = bevy::math::Vec4::as_i64vec4( + _self, + ) .into(); output }, @@ -10049,7 +12477,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = Vec4::as_u64vec4(_self) + let output: Val = bevy::math::Vec4::as_u64vec4( + _self, + ) .into(); output }, @@ -10057,396 +12487,453 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = Vec4::div(_self, rhs).into(); + let output: Val = bevy::math::Vec4::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = Vec4::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec4::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = Vec4::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec4::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = Vec4::add(_self, rhs).into(); + let output: Val = bevy::math::Vec4::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Vec4::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec4::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = Vec4::add(_self, rhs).into(); + let output: Val = bevy::math::Vec4::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Vec4::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec4::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = Vec4::rem(_self, rhs).into(); + let output: Val = bevy::math::Vec4::rem(_self, rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Vec4::neg(_self).into(); + let output: Val = bevy::math::Vec4::neg(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = Vec4::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec4::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Vec4::div(_self, rhs).into(); + let output: Val = bevy::math::Vec4::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Vec4::add(_self, rhs).into(); + let output: Val = bevy::math::Vec4::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Vec4::eq(_self, rhs).into(); + let output: bool = bevy::math::Vec4::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = Vec4::sub(_self, rhs).into(); + let output: Val = bevy::math::Vec4::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = Vec4::div(_self, rhs).into(); + let output: Val = bevy::math::Vec4::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Vec4::clone(_self).into(); + let output: Val = bevy::math::Vec4::clone(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Vec4::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec4::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = Vec4::mul(_self, rhs).into(); + let output: Val = bevy::math::Vec4::mul(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = BVec2::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::BVec2::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: bool, y: bool| { - let output: Val = BVec2::new(x, y).into(); + let output: Val = bevy::math::BVec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: bool| { - let output: Val = BVec2::splat(v).into(); + let output: Val = bevy::math::BVec2::splat(v) + .into(); output }, ) .overwrite_script_function( "from_array", |a: [bool; 2]| { - let output: Val = BVec2::from_array(a).into(); + let output: Val = bevy::math::BVec2::from_array(a) + .into(); output }, ) .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = BVec2::bitmask(_self).into(); + let output: u32 = bevy::math::BVec2::bitmask(_self).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = BVec2::any(_self).into(); + let output: bool = bevy::math::BVec2::any(_self).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = BVec2::all(_self).into(); + let output: bool = bevy::math::BVec2::all(_self).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = BVec2::test(_self, index).into(); + let output: bool = bevy::math::BVec2::test(_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = BVec2::set(_self, index, value).into(); + let output: () = bevy::math::BVec2::set(_self, index, value).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BVec2::clone(_self).into(); + let output: Val = bevy::math::BVec2::clone(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = BVec2::eq(_self, other).into(); + let output: bool = bevy::math::BVec2::eq(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = BVec3::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::BVec3::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { - let output: Val = BVec3::new(x, y, z).into(); + let output: Val = bevy::math::BVec3::new(x, y, z) + .into(); output }, ) .overwrite_script_function( "splat", |v: bool| { - let output: Val = BVec3::splat(v).into(); + let output: Val = bevy::math::BVec3::splat(v) + .into(); output }, ) .overwrite_script_function( "from_array", |a: [bool; 3]| { - let output: Val = BVec3::from_array(a).into(); + let output: Val = bevy::math::BVec3::from_array(a) + .into(); output }, ) .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = BVec3::bitmask(_self).into(); + let output: u32 = bevy::math::BVec3::bitmask(_self).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = BVec3::any(_self).into(); + let output: bool = bevy::math::BVec3::any(_self).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = BVec3::all(_self).into(); + let output: bool = bevy::math::BVec3::all(_self).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = BVec3::test(_self, index).into(); + let output: bool = bevy::math::BVec3::test(_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = BVec3::set(_self, index, value).into(); + let output: () = bevy::math::BVec3::set(_self, index, value).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BVec3::clone(_self).into(); + let output: Val = bevy::math::BVec3::clone(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = BVec3::eq(_self, other).into(); + let output: bool = bevy::math::BVec3::eq(_self, other).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BVec4::clone(_self).into(); + let output: Val = bevy::math::BVec4::clone(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = BVec4::eq(_self, other).into(); + let output: bool = bevy::math::BVec4::eq(_self, other).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = BVec4::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::BVec4::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { - let output: Val = BVec4::new(x, y, z, w).into(); + let output: Val = bevy::math::BVec4::new( + x, + y, + z, + w, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: bool| { - let output: Val = BVec4::splat(v).into(); + let output: Val = bevy::math::BVec4::splat(v) + .into(); output }, ) .overwrite_script_function( "from_array", |a: [bool; 4]| { - let output: Val = BVec4::from_array(a).into(); + let output: Val = bevy::math::BVec4::from_array(a) + .into(); output }, ) .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = BVec4::bitmask(_self).into(); + let output: u32 = bevy::math::BVec4::bitmask(_self).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = BVec4::any(_self).into(); + let output: bool = bevy::math::BVec4::any(_self).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = BVec4::all(_self).into(); + let output: bool = bevy::math::BVec4::all(_self).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = BVec4::test(_self, index).into(); + let output: bool = bevy::math::BVec4::test(_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = BVec4::set(_self, index, value).into(); + let output: () = bevy::math::BVec4::set(_self, index, value).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = DVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DVec2::add(_self, rhs).into(); + let output: Val = bevy::math::DVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: f64, y: f64| { - let output: Val = DVec2::new(x, y).into(); + let output: Val = bevy::math::DVec2::new(x, y) + .into(); output }, ) .overwrite_script_function( "splat", |v: f64| { - let output: Val = DVec2::splat(v).into(); + let output: Val = bevy::math::DVec2::splat(v) + .into(); output }, ) @@ -10457,7 +12944,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = DVec2::select( + let output: Val = bevy::math::DVec2::select( mask, if_true, if_false, @@ -10469,49 +12956,65 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 2]| { - let output: Val = DVec2::from_array(a).into(); + let output: Val = bevy::math::DVec2::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 2] = DVec2::to_array(_self).into(); + let output: [f64; 2] = bevy::math::DVec2::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: f64| { - let output: Val = DVec2::extend(_self, z).into(); + let output: Val = bevy::math::DVec2::extend( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = DVec2::with_x(_self, x).into(); + let output: Val = bevy::math::DVec2::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = DVec2::with_y(_self, y).into(); + let output: Val = bevy::math::DVec2::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = DVec2::dot(_self, rhs).into(); + let output: f64 = bevy::math::DVec2::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = DVec2::dot_into_vec(_self, rhs) + let output: Val = bevy::math::DVec2::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -10519,14 +13022,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = DVec2::min(_self, rhs).into(); + let output: Val = bevy::math::DVec2::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = DVec2::max(_self, rhs).into(); + let output: Val = bevy::math::DVec2::max( + _self, + rhs, + ) + .into(); output }, ) @@ -10537,7 +13048,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = DVec2::clamp(_self, min, max) + let output: Val = bevy::math::DVec2::clamp( + _self, + min, + max, + ) .into(); output }, @@ -10545,91 +13060,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = DVec2::min_element(_self).into(); + let output: f64 = bevy::math::DVec2::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = DVec2::max_element(_self).into(); + let output: f64 = bevy::math::DVec2::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = DVec2::element_sum(_self).into(); + let output: f64 = bevy::math::DVec2::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = DVec2::element_product(_self).into(); + let output: f64 = bevy::math::DVec2::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = DVec2::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::DVec2::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = DVec2::cmpne(_self, rhs).into(); + let output: Val = bevy::math::DVec2::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = DVec2::cmpge(_self, rhs).into(); + let output: Val = bevy::math::DVec2::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = DVec2::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::DVec2::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = DVec2::cmple(_self, rhs).into(); + let output: Val = bevy::math::DVec2::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = DVec2::cmplt(_self, rhs).into(); + let output: Val = bevy::math::DVec2::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = DVec2::abs(_self).into(); + let output: Val = bevy::math::DVec2::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = DVec2::signum(_self).into(); + let output: Val = bevy::math::DVec2::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = DVec2::copysign(_self, rhs) + let output: Val = bevy::math::DVec2::copysign( + _self, + rhs, + ) .into(); output }, @@ -10637,21 +13181,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = DVec2::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::DVec2::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = DVec2::is_finite(_self).into(); + let output: bool = bevy::math::DVec2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = DVec2::is_finite_mask(_self) + let output: Val = bevy::math::DVec2::is_finite_mask( + _self, + ) .into(); output }, @@ -10659,14 +13206,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = DVec2::is_nan(_self).into(); + let output: bool = bevy::math::DVec2::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = DVec2::is_nan_mask(_self) + let output: Val = bevy::math::DVec2::is_nan_mask( + _self, + ) .into(); output }, @@ -10674,42 +13223,46 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = DVec2::length(_self).into(); + let output: f64 = bevy::math::DVec2::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = DVec2::length_squared(_self).into(); + let output: f64 = bevy::math::DVec2::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = DVec2::length_recip(_self).into(); + let output: f64 = bevy::math::DVec2::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = DVec2::distance(_self, rhs).into(); + let output: f64 = bevy::math::DVec2::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = DVec2::distance_squared(_self, rhs).into(); + let output: f64 = bevy::math::DVec2::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = DVec2::div_euclid(_self, rhs) + let output: Val = bevy::math::DVec2::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -10717,7 +13270,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = DVec2::rem_euclid(_self, rhs) + let output: Val = bevy::math::DVec2::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -10725,14 +13281,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = DVec2::normalize(_self).into(); + let output: Val = bevy::math::DVec2::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = DVec2::normalize_or( + let output: Val = bevy::math::DVec2::normalize_or( _self, fallback, ) @@ -10743,7 +13302,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = DVec2::normalize_or_zero(_self) + let output: Val = bevy::math::DVec2::normalize_or_zero( + _self, + ) .into(); output }, @@ -10751,14 +13312,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = DVec2::is_normalized(_self).into(); + let output: bool = bevy::math::DVec2::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = DVec2::project_onto(_self, rhs) + let output: Val = bevy::math::DVec2::project_onto( + _self, + rhs, + ) .into(); output }, @@ -10766,7 +13330,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = DVec2::reject_from(_self, rhs) + let output: Val = bevy::math::DVec2::reject_from( + _self, + rhs, + ) .into(); output }, @@ -10774,7 +13341,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = DVec2::project_onto_normalized( + let output: Val = bevy::math::DVec2::project_onto_normalized( _self, rhs, ) @@ -10785,7 +13352,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = DVec2::reject_from_normalized( + let output: Val = bevy::math::DVec2::reject_from_normalized( _self, rhs, ) @@ -10796,70 +13363,88 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = DVec2::round(_self).into(); + let output: Val = bevy::math::DVec2::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = DVec2::floor(_self).into(); + let output: Val = bevy::math::DVec2::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = DVec2::ceil(_self).into(); + let output: Val = bevy::math::DVec2::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = DVec2::trunc(_self).into(); + let output: Val = bevy::math::DVec2::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = DVec2::fract(_self).into(); + let output: Val = bevy::math::DVec2::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = DVec2::fract_gl(_self).into(); + let output: Val = bevy::math::DVec2::fract_gl( + _self, + ) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = DVec2::exp(_self).into(); + let output: Val = bevy::math::DVec2::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = DVec2::powf(_self, n).into(); + let output: Val = bevy::math::DVec2::powf( + _self, + n, + ) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = DVec2::recip(_self).into(); + let output: Val = bevy::math::DVec2::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = DVec2::lerp(_self, rhs, s) + let output: Val = bevy::math::DVec2::lerp( + _self, + rhs, + s, + ) .into(); output }, @@ -10867,7 +13452,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = DVec2::move_towards( + let output: Val = bevy::math::DVec2::move_towards( _self, rhs, d, @@ -10879,7 +13464,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = DVec2::midpoint(_self, rhs) + let output: Val = bevy::math::DVec2::midpoint( + _self, + rhs, + ) .into(); output }, @@ -10891,7 +13479,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DVec2::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DVec2::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -10899,7 +13491,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = DVec2::clamp_length( + let output: Val = bevy::math::DVec2::clamp_length( _self, min, max, @@ -10911,7 +13503,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = DVec2::clamp_length_max( + let output: Val = bevy::math::DVec2::clamp_length_max( _self, max, ) @@ -10922,7 +13514,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = DVec2::clamp_length_min( + let output: Val = bevy::math::DVec2::clamp_length_min( _self, min, ) @@ -10937,7 +13529,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = DVec2::mul_add(_self, a, b) + let output: Val = bevy::math::DVec2::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -10945,7 +13541,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = DVec2::reflect(_self, normal) + let output: Val = bevy::math::DVec2::reflect( + _self, + normal, + ) .into(); output }, @@ -10957,7 +13556,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = DVec2::refract( + let output: Val = bevy::math::DVec2::refract( _self, normal, eta, @@ -10969,49 +13568,57 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = DVec2::from_angle(angle).into(); + let output: Val = bevy::math::DVec2::from_angle( + angle, + ) + .into(); output }, ) .overwrite_script_function( "to_angle", |_self: Val| { - let output: f64 = DVec2::to_angle(_self).into(); + let output: f64 = bevy::math::DVec2::to_angle(_self).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = DVec2::angle_between(_self, rhs).into(); + let output: f64 = bevy::math::DVec2::angle_between(_self, rhs) + .into(); output }, ) .overwrite_script_function( "angle_to", |_self: Val, rhs: Val| { - let output: f64 = DVec2::angle_to(_self, rhs).into(); + let output: f64 = bevy::math::DVec2::angle_to(_self, rhs).into(); output }, ) .overwrite_script_function( "perp", |_self: Val| { - let output: Val = DVec2::perp(_self).into(); + let output: Val = bevy::math::DVec2::perp(_self) + .into(); output }, ) .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: f64 = DVec2::perp_dot(_self, rhs).into(); + let output: f64 = bevy::math::DVec2::perp_dot(_self, rhs).into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = DVec2::rotate(_self, rhs) + let output: Val = bevy::math::DVec2::rotate( + _self, + rhs, + ) .into(); output }, @@ -11023,7 +13630,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f64| { - let output: Val = DVec2::rotate_towards( + let output: Val = bevy::math::DVec2::rotate_towards( _self, rhs, max_angle, @@ -11035,28 +13642,37 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = DVec2::as_vec2(_self).into(); + let output: Val = bevy::math::DVec2::as_vec2(_self) + .into(); output }, ) .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = DVec2::as_ivec2(_self).into(); + let output: Val = bevy::math::DVec2::as_ivec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = DVec2::as_uvec2(_self).into(); + let output: Val = bevy::math::DVec2::as_uvec2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = DVec2::as_i64vec2(_self) + let output: Val = bevy::math::DVec2::as_i64vec2( + _self, + ) .into(); output }, @@ -11064,7 +13680,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = DVec2::as_u64vec2(_self) + let output: Val = bevy::math::DVec2::as_u64vec2( + _self, + ) .into(); output }, @@ -11072,218 +13690,319 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = DVec2::div(_self, rhs).into(); + let output: Val = bevy::math::DVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = DVec2::div(_self, rhs).into(); + let output: Val = bevy::math::DVec2::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = DVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = DVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = DVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DVec2::neg(_self).into(); + let output: Val = bevy::math::DVec2::neg(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = DVec2::add(_self, rhs).into(); + let output: Val = bevy::math::DVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = DVec2::eq(_self, other).into(); + let output: bool = bevy::math::DVec2::eq(_self, other).into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = DVec2::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec2::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = DVec2::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DVec2::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = DVec2::add(_self, rhs).into(); + let output: Val = bevy::math::DVec2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DVec2::clone(_self).into(); + let output: Val = bevy::math::DVec2::clone(_self) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DVec2::div(_self, rhs).into(); + let output: Val = bevy::math::DVec2::div( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DVec3::div(_self, rhs).into(); + let output: Val = bevy::math::DVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = DVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = DVec3::add(_self, rhs).into(); + let output: Val = bevy::math::DVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = DVec3::div(_self, rhs).into(); + let output: Val = bevy::math::DVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DVec3::neg(_self).into(); + let output: Val = bevy::math::DVec3::neg(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = DVec3::eq(_self, other).into(); + let output: bool = bevy::math::DVec3::eq(_self, other).into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = DVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DVec3::add(_self, rhs).into(); + let output: Val = bevy::math::DVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = DVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = DVec3::add(_self, rhs).into(); + let output: Val = bevy::math::DVec3::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = DVec3::div(_self, rhs).into(); + let output: Val = bevy::math::DVec3::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = DVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = DVec3::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec3::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "new", |x: f64, y: f64, z: f64| { - let output: Val = DVec3::new(x, y, z).into(); + let output: Val = bevy::math::DVec3::new(x, y, z) + .into(); output }, ) .overwrite_script_function( "splat", |v: f64| { - let output: Val = DVec3::splat(v).into(); + let output: Val = bevy::math::DVec3::splat(v) + .into(); output }, ) @@ -11294,7 +14013,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = DVec3::select( + let output: Val = bevy::math::DVec3::select( mask, if_true, if_false, @@ -11306,63 +14025,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 3]| { - let output: Val = DVec3::from_array(a).into(); + let output: Val = bevy::math::DVec3::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 3] = DVec3::to_array(_self).into(); + let output: [f64; 3] = bevy::math::DVec3::to_array(_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f64| { - let output: Val = DVec3::extend(_self, w).into(); + let output: Val = bevy::math::DVec3::extend( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = DVec3::truncate(_self).into(); + let output: Val = bevy::math::DVec3::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = DVec3::with_x(_self, x).into(); + let output: Val = bevy::math::DVec3::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = DVec3::with_y(_self, y).into(); + let output: Val = bevy::math::DVec3::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: f64| { - let output: Val = DVec3::with_z(_self, z).into(); + let output: Val = bevy::math::DVec3::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = DVec3::dot(_self, rhs).into(); + let output: f64 = bevy::math::DVec3::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = DVec3::dot_into_vec(_self, rhs) + let output: Val = bevy::math::DVec3::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -11370,21 +14112,33 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = DVec3::cross(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cross( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = DVec3::min(_self, rhs).into(); + let output: Val = bevy::math::DVec3::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = DVec3::max(_self, rhs).into(); + let output: Val = bevy::math::DVec3::max( + _self, + rhs, + ) + .into(); output }, ) @@ -11395,7 +14149,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = DVec3::clamp(_self, min, max) + let output: Val = bevy::math::DVec3::clamp( + _self, + min, + max, + ) .into(); output }, @@ -11403,91 +14161,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = DVec3::min_element(_self).into(); + let output: f64 = bevy::math::DVec3::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = DVec3::max_element(_self).into(); + let output: f64 = bevy::math::DVec3::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = DVec3::element_sum(_self).into(); + let output: f64 = bevy::math::DVec3::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = DVec3::element_product(_self).into(); + let output: f64 = bevy::math::DVec3::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = DVec3::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = DVec3::cmpne(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = DVec3::cmpge(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = DVec3::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = DVec3::cmple(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = DVec3::cmplt(_self, rhs).into(); + let output: Val = bevy::math::DVec3::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = DVec3::abs(_self).into(); + let output: Val = bevy::math::DVec3::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = DVec3::signum(_self).into(); + let output: Val = bevy::math::DVec3::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = DVec3::copysign(_self, rhs) + let output: Val = bevy::math::DVec3::copysign( + _self, + rhs, + ) .into(); output }, @@ -11495,21 +14282,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = DVec3::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::DVec3::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = DVec3::is_finite(_self).into(); + let output: bool = bevy::math::DVec3::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = DVec3::is_finite_mask(_self) + let output: Val = bevy::math::DVec3::is_finite_mask( + _self, + ) .into(); output }, @@ -11517,14 +14307,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = DVec3::is_nan(_self).into(); + let output: bool = bevy::math::DVec3::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = DVec3::is_nan_mask(_self) + let output: Val = bevy::math::DVec3::is_nan_mask( + _self, + ) .into(); output }, @@ -11532,42 +14324,46 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = DVec3::length(_self).into(); + let output: f64 = bevy::math::DVec3::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = DVec3::length_squared(_self).into(); + let output: f64 = bevy::math::DVec3::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = DVec3::length_recip(_self).into(); + let output: f64 = bevy::math::DVec3::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = DVec3::distance(_self, rhs).into(); + let output: f64 = bevy::math::DVec3::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = DVec3::distance_squared(_self, rhs).into(); + let output: f64 = bevy::math::DVec3::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = DVec3::div_euclid(_self, rhs) + let output: Val = bevy::math::DVec3::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -11575,7 +14371,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = DVec3::rem_euclid(_self, rhs) + let output: Val = bevy::math::DVec3::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -11583,14 +14382,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = DVec3::normalize(_self).into(); + let output: Val = bevy::math::DVec3::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = DVec3::normalize_or( + let output: Val = bevy::math::DVec3::normalize_or( _self, fallback, ) @@ -11601,7 +14403,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = DVec3::normalize_or_zero(_self) + let output: Val = bevy::math::DVec3::normalize_or_zero( + _self, + ) .into(); output }, @@ -11609,14 +14413,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = DVec3::is_normalized(_self).into(); + let output: bool = bevy::math::DVec3::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = DVec3::project_onto(_self, rhs) + let output: Val = bevy::math::DVec3::project_onto( + _self, + rhs, + ) .into(); output }, @@ -11624,7 +14431,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = DVec3::reject_from(_self, rhs) + let output: Val = bevy::math::DVec3::reject_from( + _self, + rhs, + ) .into(); output }, @@ -11632,7 +14442,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = DVec3::project_onto_normalized( + let output: Val = bevy::math::DVec3::project_onto_normalized( _self, rhs, ) @@ -11643,7 +14453,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = DVec3::reject_from_normalized( + let output: Val = bevy::math::DVec3::reject_from_normalized( _self, rhs, ) @@ -11654,70 +14464,88 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = DVec3::round(_self).into(); + let output: Val = bevy::math::DVec3::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = DVec3::floor(_self).into(); + let output: Val = bevy::math::DVec3::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = DVec3::ceil(_self).into(); + let output: Val = bevy::math::DVec3::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = DVec3::trunc(_self).into(); + let output: Val = bevy::math::DVec3::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = DVec3::fract(_self).into(); + let output: Val = bevy::math::DVec3::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = DVec3::fract_gl(_self).into(); + let output: Val = bevy::math::DVec3::fract_gl( + _self, + ) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = DVec3::exp(_self).into(); + let output: Val = bevy::math::DVec3::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = DVec3::powf(_self, n).into(); + let output: Val = bevy::math::DVec3::powf( + _self, + n, + ) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = DVec3::recip(_self).into(); + let output: Val = bevy::math::DVec3::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = DVec3::lerp(_self, rhs, s) + let output: Val = bevy::math::DVec3::lerp( + _self, + rhs, + s, + ) .into(); output }, @@ -11725,7 +14553,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = DVec3::move_towards( + let output: Val = bevy::math::DVec3::move_towards( _self, rhs, d, @@ -11737,7 +14565,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = DVec3::midpoint(_self, rhs) + let output: Val = bevy::math::DVec3::midpoint( + _self, + rhs, + ) .into(); output }, @@ -11749,7 +14580,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DVec3::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DVec3::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -11757,7 +14592,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = DVec3::clamp_length( + let output: Val = bevy::math::DVec3::clamp_length( _self, min, max, @@ -11769,7 +14604,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = DVec3::clamp_length_max( + let output: Val = bevy::math::DVec3::clamp_length_max( _self, max, ) @@ -11780,7 +14615,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = DVec3::clamp_length_min( + let output: Val = bevy::math::DVec3::clamp_length_min( _self, min, ) @@ -11795,7 +14630,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = DVec3::mul_add(_self, a, b) + let output: Val = bevy::math::DVec3::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -11803,7 +14642,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = DVec3::reflect(_self, normal) + let output: Val = bevy::math::DVec3::reflect( + _self, + normal, + ) .into(); output }, @@ -11815,7 +14657,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = DVec3::refract( + let output: Val = bevy::math::DVec3::refract( _self, normal, eta, @@ -11827,14 +14669,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = DVec3::angle_between(_self, rhs).into(); + let output: f64 = bevy::math::DVec3::angle_between(_self, rhs) + .into(); output }, ) .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = DVec3::any_orthogonal_vector( + let output: Val = bevy::math::DVec3::any_orthogonal_vector( _self, ) .into(); @@ -11844,7 +14687,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = DVec3::any_orthonormal_vector( + let output: Val = bevy::math::DVec3::any_orthonormal_vector( _self, ) .into(); @@ -11854,35 +14697,47 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = DVec3::as_vec3(_self).into(); + let output: Val = bevy::math::DVec3::as_vec3(_self) + .into(); output }, ) .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = DVec3::as_vec3a(_self).into(); + let output: Val = bevy::math::DVec3::as_vec3a( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = DVec3::as_ivec3(_self).into(); + let output: Val = bevy::math::DVec3::as_ivec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = DVec3::as_uvec3(_self).into(); + let output: Val = bevy::math::DVec3::as_uvec3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = DVec3::as_i64vec3(_self) + let output: Val = bevy::math::DVec3::as_i64vec3( + _self, + ) .into(); output }, @@ -11890,7 +14745,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = DVec3::as_u64vec3(_self) + let output: Val = bevy::math::DVec3::as_u64vec3( + _self, + ) .into(); output }, @@ -11898,64 +14755,90 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DVec3::clone(_self).into(); + let output: Val = bevy::math::DVec3::clone(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = DVec3::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DVec3::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec3::sub( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = DVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DVec4::clone(_self).into(); + let output: Val = bevy::math::DVec4::clone(_self) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DVec4::neg(_self).into(); + let output: Val = bevy::math::DVec4::neg(_self) + .into(); output }, ) .overwrite_script_function( "new", |x: f64, y: f64, z: f64, w: f64| { - let output: Val = DVec4::new(x, y, z, w).into(); + let output: Val = bevy::math::DVec4::new( + x, + y, + z, + w, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: f64| { - let output: Val = DVec4::splat(v).into(); + let output: Val = bevy::math::DVec4::splat(v) + .into(); output }, ) @@ -11966,7 +14849,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = DVec4::select( + let output: Val = bevy::math::DVec4::select( mask, if_true, if_false, @@ -11978,63 +14861,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 4]| { - let output: Val = DVec4::from_array(a).into(); + let output: Val = bevy::math::DVec4::from_array(a) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = DVec4::to_array(_self).into(); + let output: [f64; 4] = bevy::math::DVec4::to_array(_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = DVec4::truncate(_self).into(); + let output: Val = bevy::math::DVec4::truncate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = DVec4::with_x(_self, x).into(); + let output: Val = bevy::math::DVec4::with_x( + _self, + x, + ) + .into(); output }, ) .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = DVec4::with_y(_self, y).into(); + let output: Val = bevy::math::DVec4::with_y( + _self, + y, + ) + .into(); output }, ) .overwrite_script_function( "with_z", |_self: Val, z: f64| { - let output: Val = DVec4::with_z(_self, z).into(); + let output: Val = bevy::math::DVec4::with_z( + _self, + z, + ) + .into(); output }, ) .overwrite_script_function( "with_w", |_self: Val, w: f64| { - let output: Val = DVec4::with_w(_self, w).into(); + let output: Val = bevy::math::DVec4::with_w( + _self, + w, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = DVec4::dot(_self, rhs).into(); + let output: f64 = bevy::math::DVec4::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = DVec4::dot_into_vec(_self, rhs) + let output: Val = bevy::math::DVec4::dot_into_vec( + _self, + rhs, + ) .into(); output }, @@ -12042,14 +14948,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = DVec4::min(_self, rhs).into(); + let output: Val = bevy::math::DVec4::min( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = DVec4::max(_self, rhs).into(); + let output: Val = bevy::math::DVec4::max( + _self, + rhs, + ) + .into(); output }, ) @@ -12060,7 +14974,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = DVec4::clamp(_self, min, max) + let output: Val = bevy::math::DVec4::clamp( + _self, + min, + max, + ) .into(); output }, @@ -12068,91 +14986,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = DVec4::min_element(_self).into(); + let output: f64 = bevy::math::DVec4::min_element(_self).into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = DVec4::max_element(_self).into(); + let output: f64 = bevy::math::DVec4::max_element(_self).into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = DVec4::element_sum(_self).into(); + let output: f64 = bevy::math::DVec4::element_sum(_self).into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = DVec4::element_product(_self).into(); + let output: f64 = bevy::math::DVec4::element_product(_self).into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = DVec4::cmpeq(_self, rhs).into(); + let output: Val = bevy::math::DVec4::cmpeq( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = DVec4::cmpne(_self, rhs).into(); + let output: Val = bevy::math::DVec4::cmpne( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = DVec4::cmpge(_self, rhs).into(); + let output: Val = bevy::math::DVec4::cmpge( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = DVec4::cmpgt(_self, rhs).into(); + let output: Val = bevy::math::DVec4::cmpgt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = DVec4::cmple(_self, rhs).into(); + let output: Val = bevy::math::DVec4::cmple( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = DVec4::cmplt(_self, rhs).into(); + let output: Val = bevy::math::DVec4::cmplt( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "abs", |_self: Val| { - let output: Val = DVec4::abs(_self).into(); + let output: Val = bevy::math::DVec4::abs(_self) + .into(); output }, ) .overwrite_script_function( "signum", |_self: Val| { - let output: Val = DVec4::signum(_self).into(); + let output: Val = bevy::math::DVec4::signum(_self) + .into(); output }, ) .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = DVec4::copysign(_self, rhs) + let output: Val = bevy::math::DVec4::copysign( + _self, + rhs, + ) .into(); output }, @@ -12160,21 +15107,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = DVec4::is_negative_bitmask(_self).into(); + let output: u32 = bevy::math::DVec4::is_negative_bitmask(_self) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = DVec4::is_finite(_self).into(); + let output: bool = bevy::math::DVec4::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = DVec4::is_finite_mask(_self) + let output: Val = bevy::math::DVec4::is_finite_mask( + _self, + ) .into(); output }, @@ -12182,14 +15132,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = DVec4::is_nan(_self).into(); + let output: bool = bevy::math::DVec4::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = DVec4::is_nan_mask(_self) + let output: Val = bevy::math::DVec4::is_nan_mask( + _self, + ) .into(); output }, @@ -12197,42 +15149,46 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = DVec4::length(_self).into(); + let output: f64 = bevy::math::DVec4::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = DVec4::length_squared(_self).into(); + let output: f64 = bevy::math::DVec4::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = DVec4::length_recip(_self).into(); + let output: f64 = bevy::math::DVec4::length_recip(_self).into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = DVec4::distance(_self, rhs).into(); + let output: f64 = bevy::math::DVec4::distance(_self, rhs).into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = DVec4::distance_squared(_self, rhs).into(); + let output: f64 = bevy::math::DVec4::distance_squared(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = DVec4::div_euclid(_self, rhs) + let output: Val = bevy::math::DVec4::div_euclid( + _self, + rhs, + ) .into(); output }, @@ -12240,7 +15196,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = DVec4::rem_euclid(_self, rhs) + let output: Val = bevy::math::DVec4::rem_euclid( + _self, + rhs, + ) .into(); output }, @@ -12248,14 +15207,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = DVec4::normalize(_self).into(); + let output: Val = bevy::math::DVec4::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = DVec4::normalize_or( + let output: Val = bevy::math::DVec4::normalize_or( _self, fallback, ) @@ -12266,7 +15228,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = DVec4::normalize_or_zero(_self) + let output: Val = bevy::math::DVec4::normalize_or_zero( + _self, + ) .into(); output }, @@ -12274,14 +15238,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = DVec4::is_normalized(_self).into(); + let output: bool = bevy::math::DVec4::is_normalized(_self).into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = DVec4::project_onto(_self, rhs) + let output: Val = bevy::math::DVec4::project_onto( + _self, + rhs, + ) .into(); output }, @@ -12289,7 +15256,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = DVec4::reject_from(_self, rhs) + let output: Val = bevy::math::DVec4::reject_from( + _self, + rhs, + ) .into(); output }, @@ -12297,7 +15267,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = DVec4::project_onto_normalized( + let output: Val = bevy::math::DVec4::project_onto_normalized( _self, rhs, ) @@ -12308,7 +15278,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = DVec4::reject_from_normalized( + let output: Val = bevy::math::DVec4::reject_from_normalized( _self, rhs, ) @@ -12319,70 +15289,88 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = DVec4::round(_self).into(); + let output: Val = bevy::math::DVec4::round(_self) + .into(); output }, ) .overwrite_script_function( "floor", |_self: Val| { - let output: Val = DVec4::floor(_self).into(); + let output: Val = bevy::math::DVec4::floor(_self) + .into(); output }, ) .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = DVec4::ceil(_self).into(); + let output: Val = bevy::math::DVec4::ceil(_self) + .into(); output }, ) .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = DVec4::trunc(_self).into(); + let output: Val = bevy::math::DVec4::trunc(_self) + .into(); output }, ) .overwrite_script_function( "fract", |_self: Val| { - let output: Val = DVec4::fract(_self).into(); + let output: Val = bevy::math::DVec4::fract(_self) + .into(); output }, ) .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = DVec4::fract_gl(_self).into(); + let output: Val = bevy::math::DVec4::fract_gl( + _self, + ) + .into(); output }, ) .overwrite_script_function( "exp", |_self: Val| { - let output: Val = DVec4::exp(_self).into(); + let output: Val = bevy::math::DVec4::exp(_self) + .into(); output }, ) .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = DVec4::powf(_self, n).into(); + let output: Val = bevy::math::DVec4::powf( + _self, + n, + ) + .into(); output }, ) .overwrite_script_function( "recip", |_self: Val| { - let output: Val = DVec4::recip(_self).into(); + let output: Val = bevy::math::DVec4::recip(_self) + .into(); output }, ) .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = DVec4::lerp(_self, rhs, s) + let output: Val = bevy::math::DVec4::lerp( + _self, + rhs, + s, + ) .into(); output }, @@ -12390,7 +15378,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = DVec4::move_towards( + let output: Val = bevy::math::DVec4::move_towards( _self, rhs, d, @@ -12402,7 +15390,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = DVec4::midpoint(_self, rhs) + let output: Val = bevy::math::DVec4::midpoint( + _self, + rhs, + ) .into(); output }, @@ -12414,7 +15405,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DVec4::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DVec4::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -12422,7 +15417,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = DVec4::clamp_length( + let output: Val = bevy::math::DVec4::clamp_length( _self, min, max, @@ -12434,7 +15429,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = DVec4::clamp_length_max( + let output: Val = bevy::math::DVec4::clamp_length_max( _self, max, ) @@ -12445,7 +15440,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = DVec4::clamp_length_min( + let output: Val = bevy::math::DVec4::clamp_length_min( _self, min, ) @@ -12460,7 +15455,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = DVec4::mul_add(_self, a, b) + let output: Val = bevy::math::DVec4::mul_add( + _self, + a, + b, + ) .into(); output }, @@ -12468,7 +15467,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = DVec4::reflect(_self, normal) + let output: Val = bevy::math::DVec4::reflect( + _self, + normal, + ) .into(); output }, @@ -12480,7 +15482,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = DVec4::refract( + let output: Val = bevy::math::DVec4::refract( _self, normal, eta, @@ -12492,28 +15494,37 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = DVec4::as_vec4(_self).into(); + let output: Val = bevy::math::DVec4::as_vec4(_self) + .into(); output }, ) .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = DVec4::as_ivec4(_self).into(); + let output: Val = bevy::math::DVec4::as_ivec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = DVec4::as_uvec4(_self).into(); + let output: Val = bevy::math::DVec4::as_uvec4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = DVec4::as_i64vec4(_self) + let output: Val = bevy::math::DVec4::as_i64vec4( + _self, + ) .into(); output }, @@ -12521,7 +15532,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = DVec4::as_u64vec4(_self) + let output: Val = bevy::math::DVec4::as_u64vec4( + _self, + ) .into(); output }, @@ -12529,141 +15542,203 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = DVec4::eq(_self, other).into(); + let output: bool = bevy::math::DVec4::eq(_self, other).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DVec4::div(_self, rhs).into(); + let output: Val = bevy::math::DVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = DVec4::add(_self, rhs).into(); + let output: Val = bevy::math::DVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = DVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = DVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = DVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = DVec4::div(_self, rhs).into(); + let output: Val = bevy::math::DVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DVec4::sub(_self, rhs).into(); + let output: Val = bevy::math::DVec4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = DVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = DVec4::add(_self, rhs).into(); + let output: Val = bevy::math::DVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DVec4::add(_self, rhs).into(); + let output: Val = bevy::math::DVec4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = DVec4::rem(_self, rhs).into(); + let output: Val = bevy::math::DVec4::rem( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = DVec4::div(_self, rhs).into(); + let output: Val = bevy::math::DVec4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DVec4::mul(_self, rhs).into(); + let output: Val = bevy::math::DVec4::mul( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Mat2::div(_self, rhs).into(); + let output: Val = bevy::math::Mat2::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Mat2::eq(_self, rhs).into(); + let output: bool = bevy::math::Mat2::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Mat2::neg(_self).into(); + let output: Val = bevy::math::Mat2::neg(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Mat2::clone(_self).into(); + let output: Val = bevy::math::Mat2::clone(_self) + .into(); output }, ) .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { - let output: Val = Mat2::from_cols(x_axis, y_axis) + let output: Val = bevy::math::Mat2::from_cols( + x_axis, + y_axis, + ) .into(); output }, @@ -12671,21 +15746,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 4] = Mat2::to_cols_array(_self).into(); + let output: [f32; 4] = bevy::math::Mat2::to_cols_array(_self).into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 2]; 2] = Mat2::to_cols_array_2d(_self).into(); + let output: [[f32; 2]; 2] = bevy::math::Mat2::to_cols_array_2d(_self) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = Mat2::from_diagonal(diagonal) + let output: Val = bevy::math::Mat2::from_diagonal( + diagonal, + ) .into(); output }, @@ -12693,7 +15771,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale_angle", |scale: Val, angle: f32| { - let output: Val = Mat2::from_scale_angle( + let output: Val = bevy::math::Mat2::from_scale_angle( scale, angle, ) @@ -12704,21 +15782,29 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = Mat2::from_angle(angle).into(); + let output: Val = bevy::math::Mat2::from_angle( + angle, + ) + .into(); output }, ) .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = Mat2::from_mat3(m).into(); + let output: Val = bevy::math::Mat2::from_mat3(m) + .into(); output }, ) .overwrite_script_function( "from_mat3_minor", |m: Val, i: usize, j: usize| { - let output: Val = Mat2::from_mat3_minor(m, i, j) + let output: Val = bevy::math::Mat2::from_mat3_minor( + m, + i, + j, + ) .into(); output }, @@ -12726,14 +15812,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = Mat2::from_mat3a(m).into(); + let output: Val = bevy::math::Mat2::from_mat3a(m) + .into(); output }, ) .overwrite_script_function( "from_mat3a_minor", |m: Val, i: usize, j: usize| { - let output: Val = Mat2::from_mat3a_minor(m, i, j) + let output: Val = bevy::math::Mat2::from_mat3a_minor( + m, + i, + j, + ) .into(); output }, @@ -12741,56 +15832,71 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = Mat2::col(_self, index).into(); + let output: Val = bevy::math::Mat2::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = Mat2::row(_self, index).into(); + let output: Val = bevy::math::Mat2::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Mat2::is_finite(_self).into(); + let output: bool = bevy::math::Mat2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = Mat2::is_nan(_self).into(); + let output: bool = bevy::math::Mat2::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = Mat2::transpose(_self).into(); + let output: Val = bevy::math::Mat2::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = Mat2::determinant(_self).into(); + let output: f32 = bevy::math::Mat2::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Mat2::inverse(_self).into(); + let output: Val = bevy::math::Mat2::inverse(_self) + .into(); output }, ) .overwrite_script_function( "mul_vec2", |_self: Ref, rhs: Val| { - let output: Val = Mat2::mul_vec2(_self, rhs) + let output: Val = bevy::math::Mat2::mul_vec2( + _self, + rhs, + ) .into(); output }, @@ -12798,7 +15904,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat2", |_self: Ref, rhs: Ref| { - let output: Val = Mat2::mul_mat2(_self, rhs) + let output: Val = bevy::math::Mat2::mul_mat2( + _self, + rhs, + ) .into(); output }, @@ -12806,7 +15915,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat2", |_self: Ref, rhs: Ref| { - let output: Val = Mat2::add_mat2(_self, rhs) + let output: Val = bevy::math::Mat2::add_mat2( + _self, + rhs, + ) .into(); output }, @@ -12814,7 +15926,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat2", |_self: Ref, rhs: Ref| { - let output: Val = Mat2::sub_mat2(_self, rhs) + let output: Val = bevy::math::Mat2::sub_mat2( + _self, + rhs, + ) .into(); output }, @@ -12822,7 +15937,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat2::mul_scalar(_self, rhs) + let output: Val = bevy::math::Mat2::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -12830,7 +15948,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat2::div_scalar(_self, rhs) + let output: Val = bevy::math::Mat2::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -12842,7 +15963,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Mat2::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Mat2::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -12850,99 +15975,118 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = Mat2::abs(_self).into(); + let output: Val = bevy::math::Mat2::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_dmat2", |_self: Ref| { - let output: Val = Mat2::as_dmat2(_self).into(); + let output: Val = bevy::math::Mat2::as_dmat2( + _self, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Mat2::sub(_self, rhs).into(); + let output: Val = bevy::math::Mat2::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat2::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat2::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Mat2::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat2::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Mat2::add(_self, rhs).into(); + let output: Val = bevy::math::Mat2::add(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Mat3::neg(_self).into(); + let output: Val = bevy::math::Mat3::neg(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Mat3::add(_self, rhs).into(); + let output: Val = bevy::math::Mat3::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Mat3::clone(_self).into(); + let output: Val = bevy::math::Mat3::clone(_self) + .into(); output }, ) @@ -12953,7 +16097,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = Mat3::from_cols( + let output: Val = bevy::math::Mat3::from_cols( x_axis, y_axis, z_axis, @@ -12965,21 +16109,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = Mat3::to_cols_array(_self).into(); + let output: [f32; 9] = bevy::math::Mat3::to_cols_array(_self).into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 3] = Mat3::to_cols_array_2d(_self).into(); + let output: [[f32; 3]; 3] = bevy::math::Mat3::to_cols_array_2d(_self) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = Mat3::from_diagonal(diagonal) + let output: Val = bevy::math::Mat3::from_diagonal( + diagonal, + ) .into(); output }, @@ -12987,14 +16134,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = Mat3::from_mat4(m).into(); + let output: Val = bevy::math::Mat3::from_mat4(m) + .into(); output }, ) .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = Mat3::from_mat4_minor(m, i, j) + let output: Val = bevy::math::Mat3::from_mat4_minor( + m, + i, + j, + ) .into(); output }, @@ -13002,14 +16154,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = Mat3::from_quat(rotation).into(); + let output: Val = bevy::math::Mat3::from_quat( + rotation, + ) + .into(); output }, ) .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = Mat3::from_axis_angle( + let output: Val = bevy::math::Mat3::from_axis_angle( axis, angle, ) @@ -13020,7 +16175,12 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = Mat3::from_euler(order, a, b, c) + let output: Val = bevy::math::Mat3::from_euler( + order, + a, + b, + c, + ) .into(); output }, @@ -13028,14 +16188,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = Mat3::to_euler(_self, order).into(); + let output: (f32, f32, f32) = bevy::math::Mat3::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = Mat3::from_rotation_x(angle) + let output: Val = bevy::math::Mat3::from_rotation_x( + angle, + ) .into(); output }, @@ -13043,7 +16209,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = Mat3::from_rotation_y(angle) + let output: Val = bevy::math::Mat3::from_rotation_y( + angle, + ) .into(); output }, @@ -13051,7 +16219,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = Mat3::from_rotation_z(angle) + let output: Val = bevy::math::Mat3::from_rotation_z( + angle, + ) .into(); output }, @@ -13059,7 +16229,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = Mat3::from_translation( + let output: Val = bevy::math::Mat3::from_translation( translation, ) .into(); @@ -13069,7 +16239,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = Mat3::from_angle(angle).into(); + let output: Val = bevy::math::Mat3::from_angle( + angle, + ) + .into(); output }, ) @@ -13080,7 +16253,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = Mat3::from_scale_angle_translation( + let output: Val = bevy::math::Mat3::from_scale_angle_translation( scale, angle, translation, @@ -13092,70 +16265,86 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = Mat3::from_scale(scale).into(); + let output: Val = bevy::math::Mat3::from_scale( + scale, + ) + .into(); output }, ) .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = Mat3::from_mat2(m).into(); + let output: Val = bevy::math::Mat3::from_mat2(m) + .into(); output }, ) .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = Mat3::col(_self, index).into(); + let output: Val = bevy::math::Mat3::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = Mat3::row(_self, index).into(); + let output: Val = bevy::math::Mat3::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Mat3::is_finite(_self).into(); + let output: bool = bevy::math::Mat3::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = Mat3::is_nan(_self).into(); + let output: bool = bevy::math::Mat3::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = Mat3::transpose(_self).into(); + let output: Val = bevy::math::Mat3::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = Mat3::determinant(_self).into(); + let output: f32 = bevy::math::Mat3::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Mat3::inverse(_self).into(); + let output: Val = bevy::math::Mat3::inverse(_self) + .into(); output }, ) .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = Mat3::transform_point2( + let output: Val = bevy::math::Mat3::transform_point2( _self, rhs, ) @@ -13166,7 +16355,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = Mat3::transform_vector2( + let output: Val = bevy::math::Mat3::transform_vector2( _self, rhs, ) @@ -13177,7 +16366,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = Mat3::mul_vec3(_self, rhs) + let output: Val = bevy::math::Mat3::mul_vec3( + _self, + rhs, + ) .into(); output }, @@ -13185,7 +16377,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Ref, rhs: Val| { - let output: Val = Mat3::mul_vec3a(_self, rhs) + let output: Val = bevy::math::Mat3::mul_vec3a( + _self, + rhs, + ) .into(); output }, @@ -13193,7 +16388,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = Mat3::mul_mat3(_self, rhs) + let output: Val = bevy::math::Mat3::mul_mat3( + _self, + rhs, + ) .into(); output }, @@ -13201,7 +16399,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = Mat3::add_mat3(_self, rhs) + let output: Val = bevy::math::Mat3::add_mat3( + _self, + rhs, + ) .into(); output }, @@ -13209,7 +16410,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = Mat3::sub_mat3(_self, rhs) + let output: Val = bevy::math::Mat3::sub_mat3( + _self, + rhs, + ) .into(); output }, @@ -13217,7 +16421,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat3::mul_scalar(_self, rhs) + let output: Val = bevy::math::Mat3::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -13225,7 +16432,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat3::div_scalar(_self, rhs) + let output: Val = bevy::math::Mat3::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -13237,7 +16447,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Mat3::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Mat3::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -13245,120 +16459,161 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = Mat3::abs(_self).into(); + let output: Val = bevy::math::Mat3::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_dmat3", |_self: Ref| { - let output: Val = Mat3::as_dmat3(_self).into(); + let output: Val = bevy::math::Mat3::as_dmat3( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Mat3::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Mat3::eq(_self, rhs).into(); + let output: bool = bevy::math::Mat3::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Mat3::div(_self, rhs).into(); + let output: Val = bevy::math::Mat3::div(_self, rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Mat3::sub(_self, rhs).into(); + let output: Val = bevy::math::Mat3::sub(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Mat3A::clone(_self).into(); + let output: Val = bevy::math::Mat3A::clone(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Mat3A::neg(_self).into(); + let output: Val = bevy::math::Mat3A::neg(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Mat3A::add(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Mat3A::eq(_self, rhs).into(); + let output: bool = bevy::math::Mat3A::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Mat3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Mat3A::div(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Mat3A::sub(_self, rhs).into(); + let output: Val = bevy::math::Mat3A::sub( + _self, + rhs, + ) + .into(); output }, ) @@ -13369,7 +16624,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = Mat3A::from_cols( + let output: Val = bevy::math::Mat3A::from_cols( x_axis, y_axis, z_axis, @@ -13381,21 +16636,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = Mat3A::to_cols_array(_self).into(); + let output: [f32; 9] = bevy::math::Mat3A::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 3] = Mat3A::to_cols_array_2d(_self).into(); + let output: [[f32; 3]; 3] = bevy::math::Mat3A::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = Mat3A::from_diagonal(diagonal) + let output: Val = bevy::math::Mat3A::from_diagonal( + diagonal, + ) .into(); output }, @@ -13403,14 +16664,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = Mat3A::from_mat4(m).into(); + let output: Val = bevy::math::Mat3A::from_mat4(m) + .into(); output }, ) .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = Mat3A::from_mat4_minor(m, i, j) + let output: Val = bevy::math::Mat3A::from_mat4_minor( + m, + i, + j, + ) .into(); output }, @@ -13418,7 +16684,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = Mat3A::from_quat(rotation) + let output: Val = bevy::math::Mat3A::from_quat( + rotation, + ) .into(); output }, @@ -13426,7 +16694,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = Mat3A::from_axis_angle( + let output: Val = bevy::math::Mat3A::from_axis_angle( axis, angle, ) @@ -13437,7 +16705,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = Mat3A::from_euler( + let output: Val = bevy::math::Mat3A::from_euler( order, a, b, @@ -13450,14 +16718,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = Mat3A::to_euler(_self, order).into(); + let output: (f32, f32, f32) = bevy::math::Mat3A::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = Mat3A::from_rotation_x(angle) + let output: Val = bevy::math::Mat3A::from_rotation_x( + angle, + ) .into(); output }, @@ -13465,7 +16739,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = Mat3A::from_rotation_y(angle) + let output: Val = bevy::math::Mat3A::from_rotation_y( + angle, + ) .into(); output }, @@ -13473,7 +16749,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = Mat3A::from_rotation_z(angle) + let output: Val = bevy::math::Mat3A::from_rotation_z( + angle, + ) .into(); output }, @@ -13481,7 +16759,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = Mat3A::from_translation( + let output: Val = bevy::math::Mat3A::from_translation( translation, ) .into(); @@ -13491,7 +16769,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = Mat3A::from_angle(angle).into(); + let output: Val = bevy::math::Mat3A::from_angle( + angle, + ) + .into(); output }, ) @@ -13502,7 +16783,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = Mat3A::from_scale_angle_translation( + let output: Val = bevy::math::Mat3A::from_scale_angle_translation( scale, angle, translation, @@ -13514,70 +16795,88 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = Mat3A::from_scale(scale).into(); + let output: Val = bevy::math::Mat3A::from_scale( + scale, + ) + .into(); output }, ) .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = Mat3A::from_mat2(m).into(); + let output: Val = bevy::math::Mat3A::from_mat2(m) + .into(); output }, ) .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = Mat3A::col(_self, index).into(); + let output: Val = bevy::math::Mat3A::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = Mat3A::row(_self, index).into(); + let output: Val = bevy::math::Mat3A::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Mat3A::is_finite(_self).into(); + let output: bool = bevy::math::Mat3A::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = Mat3A::is_nan(_self).into(); + let output: bool = bevy::math::Mat3A::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = Mat3A::transpose(_self).into(); + let output: Val = bevy::math::Mat3A::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = Mat3A::determinant(_self).into(); + let output: f32 = bevy::math::Mat3A::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Mat3A::inverse(_self).into(); + let output: Val = bevy::math::Mat3A::inverse( + _self, + ) + .into(); output }, ) .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = Mat3A::transform_point2( + let output: Val = bevy::math::Mat3A::transform_point2( _self, rhs, ) @@ -13588,7 +16887,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = Mat3A::transform_vector2( + let output: Val = bevy::math::Mat3A::transform_vector2( _self, rhs, ) @@ -13599,7 +16898,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = Mat3A::mul_vec3(_self, rhs) + let output: Val = bevy::math::Mat3A::mul_vec3( + _self, + rhs, + ) .into(); output }, @@ -13607,7 +16909,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Ref, rhs: Val| { - let output: Val = Mat3A::mul_vec3a(_self, rhs) + let output: Val = bevy::math::Mat3A::mul_vec3a( + _self, + rhs, + ) .into(); output }, @@ -13615,7 +16920,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = Mat3A::mul_mat3(_self, rhs) + let output: Val = bevy::math::Mat3A::mul_mat3( + _self, + rhs, + ) .into(); output }, @@ -13623,7 +16931,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = Mat3A::add_mat3(_self, rhs) + let output: Val = bevy::math::Mat3A::add_mat3( + _self, + rhs, + ) .into(); output }, @@ -13631,7 +16942,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = Mat3A::sub_mat3(_self, rhs) + let output: Val = bevy::math::Mat3A::sub_mat3( + _self, + rhs, + ) .into(); output }, @@ -13639,7 +16953,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat3A::mul_scalar(_self, rhs) + let output: Val = bevy::math::Mat3A::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -13647,7 +16964,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat3A::div_scalar(_self, rhs) + let output: Val = bevy::math::Mat3A::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -13659,7 +16979,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Mat3A::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Mat3A::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -13667,78 +16991,90 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = Mat3A::abs(_self).into(); + let output: Val = bevy::math::Mat3A::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_dmat3", |_self: Ref| { - let output: Val = Mat3A::as_dmat3(_self).into(); + let output: Val = bevy::math::Mat3A::as_dmat3( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = Mat4::neg(_self).into(); + let output: Val = bevy::math::Mat4::neg(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Mat4::clone(_self).into(); + let output: Val = bevy::math::Mat4::clone(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat4::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat4::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat4::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat4::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = Mat4::add(_self, rhs).into(); + let output: Val = bevy::math::Mat4::add(_self, rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = Mat4::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat4::mul(_self, rhs) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Mat4::eq(_self, rhs).into(); + let output: bool = bevy::math::Mat4::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = Mat4::sub(_self, rhs).into(); + let output: Val = bevy::math::Mat4::sub(_self, rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = Mat4::div(_self, rhs).into(); + let output: Val = bevy::math::Mat4::div(_self, rhs) + .into(); output }, ) @@ -13750,7 +17086,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = Mat4::from_cols( + let output: Val = bevy::math::Mat4::from_cols( x_axis, y_axis, z_axis, @@ -13763,21 +17099,25 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 16] = Mat4::to_cols_array(_self).into(); + let output: [f32; 16] = bevy::math::Mat4::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 4]; 4] = Mat4::to_cols_array_2d(_self).into(); + let output: [[f32; 4]; 4] = bevy::math::Mat4::to_cols_array_2d(_self) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = Mat4::from_diagonal(diagonal) + let output: Val = bevy::math::Mat4::from_diagonal( + diagonal, + ) .into(); output }, @@ -13789,7 +17129,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = Mat4::from_scale_rotation_translation( + let output: Val = bevy::math::Mat4::from_scale_rotation_translation( scale, rotation, translation, @@ -13801,7 +17141,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = Mat4::from_rotation_translation( + let output: Val = bevy::math::Mat4::from_rotation_translation( rotation, translation, ) @@ -13812,28 +17152,33 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = Mat4::from_quat(rotation).into(); + let output: Val = bevy::math::Mat4::from_quat( + rotation, + ) + .into(); output }, ) .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = Mat4::from_mat3(m).into(); + let output: Val = bevy::math::Mat4::from_mat3(m) + .into(); output }, ) .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = Mat4::from_mat3a(m).into(); + let output: Val = bevy::math::Mat4::from_mat3a(m) + .into(); output }, ) .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = Mat4::from_translation( + let output: Val = bevy::math::Mat4::from_translation( translation, ) .into(); @@ -13843,7 +17188,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = Mat4::from_axis_angle( + let output: Val = bevy::math::Mat4::from_axis_angle( axis, angle, ) @@ -13854,7 +17199,12 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = Mat4::from_euler(order, a, b, c) + let output: Val = bevy::math::Mat4::from_euler( + order, + a, + b, + c, + ) .into(); output }, @@ -13862,14 +17212,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = Mat4::to_euler(_self, order).into(); + let output: (f32, f32, f32) = bevy::math::Mat4::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = Mat4::from_rotation_x(angle) + let output: Val = bevy::math::Mat4::from_rotation_x( + angle, + ) .into(); output }, @@ -13877,7 +17233,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = Mat4::from_rotation_y(angle) + let output: Val = bevy::math::Mat4::from_rotation_y( + angle, + ) .into(); output }, @@ -13885,7 +17243,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = Mat4::from_rotation_z(angle) + let output: Val = bevy::math::Mat4::from_rotation_z( + angle, + ) .into(); output }, @@ -13893,56 +17253,71 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = Mat4::from_scale(scale).into(); + let output: Val = bevy::math::Mat4::from_scale( + scale, + ) + .into(); output }, ) .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = Mat4::col(_self, index).into(); + let output: Val = bevy::math::Mat4::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = Mat4::row(_self, index).into(); + let output: Val = bevy::math::Mat4::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Mat4::is_finite(_self).into(); + let output: bool = bevy::math::Mat4::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = Mat4::is_nan(_self).into(); + let output: bool = bevy::math::Mat4::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = Mat4::transpose(_self).into(); + let output: Val = bevy::math::Mat4::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = Mat4::determinant(_self).into(); + let output: f32 = bevy::math::Mat4::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Mat4::inverse(_self).into(); + let output: Val = bevy::math::Mat4::inverse(_self) + .into(); output }, ) @@ -13953,7 +17328,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = Mat4::look_to_lh(eye, dir, up) + let output: Val = bevy::math::Mat4::look_to_lh( + eye, + dir, + up, + ) .into(); output }, @@ -13965,7 +17344,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = Mat4::look_to_rh(eye, dir, up) + let output: Val = bevy::math::Mat4::look_to_rh( + eye, + dir, + up, + ) .into(); output }, @@ -13977,7 +17360,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = Mat4::look_at_lh(eye, center, up) + let output: Val = bevy::math::Mat4::look_at_lh( + eye, + center, + up, + ) .into(); output }, @@ -13989,7 +17376,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = Mat4::look_at_rh(eye, center, up) + let output: Val = bevy::math::Mat4::look_at_rh( + eye, + center, + up, + ) .into(); output }, @@ -13997,7 +17388,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh_gl", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = Mat4::perspective_rh_gl( + let output: Val = bevy::math::Mat4::perspective_rh_gl( fov_y_radians, aspect_ratio, z_near, @@ -14010,7 +17401,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = Mat4::perspective_lh( + let output: Val = bevy::math::Mat4::perspective_lh( fov_y_radians, aspect_ratio, z_near, @@ -14023,7 +17414,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = Mat4::perspective_rh( + let output: Val = bevy::math::Mat4::perspective_rh( fov_y_radians, aspect_ratio, z_near, @@ -14036,7 +17427,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = Mat4::perspective_infinite_lh( + let output: Val = bevy::math::Mat4::perspective_infinite_lh( fov_y_radians, aspect_ratio, z_near, @@ -14048,7 +17439,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = Mat4::perspective_infinite_reverse_lh( + let output: Val = bevy::math::Mat4::perspective_infinite_reverse_lh( fov_y_radians, aspect_ratio, z_near, @@ -14060,7 +17451,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = Mat4::perspective_infinite_rh( + let output: Val = bevy::math::Mat4::perspective_infinite_rh( fov_y_radians, aspect_ratio, z_near, @@ -14072,7 +17463,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = Mat4::perspective_infinite_reverse_rh( + let output: Val = bevy::math::Mat4::perspective_infinite_reverse_rh( fov_y_radians, aspect_ratio, z_near, @@ -14084,7 +17475,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh_gl", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = Mat4::orthographic_rh_gl( + let output: Val = bevy::math::Mat4::orthographic_rh_gl( left, right, bottom, @@ -14099,7 +17490,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_lh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = Mat4::orthographic_lh( + let output: Val = bevy::math::Mat4::orthographic_lh( left, right, bottom, @@ -14114,7 +17505,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = Mat4::orthographic_rh( + let output: Val = bevy::math::Mat4::orthographic_rh( left, right, bottom, @@ -14129,7 +17520,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3", |_self: Ref, rhs: Val| { - let output: Val = Mat4::project_point3(_self, rhs) + let output: Val = bevy::math::Mat4::project_point3( + _self, + rhs, + ) .into(); output }, @@ -14137,7 +17531,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = Mat4::transform_point3( + let output: Val = bevy::math::Mat4::transform_point3( _self, rhs, ) @@ -14148,7 +17542,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = Mat4::transform_vector3( + let output: Val = bevy::math::Mat4::transform_vector3( _self, rhs, ) @@ -14159,7 +17553,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3a", |_self: Ref, rhs: Val| { - let output: Val = Mat4::project_point3a( + let output: Val = bevy::math::Mat4::project_point3a( _self, rhs, ) @@ -14170,7 +17564,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3a", |_self: Ref, rhs: Val| { - let output: Val = Mat4::transform_point3a( + let output: Val = bevy::math::Mat4::transform_point3a( _self, rhs, ) @@ -14181,7 +17575,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3a", |_self: Ref, rhs: Val| { - let output: Val = Mat4::transform_vector3a( + let output: Val = bevy::math::Mat4::transform_vector3a( _self, rhs, ) @@ -14192,7 +17586,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = Mat4::mul_vec4(_self, rhs) + let output: Val = bevy::math::Mat4::mul_vec4( + _self, + rhs, + ) .into(); output }, @@ -14200,7 +17597,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat4", |_self: Ref, rhs: Ref| { - let output: Val = Mat4::mul_mat4(_self, rhs) + let output: Val = bevy::math::Mat4::mul_mat4( + _self, + rhs, + ) .into(); output }, @@ -14208,7 +17608,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat4", |_self: Ref, rhs: Ref| { - let output: Val = Mat4::add_mat4(_self, rhs) + let output: Val = bevy::math::Mat4::add_mat4( + _self, + rhs, + ) .into(); output }, @@ -14216,7 +17619,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat4", |_self: Ref, rhs: Ref| { - let output: Val = Mat4::sub_mat4(_self, rhs) + let output: Val = bevy::math::Mat4::sub_mat4( + _self, + rhs, + ) .into(); output }, @@ -14224,7 +17630,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat4::mul_scalar(_self, rhs) + let output: Val = bevy::math::Mat4::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -14232,7 +17641,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = Mat4::div_scalar(_self, rhs) + let output: Val = bevy::math::Mat4::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -14244,7 +17656,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Mat4::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Mat4::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -14252,78 +17668,104 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = Mat4::abs(_self).into(); + let output: Val = bevy::math::Mat4::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_dmat4", |_self: Ref| { - let output: Val = Mat4::as_dmat4(_self).into(); + let output: Val = bevy::math::Mat4::as_dmat4( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Mat4::mul(_self, rhs).into(); + let output: Val = bevy::math::Mat4::mul(_self, rhs) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = DMat2::eq(_self, rhs).into(); + let output: bool = bevy::math::DMat2::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DMat2::clone(_self).into(); + let output: Val = bevy::math::DMat2::clone(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DMat2::add(_self, rhs).into(); + let output: Val = bevy::math::DMat2::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DMat2::sub(_self, rhs).into(); + let output: Val = bevy::math::DMat2::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat2::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DMat2::neg(_self).into(); + let output: Val = bevy::math::DMat2::neg(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat2::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { - let output: Val = DMat2::from_cols(x_axis, y_axis) + let output: Val = bevy::math::DMat2::from_cols( + x_axis, + y_axis, + ) .into(); output }, @@ -14331,21 +17773,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 4] = DMat2::to_cols_array(_self).into(); + let output: [f64; 4] = bevy::math::DMat2::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 2]; 2] = DMat2::to_cols_array_2d(_self).into(); + let output: [[f64; 2]; 2] = bevy::math::DMat2::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = DMat2::from_diagonal(diagonal) + let output: Val = bevy::math::DMat2::from_diagonal( + diagonal, + ) .into(); output }, @@ -14353,7 +17801,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale_angle", |scale: Val, angle: f64| { - let output: Val = DMat2::from_scale_angle( + let output: Val = bevy::math::DMat2::from_scale_angle( scale, angle, ) @@ -14364,21 +17812,29 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = DMat2::from_angle(angle).into(); + let output: Val = bevy::math::DMat2::from_angle( + angle, + ) + .into(); output }, ) .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = DMat2::from_mat3(m).into(); + let output: Val = bevy::math::DMat2::from_mat3(m) + .into(); output }, ) .overwrite_script_function( "from_mat3_minor", |m: Val, i: usize, j: usize| { - let output: Val = DMat2::from_mat3_minor(m, i, j) + let output: Val = bevy::math::DMat2::from_mat3_minor( + m, + i, + j, + ) .into(); output }, @@ -14386,56 +17842,73 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = DMat2::col(_self, index).into(); + let output: Val = bevy::math::DMat2::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = DMat2::row(_self, index).into(); + let output: Val = bevy::math::DMat2::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = DMat2::is_finite(_self).into(); + let output: bool = bevy::math::DMat2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = DMat2::is_nan(_self).into(); + let output: bool = bevy::math::DMat2::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = DMat2::transpose(_self).into(); + let output: Val = bevy::math::DMat2::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = DMat2::determinant(_self).into(); + let output: f64 = bevy::math::DMat2::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = DMat2::inverse(_self).into(); + let output: Val = bevy::math::DMat2::inverse( + _self, + ) + .into(); output }, ) .overwrite_script_function( "mul_vec2", |_self: Ref, rhs: Val| { - let output: Val = DMat2::mul_vec2(_self, rhs) + let output: Val = bevy::math::DMat2::mul_vec2( + _self, + rhs, + ) .into(); output }, @@ -14443,7 +17916,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat2", |_self: Ref, rhs: Ref| { - let output: Val = DMat2::mul_mat2(_self, rhs) + let output: Val = bevy::math::DMat2::mul_mat2( + _self, + rhs, + ) .into(); output }, @@ -14451,7 +17927,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat2", |_self: Ref, rhs: Ref| { - let output: Val = DMat2::add_mat2(_self, rhs) + let output: Val = bevy::math::DMat2::add_mat2( + _self, + rhs, + ) .into(); output }, @@ -14459,7 +17938,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat2", |_self: Ref, rhs: Ref| { - let output: Val = DMat2::sub_mat2(_self, rhs) + let output: Val = bevy::math::DMat2::sub_mat2( + _self, + rhs, + ) .into(); output }, @@ -14467,7 +17949,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = DMat2::mul_scalar(_self, rhs) + let output: Val = bevy::math::DMat2::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -14475,7 +17960,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = DMat2::div_scalar(_self, rhs) + let output: Val = bevy::math::DMat2::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -14487,7 +17975,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DMat2::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DMat2::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -14495,50 +17987,72 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = DMat2::abs(_self).into(); + let output: Val = bevy::math::DMat2::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_mat2", |_self: Ref| { - let output: Val = DMat2::as_mat2(_self).into(); + let output: Val = bevy::math::DMat2::as_mat2(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DMat2::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DMat2::div(_self, rhs).into(); + let output: Val = bevy::math::DMat2::div( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat3::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat3::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DMat3::add(_self, rhs).into(); + let output: Val = bevy::math::DMat3::add( + _self, + rhs, + ) + .into(); output }, ) @@ -14549,7 +18063,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = DMat3::from_cols( + let output: Val = bevy::math::DMat3::from_cols( x_axis, y_axis, z_axis, @@ -14561,21 +18075,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 9] = DMat3::to_cols_array(_self).into(); + let output: [f64; 9] = bevy::math::DMat3::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 3]; 3] = DMat3::to_cols_array_2d(_self).into(); + let output: [[f64; 3]; 3] = bevy::math::DMat3::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = DMat3::from_diagonal(diagonal) + let output: Val = bevy::math::DMat3::from_diagonal( + diagonal, + ) .into(); output }, @@ -14583,14 +18103,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = DMat3::from_mat4(m).into(); + let output: Val = bevy::math::DMat3::from_mat4(m) + .into(); output }, ) .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = DMat3::from_mat4_minor(m, i, j) + let output: Val = bevy::math::DMat3::from_mat4_minor( + m, + i, + j, + ) .into(); output }, @@ -14598,7 +18123,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = DMat3::from_quat(rotation) + let output: Val = bevy::math::DMat3::from_quat( + rotation, + ) .into(); output }, @@ -14606,7 +18133,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = DMat3::from_axis_angle( + let output: Val = bevy::math::DMat3::from_axis_angle( axis, angle, ) @@ -14617,7 +18144,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f64, b: f64, c: f64| { - let output: Val = DMat3::from_euler( + let output: Val = bevy::math::DMat3::from_euler( order, a, b, @@ -14630,14 +18157,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f64, f64, f64) = DMat3::to_euler(_self, order).into(); + let output: (f64, f64, f64) = bevy::math::DMat3::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = DMat3::from_rotation_x(angle) + let output: Val = bevy::math::DMat3::from_rotation_x( + angle, + ) .into(); output }, @@ -14645,7 +18178,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = DMat3::from_rotation_y(angle) + let output: Val = bevy::math::DMat3::from_rotation_y( + angle, + ) .into(); output }, @@ -14653,7 +18188,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = DMat3::from_rotation_z(angle) + let output: Val = bevy::math::DMat3::from_rotation_z( + angle, + ) .into(); output }, @@ -14661,7 +18198,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = DMat3::from_translation( + let output: Val = bevy::math::DMat3::from_translation( translation, ) .into(); @@ -14671,7 +18208,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = DMat3::from_angle(angle).into(); + let output: Val = bevy::math::DMat3::from_angle( + angle, + ) + .into(); output }, ) @@ -14682,7 +18222,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f64, translation: Val| { - let output: Val = DMat3::from_scale_angle_translation( + let output: Val = bevy::math::DMat3::from_scale_angle_translation( scale, angle, translation, @@ -14694,70 +18234,88 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = DMat3::from_scale(scale).into(); + let output: Val = bevy::math::DMat3::from_scale( + scale, + ) + .into(); output }, ) .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = DMat3::from_mat2(m).into(); + let output: Val = bevy::math::DMat3::from_mat2(m) + .into(); output }, ) .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = DMat3::col(_self, index).into(); + let output: Val = bevy::math::DMat3::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = DMat3::row(_self, index).into(); + let output: Val = bevy::math::DMat3::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = DMat3::is_finite(_self).into(); + let output: bool = bevy::math::DMat3::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = DMat3::is_nan(_self).into(); + let output: bool = bevy::math::DMat3::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = DMat3::transpose(_self).into(); + let output: Val = bevy::math::DMat3::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = DMat3::determinant(_self).into(); + let output: f64 = bevy::math::DMat3::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = DMat3::inverse(_self).into(); + let output: Val = bevy::math::DMat3::inverse( + _self, + ) + .into(); output }, ) .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = DMat3::transform_point2( + let output: Val = bevy::math::DMat3::transform_point2( _self, rhs, ) @@ -14768,7 +18326,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = DMat3::transform_vector2( + let output: Val = bevy::math::DMat3::transform_vector2( _self, rhs, ) @@ -14779,7 +18337,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = DMat3::mul_vec3(_self, rhs) + let output: Val = bevy::math::DMat3::mul_vec3( + _self, + rhs, + ) .into(); output }, @@ -14787,7 +18348,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = DMat3::mul_mat3(_self, rhs) + let output: Val = bevy::math::DMat3::mul_mat3( + _self, + rhs, + ) .into(); output }, @@ -14795,7 +18359,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = DMat3::add_mat3(_self, rhs) + let output: Val = bevy::math::DMat3::add_mat3( + _self, + rhs, + ) .into(); output }, @@ -14803,7 +18370,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = DMat3::sub_mat3(_self, rhs) + let output: Val = bevy::math::DMat3::sub_mat3( + _self, + rhs, + ) .into(); output }, @@ -14811,7 +18381,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = DMat3::mul_scalar(_self, rhs) + let output: Val = bevy::math::DMat3::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -14819,7 +18392,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = DMat3::div_scalar(_self, rhs) + let output: Val = bevy::math::DMat3::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -14831,7 +18407,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DMat3::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DMat3::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -14839,78 +18419,106 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = DMat3::abs(_self).into(); + let output: Val = bevy::math::DMat3::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_mat3", |_self: Ref| { - let output: Val = DMat3::as_mat3(_self).into(); + let output: Val = bevy::math::DMat3::as_mat3(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = DMat3::eq(_self, rhs).into(); + let output: bool = bevy::math::DMat3::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DMat3::clone(_self).into(); + let output: Val = bevy::math::DMat3::clone(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DMat3::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DMat3::neg(_self).into(); + let output: Val = bevy::math::DMat3::neg(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DMat3::sub(_self, rhs).into(); + let output: Val = bevy::math::DMat3::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat3::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat3::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DMat3::div(_self, rhs).into(); + let output: Val = bevy::math::DMat3::div( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat4::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat4::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat4::mul( + _self, + rhs, + ) + .into(); output }, ) @@ -14922,7 +18530,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = DMat4::from_cols( + let output: Val = bevy::math::DMat4::from_cols( x_axis, y_axis, z_axis, @@ -14935,21 +18543,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 16] = DMat4::to_cols_array(_self).into(); + let output: [f64; 16] = bevy::math::DMat4::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 4]; 4] = DMat4::to_cols_array_2d(_self).into(); + let output: [[f64; 4]; 4] = bevy::math::DMat4::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = DMat4::from_diagonal(diagonal) + let output: Val = bevy::math::DMat4::from_diagonal( + diagonal, + ) .into(); output }, @@ -14961,7 +18575,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = DMat4::from_scale_rotation_translation( + let output: Val = bevy::math::DMat4::from_scale_rotation_translation( scale, rotation, translation, @@ -14973,7 +18587,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = DMat4::from_rotation_translation( + let output: Val = bevy::math::DMat4::from_rotation_translation( rotation, translation, ) @@ -14984,7 +18598,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = DMat4::from_quat(rotation) + let output: Val = bevy::math::DMat4::from_quat( + rotation, + ) .into(); output }, @@ -14992,14 +18608,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = DMat4::from_mat3(m).into(); + let output: Val = bevy::math::DMat4::from_mat3(m) + .into(); output }, ) .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = DMat4::from_translation( + let output: Val = bevy::math::DMat4::from_translation( translation, ) .into(); @@ -15009,7 +18626,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = DMat4::from_axis_angle( + let output: Val = bevy::math::DMat4::from_axis_angle( axis, angle, ) @@ -15020,7 +18637,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f64, b: f64, c: f64| { - let output: Val = DMat4::from_euler( + let output: Val = bevy::math::DMat4::from_euler( order, a, b, @@ -15033,14 +18650,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f64, f64, f64) = DMat4::to_euler(_self, order).into(); + let output: (f64, f64, f64) = bevy::math::DMat4::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = DMat4::from_rotation_x(angle) + let output: Val = bevy::math::DMat4::from_rotation_x( + angle, + ) .into(); output }, @@ -15048,7 +18671,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = DMat4::from_rotation_y(angle) + let output: Val = bevy::math::DMat4::from_rotation_y( + angle, + ) .into(); output }, @@ -15056,7 +18681,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = DMat4::from_rotation_z(angle) + let output: Val = bevy::math::DMat4::from_rotation_z( + angle, + ) .into(); output }, @@ -15064,56 +18691,73 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = DMat4::from_scale(scale).into(); + let output: Val = bevy::math::DMat4::from_scale( + scale, + ) + .into(); output }, ) .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = DMat4::col(_self, index).into(); + let output: Val = bevy::math::DMat4::col( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = DMat4::row(_self, index).into(); + let output: Val = bevy::math::DMat4::row( + _self, + index, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = DMat4::is_finite(_self).into(); + let output: bool = bevy::math::DMat4::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = DMat4::is_nan(_self).into(); + let output: bool = bevy::math::DMat4::is_nan(_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = DMat4::transpose(_self).into(); + let output: Val = bevy::math::DMat4::transpose( + _self, + ) + .into(); output }, ) .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = DMat4::determinant(_self).into(); + let output: f64 = bevy::math::DMat4::determinant(_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = DMat4::inverse(_self).into(); + let output: Val = bevy::math::DMat4::inverse( + _self, + ) + .into(); output }, ) @@ -15124,7 +18768,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = DMat4::look_to_lh(eye, dir, up) + let output: Val = bevy::math::DMat4::look_to_lh( + eye, + dir, + up, + ) .into(); output }, @@ -15136,7 +18784,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = DMat4::look_to_rh(eye, dir, up) + let output: Val = bevy::math::DMat4::look_to_rh( + eye, + dir, + up, + ) .into(); output }, @@ -15148,7 +18800,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = DMat4::look_at_lh( + let output: Val = bevy::math::DMat4::look_at_lh( eye, center, up, @@ -15164,7 +18816,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = DMat4::look_at_rh( + let output: Val = bevy::math::DMat4::look_at_rh( eye, center, up, @@ -15176,7 +18828,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh_gl", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = DMat4::perspective_rh_gl( + let output: Val = bevy::math::DMat4::perspective_rh_gl( fov_y_radians, aspect_ratio, z_near, @@ -15189,7 +18841,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = DMat4::perspective_lh( + let output: Val = bevy::math::DMat4::perspective_lh( fov_y_radians, aspect_ratio, z_near, @@ -15202,7 +18854,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = DMat4::perspective_rh( + let output: Val = bevy::math::DMat4::perspective_rh( fov_y_radians, aspect_ratio, z_near, @@ -15215,7 +18867,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = DMat4::perspective_infinite_lh( + let output: Val = bevy::math::DMat4::perspective_infinite_lh( fov_y_radians, aspect_ratio, z_near, @@ -15227,7 +18879,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = DMat4::perspective_infinite_reverse_lh( + let output: Val = bevy::math::DMat4::perspective_infinite_reverse_lh( fov_y_radians, aspect_ratio, z_near, @@ -15239,7 +18891,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = DMat4::perspective_infinite_rh( + let output: Val = bevy::math::DMat4::perspective_infinite_rh( fov_y_radians, aspect_ratio, z_near, @@ -15251,7 +18903,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = DMat4::perspective_infinite_reverse_rh( + let output: Val = bevy::math::DMat4::perspective_infinite_reverse_rh( fov_y_radians, aspect_ratio, z_near, @@ -15263,7 +18915,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh_gl", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = DMat4::orthographic_rh_gl( + let output: Val = bevy::math::DMat4::orthographic_rh_gl( left, right, bottom, @@ -15278,7 +18930,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_lh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = DMat4::orthographic_lh( + let output: Val = bevy::math::DMat4::orthographic_lh( left, right, bottom, @@ -15293,7 +18945,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = DMat4::orthographic_rh( + let output: Val = bevy::math::DMat4::orthographic_rh( left, right, bottom, @@ -15308,7 +18960,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3", |_self: Ref, rhs: Val| { - let output: Val = DMat4::project_point3( + let output: Val = bevy::math::DMat4::project_point3( _self, rhs, ) @@ -15319,7 +18971,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = DMat4::transform_point3( + let output: Val = bevy::math::DMat4::transform_point3( _self, rhs, ) @@ -15330,7 +18982,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = DMat4::transform_vector3( + let output: Val = bevy::math::DMat4::transform_vector3( _self, rhs, ) @@ -15341,7 +18993,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = DMat4::mul_vec4(_self, rhs) + let output: Val = bevy::math::DMat4::mul_vec4( + _self, + rhs, + ) .into(); output }, @@ -15349,7 +19004,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat4", |_self: Ref, rhs: Ref| { - let output: Val = DMat4::mul_mat4(_self, rhs) + let output: Val = bevy::math::DMat4::mul_mat4( + _self, + rhs, + ) .into(); output }, @@ -15357,7 +19015,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat4", |_self: Ref, rhs: Ref| { - let output: Val = DMat4::add_mat4(_self, rhs) + let output: Val = bevy::math::DMat4::add_mat4( + _self, + rhs, + ) .into(); output }, @@ -15365,7 +19026,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat4", |_self: Ref, rhs: Ref| { - let output: Val = DMat4::sub_mat4(_self, rhs) + let output: Val = bevy::math::DMat4::sub_mat4( + _self, + rhs, + ) .into(); output }, @@ -15373,7 +19037,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = DMat4::mul_scalar(_self, rhs) + let output: Val = bevy::math::DMat4::mul_scalar( + _self, + rhs, + ) .into(); output }, @@ -15381,7 +19048,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = DMat4::div_scalar(_self, rhs) + let output: Val = bevy::math::DMat4::div_scalar( + _self, + rhs, + ) .into(); output }, @@ -15393,7 +19063,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DMat4::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DMat4::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -15401,85 +19075,116 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = DMat4::abs(_self).into(); + let output: Val = bevy::math::DMat4::abs(_self) + .into(); output }, ) .overwrite_script_function( "as_mat4", |_self: Ref| { - let output: Val = DMat4::as_mat4(_self).into(); + let output: Val = bevy::math::DMat4::as_mat4(_self) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DMat4::neg(_self).into(); + let output: Val = bevy::math::DMat4::neg(_self) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DMat4::clone(_self).into(); + let output: Val = bevy::math::DMat4::clone(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DMat4::sub(_self, rhs).into(); + let output: Val = bevy::math::DMat4::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DMat4::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat4::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = DMat4::eq(_self, rhs).into(); + let output: bool = bevy::math::DMat4::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DMat4::add(_self, rhs).into(); + let output: Val = bevy::math::DMat4::add( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DMat4::div(_self, rhs).into(); + let output: Val = bevy::math::DMat4::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DMat4::mul(_self, rhs).into(); + let output: Val = bevy::math::DMat4::mul( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Affine2::mul(_self, rhs).into(); + let output: Val = bevy::math::Affine2::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Affine2::mul(_self, rhs) + let output: Val = bevy::math::Affine2::mul( + _self, + rhs, + ) .into(); output }, @@ -15487,7 +19192,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Affine2::clone(_self).into(); + let output: Val = bevy::math::Affine2::clone( + _self, + ) + .into(); output }, ) @@ -15498,7 +19206,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = Affine2::from_cols( + let output: Val = bevy::math::Affine2::from_cols( x_axis, y_axis, z_axis, @@ -15510,21 +19218,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 6] = Affine2::to_cols_array(_self).into(); + let output: [f32; 6] = bevy::math::Affine2::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 2]; 3] = Affine2::to_cols_array_2d(_self).into(); + let output: [[f32; 2]; 3] = bevy::math::Affine2::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = Affine2::from_scale(scale) + let output: Val = bevy::math::Affine2::from_scale( + scale, + ) .into(); output }, @@ -15532,7 +19246,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = Affine2::from_angle(angle) + let output: Val = bevy::math::Affine2::from_angle( + angle, + ) .into(); output }, @@ -15540,7 +19256,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = Affine2::from_translation( + let output: Val = bevy::math::Affine2::from_translation( translation, ) .into(); @@ -15550,7 +19266,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |matrix2: Val| { - let output: Val = Affine2::from_mat2(matrix2) + let output: Val = bevy::math::Affine2::from_mat2( + matrix2, + ) .into(); output }, @@ -15558,7 +19276,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2_translation", |matrix2: Val, translation: Val| { - let output: Val = Affine2::from_mat2_translation( + let output: Val = bevy::math::Affine2::from_mat2_translation( matrix2, translation, ) @@ -15573,7 +19291,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = Affine2::from_scale_angle_translation( + let output: Val = bevy::math::Affine2::from_scale_angle_translation( scale, angle, translation, @@ -15585,7 +19303,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle_translation", |angle: f32, translation: Val| { - let output: Val = Affine2::from_angle_translation( + let output: Val = bevy::math::Affine2::from_angle_translation( angle, translation, ) @@ -15596,21 +19314,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = Affine2::from_mat3(m).into(); + let output: Val = bevy::math::Affine2::from_mat3( + m, + ) + .into(); output }, ) .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = Affine2::from_mat3a(m).into(); + let output: Val = bevy::math::Affine2::from_mat3a( + m, + ) + .into(); output }, ) .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = Affine2::transform_point2( + let output: Val = bevy::math::Affine2::transform_point2( _self, rhs, ) @@ -15621,7 +19345,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = Affine2::transform_vector2( + let output: Val = bevy::math::Affine2::transform_vector2( _self, rhs, ) @@ -15632,14 +19356,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Affine2::is_finite(_self).into(); + let output: bool = bevy::math::Affine2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = Affine2::is_nan(_self).into(); + let output: bool = bevy::math::Affine2::is_nan(_self).into(); output }, ) @@ -15650,7 +19374,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Affine2::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Affine2::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -15658,7 +19386,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Affine2::inverse(_self) + let output: Val = bevy::math::Affine2::inverse( + _self, + ) .into(); output }, @@ -15666,29 +19396,35 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Affine2::eq(_self, rhs).into(); + let output: bool = bevy::math::Affine2::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Affine2::mul(_self, rhs).into(); + let output: Val = bevy::math::Affine2::mul( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = Affine3A::eq(_self, rhs).into(); + let output: bool = bevy::math::Affine3A::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Affine3A::clone(_self) + let output: Val = bevy::math::Affine3A::clone( + _self, + ) .into(); output }, @@ -15701,7 +19437,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = Affine3A::from_cols( + let output: Val = bevy::math::Affine3A::from_cols( x_axis, y_axis, z_axis, @@ -15714,21 +19450,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 12] = Affine3A::to_cols_array(_self).into(); + let output: [f32; 12] = bevy::math::Affine3A::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 4] = Affine3A::to_cols_array_2d(_self).into(); + let output: [[f32; 3]; 4] = bevy::math::Affine3A::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = Affine3A::from_scale(scale) + let output: Val = bevy::math::Affine3A::from_scale( + scale, + ) .into(); output }, @@ -15736,7 +19478,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = Affine3A::from_quat(rotation) + let output: Val = bevy::math::Affine3A::from_quat( + rotation, + ) .into(); output }, @@ -15744,7 +19488,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = Affine3A::from_axis_angle( + let output: Val = bevy::math::Affine3A::from_axis_angle( axis, angle, ) @@ -15755,7 +19499,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = Affine3A::from_rotation_x( + let output: Val = bevy::math::Affine3A::from_rotation_x( angle, ) .into(); @@ -15765,7 +19509,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = Affine3A::from_rotation_y( + let output: Val = bevy::math::Affine3A::from_rotation_y( angle, ) .into(); @@ -15775,7 +19519,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = Affine3A::from_rotation_z( + let output: Val = bevy::math::Affine3A::from_rotation_z( angle, ) .into(); @@ -15785,7 +19529,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = Affine3A::from_translation( + let output: Val = bevy::math::Affine3A::from_translation( translation, ) .into(); @@ -15795,7 +19539,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat3: Val| { - let output: Val = Affine3A::from_mat3(mat3) + let output: Val = bevy::math::Affine3A::from_mat3( + mat3, + ) .into(); output }, @@ -15803,7 +19549,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_translation", |mat3: Val, translation: Val| { - let output: Val = Affine3A::from_mat3_translation( + let output: Val = bevy::math::Affine3A::from_mat3_translation( mat3, translation, ) @@ -15818,7 +19564,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = Affine3A::from_scale_rotation_translation( + let output: Val = bevy::math::Affine3A::from_scale_rotation_translation( scale, rotation, translation, @@ -15830,7 +19576,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = Affine3A::from_rotation_translation( + let output: Val = bevy::math::Affine3A::from_rotation_translation( rotation, translation, ) @@ -15841,7 +19587,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = Affine3A::from_mat4(m) + let output: Val = bevy::math::Affine3A::from_mat4( + m, + ) .into(); output }, @@ -15853,7 +19601,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = Affine3A::look_to_lh( + let output: Val = bevy::math::Affine3A::look_to_lh( eye, dir, up, @@ -15869,7 +19617,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = Affine3A::look_to_rh( + let output: Val = bevy::math::Affine3A::look_to_rh( eye, dir, up, @@ -15885,7 +19633,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = Affine3A::look_at_lh( + let output: Val = bevy::math::Affine3A::look_at_lh( eye, center, up, @@ -15901,7 +19649,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = Affine3A::look_at_rh( + let output: Val = bevy::math::Affine3A::look_at_rh( eye, center, up, @@ -15913,7 +19661,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = Affine3A::transform_point3( + let output: Val = bevy::math::Affine3A::transform_point3( _self, rhs, ) @@ -15924,7 +19672,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = Affine3A::transform_vector3( + let output: Val = bevy::math::Affine3A::transform_vector3( _self, rhs, ) @@ -15935,7 +19683,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3a", |_self: Ref, rhs: Val| { - let output: Val = Affine3A::transform_point3a( + let output: Val = bevy::math::Affine3A::transform_point3a( _self, rhs, ) @@ -15946,7 +19694,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3a", |_self: Ref, rhs: Val| { - let output: Val = Affine3A::transform_vector3a( + let output: Val = bevy::math::Affine3A::transform_vector3a( _self, rhs, ) @@ -15957,14 +19705,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Affine3A::is_finite(_self).into(); + let output: bool = bevy::math::Affine3A::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = Affine3A::is_nan(_self).into(); + let output: bool = bevy::math::Affine3A::is_nan(_self).into(); output }, ) @@ -15975,7 +19723,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = Affine3A::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::Affine3A::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -15983,7 +19735,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = Affine3A::inverse(_self) + let output: Val = bevy::math::Affine3A::inverse( + _self, + ) .into(); output }, @@ -15991,7 +19745,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Affine3A::mul(_self, rhs) + let output: Val = bevy::math::Affine3A::mul( + _self, + rhs, + ) .into(); output }, @@ -15999,15 +19756,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = Affine3A::mul(_self, rhs).into(); + let output: Val = bevy::math::Affine3A::mul( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = DAffine2::eq(_self, rhs).into(); + let output: bool = bevy::math::DAffine2::eq(_self, rhs).into(); output }, ) @@ -16018,7 +19779,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = DAffine2::from_cols( + let output: Val = bevy::math::DAffine2::from_cols( x_axis, y_axis, z_axis, @@ -16030,21 +19791,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 6] = DAffine2::to_cols_array(_self).into(); + let output: [f64; 6] = bevy::math::DAffine2::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 2]; 3] = DAffine2::to_cols_array_2d(_self).into(); + let output: [[f64; 2]; 3] = bevy::math::DAffine2::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = DAffine2::from_scale(scale) + let output: Val = bevy::math::DAffine2::from_scale( + scale, + ) .into(); output }, @@ -16052,7 +19819,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = DAffine2::from_angle(angle) + let output: Val = bevy::math::DAffine2::from_angle( + angle, + ) .into(); output }, @@ -16060,7 +19829,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = DAffine2::from_translation( + let output: Val = bevy::math::DAffine2::from_translation( translation, ) .into(); @@ -16070,7 +19839,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |matrix2: Val| { - let output: Val = DAffine2::from_mat2(matrix2) + let output: Val = bevy::math::DAffine2::from_mat2( + matrix2, + ) .into(); output }, @@ -16078,7 +19849,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2_translation", |matrix2: Val, translation: Val| { - let output: Val = DAffine2::from_mat2_translation( + let output: Val = bevy::math::DAffine2::from_mat2_translation( matrix2, translation, ) @@ -16093,7 +19864,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f64, translation: Val| { - let output: Val = DAffine2::from_scale_angle_translation( + let output: Val = bevy::math::DAffine2::from_scale_angle_translation( scale, angle, translation, @@ -16105,7 +19876,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle_translation", |angle: f64, translation: Val| { - let output: Val = DAffine2::from_angle_translation( + let output: Val = bevy::math::DAffine2::from_angle_translation( angle, translation, ) @@ -16116,7 +19887,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = DAffine2::from_mat3(m) + let output: Val = bevy::math::DAffine2::from_mat3( + m, + ) .into(); output }, @@ -16124,7 +19897,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = DAffine2::transform_point2( + let output: Val = bevy::math::DAffine2::transform_point2( _self, rhs, ) @@ -16135,7 +19908,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = DAffine2::transform_vector2( + let output: Val = bevy::math::DAffine2::transform_vector2( _self, rhs, ) @@ -16146,14 +19919,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = DAffine2::is_finite(_self).into(); + let output: bool = bevy::math::DAffine2::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = DAffine2::is_nan(_self).into(); + let output: bool = bevy::math::DAffine2::is_nan(_self).into(); output }, ) @@ -16164,7 +19937,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DAffine2::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DAffine2::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -16172,7 +19949,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = DAffine2::inverse(_self) + let output: Val = bevy::math::DAffine2::inverse( + _self, + ) .into(); output }, @@ -16180,7 +19959,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DAffine2::mul(_self, rhs) + let output: Val = bevy::math::DAffine2::mul( + _self, + rhs, + ) .into(); output }, @@ -16188,7 +19970,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DAffine2::mul(_self, rhs) + let output: Val = bevy::math::DAffine2::mul( + _self, + rhs, + ) .into(); output }, @@ -16196,12 +19981,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DAffine2::clone(_self) + let output: Val = bevy::math::DAffine2::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_cols", | @@ -16210,7 +19997,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = DAffine3::from_cols( + let output: Val = bevy::math::DAffine3::from_cols( x_axis, y_axis, z_axis, @@ -16223,21 +20010,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 12] = DAffine3::to_cols_array(_self).into(); + let output: [f64; 12] = bevy::math::DAffine3::to_cols_array(_self) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 3]; 4] = DAffine3::to_cols_array_2d(_self).into(); + let output: [[f64; 3]; 4] = bevy::math::DAffine3::to_cols_array_2d( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = DAffine3::from_scale(scale) + let output: Val = bevy::math::DAffine3::from_scale( + scale, + ) .into(); output }, @@ -16245,7 +20038,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = DAffine3::from_quat(rotation) + let output: Val = bevy::math::DAffine3::from_quat( + rotation, + ) .into(); output }, @@ -16253,7 +20048,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = DAffine3::from_axis_angle( + let output: Val = bevy::math::DAffine3::from_axis_angle( axis, angle, ) @@ -16264,7 +20059,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = DAffine3::from_rotation_x( + let output: Val = bevy::math::DAffine3::from_rotation_x( angle, ) .into(); @@ -16274,7 +20069,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = DAffine3::from_rotation_y( + let output: Val = bevy::math::DAffine3::from_rotation_y( angle, ) .into(); @@ -16284,7 +20079,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = DAffine3::from_rotation_z( + let output: Val = bevy::math::DAffine3::from_rotation_z( angle, ) .into(); @@ -16294,7 +20089,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = DAffine3::from_translation( + let output: Val = bevy::math::DAffine3::from_translation( translation, ) .into(); @@ -16304,7 +20099,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat3: Val| { - let output: Val = DAffine3::from_mat3(mat3) + let output: Val = bevy::math::DAffine3::from_mat3( + mat3, + ) .into(); output }, @@ -16312,7 +20109,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_translation", |mat3: Val, translation: Val| { - let output: Val = DAffine3::from_mat3_translation( + let output: Val = bevy::math::DAffine3::from_mat3_translation( mat3, translation, ) @@ -16327,7 +20124,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = DAffine3::from_scale_rotation_translation( + let output: Val = bevy::math::DAffine3::from_scale_rotation_translation( scale, rotation, translation, @@ -16339,7 +20136,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = DAffine3::from_rotation_translation( + let output: Val = bevy::math::DAffine3::from_rotation_translation( rotation, translation, ) @@ -16350,7 +20147,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = DAffine3::from_mat4(m) + let output: Val = bevy::math::DAffine3::from_mat4( + m, + ) .into(); output }, @@ -16362,7 +20161,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = DAffine3::look_to_lh( + let output: Val = bevy::math::DAffine3::look_to_lh( eye, dir, up, @@ -16378,7 +20177,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = DAffine3::look_to_rh( + let output: Val = bevy::math::DAffine3::look_to_rh( eye, dir, up, @@ -16394,7 +20193,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = DAffine3::look_at_lh( + let output: Val = bevy::math::DAffine3::look_at_lh( eye, center, up, @@ -16410,7 +20209,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = DAffine3::look_at_rh( + let output: Val = bevy::math::DAffine3::look_at_rh( eye, center, up, @@ -16422,7 +20221,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = DAffine3::transform_point3( + let output: Val = bevy::math::DAffine3::transform_point3( _self, rhs, ) @@ -16433,7 +20232,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = DAffine3::transform_vector3( + let output: Val = bevy::math::DAffine3::transform_vector3( _self, rhs, ) @@ -16444,14 +20243,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = DAffine3::is_finite(_self).into(); + let output: bool = bevy::math::DAffine3::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = DAffine3::is_nan(_self).into(); + let output: bool = bevy::math::DAffine3::is_nan(_self).into(); output }, ) @@ -16462,7 +20261,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DAffine3::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DAffine3::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -16470,7 +20273,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = DAffine3::inverse(_self) + let output: Val = bevy::math::DAffine3::inverse( + _self, + ) .into(); output }, @@ -16478,14 +20283,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = DAffine3::eq(_self, rhs).into(); + let output: bool = bevy::math::DAffine3::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DAffine3::mul(_self, rhs) + let output: Val = bevy::math::DAffine3::mul( + _self, + rhs, + ) .into(); output }, @@ -16493,7 +20301,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DAffine3::mul(_self, rhs) + let output: Val = bevy::math::DAffine3::mul( + _self, + rhs, + ) .into(); output }, @@ -16501,30 +20312,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DAffine3::clone(_self) + let output: Val = bevy::math::DAffine3::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = DQuat::eq(_self, rhs).into(); + let output: bool = bevy::math::DQuat::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = DQuat::div(_self, rhs).into(); + let output: Val = bevy::math::DQuat::div( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "from_xyzw", |x: f64, y: f64, z: f64, w: f64| { - let output: Val = DQuat::from_xyzw(x, y, z, w) + let output: Val = bevy::math::DQuat::from_xyzw( + x, + y, + z, + w, + ) .into(); output }, @@ -16532,21 +20354,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 4]| { - let output: Val = DQuat::from_array(a).into(); + let output: Val = bevy::math::DQuat::from_array(a) + .into(); output }, ) .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = DQuat::from_vec4(v).into(); + let output: Val = bevy::math::DQuat::from_vec4(v) + .into(); output }, ) .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = DQuat::from_axis_angle( + let output: Val = bevy::math::DQuat::from_axis_angle( axis, angle, ) @@ -16557,7 +20381,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scaled_axis", |v: Val| { - let output: Val = DQuat::from_scaled_axis(v) + let output: Val = bevy::math::DQuat::from_scaled_axis( + v, + ) .into(); output }, @@ -16565,7 +20391,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = DQuat::from_rotation_x(angle) + let output: Val = bevy::math::DQuat::from_rotation_x( + angle, + ) .into(); output }, @@ -16573,7 +20401,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = DQuat::from_rotation_y(angle) + let output: Val = bevy::math::DQuat::from_rotation_y( + angle, + ) .into(); output }, @@ -16581,7 +20411,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = DQuat::from_rotation_z(angle) + let output: Val = bevy::math::DQuat::from_rotation_z( + angle, + ) .into(); output }, @@ -16589,7 +20421,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |euler: Val, a: f64, b: f64, c: f64| { - let output: Val = DQuat::from_euler( + let output: Val = bevy::math::DQuat::from_euler( euler, a, b, @@ -16602,21 +20434,27 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat: Ref| { - let output: Val = DQuat::from_mat3(mat).into(); + let output: Val = bevy::math::DQuat::from_mat3( + mat, + ) + .into(); output }, ) .overwrite_script_function( "from_mat4", |mat: Ref| { - let output: Val = DQuat::from_mat4(mat).into(); + let output: Val = bevy::math::DQuat::from_mat4( + mat, + ) + .into(); output }, ) .overwrite_script_function( "from_rotation_arc", |from: Val, to: Val| { - let output: Val = DQuat::from_rotation_arc( + let output: Val = bevy::math::DQuat::from_rotation_arc( from, to, ) @@ -16627,7 +20465,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_colinear", |from: Val, to: Val| { - let output: Val = DQuat::from_rotation_arc_colinear( + let output: Val = bevy::math::DQuat::from_rotation_arc_colinear( from, to, ) @@ -16638,7 +20476,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_2d", |from: Val, to: Val| { - let output: Val = DQuat::from_rotation_arc_2d( + let output: Val = bevy::math::DQuat::from_rotation_arc_2d( from, to, ) @@ -16649,7 +20487,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_scaled_axis", |_self: Val| { - let output: Val = DQuat::to_scaled_axis(_self) + let output: Val = bevy::math::DQuat::to_scaled_axis( + _self, + ) .into(); output }, @@ -16657,105 +20497,120 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Val, order: Val| { - let output: (f64, f64, f64) = DQuat::to_euler(_self, order).into(); + let output: (f64, f64, f64) = bevy::math::DQuat::to_euler( + _self, + order, + ) + .into(); output }, ) .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = DQuat::to_array(_self).into(); + let output: [f64; 4] = bevy::math::DQuat::to_array(_self).into(); output }, ) .overwrite_script_function( "xyz", |_self: Val| { - let output: Val = DQuat::xyz(_self).into(); + let output: Val = bevy::math::DQuat::xyz(_self) + .into(); output }, ) .overwrite_script_function( "conjugate", |_self: Val| { - let output: Val = DQuat::conjugate(_self).into(); + let output: Val = bevy::math::DQuat::conjugate( + _self, + ) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = DQuat::inverse(_self).into(); + let output: Val = bevy::math::DQuat::inverse( + _self, + ) + .into(); output }, ) .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = DQuat::dot(_self, rhs).into(); + let output: f64 = bevy::math::DQuat::dot(_self, rhs).into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f64 = DQuat::length(_self).into(); + let output: f64 = bevy::math::DQuat::length(_self).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = DQuat::length_squared(_self).into(); + let output: f64 = bevy::math::DQuat::length_squared(_self).into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = DQuat::length_recip(_self).into(); + let output: f64 = bevy::math::DQuat::length_recip(_self).into(); output }, ) .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = DQuat::normalize(_self).into(); + let output: Val = bevy::math::DQuat::normalize( + _self, + ) + .into(); output }, ) .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = DQuat::is_finite(_self).into(); + let output: bool = bevy::math::DQuat::is_finite(_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = DQuat::is_nan(_self).into(); + let output: bool = bevy::math::DQuat::is_nan(_self).into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = DQuat::is_normalized(_self).into(); + let output: bool = bevy::math::DQuat::is_normalized(_self).into(); output }, ) .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = DQuat::is_near_identity(_self).into(); + let output: bool = bevy::math::DQuat::is_near_identity(_self).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = DQuat::angle_between(_self, rhs).into(); + let output: f64 = bevy::math::DQuat::angle_between(_self, rhs) + .into(); output }, ) @@ -16766,7 +20621,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f64| { - let output: Val = DQuat::rotate_towards( + let output: Val = bevy::math::DQuat::rotate_towards( _self, rhs, max_angle, @@ -16782,7 +20637,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = DQuat::abs_diff_eq(_self, rhs, max_abs_diff) + let output: bool = bevy::math::DQuat::abs_diff_eq( + _self, + rhs, + max_abs_diff, + ) .into(); output }, @@ -16790,7 +20649,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, end: Val, s: f64| { - let output: Val = DQuat::lerp(_self, end, s) + let output: Val = bevy::math::DQuat::lerp( + _self, + end, + s, + ) .into(); output }, @@ -16798,7 +20661,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f64| { - let output: Val = DQuat::slerp(_self, end, s) + let output: Val = bevy::math::DQuat::slerp( + _self, + end, + s, + ) .into(); output }, @@ -16806,7 +20673,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Val, rhs: Val| { - let output: Val = DQuat::mul_vec3(_self, rhs) + let output: Val = bevy::math::DQuat::mul_vec3( + _self, + rhs, + ) .into(); output }, @@ -16814,7 +20684,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_quat", |_self: Val, rhs: Val| { - let output: Val = DQuat::mul_quat(_self, rhs) + let output: Val = bevy::math::DQuat::mul_quat( + _self, + rhs, + ) .into(); output }, @@ -16822,71 +20695,99 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_affine3", |a: Ref| { - let output: Val = DQuat::from_affine3(a).into(); + let output: Val = bevy::math::DQuat::from_affine3( + a, + ) + .into(); output }, ) .overwrite_script_function( "as_quat", |_self: Val| { - let output: Val = DQuat::as_quat(_self).into(); + let output: Val = bevy::math::DQuat::as_quat(_self) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DQuat::mul(_self, rhs).into(); + let output: Val = bevy::math::DQuat::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = DQuat::mul(_self, rhs).into(); + let output: Val = bevy::math::DQuat::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = DQuat::clone(_self).into(); + let output: Val = bevy::math::DQuat::clone(_self) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = DQuat::sub(_self, rhs).into(); + let output: Val = bevy::math::DQuat::sub( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = DQuat::mul(_self, rhs).into(); + let output: Val = bevy::math::DQuat::mul( + _self, + rhs, + ) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = DQuat::neg(_self).into(); + let output: Val = bevy::math::DQuat::neg(_self) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = DQuat::add(_self, rhs).into(); + let output: Val = bevy::math::DQuat::add( + _self, + rhs, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = EulerRot::clone(_self) + let output: Val = bevy::math::EulerRot::clone( + _self, + ) .into(); output }, @@ -16894,263 +20795,294 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = EulerRot::eq(_self, other).into(); + let output: bool = bevy::math::EulerRot::eq(_self, other).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = EulerRot::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::math::EulerRot::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { - let output: Val = BVec3A::new(x, y, z).into(); + let output: Val = bevy::math::BVec3A::new( + x, + y, + z, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: bool| { - let output: Val = BVec3A::splat(v).into(); + let output: Val = bevy::math::BVec3A::splat(v) + .into(); output }, ) .overwrite_script_function( "from_array", |a: [bool; 3]| { - let output: Val = BVec3A::from_array(a).into(); + let output: Val = bevy::math::BVec3A::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = BVec3A::bitmask(_self).into(); + let output: u32 = bevy::math::BVec3A::bitmask(_self).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = BVec3A::any(_self).into(); + let output: bool = bevy::math::BVec3A::any(_self).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = BVec3A::all(_self).into(); + let output: bool = bevy::math::BVec3A::all(_self).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = BVec3A::test(_self, index).into(); + let output: bool = bevy::math::BVec3A::test(_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = BVec3A::set(_self, index, value).into(); + let output: () = bevy::math::BVec3A::set(_self, index, value).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BVec3A::clone(_self).into(); + let output: Val = bevy::math::BVec3A::clone( + _self, + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = BVec3A::eq(_self, rhs).into(); + let output: bool = bevy::math::BVec3A::eq(_self, rhs).into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { - let output: Val = BVec4A::new(x, y, z, w).into(); + let output: Val = bevy::math::BVec4A::new( + x, + y, + z, + w, + ) + .into(); output }, ) .overwrite_script_function( "splat", |v: bool| { - let output: Val = BVec4A::splat(v).into(); + let output: Val = bevy::math::BVec4A::splat(v) + .into(); output }, ) .overwrite_script_function( "from_array", |a: [bool; 4]| { - let output: Val = BVec4A::from_array(a).into(); + let output: Val = bevy::math::BVec4A::from_array( + a, + ) + .into(); output }, ) .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = BVec4A::bitmask(_self).into(); + let output: u32 = bevy::math::BVec4A::bitmask(_self).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = BVec4A::any(_self).into(); + let output: bool = bevy::math::BVec4A::any(_self).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = BVec4A::all(_self).into(); + let output: bool = bevy::math::BVec4A::all(_self).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = BVec4A::test(_self, index).into(); + let output: bool = bevy::math::BVec4A::test(_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = BVec4A::set(_self, index, value).into(); + let output: () = bevy::math::BVec4A::set(_self, index, value).into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = BVec4A::eq(_self, rhs).into(); + let output: bool = bevy::math::BVec4A::eq(_self, rhs).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = BVec4A::clone(_self).into(); + let output: Val = bevy::math::BVec4A::clone( + _self, + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = SmolStr::clone(_self).into(); + let output: Val = smol_str::SmolStr::clone(_self) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = SmolStr::eq(_self, other).into(); + let output: bool = smol_str::SmolStr::eq(_self, other).into(); output }, ) .overwrite_script_function( "to_string", |_self: Ref| { - let output: std::string::String = SmolStr::to_string(_self).into(); + let output: std::string::String = smol_str::SmolStr::to_string(_self) + .into(); output }, ) .overwrite_script_function( "len", |_self: Ref| { - let output: usize = SmolStr::len(_self).into(); + let output: usize = smol_str::SmolStr::len(_self).into(); output }, ) .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = SmolStr::is_empty(_self).into(); + let output: bool = smol_str::SmolStr::is_empty(_self).into(); output }, ) .overwrite_script_function( "is_heap_allocated", |_self: Ref| { - let output: bool = SmolStr::is_heap_allocated(_self).into(); + let output: bool = smol_str::SmolStr::is_heap_allocated(_self) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "get_version_num", |_self: Ref| { - let output: usize = Uuid::get_version_num(_self).into(); + let output: usize = uuid::Uuid::get_version_num(_self).into(); output }, ) .overwrite_script_function( "as_u128", |_self: Ref| { - let output: u128 = Uuid::as_u128(_self).into(); + let output: u128 = uuid::Uuid::as_u128(_self).into(); output }, ) .overwrite_script_function( "to_u128_le", |_self: Ref| { - let output: u128 = Uuid::to_u128_le(_self).into(); + let output: u128 = uuid::Uuid::to_u128_le(_self).into(); output }, ) .overwrite_script_function( "as_u64_pair", |_self: Ref| { - let output: (u64, u64) = Uuid::as_u64_pair(_self).into(); + let output: (u64, u64) = uuid::Uuid::as_u64_pair(_self).into(); output }, ) .overwrite_script_function( "into_bytes", |_self: Val| { - let output: [u8; 16] = Uuid::into_bytes(_self).into(); + let output: [u8; 16] = uuid::Uuid::into_bytes(_self).into(); output }, ) .overwrite_script_function( "to_bytes_le", |_self: Ref| { - let output: [u8; 16] = Uuid::to_bytes_le(_self).into(); + let output: [u8; 16] = uuid::Uuid::to_bytes_le(_self).into(); output }, ) .overwrite_script_function( "is_nil", |_self: Ref| { - let output: bool = Uuid::is_nil(_self).into(); + let output: bool = uuid::Uuid::is_nil(_self).into(); output }, ) .overwrite_script_function( "is_max", |_self: Ref| { - let output: bool = Uuid::is_max(_self).into(); + let output: bool = uuid::Uuid::is_max(_self).into(); output }, ) .overwrite_script_function( "encode_buffer", || { - let output: [u8; 45] = Uuid::encode_buffer().into(); + let output: [u8; 45] = uuid::Uuid::encode_buffer().into(); output }, ) @@ -17159,49 +21091,50 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref| { let output: bevy::reflect::erased_serde::__private::serde::__private::Option< [u8; 6], - > = Uuid::get_node_id(_self).into(); + > = uuid::Uuid::get_node_id(_self).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Uuid::assert_receiver_is_total_eq(_self).into(); + let output: () = uuid::Uuid::assert_receiver_is_total_eq(_self) + .into(); output }, ) .overwrite_script_function( "nil", || { - let output: Val = Uuid::nil().into(); + let output: Val = uuid::Uuid::nil().into(); output }, ) .overwrite_script_function( "max", || { - let output: Val = Uuid::max().into(); + let output: Val = uuid::Uuid::max().into(); output }, ) .overwrite_script_function( "from_u128", |v: u128| { - let output: Val = Uuid::from_u128(v).into(); + let output: Val = uuid::Uuid::from_u128(v).into(); output }, ) .overwrite_script_function( "from_u128_le", |v: u128| { - let output: Val = Uuid::from_u128_le(v).into(); + let output: Val = uuid::Uuid::from_u128_le(v).into(); output }, ) .overwrite_script_function( "from_u64_pair", |high_bits: u64, low_bits: u64| { - let output: Val = Uuid::from_u64_pair( + let output: Val = uuid::Uuid::from_u64_pair( high_bits, low_bits, ) @@ -17212,35 +21145,35 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_bytes", |bytes: [u8; 16]| { - let output: Val = Uuid::from_bytes(bytes).into(); + let output: Val = uuid::Uuid::from_bytes(bytes).into(); output }, ) .overwrite_script_function( "from_bytes_le", |b: [u8; 16]| { - let output: Val = Uuid::from_bytes_le(b).into(); + let output: Val = uuid::Uuid::from_bytes_le(b).into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Uuid::eq(_self, other).into(); + let output: bool = uuid::Uuid::eq(_self, other).into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Uuid::clone(_self).into(); + let output: Val = uuid::Uuid::clone(_self).into(); output }, ) .overwrite_script_function( "new_v4", || { - let output: Val = Uuid::new_v4().into(); + let output: Val = uuid::Uuid::new_v4().into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs index b310c16014..40c2846dfe 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs @@ -5,7 +5,8 @@ use super::bevy_ecs::*; use super::bevy_reflect::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -13,29 +14,35 @@ pub struct BevyTimeScriptingPlugin; impl bevy::app::Plugin for BevyTimeScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Fixed::clone(_self) + let output: Val = bevy::time::prelude::Fixed::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Real::clone(_self) + let output: Val = bevy::time::prelude::Real::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Timer::clone(_self) + let output: Val = bevy::time::prelude::Timer::clone( + _self, + ) .into(); output }, @@ -43,14 +50,17 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Timer::assert_receiver_is_total_eq(_self).into(); + let output: () = bevy::time::prelude::Timer::assert_receiver_is_total_eq( + _self, + ) + .into(); output }, ) .overwrite_script_function( "from_seconds", |duration: f32, mode: Val| { - let output: Val = Timer::from_seconds( + let output: Val = bevy::time::prelude::Timer::from_seconds( duration, mode, ) @@ -61,35 +71,41 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "finished", |_self: Ref| { - let output: bool = Timer::finished(_self).into(); + let output: bool = bevy::time::prelude::Timer::finished(_self) + .into(); output }, ) .overwrite_script_function( "just_finished", |_self: Ref| { - let output: bool = Timer::just_finished(_self).into(); + let output: bool = bevy::time::prelude::Timer::just_finished(_self) + .into(); output }, ) .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = Timer::elapsed_secs(_self).into(); + let output: f32 = bevy::time::prelude::Timer::elapsed_secs(_self) + .into(); output }, ) .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = Timer::elapsed_secs_f64(_self).into(); + let output: f64 = bevy::time::prelude::Timer::elapsed_secs_f64(_self) + .into(); output }, ) .overwrite_script_function( "mode", |_self: Ref| { - let output: Val = Timer::mode(_self) + let output: Val = bevy::time::prelude::Timer::mode( + _self, + ) .into(); output }, @@ -100,63 +116,71 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Mut, mode: Val| { - let output: () = Timer::set_mode(_self, mode).into(); + let output: () = bevy::time::prelude::Timer::set_mode(_self, mode) + .into(); output }, ) .overwrite_script_function( "pause", |_self: Mut| { - let output: () = Timer::pause(_self).into(); + let output: () = bevy::time::prelude::Timer::pause(_self).into(); output }, ) .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = Timer::unpause(_self).into(); + let output: () = bevy::time::prelude::Timer::unpause(_self).into(); output }, ) .overwrite_script_function( "paused", |_self: Ref| { - let output: bool = Timer::paused(_self).into(); + let output: bool = bevy::time::prelude::Timer::paused(_self).into(); output }, ) .overwrite_script_function( "reset", |_self: Mut| { - let output: () = Timer::reset(_self).into(); + let output: () = bevy::time::prelude::Timer::reset(_self).into(); output }, ) .overwrite_script_function( "fraction", |_self: Ref| { - let output: f32 = Timer::fraction(_self).into(); + let output: f32 = bevy::time::prelude::Timer::fraction(_self).into(); output }, ) .overwrite_script_function( "fraction_remaining", |_self: Ref| { - let output: f32 = Timer::fraction_remaining(_self).into(); + let output: f32 = bevy::time::prelude::Timer::fraction_remaining( + _self, + ) + .into(); output }, ) .overwrite_script_function( "remaining_secs", |_self: Ref| { - let output: f32 = Timer::remaining_secs(_self).into(); + let output: f32 = bevy::time::prelude::Timer::remaining_secs(_self) + .into(); output }, ) .overwrite_script_function( "times_finished_this_tick", |_self: Ref| { - let output: u32 = Timer::times_finished_this_tick(_self).into(); + let output: u32 = bevy::time::prelude::Timer::times_finished_this_tick( + _self, + ) + .into(); output }, ) @@ -166,25 +190,27 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Timer::eq(_self, other).into(); + let output: bool = bevy::time::prelude::Timer::eq(_self, other) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = TimerMode::eq(_self, other).into(); + let output: bool = bevy::time::prelude::TimerMode::eq(_self, other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = TimerMode::clone( + let output: Val = bevy::time::prelude::TimerMode::clone( _self, ) .into(); @@ -194,74 +220,82 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = TimerMode::assert_receiver_is_total_eq(_self) + let output: () = bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Virtual::clone(_self) + let output: Val = bevy::time::prelude::Virtual::clone( + _self, + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "new", || { - let output: Val = Stopwatch::new().into(); + let output: Val = bevy::time::Stopwatch::new() + .into(); output }, ) .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = Stopwatch::elapsed_secs(_self).into(); + let output: f32 = bevy::time::Stopwatch::elapsed_secs(_self).into(); output }, ) .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = Stopwatch::elapsed_secs_f64(_self).into(); + let output: f64 = bevy::time::Stopwatch::elapsed_secs_f64(_self) + .into(); output }, ) .overwrite_script_function( "pause", |_self: Mut| { - let output: () = Stopwatch::pause(_self).into(); + let output: () = bevy::time::Stopwatch::pause(_self).into(); output }, ) .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = Stopwatch::unpause(_self).into(); + let output: () = bevy::time::Stopwatch::unpause(_self).into(); output }, ) .overwrite_script_function( "is_paused", |_self: Ref| { - let output: bool = Stopwatch::is_paused(_self).into(); + let output: bool = bevy::time::Stopwatch::is_paused(_self).into(); output }, ) .overwrite_script_function( "reset", |_self: Mut| { - let output: () = Stopwatch::reset(_self).into(); + let output: () = bevy::time::Stopwatch::reset(_self).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = Stopwatch::assert_receiver_is_total_eq(_self) + let output: () = bevy::time::Stopwatch::assert_receiver_is_total_eq( + _self, + ) .into(); output }, @@ -269,7 +303,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Stopwatch::clone(_self) + let output: Val = bevy::time::Stopwatch::clone( + _self, + ) .into(); output }, @@ -277,7 +313,7 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = Stopwatch::eq(_self, other).into(); + let output: bool = bevy::time::Stopwatch::eq(_self, other).into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs index 32fa0c402c..9a9e2a72cf 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs @@ -8,7 +8,8 @@ use super::bevy_core::*; use super::bevy_math::*; use super::bevy_hierarchy::*; use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, bindings::ReflectReference, + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; @@ -16,11 +17,11 @@ pub struct BevyTransformScriptingPlugin; impl bevy::app::Plugin for BevyTransformScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = GlobalTransform::clone( + let output: Val = bevy::transform::components::GlobalTransform::clone( _self, ) .into(); @@ -33,7 +34,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, global_transform: Val| { - let output: Val = GlobalTransform::mul( + let output: Val = bevy::transform::components::GlobalTransform::mul( _self, global_transform, ) @@ -47,7 +48,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, transform: Val| { - let output: Val = GlobalTransform::mul( + let output: Val = bevy::transform::components::GlobalTransform::mul( _self, transform, ) @@ -61,14 +62,18 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = GlobalTransform::eq(_self, other).into(); + let output: bool = bevy::transform::components::GlobalTransform::eq( + _self, + other, + ) + .into(); output }, ) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = GlobalTransform::from_xyz( + let output: Val = bevy::transform::components::GlobalTransform::from_xyz( x, y, z, @@ -80,7 +85,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "compute_transform", |_self: Ref| { - let output: Val = GlobalTransform::compute_transform( + let output: Val = bevy::transform::components::GlobalTransform::compute_transform( _self, ) .into(); @@ -93,7 +98,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, parent: Ref| { - let output: Val = GlobalTransform::reparented_to( + let output: Val = bevy::transform::components::GlobalTransform::reparented_to( _self, parent, ) @@ -107,7 +112,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, transform: Val| { - let output: Val = GlobalTransform::mul_transform( + let output: Val = bevy::transform::components::GlobalTransform::mul_transform( _self, transform, ) @@ -115,11 +120,11 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::::new(world) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = Transform::from_xyz( + let output: Val = bevy::transform::components::Transform::from_xyz( x, y, z, @@ -131,42 +136,66 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_x", |_self: Mut, angle: f32| { - let output: () = Transform::rotate_x(_self, angle).into(); + let output: () = bevy::transform::components::Transform::rotate_x( + _self, + angle, + ) + .into(); output }, ) .overwrite_script_function( "rotate_y", |_self: Mut, angle: f32| { - let output: () = Transform::rotate_y(_self, angle).into(); + let output: () = bevy::transform::components::Transform::rotate_y( + _self, + angle, + ) + .into(); output }, ) .overwrite_script_function( "rotate_z", |_self: Mut, angle: f32| { - let output: () = Transform::rotate_z(_self, angle).into(); + let output: () = bevy::transform::components::Transform::rotate_z( + _self, + angle, + ) + .into(); output }, ) .overwrite_script_function( "rotate_local_x", |_self: Mut, angle: f32| { - let output: () = Transform::rotate_local_x(_self, angle).into(); + let output: () = bevy::transform::components::Transform::rotate_local_x( + _self, + angle, + ) + .into(); output }, ) .overwrite_script_function( "rotate_local_y", |_self: Mut, angle: f32| { - let output: () = Transform::rotate_local_y(_self, angle).into(); + let output: () = bevy::transform::components::Transform::rotate_local_y( + _self, + angle, + ) + .into(); output }, ) .overwrite_script_function( "rotate_local_z", |_self: Mut, angle: f32| { - let output: () = Transform::rotate_local_z(_self, angle).into(); + let output: () = bevy::transform::components::Transform::rotate_local_z( + _self, + angle, + ) + .into(); output }, ) @@ -176,7 +205,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, transform: Val| { - let output: Val = Transform::mul_transform( + let output: Val = bevy::transform::components::Transform::mul_transform( _self, transform, ) @@ -187,7 +216,10 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = Transform::is_finite(_self).into(); + let output: bool = bevy::transform::components::Transform::is_finite( + _self, + ) + .into(); output }, ) @@ -197,7 +229,11 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = Transform::eq(_self, other).into(); + let output: bool = bevy::transform::components::Transform::eq( + _self, + other, + ) + .into(); output }, ) @@ -207,7 +243,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, transform: Val| { - let output: Val = Transform::mul( + let output: Val = bevy::transform::components::Transform::mul( _self, transform, ) @@ -221,7 +257,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, global_transform: Val| { - let output: Val = Transform::mul( + let output: Val = bevy::transform::components::Transform::mul( _self, global_transform, ) @@ -232,7 +268,7 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = Transform::clone( + let output: Val = bevy::transform::components::Transform::clone( _self, ) .into(); From b83e9db258192df6828cec96bfd70f10d85f6561 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 01:09:26 +0000 Subject: [PATCH 093/217] fix small thing --- crates/bevy_api_gen/templates/header.tera | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index 4afba72e84..cdab05cad8 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -17,8 +17,6 @@ use bevy_mod_scripting_core::{ function::from::{Ref, Mut, Val} } }; -use bevy_mod_scripting_functions::RegisterScriptFunction; - {% if args.self_is_bms_lua %} use crate::*; {% else %} From 88c361e0fc9040193f0bccf51fdaac89d535528f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 01:13:09 +0000 Subject: [PATCH 094/217] chore(codegen): update bevy bindings (#172) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs | 1 - crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs | 1 - 8 files changed, 8 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs index a1dca75e81..52cf3701e6 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs @@ -8,7 +8,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyCoreScriptingPlugin; impl bevy::app::Plugin for BevyCoreScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs index d011cc0da4..2cf5225eba 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs @@ -7,7 +7,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyEcsScriptingPlugin; impl bevy::app::Plugin for BevyEcsScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs index 411831626e..cf1b816993 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs @@ -9,7 +9,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyHierarchyScriptingPlugin; impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs index 2072c0731c..1b1b08576f 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs @@ -10,7 +10,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyInputScriptingPlugin; impl bevy::app::Plugin for BevyInputScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs index 2bf9766268..b6e75cfcc3 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs @@ -7,7 +7,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyMathScriptingPlugin; impl bevy::app::Plugin for BevyMathScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs index 41273ac2a1..db6638bf45 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs @@ -6,7 +6,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyReflectScriptingPlugin; impl bevy::app::Plugin for BevyReflectScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs index 40c2846dfe..a7cda66096 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs @@ -8,7 +8,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyTimeScriptingPlugin; impl bevy::app::Plugin for BevyTimeScriptingPlugin { diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs index 9a9e2a72cf..d9a4963c6e 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs @@ -11,7 +11,6 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use bevy_mod_scripting_functions::RegisterScriptFunction; use crate::*; pub struct BevyTransformScriptingPlugin; impl bevy::app::Plugin for BevyTransformScriptingPlugin { From 5a95c6b9c6c7f873f05480a68ee7498a7354f7ee Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 13:20:50 +0000 Subject: [PATCH 095/217] try into args --- crates/bevy_api_gen/templates/footer.tera | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 21131852b6..39d2820dfc 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -12,7 +12,7 @@ impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_cas let mut world = app.world_mut(); {% for item in items %} - NamespaceBuilder::<{{ item.import_path }}>::new(world) + NamespaceBuilder::<::{{ item.import_path }}>::new(world) {%- for function in item.functions -%} .overwrite_script_function("{{ function.ident }}", | {%- for arg in function.args -%} @@ -24,13 +24,13 @@ impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_cas : {{- arg.proxy_ty -}}, {%- endfor -%} | { - let output: {{ function.output.proxy_ty }} = {{ item.import_path }}::{{ function.ident }}( + let output: {{ function.output.proxy_ty }} = {{ ::item.import_path }}::{{ function.ident }}( {%- for arg in function.args -%} {%- if arg.ident != "self" -%} {{- arg.ident -}} {%- else -%} _{{- arg.ident -}} - {%- endif -%}, + {%- endif -%}.into(), {%- endfor -%} ).into(); output From a2bdf4a17c338655b552e0bdd0e41dc2a923fa2f Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 13:23:56 +0000 Subject: [PATCH 096/217] fix typo --- crates/bevy_api_gen/templates/footer.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 39d2820dfc..9f29e7e9d4 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -24,7 +24,7 @@ impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_cas : {{- arg.proxy_ty -}}, {%- endfor -%} | { - let output: {{ function.output.proxy_ty }} = {{ ::item.import_path }}::{{ function.ident }}( + let output: {{ function.output.proxy_ty }} = ::{{ item.import_path }}::{{ function.ident }}( {%- for arg in function.args -%} {%- if arg.ident != "self" -%} {{- arg.ident -}} From d081eb7a9bcb7cd4ad3ff4c6733766ce03b709d1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 13:29:06 +0000 Subject: [PATCH 097/217] chore(codegen): update bevy bindings (#173) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy/bevy_core.rs | 11 +- .../src/bevy/bevy_ecs.rs | 171 +- .../src/bevy/bevy_hierarchy.rs | 36 +- .../src/bevy/bevy_input.rs | 655 +- .../src/bevy/bevy_math.rs | 1622 ++- .../src/bevy/bevy_reflect.rs | 11101 +++++++++------- .../src/bevy/bevy_time.rs | 143 +- .../src/bevy/bevy_transform.rs | 126 +- 8 files changed, 7751 insertions(+), 6114 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs index 52cf3701e6..90af119c8a 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs @@ -13,14 +13,17 @@ pub struct BevyCoreScriptingPlugin; impl bevy::app::Plugin for BevyCoreScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::core::prelude::Name>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::core::prelude::Name::eq(_self, other) + let output: bool = ::bevy::core::prelude::Name::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -28,8 +31,8 @@ impl bevy::app::Plugin for BevyCoreScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::core::prelude::Name::clone( - _self, + let output: Val = ::bevy::core::prelude::Name::clone( + _self.into(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs index 2cf5225eba..89c947c828 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs @@ -12,12 +12,12 @@ pub struct BevyEcsScriptingPlugin; impl bevy::app::Plugin for BevyEcsScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::ecs::entity::Entity>::new(world) .overwrite_script_function( "from_raw", |index: u32| { - let output: Val = bevy::ecs::entity::Entity::from_raw( - index, + let output: Val = ::bevy::ecs::entity::Entity::from_raw( + index.into(), ) .into(); output @@ -26,15 +26,16 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = bevy::ecs::entity::Entity::to_bits(_self).into(); + let output: u64 = ::bevy::ecs::entity::Entity::to_bits(_self.into()) + .into(); output }, ) .overwrite_script_function( "from_bits", |bits: u64| { - let output: Val = bevy::ecs::entity::Entity::from_bits( - bits, + let output: Val = ::bevy::ecs::entity::Entity::from_bits( + bits.into(), ) .into(); output @@ -43,14 +44,17 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: u32 = bevy::ecs::entity::Entity::index(_self).into(); + let output: u32 = ::bevy::ecs::entity::Entity::index(_self.into()) + .into(); output }, ) .overwrite_script_function( "generation", |_self: Val| { - let output: u32 = bevy::ecs::entity::Entity::generation(_self) + let output: u32 = ::bevy::ecs::entity::Entity::generation( + _self.into(), + ) .into(); output }, @@ -61,7 +65,10 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::ecs::entity::Entity::eq(_self, other) + let output: bool = ::bevy::ecs::entity::Entity::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -69,27 +76,27 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::ecs::entity::Entity::clone( - _self, + let output: Val = ::bevy::ecs::entity::Entity::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::ecs::world::OnAdd>::new(world); + NamespaceBuilder::<::bevy::ecs::world::OnInsert>::new(world); + NamespaceBuilder::<::bevy::ecs::world::OnRemove>::new(world); + NamespaceBuilder::<::bevy::ecs::world::OnReplace>::new(world); + NamespaceBuilder::<::bevy::ecs::component::ComponentId>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::ecs::component::ComponentId::eq( - _self, - other, + let output: bool = ::bevy::ecs::component::ComponentId::eq( + _self.into(), + other.into(), ) .into(); output @@ -98,8 +105,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::ecs::component::ComponentId::clone( - _self, + let output: Val = ::bevy::ecs::component::ComponentId::clone( + _self.into(), ) .into(); output @@ -108,8 +115,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |index: usize| { - let output: Val = bevy::ecs::component::ComponentId::new( - index, + let output: Val = ::bevy::ecs::component::ComponentId::new( + index.into(), ) .into(); output @@ -118,7 +125,9 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: usize = bevy::ecs::component::ComponentId::index(_self) + let output: usize = ::bevy::ecs::component::ComponentId::index( + _self.into(), + ) .into(); output }, @@ -126,19 +135,19 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::ecs::component::Tick>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::ecs::component::Tick::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::ecs::component::Tick::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -150,7 +159,10 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::ecs::component::Tick::eq(_self, other) + let output: bool = ::bevy::ecs::component::Tick::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -158,8 +170,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::ecs::component::Tick::clone( - _self, + let output: Val = ::bevy::ecs::component::Tick::clone( + _self.into(), ) .into(); output @@ -168,8 +180,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |tick: u32| { - let output: Val = bevy::ecs::component::Tick::new( - tick, + let output: Val = ::bevy::ecs::component::Tick::new( + tick.into(), ) .into(); output @@ -178,14 +190,19 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "get", |_self: Val| { - let output: u32 = bevy::ecs::component::Tick::get(_self).into(); + let output: u32 = ::bevy::ecs::component::Tick::get(_self.into()) + .into(); output }, ) .overwrite_script_function( "set", |_self: Mut, tick: u32| { - let output: () = bevy::ecs::component::Tick::set(_self, tick).into(); + let output: () = ::bevy::ecs::component::Tick::set( + _self.into(), + tick.into(), + ) + .into(); output }, ) @@ -196,21 +213,21 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = bevy::ecs::component::Tick::is_newer_than( - _self, - last_run, - this_run, + let output: bool = ::bevy::ecs::component::Tick::is_newer_than( + _self.into(), + last_run.into(), + this_run.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::ecs::component::ComponentTicks>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::ecs::component::ComponentTicks::clone( - _self, + let output: Val = ::bevy::ecs::component::ComponentTicks::clone( + _self.into(), ) .into(); output @@ -223,10 +240,10 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = bevy::ecs::component::ComponentTicks::is_added( - _self, - last_run, - this_run, + let output: bool = ::bevy::ecs::component::ComponentTicks::is_added( + _self.into(), + last_run.into(), + this_run.into(), ) .into(); output @@ -239,10 +256,10 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = bevy::ecs::component::ComponentTicks::is_changed( - _self, - last_run, - this_run, + let output: bool = ::bevy::ecs::component::ComponentTicks::is_changed( + _self.into(), + last_run.into(), + this_run.into(), ) .into(); output @@ -251,8 +268,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |change_tick: Val| { - let output: Val = bevy::ecs::component::ComponentTicks::new( - change_tick, + let output: Val = ::bevy::ecs::component::ComponentTicks::new( + change_tick.into(), ) .into(); output @@ -264,20 +281,20 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Mut, change_tick: Val| { - let output: () = bevy::ecs::component::ComponentTicks::set_changed( - _self, - change_tick, + let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( + _self.into(), + change_tick.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::ecs::identifier::Identifier>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::ecs::identifier::Identifier::clone( - _self, + let output: Val = ::bevy::ecs::identifier::Identifier::clone( + _self.into(), ) .into(); output @@ -286,7 +303,9 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "low", |_self: Val| { - let output: u32 = bevy::ecs::identifier::Identifier::low(_self) + let output: u32 = ::bevy::ecs::identifier::Identifier::low( + _self.into(), + ) .into(); output }, @@ -294,8 +313,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "masked_high", |_self: Val| { - let output: u32 = bevy::ecs::identifier::Identifier::masked_high( - _self, + let output: u32 = ::bevy::ecs::identifier::Identifier::masked_high( + _self.into(), ) .into(); output @@ -304,7 +323,9 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = bevy::ecs::identifier::Identifier::to_bits(_self) + let output: u64 = ::bevy::ecs::identifier::Identifier::to_bits( + _self.into(), + ) .into(); output }, @@ -312,8 +333,8 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "from_bits", |value: u64| { - let output: Val = bevy::ecs::identifier::Identifier::from_bits( - value, + let output: Val = ::bevy::ecs::identifier::Identifier::from_bits( + value.into(), ) .into(); output @@ -325,40 +346,40 @@ impl bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::ecs::identifier::Identifier::eq( - _self, - other, + let output: bool = ::bevy::ecs::identifier::Identifier::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::ecs::entity::EntityHash>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::ecs::entity::EntityHash::clone( - _self, + let output: Val = ::bevy::ecs::entity::EntityHash::clone( + _self.into(), ) .into(); output }, ); NamespaceBuilder::< - bevy::ecs::removal_detection::RemovedComponentEntity, + ::bevy::ecs::removal_detection::RemovedComponentEntity, >::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val< bevy::ecs::removal_detection::RemovedComponentEntity, - > = bevy::ecs::removal_detection::RemovedComponentEntity::clone( - _self, + > = ::bevy::ecs::removal_detection::RemovedComponentEntity::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world); + NamespaceBuilder::<::bevy::ecs::system::SystemIdMarker>::new(world); } } diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs index cf1b816993..c6f89ceef2 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs @@ -14,7 +14,7 @@ pub struct BevyHierarchyScriptingPlugin; impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::hierarchy::prelude::Children>::new(world) .overwrite_script_function( "swap", | @@ -22,21 +22,21 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { a_index: usize, b_index: usize| { - let output: () = bevy::hierarchy::prelude::Children::swap( - _self, - a_index, - b_index, + let output: () = ::bevy::hierarchy::prelude::Children::swap( + _self.into(), + a_index.into(), + b_index.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::hierarchy::prelude::Parent>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -48,17 +48,20 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::hierarchy::prelude::Parent::eq(_self, other) + let output: bool = ::bevy::hierarchy::prelude::Parent::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::hierarchy::HierarchyEvent>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::hierarchy::HierarchyEvent::clone( - _self, + let output: Val = ::bevy::hierarchy::HierarchyEvent::clone( + _self.into(), ) .into(); output @@ -70,7 +73,10 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::hierarchy::HierarchyEvent::eq(_self, other) + let output: bool = ::bevy::hierarchy::HierarchyEvent::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -78,8 +84,8 @@ impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( + _self.into(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs index 1b1b08576f..b825240bc5 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs @@ -15,12 +15,12 @@ pub struct BevyInputScriptingPlugin; impl bevy::app::Plugin for BevyInputScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::Gamepad>::new(world) .overwrite_script_function( "vendor_id", |_self: Ref| { - let output: std::option::Option = bevy::input::gamepad::Gamepad::vendor_id( - _self, + let output: std::option::Option = ::bevy::input::gamepad::Gamepad::vendor_id( + _self.into(), ) .into(); output @@ -29,8 +29,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "product_id", |_self: Ref| { - let output: std::option::Option = bevy::input::gamepad::Gamepad::product_id( - _self, + let output: std::option::Option = ::bevy::input::gamepad::Gamepad::product_id( + _self.into(), ) .into(); output @@ -42,9 +42,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = bevy::input::gamepad::Gamepad::pressed( - _self, - button_type, + let output: bool = ::bevy::input::gamepad::Gamepad::pressed( + _self.into(), + button_type.into(), ) .into(); output @@ -56,9 +56,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = bevy::input::gamepad::Gamepad::just_pressed( - _self, - button_type, + let output: bool = ::bevy::input::gamepad::Gamepad::just_pressed( + _self.into(), + button_type.into(), ) .into(); output @@ -70,20 +70,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = bevy::input::gamepad::Gamepad::just_released( - _self, - button_type, + let output: bool = ::bevy::input::gamepad::Gamepad::just_released( + _self.into(), + button_type.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadAxis>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -95,9 +95,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadAxis::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadAxis::eq( + _self.into(), + other.into(), ) .into(); output @@ -106,23 +106,23 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadAxis::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadAxis::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadButton>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadButton::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadButton::eq( + _self.into(), + other.into(), ) .into(); output @@ -131,8 +131,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadButton::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadButton::clone( + _self.into(), ) .into(); output @@ -141,32 +141,35 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadSettings>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadSettings::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadSettings::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::keyboard::KeyCode>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::keyboard::KeyCode::eq(_self, other) + let output: bool = ::bevy::input::keyboard::KeyCode::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -174,8 +177,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::keyboard::KeyCode::clone( - _self, + let output: Val = ::bevy::input::keyboard::KeyCode::clone( + _self.into(), ) .into(); output @@ -184,19 +187,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::MouseButton>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -208,7 +211,10 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::MouseButton::eq(_self, other) + let output: bool = ::bevy::input::mouse::MouseButton::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -216,19 +222,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::MouseButton::clone( - _self, + let output: Val = ::bevy::input::mouse::MouseButton::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::touch::TouchInput>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::touch::TouchInput::clone( - _self, + let output: Val = ::bevy::input::touch::TouchInput::clone( + _self.into(), ) .into(); output @@ -240,17 +246,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::touch::TouchInput::eq(_self, other) + let output: bool = ::bevy::input::touch::TouchInput::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::keyboard::KeyboardFocusLost>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::keyboard::KeyboardFocusLost::clone( - _self, + let output: Val = ::bevy::input::keyboard::KeyboardFocusLost::clone( + _self.into(), ) .into(); output @@ -259,8 +268,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -272,24 +281,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::keyboard::KeyboardFocusLost::eq( - _self, - other, + let output: bool = ::bevy::input::keyboard::KeyboardFocusLost::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::keyboard::KeyboardInput>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::keyboard::KeyboardInput::eq( - _self, - other, + let output: bool = ::bevy::input::keyboard::KeyboardInput::eq( + _self.into(), + other.into(), ) .into(); output @@ -298,8 +307,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::keyboard::KeyboardInput::clone( - _self, + let output: Val = ::bevy::input::keyboard::KeyboardInput::clone( + _self.into(), ) .into(); output @@ -308,23 +317,23 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseMotion>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::AccumulatedMouseMotion::eq( - _self, - other, + let output: bool = ::bevy::input::mouse::AccumulatedMouseMotion::eq( + _self.into(), + other.into(), ) .into(); output @@ -333,19 +342,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::AccumulatedMouseMotion::clone( - _self, + let output: Val = ::bevy::input::mouse::AccumulatedMouseMotion::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseScroll>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::AccumulatedMouseScroll::clone( - _self, + let output: Val = ::bevy::input::mouse::AccumulatedMouseScroll::clone( + _self.into(), ) .into(); output @@ -357,24 +366,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::AccumulatedMouseScroll::eq( - _self, - other, + let output: bool = ::bevy::input::mouse::AccumulatedMouseScroll::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::MouseButtonInput>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::MouseButtonInput::eq( - _self, - other, + let output: bool = ::bevy::input::mouse::MouseButtonInput::eq( + _self.into(), + other.into(), ) .into(); output @@ -383,8 +392,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::MouseButtonInput::clone( - _self, + let output: Val = ::bevy::input::mouse::MouseButtonInput::clone( + _self.into(), ) .into(); output @@ -393,21 +402,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::MouseMotion>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::MouseMotion::eq(_self, other) + let output: bool = ::bevy::input::mouse::MouseMotion::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -415,19 +427,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::MouseMotion::clone( - _self, + let output: Val = ::bevy::input::mouse::MouseMotion::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::MouseWheel>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::MouseWheel::clone( - _self, + let output: Val = ::bevy::input::mouse::MouseWheel::clone( + _self.into(), ) .into(); output @@ -439,17 +451,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::MouseWheel::eq(_self, other) + let output: bool = ::bevy::input::mouse::MouseWheel::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadAxisChangedEvent>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadAxisChangedEvent::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadAxisChangedEvent::clone( + _self.into(), ) .into(); output @@ -461,20 +476,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadAxisChangedEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadAxisChangedEvent::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadButtonChangedEvent>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadButtonChangedEvent::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadButtonChangedEvent::clone( + _self.into(), ) .into(); output @@ -486,24 +501,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadButtonChangedEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadButtonChangedEvent::eq( + _self.into(), + other.into(), ) .into(); output }, ); NamespaceBuilder::< - bevy::input::gamepad::GamepadButtonStateChangedEvent, + ::bevy::input::gamepad::GamepadButtonStateChangedEvent, >::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val< bevy::input::gamepad::GamepadButtonStateChangedEvent, - > = bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( - _self, + > = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( + _self.into(), ) .into(); output @@ -515,9 +530,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( + _self.into(), + other.into(), ) .into(); output @@ -526,23 +541,23 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadConnection>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadConnection::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadConnection::eq( + _self.into(), + other.into(), ) .into(); output @@ -551,19 +566,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadConnection::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadConnection::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadConnectionEvent>::new(world) .overwrite_script_function( "connected", |_self: Ref| { - let output: bool = bevy::input::gamepad::GamepadConnectionEvent::connected( - _self, + let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::connected( + _self.into(), ) .into(); output @@ -572,8 +587,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "disconnected", |_self: Ref| { - let output: bool = bevy::input::gamepad::GamepadConnectionEvent::disconnected( - _self, + let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::disconnected( + _self.into(), ) .into(); output @@ -585,9 +600,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadConnectionEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::eq( + _self.into(), + other.into(), ) .into(); output @@ -596,23 +611,23 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadConnectionEvent::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadConnectionEvent::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadEvent>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadEvent::eq( + _self.into(), + other.into(), ) .into(); output @@ -621,19 +636,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadEvent::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadEvent::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadInput>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -642,8 +657,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadInput::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadInput::clone( + _self.into(), ) .into(); output @@ -655,35 +670,37 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadInput::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadInput::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleRequest>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadRumbleRequest::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadRumbleRequest::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::< + ::bevy::input::gamepad::RawGamepadAxisChangedEvent, + >::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( + _self.into(), + other.into(), ) .into(); output @@ -692,22 +709,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( - _self, + let output: Val = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( + _self.into(), ) .into(); output }, ); NamespaceBuilder::< - bevy::input::gamepad::RawGamepadButtonChangedEvent, + ::bevy::input::gamepad::RawGamepadButtonChangedEvent, >::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val< bevy::input::gamepad::RawGamepadButtonChangedEvent, - > = bevy::input::gamepad::RawGamepadButtonChangedEvent::clone(_self) + > = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::clone( + _self.into(), + ) .into(); output }, @@ -718,20 +737,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::RawGamepadEvent>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::RawGamepadEvent::clone( - _self, + let output: Val = ::bevy::input::gamepad::RawGamepadEvent::clone( + _self.into(), ) .into(); output @@ -743,20 +762,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::RawGamepadEvent::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::RawGamepadEvent::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gestures::PinchGesture>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gestures::PinchGesture::clone( - _self, + let output: Val = ::bevy::input::gestures::PinchGesture::clone( + _self.into(), ) .into(); output @@ -768,20 +787,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gestures::PinchGesture::eq( - _self, - other, + let output: bool = ::bevy::input::gestures::PinchGesture::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gestures::RotationGesture>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gestures::RotationGesture::clone( - _self, + let output: Val = ::bevy::input::gestures::RotationGesture::clone( + _self.into(), ) .into(); output @@ -793,24 +812,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gestures::RotationGesture::eq( - _self, - other, + let output: bool = ::bevy::input::gestures::RotationGesture::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gestures::DoubleTapGesture>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gestures::DoubleTapGesture::eq( - _self, - other, + let output: bool = ::bevy::input::gestures::DoubleTapGesture::eq( + _self.into(), + other.into(), ) .into(); output @@ -819,19 +838,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gestures::DoubleTapGesture::clone( - _self, + let output: Val = ::bevy::input::gestures::DoubleTapGesture::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gestures::PanGesture>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gestures::PanGesture::clone( - _self, + let output: Val = ::bevy::input::gestures::PanGesture::clone( + _self.into(), ) .into(); output @@ -843,29 +862,35 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gestures::PanGesture::eq( - _self, - other, + let output: bool = ::bevy::input::gestures::PanGesture::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::ButtonState>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::ButtonState::eq(_self, other).into(); + let output: bool = ::bevy::input::ButtonState::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "is_pressed", |_self: Ref| { - let output: bool = bevy::input::ButtonState::is_pressed(_self) + let output: bool = ::bevy::input::ButtonState::is_pressed( + _self.into(), + ) .into(); output }, @@ -873,8 +898,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::ButtonState::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::ButtonState::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -883,23 +908,23 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::ButtonState::clone( - _self, + let output: Val = ::bevy::input::ButtonState::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::ButtonSettings>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::ButtonSettings::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::ButtonSettings::eq( + _self.into(), + other.into(), ) .into(); output @@ -908,8 +933,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::ButtonSettings::clone( - _self, + let output: Val = ::bevy::input::gamepad::ButtonSettings::clone( + _self.into(), ) .into(); output @@ -918,9 +943,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "is_pressed", |_self: Ref, value: f32| { - let output: bool = bevy::input::gamepad::ButtonSettings::is_pressed( - _self, - value, + let output: bool = ::bevy::input::gamepad::ButtonSettings::is_pressed( + _self.into(), + value.into(), ) .into(); output @@ -929,9 +954,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "is_released", |_self: Ref, value: f32| { - let output: bool = bevy::input::gamepad::ButtonSettings::is_released( - _self, - value, + let output: bool = ::bevy::input::gamepad::ButtonSettings::is_released( + _self.into(), + value.into(), ) .into(); output @@ -940,8 +965,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "press_threshold", |_self: Ref| { - let output: f32 = bevy::input::gamepad::ButtonSettings::press_threshold( - _self, + let output: f32 = ::bevy::input::gamepad::ButtonSettings::press_threshold( + _self.into(), ) .into(); output @@ -950,9 +975,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_press_threshold", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::ButtonSettings::set_press_threshold( - _self, - value, + let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( + _self.into(), + value.into(), ) .into(); output @@ -961,8 +986,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "release_threshold", |_self: Ref| { - let output: f32 = bevy::input::gamepad::ButtonSettings::release_threshold( - _self, + let output: f32 = ::bevy::input::gamepad::ButtonSettings::release_threshold( + _self.into(), ) .into(); output @@ -971,24 +996,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_release_threshold", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::ButtonSettings::set_release_threshold( - _self, - value, + let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( + _self.into(), + value.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::AxisSettings>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::AxisSettings::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::AxisSettings::eq( + _self.into(), + other.into(), ) .into(); output @@ -997,8 +1022,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "livezone_upperbound", |_self: Ref| { - let output: f32 = bevy::input::gamepad::AxisSettings::livezone_upperbound( - _self, + let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_upperbound( + _self.into(), ) .into(); output @@ -1007,9 +1032,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_livezone_upperbound", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_upperbound( - _self, - value, + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( + _self.into(), + value.into(), ) .into(); output @@ -1018,8 +1043,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "deadzone_upperbound", |_self: Ref| { - let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_upperbound( - _self, + let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_upperbound( + _self.into(), ) .into(); output @@ -1028,9 +1053,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_deadzone_upperbound", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( - _self, - value, + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( + _self.into(), + value.into(), ) .into(); output @@ -1039,8 +1064,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "livezone_lowerbound", |_self: Ref| { - let output: f32 = bevy::input::gamepad::AxisSettings::livezone_lowerbound( - _self, + let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_lowerbound( + _self.into(), ) .into(); output @@ -1049,9 +1074,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_livezone_lowerbound", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( - _self, - value, + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( + _self.into(), + value.into(), ) .into(); output @@ -1060,8 +1085,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "deadzone_lowerbound", |_self: Ref| { - let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_lowerbound( - _self, + let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_lowerbound( + _self.into(), ) .into(); output @@ -1070,9 +1095,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_deadzone_lowerbound", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( - _self, - value, + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( + _self.into(), + value.into(), ) .into(); output @@ -1081,8 +1106,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "threshold", |_self: Ref| { - let output: f32 = bevy::input::gamepad::AxisSettings::threshold( - _self, + let output: f32 = ::bevy::input::gamepad::AxisSettings::threshold( + _self.into(), ) .into(); output @@ -1091,9 +1116,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_threshold", |_self: Mut, value: f32| { - let output: f32 = bevy::input::gamepad::AxisSettings::set_threshold( - _self, - value, + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( + _self.into(), + value.into(), ) .into(); output @@ -1102,9 +1127,9 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clamp", |_self: Ref, new_value: f32| { - let output: f32 = bevy::input::gamepad::AxisSettings::clamp( - _self, - new_value, + let output: f32 = ::bevy::input::gamepad::AxisSettings::clamp( + _self.into(), + new_value.into(), ) .into(); output @@ -1117,10 +1142,10 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { new_value: f32, old_value: std::option::Option| { - let output: std::option::Option = bevy::input::gamepad::AxisSettings::filter( - _self, - new_value, - old_value, + let output: std::option::Option = ::bevy::input::gamepad::AxisSettings::filter( + _self.into(), + new_value.into(), + old_value.into(), ) .into(); output @@ -1129,14 +1154,14 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::AxisSettings::clone( - _self, + let output: Val = ::bevy::input::gamepad::AxisSettings::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::ButtonAxisSettings>::new(world) .overwrite_script_function( "filter", | @@ -1144,10 +1169,10 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { new_value: f32, old_value: std::option::Option| { - let output: std::option::Option = bevy::input::gamepad::ButtonAxisSettings::filter( - _self, - new_value, - old_value, + let output: std::option::Option = ::bevy::input::gamepad::ButtonAxisSettings::filter( + _self.into(), + new_value.into(), + old_value.into(), ) .into(); output @@ -1156,19 +1181,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::ButtonAxisSettings::clone( - _self, + let output: Val = ::bevy::input::gamepad::ButtonAxisSettings::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleIntensity>::new(world) .overwrite_script_function( "weak_motor", |intensity: f32| { - let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( - intensity, + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( + intensity.into(), ) .into(); output @@ -1177,8 +1202,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "strong_motor", |intensity: f32| { - let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( - intensity, + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( + intensity.into(), ) .into(); output @@ -1187,8 +1212,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::clone( - _self, + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::clone( + _self.into(), ) .into(); output @@ -1200,20 +1225,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::gamepad::GamepadRumbleIntensity::eq( - _self, - other, + let output: bool = ::bevy::input::gamepad::GamepadRumbleIntensity::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::keyboard::Key>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::keyboard::Key::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::keyboard::Key::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -1222,8 +1247,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::keyboard::Key::clone( - _self, + let output: Val = ::bevy::input::keyboard::Key::clone( + _self.into(), ) .into(); output @@ -1235,21 +1260,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::keyboard::Key::eq(_self, other) + let output: bool = ::bevy::input::keyboard::Key::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::keyboard::NativeKeyCode>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::keyboard::NativeKeyCode::eq( - _self, - other, + let output: bool = ::bevy::input::keyboard::NativeKeyCode::eq( + _self.into(), + other.into(), ) .into(); output @@ -1258,8 +1286,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::keyboard::NativeKeyCode::clone( - _self, + let output: Val = ::bevy::input::keyboard::NativeKeyCode::clone( + _self.into(), ) .into(); output @@ -1268,21 +1296,24 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::keyboard::NativeKey>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::input::keyboard::NativeKey::eq(_self, other) + let output: bool = ::bevy::input::keyboard::NativeKey::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -1290,8 +1321,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -1300,19 +1331,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::keyboard::NativeKey::clone( - _self, + let output: Val = ::bevy::input::keyboard::NativeKey::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::mouse::MouseScrollUnit>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::mouse::MouseScrollUnit::clone( - _self, + let output: Val = ::bevy::input::mouse::MouseScrollUnit::clone( + _self.into(), ) .into(); output @@ -1321,8 +1352,8 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -1334,20 +1365,20 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::mouse::MouseScrollUnit::eq( - _self, - other, + let output: bool = ::bevy::input::mouse::MouseScrollUnit::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::touch::TouchPhase>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -1359,7 +1390,10 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::touch::TouchPhase::eq(_self, other) + let output: bool = ::bevy::input::touch::TouchPhase::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -1367,19 +1401,19 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::touch::TouchPhase::clone( - _self, + let output: Val = ::bevy::input::touch::TouchPhase::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::input::touch::ForceTouch>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::input::touch::ForceTouch::clone( - _self, + let output: Val = ::bevy::input::touch::ForceTouch::clone( + _self.into(), ) .into(); output @@ -1391,7 +1425,10 @@ impl bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::input::touch::ForceTouch::eq(_self, other) + let output: bool = ::bevy::input::touch::ForceTouch::eq( + _self.into(), + other.into(), + ) .into(); output }, diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs index b6e75cfcc3..540ed8dd48 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs @@ -12,29 +12,34 @@ pub struct BevyMathScriptingPlugin; impl bevy::app::Plugin for BevyMathScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::AspectRatio>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::AspectRatio::eq(_self, other).into(); + let output: bool = ::bevy::math::AspectRatio::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "ratio", |_self: Ref| { - let output: f32 = bevy::math::AspectRatio::ratio(_self).into(); + let output: f32 = ::bevy::math::AspectRatio::ratio(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::AspectRatio::inverse( - _self, + let output: Val = ::bevy::math::AspectRatio::inverse( + _self.into(), ) .into(); output @@ -43,7 +48,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_landscape", |_self: Ref| { - let output: bool = bevy::math::AspectRatio::is_landscape(_self) + let output: bool = ::bevy::math::AspectRatio::is_landscape( + _self.into(), + ) .into(); output }, @@ -51,7 +58,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_portrait", |_self: Ref| { - let output: bool = bevy::math::AspectRatio::is_portrait(_self) + let output: bool = ::bevy::math::AspectRatio::is_portrait( + _self.into(), + ) .into(); output }, @@ -59,26 +68,27 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_square", |_self: Ref| { - let output: bool = bevy::math::AspectRatio::is_square(_self).into(); + let output: bool = ::bevy::math::AspectRatio::is_square(_self.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::AspectRatio::clone( - _self, + let output: Val = ::bevy::math::AspectRatio::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::CompassOctant>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::CompassOctant::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::CompassOctant::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -87,8 +97,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::CompassOctant::clone( - _self, + let output: Val = ::bevy::math::CompassOctant::clone( + _self.into(), ) .into(); output @@ -100,17 +110,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::CompassOctant::eq(_self, other) + let output: bool = ::bevy::math::CompassOctant::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::CompassQuadrant>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::CompassQuadrant::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::CompassQuadrant::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -122,7 +135,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::CompassQuadrant::eq(_self, other) + let output: bool = ::bevy::math::CompassQuadrant::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -130,23 +146,23 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::CompassQuadrant::clone( - _self, + let output: Val = ::bevy::math::CompassQuadrant::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Isometry2d>::new(world) .overwrite_script_function( "mul", | _self: Val, rhs: Val| { - let output: Val = bevy::math::Isometry2d::mul( - _self, - rhs, + let output: Val = ::bevy::math::Isometry2d::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -155,8 +171,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_rotation", |rotation: Val| { - let output: Val = bevy::math::Isometry2d::from_rotation( - rotation, + let output: Val = ::bevy::math::Isometry2d::from_rotation( + rotation.into(), ) .into(); output @@ -165,9 +181,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xy", |x: f32, y: f32| { - let output: Val = bevy::math::Isometry2d::from_xy( - x, - y, + let output: Val = ::bevy::math::Isometry2d::from_xy( + x.into(), + y.into(), ) .into(); output @@ -176,8 +192,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Isometry2d::inverse( - _self, + let output: Val = ::bevy::math::Isometry2d::inverse( + _self.into(), ) .into(); output @@ -186,9 +202,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse_mul", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Isometry2d::inverse_mul( - _self, - rhs, + let output: Val = ::bevy::math::Isometry2d::inverse_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -197,8 +213,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Isometry2d::clone( - _self, + let output: Val = ::bevy::math::Isometry2d::clone( + _self.into(), ) .into(); output @@ -207,9 +223,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Isometry2d::mul( - _self, - rhs, + let output: Val = ::bevy::math::Isometry2d::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -218,18 +234,22 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Isometry2d::eq(_self, other).into(); + let output: bool = ::bevy::math::Isometry2d::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Isometry3d>::new(world) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = bevy::math::Isometry3d::from_xyz( - x, - y, - z, + let output: Val = ::bevy::math::Isometry3d::from_xyz( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -238,8 +258,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Isometry3d::inverse( - _self, + let output: Val = ::bevy::math::Isometry3d::inverse( + _self.into(), ) .into(); output @@ -248,9 +268,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse_mul", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Isometry3d::inverse_mul( - _self, - rhs, + let output: Val = ::bevy::math::Isometry3d::inverse_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -259,8 +279,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Isometry3d::clone( - _self, + let output: Val = ::bevy::math::Isometry3d::clone( + _self.into(), ) .into(); output @@ -269,9 +289,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Isometry3d::mul( - _self, - rhs, + let output: Val = ::bevy::math::Isometry3d::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -283,9 +303,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, rhs: Val| { - let output: Val = bevy::math::Isometry3d::mul( - _self, - rhs, + let output: Val = ::bevy::math::Isometry3d::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -294,15 +314,21 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Isometry3d::eq(_self, other).into(); + let output: bool = ::bevy::math::Isometry3d::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Ray2d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Ray2d::clone(_self) + let output: Val = ::bevy::math::Ray2d::clone( + _self.into(), + ) .into(); output }, @@ -310,31 +336,44 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Ray2d::eq(_self, other).into(); + let output: bool = ::bevy::math::Ray2d::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Ray3d>::new(world) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Ray3d::eq(_self, other).into(); + let output: bool = ::bevy::math::Ray3d::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Ray3d::clone(_self) + let output: Val = ::bevy::math::Ray3d::clone( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Rot2>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Rot2::mul(_self, rhs) + let output: Val = ::bevy::math::Rot2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -342,8 +381,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radians", |radians: f32| { - let output: Val = bevy::math::Rot2::radians( - radians, + let output: Val = ::bevy::math::Rot2::radians( + radians.into(), ) .into(); output @@ -352,8 +391,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "degrees", |degrees: f32| { - let output: Val = bevy::math::Rot2::degrees( - degrees, + let output: Val = ::bevy::math::Rot2::degrees( + degrees.into(), ) .into(); output @@ -362,8 +401,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "turn_fraction", |fraction: f32| { - let output: Val = bevy::math::Rot2::turn_fraction( - fraction, + let output: Val = ::bevy::math::Rot2::turn_fraction( + fraction.into(), ) .into(); output @@ -372,9 +411,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_sin_cos", |sin: f32, cos: f32| { - let output: Val = bevy::math::Rot2::from_sin_cos( - sin, - cos, + let output: Val = ::bevy::math::Rot2::from_sin_cos( + sin.into(), + cos.into(), ) .into(); output @@ -383,57 +422,63 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_radians", |_self: Val| { - let output: f32 = bevy::math::Rot2::as_radians(_self).into(); + let output: f32 = ::bevy::math::Rot2::as_radians(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_degrees", |_self: Val| { - let output: f32 = bevy::math::Rot2::as_degrees(_self).into(); + let output: f32 = ::bevy::math::Rot2::as_degrees(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_turn_fraction", |_self: Val| { - let output: f32 = bevy::math::Rot2::as_turn_fraction(_self).into(); + let output: f32 = ::bevy::math::Rot2::as_turn_fraction(_self.into()) + .into(); output }, ) .overwrite_script_function( "sin_cos", |_self: Val| { - let output: (f32, f32) = bevy::math::Rot2::sin_cos(_self).into(); + let output: (f32, f32) = ::bevy::math::Rot2::sin_cos(_self.into()) + .into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::Rot2::length(_self).into(); + let output: f32 = ::bevy::math::Rot2::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = bevy::math::Rot2::length_squared(_self).into(); + let output: f32 = ::bevy::math::Rot2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = bevy::math::Rot2::length_recip(_self).into(); + let output: f32 = ::bevy::math::Rot2::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::Rot2::normalize( - _self, + let output: Val = ::bevy::math::Rot2::normalize( + _self.into(), ) .into(); output @@ -442,8 +487,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = bevy::math::Rot2::fast_renormalize( - _self, + let output: Val = ::bevy::math::Rot2::fast_renormalize( + _self.into(), ) .into(); output @@ -452,35 +497,41 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::Rot2::is_finite(_self).into(); + let output: bool = ::bevy::math::Rot2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::Rot2::is_nan(_self).into(); + let output: bool = ::bevy::math::Rot2::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::Rot2::is_normalized(_self).into(); + let output: bool = ::bevy::math::Rot2::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = bevy::math::Rot2::is_near_identity(_self).into(); + let output: bool = ::bevy::math::Rot2::is_near_identity(_self.into()) + .into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, other: Val| { - let output: f32 = bevy::math::Rot2::angle_between(_self, other) + let output: f32 = ::bevy::math::Rot2::angle_between( + _self.into(), + other.into(), + ) .into(); output }, @@ -488,14 +539,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle_to", |_self: Val, other: Val| { - let output: f32 = bevy::math::Rot2::angle_to(_self, other).into(); + let output: f32 = ::bevy::math::Rot2::angle_to( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = bevy::math::Rot2::inverse(_self) + let output: Val = ::bevy::math::Rot2::inverse( + _self.into(), + ) .into(); output }, @@ -503,10 +560,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "nlerp", |_self: Val, end: Val, s: f32| { - let output: Val = bevy::math::Rot2::nlerp( - _self, - end, - s, + let output: Val = ::bevy::math::Rot2::nlerp( + _self.into(), + end.into(), + s.into(), ) .into(); output @@ -515,10 +572,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f32| { - let output: Val = bevy::math::Rot2::slerp( - _self, - end, - s, + let output: Val = ::bevy::math::Rot2::slerp( + _self.into(), + end.into(), + s.into(), ) .into(); output @@ -530,9 +587,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, direction: Val| { - let output: Val = bevy::math::Rot2::mul( - _self, - direction, + let output: Val = ::bevy::math::Rot2::mul( + _self.into(), + direction.into(), ) .into(); output @@ -541,24 +598,27 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Rot2::eq(_self, other).into(); + let output: bool = ::bevy::math::Rot2::eq(_self.into(), other.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Rot2::clone(_self) + let output: Val = ::bevy::math::Rot2::clone( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::prelude::Dir2>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::prelude::Dir2::clone( - _self, + let output: Val = ::bevy::math::prelude::Dir2::clone( + _self.into(), ) .into(); output @@ -567,9 +627,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xy_unchecked", |x: f32, y: f32| { - let output: Val = bevy::math::prelude::Dir2::from_xy_unchecked( - x, - y, + let output: Val = ::bevy::math::prelude::Dir2::from_xy_unchecked( + x.into(), + y.into(), ) .into(); output @@ -582,10 +642,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = bevy::math::prelude::Dir2::slerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::prelude::Dir2::slerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -597,9 +657,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: Val = bevy::math::prelude::Dir2::rotation_to( - _self, - other, + let output: Val = ::bevy::math::prelude::Dir2::rotation_to( + _self.into(), + other.into(), ) .into(); output @@ -611,9 +671,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: Val = bevy::math::prelude::Dir2::rotation_from( - _self, - other, + let output: Val = ::bevy::math::prelude::Dir2::rotation_from( + _self.into(), + other.into(), ) .into(); output @@ -622,8 +682,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_from_x", |_self: Val| { - let output: Val = bevy::math::prelude::Dir2::rotation_from_x( - _self, + let output: Val = ::bevy::math::prelude::Dir2::rotation_from_x( + _self.into(), ) .into(); output @@ -632,8 +692,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_to_x", |_self: Val| { - let output: Val = bevy::math::prelude::Dir2::rotation_to_x( - _self, + let output: Val = ::bevy::math::prelude::Dir2::rotation_to_x( + _self.into(), ) .into(); output @@ -642,8 +702,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_from_y", |_self: Val| { - let output: Val = bevy::math::prelude::Dir2::rotation_from_y( - _self, + let output: Val = ::bevy::math::prelude::Dir2::rotation_from_y( + _self.into(), ) .into(); output @@ -652,8 +712,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_to_y", |_self: Val| { - let output: Val = bevy::math::prelude::Dir2::rotation_to_y( - _self, + let output: Val = ::bevy::math::prelude::Dir2::rotation_to_y( + _self.into(), ) .into(); output @@ -662,8 +722,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = bevy::math::prelude::Dir2::fast_renormalize( - _self, + let output: Val = ::bevy::math::prelude::Dir2::fast_renormalize( + _self.into(), ) .into(); output @@ -675,7 +735,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::prelude::Dir2::eq(_self, other) + let output: bool = ::bevy::math::prelude::Dir2::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -683,19 +746,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::prelude::Dir2::neg( - _self, + let output: Val = ::bevy::math::prelude::Dir2::neg( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::prelude::Dir3>::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::prelude::Dir3::neg( - _self, + let output: Val = ::bevy::math::prelude::Dir3::neg( + _self.into(), ) .into(); output @@ -704,8 +767,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::prelude::Dir3::clone( - _self, + let output: Val = ::bevy::math::prelude::Dir3::clone( + _self.into(), ) .into(); output @@ -717,7 +780,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::prelude::Dir3::eq(_self, other) + let output: bool = ::bevy::math::prelude::Dir3::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -725,10 +791,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { - let output: Val = bevy::math::prelude::Dir3::from_xyz_unchecked( - x, - y, - z, + let output: Val = ::bevy::math::prelude::Dir3::from_xyz_unchecked( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -741,10 +807,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = bevy::math::prelude::Dir3::slerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::prelude::Dir3::slerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -753,19 +819,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = bevy::math::prelude::Dir3::fast_renormalize( - _self, + let output: Val = ::bevy::math::prelude::Dir3::fast_renormalize( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::prelude::Dir3A>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::prelude::Dir3A::clone( - _self, + let output: Val = ::bevy::math::prelude::Dir3A::clone( + _self.into(), ) .into(); output @@ -774,8 +840,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::prelude::Dir3A::neg( - _self, + let output: Val = ::bevy::math::prelude::Dir3A::neg( + _self.into(), ) .into(); output @@ -787,7 +853,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::prelude::Dir3A::eq(_self, other) + let output: bool = ::bevy::math::prelude::Dir3A::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -795,10 +864,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { - let output: Val = bevy::math::prelude::Dir3A::from_xyz_unchecked( - x, - y, - z, + let output: Val = ::bevy::math::prelude::Dir3A::from_xyz_unchecked( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -811,10 +880,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = bevy::math::prelude::Dir3A::slerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::prelude::Dir3A::slerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -823,21 +892,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = bevy::math::prelude::Dir3A::fast_renormalize( - _self, + let output: Val = ::bevy::math::prelude::Dir3A::fast_renormalize( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::prelude::IRect>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::prelude::IRect::eq(_self, other) + let output: bool = ::bevy::math::prelude::IRect::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -845,8 +917,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::prelude::IRect::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::prelude::IRect::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -855,8 +927,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::prelude::IRect::clone( - _self, + let output: Val = ::bevy::math::prelude::IRect::clone( + _self.into(), ) .into(); output @@ -865,11 +937,11 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: i32, y0: i32, x1: i32, y1: i32| { - let output: Val = bevy::math::prelude::IRect::new( - x0, - y0, - x1, - y1, + let output: Val = ::bevy::math::prelude::IRect::new( + x0.into(), + y0.into(), + x1.into(), + y1.into(), ) .into(); output @@ -878,7 +950,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = bevy::math::prelude::IRect::is_empty(_self) + let output: bool = ::bevy::math::prelude::IRect::is_empty( + _self.into(), + ) .into(); output }, @@ -886,14 +960,16 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: i32 = bevy::math::prelude::IRect::width(_self).into(); + let output: i32 = ::bevy::math::prelude::IRect::width(_self.into()) + .into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: i32 = bevy::math::prelude::IRect::height(_self).into(); + let output: i32 = ::bevy::math::prelude::IRect::height(_self.into()) + .into(); output }, ) @@ -903,9 +979,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::IRect::union( - _self, - other, + let output: Val = ::bevy::math::prelude::IRect::union( + _self.into(), + other.into(), ) .into(); output @@ -917,9 +993,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::IRect::intersect( - _self, - other, + let output: Val = ::bevy::math::prelude::IRect::intersect( + _self.into(), + other.into(), ) .into(); output @@ -928,9 +1004,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: i32| { - let output: Val = bevy::math::prelude::IRect::inflate( - _self, - expansion, + let output: Val = ::bevy::math::prelude::IRect::inflate( + _self.into(), + expansion.into(), ) .into(); output @@ -939,8 +1015,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_rect", |_self: Ref| { - let output: Val = bevy::math::prelude::IRect::as_rect( - _self, + let output: Val = ::bevy::math::prelude::IRect::as_rect( + _self.into(), ) .into(); output @@ -949,21 +1025,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_urect", |_self: Ref| { - let output: Val = bevy::math::prelude::IRect::as_urect( - _self, + let output: Val = ::bevy::math::prelude::IRect::as_urect( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::prelude::Rect>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::prelude::Rect::eq(_self, other) + let output: bool = ::bevy::math::prelude::Rect::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -971,11 +1050,11 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: f32, y0: f32, x1: f32, y1: f32| { - let output: Val = bevy::math::prelude::Rect::new( - x0, - y0, - x1, - y1, + let output: Val = ::bevy::math::prelude::Rect::new( + x0.into(), + y0.into(), + x1.into(), + y1.into(), ) .into(); output @@ -984,21 +1063,26 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = bevy::math::prelude::Rect::is_empty(_self).into(); + let output: bool = ::bevy::math::prelude::Rect::is_empty( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "width", |_self: Ref| { - let output: f32 = bevy::math::prelude::Rect::width(_self).into(); + let output: f32 = ::bevy::math::prelude::Rect::width(_self.into()) + .into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: f32 = bevy::math::prelude::Rect::height(_self).into(); + let output: f32 = ::bevy::math::prelude::Rect::height(_self.into()) + .into(); output }, ) @@ -1008,9 +1092,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::Rect::union( - _self, - other, + let output: Val = ::bevy::math::prelude::Rect::union( + _self.into(), + other.into(), ) .into(); output @@ -1022,9 +1106,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::Rect::intersect( - _self, - other, + let output: Val = ::bevy::math::prelude::Rect::intersect( + _self.into(), + other.into(), ) .into(); output @@ -1033,9 +1117,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: f32| { - let output: Val = bevy::math::prelude::Rect::inflate( - _self, - expansion, + let output: Val = ::bevy::math::prelude::Rect::inflate( + _self.into(), + expansion.into(), ) .into(); output @@ -1047,9 +1131,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::Rect::normalize( - _self, - other, + let output: Val = ::bevy::math::prelude::Rect::normalize( + _self.into(), + other.into(), ) .into(); output @@ -1058,8 +1142,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_irect", |_self: Ref| { - let output: Val = bevy::math::prelude::Rect::as_irect( - _self, + let output: Val = ::bevy::math::prelude::Rect::as_irect( + _self.into(), ) .into(); output @@ -1068,8 +1152,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_urect", |_self: Ref| { - let output: Val = bevy::math::prelude::Rect::as_urect( - _self, + let output: Val = ::bevy::math::prelude::Rect::as_urect( + _self.into(), ) .into(); output @@ -1078,21 +1162,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::prelude::Rect::clone( - _self, + let output: Val = ::bevy::math::prelude::Rect::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::prelude::URect>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::prelude::URect::eq(_self, other) + let output: bool = ::bevy::math::prelude::URect::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -1100,11 +1187,11 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: u32, y0: u32, x1: u32, y1: u32| { - let output: Val = bevy::math::prelude::URect::new( - x0, - y0, - x1, - y1, + let output: Val = ::bevy::math::prelude::URect::new( + x0.into(), + y0.into(), + x1.into(), + y1.into(), ) .into(); output @@ -1113,7 +1200,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = bevy::math::prelude::URect::is_empty(_self) + let output: bool = ::bevy::math::prelude::URect::is_empty( + _self.into(), + ) .into(); output }, @@ -1121,14 +1210,16 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: u32 = bevy::math::prelude::URect::width(_self).into(); + let output: u32 = ::bevy::math::prelude::URect::width(_self.into()) + .into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: u32 = bevy::math::prelude::URect::height(_self).into(); + let output: u32 = ::bevy::math::prelude::URect::height(_self.into()) + .into(); output }, ) @@ -1138,9 +1229,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::URect::union( - _self, - other, + let output: Val = ::bevy::math::prelude::URect::union( + _self.into(), + other.into(), ) .into(); output @@ -1152,9 +1243,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = bevy::math::prelude::URect::intersect( - _self, - other, + let output: Val = ::bevy::math::prelude::URect::intersect( + _self.into(), + other.into(), ) .into(); output @@ -1163,9 +1254,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: i32| { - let output: Val = bevy::math::prelude::URect::inflate( - _self, - expansion, + let output: Val = ::bevy::math::prelude::URect::inflate( + _self.into(), + expansion.into(), ) .into(); output @@ -1174,8 +1265,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_rect", |_self: Ref| { - let output: Val = bevy::math::prelude::URect::as_rect( - _self, + let output: Val = ::bevy::math::prelude::URect::as_rect( + _self.into(), ) .into(); output @@ -1184,8 +1275,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_irect", |_self: Ref| { - let output: Val = bevy::math::prelude::URect::as_irect( - _self, + let output: Val = ::bevy::math::prelude::URect::as_irect( + _self.into(), ) .into(); output @@ -1194,8 +1285,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::prelude::URect::clone( - _self, + let output: Val = ::bevy::math::prelude::URect::clone( + _self.into(), ) .into(); output @@ -1204,20 +1295,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::prelude::URect::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::prelude::URect::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Affine3>::new(world); + NamespaceBuilder::<::bevy::math::bounding::Aabb2d>::new(world) .overwrite_script_function( "bounding_circle", |_self: Ref| { - let output: Val = bevy::math::bounding::Aabb2d::bounding_circle( - _self, + let output: Val = ::bevy::math::bounding::Aabb2d::bounding_circle( + _self.into(), ) .into(); output @@ -1226,18 +1317,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::Aabb2d::clone( - _self, + let output: Val = ::bevy::math::bounding::Aabb2d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::BoundingCircle>::new(world) .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = bevy::math::bounding::BoundingCircle::radius(_self) + let output: f32 = ::bevy::math::bounding::BoundingCircle::radius( + _self.into(), + ) .into(); output }, @@ -1245,8 +1338,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "aabb_2d", |_self: Ref| { - let output: Val = bevy::math::bounding::BoundingCircle::aabb_2d( - _self, + let output: Val = ::bevy::math::bounding::BoundingCircle::aabb_2d( + _self.into(), ) .into(); output @@ -1255,21 +1348,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::BoundingCircle::clone( - _self, + let output: Val = ::bevy::math::bounding::BoundingCircle::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Circle>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Circle::eq(_self, other) + let output: bool = ::bevy::math::primitives::Circle::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -1277,8 +1373,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32| { - let output: Val = bevy::math::primitives::Circle::new( - radius, + let output: Val = ::bevy::math::primitives::Circle::new( + radius.into(), ) .into(); output @@ -1287,7 +1383,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = bevy::math::primitives::Circle::diameter(_self) + let output: f32 = ::bevy::math::primitives::Circle::diameter( + _self.into(), + ) .into(); output }, @@ -1295,19 +1393,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Circle::clone( - _self, + let output: Val = ::bevy::math::primitives::Circle::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Annulus>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Annulus::clone( - _self, + let output: Val = ::bevy::math::primitives::Annulus::clone( + _self.into(), ) .into(); output @@ -1319,7 +1417,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Annulus::eq(_self, other) + let output: bool = ::bevy::math::primitives::Annulus::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -1327,9 +1428,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |inner_radius: f32, outer_radius: f32| { - let output: Val = bevy::math::primitives::Annulus::new( - inner_radius, - outer_radius, + let output: Val = ::bevy::math::primitives::Annulus::new( + inner_radius.into(), + outer_radius.into(), ) .into(); output @@ -1338,7 +1439,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = bevy::math::primitives::Annulus::diameter(_self) + let output: f32 = ::bevy::math::primitives::Annulus::diameter( + _self.into(), + ) .into(); output }, @@ -1346,18 +1449,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "thickness", |_self: Ref| { - let output: f32 = bevy::math::primitives::Annulus::thickness(_self) + let output: f32 = ::bevy::math::primitives::Annulus::thickness( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Arc2d>::new(world) .overwrite_script_function( "new", |radius: f32, half_angle: f32| { - let output: Val = bevy::math::primitives::Arc2d::new( - radius, - half_angle, + let output: Val = ::bevy::math::primitives::Arc2d::new( + radius.into(), + half_angle.into(), ) .into(); output @@ -1366,9 +1471,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::Arc2d::from_radians( - radius, - angle, + let output: Val = ::bevy::math::primitives::Arc2d::from_radians( + radius.into(), + angle.into(), ) .into(); output @@ -1377,9 +1482,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::Arc2d::from_degrees( - radius, - angle, + let output: Val = ::bevy::math::primitives::Arc2d::from_degrees( + radius.into(), + angle.into(), ) .into(); output @@ -1388,9 +1493,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = bevy::math::primitives::Arc2d::from_turns( - radius, - fraction, + let output: Val = ::bevy::math::primitives::Arc2d::from_turns( + radius.into(), + fraction.into(), ) .into(); output @@ -1399,14 +1504,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = bevy::math::primitives::Arc2d::angle(_self).into(); + let output: f32 = ::bevy::math::primitives::Arc2d::angle( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "length", |_self: Ref| { - let output: f32 = bevy::math::primitives::Arc2d::length(_self) + let output: f32 = ::bevy::math::primitives::Arc2d::length( + _self.into(), + ) .into(); output }, @@ -1414,8 +1524,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::Arc2d::half_chord_length( - _self, + let output: f32 = ::bevy::math::primitives::Arc2d::half_chord_length( + _self.into(), ) .into(); output @@ -1424,7 +1534,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::Arc2d::chord_length(_self) + let output: f32 = ::bevy::math::primitives::Arc2d::chord_length( + _self.into(), + ) .into(); output }, @@ -1432,7 +1544,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = bevy::math::primitives::Arc2d::apothem(_self) + let output: f32 = ::bevy::math::primitives::Arc2d::apothem( + _self.into(), + ) .into(); output }, @@ -1440,7 +1554,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = bevy::math::primitives::Arc2d::sagitta(_self) + let output: f32 = ::bevy::math::primitives::Arc2d::sagitta( + _self.into(), + ) .into(); output }, @@ -1448,7 +1564,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_minor", |_self: Ref| { - let output: bool = bevy::math::primitives::Arc2d::is_minor(_self) + let output: bool = ::bevy::math::primitives::Arc2d::is_minor( + _self.into(), + ) .into(); output }, @@ -1456,7 +1574,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_major", |_self: Ref| { - let output: bool = bevy::math::primitives::Arc2d::is_major(_self) + let output: bool = ::bevy::math::primitives::Arc2d::is_major( + _self.into(), + ) .into(); output }, @@ -1464,8 +1584,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Arc2d::clone( - _self, + let output: Val = ::bevy::math::primitives::Arc2d::clone( + _self.into(), ) .into(); output @@ -1477,18 +1597,21 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Arc2d::eq(_self, other) + let output: bool = ::bevy::math::primitives::Arc2d::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Capsule2d>::new(world) .overwrite_script_function( "new", |radius: f32, length: f32| { - let output: Val = bevy::math::primitives::Capsule2d::new( - radius, - length, + let output: Val = ::bevy::math::primitives::Capsule2d::new( + radius.into(), + length.into(), ) .into(); output @@ -1497,8 +1620,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "to_inner_rectangle", |_self: Ref| { - let output: Val = bevy::math::primitives::Capsule2d::to_inner_rectangle( - _self, + let output: Val = ::bevy::math::primitives::Capsule2d::to_inner_rectangle( + _self.into(), ) .into(); output @@ -1510,9 +1633,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Capsule2d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Capsule2d::eq( + _self.into(), + other.into(), ) .into(); output @@ -1521,23 +1644,23 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Capsule2d::clone( - _self, + let output: Val = ::bevy::math::primitives::Capsule2d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::CircularSector>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::CircularSector::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::CircularSector::eq( + _self.into(), + other.into(), ) .into(); output @@ -1546,9 +1669,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::CircularSector::new( - radius, - angle, + let output: Val = ::bevy::math::primitives::CircularSector::new( + radius.into(), + angle.into(), ) .into(); output @@ -1557,9 +1680,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::CircularSector::from_radians( - radius, - angle, + let output: Val = ::bevy::math::primitives::CircularSector::from_radians( + radius.into(), + angle.into(), ) .into(); output @@ -1568,9 +1691,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::CircularSector::from_degrees( - radius, - angle, + let output: Val = ::bevy::math::primitives::CircularSector::from_degrees( + radius.into(), + angle.into(), ) .into(); output @@ -1579,9 +1702,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = bevy::math::primitives::CircularSector::from_turns( - radius, - fraction, + let output: Val = ::bevy::math::primitives::CircularSector::from_turns( + radius.into(), + fraction.into(), ) .into(); output @@ -1590,8 +1713,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_angle", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::half_angle( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::half_angle( + _self.into(), ) .into(); output @@ -1600,8 +1723,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::angle( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::angle( + _self.into(), ) .into(); output @@ -1610,8 +1733,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::radius( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::radius( + _self.into(), ) .into(); output @@ -1620,8 +1743,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "arc_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::arc_length( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::arc_length( + _self.into(), ) .into(); output @@ -1630,8 +1753,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::half_chord_length( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::half_chord_length( + _self.into(), ) .into(); output @@ -1640,8 +1763,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::chord_length( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::chord_length( + _self.into(), ) .into(); output @@ -1650,8 +1773,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::apothem( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::apothem( + _self.into(), ) .into(); output @@ -1660,8 +1783,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSector::sagitta( - _self, + let output: f32 = ::bevy::math::primitives::CircularSector::sagitta( + _self.into(), ) .into(); output @@ -1670,20 +1793,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::CircularSector::clone( - _self, + let output: Val = ::bevy::math::primitives::CircularSector::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::CircularSegment>::new(world) .overwrite_script_function( "new", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::CircularSegment::new( - radius, - angle, + let output: Val = ::bevy::math::primitives::CircularSegment::new( + radius.into(), + angle.into(), ) .into(); output @@ -1692,9 +1815,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::CircularSegment::from_radians( - radius, - angle, + let output: Val = ::bevy::math::primitives::CircularSegment::from_radians( + radius.into(), + angle.into(), ) .into(); output @@ -1703,9 +1826,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = bevy::math::primitives::CircularSegment::from_degrees( - radius, - angle, + let output: Val = ::bevy::math::primitives::CircularSegment::from_degrees( + radius.into(), + angle.into(), ) .into(); output @@ -1714,9 +1837,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = bevy::math::primitives::CircularSegment::from_turns( - radius, - fraction, + let output: Val = ::bevy::math::primitives::CircularSegment::from_turns( + radius.into(), + fraction.into(), ) .into(); output @@ -1725,8 +1848,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_angle", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::half_angle( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::half_angle( + _self.into(), ) .into(); output @@ -1735,8 +1858,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::angle( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::angle( + _self.into(), ) .into(); output @@ -1745,8 +1868,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::radius( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::radius( + _self.into(), ) .into(); output @@ -1755,8 +1878,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "arc_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::arc_length( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::arc_length( + _self.into(), ) .into(); output @@ -1765,8 +1888,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::half_chord_length( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::half_chord_length( + _self.into(), ) .into(); output @@ -1775,8 +1898,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::chord_length( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::chord_length( + _self.into(), ) .into(); output @@ -1785,8 +1908,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::apothem( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::apothem( + _self.into(), ) .into(); output @@ -1795,8 +1918,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = bevy::math::primitives::CircularSegment::sagitta( - _self, + let output: f32 = ::bevy::math::primitives::CircularSegment::sagitta( + _self.into(), ) .into(); output @@ -1805,8 +1928,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::CircularSegment::clone( - _self, + let output: Val = ::bevy::math::primitives::CircularSegment::clone( + _self.into(), ) .into(); output @@ -1818,22 +1941,25 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::CircularSegment::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::CircularSegment::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Ellipse>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Ellipse::eq(_self, other) + let output: bool = ::bevy::math::primitives::Ellipse::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -1841,9 +1967,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |half_width: f32, half_height: f32| { - let output: Val = bevy::math::primitives::Ellipse::new( - half_width, - half_height, + let output: Val = ::bevy::math::primitives::Ellipse::new( + half_width.into(), + half_height.into(), ) .into(); output @@ -1852,8 +1978,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eccentricity", |_self: Ref| { - let output: f32 = bevy::math::primitives::Ellipse::eccentricity( - _self, + let output: f32 = ::bevy::math::primitives::Ellipse::eccentricity( + _self.into(), ) .into(); output @@ -1862,8 +1988,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "focal_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::Ellipse::focal_length( - _self, + let output: f32 = ::bevy::math::primitives::Ellipse::focal_length( + _self.into(), ) .into(); output @@ -1872,7 +1998,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "semi_major", |_self: Ref| { - let output: f32 = bevy::math::primitives::Ellipse::semi_major(_self) + let output: f32 = ::bevy::math::primitives::Ellipse::semi_major( + _self.into(), + ) .into(); output }, @@ -1880,7 +2008,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "semi_minor", |_self: Ref| { - let output: f32 = bevy::math::primitives::Ellipse::semi_minor(_self) + let output: f32 = ::bevy::math::primitives::Ellipse::semi_minor( + _self.into(), + ) .into(); output }, @@ -1888,19 +2018,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Ellipse::clone( - _self, + let output: Val = ::bevy::math::primitives::Ellipse::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Line2d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Line2d::clone( - _self, + let output: Val = ::bevy::math::primitives::Line2d::clone( + _self.into(), ) .into(); output @@ -1912,17 +2042,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Line2d::eq(_self, other) + let output: bool = ::bevy::math::primitives::Line2d::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Plane2d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Plane2d::clone( - _self, + let output: Val = ::bevy::math::primitives::Plane2d::clone( + _self.into(), ) .into(); output @@ -1934,21 +2067,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Plane2d::eq(_self, other) + let output: bool = ::bevy::math::primitives::Plane2d::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Rectangle>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Rectangle::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Rectangle::eq( + _self.into(), + other.into(), ) .into(); output @@ -1957,9 +2093,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |width: f32, height: f32| { - let output: Val = bevy::math::primitives::Rectangle::new( - width, - height, + let output: Val = ::bevy::math::primitives::Rectangle::new( + width.into(), + height.into(), ) .into(); output @@ -1968,8 +2104,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_length", |length: f32| { - let output: Val = bevy::math::primitives::Rectangle::from_length( - length, + let output: Val = ::bevy::math::primitives::Rectangle::from_length( + length.into(), ) .into(); output @@ -1978,19 +2114,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Rectangle::clone( - _self, + let output: Val = ::bevy::math::primitives::Rectangle::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::RegularPolygon>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::RegularPolygon::clone( - _self, + let output: Val = ::bevy::math::primitives::RegularPolygon::clone( + _self.into(), ) .into(); output @@ -1999,9 +2135,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |circumradius: f32, sides: u32| { - let output: Val = bevy::math::primitives::RegularPolygon::new( - circumradius, - sides, + let output: Val = ::bevy::math::primitives::RegularPolygon::new( + circumradius.into(), + sides.into(), ) .into(); output @@ -2010,8 +2146,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "circumradius", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::circumradius( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::circumradius( + _self.into(), ) .into(); output @@ -2020,8 +2156,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::inradius( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::inradius( + _self.into(), ) .into(); output @@ -2030,8 +2166,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "side_length", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::side_length( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::side_length( + _self.into(), ) .into(); output @@ -2040,8 +2176,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "internal_angle_degrees", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_degrees( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_degrees( + _self.into(), ) .into(); output @@ -2050,8 +2186,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "internal_angle_radians", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_radians( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_radians( + _self.into(), ) .into(); output @@ -2060,8 +2196,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "external_angle_degrees", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_degrees( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_degrees( + _self.into(), ) .into(); output @@ -2070,8 +2206,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "external_angle_radians", |_self: Ref| { - let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_radians( - _self, + let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_radians( + _self.into(), ) .into(); output @@ -2083,22 +2219,25 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::RegularPolygon::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::RegularPolygon::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Rhombus>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Rhombus::eq(_self, other) + let output: bool = ::bevy::math::primitives::Rhombus::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -2106,9 +2245,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |horizontal_diagonal: f32, vertical_diagonal: f32| { - let output: Val = bevy::math::primitives::Rhombus::new( - horizontal_diagonal, - vertical_diagonal, + let output: Val = ::bevy::math::primitives::Rhombus::new( + horizontal_diagonal.into(), + vertical_diagonal.into(), ) .into(); output @@ -2117,8 +2256,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_side", |side: f32| { - let output: Val = bevy::math::primitives::Rhombus::from_side( - side, + let output: Val = ::bevy::math::primitives::Rhombus::from_side( + side.into(), ) .into(); output @@ -2127,8 +2266,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_inradius", |inradius: f32| { - let output: Val = bevy::math::primitives::Rhombus::from_inradius( - inradius, + let output: Val = ::bevy::math::primitives::Rhombus::from_inradius( + inradius.into(), ) .into(); output @@ -2137,7 +2276,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "side", |_self: Ref| { - let output: f32 = bevy::math::primitives::Rhombus::side(_self) + let output: f32 = ::bevy::math::primitives::Rhombus::side( + _self.into(), + ) .into(); output }, @@ -2145,8 +2286,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "circumradius", |_self: Ref| { - let output: f32 = bevy::math::primitives::Rhombus::circumradius( - _self, + let output: f32 = ::bevy::math::primitives::Rhombus::circumradius( + _self.into(), ) .into(); output @@ -2155,7 +2296,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = bevy::math::primitives::Rhombus::inradius(_self) + let output: f32 = ::bevy::math::primitives::Rhombus::inradius( + _self.into(), + ) .into(); output }, @@ -2163,23 +2306,23 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Rhombus::clone( - _self, + let output: Val = ::bevy::math::primitives::Rhombus::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Segment2d>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Segment2d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Segment2d::eq( + _self.into(), + other.into(), ) .into(); output @@ -2188,9 +2331,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |direction: Val, length: f32| { - let output: Val = bevy::math::primitives::Segment2d::new( - direction, - length, + let output: Val = ::bevy::math::primitives::Segment2d::new( + direction.into(), + length.into(), ) .into(); output @@ -2199,19 +2342,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Segment2d::clone( - _self, + let output: Val = ::bevy::math::primitives::Segment2d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Triangle2d>::new(world) .overwrite_script_function( "is_degenerate", |_self: Ref| { - let output: bool = bevy::math::primitives::Triangle2d::is_degenerate( - _self, + let output: bool = ::bevy::math::primitives::Triangle2d::is_degenerate( + _self.into(), ) .into(); output @@ -2220,8 +2363,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_acute", |_self: Ref| { - let output: bool = bevy::math::primitives::Triangle2d::is_acute( - _self, + let output: bool = ::bevy::math::primitives::Triangle2d::is_acute( + _self.into(), ) .into(); output @@ -2230,8 +2373,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_obtuse", |_self: Ref| { - let output: bool = bevy::math::primitives::Triangle2d::is_obtuse( - _self, + let output: bool = ::bevy::math::primitives::Triangle2d::is_obtuse( + _self.into(), ) .into(); output @@ -2240,7 +2383,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reverse", |_self: Mut| { - let output: () = bevy::math::primitives::Triangle2d::reverse(_self) + let output: () = ::bevy::math::primitives::Triangle2d::reverse( + _self.into(), + ) .into(); output }, @@ -2248,8 +2393,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reversed", |_self: Val| { - let output: Val = bevy::math::primitives::Triangle2d::reversed( - _self, + let output: Val = ::bevy::math::primitives::Triangle2d::reversed( + _self.into(), ) .into(); output @@ -2258,8 +2403,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Triangle2d::clone( - _self, + let output: Val = ::bevy::math::primitives::Triangle2d::clone( + _self.into(), ) .into(); output @@ -2271,20 +2416,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Triangle2d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Triangle2d::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::Aabb3d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::Aabb3d::clone( - _self, + let output: Val = ::bevy::math::bounding::Aabb3d::clone( + _self.into(), ) .into(); output @@ -2293,18 +2438,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "bounding_sphere", |_self: Ref| { - let output: Val = bevy::math::bounding::Aabb3d::bounding_sphere( - _self, + let output: Val = ::bevy::math::bounding::Aabb3d::bounding_sphere( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::BoundingSphere>::new(world) .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = bevy::math::bounding::BoundingSphere::radius(_self) + let output: f32 = ::bevy::math::bounding::BoundingSphere::radius( + _self.into(), + ) .into(); output }, @@ -2312,8 +2459,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "aabb_3d", |_self: Ref| { - let output: Val = bevy::math::bounding::BoundingSphere::aabb_3d( - _self, + let output: Val = ::bevy::math::bounding::BoundingSphere::aabb_3d( + _self.into(), ) .into(); output @@ -2322,21 +2469,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::BoundingSphere::clone( - _self, + let output: Val = ::bevy::math::bounding::BoundingSphere::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Sphere>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Sphere::eq(_self, other) + let output: bool = ::bevy::math::primitives::Sphere::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -2344,8 +2494,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Sphere::clone( - _self, + let output: Val = ::bevy::math::primitives::Sphere::clone( + _self.into(), ) .into(); output @@ -2354,8 +2504,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32| { - let output: Val = bevy::math::primitives::Sphere::new( - radius, + let output: Val = ::bevy::math::primitives::Sphere::new( + radius.into(), ) .into(); output @@ -2364,17 +2514,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = bevy::math::primitives::Sphere::diameter(_self) + let output: f32 = ::bevy::math::primitives::Sphere::diameter( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Cuboid>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Cuboid::clone( - _self, + let output: Val = ::bevy::math::primitives::Cuboid::clone( + _self.into(), ) .into(); output @@ -2386,7 +2538,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Cuboid::eq(_self, other) + let output: bool = ::bevy::math::primitives::Cuboid::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -2394,10 +2549,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x_length: f32, y_length: f32, z_length: f32| { - let output: Val = bevy::math::primitives::Cuboid::new( - x_length, - y_length, - z_length, + let output: Val = ::bevy::math::primitives::Cuboid::new( + x_length.into(), + y_length.into(), + z_length.into(), ) .into(); output @@ -2406,19 +2561,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_length", |length: f32| { - let output: Val = bevy::math::primitives::Cuboid::from_length( - length, + let output: Val = ::bevy::math::primitives::Cuboid::from_length( + length.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Cylinder>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Cylinder::clone( - _self, + let output: Val = ::bevy::math::primitives::Cylinder::clone( + _self.into(), ) .into(); output @@ -2430,7 +2585,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Cylinder::eq(_self, other) + let output: bool = ::bevy::math::primitives::Cylinder::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -2438,9 +2596,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, height: f32| { - let output: Val = bevy::math::primitives::Cylinder::new( - radius, - height, + let output: Val = ::bevy::math::primitives::Cylinder::new( + radius.into(), + height.into(), ) .into(); output @@ -2449,8 +2607,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base", |_self: Ref| { - let output: Val = bevy::math::primitives::Cylinder::base( - _self, + let output: Val = ::bevy::math::primitives::Cylinder::base( + _self.into(), ) .into(); output @@ -2459,8 +2617,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "lateral_area", |_self: Ref| { - let output: f32 = bevy::math::primitives::Cylinder::lateral_area( - _self, + let output: f32 = ::bevy::math::primitives::Cylinder::lateral_area( + _self.into(), ) .into(); output @@ -2469,17 +2627,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = bevy::math::primitives::Cylinder::base_area(_self) + let output: f32 = ::bevy::math::primitives::Cylinder::base_area( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Capsule3d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Capsule3d::clone( - _self, + let output: Val = ::bevy::math::primitives::Capsule3d::clone( + _self.into(), ) .into(); output @@ -2491,9 +2651,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Capsule3d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Capsule3d::eq( + _self.into(), + other.into(), ) .into(); output @@ -2502,9 +2662,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, length: f32| { - let output: Val = bevy::math::primitives::Capsule3d::new( - radius, - length, + let output: Val = ::bevy::math::primitives::Capsule3d::new( + radius.into(), + length.into(), ) .into(); output @@ -2513,20 +2673,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "to_cylinder", |_self: Ref| { - let output: Val = bevy::math::primitives::Capsule3d::to_cylinder( - _self, + let output: Val = ::bevy::math::primitives::Capsule3d::to_cylinder( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Cone>::new(world) .overwrite_script_function( "new", |radius: f32, height: f32| { - let output: Val = bevy::math::primitives::Cone::new( - radius, - height, + let output: Val = ::bevy::math::primitives::Cone::new( + radius.into(), + height.into(), ) .into(); output @@ -2535,8 +2695,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base", |_self: Ref| { - let output: Val = bevy::math::primitives::Cone::base( - _self, + let output: Val = ::bevy::math::primitives::Cone::base( + _self.into(), ) .into(); output @@ -2545,7 +2705,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "slant_height", |_self: Ref| { - let output: f32 = bevy::math::primitives::Cone::slant_height(_self) + let output: f32 = ::bevy::math::primitives::Cone::slant_height( + _self.into(), + ) .into(); output }, @@ -2553,7 +2715,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "lateral_area", |_self: Ref| { - let output: f32 = bevy::math::primitives::Cone::lateral_area(_self) + let output: f32 = ::bevy::math::primitives::Cone::lateral_area( + _self.into(), + ) .into(); output }, @@ -2561,7 +2725,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = bevy::math::primitives::Cone::base_area(_self) + let output: f32 = ::bevy::math::primitives::Cone::base_area( + _self.into(), + ) .into(); output }, @@ -2569,8 +2735,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Cone::clone( - _self, + let output: Val = ::bevy::math::primitives::Cone::clone( + _self.into(), ) .into(); output @@ -2582,21 +2748,24 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Cone::eq(_self, other) + let output: bool = ::bevy::math::primitives::Cone::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::ConicalFrustum>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::ConicalFrustum::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::ConicalFrustum::eq( + _self.into(), + other.into(), ) .into(); output @@ -2605,19 +2774,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::ConicalFrustum::clone( - _self, + let output: Val = ::bevy::math::primitives::ConicalFrustum::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::InfinitePlane3d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::InfinitePlane3d::clone( - _self, + let output: Val = ::bevy::math::primitives::InfinitePlane3d::clone( + _self.into(), ) .into(); output @@ -2629,20 +2798,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::InfinitePlane3d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::InfinitePlane3d::eq( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Line3d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Line3d::clone( - _self, + let output: Val = ::bevy::math::primitives::Line3d::clone( + _self.into(), ) .into(); output @@ -2654,18 +2823,21 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Line3d::eq(_self, other) + let output: bool = ::bevy::math::primitives::Line3d::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Segment3d>::new(world) .overwrite_script_function( "new", |direction: Val, length: f32| { - let output: Val = bevy::math::primitives::Segment3d::new( - direction, - length, + let output: Val = ::bevy::math::primitives::Segment3d::new( + direction.into(), + length.into(), ) .into(); output @@ -2677,9 +2849,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Segment3d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Segment3d::eq( + _self.into(), + other.into(), ) .into(); output @@ -2688,19 +2860,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Segment3d::clone( - _self, + let output: Val = ::bevy::math::primitives::Segment3d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Torus>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Torus::clone( - _self, + let output: Val = ::bevy::math::primitives::Torus::clone( + _self.into(), ) .into(); output @@ -2712,7 +2884,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Torus::eq(_self, other) + let output: bool = ::bevy::math::primitives::Torus::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -2720,9 +2895,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |inner_radius: f32, outer_radius: f32| { - let output: Val = bevy::math::primitives::Torus::new( - inner_radius, - outer_radius, + let output: Val = ::bevy::math::primitives::Torus::new( + inner_radius.into(), + outer_radius.into(), ) .into(); output @@ -2731,7 +2906,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inner_radius", |_self: Ref| { - let output: f32 = bevy::math::primitives::Torus::inner_radius(_self) + let output: f32 = ::bevy::math::primitives::Torus::inner_radius( + _self.into(), + ) .into(); output }, @@ -2739,21 +2916,23 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "outer_radius", |_self: Ref| { - let output: f32 = bevy::math::primitives::Torus::outer_radius(_self) + let output: f32 = ::bevy::math::primitives::Torus::outer_radius( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Triangle3d>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Triangle3d::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Triangle3d::eq( + _self.into(), + other.into(), ) .into(); output @@ -2762,8 +2941,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_degenerate", |_self: Ref| { - let output: bool = bevy::math::primitives::Triangle3d::is_degenerate( - _self, + let output: bool = ::bevy::math::primitives::Triangle3d::is_degenerate( + _self.into(), ) .into(); output @@ -2772,8 +2951,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_acute", |_self: Ref| { - let output: bool = bevy::math::primitives::Triangle3d::is_acute( - _self, + let output: bool = ::bevy::math::primitives::Triangle3d::is_acute( + _self.into(), ) .into(); output @@ -2782,8 +2961,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_obtuse", |_self: Ref| { - let output: bool = bevy::math::primitives::Triangle3d::is_obtuse( - _self, + let output: bool = ::bevy::math::primitives::Triangle3d::is_obtuse( + _self.into(), ) .into(); output @@ -2792,7 +2971,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reverse", |_self: Mut| { - let output: () = bevy::math::primitives::Triangle3d::reverse(_self) + let output: () = ::bevy::math::primitives::Triangle3d::reverse( + _self.into(), + ) .into(); output }, @@ -2800,8 +2981,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reversed", |_self: Val| { - let output: Val = bevy::math::primitives::Triangle3d::reversed( - _self, + let output: Val = ::bevy::math::primitives::Triangle3d::reversed( + _self.into(), ) .into(); output @@ -2810,19 +2991,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Triangle3d::clone( - _self, + let output: Val = ::bevy::math::primitives::Triangle3d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::RayCast2d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::RayCast2d::clone( - _self, + let output: Val = ::bevy::math::bounding::RayCast2d::clone( + _self.into(), ) .into(); output @@ -2831,9 +3012,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_ray", |ray: Val, max: f32| { - let output: Val = bevy::math::bounding::RayCast2d::from_ray( - ray, - max, + let output: Val = ::bevy::math::bounding::RayCast2d::from_ray( + ray.into(), + max.into(), ) .into(); output @@ -2845,9 +3026,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Ref| { - let output: std::option::Option = bevy::math::bounding::RayCast2d::aabb_intersection_at( - _self, - aabb, + let output: std::option::Option = ::bevy::math::bounding::RayCast2d::aabb_intersection_at( + _self.into(), + aabb.into(), ) .into(); output @@ -2859,15 +3040,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, circle: Ref| { - let output: std::option::Option = bevy::math::bounding::RayCast2d::circle_intersection_at( - _self, - circle, + let output: std::option::Option = ::bevy::math::bounding::RayCast2d::circle_intersection_at( + _self.into(), + circle.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::AabbCast2d>::new(world) .overwrite_script_function( "from_ray", | @@ -2875,10 +3056,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = bevy::math::bounding::AabbCast2d::from_ray( - aabb, - ray, - max, + let output: Val = ::bevy::math::bounding::AabbCast2d::from_ray( + aabb.into(), + ray.into(), + max.into(), ) .into(); output @@ -2890,9 +3071,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Val| { - let output: std::option::Option = bevy::math::bounding::AabbCast2d::aabb_collision_at( - _self, - aabb, + let output: std::option::Option = ::bevy::math::bounding::AabbCast2d::aabb_collision_at( + _self.into(), + aabb.into(), ) .into(); output @@ -2901,14 +3082,14 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::AabbCast2d::clone( - _self, + let output: Val = ::bevy::math::bounding::AabbCast2d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::BoundingCircleCast>::new(world) .overwrite_script_function( "from_ray", | @@ -2916,10 +3097,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = bevy::math::bounding::BoundingCircleCast::from_ray( - circle, - ray, - max, + let output: Val = ::bevy::math::bounding::BoundingCircleCast::from_ray( + circle.into(), + ray.into(), + max.into(), ) .into(); output @@ -2931,9 +3112,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, circle: Val| { - let output: std::option::Option = bevy::math::bounding::BoundingCircleCast::circle_collision_at( - _self, - circle, + let output: std::option::Option = ::bevy::math::bounding::BoundingCircleCast::circle_collision_at( + _self.into(), + circle.into(), ) .into(); output @@ -2942,19 +3123,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::BoundingCircleCast::clone( - _self, + let output: Val = ::bevy::math::bounding::BoundingCircleCast::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::RayCast3d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::RayCast3d::clone( - _self, + let output: Val = ::bevy::math::bounding::RayCast3d::clone( + _self.into(), ) .into(); output @@ -2963,9 +3144,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_ray", |ray: Val, max: f32| { - let output: Val = bevy::math::bounding::RayCast3d::from_ray( - ray, - max, + let output: Val = ::bevy::math::bounding::RayCast3d::from_ray( + ray.into(), + max.into(), ) .into(); output @@ -2977,9 +3158,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Ref| { - let output: std::option::Option = bevy::math::bounding::RayCast3d::aabb_intersection_at( - _self, - aabb, + let output: std::option::Option = ::bevy::math::bounding::RayCast3d::aabb_intersection_at( + _self.into(), + aabb.into(), ) .into(); output @@ -2991,15 +3172,15 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, sphere: Ref| { - let output: std::option::Option = bevy::math::bounding::RayCast3d::sphere_intersection_at( - _self, - sphere, + let output: std::option::Option = ::bevy::math::bounding::RayCast3d::sphere_intersection_at( + _self.into(), + sphere.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::AabbCast3d>::new(world) .overwrite_script_function( "from_ray", | @@ -3007,10 +3188,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = bevy::math::bounding::AabbCast3d::from_ray( - aabb, - ray, - max, + let output: Val = ::bevy::math::bounding::AabbCast3d::from_ray( + aabb.into(), + ray.into(), + max.into(), ) .into(); output @@ -3022,9 +3203,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Val| { - let output: std::option::Option = bevy::math::bounding::AabbCast3d::aabb_collision_at( - _self, - aabb, + let output: std::option::Option = ::bevy::math::bounding::AabbCast3d::aabb_collision_at( + _self.into(), + aabb.into(), ) .into(); output @@ -3033,14 +3214,14 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::AabbCast3d::clone( - _self, + let output: Val = ::bevy::math::bounding::AabbCast3d::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::bounding::BoundingSphereCast>::new(world) .overwrite_script_function( "from_ray", | @@ -3048,10 +3229,10 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = bevy::math::bounding::BoundingSphereCast::from_ray( - sphere, - ray, - max, + let output: Val = ::bevy::math::bounding::BoundingSphereCast::from_ray( + sphere.into(), + ray.into(), + max.into(), ) .into(); output @@ -3063,9 +3244,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, sphere: Val| { - let output: std::option::Option = bevy::math::bounding::BoundingSphereCast::sphere_collision_at( - _self, - sphere, + let output: std::option::Option = ::bevy::math::bounding::BoundingSphereCast::sphere_collision_at( + _self.into(), + sphere.into(), ) .into(); output @@ -3074,23 +3255,23 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::bounding::BoundingSphereCast::clone( - _self, + let output: Val = ::bevy::math::bounding::BoundingSphereCast::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::curve::interval::Interval>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::math::curve::interval::Interval::eq( - _self, - other, + let output: bool = ::bevy::math::curve::interval::Interval::eq( + _self.into(), + other.into(), ) .into(); output @@ -3099,7 +3280,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "start", |_self: Val| { - let output: f32 = bevy::math::curve::interval::Interval::start(_self) + let output: f32 = ::bevy::math::curve::interval::Interval::start( + _self.into(), + ) .into(); output }, @@ -3107,7 +3290,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "end", |_self: Val| { - let output: f32 = bevy::math::curve::interval::Interval::end(_self) + let output: f32 = ::bevy::math::curve::interval::Interval::end( + _self.into(), + ) .into(); output }, @@ -3115,8 +3300,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::curve::interval::Interval::length( - _self, + let output: f32 = ::bevy::math::curve::interval::Interval::length( + _self.into(), ) .into(); output @@ -3125,8 +3310,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_bounded", |_self: Val| { - let output: bool = bevy::math::curve::interval::Interval::is_bounded( - _self, + let output: bool = ::bevy::math::curve::interval::Interval::is_bounded( + _self.into(), ) .into(); output @@ -3135,8 +3320,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "has_finite_start", |_self: Val| { - let output: bool = bevy::math::curve::interval::Interval::has_finite_start( - _self, + let output: bool = ::bevy::math::curve::interval::Interval::has_finite_start( + _self.into(), ) .into(); output @@ -3145,8 +3330,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "has_finite_end", |_self: Val| { - let output: bool = bevy::math::curve::interval::Interval::has_finite_end( - _self, + let output: bool = ::bevy::math::curve::interval::Interval::has_finite_end( + _self.into(), ) .into(); output @@ -3155,9 +3340,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "contains", |_self: Val, item: f32| { - let output: bool = bevy::math::curve::interval::Interval::contains( - _self, - item, + let output: bool = ::bevy::math::curve::interval::Interval::contains( + _self.into(), + item.into(), ) .into(); output @@ -3169,9 +3354,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: bool = bevy::math::curve::interval::Interval::contains_interval( - _self, - other, + let output: bool = ::bevy::math::curve::interval::Interval::contains_interval( + _self.into(), + other.into(), ) .into(); output @@ -3180,9 +3365,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clamp", |_self: Val, value: f32| { - let output: f32 = bevy::math::curve::interval::Interval::clamp( - _self, - value, + let output: f32 = ::bevy::math::curve::interval::Interval::clamp( + _self.into(), + value.into(), ) .into(); output @@ -3191,19 +3376,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::curve::interval::Interval::clone( - _self, + let output: Val = ::bevy::math::curve::interval::Interval::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::FloatOrd>::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::FloatOrd::neg( - _self, + let output: Val = ::bevy::math::FloatOrd::neg( + _self.into(), ) .into(); output @@ -3212,8 +3397,8 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::FloatOrd::clone( - _self, + let output: Val = ::bevy::math::FloatOrd::clone( + _self.into(), ) .into(); output @@ -3222,44 +3407,64 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::FloatOrd::eq(_self, other).into(); + let output: bool = ::bevy::math::FloatOrd::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "lt", |_self: Ref, other: Ref| { - let output: bool = bevy::math::FloatOrd::lt(_self, other).into(); + let output: bool = ::bevy::math::FloatOrd::lt( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "le", |_self: Ref, other: Ref| { - let output: bool = bevy::math::FloatOrd::le(_self, other).into(); + let output: bool = ::bevy::math::FloatOrd::le( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "gt", |_self: Ref, other: Ref| { - let output: bool = bevy::math::FloatOrd::gt(_self, other).into(); + let output: bool = ::bevy::math::FloatOrd::gt( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "ge", |_self: Ref, other: Ref| { - let output: bool = bevy::math::FloatOrd::ge(_self, other).into(); + let output: bool = ::bevy::math::FloatOrd::ge( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Plane3d>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Plane3d::clone( - _self, + let output: Val = ::bevy::math::primitives::Plane3d::clone( + _self.into(), ) .into(); output @@ -3271,17 +3476,20 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Plane3d::eq(_self, other) + let output: bool = ::bevy::math::primitives::Plane3d::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::primitives::Tetrahedron>::new(world) .overwrite_script_function( "signed_volume", |_self: Ref| { - let output: f32 = bevy::math::primitives::Tetrahedron::signed_volume( - _self, + let output: f32 = ::bevy::math::primitives::Tetrahedron::signed_volume( + _self.into(), ) .into(); output @@ -3293,9 +3501,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::primitives::Tetrahedron::eq( - _self, - other, + let output: bool = ::bevy::math::primitives::Tetrahedron::eq( + _self.into(), + other.into(), ) .into(); output @@ -3304,19 +3512,19 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::primitives::Tetrahedron::clone( - _self, + let output: Val = ::bevy::math::primitives::Tetrahedron::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::curve::easing::EaseFunction>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::curve::easing::EaseFunction::clone( - _self, + let output: Val = ::bevy::math::curve::easing::EaseFunction::clone( + _self.into(), ) .into(); output @@ -3328,9 +3536,9 @@ impl bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::math::curve::easing::EaseFunction::eq( - _self, - other, + let output: bool = ::bevy::math::curve::easing::EaseFunction::eq( + _self.into(), + other.into(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs index db6638bf45..8644819064 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs @@ -11,12 +11,12 @@ pub struct BevyReflectScriptingPlugin; impl bevy::app::Plugin for BevyReflectScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicBool>::new(world) .overwrite_script_function( "new", |v: bool| { - let output: Val = std::sync::atomic::AtomicBool::new( - v, + let output: Val = ::std::sync::atomic::AtomicBool::new( + v.into(), ) .into(); output @@ -25,17 +25,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: bool = std::sync::atomic::AtomicBool::into_inner(_self) + let output: bool = ::std::sync::atomic::AtomicBool::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicI16>::new(world) .overwrite_script_function( "new", |v: i16| { - let output: Val = std::sync::atomic::AtomicI16::new( - v, + let output: Val = ::std::sync::atomic::AtomicI16::new( + v.into(), ) .into(); output @@ -44,17 +46,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i16 = std::sync::atomic::AtomicI16::into_inner(_self) + let output: i16 = ::std::sync::atomic::AtomicI16::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicI32>::new(world) .overwrite_script_function( "new", |v: i32| { - let output: Val = std::sync::atomic::AtomicI32::new( - v, + let output: Val = ::std::sync::atomic::AtomicI32::new( + v.into(), ) .into(); output @@ -63,17 +67,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i32 = std::sync::atomic::AtomicI32::into_inner(_self) + let output: i32 = ::std::sync::atomic::AtomicI32::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicI64>::new(world) .overwrite_script_function( "new", |v: i64| { - let output: Val = std::sync::atomic::AtomicI64::new( - v, + let output: Val = ::std::sync::atomic::AtomicI64::new( + v.into(), ) .into(); output @@ -82,17 +88,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i64 = std::sync::atomic::AtomicI64::into_inner(_self) + let output: i64 = ::std::sync::atomic::AtomicI64::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicI8>::new(world) .overwrite_script_function( "new", |v: i8| { - let output: Val = std::sync::atomic::AtomicI8::new( - v, + let output: Val = ::std::sync::atomic::AtomicI8::new( + v.into(), ) .into(); output @@ -101,17 +109,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i8 = std::sync::atomic::AtomicI8::into_inner(_self) + let output: i8 = ::std::sync::atomic::AtomicI8::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicIsize>::new(world) .overwrite_script_function( "new", |v: isize| { - let output: Val = std::sync::atomic::AtomicIsize::new( - v, + let output: Val = ::std::sync::atomic::AtomicIsize::new( + v.into(), ) .into(); output @@ -120,17 +130,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: isize = std::sync::atomic::AtomicIsize::into_inner(_self) + let output: isize = ::std::sync::atomic::AtomicIsize::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicU16>::new(world) .overwrite_script_function( "new", |v: u16| { - let output: Val = std::sync::atomic::AtomicU16::new( - v, + let output: Val = ::std::sync::atomic::AtomicU16::new( + v.into(), ) .into(); output @@ -139,17 +151,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u16 = std::sync::atomic::AtomicU16::into_inner(_self) + let output: u16 = ::std::sync::atomic::AtomicU16::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicU32>::new(world) .overwrite_script_function( "new", |v: u32| { - let output: Val = std::sync::atomic::AtomicU32::new( - v, + let output: Val = ::std::sync::atomic::AtomicU32::new( + v.into(), ) .into(); output @@ -158,17 +172,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u32 = std::sync::atomic::AtomicU32::into_inner(_self) + let output: u32 = ::std::sync::atomic::AtomicU32::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicU64>::new(world) .overwrite_script_function( "new", |v: u64| { - let output: Val = std::sync::atomic::AtomicU64::new( - v, + let output: Val = ::std::sync::atomic::AtomicU64::new( + v.into(), ) .into(); output @@ -177,17 +193,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u64 = std::sync::atomic::AtomicU64::into_inner(_self) + let output: u64 = ::std::sync::atomic::AtomicU64::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicU8>::new(world) .overwrite_script_function( "new", |v: u8| { - let output: Val = std::sync::atomic::AtomicU8::new( - v, + let output: Val = ::std::sync::atomic::AtomicU8::new( + v.into(), ) .into(); output @@ -196,17 +214,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u8 = std::sync::atomic::AtomicU8::into_inner(_self) + let output: u8 = ::std::sync::atomic::AtomicU8::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::sync::atomic::AtomicUsize>::new(world) .overwrite_script_function( "new", |v: usize| { - let output: Val = std::sync::atomic::AtomicUsize::new( - v, + let output: Val = ::std::sync::atomic::AtomicUsize::new( + v.into(), ) .into(); output @@ -215,18 +235,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: usize = std::sync::atomic::AtomicUsize::into_inner(_self) + let output: usize = ::std::sync::atomic::AtomicUsize::into_inner( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::utils::Duration>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = bevy::utils::Duration::mul( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -235,8 +257,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::utils::Duration::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::utils::Duration::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -245,8 +267,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::utils::Duration::clone( - _self, + let output: Val = ::bevy::utils::Duration::clone( + _self.into(), ) .into(); output @@ -255,9 +277,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::utils::Duration::sub( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -266,9 +288,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::utils::Duration::add( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::add( + _self.into(), + rhs.into(), ) .into(); output @@ -277,16 +299,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::utils::Duration::eq(_self, other).into(); + let output: bool = ::bevy::utils::Duration::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = bevy::utils::Duration::div( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::div( + _self.into(), + rhs.into(), ) .into(); output @@ -295,9 +321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |secs: u64, nanos: u32| { - let output: Val = bevy::utils::Duration::new( - secs, - nanos, + let output: Val = ::bevy::utils::Duration::new( + secs.into(), + nanos.into(), ) .into(); output @@ -306,8 +332,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_secs", |secs: u64| { - let output: Val = bevy::utils::Duration::from_secs( - secs, + let output: Val = ::bevy::utils::Duration::from_secs( + secs.into(), ) .into(); output @@ -316,8 +342,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_millis", |millis: u64| { - let output: Val = bevy::utils::Duration::from_millis( - millis, + let output: Val = ::bevy::utils::Duration::from_millis( + millis.into(), ) .into(); output @@ -326,8 +352,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_micros", |micros: u64| { - let output: Val = bevy::utils::Duration::from_micros( - micros, + let output: Val = ::bevy::utils::Duration::from_micros( + micros.into(), ) .into(); output @@ -336,8 +362,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_nanos", |nanos: u64| { - let output: Val = bevy::utils::Duration::from_nanos( - nanos, + let output: Val = ::bevy::utils::Duration::from_nanos( + nanos.into(), ) .into(); output @@ -346,65 +372,77 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_zero", |_self: Ref| { - let output: bool = bevy::utils::Duration::is_zero(_self).into(); + let output: bool = ::bevy::utils::Duration::is_zero(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_secs", |_self: Ref| { - let output: u64 = bevy::utils::Duration::as_secs(_self).into(); + let output: u64 = ::bevy::utils::Duration::as_secs(_self.into()) + .into(); output }, ) .overwrite_script_function( "subsec_millis", |_self: Ref| { - let output: u32 = bevy::utils::Duration::subsec_millis(_self).into(); + let output: u32 = ::bevy::utils::Duration::subsec_millis( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "subsec_micros", |_self: Ref| { - let output: u32 = bevy::utils::Duration::subsec_micros(_self).into(); + let output: u32 = ::bevy::utils::Duration::subsec_micros( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "subsec_nanos", |_self: Ref| { - let output: u32 = bevy::utils::Duration::subsec_nanos(_self).into(); + let output: u32 = ::bevy::utils::Duration::subsec_nanos(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_millis", |_self: Ref| { - let output: u128 = bevy::utils::Duration::as_millis(_self).into(); + let output: u128 = ::bevy::utils::Duration::as_millis(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_micros", |_self: Ref| { - let output: u128 = bevy::utils::Duration::as_micros(_self).into(); + let output: u128 = ::bevy::utils::Duration::as_micros(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_nanos", |_self: Ref| { - let output: u128 = bevy::utils::Duration::as_nanos(_self).into(); + let output: u128 = ::bevy::utils::Duration::as_nanos(_self.into()) + .into(); output }, ) .overwrite_script_function( "abs_diff", |_self: Val, other: Val| { - let output: Val = bevy::utils::Duration::abs_diff( - _self, - other, + let output: Val = ::bevy::utils::Duration::abs_diff( + _self.into(), + other.into(), ) .into(); output @@ -413,9 +451,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::utils::Duration::saturating_add( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -424,9 +462,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::utils::Duration::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -435,9 +473,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: u32| { - let output: Val = bevy::utils::Duration::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -446,22 +484,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_secs_f64", |_self: Ref| { - let output: f64 = bevy::utils::Duration::as_secs_f64(_self).into(); + let output: f64 = ::bevy::utils::Duration::as_secs_f64(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_secs_f32", |_self: Ref| { - let output: f32 = bevy::utils::Duration::as_secs_f32(_self).into(); + let output: f32 = ::bevy::utils::Duration::as_secs_f32(_self.into()) + .into(); output }, ) .overwrite_script_function( "from_secs_f64", |secs: f64| { - let output: Val = bevy::utils::Duration::from_secs_f64( - secs, + let output: Val = ::bevy::utils::Duration::from_secs_f64( + secs.into(), ) .into(); output @@ -470,8 +510,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_secs_f32", |secs: f32| { - let output: Val = bevy::utils::Duration::from_secs_f32( - secs, + let output: Val = ::bevy::utils::Duration::from_secs_f32( + secs.into(), ) .into(); output @@ -480,9 +520,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_f64", |_self: Val, rhs: f64| { - let output: Val = bevy::utils::Duration::mul_f64( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::mul_f64( + _self.into(), + rhs.into(), ) .into(); output @@ -491,9 +531,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_f32", |_self: Val, rhs: f32| { - let output: Val = bevy::utils::Duration::mul_f32( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::mul_f32( + _self.into(), + rhs.into(), ) .into(); output @@ -502,9 +542,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_f64", |_self: Val, rhs: f64| { - let output: Val = bevy::utils::Duration::div_f64( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::div_f64( + _self.into(), + rhs.into(), ) .into(); output @@ -513,9 +553,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_f32", |_self: Val, rhs: f32| { - let output: Val = bevy::utils::Duration::div_f32( - _self, - rhs, + let output: Val = ::bevy::utils::Duration::div_f32( + _self.into(), + rhs.into(), ) .into(); output @@ -524,7 +564,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_duration_f64", |_self: Val, rhs: Val| { - let output: f64 = bevy::utils::Duration::div_duration_f64(_self, rhs) + let output: f64 = ::bevy::utils::Duration::div_duration_f64( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -532,17 +575,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_duration_f32", |_self: Val, rhs: Val| { - let output: f32 = bevy::utils::Duration::div_duration_f32(_self, rhs) + let output: f32 = ::bevy::utils::Duration::div_duration_f32( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::utils::Instant>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::utils::Instant::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::utils::Instant::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -551,16 +597,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::utils::Instant::eq(_self, other).into(); + let output: bool = ::bevy::utils::Instant::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, other: Val| { - let output: Val = bevy::utils::Instant::sub( - _self, - other, + let output: Val = ::bevy::utils::Instant::sub( + _self.into(), + other.into(), ) .into(); output @@ -569,9 +619,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, other: Val| { - let output: Val = bevy::utils::Instant::sub( - _self, - other, + let output: Val = ::bevy::utils::Instant::sub( + _self.into(), + other.into(), ) .into(); output @@ -580,7 +630,7 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "now", || { - let output: Val = bevy::utils::Instant::now() + let output: Val = ::bevy::utils::Instant::now() .into(); output }, @@ -588,9 +638,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "duration_since", |_self: Ref, earlier: Val| { - let output: Val = bevy::utils::Instant::duration_since( - _self, - earlier, + let output: Val = ::bevy::utils::Instant::duration_since( + _self.into(), + earlier.into(), ) .into(); output @@ -599,9 +649,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_duration_since", |_self: Ref, earlier: Val| { - let output: Val = bevy::utils::Instant::saturating_duration_since( - _self, - earlier, + let output: Val = ::bevy::utils::Instant::saturating_duration_since( + _self.into(), + earlier.into(), ) .into(); output @@ -610,8 +660,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "elapsed", |_self: Ref| { - let output: Val = bevy::utils::Instant::elapsed( - _self, + let output: Val = ::bevy::utils::Instant::elapsed( + _self.into(), ) .into(); output @@ -620,8 +670,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::utils::Instant::clone( - _self, + let output: Val = ::bevy::utils::Instant::clone( + _self.into(), ) .into(); output @@ -630,20 +680,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, other: Val| { - let output: Val = bevy::utils::Instant::add( - _self, - other, + let output: Val = ::bevy::utils::Instant::add( + _self.into(), + other.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::std::ops::RangeFull>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = std::ops::RangeFull::clone( - _self, + let output: Val = ::std::ops::RangeFull::clone( + _self.into(), ) .into(); output @@ -652,8 +702,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = std::ops::RangeFull::assert_receiver_is_total_eq( - _self, + let output: () = ::std::ops::RangeFull::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -662,15 +712,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = std::ops::RangeFull::eq(_self, other).into(); + let output: bool = ::std::ops::RangeFull::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Quat>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Quat::mul(_self, rhs) + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -678,7 +735,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::sub(_self, rhs) + let output: Val = ::bevy::math::Quat::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -686,7 +746,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Quat::neg(_self) + let output: Val = ::bevy::math::Quat::neg( + _self.into(), + ) .into(); output }, @@ -694,9 +756,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::mul( - _self, - rhs, + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -705,7 +767,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Quat::clone(_self) + let output: Val = ::bevy::math::Quat::clone( + _self.into(), + ) .into(); output }, @@ -713,11 +777,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_xyzw", |x: f32, y: f32, z: f32, w: f32| { - let output: Val = bevy::math::Quat::from_xyzw( - x, - y, - z, - w, + let output: Val = ::bevy::math::Quat::from_xyzw( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -726,7 +790,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = bevy::math::Quat::from_array(a) + let output: Val = ::bevy::math::Quat::from_array( + a.into(), + ) .into(); output }, @@ -734,7 +800,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = bevy::math::Quat::from_vec4(v) + let output: Val = ::bevy::math::Quat::from_vec4( + v.into(), + ) .into(); output }, @@ -742,9 +810,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = bevy::math::Quat::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::Quat::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -753,8 +821,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scaled_axis", |v: Val| { - let output: Val = bevy::math::Quat::from_scaled_axis( - v, + let output: Val = ::bevy::math::Quat::from_scaled_axis( + v.into(), ) .into(); output @@ -763,8 +831,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = bevy::math::Quat::from_rotation_x( - angle, + let output: Val = ::bevy::math::Quat::from_rotation_x( + angle.into(), ) .into(); output @@ -773,8 +841,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = bevy::math::Quat::from_rotation_y( - angle, + let output: Val = ::bevy::math::Quat::from_rotation_y( + angle.into(), ) .into(); output @@ -783,8 +851,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = bevy::math::Quat::from_rotation_z( - angle, + let output: Val = ::bevy::math::Quat::from_rotation_z( + angle.into(), ) .into(); output @@ -793,11 +861,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |euler: Val, a: f32, b: f32, c: f32| { - let output: Val = bevy::math::Quat::from_euler( - euler, - a, - b, - c, + let output: Val = ::bevy::math::Quat::from_euler( + euler.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -806,7 +874,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat: Ref| { - let output: Val = bevy::math::Quat::from_mat3(mat) + let output: Val = ::bevy::math::Quat::from_mat3( + mat.into(), + ) .into(); output }, @@ -814,7 +884,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |mat: Ref| { - let output: Val = bevy::math::Quat::from_mat3a(mat) + let output: Val = ::bevy::math::Quat::from_mat3a( + mat.into(), + ) .into(); output }, @@ -822,7 +894,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |mat: Ref| { - let output: Val = bevy::math::Quat::from_mat4(mat) + let output: Val = ::bevy::math::Quat::from_mat4( + mat.into(), + ) .into(); output }, @@ -830,9 +904,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc", |from: Val, to: Val| { - let output: Val = bevy::math::Quat::from_rotation_arc( - from, - to, + let output: Val = ::bevy::math::Quat::from_rotation_arc( + from.into(), + to.into(), ) .into(); output @@ -841,9 +915,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_colinear", |from: Val, to: Val| { - let output: Val = bevy::math::Quat::from_rotation_arc_colinear( - from, - to, + let output: Val = ::bevy::math::Quat::from_rotation_arc_colinear( + from.into(), + to.into(), ) .into(); output @@ -852,9 +926,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_2d", |from: Val, to: Val| { - let output: Val = bevy::math::Quat::from_rotation_arc_2d( - from, - to, + let output: Val = ::bevy::math::Quat::from_rotation_arc_2d( + from.into(), + to.into(), ) .into(); output @@ -863,8 +937,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_scaled_axis", |_self: Val| { - let output: Val = bevy::math::Quat::to_scaled_axis( - _self, + let output: Val = ::bevy::math::Quat::to_scaled_axis( + _self.into(), ) .into(); output @@ -873,9 +947,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Val, order: Val| { - let output: (f32, f32, f32) = bevy::math::Quat::to_euler( - _self, - order, + let output: (f32, f32, f32) = ::bevy::math::Quat::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -884,14 +958,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = bevy::math::Quat::to_array(_self).into(); + let output: [f32; 4] = ::bevy::math::Quat::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "xyz", |_self: Val| { - let output: Val = bevy::math::Quat::xyz(_self) + let output: Val = ::bevy::math::Quat::xyz( + _self.into(), + ) .into(); output }, @@ -899,8 +976,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "conjugate", |_self: Val| { - let output: Val = bevy::math::Quat::conjugate( - _self, + let output: Val = ::bevy::math::Quat::conjugate( + _self.into(), ) .into(); output @@ -909,7 +986,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = bevy::math::Quat::inverse(_self) + let output: Val = ::bevy::math::Quat::inverse( + _self.into(), + ) .into(); output }, @@ -917,36 +996,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Quat::dot(_self, rhs).into(); + let output: f32 = ::bevy::math::Quat::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::Quat::length(_self).into(); + let output: f32 = ::bevy::math::Quat::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = bevy::math::Quat::length_squared(_self).into(); + let output: f32 = ::bevy::math::Quat::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = bevy::math::Quat::length_recip(_self).into(); + let output: f32 = ::bevy::math::Quat::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::Quat::normalize( - _self, + let output: Val = ::bevy::math::Quat::normalize( + _self.into(), ) .into(); output @@ -955,35 +1037,42 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::Quat::is_finite(_self).into(); + let output: bool = ::bevy::math::Quat::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::Quat::is_nan(_self).into(); + let output: bool = ::bevy::math::Quat::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::Quat::is_normalized(_self).into(); + let output: bool = ::bevy::math::Quat::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = bevy::math::Quat::is_near_identity(_self).into(); + let output: bool = ::bevy::math::Quat::is_near_identity(_self.into()) + .into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Quat::angle_between(_self, rhs).into(); + let output: f32 = ::bevy::math::Quat::angle_between( + _self.into(), + rhs.into(), + ) + .into(); output }, ) @@ -994,10 +1083,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f32| { - let output: Val = bevy::math::Quat::rotate_towards( - _self, - rhs, - max_angle, + let output: Val = ::bevy::math::Quat::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), ) .into(); output @@ -1010,10 +1099,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Quat::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Quat::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -1022,10 +1111,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, end: Val, s: f32| { - let output: Val = bevy::math::Quat::lerp( - _self, - end, - s, + let output: Val = ::bevy::math::Quat::lerp( + _self.into(), + end.into(), + s.into(), ) .into(); output @@ -1034,10 +1123,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f32| { - let output: Val = bevy::math::Quat::slerp( - _self, - end, - s, + let output: Val = ::bevy::math::Quat::slerp( + _self.into(), + end.into(), + s.into(), ) .into(); output @@ -1046,9 +1135,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::mul_vec3( - _self, - rhs, + let output: Val = ::bevy::math::Quat::mul_vec3( + _self.into(), + rhs.into(), ) .into(); output @@ -1057,9 +1146,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_quat", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::mul_quat( - _self, - rhs, + let output: Val = ::bevy::math::Quat::mul_quat( + _self.into(), + rhs.into(), ) .into(); output @@ -1068,7 +1157,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_affine3", |a: Ref| { - let output: Val = bevy::math::Quat::from_affine3(a) + let output: Val = ::bevy::math::Quat::from_affine3( + a.into(), + ) .into(); output }, @@ -1076,9 +1167,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::mul_vec3a( - _self, - rhs, + let output: Val = ::bevy::math::Quat::mul_vec3a( + _self.into(), + rhs.into(), ) .into(); output @@ -1087,8 +1178,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dquat", |_self: Val| { - let output: Val = bevy::math::Quat::as_dquat( - _self, + let output: Val = ::bevy::math::Quat::as_dquat( + _self.into(), ) .into(); output @@ -1097,14 +1188,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Quat::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Quat::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::mul(_self, rhs) + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1112,7 +1207,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::mul(_self, rhs) + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1120,7 +1218,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Quat::div(_self, rhs) + let output: Val = ::bevy::math::Quat::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1128,16 +1229,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Quat::add(_self, rhs) + let output: Val = ::bevy::math::Quat::add( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Vec3>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3::mul(_self, rhs) + let output: Val = ::bevy::math::Vec3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1145,7 +1252,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3::div(_self, rhs) + let output: Val = ::bevy::math::Vec3::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1153,7 +1263,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::mul(_self, rhs) + let output: Val = ::bevy::math::Vec3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1161,7 +1274,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::add(_self, rhs) + let output: Val = ::bevy::math::Vec3::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1169,7 +1285,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Vec3::clone(_self) + let output: Val = ::bevy::math::Vec3::clone( + _self.into(), + ) .into(); output }, @@ -1177,7 +1295,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3::sub(_self, rhs) + let output: Val = ::bevy::math::Vec3::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1185,7 +1306,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::rem(_self, rhs) + let output: Val = ::bevy::math::Vec3::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1193,7 +1317,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Vec3::neg(_self) + let output: Val = ::bevy::math::Vec3::neg( + _self.into(), + ) .into(); output }, @@ -1201,7 +1327,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3::mul(_self, rhs) + let output: Val = ::bevy::math::Vec3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1209,7 +1338,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3::sub(_self, rhs) + let output: Val = ::bevy::math::Vec3::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1217,7 +1349,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::div(_self, rhs) + let output: Val = ::bevy::math::Vec3::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1225,7 +1360,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3::add(_self, rhs) + let output: Val = ::bevy::math::Vec3::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1233,7 +1371,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3::rem(_self, rhs) + let output: Val = ::bevy::math::Vec3::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1241,7 +1382,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3::rem(_self, rhs) + let output: Val = ::bevy::math::Vec3::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1249,7 +1393,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3::div(_self, rhs) + let output: Val = ::bevy::math::Vec3::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1257,7 +1404,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32, z: f32| { - let output: Val = bevy::math::Vec3::new(x, y, z) + let output: Val = ::bevy::math::Vec3::new( + x.into(), + y.into(), + z.into(), + ) .into(); output }, @@ -1265,7 +1416,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = bevy::math::Vec3::splat(v) + let output: Val = ::bevy::math::Vec3::splat( + v.into(), + ) .into(); output }, @@ -1277,10 +1430,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::Vec3::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -1289,7 +1442,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 3]| { - let output: Val = bevy::math::Vec3::from_array(a) + let output: Val = ::bevy::math::Vec3::from_array( + a.into(), + ) .into(); output }, @@ -1297,16 +1452,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = bevy::math::Vec3::to_array(_self).into(); + let output: [f32; 3] = ::bevy::math::Vec3::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f32| { - let output: Val = bevy::math::Vec3::extend( - _self, - w, + let output: Val = ::bevy::math::Vec3::extend( + _self.into(), + w.into(), ) .into(); output @@ -1315,7 +1471,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::Vec3::truncate(_self) + let output: Val = ::bevy::math::Vec3::truncate( + _self.into(), + ) .into(); output }, @@ -1323,9 +1481,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = bevy::math::Vec3::with_x( - _self, - x, + let output: Val = ::bevy::math::Vec3::with_x( + _self.into(), + x.into(), ) .into(); output @@ -1334,9 +1492,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = bevy::math::Vec3::with_y( - _self, - y, + let output: Val = ::bevy::math::Vec3::with_y( + _self.into(), + y.into(), ) .into(); output @@ -1345,9 +1503,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = bevy::math::Vec3::with_z( - _self, - z, + let output: Val = ::bevy::math::Vec3::with_z( + _self.into(), + z.into(), ) .into(); output @@ -1356,16 +1514,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3::dot(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec3::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -1374,9 +1533,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cross( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -1385,7 +1544,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::min(_self, rhs) + let output: Val = ::bevy::math::Vec3::min( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1393,7 +1555,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::max(_self, rhs) + let output: Val = ::bevy::math::Vec3::max( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1405,10 +1570,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::Vec3::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::Vec3::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -1417,37 +1582,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = bevy::math::Vec3::min_element(_self).into(); + let output: f32 = ::bevy::math::Vec3::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = bevy::math::Vec3::max_element(_self).into(); + let output: f32 = ::bevy::math::Vec3::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = bevy::math::Vec3::element_sum(_self).into(); + let output: f32 = ::bevy::math::Vec3::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = bevy::math::Vec3::element_product(_self).into(); + let output: f32 = ::bevy::math::Vec3::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -1456,9 +1625,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -1467,9 +1636,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -1478,9 +1647,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -1489,9 +1658,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cmple( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -1500,9 +1669,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -1511,7 +1680,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::Vec3::abs(_self) + let output: Val = ::bevy::math::Vec3::abs( + _self.into(), + ) .into(); output }, @@ -1519,7 +1690,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::Vec3::signum(_self) + let output: Val = ::bevy::math::Vec3::signum( + _self.into(), + ) .into(); output }, @@ -1527,9 +1700,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::copysign( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -1538,7 +1711,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::Vec3::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::Vec3::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -1546,15 +1721,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::Vec3::is_finite(_self).into(); + let output: bool = ::bevy::math::Vec3::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::Vec3::is_finite_mask( - _self, + let output: Val = ::bevy::math::Vec3::is_finite_mask( + _self.into(), ) .into(); output @@ -1563,15 +1739,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::Vec3::is_nan(_self).into(); + let output: bool = ::bevy::math::Vec3::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::Vec3::is_nan_mask( - _self, + let output: Val = ::bevy::math::Vec3::is_nan_mask( + _self.into(), ) .into(); output @@ -1580,35 +1756,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::Vec3::length(_self).into(); + let output: f32 = ::bevy::math::Vec3::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = bevy::math::Vec3::length_squared(_self).into(); + let output: f32 = ::bevy::math::Vec3::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = bevy::math::Vec3::length_recip(_self).into(); + let output: f32 = ::bevy::math::Vec3::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3::distance(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec3::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3::distance_squared(_self, rhs) + let output: f32 = ::bevy::math::Vec3::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -1616,9 +1801,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -1627,9 +1812,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -1638,8 +1823,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::Vec3::normalize( - _self, + let output: Val = ::bevy::math::Vec3::normalize( + _self.into(), ) .into(); output @@ -1648,9 +1833,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::Vec3::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::Vec3::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -1659,8 +1844,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::Vec3::normalize_or_zero( - _self, + let output: Val = ::bevy::math::Vec3::normalize_or_zero( + _self.into(), ) .into(); output @@ -1669,16 +1854,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::Vec3::is_normalized(_self).into(); + let output: bool = ::bevy::math::Vec3::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -1687,9 +1873,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -1698,9 +1884,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -1709,9 +1895,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -1720,7 +1906,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::Vec3::round(_self) + let output: Val = ::bevy::math::Vec3::round( + _self.into(), + ) .into(); output }, @@ -1728,7 +1916,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::Vec3::floor(_self) + let output: Val = ::bevy::math::Vec3::floor( + _self.into(), + ) .into(); output }, @@ -1736,7 +1926,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::Vec3::ceil(_self) + let output: Val = ::bevy::math::Vec3::ceil( + _self.into(), + ) .into(); output }, @@ -1744,7 +1936,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::Vec3::trunc(_self) + let output: Val = ::bevy::math::Vec3::trunc( + _self.into(), + ) .into(); output }, @@ -1752,7 +1946,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::Vec3::fract(_self) + let output: Val = ::bevy::math::Vec3::fract( + _self.into(), + ) .into(); output }, @@ -1760,7 +1956,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::Vec3::fract_gl(_self) + let output: Val = ::bevy::math::Vec3::fract_gl( + _self.into(), + ) .into(); output }, @@ -1768,7 +1966,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::Vec3::exp(_self) + let output: Val = ::bevy::math::Vec3::exp( + _self.into(), + ) .into(); output }, @@ -1776,7 +1976,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = bevy::math::Vec3::powf(_self, n) + let output: Val = ::bevy::math::Vec3::powf( + _self.into(), + n.into(), + ) .into(); output }, @@ -1784,7 +1987,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::Vec3::recip(_self) + let output: Val = ::bevy::math::Vec3::recip( + _self.into(), + ) .into(); output }, @@ -1792,10 +1997,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = bevy::math::Vec3::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::Vec3::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -1804,10 +2009,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = bevy::math::Vec3::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::Vec3::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -1816,9 +2021,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::Vec3::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -1831,10 +2036,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Vec3::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Vec3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -1843,10 +2048,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = bevy::math::Vec3::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::Vec3::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -1855,9 +2060,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = bevy::math::Vec3::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::Vec3::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -1866,9 +2071,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = bevy::math::Vec3::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::Vec3::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -1881,10 +2086,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::Vec3::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::Vec3::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -1893,9 +2098,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::Vec3::reflect( - _self, - normal, + let output: Val = ::bevy::math::Vec3::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -1904,10 +2109,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = bevy::math::Vec3::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::Vec3::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -1916,15 +2121,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3::angle_between(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec3::angle_between( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = bevy::math::Vec3::any_orthogonal_vector( - _self, + let output: Val = ::bevy::math::Vec3::any_orthogonal_vector( + _self.into(), ) .into(); output @@ -1933,8 +2142,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = bevy::math::Vec3::any_orthonormal_vector( - _self, + let output: Val = ::bevy::math::Vec3::any_orthonormal_vector( + _self.into(), ) .into(); output @@ -1943,8 +2152,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = bevy::math::Vec3::as_dvec3( - _self, + let output: Val = ::bevy::math::Vec3::as_dvec3( + _self.into(), ) .into(); output @@ -1953,8 +2162,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = bevy::math::Vec3::as_ivec3( - _self, + let output: Val = ::bevy::math::Vec3::as_ivec3( + _self.into(), ) .into(); output @@ -1963,8 +2172,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = bevy::math::Vec3::as_uvec3( - _self, + let output: Val = ::bevy::math::Vec3::as_uvec3( + _self.into(), ) .into(); output @@ -1973,8 +2182,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = bevy::math::Vec3::as_i64vec3( - _self, + let output: Val = ::bevy::math::Vec3::as_i64vec3( + _self.into(), ) .into(); output @@ -1983,8 +2192,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = bevy::math::Vec3::as_u64vec3( - _self, + let output: Val = ::bevy::math::Vec3::as_u64vec3( + _self.into(), ) .into(); output @@ -1993,14 +2202,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Vec3::eq(_self, other).into(); + let output: bool = ::bevy::math::Vec3::eq(_self.into(), other.into()) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3::add(_self, rhs) + let output: Val = ::bevy::math::Vec3::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -2008,18 +2221,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3::sub(_self, rhs) + let output: Val = ::bevy::math::Vec3::sub( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::IVec2>::new(world) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -2028,9 +2244,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -2039,9 +2255,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -2050,9 +2266,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -2061,9 +2277,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -2072,9 +2288,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -2083,9 +2299,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -2094,9 +2310,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -2105,9 +2321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -2116,9 +2332,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -2127,8 +2343,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::IVec2::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::IVec2::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -2137,9 +2353,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -2148,9 +2364,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -2159,9 +2375,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -2170,16 +2386,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::IVec2::eq(_self, other).into(); + let output: bool = ::bevy::math::IVec2::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -2188,9 +2408,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -2199,7 +2419,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i32, y: i32| { - let output: Val = bevy::math::IVec2::new(x, y) + let output: Val = ::bevy::math::IVec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -2207,7 +2430,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = bevy::math::IVec2::splat(v) + let output: Val = ::bevy::math::IVec2::splat( + v.into(), + ) .into(); output }, @@ -2219,10 +2444,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::IVec2::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::IVec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -2231,7 +2456,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 2]| { - let output: Val = bevy::math::IVec2::from_array(a) + let output: Val = ::bevy::math::IVec2::from_array( + a.into(), + ) .into(); output }, @@ -2239,16 +2466,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 2] = bevy::math::IVec2::to_array(_self).into(); + let output: [i32; 2] = ::bevy::math::IVec2::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: i32| { - let output: Val = bevy::math::IVec2::extend( - _self, - z, + let output: Val = ::bevy::math::IVec2::extend( + _self.into(), + z.into(), ) .into(); output @@ -2257,9 +2485,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = bevy::math::IVec2::with_x( - _self, - x, + let output: Val = ::bevy::math::IVec2::with_x( + _self.into(), + x.into(), ) .into(); output @@ -2268,9 +2496,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = bevy::math::IVec2::with_y( - _self, - y, + let output: Val = ::bevy::math::IVec2::with_y( + _self.into(), + y.into(), ) .into(); output @@ -2279,16 +2507,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec2::dot(_self, rhs).into(); + let output: i32 = ::bevy::math::IVec2::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -2297,9 +2526,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::min( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::min( + _self.into(), + rhs.into(), ) .into(); output @@ -2308,9 +2537,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::max( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::max( + _self.into(), + rhs.into(), ) .into(); output @@ -2323,10 +2552,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::IVec2::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::IVec2::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -2335,37 +2564,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = bevy::math::IVec2::min_element(_self).into(); + let output: i32 = ::bevy::math::IVec2::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = bevy::math::IVec2::max_element(_self).into(); + let output: i32 = ::bevy::math::IVec2::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = bevy::math::IVec2::element_sum(_self).into(); + let output: i32 = ::bevy::math::IVec2::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = bevy::math::IVec2::element_product(_self).into(); + let output: i32 = ::bevy::math::IVec2::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -2374,9 +2607,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -2385,9 +2618,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -2396,9 +2629,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -2407,9 +2640,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::cmple( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -2418,9 +2651,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -2429,7 +2662,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::IVec2::abs(_self) + let output: Val = ::bevy::math::IVec2::abs( + _self.into(), + ) .into(); output }, @@ -2437,7 +2672,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::IVec2::signum(_self) + let output: Val = ::bevy::math::IVec2::signum( + _self.into(), + ) .into(); output }, @@ -2445,7 +2682,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::IVec2::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::IVec2::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -2453,14 +2692,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = bevy::math::IVec2::length_squared(_self).into(); + let output: i32 = ::bevy::math::IVec2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec2::distance_squared(_self, rhs) + let output: i32 = ::bevy::math::IVec2::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -2468,9 +2711,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -2479,9 +2722,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -2490,7 +2733,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = bevy::math::IVec2::perp(_self) + let output: Val = ::bevy::math::IVec2::perp( + _self.into(), + ) .into(); output }, @@ -2498,16 +2743,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec2::perp_dot(_self, rhs).into(); + let output: i32 = ::bevy::math::IVec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::rotate( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::rotate( + _self.into(), + rhs.into(), ) .into(); output @@ -2516,7 +2765,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = bevy::math::IVec2::as_vec2(_self) + let output: Val = ::bevy::math::IVec2::as_vec2( + _self.into(), + ) .into(); output }, @@ -2524,8 +2775,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = bevy::math::IVec2::as_dvec2( - _self, + let output: Val = ::bevy::math::IVec2::as_dvec2( + _self.into(), ) .into(); output @@ -2534,8 +2785,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = bevy::math::IVec2::as_uvec2( - _self, + let output: Val = ::bevy::math::IVec2::as_uvec2( + _self.into(), ) .into(); output @@ -2544,8 +2795,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = bevy::math::IVec2::as_i64vec2( - _self, + let output: Val = ::bevy::math::IVec2::as_i64vec2( + _self.into(), ) .into(); output @@ -2554,8 +2805,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = bevy::math::IVec2::as_u64vec2( - _self, + let output: Val = ::bevy::math::IVec2::as_u64vec2( + _self.into(), ) .into(); output @@ -2564,9 +2815,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -2575,9 +2826,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -2586,9 +2837,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -2597,9 +2848,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -2608,9 +2859,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -2619,9 +2870,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -2630,9 +2881,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -2641,9 +2892,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -2652,9 +2903,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::wrapping_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::wrapping_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -2663,9 +2914,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::wrapping_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::wrapping_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -2674,9 +2925,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::saturating_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::saturating_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -2685,9 +2936,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec2::saturating_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec2::saturating_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -2696,7 +2947,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::IVec2::neg(_self) + let output: Val = ::bevy::math::IVec2::neg( + _self.into(), + ) .into(); output }, @@ -2704,18 +2957,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::IVec2::clone(_self) + let output: Val = ::bevy::math::IVec2::clone( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::IVec3>::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -2724,9 +2979,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -2735,8 +2990,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::IVec3::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::IVec3::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -2745,9 +3000,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -2756,7 +3011,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i32, y: i32, z: i32| { - let output: Val = bevy::math::IVec3::new(x, y, z) + let output: Val = ::bevy::math::IVec3::new( + x.into(), + y.into(), + z.into(), + ) .into(); output }, @@ -2764,7 +3023,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = bevy::math::IVec3::splat(v) + let output: Val = ::bevy::math::IVec3::splat( + v.into(), + ) .into(); output }, @@ -2776,10 +3037,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::IVec3::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::IVec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -2788,7 +3049,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 3]| { - let output: Val = bevy::math::IVec3::from_array(a) + let output: Val = ::bevy::math::IVec3::from_array( + a.into(), + ) .into(); output }, @@ -2796,16 +3059,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 3] = bevy::math::IVec3::to_array(_self).into(); + let output: [i32; 3] = ::bevy::math::IVec3::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: i32| { - let output: Val = bevy::math::IVec3::extend( - _self, - w, + let output: Val = ::bevy::math::IVec3::extend( + _self.into(), + w.into(), ) .into(); output @@ -2814,8 +3078,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::IVec3::truncate( - _self, + let output: Val = ::bevy::math::IVec3::truncate( + _self.into(), ) .into(); output @@ -2824,9 +3088,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = bevy::math::IVec3::with_x( - _self, - x, + let output: Val = ::bevy::math::IVec3::with_x( + _self.into(), + x.into(), ) .into(); output @@ -2835,9 +3099,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = bevy::math::IVec3::with_y( - _self, - y, + let output: Val = ::bevy::math::IVec3::with_y( + _self.into(), + y.into(), ) .into(); output @@ -2846,9 +3110,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i32| { - let output: Val = bevy::math::IVec3::with_z( - _self, - z, + let output: Val = ::bevy::math::IVec3::with_z( + _self.into(), + z.into(), ) .into(); output @@ -2857,16 +3121,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec3::dot(_self, rhs).into(); + let output: i32 = ::bevy::math::IVec3::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -2875,9 +3140,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cross( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -2886,9 +3151,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::min( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::min( + _self.into(), + rhs.into(), ) .into(); output @@ -2897,9 +3162,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::max( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::max( + _self.into(), + rhs.into(), ) .into(); output @@ -2912,10 +3177,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::IVec3::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::IVec3::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -2924,37 +3189,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = bevy::math::IVec3::min_element(_self).into(); + let output: i32 = ::bevy::math::IVec3::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = bevy::math::IVec3::max_element(_self).into(); + let output: i32 = ::bevy::math::IVec3::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = bevy::math::IVec3::element_sum(_self).into(); + let output: i32 = ::bevy::math::IVec3::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = bevy::math::IVec3::element_product(_self).into(); + let output: i32 = ::bevy::math::IVec3::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -2963,9 +3232,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -2974,9 +3243,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -2985,9 +3254,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -2996,9 +3265,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cmple( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -3007,9 +3276,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -3018,7 +3287,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::IVec3::abs(_self) + let output: Val = ::bevy::math::IVec3::abs( + _self.into(), + ) .into(); output }, @@ -3026,7 +3297,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::IVec3::signum(_self) + let output: Val = ::bevy::math::IVec3::signum( + _self.into(), + ) .into(); output }, @@ -3034,7 +3307,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::IVec3::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::IVec3::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -3042,14 +3317,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = bevy::math::IVec3::length_squared(_self).into(); + let output: i32 = ::bevy::math::IVec3::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec3::distance_squared(_self, rhs) + let output: i32 = ::bevy::math::IVec3::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -3057,9 +3336,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -3068,9 +3347,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -3079,7 +3358,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = bevy::math::IVec3::as_vec3(_self) + let output: Val = ::bevy::math::IVec3::as_vec3( + _self.into(), + ) .into(); output }, @@ -3087,8 +3368,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = bevy::math::IVec3::as_vec3a( - _self, + let output: Val = ::bevy::math::IVec3::as_vec3a( + _self.into(), ) .into(); output @@ -3097,8 +3378,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = bevy::math::IVec3::as_dvec3( - _self, + let output: Val = ::bevy::math::IVec3::as_dvec3( + _self.into(), ) .into(); output @@ -3107,8 +3388,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = bevy::math::IVec3::as_uvec3( - _self, + let output: Val = ::bevy::math::IVec3::as_uvec3( + _self.into(), ) .into(); output @@ -3117,8 +3398,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = bevy::math::IVec3::as_i64vec3( - _self, + let output: Val = ::bevy::math::IVec3::as_i64vec3( + _self.into(), ) .into(); output @@ -3127,8 +3408,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = bevy::math::IVec3::as_u64vec3( - _self, + let output: Val = ::bevy::math::IVec3::as_u64vec3( + _self.into(), ) .into(); output @@ -3137,9 +3418,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -3148,9 +3429,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3159,9 +3440,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3170,9 +3451,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -3181,9 +3462,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -3192,9 +3473,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3203,9 +3484,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3214,9 +3495,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -3225,9 +3506,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::wrapping_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::wrapping_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3236,9 +3517,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::wrapping_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::wrapping_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3247,9 +3528,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::saturating_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::saturating_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3258,9 +3539,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::saturating_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::saturating_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3269,9 +3550,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -3280,9 +3561,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3291,9 +3572,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -3302,9 +3583,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -3313,9 +3594,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3324,9 +3605,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -3335,7 +3616,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::IVec3::neg(_self) + let output: Val = ::bevy::math::IVec3::neg( + _self.into(), + ) .into(); output }, @@ -3343,7 +3626,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::IVec3::clone(_self) + let output: Val = ::bevy::math::IVec3::clone( + _self.into(), + ) .into(); output }, @@ -3351,16 +3636,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::IVec3::eq(_self, other).into(); + let output: bool = ::bevy::math::IVec3::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3369,9 +3658,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3380,9 +3669,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -3391,9 +3680,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -3402,9 +3691,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3413,21 +3702,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::IVec4>::new(world) .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -3436,9 +3725,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -3447,9 +3736,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3458,9 +3747,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3469,11 +3758,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i32, y: i32, z: i32, w: i32| { - let output: Val = bevy::math::IVec4::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::IVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -3482,7 +3771,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = bevy::math::IVec4::splat(v) + let output: Val = ::bevy::math::IVec4::splat( + v.into(), + ) .into(); output }, @@ -3494,10 +3785,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::IVec4::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::IVec4::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -3506,7 +3797,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 4]| { - let output: Val = bevy::math::IVec4::from_array(a) + let output: Val = ::bevy::math::IVec4::from_array( + a.into(), + ) .into(); output }, @@ -3514,15 +3807,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 4] = bevy::math::IVec4::to_array(_self).into(); + let output: [i32; 4] = ::bevy::math::IVec4::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::IVec4::truncate( - _self, + let output: Val = ::bevy::math::IVec4::truncate( + _self.into(), ) .into(); output @@ -3531,9 +3825,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = bevy::math::IVec4::with_x( - _self, - x, + let output: Val = ::bevy::math::IVec4::with_x( + _self.into(), + x.into(), ) .into(); output @@ -3542,9 +3836,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = bevy::math::IVec4::with_y( - _self, - y, + let output: Val = ::bevy::math::IVec4::with_y( + _self.into(), + y.into(), ) .into(); output @@ -3553,9 +3847,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i32| { - let output: Val = bevy::math::IVec4::with_z( - _self, - z, + let output: Val = ::bevy::math::IVec4::with_z( + _self.into(), + z.into(), ) .into(); output @@ -3564,9 +3858,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: i32| { - let output: Val = bevy::math::IVec4::with_w( - _self, - w, + let output: Val = ::bevy::math::IVec4::with_w( + _self.into(), + w.into(), ) .into(); output @@ -3575,16 +3869,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec4::dot(_self, rhs).into(); + let output: i32 = ::bevy::math::IVec4::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -3593,9 +3888,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::min( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::min( + _self.into(), + rhs.into(), ) .into(); output @@ -3604,9 +3899,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::max( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::max( + _self.into(), + rhs.into(), ) .into(); output @@ -3619,10 +3914,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::IVec4::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::IVec4::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -3631,37 +3926,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = bevy::math::IVec4::min_element(_self).into(); + let output: i32 = ::bevy::math::IVec4::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = bevy::math::IVec4::max_element(_self).into(); + let output: i32 = ::bevy::math::IVec4::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = bevy::math::IVec4::element_sum(_self).into(); + let output: i32 = ::bevy::math::IVec4::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = bevy::math::IVec4::element_product(_self).into(); + let output: i32 = ::bevy::math::IVec4::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -3670,9 +3969,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -3681,9 +3980,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -3692,9 +3991,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -3703,9 +4002,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::cmple( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -3714,9 +4013,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -3725,7 +4024,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::IVec4::abs(_self) + let output: Val = ::bevy::math::IVec4::abs( + _self.into(), + ) .into(); output }, @@ -3733,7 +4034,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::IVec4::signum(_self) + let output: Val = ::bevy::math::IVec4::signum( + _self.into(), + ) .into(); output }, @@ -3741,7 +4044,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::IVec4::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::IVec4::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -3749,14 +4054,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = bevy::math::IVec4::length_squared(_self).into(); + let output: i32 = ::bevy::math::IVec4::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = bevy::math::IVec4::distance_squared(_self, rhs) + let output: i32 = ::bevy::math::IVec4::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -3764,9 +4073,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -3775,9 +4084,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -3786,7 +4095,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = bevy::math::IVec4::as_vec4(_self) + let output: Val = ::bevy::math::IVec4::as_vec4( + _self.into(), + ) .into(); output }, @@ -3794,8 +4105,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = bevy::math::IVec4::as_dvec4( - _self, + let output: Val = ::bevy::math::IVec4::as_dvec4( + _self.into(), ) .into(); output @@ -3804,8 +4115,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = bevy::math::IVec4::as_uvec4( - _self, + let output: Val = ::bevy::math::IVec4::as_uvec4( + _self.into(), ) .into(); output @@ -3814,8 +4125,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = bevy::math::IVec4::as_i64vec4( - _self, + let output: Val = ::bevy::math::IVec4::as_i64vec4( + _self.into(), ) .into(); output @@ -3824,8 +4135,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = bevy::math::IVec4::as_u64vec4( - _self, + let output: Val = ::bevy::math::IVec4::as_u64vec4( + _self.into(), ) .into(); output @@ -3834,9 +4145,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -3845,9 +4156,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3856,9 +4167,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3867,9 +4178,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -3878,9 +4189,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -3889,9 +4200,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -3900,9 +4211,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -3911,9 +4222,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -3922,9 +4233,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::wrapping_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::wrapping_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3933,9 +4244,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::wrapping_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::wrapping_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3944,9 +4255,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::saturating_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::saturating_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3955,9 +4266,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::saturating_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::saturating_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -3966,9 +4277,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -3977,9 +4288,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -3988,16 +4299,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::IVec4::eq(_self, other).into(); + let output: bool = ::bevy::math::IVec4::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -4006,9 +4321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4017,9 +4332,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::IVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4028,9 +4343,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4039,7 +4354,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::IVec4::clone(_self) + let output: Val = ::bevy::math::IVec4::clone( + _self.into(), + ) .into(); output }, @@ -4047,9 +4364,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4058,9 +4375,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4069,9 +4386,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4080,7 +4397,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::IVec4::neg(_self) + let output: Val = ::bevy::math::IVec4::neg( + _self.into(), + ) .into(); output }, @@ -4088,9 +4407,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::IVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -4099,8 +4418,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::IVec4::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::IVec4::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -4109,20 +4428,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = bevy::math::IVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::IVec4::rem( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::I64Vec2>::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::I64Vec2::neg( - _self, + let output: Val = ::bevy::math::I64Vec2::neg( + _self.into(), ) .into(); output @@ -4131,9 +4450,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4142,9 +4461,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -4153,9 +4472,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4164,9 +4483,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4175,9 +4494,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4186,16 +4505,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::I64Vec2::eq(_self, other).into(); + let output: bool = ::bevy::math::I64Vec2::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4204,8 +4527,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::I64Vec2::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::I64Vec2::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -4214,9 +4537,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec2::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -4225,9 +4548,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec2::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -4236,8 +4559,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::I64Vec2::clone( - _self, + let output: Val = ::bevy::math::I64Vec2::clone( + _self.into(), ) .into(); output @@ -4246,9 +4569,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -4257,9 +4580,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4268,7 +4591,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64| { - let output: Val = bevy::math::I64Vec2::new(x, y) + let output: Val = ::bevy::math::I64Vec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -4276,7 +4602,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = bevy::math::I64Vec2::splat(v) + let output: Val = ::bevy::math::I64Vec2::splat( + v.into(), + ) .into(); output }, @@ -4288,10 +4616,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::I64Vec2::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::I64Vec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -4300,8 +4628,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 2]| { - let output: Val = bevy::math::I64Vec2::from_array( - a, + let output: Val = ::bevy::math::I64Vec2::from_array( + a.into(), ) .into(); output @@ -4310,16 +4638,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 2] = bevy::math::I64Vec2::to_array(_self).into(); + let output: [i64; 2] = ::bevy::math::I64Vec2::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: i64| { - let output: Val = bevy::math::I64Vec2::extend( - _self, - z, + let output: Val = ::bevy::math::I64Vec2::extend( + _self.into(), + z.into(), ) .into(); output @@ -4328,9 +4657,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = bevy::math::I64Vec2::with_x( - _self, - x, + let output: Val = ::bevy::math::I64Vec2::with_x( + _self.into(), + x.into(), ) .into(); output @@ -4339,9 +4668,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = bevy::math::I64Vec2::with_y( - _self, - y, + let output: Val = ::bevy::math::I64Vec2::with_y( + _self.into(), + y.into(), ) .into(); output @@ -4350,16 +4679,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec2::dot(_self, rhs).into(); + let output: i64 = ::bevy::math::I64Vec2::dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -4368,9 +4701,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::min( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::min( + _self.into(), + rhs.into(), ) .into(); output @@ -4379,9 +4712,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::max( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::max( + _self.into(), + rhs.into(), ) .into(); output @@ -4394,10 +4727,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::I64Vec2::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::I64Vec2::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -4406,37 +4739,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = bevy::math::I64Vec2::min_element(_self).into(); + let output: i64 = ::bevy::math::I64Vec2::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = bevy::math::I64Vec2::max_element(_self).into(); + let output: i64 = ::bevy::math::I64Vec2::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = bevy::math::I64Vec2::element_sum(_self).into(); + let output: i64 = ::bevy::math::I64Vec2::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = bevy::math::I64Vec2::element_product(_self).into(); + let output: i64 = ::bevy::math::I64Vec2::element_product( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -4445,9 +4784,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -4456,9 +4795,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -4467,9 +4806,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -4478,9 +4817,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::cmple( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -4489,9 +4828,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -4500,8 +4839,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::I64Vec2::abs( - _self, + let output: Val = ::bevy::math::I64Vec2::abs( + _self.into(), ) .into(); output @@ -4510,8 +4849,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::I64Vec2::signum( - _self, + let output: Val = ::bevy::math::I64Vec2::signum( + _self.into(), ) .into(); output @@ -4520,7 +4859,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::I64Vec2::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::I64Vec2::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -4528,14 +4869,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = bevy::math::I64Vec2::length_squared(_self).into(); + let output: i64 = ::bevy::math::I64Vec2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec2::distance_squared(_self, rhs) + let output: i64 = ::bevy::math::I64Vec2::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -4543,9 +4888,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -4554,9 +4899,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -4565,8 +4910,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = bevy::math::I64Vec2::perp( - _self, + let output: Val = ::bevy::math::I64Vec2::perp( + _self.into(), ) .into(); output @@ -4575,16 +4920,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec2::perp_dot(_self, rhs).into(); + let output: i64 = ::bevy::math::I64Vec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::rotate( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::rotate( + _self.into(), + rhs.into(), ) .into(); output @@ -4593,8 +4942,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = bevy::math::I64Vec2::as_vec2( - _self, + let output: Val = ::bevy::math::I64Vec2::as_vec2( + _self.into(), ) .into(); output @@ -4603,8 +4952,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = bevy::math::I64Vec2::as_dvec2( - _self, + let output: Val = ::bevy::math::I64Vec2::as_dvec2( + _self.into(), ) .into(); output @@ -4613,8 +4962,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = bevy::math::I64Vec2::as_ivec2( - _self, + let output: Val = ::bevy::math::I64Vec2::as_ivec2( + _self.into(), ) .into(); output @@ -4623,8 +4972,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = bevy::math::I64Vec2::as_uvec2( - _self, + let output: Val = ::bevy::math::I64Vec2::as_uvec2( + _self.into(), ) .into(); output @@ -4633,8 +4982,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = bevy::math::I64Vec2::as_u64vec2( - _self, + let output: Val = ::bevy::math::I64Vec2::as_u64vec2( + _self.into(), ) .into(); output @@ -4643,9 +4992,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -4654,9 +5003,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4665,9 +5014,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4676,9 +5025,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -4687,9 +5036,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -4698,9 +5047,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4709,9 +5058,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4720,9 +5069,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -4731,9 +5080,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::wrapping_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::wrapping_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -4742,9 +5091,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::wrapping_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::wrapping_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -4753,9 +5102,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::saturating_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::saturating_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -4764,9 +5113,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::saturating_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::saturating_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -4775,9 +5124,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec2::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -4786,9 +5135,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4797,9 +5146,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4808,9 +5157,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4819,21 +5168,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec2::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::I64Vec3>::new(world) .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec3::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -4842,9 +5191,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec3::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -4853,9 +5202,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -4864,9 +5213,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -4875,8 +5224,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::I64Vec3::neg( - _self, + let output: Val = ::bevy::math::I64Vec3::neg( + _self.into(), ) .into(); output @@ -4885,8 +5234,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::I64Vec3::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::I64Vec3::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -4895,9 +5244,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4906,16 +5255,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::I64Vec3::eq(_self, other).into(); + let output: bool = ::bevy::math::I64Vec3::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4924,9 +5277,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -4935,9 +5288,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4946,9 +5299,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4957,9 +5310,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -4968,9 +5321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec3::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -4979,9 +5332,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -4990,9 +5343,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec3::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -5001,9 +5354,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -5012,10 +5365,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64, z: i64| { - let output: Val = bevy::math::I64Vec3::new( - x, - y, - z, + let output: Val = ::bevy::math::I64Vec3::new( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -5024,7 +5377,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = bevy::math::I64Vec3::splat(v) + let output: Val = ::bevy::math::I64Vec3::splat( + v.into(), + ) .into(); output }, @@ -5036,10 +5391,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::I64Vec3::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::I64Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -5048,8 +5403,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 3]| { - let output: Val = bevy::math::I64Vec3::from_array( - a, + let output: Val = ::bevy::math::I64Vec3::from_array( + a.into(), ) .into(); output @@ -5058,16 +5413,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 3] = bevy::math::I64Vec3::to_array(_self).into(); + let output: [i64; 3] = ::bevy::math::I64Vec3::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: i64| { - let output: Val = bevy::math::I64Vec3::extend( - _self, - w, + let output: Val = ::bevy::math::I64Vec3::extend( + _self.into(), + w.into(), ) .into(); output @@ -5076,8 +5432,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::I64Vec3::truncate( - _self, + let output: Val = ::bevy::math::I64Vec3::truncate( + _self.into(), ) .into(); output @@ -5086,9 +5442,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = bevy::math::I64Vec3::with_x( - _self, - x, + let output: Val = ::bevy::math::I64Vec3::with_x( + _self.into(), + x.into(), ) .into(); output @@ -5097,9 +5453,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = bevy::math::I64Vec3::with_y( - _self, - y, + let output: Val = ::bevy::math::I64Vec3::with_y( + _self.into(), + y.into(), ) .into(); output @@ -5108,9 +5464,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i64| { - let output: Val = bevy::math::I64Vec3::with_z( - _self, - z, + let output: Val = ::bevy::math::I64Vec3::with_z( + _self.into(), + z.into(), ) .into(); output @@ -5119,16 +5475,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec3::dot(_self, rhs).into(); + let output: i64 = ::bevy::math::I64Vec3::dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -5137,9 +5497,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cross( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -5148,9 +5508,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::min( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::min( + _self.into(), + rhs.into(), ) .into(); output @@ -5159,9 +5519,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::max( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::max( + _self.into(), + rhs.into(), ) .into(); output @@ -5174,10 +5534,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::I64Vec3::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::I64Vec3::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -5186,37 +5546,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = bevy::math::I64Vec3::min_element(_self).into(); + let output: i64 = ::bevy::math::I64Vec3::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = bevy::math::I64Vec3::max_element(_self).into(); + let output: i64 = ::bevy::math::I64Vec3::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = bevy::math::I64Vec3::element_sum(_self).into(); + let output: i64 = ::bevy::math::I64Vec3::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = bevy::math::I64Vec3::element_product(_self).into(); + let output: i64 = ::bevy::math::I64Vec3::element_product( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -5225,9 +5591,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -5236,9 +5602,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -5247,9 +5613,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -5258,9 +5624,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cmple( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -5269,9 +5635,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -5280,8 +5646,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::I64Vec3::abs( - _self, + let output: Val = ::bevy::math::I64Vec3::abs( + _self.into(), ) .into(); output @@ -5290,8 +5656,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::I64Vec3::signum( - _self, + let output: Val = ::bevy::math::I64Vec3::signum( + _self.into(), ) .into(); output @@ -5300,7 +5666,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::I64Vec3::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::I64Vec3::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -5308,14 +5676,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = bevy::math::I64Vec3::length_squared(_self).into(); + let output: i64 = ::bevy::math::I64Vec3::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec3::distance_squared(_self, rhs) + let output: i64 = ::bevy::math::I64Vec3::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -5323,9 +5695,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -5334,9 +5706,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -5345,8 +5717,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::as_vec3( - _self, + let output: Val = ::bevy::math::I64Vec3::as_vec3( + _self.into(), ) .into(); output @@ -5355,8 +5727,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::as_vec3a( - _self, + let output: Val = ::bevy::math::I64Vec3::as_vec3a( + _self.into(), ) .into(); output @@ -5365,8 +5737,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::as_dvec3( - _self, + let output: Val = ::bevy::math::I64Vec3::as_dvec3( + _self.into(), ) .into(); output @@ -5375,8 +5747,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::as_ivec3( - _self, + let output: Val = ::bevy::math::I64Vec3::as_ivec3( + _self.into(), ) .into(); output @@ -5385,8 +5757,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::as_uvec3( - _self, + let output: Val = ::bevy::math::I64Vec3::as_uvec3( + _self.into(), ) .into(); output @@ -5395,8 +5767,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::as_u64vec3( - _self, + let output: Val = ::bevy::math::I64Vec3::as_u64vec3( + _self.into(), ) .into(); output @@ -5405,9 +5777,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -5416,9 +5788,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -5427,9 +5799,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -5438,9 +5810,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -5449,9 +5821,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -5460,9 +5832,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -5471,9 +5843,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -5482,9 +5854,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -5493,9 +5865,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::wrapping_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::wrapping_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -5504,9 +5876,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::wrapping_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::wrapping_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -5515,9 +5887,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::saturating_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::saturating_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -5526,9 +5898,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec3::saturating_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::saturating_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -5537,9 +5909,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -5548,20 +5920,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::I64Vec3::clone( - _self, + let output: Val = ::bevy::math::I64Vec3::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::I64Vec4>::new(world) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -5570,8 +5942,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::I64Vec4::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::I64Vec4::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -5580,9 +5952,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec4::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -5591,9 +5963,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -5602,9 +5974,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -5613,8 +5985,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::I64Vec4::clone( - _self, + let output: Val = ::bevy::math::I64Vec4::clone( + _self.into(), ) .into(); output @@ -5623,9 +5995,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec4::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -5634,9 +6006,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -5645,9 +6017,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -5656,9 +6028,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec4::add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -5667,16 +6039,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::I64Vec4::eq(_self, other).into(); + let output: bool = ::bevy::math::I64Vec4::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::I64Vec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -5685,9 +6061,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -5696,9 +6072,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -5707,9 +6083,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -5718,9 +6094,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -5729,11 +6105,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64, z: i64, w: i64| { - let output: Val = bevy::math::I64Vec4::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::I64Vec4::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -5742,7 +6118,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = bevy::math::I64Vec4::splat(v) + let output: Val = ::bevy::math::I64Vec4::splat( + v.into(), + ) .into(); output }, @@ -5754,10 +6132,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::I64Vec4::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::I64Vec4::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -5766,8 +6144,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 4]| { - let output: Val = bevy::math::I64Vec4::from_array( - a, + let output: Val = ::bevy::math::I64Vec4::from_array( + a.into(), ) .into(); output @@ -5776,15 +6154,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 4] = bevy::math::I64Vec4::to_array(_self).into(); + let output: [i64; 4] = ::bevy::math::I64Vec4::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::I64Vec4::truncate( - _self, + let output: Val = ::bevy::math::I64Vec4::truncate( + _self.into(), ) .into(); output @@ -5793,9 +6172,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = bevy::math::I64Vec4::with_x( - _self, - x, + let output: Val = ::bevy::math::I64Vec4::with_x( + _self.into(), + x.into(), ) .into(); output @@ -5804,9 +6183,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = bevy::math::I64Vec4::with_y( - _self, - y, + let output: Val = ::bevy::math::I64Vec4::with_y( + _self.into(), + y.into(), ) .into(); output @@ -5815,9 +6194,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i64| { - let output: Val = bevy::math::I64Vec4::with_z( - _self, - z, + let output: Val = ::bevy::math::I64Vec4::with_z( + _self.into(), + z.into(), ) .into(); output @@ -5826,9 +6205,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: i64| { - let output: Val = bevy::math::I64Vec4::with_w( - _self, - w, + let output: Val = ::bevy::math::I64Vec4::with_w( + _self.into(), + w.into(), ) .into(); output @@ -5837,16 +6216,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec4::dot(_self, rhs).into(); + let output: i64 = ::bevy::math::I64Vec4::dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -5855,9 +6238,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::min( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::min( + _self.into(), + rhs.into(), ) .into(); output @@ -5866,9 +6249,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::max( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::max( + _self.into(), + rhs.into(), ) .into(); output @@ -5881,10 +6264,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::I64Vec4::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::I64Vec4::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -5893,37 +6276,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = bevy::math::I64Vec4::min_element(_self).into(); + let output: i64 = ::bevy::math::I64Vec4::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = bevy::math::I64Vec4::max_element(_self).into(); + let output: i64 = ::bevy::math::I64Vec4::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = bevy::math::I64Vec4::element_sum(_self).into(); + let output: i64 = ::bevy::math::I64Vec4::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = bevy::math::I64Vec4::element_product(_self).into(); + let output: i64 = ::bevy::math::I64Vec4::element_product( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -5932,9 +6321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -5943,9 +6332,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -5954,9 +6343,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -5965,9 +6354,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::cmple( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -5976,9 +6365,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -5987,8 +6376,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::I64Vec4::abs( - _self, + let output: Val = ::bevy::math::I64Vec4::abs( + _self.into(), ) .into(); output @@ -5997,8 +6386,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::I64Vec4::signum( - _self, + let output: Val = ::bevy::math::I64Vec4::signum( + _self.into(), ) .into(); output @@ -6007,7 +6396,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::I64Vec4::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::I64Vec4::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -6015,14 +6406,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = bevy::math::I64Vec4::length_squared(_self).into(); + let output: i64 = ::bevy::math::I64Vec4::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = bevy::math::I64Vec4::distance_squared(_self, rhs) + let output: i64 = ::bevy::math::I64Vec4::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -6030,9 +6425,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -6041,9 +6436,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -6052,8 +6447,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = bevy::math::I64Vec4::as_vec4( - _self, + let output: Val = ::bevy::math::I64Vec4::as_vec4( + _self.into(), ) .into(); output @@ -6062,8 +6457,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = bevy::math::I64Vec4::as_dvec4( - _self, + let output: Val = ::bevy::math::I64Vec4::as_dvec4( + _self.into(), ) .into(); output @@ -6072,8 +6467,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = bevy::math::I64Vec4::as_ivec4( - _self, + let output: Val = ::bevy::math::I64Vec4::as_ivec4( + _self.into(), ) .into(); output @@ -6082,8 +6477,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = bevy::math::I64Vec4::as_uvec4( - _self, + let output: Val = ::bevy::math::I64Vec4::as_uvec4( + _self.into(), ) .into(); output @@ -6092,8 +6487,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = bevy::math::I64Vec4::as_u64vec4( - _self, + let output: Val = ::bevy::math::I64Vec4::as_u64vec4( + _self.into(), ) .into(); output @@ -6102,9 +6497,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -6113,9 +6508,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6124,9 +6519,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6135,9 +6530,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -6146,9 +6541,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -6157,9 +6552,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6168,9 +6563,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6179,9 +6574,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -6190,9 +6585,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::wrapping_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::wrapping_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -6201,9 +6596,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::wrapping_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::wrapping_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -6212,9 +6607,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::saturating_add_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::saturating_add_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -6223,9 +6618,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::saturating_sub_unsigned( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::saturating_sub_unsigned( + _self.into(), + rhs.into(), ) .into(); output @@ -6234,8 +6629,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::I64Vec4::neg( - _self, + let output: Val = ::bevy::math::I64Vec4::neg( + _self.into(), ) .into(); output @@ -6244,9 +6639,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::I64Vec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6255,21 +6650,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = bevy::math::I64Vec4::div( - _self, - rhs, + let output: Val = ::bevy::math::I64Vec4::div( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::UVec2>::new(world) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -6278,9 +6673,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -6289,9 +6684,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -6300,9 +6695,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -6311,9 +6706,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -6322,9 +6717,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -6333,9 +6728,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -6344,9 +6739,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -6355,8 +6750,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::UVec2::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::UVec2::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -6365,14 +6760,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::UVec2::eq(_self, other).into(); + let output: bool = ::bevy::math::UVec2::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "new", |x: u32, y: u32| { - let output: Val = bevy::math::UVec2::new(x, y) + let output: Val = ::bevy::math::UVec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -6380,7 +6782,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = bevy::math::UVec2::splat(v) + let output: Val = ::bevy::math::UVec2::splat( + v.into(), + ) .into(); output }, @@ -6392,10 +6796,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::UVec2::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::UVec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -6404,7 +6808,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 2]| { - let output: Val = bevy::math::UVec2::from_array(a) + let output: Val = ::bevy::math::UVec2::from_array( + a.into(), + ) .into(); output }, @@ -6412,16 +6818,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 2] = bevy::math::UVec2::to_array(_self).into(); + let output: [u32; 2] = ::bevy::math::UVec2::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: u32| { - let output: Val = bevy::math::UVec2::extend( - _self, - z, + let output: Val = ::bevy::math::UVec2::extend( + _self.into(), + z.into(), ) .into(); output @@ -6430,9 +6837,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = bevy::math::UVec2::with_x( - _self, - x, + let output: Val = ::bevy::math::UVec2::with_x( + _self.into(), + x.into(), ) .into(); output @@ -6441,9 +6848,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = bevy::math::UVec2::with_y( - _self, - y, + let output: Val = ::bevy::math::UVec2::with_y( + _self.into(), + y.into(), ) .into(); output @@ -6452,16 +6859,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = bevy::math::UVec2::dot(_self, rhs).into(); + let output: u32 = ::bevy::math::UVec2::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -6470,9 +6878,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::min( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::min( + _self.into(), + rhs.into(), ) .into(); output @@ -6481,9 +6889,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::max( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::max( + _self.into(), + rhs.into(), ) .into(); output @@ -6496,10 +6904,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::UVec2::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::UVec2::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -6508,37 +6916,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = bevy::math::UVec2::min_element(_self).into(); + let output: u32 = ::bevy::math::UVec2::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = bevy::math::UVec2::max_element(_self).into(); + let output: u32 = ::bevy::math::UVec2::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = bevy::math::UVec2::element_sum(_self).into(); + let output: u32 = ::bevy::math::UVec2::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = bevy::math::UVec2::element_product(_self).into(); + let output: u32 = ::bevy::math::UVec2::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -6547,9 +6959,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -6558,9 +6970,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -6569,9 +6981,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -6580,9 +6992,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::cmple( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -6591,9 +7003,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -6602,14 +7014,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = bevy::math::UVec2::length_squared(_self).into(); + let output: u32 = ::bevy::math::UVec2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = bevy::math::UVec2::as_vec2(_self) + let output: Val = ::bevy::math::UVec2::as_vec2( + _self.into(), + ) .into(); output }, @@ -6617,8 +7032,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = bevy::math::UVec2::as_dvec2( - _self, + let output: Val = ::bevy::math::UVec2::as_dvec2( + _self.into(), ) .into(); output @@ -6627,8 +7042,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = bevy::math::UVec2::as_ivec2( - _self, + let output: Val = ::bevy::math::UVec2::as_ivec2( + _self.into(), ) .into(); output @@ -6637,8 +7052,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = bevy::math::UVec2::as_i64vec2( - _self, + let output: Val = ::bevy::math::UVec2::as_i64vec2( + _self.into(), ) .into(); output @@ -6647,8 +7062,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = bevy::math::UVec2::as_u64vec2( - _self, + let output: Val = ::bevy::math::UVec2::as_u64vec2( + _self.into(), ) .into(); output @@ -6657,9 +7072,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -6668,9 +7083,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6679,9 +7094,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6690,9 +7105,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -6701,9 +7116,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -6712,9 +7127,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6723,9 +7138,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6734,9 +7149,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -6745,9 +7160,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::wrapping_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::wrapping_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -6756,9 +7171,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::saturating_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::saturating_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -6767,9 +7182,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -6778,9 +7193,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6789,9 +7204,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6800,7 +7215,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::UVec2::clone(_self) + let output: Val = ::bevy::math::UVec2::clone( + _self.into(), + ) .into(); output }, @@ -6808,9 +7225,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6819,9 +7236,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -6830,9 +7247,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -6841,21 +7258,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::UVec3>::new(world) .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -6864,9 +7281,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -6875,9 +7292,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -6886,7 +7303,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u32, y: u32, z: u32| { - let output: Val = bevy::math::UVec3::new(x, y, z) + let output: Val = ::bevy::math::UVec3::new( + x.into(), + y.into(), + z.into(), + ) .into(); output }, @@ -6894,7 +7315,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = bevy::math::UVec3::splat(v) + let output: Val = ::bevy::math::UVec3::splat( + v.into(), + ) .into(); output }, @@ -6906,10 +7329,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::UVec3::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::UVec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -6918,7 +7341,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 3]| { - let output: Val = bevy::math::UVec3::from_array(a) + let output: Val = ::bevy::math::UVec3::from_array( + a.into(), + ) .into(); output }, @@ -6926,16 +7351,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 3] = bevy::math::UVec3::to_array(_self).into(); + let output: [u32; 3] = ::bevy::math::UVec3::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: u32| { - let output: Val = bevy::math::UVec3::extend( - _self, - w, + let output: Val = ::bevy::math::UVec3::extend( + _self.into(), + w.into(), ) .into(); output @@ -6944,8 +7370,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::UVec3::truncate( - _self, + let output: Val = ::bevy::math::UVec3::truncate( + _self.into(), ) .into(); output @@ -6954,9 +7380,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = bevy::math::UVec3::with_x( - _self, - x, + let output: Val = ::bevy::math::UVec3::with_x( + _self.into(), + x.into(), ) .into(); output @@ -6965,9 +7391,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = bevy::math::UVec3::with_y( - _self, - y, + let output: Val = ::bevy::math::UVec3::with_y( + _self.into(), + y.into(), ) .into(); output @@ -6976,9 +7402,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u32| { - let output: Val = bevy::math::UVec3::with_z( - _self, - z, + let output: Val = ::bevy::math::UVec3::with_z( + _self.into(), + z.into(), ) .into(); output @@ -6987,16 +7413,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = bevy::math::UVec3::dot(_self, rhs).into(); + let output: u32 = ::bevy::math::UVec3::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -7005,9 +7432,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cross( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -7016,9 +7443,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::min( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::min( + _self.into(), + rhs.into(), ) .into(); output @@ -7027,9 +7454,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::max( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::max( + _self.into(), + rhs.into(), ) .into(); output @@ -7042,10 +7469,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::UVec3::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::UVec3::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -7054,37 +7481,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = bevy::math::UVec3::min_element(_self).into(); + let output: u32 = ::bevy::math::UVec3::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = bevy::math::UVec3::max_element(_self).into(); + let output: u32 = ::bevy::math::UVec3::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = bevy::math::UVec3::element_sum(_self).into(); + let output: u32 = ::bevy::math::UVec3::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = bevy::math::UVec3::element_product(_self).into(); + let output: u32 = ::bevy::math::UVec3::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -7093,9 +7524,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -7104,9 +7535,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -7115,9 +7546,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -7126,9 +7557,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cmple( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -7137,9 +7568,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -7148,14 +7579,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = bevy::math::UVec3::length_squared(_self).into(); + let output: u32 = ::bevy::math::UVec3::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = bevy::math::UVec3::as_vec3(_self) + let output: Val = ::bevy::math::UVec3::as_vec3( + _self.into(), + ) .into(); output }, @@ -7163,8 +7597,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = bevy::math::UVec3::as_vec3a( - _self, + let output: Val = ::bevy::math::UVec3::as_vec3a( + _self.into(), ) .into(); output @@ -7173,8 +7607,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = bevy::math::UVec3::as_dvec3( - _self, + let output: Val = ::bevy::math::UVec3::as_dvec3( + _self.into(), ) .into(); output @@ -7183,8 +7617,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = bevy::math::UVec3::as_ivec3( - _self, + let output: Val = ::bevy::math::UVec3::as_ivec3( + _self.into(), ) .into(); output @@ -7193,8 +7627,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = bevy::math::UVec3::as_i64vec3( - _self, + let output: Val = ::bevy::math::UVec3::as_i64vec3( + _self.into(), ) .into(); output @@ -7203,8 +7637,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = bevy::math::UVec3::as_u64vec3( - _self, + let output: Val = ::bevy::math::UVec3::as_u64vec3( + _self.into(), ) .into(); output @@ -7213,9 +7647,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -7224,9 +7658,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7235,9 +7669,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7246,9 +7680,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -7257,9 +7691,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -7268,9 +7702,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7279,9 +7713,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7290,9 +7724,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -7301,9 +7735,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::wrapping_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::wrapping_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -7312,9 +7746,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::saturating_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::saturating_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -7323,9 +7757,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -7334,9 +7768,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7345,9 +7779,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7356,9 +7790,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7367,9 +7801,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7378,9 +7812,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7389,9 +7823,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -7400,9 +7834,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -7411,8 +7845,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::UVec3::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::UVec3::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -7421,9 +7855,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -7432,9 +7866,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7443,7 +7877,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::UVec3::clone(_self) + let output: Val = ::bevy::math::UVec3::clone( + _self.into(), + ) .into(); output }, @@ -7451,9 +7887,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -7462,27 +7898,31 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::UVec3::eq(_self, other).into(); + let output: bool = ::bevy::math::UVec3::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec3::div( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::UVec4>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::UVec4::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::UVec4::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -7491,9 +7931,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7502,9 +7942,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -7513,11 +7953,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u32, y: u32, z: u32, w: u32| { - let output: Val = bevy::math::UVec4::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::UVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -7526,7 +7966,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = bevy::math::UVec4::splat(v) + let output: Val = ::bevy::math::UVec4::splat( + v.into(), + ) .into(); output }, @@ -7538,10 +7980,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::UVec4::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::UVec4::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -7550,7 +7992,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 4]| { - let output: Val = bevy::math::UVec4::from_array(a) + let output: Val = ::bevy::math::UVec4::from_array( + a.into(), + ) .into(); output }, @@ -7558,15 +8002,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 4] = bevy::math::UVec4::to_array(_self).into(); + let output: [u32; 4] = ::bevy::math::UVec4::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::UVec4::truncate( - _self, + let output: Val = ::bevy::math::UVec4::truncate( + _self.into(), ) .into(); output @@ -7575,9 +8020,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = bevy::math::UVec4::with_x( - _self, - x, + let output: Val = ::bevy::math::UVec4::with_x( + _self.into(), + x.into(), ) .into(); output @@ -7586,9 +8031,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = bevy::math::UVec4::with_y( - _self, - y, + let output: Val = ::bevy::math::UVec4::with_y( + _self.into(), + y.into(), ) .into(); output @@ -7597,9 +8042,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u32| { - let output: Val = bevy::math::UVec4::with_z( - _self, - z, + let output: Val = ::bevy::math::UVec4::with_z( + _self.into(), + z.into(), ) .into(); output @@ -7608,9 +8053,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: u32| { - let output: Val = bevy::math::UVec4::with_w( - _self, - w, + let output: Val = ::bevy::math::UVec4::with_w( + _self.into(), + w.into(), ) .into(); output @@ -7619,16 +8064,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = bevy::math::UVec4::dot(_self, rhs).into(); + let output: u32 = ::bevy::math::UVec4::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -7637,9 +8083,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::min( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::min( + _self.into(), + rhs.into(), ) .into(); output @@ -7648,9 +8094,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::max( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::max( + _self.into(), + rhs.into(), ) .into(); output @@ -7663,10 +8109,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::UVec4::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::UVec4::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -7675,37 +8121,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = bevy::math::UVec4::min_element(_self).into(); + let output: u32 = ::bevy::math::UVec4::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = bevy::math::UVec4::max_element(_self).into(); + let output: u32 = ::bevy::math::UVec4::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = bevy::math::UVec4::element_sum(_self).into(); + let output: u32 = ::bevy::math::UVec4::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = bevy::math::UVec4::element_product(_self).into(); + let output: u32 = ::bevy::math::UVec4::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -7714,9 +8164,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -7725,9 +8175,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -7736,9 +8186,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -7747,9 +8197,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::cmple( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -7758,9 +8208,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -7769,14 +8219,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = bevy::math::UVec4::length_squared(_self).into(); + let output: u32 = ::bevy::math::UVec4::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = bevy::math::UVec4::as_vec4(_self) + let output: Val = ::bevy::math::UVec4::as_vec4( + _self.into(), + ) .into(); output }, @@ -7784,8 +8237,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = bevy::math::UVec4::as_dvec4( - _self, + let output: Val = ::bevy::math::UVec4::as_dvec4( + _self.into(), ) .into(); output @@ -7794,8 +8247,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = bevy::math::UVec4::as_ivec4( - _self, + let output: Val = ::bevy::math::UVec4::as_ivec4( + _self.into(), ) .into(); output @@ -7804,8 +8257,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = bevy::math::UVec4::as_i64vec4( - _self, + let output: Val = ::bevy::math::UVec4::as_i64vec4( + _self.into(), ) .into(); output @@ -7814,8 +8267,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = bevy::math::UVec4::as_u64vec4( - _self, + let output: Val = ::bevy::math::UVec4::as_u64vec4( + _self.into(), ) .into(); output @@ -7824,9 +8277,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -7835,9 +8288,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7846,9 +8299,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7857,9 +8310,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -7868,9 +8321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -7879,9 +8332,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7890,9 +8343,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7901,9 +8354,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -7912,9 +8365,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::wrapping_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::wrapping_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -7923,9 +8376,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::saturating_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::saturating_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -7934,7 +8387,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::UVec4::clone(_self) + let output: Val = ::bevy::math::UVec4::clone( + _self.into(), + ) .into(); output }, @@ -7942,9 +8397,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -7953,9 +8408,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -7964,9 +8419,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -7975,9 +8430,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -7986,9 +8441,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -7997,9 +8452,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8008,9 +8463,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8019,9 +8474,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::UVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8030,9 +8485,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8041,9 +8496,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::UVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8052,9 +8507,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8063,9 +8518,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8074,27 +8529,31 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::UVec4::eq(_self, other).into(); + let output: bool = ::bevy::math::UVec4::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = bevy::math::UVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::UVec4::add( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::U64Vec2>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::U64Vec2::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::U64Vec2::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -8103,9 +8562,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8114,9 +8573,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec2::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -8125,9 +8584,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8136,9 +8595,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8147,9 +8606,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec2::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8158,9 +8617,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec2::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8169,9 +8628,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8180,9 +8639,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8191,9 +8650,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8202,9 +8661,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8213,14 +8672,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::U64Vec2::eq(_self, other).into(); + let output: bool = ::bevy::math::U64Vec2::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "new", |x: u64, y: u64| { - let output: Val = bevy::math::U64Vec2::new(x, y) + let output: Val = ::bevy::math::U64Vec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -8228,7 +8694,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = bevy::math::U64Vec2::splat(v) + let output: Val = ::bevy::math::U64Vec2::splat( + v.into(), + ) .into(); output }, @@ -8240,10 +8708,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::U64Vec2::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::U64Vec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -8252,8 +8720,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 2]| { - let output: Val = bevy::math::U64Vec2::from_array( - a, + let output: Val = ::bevy::math::U64Vec2::from_array( + a.into(), ) .into(); output @@ -8262,16 +8730,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 2] = bevy::math::U64Vec2::to_array(_self).into(); + let output: [u64; 2] = ::bevy::math::U64Vec2::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: u64| { - let output: Val = bevy::math::U64Vec2::extend( - _self, - z, + let output: Val = ::bevy::math::U64Vec2::extend( + _self.into(), + z.into(), ) .into(); output @@ -8280,9 +8749,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = bevy::math::U64Vec2::with_x( - _self, - x, + let output: Val = ::bevy::math::U64Vec2::with_x( + _self.into(), + x.into(), ) .into(); output @@ -8291,9 +8760,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = bevy::math::U64Vec2::with_y( - _self, - y, + let output: Val = ::bevy::math::U64Vec2::with_y( + _self.into(), + y.into(), ) .into(); output @@ -8302,16 +8771,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = bevy::math::U64Vec2::dot(_self, rhs).into(); + let output: u64 = ::bevy::math::U64Vec2::dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -8320,9 +8793,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::min( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::min( + _self.into(), + rhs.into(), ) .into(); output @@ -8331,9 +8804,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::max( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::max( + _self.into(), + rhs.into(), ) .into(); output @@ -8346,10 +8819,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::U64Vec2::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::U64Vec2::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -8358,37 +8831,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = bevy::math::U64Vec2::min_element(_self).into(); + let output: u64 = ::bevy::math::U64Vec2::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = bevy::math::U64Vec2::max_element(_self).into(); + let output: u64 = ::bevy::math::U64Vec2::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = bevy::math::U64Vec2::element_sum(_self).into(); + let output: u64 = ::bevy::math::U64Vec2::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = bevy::math::U64Vec2::element_product(_self).into(); + let output: u64 = ::bevy::math::U64Vec2::element_product( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -8397,9 +8876,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -8408,9 +8887,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -8419,9 +8898,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -8430,9 +8909,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::cmple( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -8441,9 +8920,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -8452,15 +8931,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = bevy::math::U64Vec2::length_squared(_self).into(); + let output: u64 = ::bevy::math::U64Vec2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = bevy::math::U64Vec2::as_vec2( - _self, + let output: Val = ::bevy::math::U64Vec2::as_vec2( + _self.into(), ) .into(); output @@ -8469,8 +8949,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = bevy::math::U64Vec2::as_dvec2( - _self, + let output: Val = ::bevy::math::U64Vec2::as_dvec2( + _self.into(), ) .into(); output @@ -8479,8 +8959,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = bevy::math::U64Vec2::as_ivec2( - _self, + let output: Val = ::bevy::math::U64Vec2::as_ivec2( + _self.into(), ) .into(); output @@ -8489,8 +8969,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = bevy::math::U64Vec2::as_uvec2( - _self, + let output: Val = ::bevy::math::U64Vec2::as_uvec2( + _self.into(), ) .into(); output @@ -8499,8 +8979,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = bevy::math::U64Vec2::as_i64vec2( - _self, + let output: Val = ::bevy::math::U64Vec2::as_i64vec2( + _self.into(), ) .into(); output @@ -8509,9 +8989,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -8520,9 +9000,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8531,9 +9011,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8542,9 +9022,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -8553,9 +9033,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -8564,9 +9044,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8575,9 +9055,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8586,9 +9066,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -8597,9 +9077,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::wrapping_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::wrapping_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -8608,9 +9088,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::saturating_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::saturating_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -8619,9 +9099,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8630,8 +9110,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::U64Vec2::clone( - _self, + let output: Val = ::bevy::math::U64Vec2::clone( + _self.into(), ) .into(); output @@ -8640,9 +9120,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8651,9 +9131,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -8662,9 +9142,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8673,21 +9153,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec2::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec2::add( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::U64Vec3>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8696,9 +9176,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8707,9 +9187,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec3::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8718,9 +9198,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8729,9 +9209,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8740,9 +9220,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec3::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -8751,9 +9231,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8762,9 +9242,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -8773,9 +9253,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -8784,9 +9264,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -8795,9 +9275,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec3::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -8806,9 +9286,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8817,9 +9297,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -8828,10 +9308,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64, z: u64| { - let output: Val = bevy::math::U64Vec3::new( - x, - y, - z, + let output: Val = ::bevy::math::U64Vec3::new( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -8840,7 +9320,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = bevy::math::U64Vec3::splat(v) + let output: Val = ::bevy::math::U64Vec3::splat( + v.into(), + ) .into(); output }, @@ -8852,10 +9334,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::U64Vec3::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::U64Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -8864,8 +9346,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 3]| { - let output: Val = bevy::math::U64Vec3::from_array( - a, + let output: Val = ::bevy::math::U64Vec3::from_array( + a.into(), ) .into(); output @@ -8874,16 +9356,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 3] = bevy::math::U64Vec3::to_array(_self).into(); + let output: [u64; 3] = ::bevy::math::U64Vec3::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: u64| { - let output: Val = bevy::math::U64Vec3::extend( - _self, - w, + let output: Val = ::bevy::math::U64Vec3::extend( + _self.into(), + w.into(), ) .into(); output @@ -8892,8 +9375,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::U64Vec3::truncate( - _self, + let output: Val = ::bevy::math::U64Vec3::truncate( + _self.into(), ) .into(); output @@ -8902,9 +9385,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = bevy::math::U64Vec3::with_x( - _self, - x, + let output: Val = ::bevy::math::U64Vec3::with_x( + _self.into(), + x.into(), ) .into(); output @@ -8913,9 +9396,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = bevy::math::U64Vec3::with_y( - _self, - y, + let output: Val = ::bevy::math::U64Vec3::with_y( + _self.into(), + y.into(), ) .into(); output @@ -8924,9 +9407,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u64| { - let output: Val = bevy::math::U64Vec3::with_z( - _self, - z, + let output: Val = ::bevy::math::U64Vec3::with_z( + _self.into(), + z.into(), ) .into(); output @@ -8935,16 +9418,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = bevy::math::U64Vec3::dot(_self, rhs).into(); + let output: u64 = ::bevy::math::U64Vec3::dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -8953,9 +9440,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cross( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -8964,9 +9451,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::min( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::min( + _self.into(), + rhs.into(), ) .into(); output @@ -8975,9 +9462,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::max( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::max( + _self.into(), + rhs.into(), ) .into(); output @@ -8990,10 +9477,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::U64Vec3::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::U64Vec3::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -9002,37 +9489,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = bevy::math::U64Vec3::min_element(_self).into(); + let output: u64 = ::bevy::math::U64Vec3::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = bevy::math::U64Vec3::max_element(_self).into(); + let output: u64 = ::bevy::math::U64Vec3::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = bevy::math::U64Vec3::element_sum(_self).into(); + let output: u64 = ::bevy::math::U64Vec3::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = bevy::math::U64Vec3::element_product(_self).into(); + let output: u64 = ::bevy::math::U64Vec3::element_product( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -9041,9 +9534,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -9052,9 +9545,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -9063,9 +9556,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -9074,9 +9567,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cmple( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -9085,9 +9578,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -9096,15 +9589,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = bevy::math::U64Vec3::length_squared(_self).into(); + let output: u64 = ::bevy::math::U64Vec3::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::as_vec3( - _self, + let output: Val = ::bevy::math::U64Vec3::as_vec3( + _self.into(), ) .into(); output @@ -9113,8 +9607,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::as_vec3a( - _self, + let output: Val = ::bevy::math::U64Vec3::as_vec3a( + _self.into(), ) .into(); output @@ -9123,8 +9617,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::as_dvec3( - _self, + let output: Val = ::bevy::math::U64Vec3::as_dvec3( + _self.into(), ) .into(); output @@ -9133,8 +9627,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::as_ivec3( - _self, + let output: Val = ::bevy::math::U64Vec3::as_ivec3( + _self.into(), ) .into(); output @@ -9143,8 +9637,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::as_uvec3( - _self, + let output: Val = ::bevy::math::U64Vec3::as_uvec3( + _self.into(), ) .into(); output @@ -9153,8 +9647,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::as_i64vec3( - _self, + let output: Val = ::bevy::math::U64Vec3::as_i64vec3( + _self.into(), ) .into(); output @@ -9163,9 +9657,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -9174,9 +9668,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9185,9 +9679,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9196,9 +9690,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -9207,9 +9701,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -9218,9 +9712,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9229,9 +9723,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9240,9 +9734,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -9251,9 +9745,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::wrapping_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::wrapping_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -9262,9 +9756,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec3::saturating_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::saturating_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -9273,9 +9767,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -9284,9 +9778,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec3::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -9295,15 +9789,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::U64Vec3::eq(_self, other).into(); + let output: bool = ::bevy::math::U64Vec3::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::U64Vec3::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::U64Vec3::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -9312,20 +9810,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::U64Vec3::clone( - _self, + let output: Val = ::bevy::math::U64Vec3::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::U64Vec4>::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -9334,9 +9832,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9345,9 +9843,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9356,9 +9854,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -9367,8 +9865,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::U64Vec4::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::U64Vec4::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -9377,15 +9875,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::U64Vec4::eq(_self, other).into(); + let output: bool = ::bevy::math::U64Vec4::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::U64Vec4::clone( - _self, + let output: Val = ::bevy::math::U64Vec4::clone( + _self.into(), ) .into(); output @@ -9394,9 +9896,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -9405,9 +9907,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec4::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -9416,9 +9918,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -9427,9 +9929,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9438,9 +9940,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -9449,9 +9951,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9460,9 +9962,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec4::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -9471,9 +9973,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9482,9 +9984,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::U64Vec4::div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -9493,11 +9995,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64, z: u64, w: u64| { - let output: Val = bevy::math::U64Vec4::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::U64Vec4::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -9506,7 +10008,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = bevy::math::U64Vec4::splat(v) + let output: Val = ::bevy::math::U64Vec4::splat( + v.into(), + ) .into(); output }, @@ -9518,10 +10022,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::U64Vec4::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::U64Vec4::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -9530,8 +10034,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 4]| { - let output: Val = bevy::math::U64Vec4::from_array( - a, + let output: Val = ::bevy::math::U64Vec4::from_array( + a.into(), ) .into(); output @@ -9540,15 +10044,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 4] = bevy::math::U64Vec4::to_array(_self).into(); + let output: [u64; 4] = ::bevy::math::U64Vec4::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::U64Vec4::truncate( - _self, + let output: Val = ::bevy::math::U64Vec4::truncate( + _self.into(), ) .into(); output @@ -9557,9 +10062,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = bevy::math::U64Vec4::with_x( - _self, - x, + let output: Val = ::bevy::math::U64Vec4::with_x( + _self.into(), + x.into(), ) .into(); output @@ -9568,9 +10073,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = bevy::math::U64Vec4::with_y( - _self, - y, + let output: Val = ::bevy::math::U64Vec4::with_y( + _self.into(), + y.into(), ) .into(); output @@ -9579,9 +10084,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u64| { - let output: Val = bevy::math::U64Vec4::with_z( - _self, - z, + let output: Val = ::bevy::math::U64Vec4::with_z( + _self.into(), + z.into(), ) .into(); output @@ -9590,9 +10095,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: u64| { - let output: Val = bevy::math::U64Vec4::with_w( - _self, - w, + let output: Val = ::bevy::math::U64Vec4::with_w( + _self.into(), + w.into(), ) .into(); output @@ -9601,16 +10106,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = bevy::math::U64Vec4::dot(_self, rhs).into(); + let output: u64 = ::bevy::math::U64Vec4::dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -9619,9 +10128,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::min( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::min( + _self.into(), + rhs.into(), ) .into(); output @@ -9630,9 +10139,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::max( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::max( + _self.into(), + rhs.into(), ) .into(); output @@ -9645,10 +10154,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::U64Vec4::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::U64Vec4::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -9657,37 +10166,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = bevy::math::U64Vec4::min_element(_self).into(); + let output: u64 = ::bevy::math::U64Vec4::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = bevy::math::U64Vec4::max_element(_self).into(); + let output: u64 = ::bevy::math::U64Vec4::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = bevy::math::U64Vec4::element_sum(_self).into(); + let output: u64 = ::bevy::math::U64Vec4::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = bevy::math::U64Vec4::element_product(_self).into(); + let output: u64 = ::bevy::math::U64Vec4::element_product( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -9696,9 +10211,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -9707,9 +10222,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -9718,9 +10233,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -9729,9 +10244,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::cmple( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -9740,9 +10255,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -9751,15 +10266,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = bevy::math::U64Vec4::length_squared(_self).into(); + let output: u64 = ::bevy::math::U64Vec4::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = bevy::math::U64Vec4::as_vec4( - _self, + let output: Val = ::bevy::math::U64Vec4::as_vec4( + _self.into(), ) .into(); output @@ -9768,8 +10284,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = bevy::math::U64Vec4::as_dvec4( - _self, + let output: Val = ::bevy::math::U64Vec4::as_dvec4( + _self.into(), ) .into(); output @@ -9778,8 +10294,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = bevy::math::U64Vec4::as_ivec4( - _self, + let output: Val = ::bevy::math::U64Vec4::as_ivec4( + _self.into(), ) .into(); output @@ -9788,8 +10304,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = bevy::math::U64Vec4::as_uvec4( - _self, + let output: Val = ::bevy::math::U64Vec4::as_uvec4( + _self.into(), ) .into(); output @@ -9798,8 +10314,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = bevy::math::U64Vec4::as_i64vec4( - _self, + let output: Val = ::bevy::math::U64Vec4::as_i64vec4( + _self.into(), ) .into(); output @@ -9808,9 +10324,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::wrapping_add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::wrapping_add( + _self.into(), + rhs.into(), ) .into(); output @@ -9819,9 +10335,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::wrapping_sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::wrapping_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9830,9 +10346,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::wrapping_mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::wrapping_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9841,9 +10357,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::wrapping_div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::wrapping_div( + _self.into(), + rhs.into(), ) .into(); output @@ -9852,9 +10368,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::saturating_add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::saturating_add( + _self.into(), + rhs.into(), ) .into(); output @@ -9863,9 +10379,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::saturating_sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::saturating_sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9874,9 +10390,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::saturating_mul( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::saturating_mul( + _self.into(), + rhs.into(), ) .into(); output @@ -9885,9 +10401,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::saturating_div( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::saturating_div( + _self.into(), + rhs.into(), ) .into(); output @@ -9896,9 +10412,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::wrapping_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::wrapping_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -9907,9 +10423,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = bevy::math::U64Vec4::saturating_add_signed( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::saturating_add_signed( + _self.into(), + rhs.into(), ) .into(); output @@ -9918,9 +10434,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -9929,19 +10445,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = bevy::math::U64Vec4::add( - _self, - rhs, + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Vec2>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::mul(_self, rhs) + let output: Val = ::bevy::math::Vec2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9949,7 +10468,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::add(_self, rhs) + let output: Val = ::bevy::math::Vec2::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9957,7 +10479,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec2::mul(_self, rhs) + let output: Val = ::bevy::math::Vec2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9965,7 +10490,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec2::div(_self, rhs) + let output: Val = ::bevy::math::Vec2::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9973,7 +10501,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec2::add(_self, rhs) + let output: Val = ::bevy::math::Vec2::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9981,7 +10512,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::sub(_self, rhs) + let output: Val = ::bevy::math::Vec2::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9989,7 +10523,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::rem(_self, rhs) + let output: Val = ::bevy::math::Vec2::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -9997,7 +10534,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32| { - let output: Val = bevy::math::Vec2::new(x, y) + let output: Val = ::bevy::math::Vec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -10005,7 +10545,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = bevy::math::Vec2::splat(v) + let output: Val = ::bevy::math::Vec2::splat( + v.into(), + ) .into(); output }, @@ -10017,10 +10559,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::Vec2::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::Vec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -10029,7 +10571,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 2]| { - let output: Val = bevy::math::Vec2::from_array(a) + let output: Val = ::bevy::math::Vec2::from_array( + a.into(), + ) .into(); output }, @@ -10037,16 +10581,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 2] = bevy::math::Vec2::to_array(_self).into(); + let output: [f32; 2] = ::bevy::math::Vec2::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: f32| { - let output: Val = bevy::math::Vec2::extend( - _self, - z, + let output: Val = ::bevy::math::Vec2::extend( + _self.into(), + z.into(), ) .into(); output @@ -10055,9 +10600,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = bevy::math::Vec2::with_x( - _self, - x, + let output: Val = ::bevy::math::Vec2::with_x( + _self.into(), + x.into(), ) .into(); output @@ -10066,9 +10611,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = bevy::math::Vec2::with_y( - _self, - y, + let output: Val = ::bevy::math::Vec2::with_y( + _self.into(), + y.into(), ) .into(); output @@ -10077,16 +10622,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec2::dot(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec2::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -10095,7 +10641,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::min(_self, rhs) + let output: Val = ::bevy::math::Vec2::min( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10103,7 +10652,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::max(_self, rhs) + let output: Val = ::bevy::math::Vec2::max( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10115,10 +10667,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::Vec2::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::Vec2::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -10127,37 +10679,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = bevy::math::Vec2::min_element(_self).into(); + let output: f32 = ::bevy::math::Vec2::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = bevy::math::Vec2::max_element(_self).into(); + let output: f32 = ::bevy::math::Vec2::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = bevy::math::Vec2::element_sum(_self).into(); + let output: f32 = ::bevy::math::Vec2::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = bevy::math::Vec2::element_product(_self).into(); + let output: f32 = ::bevy::math::Vec2::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -10166,9 +10722,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -10177,9 +10733,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -10188,9 +10744,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -10199,9 +10755,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::cmple( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -10210,9 +10766,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -10221,7 +10777,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::Vec2::abs(_self) + let output: Val = ::bevy::math::Vec2::abs( + _self.into(), + ) .into(); output }, @@ -10229,7 +10787,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::Vec2::signum(_self) + let output: Val = ::bevy::math::Vec2::signum( + _self.into(), + ) .into(); output }, @@ -10237,9 +10797,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::copysign( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -10248,7 +10808,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::Vec2::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::Vec2::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -10256,15 +10818,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::Vec2::is_finite(_self).into(); + let output: bool = ::bevy::math::Vec2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::Vec2::is_finite_mask( - _self, + let output: Val = ::bevy::math::Vec2::is_finite_mask( + _self.into(), ) .into(); output @@ -10273,15 +10836,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::Vec2::is_nan(_self).into(); + let output: bool = ::bevy::math::Vec2::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::Vec2::is_nan_mask( - _self, + let output: Val = ::bevy::math::Vec2::is_nan_mask( + _self.into(), ) .into(); output @@ -10290,35 +10853,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::Vec2::length(_self).into(); + let output: f32 = ::bevy::math::Vec2::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = bevy::math::Vec2::length_squared(_self).into(); + let output: f32 = ::bevy::math::Vec2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = bevy::math::Vec2::length_recip(_self).into(); + let output: f32 = ::bevy::math::Vec2::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec2::distance(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec2::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec2::distance_squared(_self, rhs) + let output: f32 = ::bevy::math::Vec2::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10326,9 +10898,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -10337,9 +10909,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -10348,8 +10920,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::Vec2::normalize( - _self, + let output: Val = ::bevy::math::Vec2::normalize( + _self.into(), ) .into(); output @@ -10358,9 +10930,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::Vec2::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::Vec2::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -10369,8 +10941,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::Vec2::normalize_or_zero( - _self, + let output: Val = ::bevy::math::Vec2::normalize_or_zero( + _self.into(), ) .into(); output @@ -10379,16 +10951,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::Vec2::is_normalized(_self).into(); + let output: bool = ::bevy::math::Vec2::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -10397,9 +10970,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -10408,9 +10981,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -10419,9 +10992,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -10430,7 +11003,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::Vec2::round(_self) + let output: Val = ::bevy::math::Vec2::round( + _self.into(), + ) .into(); output }, @@ -10438,7 +11013,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::Vec2::floor(_self) + let output: Val = ::bevy::math::Vec2::floor( + _self.into(), + ) .into(); output }, @@ -10446,7 +11023,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::Vec2::ceil(_self) + let output: Val = ::bevy::math::Vec2::ceil( + _self.into(), + ) .into(); output }, @@ -10454,7 +11033,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::Vec2::trunc(_self) + let output: Val = ::bevy::math::Vec2::trunc( + _self.into(), + ) .into(); output }, @@ -10462,7 +11043,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::Vec2::fract(_self) + let output: Val = ::bevy::math::Vec2::fract( + _self.into(), + ) .into(); output }, @@ -10470,7 +11053,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::Vec2::fract_gl(_self) + let output: Val = ::bevy::math::Vec2::fract_gl( + _self.into(), + ) .into(); output }, @@ -10478,7 +11063,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::Vec2::exp(_self) + let output: Val = ::bevy::math::Vec2::exp( + _self.into(), + ) .into(); output }, @@ -10486,7 +11073,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = bevy::math::Vec2::powf(_self, n) + let output: Val = ::bevy::math::Vec2::powf( + _self.into(), + n.into(), + ) .into(); output }, @@ -10494,7 +11084,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::Vec2::recip(_self) + let output: Val = ::bevy::math::Vec2::recip( + _self.into(), + ) .into(); output }, @@ -10502,10 +11094,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = bevy::math::Vec2::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::Vec2::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -10514,10 +11106,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = bevy::math::Vec2::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::Vec2::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -10526,9 +11118,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -10541,10 +11133,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Vec2::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Vec2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -10553,10 +11145,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = bevy::math::Vec2::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::Vec2::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -10565,9 +11157,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = bevy::math::Vec2::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::Vec2::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -10576,9 +11168,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = bevy::math::Vec2::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::Vec2::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -10591,10 +11183,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::Vec2::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::Vec2::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -10603,9 +11195,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::Vec2::reflect( - _self, - normal, + let output: Val = ::bevy::math::Vec2::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -10614,10 +11206,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = bevy::math::Vec2::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::Vec2::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -10626,8 +11218,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = bevy::math::Vec2::from_angle( - angle, + let output: Val = ::bevy::math::Vec2::from_angle( + angle.into(), ) .into(); output @@ -10636,28 +11228,38 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_angle", |_self: Val| { - let output: f32 = bevy::math::Vec2::to_angle(_self).into(); + let output: f32 = ::bevy::math::Vec2::to_angle(_self.into()).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec2::angle_between(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec2::angle_between( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "angle_to", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec2::angle_to(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec2::angle_to( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "perp", |_self: Val| { - let output: Val = bevy::math::Vec2::perp(_self) + let output: Val = ::bevy::math::Vec2::perp( + _self.into(), + ) .into(); output }, @@ -10665,16 +11267,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec2::perp_dot(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::rotate( - _self, - rhs, + let output: Val = ::bevy::math::Vec2::rotate( + _self.into(), + rhs.into(), ) .into(); output @@ -10687,10 +11293,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f32| { - let output: Val = bevy::math::Vec2::rotate_towards( - _self, - rhs, - max_angle, + let output: Val = ::bevy::math::Vec2::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), ) .into(); output @@ -10699,8 +11305,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = bevy::math::Vec2::as_dvec2( - _self, + let output: Val = ::bevy::math::Vec2::as_dvec2( + _self.into(), ) .into(); output @@ -10709,8 +11315,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = bevy::math::Vec2::as_ivec2( - _self, + let output: Val = ::bevy::math::Vec2::as_ivec2( + _self.into(), ) .into(); output @@ -10719,8 +11325,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = bevy::math::Vec2::as_uvec2( - _self, + let output: Val = ::bevy::math::Vec2::as_uvec2( + _self.into(), ) .into(); output @@ -10729,8 +11335,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = bevy::math::Vec2::as_i64vec2( - _self, + let output: Val = ::bevy::math::Vec2::as_i64vec2( + _self.into(), ) .into(); output @@ -10739,8 +11345,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = bevy::math::Vec2::as_u64vec2( - _self, + let output: Val = ::bevy::math::Vec2::as_u64vec2( + _self.into(), ) .into(); output @@ -10749,14 +11355,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::Vec2::eq(_self, other).into(); + let output: bool = ::bevy::math::Vec2::eq(_self.into(), other.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Vec2::clone(_self) + let output: Val = ::bevy::math::Vec2::clone( + _self.into(), + ) .into(); output }, @@ -10764,7 +11373,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec2::sub(_self, rhs) + let output: Val = ::bevy::math::Vec2::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10772,7 +11384,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec2::rem(_self, rhs) + let output: Val = ::bevy::math::Vec2::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10780,7 +11395,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec2::rem(_self, rhs) + let output: Val = ::bevy::math::Vec2::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10788,7 +11406,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec2::div(_self, rhs) + let output: Val = ::bevy::math::Vec2::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10796,7 +11417,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec2::sub(_self, rhs) + let output: Val = ::bevy::math::Vec2::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10804,7 +11428,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec2::mul(_self, rhs) + let output: Val = ::bevy::math::Vec2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10812,7 +11439,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Vec2::neg(_self) + let output: Val = ::bevy::math::Vec2::neg( + _self.into(), + ) .into(); output }, @@ -10820,7 +11449,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec2::add(_self, rhs) + let output: Val = ::bevy::math::Vec2::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -10828,18 +11460,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec2::div(_self, rhs) + let output: Val = ::bevy::math::Vec2::div( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Vec3A>::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3A::rem( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -10848,9 +11483,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -10859,9 +11494,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3A::div( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), ) .into(); output @@ -10870,9 +11505,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3A::div( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), ) .into(); output @@ -10881,9 +11516,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3A::sub( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -10892,7 +11527,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32, z: f32| { - let output: Val = bevy::math::Vec3A::new(x, y, z) + let output: Val = ::bevy::math::Vec3A::new( + x.into(), + y.into(), + z.into(), + ) .into(); output }, @@ -10900,7 +11539,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = bevy::math::Vec3A::splat(v) + let output: Val = ::bevy::math::Vec3A::splat( + v.into(), + ) .into(); output }, @@ -10912,10 +11553,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::Vec3A::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::Vec3A::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -10924,7 +11565,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 3]| { - let output: Val = bevy::math::Vec3A::from_array(a) + let output: Val = ::bevy::math::Vec3A::from_array( + a.into(), + ) .into(); output }, @@ -10932,14 +11575,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = bevy::math::Vec3A::to_array(_self).into(); + let output: [f32; 3] = ::bevy::math::Vec3A::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = bevy::math::Vec3A::from_vec4(v) + let output: Val = ::bevy::math::Vec3A::from_vec4( + v.into(), + ) .into(); output }, @@ -10947,9 +11593,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "extend", |_self: Val, w: f32| { - let output: Val = bevy::math::Vec3A::extend( - _self, - w, + let output: Val = ::bevy::math::Vec3A::extend( + _self.into(), + w.into(), ) .into(); output @@ -10958,8 +11604,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::Vec3A::truncate( - _self, + let output: Val = ::bevy::math::Vec3A::truncate( + _self.into(), ) .into(); output @@ -10968,9 +11614,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = bevy::math::Vec3A::with_x( - _self, - x, + let output: Val = ::bevy::math::Vec3A::with_x( + _self.into(), + x.into(), ) .into(); output @@ -10979,9 +11625,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = bevy::math::Vec3A::with_y( - _self, - y, + let output: Val = ::bevy::math::Vec3A::with_y( + _self.into(), + y.into(), ) .into(); output @@ -10990,9 +11636,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = bevy::math::Vec3A::with_z( - _self, - z, + let output: Val = ::bevy::math::Vec3A::with_z( + _self.into(), + z.into(), ) .into(); output @@ -11001,16 +11647,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3A::dot(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec3A::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -11019,9 +11666,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cross( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -11030,9 +11677,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::min( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::min( + _self.into(), + rhs.into(), ) .into(); output @@ -11041,9 +11688,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::max( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::max( + _self.into(), + rhs.into(), ) .into(); output @@ -11056,10 +11703,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::Vec3A::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::Vec3A::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -11068,37 +11715,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = bevy::math::Vec3A::min_element(_self).into(); + let output: f32 = ::bevy::math::Vec3A::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = bevy::math::Vec3A::max_element(_self).into(); + let output: f32 = ::bevy::math::Vec3A::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = bevy::math::Vec3A::element_sum(_self).into(); + let output: f32 = ::bevy::math::Vec3A::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = bevy::math::Vec3A::element_product(_self).into(); + let output: f32 = ::bevy::math::Vec3A::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -11107,9 +11758,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -11118,9 +11769,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -11129,9 +11780,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -11140,9 +11791,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cmple( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -11151,9 +11802,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -11162,7 +11813,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::Vec3A::abs(_self) + let output: Val = ::bevy::math::Vec3A::abs( + _self.into(), + ) .into(); output }, @@ -11170,7 +11823,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::Vec3A::signum(_self) + let output: Val = ::bevy::math::Vec3A::signum( + _self.into(), + ) .into(); output }, @@ -11178,9 +11833,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::copysign( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -11189,7 +11844,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::Vec3A::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::Vec3A::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -11197,15 +11854,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::Vec3A::is_finite(_self).into(); + let output: bool = ::bevy::math::Vec3A::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::Vec3A::is_finite_mask( - _self, + let output: Val = ::bevy::math::Vec3A::is_finite_mask( + _self.into(), ) .into(); output @@ -11214,15 +11872,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::Vec3A::is_nan(_self).into(); + let output: bool = ::bevy::math::Vec3A::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::Vec3A::is_nan_mask( - _self, + let output: Val = ::bevy::math::Vec3A::is_nan_mask( + _self.into(), ) .into(); output @@ -11231,35 +11889,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::Vec3A::length(_self).into(); + let output: f32 = ::bevy::math::Vec3A::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = bevy::math::Vec3A::length_squared(_self).into(); + let output: f32 = ::bevy::math::Vec3A::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = bevy::math::Vec3A::length_recip(_self).into(); + let output: f32 = ::bevy::math::Vec3A::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3A::distance(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec3A::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3A::distance_squared(_self, rhs) + let output: f32 = ::bevy::math::Vec3A::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -11267,9 +11934,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -11278,9 +11945,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -11289,8 +11956,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::Vec3A::normalize( - _self, + let output: Val = ::bevy::math::Vec3A::normalize( + _self.into(), ) .into(); output @@ -11299,9 +11966,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::Vec3A::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::Vec3A::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -11310,8 +11977,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::Vec3A::normalize_or_zero( - _self, + let output: Val = ::bevy::math::Vec3A::normalize_or_zero( + _self.into(), ) .into(); output @@ -11320,16 +11987,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::Vec3A::is_normalized(_self).into(); + let output: bool = ::bevy::math::Vec3A::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -11338,9 +12006,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -11349,9 +12017,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -11360,9 +12028,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -11371,7 +12039,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::Vec3A::round(_self) + let output: Val = ::bevy::math::Vec3A::round( + _self.into(), + ) .into(); output }, @@ -11379,7 +12049,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::Vec3A::floor(_self) + let output: Val = ::bevy::math::Vec3A::floor( + _self.into(), + ) .into(); output }, @@ -11387,7 +12059,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::Vec3A::ceil(_self) + let output: Val = ::bevy::math::Vec3A::ceil( + _self.into(), + ) .into(); output }, @@ -11395,7 +12069,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::Vec3A::trunc(_self) + let output: Val = ::bevy::math::Vec3A::trunc( + _self.into(), + ) .into(); output }, @@ -11403,7 +12079,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::Vec3A::fract(_self) + let output: Val = ::bevy::math::Vec3A::fract( + _self.into(), + ) .into(); output }, @@ -11411,8 +12089,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::Vec3A::fract_gl( - _self, + let output: Val = ::bevy::math::Vec3A::fract_gl( + _self.into(), ) .into(); output @@ -11421,7 +12099,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::Vec3A::exp(_self) + let output: Val = ::bevy::math::Vec3A::exp( + _self.into(), + ) .into(); output }, @@ -11429,9 +12109,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = bevy::math::Vec3A::powf( - _self, - n, + let output: Val = ::bevy::math::Vec3A::powf( + _self.into(), + n.into(), ) .into(); output @@ -11440,7 +12120,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::Vec3A::recip(_self) + let output: Val = ::bevy::math::Vec3A::recip( + _self.into(), + ) .into(); output }, @@ -11448,10 +12130,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = bevy::math::Vec3A::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::Vec3A::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -11460,10 +12142,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = bevy::math::Vec3A::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::Vec3A::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -11472,9 +12154,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -11487,10 +12169,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Vec3A::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Vec3A::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -11499,10 +12181,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = bevy::math::Vec3A::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::Vec3A::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -11511,9 +12193,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = bevy::math::Vec3A::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::Vec3A::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -11522,9 +12204,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = bevy::math::Vec3A::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::Vec3A::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -11537,10 +12219,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::Vec3A::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::Vec3A::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -11549,9 +12231,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::Vec3A::reflect( - _self, - normal, + let output: Val = ::bevy::math::Vec3A::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -11564,10 +12246,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f32| { - let output: Val = bevy::math::Vec3A::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::Vec3A::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -11576,7 +12258,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec3A::angle_between(_self, rhs) + let output: f32 = ::bevy::math::Vec3A::angle_between( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -11584,8 +12269,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = bevy::math::Vec3A::any_orthogonal_vector( - _self, + let output: Val = ::bevy::math::Vec3A::any_orthogonal_vector( + _self.into(), ) .into(); output @@ -11594,8 +12279,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = bevy::math::Vec3A::any_orthonormal_vector( - _self, + let output: Val = ::bevy::math::Vec3A::any_orthonormal_vector( + _self.into(), ) .into(); output @@ -11604,8 +12289,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = bevy::math::Vec3A::as_dvec3( - _self, + let output: Val = ::bevy::math::Vec3A::as_dvec3( + _self.into(), ) .into(); output @@ -11614,8 +12299,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = bevy::math::Vec3A::as_ivec3( - _self, + let output: Val = ::bevy::math::Vec3A::as_ivec3( + _self.into(), ) .into(); output @@ -11624,8 +12309,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = bevy::math::Vec3A::as_uvec3( - _self, + let output: Val = ::bevy::math::Vec3A::as_uvec3( + _self.into(), ) .into(); output @@ -11634,8 +12319,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = bevy::math::Vec3A::as_i64vec3( - _self, + let output: Val = ::bevy::math::Vec3A::as_i64vec3( + _self.into(), ) .into(); output @@ -11644,8 +12329,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = bevy::math::Vec3A::as_u64vec3( - _self, + let output: Val = ::bevy::math::Vec3A::as_u64vec3( + _self.into(), ) .into(); output @@ -11654,7 +12339,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Vec3A::neg(_self) + let output: Val = ::bevy::math::Vec3A::neg( + _self.into(), + ) .into(); output }, @@ -11662,9 +12349,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3A::sub( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -11673,7 +12360,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Vec3A::clone(_self) + let output: Val = ::bevy::math::Vec3A::clone( + _self.into(), + ) .into(); output }, @@ -11681,9 +12370,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3A::add( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::add( + _self.into(), + rhs.into(), ) .into(); output @@ -11692,9 +12381,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3A::add( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::add( + _self.into(), + rhs.into(), ) .into(); output @@ -11703,9 +12392,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::sub( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -11714,9 +12403,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::div( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), ) .into(); output @@ -11725,9 +12414,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::add( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::add( + _self.into(), + rhs.into(), ) .into(); output @@ -11736,16 +12425,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Vec3A::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Vec3A::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec3A::rem( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -11754,9 +12444,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3A::rem( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -11765,9 +12455,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -11776,19 +12466,24 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Vec3A::mul( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Vec4>::new(world) .overwrite_script_function( "new", |x: f32, y: f32, z: f32, w: f32| { - let output: Val = bevy::math::Vec4::new(x, y, z, w) + let output: Val = ::bevy::math::Vec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) .into(); output }, @@ -11796,7 +12491,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = bevy::math::Vec4::splat(v) + let output: Val = ::bevy::math::Vec4::splat( + v.into(), + ) .into(); output }, @@ -11808,10 +12505,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::Vec4::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::Vec4::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -11820,7 +12517,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = bevy::math::Vec4::from_array(a) + let output: Val = ::bevy::math::Vec4::from_array( + a.into(), + ) .into(); output }, @@ -11828,14 +12527,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = bevy::math::Vec4::to_array(_self).into(); + let output: [f32; 4] = ::bevy::math::Vec4::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::Vec4::truncate(_self) + let output: Val = ::bevy::math::Vec4::truncate( + _self.into(), + ) .into(); output }, @@ -11843,9 +12545,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = bevy::math::Vec4::with_x( - _self, - x, + let output: Val = ::bevy::math::Vec4::with_x( + _self.into(), + x.into(), ) .into(); output @@ -11854,9 +12556,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = bevy::math::Vec4::with_y( - _self, - y, + let output: Val = ::bevy::math::Vec4::with_y( + _self.into(), + y.into(), ) .into(); output @@ -11865,9 +12567,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = bevy::math::Vec4::with_z( - _self, - z, + let output: Val = ::bevy::math::Vec4::with_z( + _self.into(), + z.into(), ) .into(); output @@ -11876,9 +12578,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: f32| { - let output: Val = bevy::math::Vec4::with_w( - _self, - w, + let output: Val = ::bevy::math::Vec4::with_w( + _self.into(), + w.into(), ) .into(); output @@ -11887,16 +12589,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec4::dot(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec4::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -11905,7 +12608,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::min(_self, rhs) + let output: Val = ::bevy::math::Vec4::min( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -11913,7 +12619,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::max(_self, rhs) + let output: Val = ::bevy::math::Vec4::max( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -11925,10 +12634,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::Vec4::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::Vec4::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -11937,37 +12646,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = bevy::math::Vec4::min_element(_self).into(); + let output: f32 = ::bevy::math::Vec4::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = bevy::math::Vec4::max_element(_self).into(); + let output: f32 = ::bevy::math::Vec4::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = bevy::math::Vec4::element_sum(_self).into(); + let output: f32 = ::bevy::math::Vec4::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = bevy::math::Vec4::element_product(_self).into(); + let output: f32 = ::bevy::math::Vec4::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -11976,9 +12689,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -11987,9 +12700,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -11998,9 +12711,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -12009,9 +12722,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::cmple( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -12020,9 +12733,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -12031,7 +12744,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::Vec4::abs(_self) + let output: Val = ::bevy::math::Vec4::abs( + _self.into(), + ) .into(); output }, @@ -12039,7 +12754,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::Vec4::signum(_self) + let output: Val = ::bevy::math::Vec4::signum( + _self.into(), + ) .into(); output }, @@ -12047,9 +12764,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::copysign( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -12058,7 +12775,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::Vec4::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::Vec4::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -12066,15 +12785,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::Vec4::is_finite(_self).into(); + let output: bool = ::bevy::math::Vec4::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::Vec4::is_finite_mask( - _self, + let output: Val = ::bevy::math::Vec4::is_finite_mask( + _self.into(), ) .into(); output @@ -12083,15 +12803,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::Vec4::is_nan(_self).into(); + let output: bool = ::bevy::math::Vec4::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::Vec4::is_nan_mask( - _self, + let output: Val = ::bevy::math::Vec4::is_nan_mask( + _self.into(), ) .into(); output @@ -12100,35 +12820,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = bevy::math::Vec4::length(_self).into(); + let output: f32 = ::bevy::math::Vec4::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = bevy::math::Vec4::length_squared(_self).into(); + let output: f32 = ::bevy::math::Vec4::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = bevy::math::Vec4::length_recip(_self).into(); + let output: f32 = ::bevy::math::Vec4::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec4::distance(_self, rhs).into(); + let output: f32 = ::bevy::math::Vec4::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = bevy::math::Vec4::distance_squared(_self, rhs) + let output: f32 = ::bevy::math::Vec4::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12136,9 +12865,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -12147,9 +12876,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -12158,8 +12887,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::Vec4::normalize( - _self, + let output: Val = ::bevy::math::Vec4::normalize( + _self.into(), ) .into(); output @@ -12168,9 +12897,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::Vec4::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::Vec4::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -12179,8 +12908,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::Vec4::normalize_or_zero( - _self, + let output: Val = ::bevy::math::Vec4::normalize_or_zero( + _self.into(), ) .into(); output @@ -12189,16 +12918,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::Vec4::is_normalized(_self).into(); + let output: bool = ::bevy::math::Vec4::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -12207,9 +12937,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -12218,9 +12948,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -12229,9 +12959,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -12240,7 +12970,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::Vec4::round(_self) + let output: Val = ::bevy::math::Vec4::round( + _self.into(), + ) .into(); output }, @@ -12248,7 +12980,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::Vec4::floor(_self) + let output: Val = ::bevy::math::Vec4::floor( + _self.into(), + ) .into(); output }, @@ -12256,7 +12990,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::Vec4::ceil(_self) + let output: Val = ::bevy::math::Vec4::ceil( + _self.into(), + ) .into(); output }, @@ -12264,7 +13000,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::Vec4::trunc(_self) + let output: Val = ::bevy::math::Vec4::trunc( + _self.into(), + ) .into(); output }, @@ -12272,7 +13010,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::Vec4::fract(_self) + let output: Val = ::bevy::math::Vec4::fract( + _self.into(), + ) .into(); output }, @@ -12280,7 +13020,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::Vec4::fract_gl(_self) + let output: Val = ::bevy::math::Vec4::fract_gl( + _self.into(), + ) .into(); output }, @@ -12288,7 +13030,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::Vec4::exp(_self) + let output: Val = ::bevy::math::Vec4::exp( + _self.into(), + ) .into(); output }, @@ -12296,7 +13040,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = bevy::math::Vec4::powf(_self, n) + let output: Val = ::bevy::math::Vec4::powf( + _self.into(), + n.into(), + ) .into(); output }, @@ -12304,7 +13051,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::Vec4::recip(_self) + let output: Val = ::bevy::math::Vec4::recip( + _self.into(), + ) .into(); output }, @@ -12312,10 +13061,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = bevy::math::Vec4::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::Vec4::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -12324,10 +13073,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = bevy::math::Vec4::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::Vec4::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -12336,9 +13085,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::Vec4::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -12351,10 +13100,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Vec4::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Vec4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -12363,10 +13112,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = bevy::math::Vec4::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::Vec4::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -12375,9 +13124,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = bevy::math::Vec4::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::Vec4::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -12386,9 +13135,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = bevy::math::Vec4::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::Vec4::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -12401,10 +13150,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::Vec4::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::Vec4::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -12413,9 +13162,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::Vec4::reflect( - _self, - normal, + let output: Val = ::bevy::math::Vec4::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -12424,10 +13173,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = bevy::math::Vec4::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::Vec4::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -12436,8 +13185,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = bevy::math::Vec4::as_dvec4( - _self, + let output: Val = ::bevy::math::Vec4::as_dvec4( + _self.into(), ) .into(); output @@ -12446,8 +13195,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = bevy::math::Vec4::as_ivec4( - _self, + let output: Val = ::bevy::math::Vec4::as_ivec4( + _self.into(), ) .into(); output @@ -12456,8 +13205,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = bevy::math::Vec4::as_uvec4( - _self, + let output: Val = ::bevy::math::Vec4::as_uvec4( + _self.into(), ) .into(); output @@ -12466,8 +13215,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = bevy::math::Vec4::as_i64vec4( - _self, + let output: Val = ::bevy::math::Vec4::as_i64vec4( + _self.into(), ) .into(); output @@ -12476,8 +13225,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = bevy::math::Vec4::as_u64vec4( - _self, + let output: Val = ::bevy::math::Vec4::as_u64vec4( + _self.into(), ) .into(); output @@ -12486,7 +13235,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::div(_self, rhs) + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12494,7 +13246,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::rem(_self, rhs) + let output: Val = ::bevy::math::Vec4::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12502,7 +13257,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec4::rem(_self, rhs) + let output: Val = ::bevy::math::Vec4::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12510,7 +13268,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec4::add(_self, rhs) + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12518,7 +13279,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::mul(_self, rhs) + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12526,7 +13290,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec4::add(_self, rhs) + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12534,7 +13301,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::sub(_self, rhs) + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12542,7 +13312,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec4::rem(_self, rhs) + let output: Val = ::bevy::math::Vec4::rem( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12550,7 +13323,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Vec4::neg(_self) + let output: Val = ::bevy::math::Vec4::neg( + _self.into(), + ) .into(); output }, @@ -12558,7 +13333,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec4::sub(_self, rhs) + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12566,7 +13344,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec4::div(_self, rhs) + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12574,7 +13355,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Vec4::add(_self, rhs) + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12582,14 +13366,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Vec4::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Vec4::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec4::sub(_self, rhs) + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12597,7 +13385,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec4::div(_self, rhs) + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12605,7 +13396,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Vec4::clone(_self) + let output: Val = ::bevy::math::Vec4::clone( + _self.into(), + ) .into(); output }, @@ -12613,7 +13406,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Vec4::mul(_self, rhs) + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -12621,17 +13417,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::Vec4::mul(_self, rhs) + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::BVec2>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::BVec2::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::BVec2::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -12640,7 +13439,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool| { - let output: Val = bevy::math::BVec2::new(x, y) + let output: Val = ::bevy::math::BVec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -12648,7 +13450,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = bevy::math::BVec2::splat(v) + let output: Val = ::bevy::math::BVec2::splat( + v.into(), + ) .into(); output }, @@ -12656,7 +13460,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 2]| { - let output: Val = bevy::math::BVec2::from_array(a) + let output: Val = ::bevy::math::BVec2::from_array( + a.into(), + ) .into(); output }, @@ -12664,42 +13470,53 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = bevy::math::BVec2::bitmask(_self).into(); + let output: u32 = ::bevy::math::BVec2::bitmask(_self.into()).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = bevy::math::BVec2::any(_self).into(); + let output: bool = ::bevy::math::BVec2::any(_self.into()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = bevy::math::BVec2::all(_self).into(); + let output: bool = ::bevy::math::BVec2::all(_self.into()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = bevy::math::BVec2::test(_self, index).into(); + let output: bool = ::bevy::math::BVec2::test( + _self.into(), + index.into(), + ) + .into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = bevy::math::BVec2::set(_self, index, value).into(); + let output: () = ::bevy::math::BVec2::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::BVec2::clone(_self) + let output: Val = ::bevy::math::BVec2::clone( + _self.into(), + ) .into(); output }, @@ -12707,16 +13524,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::BVec2::eq(_self, other).into(); + let output: bool = ::bevy::math::BVec2::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::BVec3>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::BVec3::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::BVec3::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -12725,7 +13546,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { - let output: Val = bevy::math::BVec3::new(x, y, z) + let output: Val = ::bevy::math::BVec3::new( + x.into(), + y.into(), + z.into(), + ) .into(); output }, @@ -12733,7 +13558,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = bevy::math::BVec3::splat(v) + let output: Val = ::bevy::math::BVec3::splat( + v.into(), + ) .into(); output }, @@ -12741,7 +13568,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 3]| { - let output: Val = bevy::math::BVec3::from_array(a) + let output: Val = ::bevy::math::BVec3::from_array( + a.into(), + ) .into(); output }, @@ -12749,42 +13578,53 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = bevy::math::BVec3::bitmask(_self).into(); + let output: u32 = ::bevy::math::BVec3::bitmask(_self.into()).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = bevy::math::BVec3::any(_self).into(); + let output: bool = ::bevy::math::BVec3::any(_self.into()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = bevy::math::BVec3::all(_self).into(); + let output: bool = ::bevy::math::BVec3::all(_self.into()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = bevy::math::BVec3::test(_self, index).into(); + let output: bool = ::bevy::math::BVec3::test( + _self.into(), + index.into(), + ) + .into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = bevy::math::BVec3::set(_self, index, value).into(); + let output: () = ::bevy::math::BVec3::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::BVec3::clone(_self) + let output: Val = ::bevy::math::BVec3::clone( + _self.into(), + ) .into(); output }, @@ -12792,15 +13632,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::BVec3::eq(_self, other).into(); + let output: bool = ::bevy::math::BVec3::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::BVec4>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::BVec4::clone(_self) + let output: Val = ::bevy::math::BVec4::clone( + _self.into(), + ) .into(); output }, @@ -12808,15 +13654,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::BVec4::eq(_self, other).into(); + let output: bool = ::bevy::math::BVec4::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::BVec4::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::BVec4::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -12825,11 +13675,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { - let output: Val = bevy::math::BVec4::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::BVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -12838,7 +13688,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = bevy::math::BVec4::splat(v) + let output: Val = ::bevy::math::BVec4::splat( + v.into(), + ) .into(); output }, @@ -12846,7 +13698,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 4]| { - let output: Val = bevy::math::BVec4::from_array(a) + let output: Val = ::bevy::math::BVec4::from_array( + a.into(), + ) .into(); output }, @@ -12854,45 +13708,54 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = bevy::math::BVec4::bitmask(_self).into(); + let output: u32 = ::bevy::math::BVec4::bitmask(_self.into()).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = bevy::math::BVec4::any(_self).into(); + let output: bool = ::bevy::math::BVec4::any(_self.into()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = bevy::math::BVec4::all(_self).into(); + let output: bool = ::bevy::math::BVec4::all(_self.into()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = bevy::math::BVec4::test(_self, index).into(); + let output: bool = ::bevy::math::BVec4::test( + _self.into(), + index.into(), + ) + .into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = bevy::math::BVec4::set(_self, index, value).into(); + let output: () = ::bevy::math::BVec4::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DVec2>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -12901,9 +13764,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -12912,9 +13775,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -12923,7 +13786,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64| { - let output: Val = bevy::math::DVec2::new(x, y) + let output: Val = ::bevy::math::DVec2::new( + x.into(), + y.into(), + ) .into(); output }, @@ -12931,7 +13797,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = bevy::math::DVec2::splat(v) + let output: Val = ::bevy::math::DVec2::splat( + v.into(), + ) .into(); output }, @@ -12943,10 +13811,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::DVec2::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::DVec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -12955,7 +13823,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 2]| { - let output: Val = bevy::math::DVec2::from_array(a) + let output: Val = ::bevy::math::DVec2::from_array( + a.into(), + ) .into(); output }, @@ -12963,16 +13833,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 2] = bevy::math::DVec2::to_array(_self).into(); + let output: [f64; 2] = ::bevy::math::DVec2::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: f64| { - let output: Val = bevy::math::DVec2::extend( - _self, - z, + let output: Val = ::bevy::math::DVec2::extend( + _self.into(), + z.into(), ) .into(); output @@ -12981,9 +13852,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = bevy::math::DVec2::with_x( - _self, - x, + let output: Val = ::bevy::math::DVec2::with_x( + _self.into(), + x.into(), ) .into(); output @@ -12992,9 +13863,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = bevy::math::DVec2::with_y( - _self, - y, + let output: Val = ::bevy::math::DVec2::with_y( + _self.into(), + y.into(), ) .into(); output @@ -13003,16 +13874,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec2::dot(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec2::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -13021,9 +13893,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::min( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::min( + _self.into(), + rhs.into(), ) .into(); output @@ -13032,9 +13904,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::max( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::max( + _self.into(), + rhs.into(), ) .into(); output @@ -13047,10 +13919,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::DVec2::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::DVec2::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -13059,37 +13931,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = bevy::math::DVec2::min_element(_self).into(); + let output: f64 = ::bevy::math::DVec2::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = bevy::math::DVec2::max_element(_self).into(); + let output: f64 = ::bevy::math::DVec2::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = bevy::math::DVec2::element_sum(_self).into(); + let output: f64 = ::bevy::math::DVec2::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = bevy::math::DVec2::element_product(_self).into(); + let output: f64 = ::bevy::math::DVec2::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -13098,9 +13974,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -13109,9 +13985,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -13120,9 +13996,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -13131,9 +14007,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::cmple( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -13142,9 +14018,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -13153,7 +14029,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::DVec2::abs(_self) + let output: Val = ::bevy::math::DVec2::abs( + _self.into(), + ) .into(); output }, @@ -13161,7 +14039,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::DVec2::signum(_self) + let output: Val = ::bevy::math::DVec2::signum( + _self.into(), + ) .into(); output }, @@ -13169,9 +14049,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::copysign( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -13180,7 +14060,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::DVec2::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::DVec2::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -13188,15 +14070,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::DVec2::is_finite(_self).into(); + let output: bool = ::bevy::math::DVec2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::DVec2::is_finite_mask( - _self, + let output: Val = ::bevy::math::DVec2::is_finite_mask( + _self.into(), ) .into(); output @@ -13205,15 +14088,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::DVec2::is_nan(_self).into(); + let output: bool = ::bevy::math::DVec2::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::DVec2::is_nan_mask( - _self, + let output: Val = ::bevy::math::DVec2::is_nan_mask( + _self.into(), ) .into(); output @@ -13222,35 +14105,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = bevy::math::DVec2::length(_self).into(); + let output: f64 = ::bevy::math::DVec2::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = bevy::math::DVec2::length_squared(_self).into(); + let output: f64 = ::bevy::math::DVec2::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = bevy::math::DVec2::length_recip(_self).into(); + let output: f64 = ::bevy::math::DVec2::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec2::distance(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec2::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec2::distance_squared(_self, rhs) + let output: f64 = ::bevy::math::DVec2::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -13258,9 +14150,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -13269,9 +14161,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -13280,8 +14172,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::DVec2::normalize( - _self, + let output: Val = ::bevy::math::DVec2::normalize( + _self.into(), ) .into(); output @@ -13290,9 +14182,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::DVec2::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::DVec2::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -13301,8 +14193,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::DVec2::normalize_or_zero( - _self, + let output: Val = ::bevy::math::DVec2::normalize_or_zero( + _self.into(), ) .into(); output @@ -13311,16 +14203,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::DVec2::is_normalized(_self).into(); + let output: bool = ::bevy::math::DVec2::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -13329,9 +14222,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -13340,9 +14233,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -13351,9 +14244,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -13362,7 +14255,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::DVec2::round(_self) + let output: Val = ::bevy::math::DVec2::round( + _self.into(), + ) .into(); output }, @@ -13370,7 +14265,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::DVec2::floor(_self) + let output: Val = ::bevy::math::DVec2::floor( + _self.into(), + ) .into(); output }, @@ -13378,7 +14275,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::DVec2::ceil(_self) + let output: Val = ::bevy::math::DVec2::ceil( + _self.into(), + ) .into(); output }, @@ -13386,7 +14285,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::DVec2::trunc(_self) + let output: Val = ::bevy::math::DVec2::trunc( + _self.into(), + ) .into(); output }, @@ -13394,7 +14295,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::DVec2::fract(_self) + let output: Val = ::bevy::math::DVec2::fract( + _self.into(), + ) .into(); output }, @@ -13402,8 +14305,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::DVec2::fract_gl( - _self, + let output: Val = ::bevy::math::DVec2::fract_gl( + _self.into(), ) .into(); output @@ -13412,7 +14315,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::DVec2::exp(_self) + let output: Val = ::bevy::math::DVec2::exp( + _self.into(), + ) .into(); output }, @@ -13420,9 +14325,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = bevy::math::DVec2::powf( - _self, - n, + let output: Val = ::bevy::math::DVec2::powf( + _self.into(), + n.into(), ) .into(); output @@ -13431,7 +14336,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::DVec2::recip(_self) + let output: Val = ::bevy::math::DVec2::recip( + _self.into(), + ) .into(); output }, @@ -13439,10 +14346,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = bevy::math::DVec2::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::DVec2::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -13451,10 +14358,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = bevy::math::DVec2::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::DVec2::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -13463,9 +14370,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -13478,10 +14385,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DVec2::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DVec2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -13490,10 +14397,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = bevy::math::DVec2::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::DVec2::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -13502,9 +14409,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = bevy::math::DVec2::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::DVec2::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -13513,9 +14420,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = bevy::math::DVec2::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::DVec2::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -13528,10 +14435,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::DVec2::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::DVec2::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -13540,9 +14447,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::DVec2::reflect( - _self, - normal, + let output: Val = ::bevy::math::DVec2::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -13555,10 +14462,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = bevy::math::DVec2::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::DVec2::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -13567,8 +14474,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = bevy::math::DVec2::from_angle( - angle, + let output: Val = ::bevy::math::DVec2::from_angle( + angle.into(), ) .into(); output @@ -13577,14 +14484,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_angle", |_self: Val| { - let output: f64 = bevy::math::DVec2::to_angle(_self).into(); + let output: f64 = ::bevy::math::DVec2::to_angle(_self.into()).into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec2::angle_between(_self, rhs) + let output: f64 = ::bevy::math::DVec2::angle_between( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -13592,14 +14502,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_to", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec2::angle_to(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec2::angle_to( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "perp", |_self: Val| { - let output: Val = bevy::math::DVec2::perp(_self) + let output: Val = ::bevy::math::DVec2::perp( + _self.into(), + ) .into(); output }, @@ -13607,16 +14523,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec2::perp_dot(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::rotate( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::rotate( + _self.into(), + rhs.into(), ) .into(); output @@ -13629,10 +14549,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f64| { - let output: Val = bevy::math::DVec2::rotate_towards( - _self, - rhs, - max_angle, + let output: Val = ::bevy::math::DVec2::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), ) .into(); output @@ -13641,7 +14561,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = bevy::math::DVec2::as_vec2(_self) + let output: Val = ::bevy::math::DVec2::as_vec2( + _self.into(), + ) .into(); output }, @@ -13649,8 +14571,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = bevy::math::DVec2::as_ivec2( - _self, + let output: Val = ::bevy::math::DVec2::as_ivec2( + _self.into(), ) .into(); output @@ -13659,8 +14581,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = bevy::math::DVec2::as_uvec2( - _self, + let output: Val = ::bevy::math::DVec2::as_uvec2( + _self.into(), ) .into(); output @@ -13669,8 +14591,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = bevy::math::DVec2::as_i64vec2( - _self, + let output: Val = ::bevy::math::DVec2::as_i64vec2( + _self.into(), ) .into(); output @@ -13679,8 +14601,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = bevy::math::DVec2::as_u64vec2( - _self, + let output: Val = ::bevy::math::DVec2::as_u64vec2( + _self.into(), ) .into(); output @@ -13689,9 +14611,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -13700,9 +14622,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::div( + _self.into(), + rhs.into(), ) .into(); output @@ -13711,9 +14633,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -13722,9 +14644,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -13733,9 +14655,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -13744,7 +14666,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DVec2::neg(_self) + let output: Val = ::bevy::math::DVec2::neg( + _self.into(), + ) .into(); output }, @@ -13752,9 +14676,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -13763,16 +14687,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::DVec2::eq(_self, other).into(); + let output: bool = ::bevy::math::DVec2::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec2::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -13781,9 +14709,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -13792,9 +14720,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec2::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -13803,9 +14731,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -13814,9 +14742,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec2::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -13825,7 +14753,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DVec2::clone(_self) + let output: Val = ::bevy::math::DVec2::clone( + _self.into(), + ) .into(); output }, @@ -13833,21 +14763,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec2::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec2::div( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DVec3>::new(world) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -13856,9 +14786,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -13867,9 +14797,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -13878,9 +14808,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -13889,7 +14819,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DVec3::neg(_self) + let output: Val = ::bevy::math::DVec3::neg( + _self.into(), + ) .into(); output }, @@ -13897,16 +14829,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::DVec3::eq(_self, other).into(); + let output: bool = ::bevy::math::DVec3::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -13915,9 +14851,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -13926,9 +14862,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -13937,9 +14873,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec3::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -13948,9 +14884,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -13959,9 +14895,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec3::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), ) .into(); output @@ -13970,9 +14906,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -13981,9 +14917,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -13992,7 +14928,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64, z: f64| { - let output: Val = bevy::math::DVec3::new(x, y, z) + let output: Val = ::bevy::math::DVec3::new( + x.into(), + y.into(), + z.into(), + ) .into(); output }, @@ -14000,7 +14940,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = bevy::math::DVec3::splat(v) + let output: Val = ::bevy::math::DVec3::splat( + v.into(), + ) .into(); output }, @@ -14012,10 +14954,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::DVec3::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::DVec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -14024,7 +14966,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 3]| { - let output: Val = bevy::math::DVec3::from_array(a) + let output: Val = ::bevy::math::DVec3::from_array( + a.into(), + ) .into(); output }, @@ -14032,16 +14976,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 3] = bevy::math::DVec3::to_array(_self).into(); + let output: [f64; 3] = ::bevy::math::DVec3::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f64| { - let output: Val = bevy::math::DVec3::extend( - _self, - w, + let output: Val = ::bevy::math::DVec3::extend( + _self.into(), + w.into(), ) .into(); output @@ -14050,8 +14995,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::DVec3::truncate( - _self, + let output: Val = ::bevy::math::DVec3::truncate( + _self.into(), ) .into(); output @@ -14060,9 +15005,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = bevy::math::DVec3::with_x( - _self, - x, + let output: Val = ::bevy::math::DVec3::with_x( + _self.into(), + x.into(), ) .into(); output @@ -14071,9 +15016,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = bevy::math::DVec3::with_y( - _self, - y, + let output: Val = ::bevy::math::DVec3::with_y( + _self.into(), + y.into(), ) .into(); output @@ -14082,9 +15027,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f64| { - let output: Val = bevy::math::DVec3::with_z( - _self, - z, + let output: Val = ::bevy::math::DVec3::with_z( + _self.into(), + z.into(), ) .into(); output @@ -14093,16 +15038,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec3::dot(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec3::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -14111,9 +15057,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cross( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cross( + _self.into(), + rhs.into(), ) .into(); output @@ -14122,9 +15068,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::min( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::min( + _self.into(), + rhs.into(), ) .into(); output @@ -14133,9 +15079,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::max( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::max( + _self.into(), + rhs.into(), ) .into(); output @@ -14148,10 +15094,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::DVec3::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::DVec3::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -14160,37 +15106,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = bevy::math::DVec3::min_element(_self).into(); + let output: f64 = ::bevy::math::DVec3::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = bevy::math::DVec3::max_element(_self).into(); + let output: f64 = ::bevy::math::DVec3::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = bevy::math::DVec3::element_sum(_self).into(); + let output: f64 = ::bevy::math::DVec3::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = bevy::math::DVec3::element_product(_self).into(); + let output: f64 = ::bevy::math::DVec3::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -14199,9 +15149,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -14210,9 +15160,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -14221,9 +15171,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -14232,9 +15182,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cmple( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -14243,9 +15193,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -14254,7 +15204,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::DVec3::abs(_self) + let output: Val = ::bevy::math::DVec3::abs( + _self.into(), + ) .into(); output }, @@ -14262,7 +15214,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::DVec3::signum(_self) + let output: Val = ::bevy::math::DVec3::signum( + _self.into(), + ) .into(); output }, @@ -14270,9 +15224,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::copysign( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -14281,7 +15235,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::DVec3::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::DVec3::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -14289,15 +15245,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::DVec3::is_finite(_self).into(); + let output: bool = ::bevy::math::DVec3::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::DVec3::is_finite_mask( - _self, + let output: Val = ::bevy::math::DVec3::is_finite_mask( + _self.into(), ) .into(); output @@ -14306,15 +15263,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::DVec3::is_nan(_self).into(); + let output: bool = ::bevy::math::DVec3::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::DVec3::is_nan_mask( - _self, + let output: Val = ::bevy::math::DVec3::is_nan_mask( + _self.into(), ) .into(); output @@ -14323,35 +15280,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = bevy::math::DVec3::length(_self).into(); + let output: f64 = ::bevy::math::DVec3::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = bevy::math::DVec3::length_squared(_self).into(); + let output: f64 = ::bevy::math::DVec3::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = bevy::math::DVec3::length_recip(_self).into(); + let output: f64 = ::bevy::math::DVec3::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec3::distance(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec3::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec3::distance_squared(_self, rhs) + let output: f64 = ::bevy::math::DVec3::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -14359,9 +15325,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -14370,9 +15336,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -14381,8 +15347,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::DVec3::normalize( - _self, + let output: Val = ::bevy::math::DVec3::normalize( + _self.into(), ) .into(); output @@ -14391,9 +15357,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::DVec3::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::DVec3::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -14402,8 +15368,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::DVec3::normalize_or_zero( - _self, + let output: Val = ::bevy::math::DVec3::normalize_or_zero( + _self.into(), ) .into(); output @@ -14412,16 +15378,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::DVec3::is_normalized(_self).into(); + let output: bool = ::bevy::math::DVec3::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -14430,9 +15397,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -14441,9 +15408,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -14452,9 +15419,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -14463,7 +15430,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::DVec3::round(_self) + let output: Val = ::bevy::math::DVec3::round( + _self.into(), + ) .into(); output }, @@ -14471,7 +15440,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::DVec3::floor(_self) + let output: Val = ::bevy::math::DVec3::floor( + _self.into(), + ) .into(); output }, @@ -14479,7 +15450,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::DVec3::ceil(_self) + let output: Val = ::bevy::math::DVec3::ceil( + _self.into(), + ) .into(); output }, @@ -14487,7 +15460,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::DVec3::trunc(_self) + let output: Val = ::bevy::math::DVec3::trunc( + _self.into(), + ) .into(); output }, @@ -14495,7 +15470,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::DVec3::fract(_self) + let output: Val = ::bevy::math::DVec3::fract( + _self.into(), + ) .into(); output }, @@ -14503,8 +15480,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::DVec3::fract_gl( - _self, + let output: Val = ::bevy::math::DVec3::fract_gl( + _self.into(), ) .into(); output @@ -14513,7 +15490,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::DVec3::exp(_self) + let output: Val = ::bevy::math::DVec3::exp( + _self.into(), + ) .into(); output }, @@ -14521,9 +15500,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = bevy::math::DVec3::powf( - _self, - n, + let output: Val = ::bevy::math::DVec3::powf( + _self.into(), + n.into(), ) .into(); output @@ -14532,7 +15511,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::DVec3::recip(_self) + let output: Val = ::bevy::math::DVec3::recip( + _self.into(), + ) .into(); output }, @@ -14540,10 +15521,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = bevy::math::DVec3::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::DVec3::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -14552,10 +15533,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = bevy::math::DVec3::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::DVec3::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -14564,9 +15545,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -14579,10 +15560,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DVec3::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DVec3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -14591,10 +15572,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = bevy::math::DVec3::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::DVec3::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -14603,9 +15584,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = bevy::math::DVec3::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::DVec3::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -14614,9 +15595,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = bevy::math::DVec3::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::DVec3::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -14629,10 +15610,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::DVec3::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::DVec3::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -14641,9 +15622,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::DVec3::reflect( - _self, - normal, + let output: Val = ::bevy::math::DVec3::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -14656,10 +15637,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = bevy::math::DVec3::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::DVec3::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -14668,7 +15649,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec3::angle_between(_self, rhs) + let output: f64 = ::bevy::math::DVec3::angle_between( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -14676,8 +15660,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = bevy::math::DVec3::any_orthogonal_vector( - _self, + let output: Val = ::bevy::math::DVec3::any_orthogonal_vector( + _self.into(), ) .into(); output @@ -14686,8 +15670,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = bevy::math::DVec3::any_orthonormal_vector( - _self, + let output: Val = ::bevy::math::DVec3::any_orthonormal_vector( + _self.into(), ) .into(); output @@ -14696,7 +15680,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = bevy::math::DVec3::as_vec3(_self) + let output: Val = ::bevy::math::DVec3::as_vec3( + _self.into(), + ) .into(); output }, @@ -14704,8 +15690,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = bevy::math::DVec3::as_vec3a( - _self, + let output: Val = ::bevy::math::DVec3::as_vec3a( + _self.into(), ) .into(); output @@ -14714,8 +15700,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = bevy::math::DVec3::as_ivec3( - _self, + let output: Val = ::bevy::math::DVec3::as_ivec3( + _self.into(), ) .into(); output @@ -14724,8 +15710,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = bevy::math::DVec3::as_uvec3( - _self, + let output: Val = ::bevy::math::DVec3::as_uvec3( + _self.into(), ) .into(); output @@ -14734,8 +15720,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = bevy::math::DVec3::as_i64vec3( - _self, + let output: Val = ::bevy::math::DVec3::as_i64vec3( + _self.into(), ) .into(); output @@ -14744,8 +15730,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = bevy::math::DVec3::as_u64vec3( - _self, + let output: Val = ::bevy::math::DVec3::as_u64vec3( + _self.into(), ) .into(); output @@ -14754,9 +15740,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -14765,7 +15751,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DVec3::clone(_self) + let output: Val = ::bevy::math::DVec3::clone( + _self.into(), + ) .into(); output }, @@ -14773,9 +15761,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -14784,21 +15772,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec3::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DVec4>::new(world) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -14807,7 +15795,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DVec4::clone(_self) + let output: Val = ::bevy::math::DVec4::clone( + _self.into(), + ) .into(); output }, @@ -14815,7 +15805,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DVec4::neg(_self) + let output: Val = ::bevy::math::DVec4::neg( + _self.into(), + ) .into(); output }, @@ -14823,11 +15815,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64, z: f64, w: f64| { - let output: Val = bevy::math::DVec4::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::DVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -14836,7 +15828,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = bevy::math::DVec4::splat(v) + let output: Val = ::bevy::math::DVec4::splat( + v.into(), + ) .into(); output }, @@ -14848,10 +15842,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = bevy::math::DVec4::select( - mask, - if_true, - if_false, + let output: Val = ::bevy::math::DVec4::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output @@ -14860,7 +15854,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 4]| { - let output: Val = bevy::math::DVec4::from_array(a) + let output: Val = ::bevy::math::DVec4::from_array( + a.into(), + ) .into(); output }, @@ -14868,15 +15864,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = bevy::math::DVec4::to_array(_self).into(); + let output: [f64; 4] = ::bevy::math::DVec4::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = bevy::math::DVec4::truncate( - _self, + let output: Val = ::bevy::math::DVec4::truncate( + _self.into(), ) .into(); output @@ -14885,9 +15882,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = bevy::math::DVec4::with_x( - _self, - x, + let output: Val = ::bevy::math::DVec4::with_x( + _self.into(), + x.into(), ) .into(); output @@ -14896,9 +15893,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = bevy::math::DVec4::with_y( - _self, - y, + let output: Val = ::bevy::math::DVec4::with_y( + _self.into(), + y.into(), ) .into(); output @@ -14907,9 +15904,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f64| { - let output: Val = bevy::math::DVec4::with_z( - _self, - z, + let output: Val = ::bevy::math::DVec4::with_z( + _self.into(), + z.into(), ) .into(); output @@ -14918,9 +15915,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: f64| { - let output: Val = bevy::math::DVec4::with_w( - _self, - w, + let output: Val = ::bevy::math::DVec4::with_w( + _self.into(), + w.into(), ) .into(); output @@ -14929,16 +15926,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec4::dot(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec4::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::dot_into_vec( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::dot_into_vec( + _self.into(), + rhs.into(), ) .into(); output @@ -14947,9 +15945,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::min( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::min( + _self.into(), + rhs.into(), ) .into(); output @@ -14958,9 +15956,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::max( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::max( + _self.into(), + rhs.into(), ) .into(); output @@ -14973,10 +15971,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = bevy::math::DVec4::clamp( - _self, - min, - max, + let output: Val = ::bevy::math::DVec4::clamp( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -14985,37 +15983,41 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = bevy::math::DVec4::min_element(_self).into(); + let output: f64 = ::bevy::math::DVec4::min_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = bevy::math::DVec4::max_element(_self).into(); + let output: f64 = ::bevy::math::DVec4::max_element(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = bevy::math::DVec4::element_sum(_self).into(); + let output: f64 = ::bevy::math::DVec4::element_sum(_self.into()) + .into(); output }, ) .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = bevy::math::DVec4::element_product(_self).into(); + let output: f64 = ::bevy::math::DVec4::element_product(_self.into()) + .into(); output }, ) .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::cmpeq( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::cmpeq( + _self.into(), + rhs.into(), ) .into(); output @@ -15024,9 +16026,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::cmpne( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::cmpne( + _self.into(), + rhs.into(), ) .into(); output @@ -15035,9 +16037,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::cmpge( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::cmpge( + _self.into(), + rhs.into(), ) .into(); output @@ -15046,9 +16048,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::cmpgt( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::cmpgt( + _self.into(), + rhs.into(), ) .into(); output @@ -15057,9 +16059,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::cmple( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::cmple( + _self.into(), + rhs.into(), ) .into(); output @@ -15068,9 +16070,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::cmplt( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::cmplt( + _self.into(), + rhs.into(), ) .into(); output @@ -15079,7 +16081,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = bevy::math::DVec4::abs(_self) + let output: Val = ::bevy::math::DVec4::abs( + _self.into(), + ) .into(); output }, @@ -15087,7 +16091,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = bevy::math::DVec4::signum(_self) + let output: Val = ::bevy::math::DVec4::signum( + _self.into(), + ) .into(); output }, @@ -15095,9 +16101,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::copysign( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::copysign( + _self.into(), + rhs.into(), ) .into(); output @@ -15106,7 +16112,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = bevy::math::DVec4::is_negative_bitmask(_self) + let output: u32 = ::bevy::math::DVec4::is_negative_bitmask( + _self.into(), + ) .into(); output }, @@ -15114,15 +16122,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::DVec4::is_finite(_self).into(); + let output: bool = ::bevy::math::DVec4::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = bevy::math::DVec4::is_finite_mask( - _self, + let output: Val = ::bevy::math::DVec4::is_finite_mask( + _self.into(), ) .into(); output @@ -15131,15 +16140,15 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::DVec4::is_nan(_self).into(); + let output: bool = ::bevy::math::DVec4::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = bevy::math::DVec4::is_nan_mask( - _self, + let output: Val = ::bevy::math::DVec4::is_nan_mask( + _self.into(), ) .into(); output @@ -15148,35 +16157,44 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = bevy::math::DVec4::length(_self).into(); + let output: f64 = ::bevy::math::DVec4::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = bevy::math::DVec4::length_squared(_self).into(); + let output: f64 = ::bevy::math::DVec4::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = bevy::math::DVec4::length_recip(_self).into(); + let output: f64 = ::bevy::math::DVec4::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec4::distance(_self, rhs).into(); + let output: f64 = ::bevy::math::DVec4::distance( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DVec4::distance_squared(_self, rhs) + let output: f64 = ::bevy::math::DVec4::distance_squared( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -15184,9 +16202,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::div_euclid( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::div_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -15195,9 +16213,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::rem_euclid( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::rem_euclid( + _self.into(), + rhs.into(), ) .into(); output @@ -15206,8 +16224,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::DVec4::normalize( - _self, + let output: Val = ::bevy::math::DVec4::normalize( + _self.into(), ) .into(); output @@ -15216,9 +16234,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = bevy::math::DVec4::normalize_or( - _self, - fallback, + let output: Val = ::bevy::math::DVec4::normalize_or( + _self.into(), + fallback.into(), ) .into(); output @@ -15227,8 +16245,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = bevy::math::DVec4::normalize_or_zero( - _self, + let output: Val = ::bevy::math::DVec4::normalize_or_zero( + _self.into(), ) .into(); output @@ -15237,16 +16255,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::DVec4::is_normalized(_self).into(); + let output: bool = ::bevy::math::DVec4::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::project_onto( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::project_onto( + _self.into(), + rhs.into(), ) .into(); output @@ -15255,9 +16274,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::reject_from( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::reject_from( + _self.into(), + rhs.into(), ) .into(); output @@ -15266,9 +16285,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::project_onto_normalized( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::project_onto_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -15277,9 +16296,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::reject_from_normalized( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::reject_from_normalized( + _self.into(), + rhs.into(), ) .into(); output @@ -15288,7 +16307,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = bevy::math::DVec4::round(_self) + let output: Val = ::bevy::math::DVec4::round( + _self.into(), + ) .into(); output }, @@ -15296,7 +16317,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = bevy::math::DVec4::floor(_self) + let output: Val = ::bevy::math::DVec4::floor( + _self.into(), + ) .into(); output }, @@ -15304,7 +16327,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = bevy::math::DVec4::ceil(_self) + let output: Val = ::bevy::math::DVec4::ceil( + _self.into(), + ) .into(); output }, @@ -15312,7 +16337,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = bevy::math::DVec4::trunc(_self) + let output: Val = ::bevy::math::DVec4::trunc( + _self.into(), + ) .into(); output }, @@ -15320,7 +16347,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = bevy::math::DVec4::fract(_self) + let output: Val = ::bevy::math::DVec4::fract( + _self.into(), + ) .into(); output }, @@ -15328,8 +16357,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = bevy::math::DVec4::fract_gl( - _self, + let output: Val = ::bevy::math::DVec4::fract_gl( + _self.into(), ) .into(); output @@ -15338,7 +16367,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = bevy::math::DVec4::exp(_self) + let output: Val = ::bevy::math::DVec4::exp( + _self.into(), + ) .into(); output }, @@ -15346,9 +16377,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = bevy::math::DVec4::powf( - _self, - n, + let output: Val = ::bevy::math::DVec4::powf( + _self.into(), + n.into(), ) .into(); output @@ -15357,7 +16388,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = bevy::math::DVec4::recip(_self) + let output: Val = ::bevy::math::DVec4::recip( + _self.into(), + ) .into(); output }, @@ -15365,10 +16398,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = bevy::math::DVec4::lerp( - _self, - rhs, - s, + let output: Val = ::bevy::math::DVec4::lerp( + _self.into(), + rhs.into(), + s.into(), ) .into(); output @@ -15377,10 +16410,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = bevy::math::DVec4::move_towards( - _self, - rhs, - d, + let output: Val = ::bevy::math::DVec4::move_towards( + _self.into(), + rhs.into(), + d.into(), ) .into(); output @@ -15389,9 +16422,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::midpoint( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::midpoint( + _self.into(), + rhs.into(), ) .into(); output @@ -15404,10 +16437,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DVec4::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DVec4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -15416,10 +16449,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = bevy::math::DVec4::clamp_length( - _self, - min, - max, + let output: Val = ::bevy::math::DVec4::clamp_length( + _self.into(), + min.into(), + max.into(), ) .into(); output @@ -15428,9 +16461,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = bevy::math::DVec4::clamp_length_max( - _self, - max, + let output: Val = ::bevy::math::DVec4::clamp_length_max( + _self.into(), + max.into(), ) .into(); output @@ -15439,9 +16472,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = bevy::math::DVec4::clamp_length_min( - _self, - min, + let output: Val = ::bevy::math::DVec4::clamp_length_min( + _self.into(), + min.into(), ) .into(); output @@ -15454,10 +16487,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = bevy::math::DVec4::mul_add( - _self, - a, - b, + let output: Val = ::bevy::math::DVec4::mul_add( + _self.into(), + a.into(), + b.into(), ) .into(); output @@ -15466,9 +16499,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = bevy::math::DVec4::reflect( - _self, - normal, + let output: Val = ::bevy::math::DVec4::reflect( + _self.into(), + normal.into(), ) .into(); output @@ -15481,10 +16514,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = bevy::math::DVec4::refract( - _self, - normal, - eta, + let output: Val = ::bevy::math::DVec4::refract( + _self.into(), + normal.into(), + eta.into(), ) .into(); output @@ -15493,7 +16526,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = bevy::math::DVec4::as_vec4(_self) + let output: Val = ::bevy::math::DVec4::as_vec4( + _self.into(), + ) .into(); output }, @@ -15501,8 +16536,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = bevy::math::DVec4::as_ivec4( - _self, + let output: Val = ::bevy::math::DVec4::as_ivec4( + _self.into(), ) .into(); output @@ -15511,8 +16546,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = bevy::math::DVec4::as_uvec4( - _self, + let output: Val = ::bevy::math::DVec4::as_uvec4( + _self.into(), ) .into(); output @@ -15521,8 +16556,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = bevy::math::DVec4::as_i64vec4( - _self, + let output: Val = ::bevy::math::DVec4::as_i64vec4( + _self.into(), ) .into(); output @@ -15531,8 +16566,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = bevy::math::DVec4::as_u64vec4( - _self, + let output: Val = ::bevy::math::DVec4::as_u64vec4( + _self.into(), ) .into(); output @@ -15541,16 +16576,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::DVec4::eq(_self, other).into(); + let output: bool = ::bevy::math::DVec4::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -15559,9 +16598,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -15570,9 +16609,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -15581,9 +16620,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -15592,9 +16631,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -15603,9 +16642,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -15614,9 +16653,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -15625,9 +16664,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::sub( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -15636,9 +16675,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -15647,9 +16686,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -15658,9 +16697,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::add( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -15669,9 +16708,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DVec4::rem( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::rem( + _self.into(), + rhs.into(), ) .into(); output @@ -15680,9 +16719,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = bevy::math::DVec4::div( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -15691,19 +16730,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DVec4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Mat2>::new(world) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat2::div(_self, rhs) + let output: Val = ::bevy::math::Mat2::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -15711,14 +16753,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Mat2::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Mat2::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Mat2::neg(_self) + let output: Val = ::bevy::math::Mat2::neg( + _self.into(), + ) .into(); output }, @@ -15726,7 +16771,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Mat2::clone(_self) + let output: Val = ::bevy::math::Mat2::clone( + _self.into(), + ) .into(); output }, @@ -15734,9 +16781,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { - let output: Val = bevy::math::Mat2::from_cols( - x_axis, - y_axis, + let output: Val = ::bevy::math::Mat2::from_cols( + x_axis.into(), + y_axis.into(), ) .into(); output @@ -15745,14 +16792,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 4] = bevy::math::Mat2::to_cols_array(_self).into(); + let output: [f32; 4] = ::bevy::math::Mat2::to_cols_array( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 2]; 2] = bevy::math::Mat2::to_cols_array_2d(_self) + let output: [[f32; 2]; 2] = ::bevy::math::Mat2::to_cols_array_2d( + _self.into(), + ) .into(); output }, @@ -15760,8 +16812,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::Mat2::from_diagonal( - diagonal, + let output: Val = ::bevy::math::Mat2::from_diagonal( + diagonal.into(), ) .into(); output @@ -15770,9 +16822,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale_angle", |scale: Val, angle: f32| { - let output: Val = bevy::math::Mat2::from_scale_angle( - scale, - angle, + let output: Val = ::bevy::math::Mat2::from_scale_angle( + scale.into(), + angle.into(), ) .into(); output @@ -15781,8 +16833,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = bevy::math::Mat2::from_angle( - angle, + let output: Val = ::bevy::math::Mat2::from_angle( + angle.into(), ) .into(); output @@ -15791,7 +16843,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = bevy::math::Mat2::from_mat3(m) + let output: Val = ::bevy::math::Mat2::from_mat3( + m.into(), + ) .into(); output }, @@ -15799,10 +16853,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_minor", |m: Val, i: usize, j: usize| { - let output: Val = bevy::math::Mat2::from_mat3_minor( - m, - i, - j, + let output: Val = ::bevy::math::Mat2::from_mat3_minor( + m.into(), + i.into(), + j.into(), ) .into(); output @@ -15811,7 +16865,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = bevy::math::Mat2::from_mat3a(m) + let output: Val = ::bevy::math::Mat2::from_mat3a( + m.into(), + ) .into(); output }, @@ -15819,10 +16875,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a_minor", |m: Val, i: usize, j: usize| { - let output: Val = bevy::math::Mat2::from_mat3a_minor( - m, - i, - j, + let output: Val = ::bevy::math::Mat2::from_mat3a_minor( + m.into(), + i.into(), + j.into(), ) .into(); output @@ -15831,9 +16887,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat2::col( - _self, - index, + let output: Val = ::bevy::math::Mat2::col( + _self.into(), + index.into(), ) .into(); output @@ -15842,9 +16898,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat2::row( - _self, - index, + let output: Val = ::bevy::math::Mat2::row( + _self.into(), + index.into(), ) .into(); output @@ -15853,22 +16909,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::Mat2::is_finite(_self).into(); + let output: bool = ::bevy::math::Mat2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::Mat2::is_nan(_self).into(); + let output: bool = ::bevy::math::Mat2::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::Mat2::transpose( - _self, + let output: Val = ::bevy::math::Mat2::transpose( + _self.into(), ) .into(); output @@ -15877,14 +16934,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = bevy::math::Mat2::determinant(_self).into(); + let output: f32 = ::bevy::math::Mat2::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Mat2::inverse(_self) + let output: Val = ::bevy::math::Mat2::inverse( + _self.into(), + ) .into(); output }, @@ -15892,9 +16952,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat2::mul_vec2( - _self, - rhs, + let output: Val = ::bevy::math::Mat2::mul_vec2( + _self.into(), + rhs.into(), ) .into(); output @@ -15903,9 +16963,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat2", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat2::mul_mat2( - _self, - rhs, + let output: Val = ::bevy::math::Mat2::mul_mat2( + _self.into(), + rhs.into(), ) .into(); output @@ -15914,9 +16974,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat2", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat2::add_mat2( - _self, - rhs, + let output: Val = ::bevy::math::Mat2::add_mat2( + _self.into(), + rhs.into(), ) .into(); output @@ -15925,9 +16985,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat2", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat2::sub_mat2( - _self, - rhs, + let output: Val = ::bevy::math::Mat2::sub_mat2( + _self.into(), + rhs.into(), ) .into(); output @@ -15936,9 +16996,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat2::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat2::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -15947,9 +17007,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat2::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat2::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -15962,10 +17022,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Mat2::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Mat2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -15974,7 +17034,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::Mat2::abs(_self) + let output: Val = ::bevy::math::Mat2::abs( + _self.into(), + ) .into(); output }, @@ -15982,8 +17044,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat2", |_self: Ref| { - let output: Val = bevy::math::Mat2::as_dmat2( - _self, + let output: Val = ::bevy::math::Mat2::as_dmat2( + _self.into(), ) .into(); output @@ -15992,7 +17054,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat2::sub(_self, rhs) + let output: Val = ::bevy::math::Mat2::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16000,7 +17065,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat2::mul(_self, rhs) + let output: Val = ::bevy::math::Mat2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16008,7 +17076,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat2::mul(_self, rhs) + let output: Val = ::bevy::math::Mat2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16016,7 +17087,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat2::mul(_self, rhs) + let output: Val = ::bevy::math::Mat2::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16024,16 +17098,22 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat2::add(_self, rhs) + let output: Val = ::bevy::math::Mat2::add( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Mat3>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3::mul(_self, rhs) + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16041,7 +17121,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3::mul(_self, rhs) + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16049,7 +17132,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3::mul(_self, rhs) + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16057,9 +17143,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3::mul( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -16068,7 +17154,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Mat3::neg(_self) + let output: Val = ::bevy::math::Mat3::neg( + _self.into(), + ) .into(); output }, @@ -16076,7 +17164,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3::add(_self, rhs) + let output: Val = ::bevy::math::Mat3::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16084,7 +17175,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Mat3::clone(_self) + let output: Val = ::bevy::math::Mat3::clone( + _self.into(), + ) .into(); output }, @@ -16096,10 +17189,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = bevy::math::Mat3::from_cols( - x_axis, - y_axis, - z_axis, + let output: Val = ::bevy::math::Mat3::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), ) .into(); output @@ -16108,14 +17201,19 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = bevy::math::Mat3::to_cols_array(_self).into(); + let output: [f32; 9] = ::bevy::math::Mat3::to_cols_array( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 3] = bevy::math::Mat3::to_cols_array_2d(_self) + let output: [[f32; 3]; 3] = ::bevy::math::Mat3::to_cols_array_2d( + _self.into(), + ) .into(); output }, @@ -16123,8 +17221,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::Mat3::from_diagonal( - diagonal, + let output: Val = ::bevy::math::Mat3::from_diagonal( + diagonal.into(), ) .into(); output @@ -16133,7 +17231,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = bevy::math::Mat3::from_mat4(m) + let output: Val = ::bevy::math::Mat3::from_mat4( + m.into(), + ) .into(); output }, @@ -16141,10 +17241,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = bevy::math::Mat3::from_mat4_minor( - m, - i, - j, + let output: Val = ::bevy::math::Mat3::from_mat4_minor( + m.into(), + i.into(), + j.into(), ) .into(); output @@ -16153,8 +17253,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::Mat3::from_quat( - rotation, + let output: Val = ::bevy::math::Mat3::from_quat( + rotation.into(), ) .into(); output @@ -16163,9 +17263,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = bevy::math::Mat3::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::Mat3::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -16174,11 +17274,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = bevy::math::Mat3::from_euler( - order, - a, - b, - c, + let output: Val = ::bevy::math::Mat3::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -16187,9 +17287,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = bevy::math::Mat3::to_euler( - _self, - order, + let output: (f32, f32, f32) = ::bevy::math::Mat3::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -16198,8 +17298,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = bevy::math::Mat3::from_rotation_x( - angle, + let output: Val = ::bevy::math::Mat3::from_rotation_x( + angle.into(), ) .into(); output @@ -16208,8 +17308,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = bevy::math::Mat3::from_rotation_y( - angle, + let output: Val = ::bevy::math::Mat3::from_rotation_y( + angle.into(), ) .into(); output @@ -16218,8 +17318,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = bevy::math::Mat3::from_rotation_z( - angle, + let output: Val = ::bevy::math::Mat3::from_rotation_z( + angle.into(), ) .into(); output @@ -16228,8 +17328,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::Mat3::from_translation( - translation, + let output: Val = ::bevy::math::Mat3::from_translation( + translation.into(), ) .into(); output @@ -16238,8 +17338,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = bevy::math::Mat3::from_angle( - angle, + let output: Val = ::bevy::math::Mat3::from_angle( + angle.into(), ) .into(); output @@ -16252,10 +17352,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = bevy::math::Mat3::from_scale_angle_translation( - scale, - angle, - translation, + let output: Val = ::bevy::math::Mat3::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), ) .into(); output @@ -16264,8 +17364,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::Mat3::from_scale( - scale, + let output: Val = ::bevy::math::Mat3::from_scale( + scale.into(), ) .into(); output @@ -16274,7 +17374,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = bevy::math::Mat3::from_mat2(m) + let output: Val = ::bevy::math::Mat3::from_mat2( + m.into(), + ) .into(); output }, @@ -16282,9 +17384,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat3::col( - _self, - index, + let output: Val = ::bevy::math::Mat3::col( + _self.into(), + index.into(), ) .into(); output @@ -16293,9 +17395,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat3::row( - _self, - index, + let output: Val = ::bevy::math::Mat3::row( + _self.into(), + index.into(), ) .into(); output @@ -16304,22 +17406,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::Mat3::is_finite(_self).into(); + let output: bool = ::bevy::math::Mat3::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::Mat3::is_nan(_self).into(); + let output: bool = ::bevy::math::Mat3::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::Mat3::transpose( - _self, + let output: Val = ::bevy::math::Mat3::transpose( + _self.into(), ) .into(); output @@ -16328,14 +17431,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = bevy::math::Mat3::determinant(_self).into(); + let output: f32 = ::bevy::math::Mat3::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Mat3::inverse(_self) + let output: Val = ::bevy::math::Mat3::inverse( + _self.into(), + ) .into(); output }, @@ -16343,9 +17449,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3::transform_point2( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::transform_point2( + _self.into(), + rhs.into(), ) .into(); output @@ -16354,9 +17460,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3::transform_vector2( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::transform_vector2( + _self.into(), + rhs.into(), ) .into(); output @@ -16365,9 +17471,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3::mul_vec3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::mul_vec3( + _self.into(), + rhs.into(), ) .into(); output @@ -16376,9 +17482,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3::mul_vec3a( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::mul_vec3a( + _self.into(), + rhs.into(), ) .into(); output @@ -16387,9 +17493,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat3::mul_mat3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::mul_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -16398,9 +17504,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat3::add_mat3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::add_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -16409,9 +17515,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat3::sub_mat3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::sub_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -16420,9 +17526,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat3::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -16431,9 +17537,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat3::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat3::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -16446,10 +17552,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Mat3::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Mat3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -16458,7 +17564,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::Mat3::abs(_self) + let output: Val = ::bevy::math::Mat3::abs( + _self.into(), + ) .into(); output }, @@ -16466,8 +17574,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat3", |_self: Ref| { - let output: Val = bevy::math::Mat3::as_dmat3( - _self, + let output: Val = ::bevy::math::Mat3::as_dmat3( + _self.into(), ) .into(); output @@ -16476,7 +17584,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat3::mul(_self, rhs) + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16484,14 +17595,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Mat3::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Mat3::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat3::div(_self, rhs) + let output: Val = ::bevy::math::Mat3::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -16499,18 +17614,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3::sub(_self, rhs) + let output: Val = ::bevy::math::Mat3::sub( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Mat3A>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -16519,7 +17637,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Mat3A::clone(_self) + let output: Val = ::bevy::math::Mat3A::clone( + _self.into(), + ) .into(); output }, @@ -16527,9 +17647,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -16538,7 +17658,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Mat3A::neg(_self) + let output: Val = ::bevy::math::Mat3A::neg( + _self.into(), + ) .into(); output }, @@ -16546,9 +17668,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3A::add( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::add( + _self.into(), + rhs.into(), ) .into(); output @@ -16557,9 +17679,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -16568,16 +17690,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Mat3A::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Mat3A::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -16586,9 +17709,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat3A::div( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::div( + _self.into(), + rhs.into(), ) .into(); output @@ -16597,9 +17720,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -16608,9 +17731,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat3A::sub( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -16623,10 +17746,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = bevy::math::Mat3A::from_cols( - x_axis, - y_axis, - z_axis, + let output: Val = ::bevy::math::Mat3A::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), ) .into(); output @@ -16635,7 +17758,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = bevy::math::Mat3A::to_cols_array(_self) + let output: [f32; 9] = ::bevy::math::Mat3A::to_cols_array( + _self.into(), + ) .into(); output }, @@ -16643,8 +17768,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 3] = bevy::math::Mat3A::to_cols_array_2d( - _self, + let output: [[f32; 3]; 3] = ::bevy::math::Mat3A::to_cols_array_2d( + _self.into(), ) .into(); output @@ -16653,8 +17778,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::Mat3A::from_diagonal( - diagonal, + let output: Val = ::bevy::math::Mat3A::from_diagonal( + diagonal.into(), ) .into(); output @@ -16663,7 +17788,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = bevy::math::Mat3A::from_mat4(m) + let output: Val = ::bevy::math::Mat3A::from_mat4( + m.into(), + ) .into(); output }, @@ -16671,10 +17798,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = bevy::math::Mat3A::from_mat4_minor( - m, - i, - j, + let output: Val = ::bevy::math::Mat3A::from_mat4_minor( + m.into(), + i.into(), + j.into(), ) .into(); output @@ -16683,8 +17810,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::Mat3A::from_quat( - rotation, + let output: Val = ::bevy::math::Mat3A::from_quat( + rotation.into(), ) .into(); output @@ -16693,9 +17820,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = bevy::math::Mat3A::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::Mat3A::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -16704,11 +17831,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = bevy::math::Mat3A::from_euler( - order, - a, - b, - c, + let output: Val = ::bevy::math::Mat3A::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -16717,9 +17844,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = bevy::math::Mat3A::to_euler( - _self, - order, + let output: (f32, f32, f32) = ::bevy::math::Mat3A::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -16728,8 +17855,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = bevy::math::Mat3A::from_rotation_x( - angle, + let output: Val = ::bevy::math::Mat3A::from_rotation_x( + angle.into(), ) .into(); output @@ -16738,8 +17865,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = bevy::math::Mat3A::from_rotation_y( - angle, + let output: Val = ::bevy::math::Mat3A::from_rotation_y( + angle.into(), ) .into(); output @@ -16748,8 +17875,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = bevy::math::Mat3A::from_rotation_z( - angle, + let output: Val = ::bevy::math::Mat3A::from_rotation_z( + angle.into(), ) .into(); output @@ -16758,8 +17885,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::Mat3A::from_translation( - translation, + let output: Val = ::bevy::math::Mat3A::from_translation( + translation.into(), ) .into(); output @@ -16768,8 +17895,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = bevy::math::Mat3A::from_angle( - angle, + let output: Val = ::bevy::math::Mat3A::from_angle( + angle.into(), ) .into(); output @@ -16782,10 +17909,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = bevy::math::Mat3A::from_scale_angle_translation( - scale, - angle, - translation, + let output: Val = ::bevy::math::Mat3A::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), ) .into(); output @@ -16794,8 +17921,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::Mat3A::from_scale( - scale, + let output: Val = ::bevy::math::Mat3A::from_scale( + scale.into(), ) .into(); output @@ -16804,7 +17931,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = bevy::math::Mat3A::from_mat2(m) + let output: Val = ::bevy::math::Mat3A::from_mat2( + m.into(), + ) .into(); output }, @@ -16812,9 +17941,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat3A::col( - _self, - index, + let output: Val = ::bevy::math::Mat3A::col( + _self.into(), + index.into(), ) .into(); output @@ -16823,9 +17952,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat3A::row( - _self, - index, + let output: Val = ::bevy::math::Mat3A::row( + _self.into(), + index.into(), ) .into(); output @@ -16834,22 +17963,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::Mat3A::is_finite(_self).into(); + let output: bool = ::bevy::math::Mat3A::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::Mat3A::is_nan(_self).into(); + let output: bool = ::bevy::math::Mat3A::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::Mat3A::transpose( - _self, + let output: Val = ::bevy::math::Mat3A::transpose( + _self.into(), ) .into(); output @@ -16858,15 +17988,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = bevy::math::Mat3A::determinant(_self).into(); + let output: f32 = ::bevy::math::Mat3A::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Mat3A::inverse( - _self, + let output: Val = ::bevy::math::Mat3A::inverse( + _self.into(), ) .into(); output @@ -16875,9 +18006,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3A::transform_point2( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::transform_point2( + _self.into(), + rhs.into(), ) .into(); output @@ -16886,9 +18017,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3A::transform_vector2( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::transform_vector2( + _self.into(), + rhs.into(), ) .into(); output @@ -16897,9 +18028,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3A::mul_vec3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul_vec3( + _self.into(), + rhs.into(), ) .into(); output @@ -16908,9 +18039,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat3A::mul_vec3a( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul_vec3a( + _self.into(), + rhs.into(), ) .into(); output @@ -16919,9 +18050,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat3A::mul_mat3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -16930,9 +18061,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat3A::add_mat3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::add_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -16941,9 +18072,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat3A::sub_mat3( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::sub_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -16952,9 +18083,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat3A::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -16963,9 +18094,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat3A::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat3A::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -16978,10 +18109,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Mat3A::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Mat3A::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -16990,7 +18121,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::Mat3A::abs(_self) + let output: Val = ::bevy::math::Mat3A::abs( + _self.into(), + ) .into(); output }, @@ -16998,18 +18131,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat3", |_self: Ref| { - let output: Val = bevy::math::Mat3A::as_dmat3( - _self, + let output: Val = ::bevy::math::Mat3A::as_dmat3( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Mat4>::new(world) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::Mat4::neg(_self) + let output: Val = ::bevy::math::Mat4::neg( + _self.into(), + ) .into(); output }, @@ -17017,7 +18152,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Mat4::clone(_self) + let output: Val = ::bevy::math::Mat4::clone( + _self.into(), + ) .into(); output }, @@ -17025,7 +18162,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat4::mul(_self, rhs) + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -17033,7 +18173,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat4::mul(_self, rhs) + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -17041,7 +18184,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat4::add(_self, rhs) + let output: Val = ::bevy::math::Mat4::add( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -17049,7 +18195,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat4::mul(_self, rhs) + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -17057,14 +18206,18 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Mat4::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Mat4::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat4::sub(_self, rhs) + let output: Val = ::bevy::math::Mat4::sub( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -17072,7 +18225,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = bevy::math::Mat4::div(_self, rhs) + let output: Val = ::bevy::math::Mat4::div( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -17085,11 +18241,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = bevy::math::Mat4::from_cols( - x_axis, - y_axis, - z_axis, - w_axis, + let output: Val = ::bevy::math::Mat4::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), ) .into(); output @@ -17098,7 +18254,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 16] = bevy::math::Mat4::to_cols_array(_self) + let output: [f32; 16] = ::bevy::math::Mat4::to_cols_array( + _self.into(), + ) .into(); output }, @@ -17106,7 +18264,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 4]; 4] = bevy::math::Mat4::to_cols_array_2d(_self) + let output: [[f32; 4]; 4] = ::bevy::math::Mat4::to_cols_array_2d( + _self.into(), + ) .into(); output }, @@ -17114,8 +18274,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::Mat4::from_diagonal( - diagonal, + let output: Val = ::bevy::math::Mat4::from_diagonal( + diagonal.into(), ) .into(); output @@ -17128,10 +18288,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = bevy::math::Mat4::from_scale_rotation_translation( - scale, - rotation, - translation, + let output: Val = ::bevy::math::Mat4::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), ) .into(); output @@ -17140,9 +18300,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = bevy::math::Mat4::from_rotation_translation( - rotation, - translation, + let output: Val = ::bevy::math::Mat4::from_rotation_translation( + rotation.into(), + translation.into(), ) .into(); output @@ -17151,8 +18311,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::Mat4::from_quat( - rotation, + let output: Val = ::bevy::math::Mat4::from_quat( + rotation.into(), ) .into(); output @@ -17161,7 +18321,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = bevy::math::Mat4::from_mat3(m) + let output: Val = ::bevy::math::Mat4::from_mat3( + m.into(), + ) .into(); output }, @@ -17169,7 +18331,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = bevy::math::Mat4::from_mat3a(m) + let output: Val = ::bevy::math::Mat4::from_mat3a( + m.into(), + ) .into(); output }, @@ -17177,8 +18341,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::Mat4::from_translation( - translation, + let output: Val = ::bevy::math::Mat4::from_translation( + translation.into(), ) .into(); output @@ -17187,9 +18351,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = bevy::math::Mat4::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::Mat4::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -17198,11 +18362,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = bevy::math::Mat4::from_euler( - order, - a, - b, - c, + let output: Val = ::bevy::math::Mat4::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -17211,9 +18375,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = bevy::math::Mat4::to_euler( - _self, - order, + let output: (f32, f32, f32) = ::bevy::math::Mat4::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -17222,8 +18386,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = bevy::math::Mat4::from_rotation_x( - angle, + let output: Val = ::bevy::math::Mat4::from_rotation_x( + angle.into(), ) .into(); output @@ -17232,8 +18396,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = bevy::math::Mat4::from_rotation_y( - angle, + let output: Val = ::bevy::math::Mat4::from_rotation_y( + angle.into(), ) .into(); output @@ -17242,8 +18406,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = bevy::math::Mat4::from_rotation_z( - angle, + let output: Val = ::bevy::math::Mat4::from_rotation_z( + angle.into(), ) .into(); output @@ -17252,8 +18416,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::Mat4::from_scale( - scale, + let output: Val = ::bevy::math::Mat4::from_scale( + scale.into(), ) .into(); output @@ -17262,9 +18426,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat4::col( - _self, - index, + let output: Val = ::bevy::math::Mat4::col( + _self.into(), + index.into(), ) .into(); output @@ -17273,9 +18437,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::Mat4::row( - _self, - index, + let output: Val = ::bevy::math::Mat4::row( + _self.into(), + index.into(), ) .into(); output @@ -17284,22 +18448,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::Mat4::is_finite(_self).into(); + let output: bool = ::bevy::math::Mat4::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::Mat4::is_nan(_self).into(); + let output: bool = ::bevy::math::Mat4::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::Mat4::transpose( - _self, + let output: Val = ::bevy::math::Mat4::transpose( + _self.into(), ) .into(); output @@ -17308,14 +18473,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = bevy::math::Mat4::determinant(_self).into(); + let output: f32 = ::bevy::math::Mat4::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Mat4::inverse(_self) + let output: Val = ::bevy::math::Mat4::inverse( + _self.into(), + ) .into(); output }, @@ -17327,10 +18495,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::Mat4::look_to_lh( - eye, - dir, - up, + let output: Val = ::bevy::math::Mat4::look_to_lh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -17343,10 +18511,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::Mat4::look_to_rh( - eye, - dir, - up, + let output: Val = ::bevy::math::Mat4::look_to_rh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -17359,10 +18527,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::Mat4::look_at_lh( - eye, - center, - up, + let output: Val = ::bevy::math::Mat4::look_at_lh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -17375,10 +18543,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::Mat4::look_at_rh( - eye, - center, - up, + let output: Val = ::bevy::math::Mat4::look_at_rh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -17387,11 +18555,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh_gl", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = bevy::math::Mat4::perspective_rh_gl( - fov_y_radians, - aspect_ratio, - z_near, - z_far, + let output: Val = ::bevy::math::Mat4::perspective_rh_gl( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), ) .into(); output @@ -17400,11 +18568,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = bevy::math::Mat4::perspective_lh( - fov_y_radians, - aspect_ratio, - z_near, - z_far, + let output: Val = ::bevy::math::Mat4::perspective_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), ) .into(); output @@ -17413,11 +18581,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = bevy::math::Mat4::perspective_rh( - fov_y_radians, - aspect_ratio, - z_near, - z_far, + let output: Val = ::bevy::math::Mat4::perspective_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), ) .into(); output @@ -17426,10 +18594,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = bevy::math::Mat4::perspective_infinite_lh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::Mat4::perspective_infinite_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -17438,10 +18606,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = bevy::math::Mat4::perspective_infinite_reverse_lh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -17450,10 +18618,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = bevy::math::Mat4::perspective_infinite_rh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::Mat4::perspective_infinite_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -17462,10 +18630,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = bevy::math::Mat4::perspective_infinite_reverse_rh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -17474,13 +18642,13 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh_gl", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = bevy::math::Mat4::orthographic_rh_gl( - left, - right, - bottom, - top, - near, - far, + let output: Val = ::bevy::math::Mat4::orthographic_rh_gl( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), ) .into(); output @@ -17489,13 +18657,13 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_lh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = bevy::math::Mat4::orthographic_lh( - left, - right, - bottom, - top, - near, - far, + let output: Val = ::bevy::math::Mat4::orthographic_lh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), ) .into(); output @@ -17504,13 +18672,13 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = bevy::math::Mat4::orthographic_rh( - left, - right, - bottom, - top, - near, - far, + let output: Val = ::bevy::math::Mat4::orthographic_rh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), ) .into(); output @@ -17519,9 +18687,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::project_point3( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::project_point3( + _self.into(), + rhs.into(), ) .into(); output @@ -17530,9 +18698,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::transform_point3( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::transform_point3( + _self.into(), + rhs.into(), ) .into(); output @@ -17541,9 +18709,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::transform_vector3( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::transform_vector3( + _self.into(), + rhs.into(), ) .into(); output @@ -17552,9 +18720,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::project_point3a( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::project_point3a( + _self.into(), + rhs.into(), ) .into(); output @@ -17563,9 +18731,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::transform_point3a( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::transform_point3a( + _self.into(), + rhs.into(), ) .into(); output @@ -17574,9 +18742,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::transform_vector3a( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::transform_vector3a( + _self.into(), + rhs.into(), ) .into(); output @@ -17585,9 +18753,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Mat4::mul_vec4( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::mul_vec4( + _self.into(), + rhs.into(), ) .into(); output @@ -17596,9 +18764,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat4", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat4::mul_mat4( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::mul_mat4( + _self.into(), + rhs.into(), ) .into(); output @@ -17607,9 +18775,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat4", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat4::add_mat4( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::add_mat4( + _self.into(), + rhs.into(), ) .into(); output @@ -17618,9 +18786,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat4", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::Mat4::sub_mat4( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::sub_mat4( + _self.into(), + rhs.into(), ) .into(); output @@ -17629,9 +18797,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat4::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -17640,9 +18808,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = bevy::math::Mat4::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::Mat4::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -17655,10 +18823,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Mat4::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Mat4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -17667,7 +18835,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::Mat4::abs(_self) + let output: Val = ::bevy::math::Mat4::abs( + _self.into(), + ) .into(); output }, @@ -17675,8 +18845,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat4", |_self: Ref| { - let output: Val = bevy::math::Mat4::as_dmat4( - _self, + let output: Val = ::bevy::math::Mat4::as_dmat4( + _self.into(), ) .into(); output @@ -17685,23 +18855,29 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Mat4::mul(_self, rhs) + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DMat2>::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::DMat2::eq(_self, rhs).into(); + let output: bool = ::bevy::math::DMat2::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DMat2::clone(_self) + let output: Val = ::bevy::math::DMat2::clone( + _self.into(), + ) .into(); output }, @@ -17709,9 +18885,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat2::add( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::add( + _self.into(), + rhs.into(), ) .into(); output @@ -17720,9 +18896,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat2::sub( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -17731,9 +18907,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -17742,7 +18918,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DMat2::neg(_self) + let output: Val = ::bevy::math::DMat2::neg( + _self.into(), + ) .into(); output }, @@ -17750,9 +18928,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -17761,9 +18939,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { - let output: Val = bevy::math::DMat2::from_cols( - x_axis, - y_axis, + let output: Val = ::bevy::math::DMat2::from_cols( + x_axis.into(), + y_axis.into(), ) .into(); output @@ -17772,7 +18950,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 4] = bevy::math::DMat2::to_cols_array(_self) + let output: [f64; 4] = ::bevy::math::DMat2::to_cols_array( + _self.into(), + ) .into(); output }, @@ -17780,8 +18960,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 2]; 2] = bevy::math::DMat2::to_cols_array_2d( - _self, + let output: [[f64; 2]; 2] = ::bevy::math::DMat2::to_cols_array_2d( + _self.into(), ) .into(); output @@ -17790,8 +18970,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::DMat2::from_diagonal( - diagonal, + let output: Val = ::bevy::math::DMat2::from_diagonal( + diagonal.into(), ) .into(); output @@ -17800,9 +18980,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale_angle", |scale: Val, angle: f64| { - let output: Val = bevy::math::DMat2::from_scale_angle( - scale, - angle, + let output: Val = ::bevy::math::DMat2::from_scale_angle( + scale.into(), + angle.into(), ) .into(); output @@ -17811,8 +18991,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = bevy::math::DMat2::from_angle( - angle, + let output: Val = ::bevy::math::DMat2::from_angle( + angle.into(), ) .into(); output @@ -17821,7 +19001,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = bevy::math::DMat2::from_mat3(m) + let output: Val = ::bevy::math::DMat2::from_mat3( + m.into(), + ) .into(); output }, @@ -17829,10 +19011,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_minor", |m: Val, i: usize, j: usize| { - let output: Val = bevy::math::DMat2::from_mat3_minor( - m, - i, - j, + let output: Val = ::bevy::math::DMat2::from_mat3_minor( + m.into(), + i.into(), + j.into(), ) .into(); output @@ -17841,9 +19023,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::DMat2::col( - _self, - index, + let output: Val = ::bevy::math::DMat2::col( + _self.into(), + index.into(), ) .into(); output @@ -17852,9 +19034,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::DMat2::row( - _self, - index, + let output: Val = ::bevy::math::DMat2::row( + _self.into(), + index.into(), ) .into(); output @@ -17863,22 +19045,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::DMat2::is_finite(_self).into(); + let output: bool = ::bevy::math::DMat2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::DMat2::is_nan(_self).into(); + let output: bool = ::bevy::math::DMat2::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::DMat2::transpose( - _self, + let output: Val = ::bevy::math::DMat2::transpose( + _self.into(), ) .into(); output @@ -17887,15 +19070,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = bevy::math::DMat2::determinant(_self).into(); + let output: f64 = ::bevy::math::DMat2::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::DMat2::inverse( - _self, + let output: Val = ::bevy::math::DMat2::inverse( + _self.into(), ) .into(); output @@ -17904,9 +19088,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat2::mul_vec2( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::mul_vec2( + _self.into(), + rhs.into(), ) .into(); output @@ -17915,9 +19099,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat2", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat2::mul_mat2( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::mul_mat2( + _self.into(), + rhs.into(), ) .into(); output @@ -17926,9 +19110,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat2", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat2::add_mat2( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::add_mat2( + _self.into(), + rhs.into(), ) .into(); output @@ -17937,9 +19121,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat2", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat2::sub_mat2( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::sub_mat2( + _self.into(), + rhs.into(), ) .into(); output @@ -17948,9 +19132,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = bevy::math::DMat2::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -17959,9 +19143,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = bevy::math::DMat2::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -17974,10 +19158,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DMat2::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DMat2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -17986,7 +19170,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::DMat2::abs(_self) + let output: Val = ::bevy::math::DMat2::abs( + _self.into(), + ) .into(); output }, @@ -17994,7 +19180,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_mat2", |_self: Ref| { - let output: Val = bevy::math::DMat2::as_mat2(_self) + let output: Val = ::bevy::math::DMat2::as_mat2( + _self.into(), + ) .into(); output }, @@ -18002,9 +19190,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DMat2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18013,21 +19201,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DMat2::div( - _self, - rhs, + let output: Val = ::bevy::math::DMat2::div( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DMat3>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18036,9 +19224,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18047,9 +19235,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat3::add( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::add( + _self.into(), + rhs.into(), ) .into(); output @@ -18062,10 +19250,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = bevy::math::DMat3::from_cols( - x_axis, - y_axis, - z_axis, + let output: Val = ::bevy::math::DMat3::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), ) .into(); output @@ -18074,7 +19262,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 9] = bevy::math::DMat3::to_cols_array(_self) + let output: [f64; 9] = ::bevy::math::DMat3::to_cols_array( + _self.into(), + ) .into(); output }, @@ -18082,8 +19272,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 3]; 3] = bevy::math::DMat3::to_cols_array_2d( - _self, + let output: [[f64; 3]; 3] = ::bevy::math::DMat3::to_cols_array_2d( + _self.into(), ) .into(); output @@ -18092,8 +19282,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::DMat3::from_diagonal( - diagonal, + let output: Val = ::bevy::math::DMat3::from_diagonal( + diagonal.into(), ) .into(); output @@ -18102,7 +19292,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = bevy::math::DMat3::from_mat4(m) + let output: Val = ::bevy::math::DMat3::from_mat4( + m.into(), + ) .into(); output }, @@ -18110,10 +19302,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = bevy::math::DMat3::from_mat4_minor( - m, - i, - j, + let output: Val = ::bevy::math::DMat3::from_mat4_minor( + m.into(), + i.into(), + j.into(), ) .into(); output @@ -18122,8 +19314,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::DMat3::from_quat( - rotation, + let output: Val = ::bevy::math::DMat3::from_quat( + rotation.into(), ) .into(); output @@ -18132,9 +19324,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = bevy::math::DMat3::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::DMat3::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -18143,11 +19335,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f64, b: f64, c: f64| { - let output: Val = bevy::math::DMat3::from_euler( - order, - a, - b, - c, + let output: Val = ::bevy::math::DMat3::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -18156,9 +19348,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f64, f64, f64) = bevy::math::DMat3::to_euler( - _self, - order, + let output: (f64, f64, f64) = ::bevy::math::DMat3::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -18167,8 +19359,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = bevy::math::DMat3::from_rotation_x( - angle, + let output: Val = ::bevy::math::DMat3::from_rotation_x( + angle.into(), ) .into(); output @@ -18177,8 +19369,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = bevy::math::DMat3::from_rotation_y( - angle, + let output: Val = ::bevy::math::DMat3::from_rotation_y( + angle.into(), ) .into(); output @@ -18187,8 +19379,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = bevy::math::DMat3::from_rotation_z( - angle, + let output: Val = ::bevy::math::DMat3::from_rotation_z( + angle.into(), ) .into(); output @@ -18197,8 +19389,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::DMat3::from_translation( - translation, + let output: Val = ::bevy::math::DMat3::from_translation( + translation.into(), ) .into(); output @@ -18207,8 +19399,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = bevy::math::DMat3::from_angle( - angle, + let output: Val = ::bevy::math::DMat3::from_angle( + angle.into(), ) .into(); output @@ -18221,10 +19413,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f64, translation: Val| { - let output: Val = bevy::math::DMat3::from_scale_angle_translation( - scale, - angle, - translation, + let output: Val = ::bevy::math::DMat3::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), ) .into(); output @@ -18233,8 +19425,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::DMat3::from_scale( - scale, + let output: Val = ::bevy::math::DMat3::from_scale( + scale.into(), ) .into(); output @@ -18243,7 +19435,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = bevy::math::DMat3::from_mat2(m) + let output: Val = ::bevy::math::DMat3::from_mat2( + m.into(), + ) .into(); output }, @@ -18251,9 +19445,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::DMat3::col( - _self, - index, + let output: Val = ::bevy::math::DMat3::col( + _self.into(), + index.into(), ) .into(); output @@ -18262,9 +19456,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::DMat3::row( - _self, - index, + let output: Val = ::bevy::math::DMat3::row( + _self.into(), + index.into(), ) .into(); output @@ -18273,22 +19467,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::DMat3::is_finite(_self).into(); + let output: bool = ::bevy::math::DMat3::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::DMat3::is_nan(_self).into(); + let output: bool = ::bevy::math::DMat3::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::DMat3::transpose( - _self, + let output: Val = ::bevy::math::DMat3::transpose( + _self.into(), ) .into(); output @@ -18297,15 +19492,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = bevy::math::DMat3::determinant(_self).into(); + let output: f64 = ::bevy::math::DMat3::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::DMat3::inverse( - _self, + let output: Val = ::bevy::math::DMat3::inverse( + _self.into(), ) .into(); output @@ -18314,9 +19510,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat3::transform_point2( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::transform_point2( + _self.into(), + rhs.into(), ) .into(); output @@ -18325,9 +19521,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat3::transform_vector2( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::transform_vector2( + _self.into(), + rhs.into(), ) .into(); output @@ -18336,9 +19532,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat3::mul_vec3( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul_vec3( + _self.into(), + rhs.into(), ) .into(); output @@ -18347,9 +19543,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat3::mul_mat3( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -18358,9 +19554,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat3::add_mat3( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::add_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -18369,9 +19565,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat3::sub_mat3( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::sub_mat3( + _self.into(), + rhs.into(), ) .into(); output @@ -18380,9 +19576,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = bevy::math::DMat3::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -18391,9 +19587,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = bevy::math::DMat3::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -18406,10 +19602,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DMat3::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DMat3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -18418,7 +19614,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::DMat3::abs(_self) + let output: Val = ::bevy::math::DMat3::abs( + _self.into(), + ) .into(); output }, @@ -18426,7 +19624,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_mat3", |_self: Ref| { - let output: Val = bevy::math::DMat3::as_mat3(_self) + let output: Val = ::bevy::math::DMat3::as_mat3( + _self.into(), + ) .into(); output }, @@ -18434,14 +19634,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::DMat3::eq(_self, rhs).into(); + let output: bool = ::bevy::math::DMat3::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DMat3::clone(_self) + let output: Val = ::bevy::math::DMat3::clone( + _self.into(), + ) .into(); output }, @@ -18449,9 +19652,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DMat3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18460,7 +19663,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DMat3::neg(_self) + let output: Val = ::bevy::math::DMat3::neg( + _self.into(), + ) .into(); output }, @@ -18468,9 +19673,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat3::sub( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -18479,9 +19684,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18490,21 +19695,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DMat3::div( - _self, - rhs, + let output: Val = ::bevy::math::DMat3::div( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DMat4>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18513,9 +19718,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -18529,11 +19734,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = bevy::math::DMat4::from_cols( - x_axis, - y_axis, - z_axis, - w_axis, + let output: Val = ::bevy::math::DMat4::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), ) .into(); output @@ -18542,7 +19747,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 16] = bevy::math::DMat4::to_cols_array(_self) + let output: [f64; 16] = ::bevy::math::DMat4::to_cols_array( + _self.into(), + ) .into(); output }, @@ -18550,8 +19757,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 4]; 4] = bevy::math::DMat4::to_cols_array_2d( - _self, + let output: [[f64; 4]; 4] = ::bevy::math::DMat4::to_cols_array_2d( + _self.into(), ) .into(); output @@ -18560,8 +19767,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = bevy::math::DMat4::from_diagonal( - diagonal, + let output: Val = ::bevy::math::DMat4::from_diagonal( + diagonal.into(), ) .into(); output @@ -18574,10 +19781,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = bevy::math::DMat4::from_scale_rotation_translation( - scale, - rotation, - translation, + let output: Val = ::bevy::math::DMat4::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), ) .into(); output @@ -18586,9 +19793,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = bevy::math::DMat4::from_rotation_translation( - rotation, - translation, + let output: Val = ::bevy::math::DMat4::from_rotation_translation( + rotation.into(), + translation.into(), ) .into(); output @@ -18597,8 +19804,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::DMat4::from_quat( - rotation, + let output: Val = ::bevy::math::DMat4::from_quat( + rotation.into(), ) .into(); output @@ -18607,7 +19814,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = bevy::math::DMat4::from_mat3(m) + let output: Val = ::bevy::math::DMat4::from_mat3( + m.into(), + ) .into(); output }, @@ -18615,8 +19824,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::DMat4::from_translation( - translation, + let output: Val = ::bevy::math::DMat4::from_translation( + translation.into(), ) .into(); output @@ -18625,9 +19834,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = bevy::math::DMat4::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::DMat4::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -18636,11 +19845,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f64, b: f64, c: f64| { - let output: Val = bevy::math::DMat4::from_euler( - order, - a, - b, - c, + let output: Val = ::bevy::math::DMat4::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -18649,9 +19858,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f64, f64, f64) = bevy::math::DMat4::to_euler( - _self, - order, + let output: (f64, f64, f64) = ::bevy::math::DMat4::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -18660,8 +19869,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = bevy::math::DMat4::from_rotation_x( - angle, + let output: Val = ::bevy::math::DMat4::from_rotation_x( + angle.into(), ) .into(); output @@ -18670,8 +19879,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = bevy::math::DMat4::from_rotation_y( - angle, + let output: Val = ::bevy::math::DMat4::from_rotation_y( + angle.into(), ) .into(); output @@ -18680,8 +19889,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = bevy::math::DMat4::from_rotation_z( - angle, + let output: Val = ::bevy::math::DMat4::from_rotation_z( + angle.into(), ) .into(); output @@ -18690,8 +19899,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::DMat4::from_scale( - scale, + let output: Val = ::bevy::math::DMat4::from_scale( + scale.into(), ) .into(); output @@ -18700,9 +19909,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = bevy::math::DMat4::col( - _self, - index, + let output: Val = ::bevy::math::DMat4::col( + _self.into(), + index.into(), ) .into(); output @@ -18711,9 +19920,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = bevy::math::DMat4::row( - _self, - index, + let output: Val = ::bevy::math::DMat4::row( + _self.into(), + index.into(), ) .into(); output @@ -18722,22 +19931,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::DMat4::is_finite(_self).into(); + let output: bool = ::bevy::math::DMat4::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::DMat4::is_nan(_self).into(); + let output: bool = ::bevy::math::DMat4::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = bevy::math::DMat4::transpose( - _self, + let output: Val = ::bevy::math::DMat4::transpose( + _self.into(), ) .into(); output @@ -18746,15 +19956,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = bevy::math::DMat4::determinant(_self).into(); + let output: f64 = ::bevy::math::DMat4::determinant(_self.into()) + .into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::DMat4::inverse( - _self, + let output: Val = ::bevy::math::DMat4::inverse( + _self.into(), ) .into(); output @@ -18767,10 +19978,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::DMat4::look_to_lh( - eye, - dir, - up, + let output: Val = ::bevy::math::DMat4::look_to_lh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -18783,10 +19994,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::DMat4::look_to_rh( - eye, - dir, - up, + let output: Val = ::bevy::math::DMat4::look_to_rh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -18799,10 +20010,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::DMat4::look_at_lh( - eye, - center, - up, + let output: Val = ::bevy::math::DMat4::look_at_lh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -18815,10 +20026,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::DMat4::look_at_rh( - eye, - center, - up, + let output: Val = ::bevy::math::DMat4::look_at_rh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -18827,11 +20038,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh_gl", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = bevy::math::DMat4::perspective_rh_gl( - fov_y_radians, - aspect_ratio, - z_near, - z_far, + let output: Val = ::bevy::math::DMat4::perspective_rh_gl( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), ) .into(); output @@ -18840,11 +20051,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = bevy::math::DMat4::perspective_lh( - fov_y_radians, - aspect_ratio, - z_near, - z_far, + let output: Val = ::bevy::math::DMat4::perspective_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), ) .into(); output @@ -18853,11 +20064,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = bevy::math::DMat4::perspective_rh( - fov_y_radians, - aspect_ratio, - z_near, - z_far, + let output: Val = ::bevy::math::DMat4::perspective_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), ) .into(); output @@ -18866,10 +20077,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = bevy::math::DMat4::perspective_infinite_lh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::DMat4::perspective_infinite_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -18878,10 +20089,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = bevy::math::DMat4::perspective_infinite_reverse_lh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -18890,10 +20101,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = bevy::math::DMat4::perspective_infinite_rh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::DMat4::perspective_infinite_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -18902,10 +20113,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = bevy::math::DMat4::perspective_infinite_reverse_rh( - fov_y_radians, - aspect_ratio, - z_near, + let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), ) .into(); output @@ -18914,13 +20125,13 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh_gl", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = bevy::math::DMat4::orthographic_rh_gl( - left, - right, - bottom, - top, - near, - far, + let output: Val = ::bevy::math::DMat4::orthographic_rh_gl( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), ) .into(); output @@ -18929,13 +20140,13 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_lh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = bevy::math::DMat4::orthographic_lh( - left, - right, - bottom, - top, - near, - far, + let output: Val = ::bevy::math::DMat4::orthographic_lh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), ) .into(); output @@ -18944,13 +20155,13 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = bevy::math::DMat4::orthographic_rh( - left, - right, - bottom, - top, - near, - far, + let output: Val = ::bevy::math::DMat4::orthographic_rh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), ) .into(); output @@ -18959,9 +20170,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat4::project_point3( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::project_point3( + _self.into(), + rhs.into(), ) .into(); output @@ -18970,9 +20181,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat4::transform_point3( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::transform_point3( + _self.into(), + rhs.into(), ) .into(); output @@ -18981,9 +20192,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat4::transform_vector3( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::transform_vector3( + _self.into(), + rhs.into(), ) .into(); output @@ -18992,9 +20203,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DMat4::mul_vec4( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul_vec4( + _self.into(), + rhs.into(), ) .into(); output @@ -19003,9 +20214,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat4", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat4::mul_mat4( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul_mat4( + _self.into(), + rhs.into(), ) .into(); output @@ -19014,9 +20225,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat4", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat4::add_mat4( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::add_mat4( + _self.into(), + rhs.into(), ) .into(); output @@ -19025,9 +20236,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat4", |_self: Ref, rhs: Ref| { - let output: Val = bevy::math::DMat4::sub_mat4( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::sub_mat4( + _self.into(), + rhs.into(), ) .into(); output @@ -19036,9 +20247,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = bevy::math::DMat4::mul_scalar( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -19047,9 +20258,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = bevy::math::DMat4::div_scalar( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::div_scalar( + _self.into(), + rhs.into(), ) .into(); output @@ -19062,10 +20273,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DMat4::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DMat4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -19074,7 +20285,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = bevy::math::DMat4::abs(_self) + let output: Val = ::bevy::math::DMat4::abs( + _self.into(), + ) .into(); output }, @@ -19082,7 +20295,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_mat4", |_self: Ref| { - let output: Val = bevy::math::DMat4::as_mat4(_self) + let output: Val = ::bevy::math::DMat4::as_mat4( + _self.into(), + ) .into(); output }, @@ -19090,7 +20305,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DMat4::neg(_self) + let output: Val = ::bevy::math::DMat4::neg( + _self.into(), + ) .into(); output }, @@ -19098,7 +20315,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DMat4::clone(_self) + let output: Val = ::bevy::math::DMat4::clone( + _self.into(), + ) .into(); output }, @@ -19106,9 +20325,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat4::sub( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -19117,9 +20336,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DMat4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -19128,16 +20347,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::DMat4::eq(_self, rhs).into(); + let output: bool = ::bevy::math::DMat4::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat4::add( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::add( + _self.into(), + rhs.into(), ) .into(); output @@ -19146,9 +20366,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DMat4::div( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::div( + _self.into(), + rhs.into(), ) .into(); output @@ -19157,21 +20377,21 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DMat4::mul( - _self, - rhs, + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Affine2>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Affine2::mul( - _self, - rhs, + let output: Val = ::bevy::math::Affine2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -19180,9 +20400,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Affine2::mul( - _self, - rhs, + let output: Val = ::bevy::math::Affine2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -19191,8 +20411,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Affine2::clone( - _self, + let output: Val = ::bevy::math::Affine2::clone( + _self.into(), ) .into(); output @@ -19205,10 +20425,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = bevy::math::Affine2::from_cols( - x_axis, - y_axis, - z_axis, + let output: Val = ::bevy::math::Affine2::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), ) .into(); output @@ -19217,7 +20437,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 6] = bevy::math::Affine2::to_cols_array(_self) + let output: [f32; 6] = ::bevy::math::Affine2::to_cols_array( + _self.into(), + ) .into(); output }, @@ -19225,8 +20447,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 2]; 3] = bevy::math::Affine2::to_cols_array_2d( - _self, + let output: [[f32; 2]; 3] = ::bevy::math::Affine2::to_cols_array_2d( + _self.into(), ) .into(); output @@ -19235,8 +20457,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::Affine2::from_scale( - scale, + let output: Val = ::bevy::math::Affine2::from_scale( + scale.into(), ) .into(); output @@ -19245,8 +20467,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = bevy::math::Affine2::from_angle( - angle, + let output: Val = ::bevy::math::Affine2::from_angle( + angle.into(), ) .into(); output @@ -19255,8 +20477,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::Affine2::from_translation( - translation, + let output: Val = ::bevy::math::Affine2::from_translation( + translation.into(), ) .into(); output @@ -19265,8 +20487,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |matrix2: Val| { - let output: Val = bevy::math::Affine2::from_mat2( - matrix2, + let output: Val = ::bevy::math::Affine2::from_mat2( + matrix2.into(), ) .into(); output @@ -19275,9 +20497,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2_translation", |matrix2: Val, translation: Val| { - let output: Val = bevy::math::Affine2::from_mat2_translation( - matrix2, - translation, + let output: Val = ::bevy::math::Affine2::from_mat2_translation( + matrix2.into(), + translation.into(), ) .into(); output @@ -19290,10 +20512,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = bevy::math::Affine2::from_scale_angle_translation( - scale, - angle, - translation, + let output: Val = ::bevy::math::Affine2::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), ) .into(); output @@ -19302,9 +20524,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle_translation", |angle: f32, translation: Val| { - let output: Val = bevy::math::Affine2::from_angle_translation( - angle, - translation, + let output: Val = ::bevy::math::Affine2::from_angle_translation( + angle.into(), + translation.into(), ) .into(); output @@ -19313,8 +20535,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = bevy::math::Affine2::from_mat3( - m, + let output: Val = ::bevy::math::Affine2::from_mat3( + m.into(), ) .into(); output @@ -19323,8 +20545,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = bevy::math::Affine2::from_mat3a( - m, + let output: Val = ::bevy::math::Affine2::from_mat3a( + m.into(), ) .into(); output @@ -19333,9 +20555,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Affine2::transform_point2( - _self, - rhs, + let output: Val = ::bevy::math::Affine2::transform_point2( + _self.into(), + rhs.into(), ) .into(); output @@ -19344,9 +20566,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Affine2::transform_vector2( - _self, - rhs, + let output: Val = ::bevy::math::Affine2::transform_vector2( + _self.into(), + rhs.into(), ) .into(); output @@ -19355,14 +20577,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::Affine2::is_finite(_self).into(); + let output: bool = ::bevy::math::Affine2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::Affine2::is_nan(_self).into(); + let output: bool = ::bevy::math::Affine2::is_nan(_self.into()) + .into(); output }, ) @@ -19373,10 +20597,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Affine2::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Affine2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -19385,8 +20609,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Affine2::inverse( - _self, + let output: Val = ::bevy::math::Affine2::inverse( + _self.into(), ) .into(); output @@ -19395,34 +20619,42 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Affine2::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Affine2::eq( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Affine2::mul( - _self, - rhs, + let output: Val = ::bevy::math::Affine2::mul( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::Affine3A>::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::Affine3A::eq(_self, rhs).into(); + let output: bool = ::bevy::math::Affine3A::eq( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::Affine3A::clone( - _self, + let output: Val = ::bevy::math::Affine3A::clone( + _self.into(), ) .into(); output @@ -19436,11 +20668,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = bevy::math::Affine3A::from_cols( - x_axis, - y_axis, - z_axis, - w_axis, + let output: Val = ::bevy::math::Affine3A::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), ) .into(); output @@ -19449,7 +20681,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 12] = bevy::math::Affine3A::to_cols_array(_self) + let output: [f32; 12] = ::bevy::math::Affine3A::to_cols_array( + _self.into(), + ) .into(); output }, @@ -19457,8 +20691,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 4] = bevy::math::Affine3A::to_cols_array_2d( - _self, + let output: [[f32; 3]; 4] = ::bevy::math::Affine3A::to_cols_array_2d( + _self.into(), ) .into(); output @@ -19467,8 +20701,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::Affine3A::from_scale( - scale, + let output: Val = ::bevy::math::Affine3A::from_scale( + scale.into(), ) .into(); output @@ -19477,8 +20711,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::Affine3A::from_quat( - rotation, + let output: Val = ::bevy::math::Affine3A::from_quat( + rotation.into(), ) .into(); output @@ -19487,9 +20721,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = bevy::math::Affine3A::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::Affine3A::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -19498,8 +20732,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = bevy::math::Affine3A::from_rotation_x( - angle, + let output: Val = ::bevy::math::Affine3A::from_rotation_x( + angle.into(), ) .into(); output @@ -19508,8 +20742,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = bevy::math::Affine3A::from_rotation_y( - angle, + let output: Val = ::bevy::math::Affine3A::from_rotation_y( + angle.into(), ) .into(); output @@ -19518,8 +20752,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = bevy::math::Affine3A::from_rotation_z( - angle, + let output: Val = ::bevy::math::Affine3A::from_rotation_z( + angle.into(), ) .into(); output @@ -19528,8 +20762,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::Affine3A::from_translation( - translation, + let output: Val = ::bevy::math::Affine3A::from_translation( + translation.into(), ) .into(); output @@ -19538,8 +20772,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat3: Val| { - let output: Val = bevy::math::Affine3A::from_mat3( - mat3, + let output: Val = ::bevy::math::Affine3A::from_mat3( + mat3.into(), ) .into(); output @@ -19548,9 +20782,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_translation", |mat3: Val, translation: Val| { - let output: Val = bevy::math::Affine3A::from_mat3_translation( - mat3, - translation, + let output: Val = ::bevy::math::Affine3A::from_mat3_translation( + mat3.into(), + translation.into(), ) .into(); output @@ -19563,10 +20797,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = bevy::math::Affine3A::from_scale_rotation_translation( - scale, - rotation, - translation, + let output: Val = ::bevy::math::Affine3A::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), ) .into(); output @@ -19575,9 +20809,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = bevy::math::Affine3A::from_rotation_translation( - rotation, - translation, + let output: Val = ::bevy::math::Affine3A::from_rotation_translation( + rotation.into(), + translation.into(), ) .into(); output @@ -19586,8 +20820,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = bevy::math::Affine3A::from_mat4( - m, + let output: Val = ::bevy::math::Affine3A::from_mat4( + m.into(), ) .into(); output @@ -19600,10 +20834,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::Affine3A::look_to_lh( - eye, - dir, - up, + let output: Val = ::bevy::math::Affine3A::look_to_lh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -19616,10 +20850,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::Affine3A::look_to_rh( - eye, - dir, - up, + let output: Val = ::bevy::math::Affine3A::look_to_rh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -19632,10 +20866,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::Affine3A::look_at_lh( - eye, - center, - up, + let output: Val = ::bevy::math::Affine3A::look_at_lh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -19648,10 +20882,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::Affine3A::look_at_rh( - eye, - center, - up, + let output: Val = ::bevy::math::Affine3A::look_at_rh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -19660,9 +20894,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Affine3A::transform_point3( - _self, - rhs, + let output: Val = ::bevy::math::Affine3A::transform_point3( + _self.into(), + rhs.into(), ) .into(); output @@ -19671,9 +20905,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Affine3A::transform_vector3( - _self, - rhs, + let output: Val = ::bevy::math::Affine3A::transform_vector3( + _self.into(), + rhs.into(), ) .into(); output @@ -19682,9 +20916,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Affine3A::transform_point3a( - _self, - rhs, + let output: Val = ::bevy::math::Affine3A::transform_point3a( + _self.into(), + rhs.into(), ) .into(); output @@ -19693,9 +20927,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3a", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::Affine3A::transform_vector3a( - _self, - rhs, + let output: Val = ::bevy::math::Affine3A::transform_vector3a( + _self.into(), + rhs.into(), ) .into(); output @@ -19704,14 +20938,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::Affine3A::is_finite(_self).into(); + let output: bool = ::bevy::math::Affine3A::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::Affine3A::is_nan(_self).into(); + let output: bool = ::bevy::math::Affine3A::is_nan(_self.into()) + .into(); output }, ) @@ -19722,10 +20958,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = bevy::math::Affine3A::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::Affine3A::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -19734,8 +20970,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::Affine3A::inverse( - _self, + let output: Val = ::bevy::math::Affine3A::inverse( + _self.into(), ) .into(); output @@ -19744,9 +20980,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Affine3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Affine3A::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -19755,19 +20991,23 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::Affine3A::mul( - _self, - rhs, + let output: Val = ::bevy::math::Affine3A::mul( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DAffine2>::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::DAffine2::eq(_self, rhs).into(); + let output: bool = ::bevy::math::DAffine2::eq( + _self.into(), + rhs.into(), + ) + .into(); output }, ) @@ -19778,10 +21018,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = bevy::math::DAffine2::from_cols( - x_axis, - y_axis, - z_axis, + let output: Val = ::bevy::math::DAffine2::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), ) .into(); output @@ -19790,7 +21030,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 6] = bevy::math::DAffine2::to_cols_array(_self) + let output: [f64; 6] = ::bevy::math::DAffine2::to_cols_array( + _self.into(), + ) .into(); output }, @@ -19798,8 +21040,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 2]; 3] = bevy::math::DAffine2::to_cols_array_2d( - _self, + let output: [[f64; 2]; 3] = ::bevy::math::DAffine2::to_cols_array_2d( + _self.into(), ) .into(); output @@ -19808,8 +21050,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::DAffine2::from_scale( - scale, + let output: Val = ::bevy::math::DAffine2::from_scale( + scale.into(), ) .into(); output @@ -19818,8 +21060,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = bevy::math::DAffine2::from_angle( - angle, + let output: Val = ::bevy::math::DAffine2::from_angle( + angle.into(), ) .into(); output @@ -19828,8 +21070,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::DAffine2::from_translation( - translation, + let output: Val = ::bevy::math::DAffine2::from_translation( + translation.into(), ) .into(); output @@ -19838,8 +21080,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |matrix2: Val| { - let output: Val = bevy::math::DAffine2::from_mat2( - matrix2, + let output: Val = ::bevy::math::DAffine2::from_mat2( + matrix2.into(), ) .into(); output @@ -19848,9 +21090,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2_translation", |matrix2: Val, translation: Val| { - let output: Val = bevy::math::DAffine2::from_mat2_translation( - matrix2, - translation, + let output: Val = ::bevy::math::DAffine2::from_mat2_translation( + matrix2.into(), + translation.into(), ) .into(); output @@ -19863,10 +21105,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f64, translation: Val| { - let output: Val = bevy::math::DAffine2::from_scale_angle_translation( - scale, - angle, - translation, + let output: Val = ::bevy::math::DAffine2::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), ) .into(); output @@ -19875,9 +21117,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle_translation", |angle: f64, translation: Val| { - let output: Val = bevy::math::DAffine2::from_angle_translation( - angle, - translation, + let output: Val = ::bevy::math::DAffine2::from_angle_translation( + angle.into(), + translation.into(), ) .into(); output @@ -19886,8 +21128,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = bevy::math::DAffine2::from_mat3( - m, + let output: Val = ::bevy::math::DAffine2::from_mat3( + m.into(), ) .into(); output @@ -19896,9 +21138,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DAffine2::transform_point2( - _self, - rhs, + let output: Val = ::bevy::math::DAffine2::transform_point2( + _self.into(), + rhs.into(), ) .into(); output @@ -19907,9 +21149,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DAffine2::transform_vector2( - _self, - rhs, + let output: Val = ::bevy::math::DAffine2::transform_vector2( + _self.into(), + rhs.into(), ) .into(); output @@ -19918,14 +21160,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::DAffine2::is_finite(_self).into(); + let output: bool = ::bevy::math::DAffine2::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::DAffine2::is_nan(_self).into(); + let output: bool = ::bevy::math::DAffine2::is_nan(_self.into()) + .into(); output }, ) @@ -19936,10 +21180,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DAffine2::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DAffine2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -19948,8 +21192,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::DAffine2::inverse( - _self, + let output: Val = ::bevy::math::DAffine2::inverse( + _self.into(), ) .into(); output @@ -19958,9 +21202,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DAffine2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DAffine2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -19969,9 +21213,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DAffine2::mul( - _self, - rhs, + let output: Val = ::bevy::math::DAffine2::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -19980,14 +21224,14 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DAffine2::clone( - _self, + let output: Val = ::bevy::math::DAffine2::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DAffine3>::new(world) .overwrite_script_function( "from_cols", | @@ -19996,11 +21240,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = bevy::math::DAffine3::from_cols( - x_axis, - y_axis, - z_axis, - w_axis, + let output: Val = ::bevy::math::DAffine3::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), ) .into(); output @@ -20009,7 +21253,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 12] = bevy::math::DAffine3::to_cols_array(_self) + let output: [f64; 12] = ::bevy::math::DAffine3::to_cols_array( + _self.into(), + ) .into(); output }, @@ -20017,8 +21263,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 3]; 4] = bevy::math::DAffine3::to_cols_array_2d( - _self, + let output: [[f64; 3]; 4] = ::bevy::math::DAffine3::to_cols_array_2d( + _self.into(), ) .into(); output @@ -20027,8 +21273,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = bevy::math::DAffine3::from_scale( - scale, + let output: Val = ::bevy::math::DAffine3::from_scale( + scale.into(), ) .into(); output @@ -20037,8 +21283,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = bevy::math::DAffine3::from_quat( - rotation, + let output: Val = ::bevy::math::DAffine3::from_quat( + rotation.into(), ) .into(); output @@ -20047,9 +21293,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = bevy::math::DAffine3::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::DAffine3::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -20058,8 +21304,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = bevy::math::DAffine3::from_rotation_x( - angle, + let output: Val = ::bevy::math::DAffine3::from_rotation_x( + angle.into(), ) .into(); output @@ -20068,8 +21314,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = bevy::math::DAffine3::from_rotation_y( - angle, + let output: Val = ::bevy::math::DAffine3::from_rotation_y( + angle.into(), ) .into(); output @@ -20078,8 +21324,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = bevy::math::DAffine3::from_rotation_z( - angle, + let output: Val = ::bevy::math::DAffine3::from_rotation_z( + angle.into(), ) .into(); output @@ -20088,8 +21334,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = bevy::math::DAffine3::from_translation( - translation, + let output: Val = ::bevy::math::DAffine3::from_translation( + translation.into(), ) .into(); output @@ -20098,8 +21344,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat3: Val| { - let output: Val = bevy::math::DAffine3::from_mat3( - mat3, + let output: Val = ::bevy::math::DAffine3::from_mat3( + mat3.into(), ) .into(); output @@ -20108,9 +21354,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_translation", |mat3: Val, translation: Val| { - let output: Val = bevy::math::DAffine3::from_mat3_translation( - mat3, - translation, + let output: Val = ::bevy::math::DAffine3::from_mat3_translation( + mat3.into(), + translation.into(), ) .into(); output @@ -20123,10 +21369,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = bevy::math::DAffine3::from_scale_rotation_translation( - scale, - rotation, - translation, + let output: Val = ::bevy::math::DAffine3::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), ) .into(); output @@ -20135,9 +21381,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = bevy::math::DAffine3::from_rotation_translation( - rotation, - translation, + let output: Val = ::bevy::math::DAffine3::from_rotation_translation( + rotation.into(), + translation.into(), ) .into(); output @@ -20146,8 +21392,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = bevy::math::DAffine3::from_mat4( - m, + let output: Val = ::bevy::math::DAffine3::from_mat4( + m.into(), ) .into(); output @@ -20160,10 +21406,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::DAffine3::look_to_lh( - eye, - dir, - up, + let output: Val = ::bevy::math::DAffine3::look_to_lh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -20176,10 +21422,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = bevy::math::DAffine3::look_to_rh( - eye, - dir, - up, + let output: Val = ::bevy::math::DAffine3::look_to_rh( + eye.into(), + dir.into(), + up.into(), ) .into(); output @@ -20192,10 +21438,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::DAffine3::look_at_lh( - eye, - center, - up, + let output: Val = ::bevy::math::DAffine3::look_at_lh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -20208,10 +21454,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = bevy::math::DAffine3::look_at_rh( - eye, - center, - up, + let output: Val = ::bevy::math::DAffine3::look_at_rh( + eye.into(), + center.into(), + up.into(), ) .into(); output @@ -20220,9 +21466,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DAffine3::transform_point3( - _self, - rhs, + let output: Val = ::bevy::math::DAffine3::transform_point3( + _self.into(), + rhs.into(), ) .into(); output @@ -20231,9 +21477,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = bevy::math::DAffine3::transform_vector3( - _self, - rhs, + let output: Val = ::bevy::math::DAffine3::transform_vector3( + _self.into(), + rhs.into(), ) .into(); output @@ -20242,14 +21488,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::math::DAffine3::is_finite(_self).into(); + let output: bool = ::bevy::math::DAffine3::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = bevy::math::DAffine3::is_nan(_self).into(); + let output: bool = ::bevy::math::DAffine3::is_nan(_self.into()) + .into(); output }, ) @@ -20260,10 +21508,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DAffine3::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DAffine3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -20272,8 +21520,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = bevy::math::DAffine3::inverse( - _self, + let output: Val = ::bevy::math::DAffine3::inverse( + _self.into(), ) .into(); output @@ -20282,16 +21530,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::DAffine3::eq(_self, rhs).into(); + let output: bool = ::bevy::math::DAffine3::eq( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DAffine3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DAffine3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -20300,9 +21552,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DAffine3::mul( - _self, - rhs, + let output: Val = ::bevy::math::DAffine3::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -20311,27 +21563,28 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DAffine3::clone( - _self, + let output: Val = ::bevy::math::DAffine3::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::DQuat>::new(world) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::DQuat::eq(_self, rhs).into(); + let output: bool = ::bevy::math::DQuat::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DQuat::div( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::div( + _self.into(), + rhs.into(), ) .into(); output @@ -20340,11 +21593,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_xyzw", |x: f64, y: f64, z: f64, w: f64| { - let output: Val = bevy::math::DQuat::from_xyzw( - x, - y, - z, - w, + let output: Val = ::bevy::math::DQuat::from_xyzw( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -20353,7 +21606,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 4]| { - let output: Val = bevy::math::DQuat::from_array(a) + let output: Val = ::bevy::math::DQuat::from_array( + a.into(), + ) .into(); output }, @@ -20361,7 +21616,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = bevy::math::DQuat::from_vec4(v) + let output: Val = ::bevy::math::DQuat::from_vec4( + v.into(), + ) .into(); output }, @@ -20369,9 +21626,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = bevy::math::DQuat::from_axis_angle( - axis, - angle, + let output: Val = ::bevy::math::DQuat::from_axis_angle( + axis.into(), + angle.into(), ) .into(); output @@ -20380,8 +21637,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scaled_axis", |v: Val| { - let output: Val = bevy::math::DQuat::from_scaled_axis( - v, + let output: Val = ::bevy::math::DQuat::from_scaled_axis( + v.into(), ) .into(); output @@ -20390,8 +21647,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = bevy::math::DQuat::from_rotation_x( - angle, + let output: Val = ::bevy::math::DQuat::from_rotation_x( + angle.into(), ) .into(); output @@ -20400,8 +21657,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = bevy::math::DQuat::from_rotation_y( - angle, + let output: Val = ::bevy::math::DQuat::from_rotation_y( + angle.into(), ) .into(); output @@ -20410,8 +21667,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = bevy::math::DQuat::from_rotation_z( - angle, + let output: Val = ::bevy::math::DQuat::from_rotation_z( + angle.into(), ) .into(); output @@ -20420,11 +21677,11 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |euler: Val, a: f64, b: f64, c: f64| { - let output: Val = bevy::math::DQuat::from_euler( - euler, - a, - b, - c, + let output: Val = ::bevy::math::DQuat::from_euler( + euler.into(), + a.into(), + b.into(), + c.into(), ) .into(); output @@ -20433,8 +21690,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat: Ref| { - let output: Val = bevy::math::DQuat::from_mat3( - mat, + let output: Val = ::bevy::math::DQuat::from_mat3( + mat.into(), ) .into(); output @@ -20443,8 +21700,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |mat: Ref| { - let output: Val = bevy::math::DQuat::from_mat4( - mat, + let output: Val = ::bevy::math::DQuat::from_mat4( + mat.into(), ) .into(); output @@ -20453,9 +21710,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc", |from: Val, to: Val| { - let output: Val = bevy::math::DQuat::from_rotation_arc( - from, - to, + let output: Val = ::bevy::math::DQuat::from_rotation_arc( + from.into(), + to.into(), ) .into(); output @@ -20464,9 +21721,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_colinear", |from: Val, to: Val| { - let output: Val = bevy::math::DQuat::from_rotation_arc_colinear( - from, - to, + let output: Val = ::bevy::math::DQuat::from_rotation_arc_colinear( + from.into(), + to.into(), ) .into(); output @@ -20475,9 +21732,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_2d", |from: Val, to: Val| { - let output: Val = bevy::math::DQuat::from_rotation_arc_2d( - from, - to, + let output: Val = ::bevy::math::DQuat::from_rotation_arc_2d( + from.into(), + to.into(), ) .into(); output @@ -20486,8 +21743,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_scaled_axis", |_self: Val| { - let output: Val = bevy::math::DQuat::to_scaled_axis( - _self, + let output: Val = ::bevy::math::DQuat::to_scaled_axis( + _self.into(), ) .into(); output @@ -20496,9 +21753,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Val, order: Val| { - let output: (f64, f64, f64) = bevy::math::DQuat::to_euler( - _self, - order, + let output: (f64, f64, f64) = ::bevy::math::DQuat::to_euler( + _self.into(), + order.into(), ) .into(); output @@ -20507,14 +21764,17 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = bevy::math::DQuat::to_array(_self).into(); + let output: [f64; 4] = ::bevy::math::DQuat::to_array(_self.into()) + .into(); output }, ) .overwrite_script_function( "xyz", |_self: Val| { - let output: Val = bevy::math::DQuat::xyz(_self) + let output: Val = ::bevy::math::DQuat::xyz( + _self.into(), + ) .into(); output }, @@ -20522,8 +21782,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "conjugate", |_self: Val| { - let output: Val = bevy::math::DQuat::conjugate( - _self, + let output: Val = ::bevy::math::DQuat::conjugate( + _self.into(), ) .into(); output @@ -20532,8 +21792,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = bevy::math::DQuat::inverse( - _self, + let output: Val = ::bevy::math::DQuat::inverse( + _self.into(), ) .into(); output @@ -20542,36 +21802,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DQuat::dot(_self, rhs).into(); + let output: f64 = ::bevy::math::DQuat::dot(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "length", |_self: Val| { - let output: f64 = bevy::math::DQuat::length(_self).into(); + let output: f64 = ::bevy::math::DQuat::length(_self.into()).into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = bevy::math::DQuat::length_squared(_self).into(); + let output: f64 = ::bevy::math::DQuat::length_squared(_self.into()) + .into(); output }, ) .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = bevy::math::DQuat::length_recip(_self).into(); + let output: f64 = ::bevy::math::DQuat::length_recip(_self.into()) + .into(); output }, ) .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = bevy::math::DQuat::normalize( - _self, + let output: Val = ::bevy::math::DQuat::normalize( + _self.into(), ) .into(); output @@ -20580,35 +21843,43 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = bevy::math::DQuat::is_finite(_self).into(); + let output: bool = ::bevy::math::DQuat::is_finite(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = bevy::math::DQuat::is_nan(_self).into(); + let output: bool = ::bevy::math::DQuat::is_nan(_self.into()).into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = bevy::math::DQuat::is_normalized(_self).into(); + let output: bool = ::bevy::math::DQuat::is_normalized(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = bevy::math::DQuat::is_near_identity(_self).into(); + let output: bool = ::bevy::math::DQuat::is_near_identity( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = bevy::math::DQuat::angle_between(_self, rhs) + let output: f64 = ::bevy::math::DQuat::angle_between( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -20620,10 +21891,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f64| { - let output: Val = bevy::math::DQuat::rotate_towards( - _self, - rhs, - max_angle, + let output: Val = ::bevy::math::DQuat::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), ) .into(); output @@ -20636,10 +21907,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = bevy::math::DQuat::abs_diff_eq( - _self, - rhs, - max_abs_diff, + let output: bool = ::bevy::math::DQuat::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), ) .into(); output @@ -20648,10 +21919,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, end: Val, s: f64| { - let output: Val = bevy::math::DQuat::lerp( - _self, - end, - s, + let output: Val = ::bevy::math::DQuat::lerp( + _self.into(), + end.into(), + s.into(), ) .into(); output @@ -20660,10 +21931,10 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f64| { - let output: Val = bevy::math::DQuat::slerp( - _self, - end, - s, + let output: Val = ::bevy::math::DQuat::slerp( + _self.into(), + end.into(), + s.into(), ) .into(); output @@ -20672,9 +21943,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DQuat::mul_vec3( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::mul_vec3( + _self.into(), + rhs.into(), ) .into(); output @@ -20683,9 +21954,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_quat", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DQuat::mul_quat( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::mul_quat( + _self.into(), + rhs.into(), ) .into(); output @@ -20694,8 +21965,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_affine3", |a: Ref| { - let output: Val = bevy::math::DQuat::from_affine3( - a, + let output: Val = ::bevy::math::DQuat::from_affine3( + a.into(), ) .into(); output @@ -20704,7 +21975,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_quat", |_self: Val| { - let output: Val = bevy::math::DQuat::as_quat(_self) + let output: Val = ::bevy::math::DQuat::as_quat( + _self.into(), + ) .into(); output }, @@ -20712,9 +21985,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DQuat::mul( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -20723,9 +21996,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DQuat::mul( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -20734,7 +22007,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::DQuat::clone(_self) + let output: Val = ::bevy::math::DQuat::clone( + _self.into(), + ) .into(); output }, @@ -20742,9 +22017,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DQuat::sub( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::sub( + _self.into(), + rhs.into(), ) .into(); output @@ -20753,9 +22028,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = bevy::math::DQuat::mul( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::mul( + _self.into(), + rhs.into(), ) .into(); output @@ -20764,7 +22039,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = bevy::math::DQuat::neg(_self) + let output: Val = ::bevy::math::DQuat::neg( + _self.into(), + ) .into(); output }, @@ -20772,20 +22049,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = bevy::math::DQuat::add( - _self, - rhs, + let output: Val = ::bevy::math::DQuat::add( + _self.into(), + rhs.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::EulerRot>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::EulerRot::clone( - _self, + let output: Val = ::bevy::math::EulerRot::clone( + _self.into(), ) .into(); output @@ -20794,28 +22071,32 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::math::EulerRot::eq(_self, other).into(); + let output: bool = ::bevy::math::EulerRot::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::math::EulerRot::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::math::EulerRot::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::BVec3A>::new(world) .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { - let output: Val = bevy::math::BVec3A::new( - x, - y, - z, + let output: Val = ::bevy::math::BVec3A::new( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -20824,7 +22105,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = bevy::math::BVec3A::splat(v) + let output: Val = ::bevy::math::BVec3A::splat( + v.into(), + ) .into(); output }, @@ -20832,8 +22115,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 3]| { - let output: Val = bevy::math::BVec3A::from_array( - a, + let output: Val = ::bevy::math::BVec3A::from_array( + a.into(), ) .into(); output @@ -20842,43 +22125,52 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = bevy::math::BVec3A::bitmask(_self).into(); + let output: u32 = ::bevy::math::BVec3A::bitmask(_self.into()).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = bevy::math::BVec3A::any(_self).into(); + let output: bool = ::bevy::math::BVec3A::any(_self.into()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = bevy::math::BVec3A::all(_self).into(); + let output: bool = ::bevy::math::BVec3A::all(_self.into()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = bevy::math::BVec3A::test(_self, index).into(); + let output: bool = ::bevy::math::BVec3A::test( + _self.into(), + index.into(), + ) + .into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = bevy::math::BVec3A::set(_self, index, value).into(); + let output: () = ::bevy::math::BVec3A::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::BVec3A::clone( - _self, + let output: Val = ::bevy::math::BVec3A::clone( + _self.into(), ) .into(); output @@ -20887,19 +22179,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::BVec3A::eq(_self, rhs).into(); + let output: bool = ::bevy::math::BVec3A::eq(_self.into(), rhs.into()) + .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::math::BVec4A>::new(world) .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { - let output: Val = bevy::math::BVec4A::new( - x, - y, - z, - w, + let output: Val = ::bevy::math::BVec4A::new( + x.into(), + y.into(), + z.into(), + w.into(), ) .into(); output @@ -20908,7 +22201,9 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = bevy::math::BVec4A::splat(v) + let output: Val = ::bevy::math::BVec4A::splat( + v.into(), + ) .into(); output }, @@ -20916,8 +22211,8 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 4]| { - let output: Val = bevy::math::BVec4A::from_array( - a, + let output: Val = ::bevy::math::BVec4A::from_array( + a.into(), ) .into(); output @@ -20926,60 +22221,72 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = bevy::math::BVec4A::bitmask(_self).into(); + let output: u32 = ::bevy::math::BVec4A::bitmask(_self.into()).into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = bevy::math::BVec4A::any(_self).into(); + let output: bool = ::bevy::math::BVec4A::any(_self.into()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = bevy::math::BVec4A::all(_self).into(); + let output: bool = ::bevy::math::BVec4A::all(_self.into()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = bevy::math::BVec4A::test(_self, index).into(); + let output: bool = ::bevy::math::BVec4A::test( + _self.into(), + index.into(), + ) + .into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = bevy::math::BVec4A::set(_self, index, value).into(); + let output: () = ::bevy::math::BVec4A::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = bevy::math::BVec4A::eq(_self, rhs).into(); + let output: bool = ::bevy::math::BVec4A::eq(_self.into(), rhs.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::math::BVec4A::clone( - _self, + let output: Val = ::bevy::math::BVec4A::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::smol_str::SmolStr>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = smol_str::SmolStr::clone(_self) + let output: Val = ::smol_str::SmolStr::clone( + _self.into(), + ) .into(); output }, @@ -20987,14 +22294,20 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = smol_str::SmolStr::eq(_self, other).into(); + let output: bool = ::smol_str::SmolStr::eq( + _self.into(), + other.into(), + ) + .into(); output }, ) .overwrite_script_function( "to_string", |_self: Ref| { - let output: std::string::String = smol_str::SmolStr::to_string(_self) + let output: std::string::String = ::smol_str::SmolStr::to_string( + _self.into(), + ) .into(); output }, @@ -21002,86 +22315,92 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "len", |_self: Ref| { - let output: usize = smol_str::SmolStr::len(_self).into(); + let output: usize = ::smol_str::SmolStr::len(_self.into()).into(); output }, ) .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = smol_str::SmolStr::is_empty(_self).into(); + let output: bool = ::smol_str::SmolStr::is_empty(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_heap_allocated", |_self: Ref| { - let output: bool = smol_str::SmolStr::is_heap_allocated(_self) + let output: bool = ::smol_str::SmolStr::is_heap_allocated( + _self.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::uuid::Uuid>::new(world) .overwrite_script_function( "get_version_num", |_self: Ref| { - let output: usize = uuid::Uuid::get_version_num(_self).into(); + let output: usize = ::uuid::Uuid::get_version_num(_self.into()) + .into(); output }, ) .overwrite_script_function( "as_u128", |_self: Ref| { - let output: u128 = uuid::Uuid::as_u128(_self).into(); + let output: u128 = ::uuid::Uuid::as_u128(_self.into()).into(); output }, ) .overwrite_script_function( "to_u128_le", |_self: Ref| { - let output: u128 = uuid::Uuid::to_u128_le(_self).into(); + let output: u128 = ::uuid::Uuid::to_u128_le(_self.into()).into(); output }, ) .overwrite_script_function( "as_u64_pair", |_self: Ref| { - let output: (u64, u64) = uuid::Uuid::as_u64_pair(_self).into(); + let output: (u64, u64) = ::uuid::Uuid::as_u64_pair(_self.into()) + .into(); output }, ) .overwrite_script_function( "into_bytes", |_self: Val| { - let output: [u8; 16] = uuid::Uuid::into_bytes(_self).into(); + let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into()).into(); output }, ) .overwrite_script_function( "to_bytes_le", |_self: Ref| { - let output: [u8; 16] = uuid::Uuid::to_bytes_le(_self).into(); + let output: [u8; 16] = ::uuid::Uuid::to_bytes_le(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_nil", |_self: Ref| { - let output: bool = uuid::Uuid::is_nil(_self).into(); + let output: bool = ::uuid::Uuid::is_nil(_self.into()).into(); output }, ) .overwrite_script_function( "is_max", |_self: Ref| { - let output: bool = uuid::Uuid::is_max(_self).into(); + let output: bool = ::uuid::Uuid::is_max(_self.into()).into(); output }, ) .overwrite_script_function( "encode_buffer", || { - let output: [u8; 45] = uuid::Uuid::encode_buffer().into(); + let output: [u8; 45] = ::uuid::Uuid::encode_buffer().into(); output }, ) @@ -21090,14 +22409,16 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref| { let output: bevy::reflect::erased_serde::__private::serde::__private::Option< [u8; 6], - > = uuid::Uuid::get_node_id(_self).into(); + > = ::uuid::Uuid::get_node_id(_self.into()).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = uuid::Uuid::assert_receiver_is_total_eq(_self) + let output: () = ::uuid::Uuid::assert_receiver_is_total_eq( + _self.into(), + ) .into(); output }, @@ -21105,37 +22426,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "nil", || { - let output: Val = uuid::Uuid::nil().into(); + let output: Val = ::uuid::Uuid::nil().into(); output }, ) .overwrite_script_function( "max", || { - let output: Val = uuid::Uuid::max().into(); + let output: Val = ::uuid::Uuid::max().into(); output }, ) .overwrite_script_function( "from_u128", |v: u128| { - let output: Val = uuid::Uuid::from_u128(v).into(); + let output: Val = ::uuid::Uuid::from_u128(v.into()) + .into(); output }, ) .overwrite_script_function( "from_u128_le", |v: u128| { - let output: Val = uuid::Uuid::from_u128_le(v).into(); + let output: Val = ::uuid::Uuid::from_u128_le(v.into()) + .into(); output }, ) .overwrite_script_function( "from_u64_pair", |high_bits: u64, low_bits: u64| { - let output: Val = uuid::Uuid::from_u64_pair( - high_bits, - low_bits, + let output: Val = ::uuid::Uuid::from_u64_pair( + high_bits.into(), + low_bits.into(), ) .into(); output @@ -21144,35 +22467,39 @@ impl bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_bytes", |bytes: [u8; 16]| { - let output: Val = uuid::Uuid::from_bytes(bytes).into(); + let output: Val = ::uuid::Uuid::from_bytes(bytes.into()) + .into(); output }, ) .overwrite_script_function( "from_bytes_le", |b: [u8; 16]| { - let output: Val = uuid::Uuid::from_bytes_le(b).into(); + let output: Val = ::uuid::Uuid::from_bytes_le(b.into()) + .into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = uuid::Uuid::eq(_self, other).into(); + let output: bool = ::uuid::Uuid::eq(_self.into(), other.into()) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = uuid::Uuid::clone(_self).into(); + let output: Val = ::uuid::Uuid::clone(_self.into()) + .into(); output }, ) .overwrite_script_function( "new_v4", || { - let output: Val = uuid::Uuid::new_v4().into(); + let output: Val = ::uuid::Uuid::new_v4().into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs index a7cda66096..94e19efea1 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs @@ -13,34 +13,34 @@ pub struct BevyTimeScriptingPlugin; impl bevy::app::Plugin for BevyTimeScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::time::prelude::Fixed>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::time::prelude::Fixed::clone( - _self, + let output: Val = ::bevy::time::prelude::Fixed::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::time::prelude::Real>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::time::prelude::Real::clone( - _self, + let output: Val = ::bevy::time::prelude::Real::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::time::prelude::Timer>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::time::prelude::Timer::clone( - _self, + let output: Val = ::bevy::time::prelude::Timer::clone( + _self.into(), ) .into(); output @@ -49,8 +49,8 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::time::prelude::Timer::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::time::prelude::Timer::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -59,9 +59,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "from_seconds", |duration: f32, mode: Val| { - let output: Val = bevy::time::prelude::Timer::from_seconds( - duration, - mode, + let output: Val = ::bevy::time::prelude::Timer::from_seconds( + duration.into(), + mode.into(), ) .into(); output @@ -70,7 +70,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "finished", |_self: Ref| { - let output: bool = bevy::time::prelude::Timer::finished(_self) + let output: bool = ::bevy::time::prelude::Timer::finished( + _self.into(), + ) .into(); output }, @@ -78,7 +80,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "just_finished", |_self: Ref| { - let output: bool = bevy::time::prelude::Timer::just_finished(_self) + let output: bool = ::bevy::time::prelude::Timer::just_finished( + _self.into(), + ) .into(); output }, @@ -86,7 +90,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = bevy::time::prelude::Timer::elapsed_secs(_self) + let output: f32 = ::bevy::time::prelude::Timer::elapsed_secs( + _self.into(), + ) .into(); output }, @@ -94,7 +100,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = bevy::time::prelude::Timer::elapsed_secs_f64(_self) + let output: f64 = ::bevy::time::prelude::Timer::elapsed_secs_f64( + _self.into(), + ) .into(); output }, @@ -102,8 +110,8 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "mode", |_self: Ref| { - let output: Val = bevy::time::prelude::Timer::mode( - _self, + let output: Val = ::bevy::time::prelude::Timer::mode( + _self.into(), ) .into(); output @@ -115,7 +123,10 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Mut, mode: Val| { - let output: () = bevy::time::prelude::Timer::set_mode(_self, mode) + let output: () = ::bevy::time::prelude::Timer::set_mode( + _self.into(), + mode.into(), + ) .into(); output }, @@ -123,43 +134,50 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |_self: Mut| { - let output: () = bevy::time::prelude::Timer::pause(_self).into(); + let output: () = ::bevy::time::prelude::Timer::pause(_self.into()) + .into(); output }, ) .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = bevy::time::prelude::Timer::unpause(_self).into(); + let output: () = ::bevy::time::prelude::Timer::unpause(_self.into()) + .into(); output }, ) .overwrite_script_function( "paused", |_self: Ref| { - let output: bool = bevy::time::prelude::Timer::paused(_self).into(); + let output: bool = ::bevy::time::prelude::Timer::paused(_self.into()) + .into(); output }, ) .overwrite_script_function( "reset", |_self: Mut| { - let output: () = bevy::time::prelude::Timer::reset(_self).into(); + let output: () = ::bevy::time::prelude::Timer::reset(_self.into()) + .into(); output }, ) .overwrite_script_function( "fraction", |_self: Ref| { - let output: f32 = bevy::time::prelude::Timer::fraction(_self).into(); + let output: f32 = ::bevy::time::prelude::Timer::fraction( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( "fraction_remaining", |_self: Ref| { - let output: f32 = bevy::time::prelude::Timer::fraction_remaining( - _self, + let output: f32 = ::bevy::time::prelude::Timer::fraction_remaining( + _self.into(), ) .into(); output @@ -168,7 +186,9 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "remaining_secs", |_self: Ref| { - let output: f32 = bevy::time::prelude::Timer::remaining_secs(_self) + let output: f32 = ::bevy::time::prelude::Timer::remaining_secs( + _self.into(), + ) .into(); output }, @@ -176,8 +196,8 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "times_finished_this_tick", |_self: Ref| { - let output: u32 = bevy::time::prelude::Timer::times_finished_this_tick( - _self, + let output: u32 = ::bevy::time::prelude::Timer::times_finished_this_tick( + _self.into(), ) .into(); output @@ -189,19 +209,25 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::time::prelude::Timer::eq(_self, other) + let output: bool = ::bevy::time::prelude::Timer::eq( + _self.into(), + other.into(), + ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::time::prelude::TimerMode>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = bevy::time::prelude::TimerMode::eq(_self, other) + let output: bool = ::bevy::time::prelude::TimerMode::eq( + _self.into(), + other.into(), + ) .into(); output }, @@ -209,8 +235,8 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::time::prelude::TimerMode::clone( - _self, + let output: Val = ::bevy::time::prelude::TimerMode::clone( + _self.into(), ) .into(); output @@ -219,29 +245,29 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::time::prelude::Virtual>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::time::prelude::Virtual::clone( - _self, + let output: Val = ::bevy::time::prelude::Virtual::clone( + _self.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::time::Stopwatch>::new(world) .overwrite_script_function( "new", || { - let output: Val = bevy::time::Stopwatch::new() + let output: Val = ::bevy::time::Stopwatch::new() .into(); output }, @@ -249,14 +275,17 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = bevy::time::Stopwatch::elapsed_secs(_self).into(); + let output: f32 = ::bevy::time::Stopwatch::elapsed_secs(_self.into()) + .into(); output }, ) .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = bevy::time::Stopwatch::elapsed_secs_f64(_self) + let output: f64 = ::bevy::time::Stopwatch::elapsed_secs_f64( + _self.into(), + ) .into(); output }, @@ -264,36 +293,38 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |_self: Mut| { - let output: () = bevy::time::Stopwatch::pause(_self).into(); + let output: () = ::bevy::time::Stopwatch::pause(_self.into()).into(); output }, ) .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = bevy::time::Stopwatch::unpause(_self).into(); + let output: () = ::bevy::time::Stopwatch::unpause(_self.into()) + .into(); output }, ) .overwrite_script_function( "is_paused", |_self: Ref| { - let output: bool = bevy::time::Stopwatch::is_paused(_self).into(); + let output: bool = ::bevy::time::Stopwatch::is_paused(_self.into()) + .into(); output }, ) .overwrite_script_function( "reset", |_self: Mut| { - let output: () = bevy::time::Stopwatch::reset(_self).into(); + let output: () = ::bevy::time::Stopwatch::reset(_self.into()).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = bevy::time::Stopwatch::assert_receiver_is_total_eq( - _self, + let output: () = ::bevy::time::Stopwatch::assert_receiver_is_total_eq( + _self.into(), ) .into(); output @@ -302,8 +333,8 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::time::Stopwatch::clone( - _self, + let output: Val = ::bevy::time::Stopwatch::clone( + _self.into(), ) .into(); output @@ -312,7 +343,11 @@ impl bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = bevy::time::Stopwatch::eq(_self, other).into(); + let output: bool = ::bevy::time::Stopwatch::eq( + _self.into(), + other.into(), + ) + .into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs index d9a4963c6e..89b7321077 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs @@ -16,12 +16,12 @@ pub struct BevyTransformScriptingPlugin; impl bevy::app::Plugin for BevyTransformScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { let mut world = app.world_mut(); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::transform::components::GlobalTransform>::new(world) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::transform::components::GlobalTransform::clone( - _self, + let output: Val = ::bevy::transform::components::GlobalTransform::clone( + _self.into(), ) .into(); output @@ -33,9 +33,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, global_transform: Val| { - let output: Val = bevy::transform::components::GlobalTransform::mul( - _self, - global_transform, + let output: Val = ::bevy::transform::components::GlobalTransform::mul( + _self.into(), + global_transform.into(), ) .into(); output @@ -47,9 +47,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, transform: Val| { - let output: Val = bevy::transform::components::GlobalTransform::mul( - _self, - transform, + let output: Val = ::bevy::transform::components::GlobalTransform::mul( + _self.into(), + transform.into(), ) .into(); output @@ -61,9 +61,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::transform::components::GlobalTransform::eq( - _self, - other, + let output: bool = ::bevy::transform::components::GlobalTransform::eq( + _self.into(), + other.into(), ) .into(); output @@ -72,10 +72,10 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = bevy::transform::components::GlobalTransform::from_xyz( - x, - y, - z, + let output: Val = ::bevy::transform::components::GlobalTransform::from_xyz( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -84,8 +84,8 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "compute_transform", |_self: Ref| { - let output: Val = bevy::transform::components::GlobalTransform::compute_transform( - _self, + let output: Val = ::bevy::transform::components::GlobalTransform::compute_transform( + _self.into(), ) .into(); output @@ -97,9 +97,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, parent: Ref| { - let output: Val = bevy::transform::components::GlobalTransform::reparented_to( - _self, - parent, + let output: Val = ::bevy::transform::components::GlobalTransform::reparented_to( + _self.into(), + parent.into(), ) .into(); output @@ -111,22 +111,22 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, transform: Val| { - let output: Val = bevy::transform::components::GlobalTransform::mul_transform( - _self, - transform, + let output: Val = ::bevy::transform::components::GlobalTransform::mul_transform( + _self.into(), + transform.into(), ) .into(); output }, ); - NamespaceBuilder::::new(world) + NamespaceBuilder::<::bevy::transform::components::Transform>::new(world) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = bevy::transform::components::Transform::from_xyz( - x, - y, - z, + let output: Val = ::bevy::transform::components::Transform::from_xyz( + x.into(), + y.into(), + z.into(), ) .into(); output @@ -135,9 +135,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_x", |_self: Mut, angle: f32| { - let output: () = bevy::transform::components::Transform::rotate_x( - _self, - angle, + let output: () = ::bevy::transform::components::Transform::rotate_x( + _self.into(), + angle.into(), ) .into(); output @@ -146,9 +146,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_y", |_self: Mut, angle: f32| { - let output: () = bevy::transform::components::Transform::rotate_y( - _self, - angle, + let output: () = ::bevy::transform::components::Transform::rotate_y( + _self.into(), + angle.into(), ) .into(); output @@ -157,9 +157,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_z", |_self: Mut, angle: f32| { - let output: () = bevy::transform::components::Transform::rotate_z( - _self, - angle, + let output: () = ::bevy::transform::components::Transform::rotate_z( + _self.into(), + angle.into(), ) .into(); output @@ -168,9 +168,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_local_x", |_self: Mut, angle: f32| { - let output: () = bevy::transform::components::Transform::rotate_local_x( - _self, - angle, + let output: () = ::bevy::transform::components::Transform::rotate_local_x( + _self.into(), + angle.into(), ) .into(); output @@ -179,9 +179,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_local_y", |_self: Mut, angle: f32| { - let output: () = bevy::transform::components::Transform::rotate_local_y( - _self, - angle, + let output: () = ::bevy::transform::components::Transform::rotate_local_y( + _self.into(), + angle.into(), ) .into(); output @@ -190,9 +190,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_local_z", |_self: Mut, angle: f32| { - let output: () = bevy::transform::components::Transform::rotate_local_z( - _self, - angle, + let output: () = ::bevy::transform::components::Transform::rotate_local_z( + _self.into(), + angle.into(), ) .into(); output @@ -204,9 +204,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, transform: Val| { - let output: Val = bevy::transform::components::Transform::mul_transform( - _self, - transform, + let output: Val = ::bevy::transform::components::Transform::mul_transform( + _self.into(), + transform.into(), ) .into(); output @@ -215,8 +215,8 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = bevy::transform::components::Transform::is_finite( - _self, + let output: bool = ::bevy::transform::components::Transform::is_finite( + _self.into(), ) .into(); output @@ -228,9 +228,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = bevy::transform::components::Transform::eq( - _self, - other, + let output: bool = ::bevy::transform::components::Transform::eq( + _self.into(), + other.into(), ) .into(); output @@ -242,9 +242,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, transform: Val| { - let output: Val = bevy::transform::components::Transform::mul( - _self, - transform, + let output: Val = ::bevy::transform::components::Transform::mul( + _self.into(), + transform.into(), ) .into(); output @@ -256,9 +256,9 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, global_transform: Val| { - let output: Val = bevy::transform::components::Transform::mul( - _self, - global_transform, + let output: Val = ::bevy::transform::components::Transform::mul( + _self.into(), + global_transform.into(), ) .into(); output @@ -267,8 +267,8 @@ impl bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = bevy::transform::components::Transform::clone( - _self, + let output: Val = ::bevy::transform::components::Transform::clone( + _self.into(), ) .into(); output From b1f47c68043b884c33a8355692b9a8133e6988a6 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 13:31:33 +0000 Subject: [PATCH 098/217] imports --- crates/bevy_api_gen/templates/footer.tera | 4 ++-- crates/bevy_api_gen/templates/macros.tera | 2 +- crates/bevy_api_gen/templates/mod.tera | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 9f29e7e9d4..da71526f7f 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -7,8 +7,8 @@ pub struct {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}}; -impl bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}} { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_case(case="upper_camel")}} { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); {% for item in items %} diff --git a/crates/bevy_api_gen/templates/macros.tera b/crates/bevy_api_gen/templates/macros.tera index 67ad6ddaf7..5297a43694 100644 --- a/crates/bevy_api_gen/templates/macros.tera +++ b/crates/bevy_api_gen/templates/macros.tera @@ -25,7 +25,7 @@ fn index(_self: Self, idx: usize, lua: &tealr::mlu::mlua::Lua) -> Result "unknown_axis" }; - let parsed_path = bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); + let parsed_path = ::bevy::reflect::ParsedPath::parse_static(path).expect("invariant"); curr_ref.index_path(bevy_mod_scripting_core::bindings::ReflectionPathElem::new_reflection(parsed_path)); crate::bindings::reference::LuaReflectReference(curr_ref).to_lua_proxy(lua) } diff --git a/crates/bevy_api_gen/templates/mod.tera b/crates/bevy_api_gen/templates/mod.tera index 4032b344d9..3655a08e26 100644 --- a/crates/bevy_api_gen/templates/mod.tera +++ b/crates/bevy_api_gen/templates/mod.tera @@ -9,8 +9,8 @@ pub struct {{ api_name }}; -impl bevy::app::Plugin for {{ api_name }} { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for {{ api_name }} { + fn build(&self, app: &mut ::bevy::prelude::App) { {% for crate in crates %} {% set crate_name = crate.name %} {{ crate_name }}::{{ "ScriptingPlugin" | prefix(val=crate_name) | convert_case(case="upper_camel")}}.build(app); From 3d5123d5baf8f358b78337f147217a881c07c9c1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 13:35:08 +0000 Subject: [PATCH 099/217] chore(codegen): update bevy bindings (#174) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs | 4 ++-- crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs | 4 ++-- .../bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs | 4 ++-- crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs | 4 ++-- crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs | 4 ++-- crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs | 4 ++-- crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs | 4 ++-- .../bevy_mod_scripting_functions/src/bevy/bevy_transform.rs | 4 ++-- crates/bevy_mod_scripting_functions/src/bevy/mod.rs | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs index 90af119c8a..870b902312 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs @@ -10,8 +10,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyCoreScriptingPlugin; -impl bevy::app::Plugin for BevyCoreScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::core::prelude::Name>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs index 89c947c828..6bf900abf5 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs @@ -9,8 +9,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyEcsScriptingPlugin; -impl bevy::app::Plugin for BevyEcsScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::ecs::entity::Entity>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs index c6f89ceef2..faa3ed7af6 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs @@ -11,8 +11,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyHierarchyScriptingPlugin; -impl bevy::app::Plugin for BevyHierarchyScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::hierarchy::prelude::Children>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs index b825240bc5..db3d2207c3 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs @@ -12,8 +12,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyInputScriptingPlugin; -impl bevy::app::Plugin for BevyInputScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyInputScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::input::gamepad::Gamepad>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs index 540ed8dd48..09e42ace0a 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs @@ -9,8 +9,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyMathScriptingPlugin; -impl bevy::app::Plugin for BevyMathScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyMathScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::math::AspectRatio>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs index 8644819064..603a8e68d0 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs @@ -8,8 +8,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyReflectScriptingPlugin; -impl bevy::app::Plugin for BevyReflectScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::std::sync::atomic::AtomicBool>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs index 94e19efea1..2a0259468a 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs @@ -10,8 +10,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyTimeScriptingPlugin; -impl bevy::app::Plugin for BevyTimeScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::time::prelude::Fixed>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs index 89b7321077..c32d3ee20e 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs @@ -13,8 +13,8 @@ use bevy_mod_scripting_core::{ }; use crate::*; pub struct BevyTransformScriptingPlugin; -impl bevy::app::Plugin for BevyTransformScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::transform::components::GlobalTransform>::new(world) .overwrite_script_function( diff --git a/crates/bevy_mod_scripting_functions/src/bevy/mod.rs b/crates/bevy_mod_scripting_functions/src/bevy/mod.rs index 94eef83506..7aa0977203 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy/mod.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy/mod.rs @@ -11,8 +11,8 @@ pub mod bevy_hierarchy; pub mod bevy_ecs; pub mod bevy_time; pub struct LuaBevyScriptingPlugin; -impl bevy::app::Plugin for LuaBevyScriptingPlugin { - fn build(&self, app: &mut bevy::prelude::App) { +impl ::bevy::app::Plugin for LuaBevyScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { bevy_reflect::BevyReflectScriptingPlugin.build(app); bevy_math::BevyMathScriptingPlugin.build(app); bevy_input::BevyInputScriptingPlugin.build(app); From cbcfd5fa4e21845bbe70654bce86df210fec26af Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 13:41:11 +0000 Subject: [PATCH 100/217] move bindings under different module --- .github/workflows/generate_bindings.yml | 2 +- .../src/bevy/bevy_core.rs | 42 - .../src/bevy/bevy_ecs.rs | 385 - .../src/bevy/bevy_hierarchy.rs | 95 - .../src/bevy/bevy_input.rs | 1437 - .../src/bevy/bevy_math.rs | 3548 --- .../src/bevy/bevy_reflect.rs | 22507 ---------------- .../src/bevy/bevy_time.rs | 355 - .../src/bevy/bevy_transform.rs | 278 - .../src/bevy/mod.rs | 25 - 10 files changed, 1 insertion(+), 28673 deletions(-) delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs delete mode 100644 crates/bevy_mod_scripting_functions/src/bevy/mod.rs diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index 426cb896e0..e1b38dc19e 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -15,7 +15,7 @@ env: RUST_TOOLCHAIN: nightly-2024-12-15 BEVY_API_GEN_PATH: ${{ github.workspace }}/crates/bevy_api_gen BEVY_PATH: ${{ github.workspace }}/target/codegen/bevy - OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy/ + OUTPUT_PATH: ${{ github.workspace }}/crates/bevy_mod_scripting_functions/src/bevy_bindings/ BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }} GH_TOKEN: ${{ github.token }} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs deleted file mode 100644 index 870b902312..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_core.rs +++ /dev/null @@ -1,42 +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::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyCoreScriptingPlugin; -impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::core::prelude::Name>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::core::prelude::Name::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::core::prelude::Name::clone( - _self.into(), - ) - .into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs deleted file mode 100644 index 6bf900abf5..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_ecs.rs +++ /dev/null @@ -1,385 +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_reflect::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyEcsScriptingPlugin; -impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::ecs::entity::Entity>::new(world) - .overwrite_script_function( - "from_raw", - |index: u32| { - let output: Val = ::bevy::ecs::entity::Entity::from_raw( - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_bits", - |_self: Val| { - let output: u64 = ::bevy::ecs::entity::Entity::to_bits(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "from_bits", - |bits: u64| { - let output: Val = ::bevy::ecs::entity::Entity::from_bits( - bits.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "index", - |_self: Val| { - let output: u32 = ::bevy::ecs::entity::Entity::index(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "generation", - |_self: Val| { - let output: u32 = ::bevy::ecs::entity::Entity::generation( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::ecs::entity::Entity::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::entity::Entity::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::world::OnAdd>::new(world); - NamespaceBuilder::<::bevy::ecs::world::OnInsert>::new(world); - NamespaceBuilder::<::bevy::ecs::world::OnRemove>::new(world); - NamespaceBuilder::<::bevy::ecs::world::OnReplace>::new(world); - NamespaceBuilder::<::bevy::ecs::component::ComponentId>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::ecs::component::ComponentId::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::component::ComponentId::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |index: usize| { - let output: Val = ::bevy::ecs::component::ComponentId::new( - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "index", - |_self: Val| { - let output: usize = ::bevy::ecs::component::ComponentId::index( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::component::Tick>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::ecs::component::Tick::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::ecs::component::Tick::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::component::Tick::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |tick: u32| { - let output: Val = ::bevy::ecs::component::Tick::new( - tick.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "get", - |_self: Val| { - let output: u32 = ::bevy::ecs::component::Tick::get(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "set", - |_self: Mut, tick: u32| { - let output: () = ::bevy::ecs::component::Tick::set( - _self.into(), - tick.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_newer_than", - | - _self: Val, - last_run: Val, - this_run: Val| - { - let output: bool = ::bevy::ecs::component::Tick::is_newer_than( - _self.into(), - last_run.into(), - this_run.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::component::ComponentTicks>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::component::ComponentTicks::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_added", - | - _self: Ref, - last_run: Val, - this_run: Val| - { - let output: bool = ::bevy::ecs::component::ComponentTicks::is_added( - _self.into(), - last_run.into(), - this_run.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_changed", - | - _self: Ref, - last_run: Val, - this_run: Val| - { - let output: bool = ::bevy::ecs::component::ComponentTicks::is_changed( - _self.into(), - last_run.into(), - this_run.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |change_tick: Val| { - let output: Val = ::bevy::ecs::component::ComponentTicks::new( - change_tick.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_changed", - | - _self: Mut, - change_tick: Val| - { - let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( - _self.into(), - change_tick.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::identifier::Identifier>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::identifier::Identifier::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "low", - |_self: Val| { - let output: u32 = ::bevy::ecs::identifier::Identifier::low( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "masked_high", - |_self: Val| { - let output: u32 = ::bevy::ecs::identifier::Identifier::masked_high( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_bits", - |_self: Val| { - let output: u64 = ::bevy::ecs::identifier::Identifier::to_bits( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_bits", - |value: u64| { - let output: Val = ::bevy::ecs::identifier::Identifier::from_bits( - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::ecs::identifier::Identifier::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::entity::EntityHash>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::entity::EntityHash::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::< - ::bevy::ecs::removal_detection::RemovedComponentEntity, - >::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val< - bevy::ecs::removal_detection::RemovedComponentEntity, - > = ::bevy::ecs::removal_detection::RemovedComponentEntity::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::system::SystemIdMarker>::new(world); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs deleted file mode 100644 index faa3ed7af6..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_hierarchy.rs +++ /dev/null @@ -1,95 +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::*; -use super::bevy_core::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyHierarchyScriptingPlugin; -impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::hierarchy::prelude::Children>::new(world) - .overwrite_script_function( - "swap", - | - _self: Mut, - a_index: usize, - b_index: usize| - { - let output: () = ::bevy::hierarchy::prelude::Children::swap( - _self.into(), - a_index.into(), - b_index.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::hierarchy::prelude::Parent>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::hierarchy::prelude::Parent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::hierarchy::HierarchyEvent>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::hierarchy::HierarchyEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::hierarchy::HierarchyEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs deleted file mode 100644 index db3d2207c3..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_input.rs +++ /dev/null @@ -1,1437 +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::*; -use super::bevy_core::*; -use super::bevy_math::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyInputScriptingPlugin; -impl ::bevy::app::Plugin for BevyInputScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::input::gamepad::Gamepad>::new(world) - .overwrite_script_function( - "vendor_id", - |_self: Ref| { - let output: std::option::Option = ::bevy::input::gamepad::Gamepad::vendor_id( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "product_id", - |_self: Ref| { - let output: std::option::Option = ::bevy::input::gamepad::Gamepad::product_id( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "pressed", - | - _self: Ref, - button_type: Val| - { - let output: bool = ::bevy::input::gamepad::Gamepad::pressed( - _self.into(), - button_type.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "just_pressed", - | - _self: Ref, - button_type: Val| - { - let output: bool = ::bevy::input::gamepad::Gamepad::just_pressed( - _self.into(), - button_type.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "just_released", - | - _self: Ref, - button_type: Val| - { - let output: bool = ::bevy::input::gamepad::Gamepad::just_released( - _self.into(), - button_type.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadAxis>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadAxis::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadAxis::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadButton>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadButton::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadButton::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadSettings>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadSettings::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::keyboard::KeyCode>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::KeyCode::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyCode::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::MouseButton>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::MouseButton::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseButton::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::touch::TouchInput>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::touch::TouchInput::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::touch::TouchInput::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::keyboard::KeyboardFocusLost>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyboardFocusLost::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::KeyboardFocusLost::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::keyboard::KeyboardInput>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::KeyboardInput::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyboardInput::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseMotion>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::AccumulatedMouseMotion::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::AccumulatedMouseMotion::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseScroll>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::AccumulatedMouseScroll::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::AccumulatedMouseScroll::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::MouseButtonInput>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::MouseButtonInput::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseButtonInput::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::MouseMotion>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::MouseMotion::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseMotion::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::MouseWheel>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseWheel::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::MouseWheel::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadAxisChangedEvent>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadAxisChangedEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadAxisChangedEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadButtonChangedEvent>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadButtonChangedEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadButtonChangedEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::< - ::bevy::input::gamepad::GamepadButtonStateChangedEvent, - >::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val< - bevy::input::gamepad::GamepadButtonStateChangedEvent, - > = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadConnection>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadConnection::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadConnection::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadConnectionEvent>::new(world) - .overwrite_script_function( - "connected", - |_self: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::connected( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "disconnected", - |_self: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::disconnected( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadConnectionEvent::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadEvent>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadEvent::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadInput>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadInput::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadInput::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleRequest>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleRequest::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::< - ::bevy::input::gamepad::RawGamepadAxisChangedEvent, - >::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::< - ::bevy::input::gamepad::RawGamepadButtonChangedEvent, - >::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val< - bevy::input::gamepad::RawGamepadButtonChangedEvent, - > = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::RawGamepadEvent>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::RawGamepadEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::RawGamepadEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gestures::PinchGesture>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gestures::PinchGesture::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gestures::PinchGesture::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gestures::RotationGesture>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gestures::RotationGesture::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gestures::RotationGesture::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gestures::DoubleTapGesture>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gestures::DoubleTapGesture::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gestures::DoubleTapGesture::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gestures::PanGesture>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gestures::PanGesture::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gestures::PanGesture::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::ButtonState>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::ButtonState::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_pressed", - |_self: Ref| { - let output: bool = ::bevy::input::ButtonState::is_pressed( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::ButtonState::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::ButtonState::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::ButtonSettings>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::ButtonSettings::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::ButtonSettings::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_pressed", - |_self: Ref, value: f32| { - let output: bool = ::bevy::input::gamepad::ButtonSettings::is_pressed( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_released", - |_self: Ref, value: f32| { - let output: bool = ::bevy::input::gamepad::ButtonSettings::is_released( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "press_threshold", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::press_threshold( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_press_threshold", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "release_threshold", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::release_threshold( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_release_threshold", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( - _self.into(), - value.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::AxisSettings>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::AxisSettings::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "livezone_upperbound", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_upperbound( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_livezone_upperbound", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "deadzone_upperbound", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_upperbound( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_deadzone_upperbound", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "livezone_lowerbound", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_lowerbound( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_livezone_lowerbound", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "deadzone_lowerbound", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_lowerbound( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_deadzone_lowerbound", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "threshold", - |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::threshold( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_threshold", - |_self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - |_self: Ref, new_value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::clamp( - _self.into(), - new_value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "filter", - | - _self: Ref, - new_value: f32, - old_value: std::option::Option| - { - let output: std::option::Option = ::bevy::input::gamepad::AxisSettings::filter( - _self.into(), - new_value.into(), - old_value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::AxisSettings::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::ButtonAxisSettings>::new(world) - .overwrite_script_function( - "filter", - | - _self: Ref, - new_value: f32, - old_value: std::option::Option| - { - let output: std::option::Option = ::bevy::input::gamepad::ButtonAxisSettings::filter( - _self.into(), - new_value.into(), - old_value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::ButtonAxisSettings::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleIntensity>::new(world) - .overwrite_script_function( - "weak_motor", - |intensity: f32| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( - intensity.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "strong_motor", - |intensity: f32| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( - intensity.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadRumbleIntensity::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::keyboard::Key>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::Key::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::keyboard::Key::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::Key::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::keyboard::NativeKeyCode>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::NativeKeyCode::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::keyboard::NativeKeyCode::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::keyboard::NativeKey>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::NativeKey::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::keyboard::NativeKey::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::mouse::MouseScrollUnit>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseScrollUnit::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::MouseScrollUnit::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::touch::TouchPhase>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::touch::TouchPhase::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::touch::TouchPhase::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::touch::ForceTouch>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::touch::ForceTouch::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::touch::ForceTouch::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs deleted file mode 100644 index 09e42ace0a..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_math.rs +++ /dev/null @@ -1,3548 +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_reflect::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyMathScriptingPlugin; -impl ::bevy::app::Plugin for BevyMathScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::math::AspectRatio>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::AspectRatio::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ratio", - |_self: Ref| { - let output: f32 = ::bevy::math::AspectRatio::ratio(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::AspectRatio::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_landscape", - |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_landscape( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_portrait", - |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_portrait( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_square", - |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_square(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::AspectRatio::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::CompassOctant>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::CompassOctant::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::CompassOctant::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::CompassOctant::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::CompassQuadrant>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::CompassQuadrant::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::CompassQuadrant::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::CompassQuadrant::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Isometry2d>::new(world) - .overwrite_script_function( - "mul", - | - _self: Val, - rhs: Val| - { - let output: Val = ::bevy::math::Isometry2d::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation", - |rotation: Val| { - let output: Val = ::bevy::math::Isometry2d::from_rotation( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xy", - |x: f32, y: f32| { - let output: Val = ::bevy::math::Isometry2d::from_xy( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Isometry2d::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse_mul", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Isometry2d::inverse_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Isometry2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Isometry2d::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Isometry2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Isometry3d>::new(world) - .overwrite_script_function( - "from_xyz", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Isometry3d::from_xyz( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Isometry3d::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse_mul", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Isometry3d::inverse_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Isometry3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Isometry3d::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - rhs: Val| - { - let output: Val = ::bevy::math::Isometry3d::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Isometry3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Ray2d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Ray2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Ray2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Ray3d>::new(world) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Ray3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Ray3d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Rot2>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Rot2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "radians", - |radians: f32| { - let output: Val = ::bevy::math::Rot2::radians( - radians.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "degrees", - |degrees: f32| { - let output: Val = ::bevy::math::Rot2::degrees( - degrees.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "turn_fraction", - |fraction: f32| { - let output: Val = ::bevy::math::Rot2::turn_fraction( - fraction.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_sin_cos", - |sin: f32, cos: f32| { - let output: Val = ::bevy::math::Rot2::from_sin_cos( - sin.into(), - cos.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_radians", - |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_radians(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_degrees", - |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_degrees(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_turn_fraction", - |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_turn_fraction(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "sin_cos", - |_self: Val| { - let output: (f32, f32) = ::bevy::math::Rot2::sin_cos(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::Rot2::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fast_renormalize", - |_self: Val| { - let output: Val = ::bevy::math::Rot2::fast_renormalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_near_identity", - |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_near_identity(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, other: Val| { - let output: f32 = ::bevy::math::Rot2::angle_between( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_to", - |_self: Val, other: Val| { - let output: f32 = ::bevy::math::Rot2::angle_to( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Val| { - let output: Val = ::bevy::math::Rot2::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "nlerp", - |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Rot2::nlerp( - _self.into(), - end.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slerp", - |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Rot2::slerp( - _self.into(), - end.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - direction: Val| - { - let output: Val = ::bevy::math::Rot2::mul( - _self.into(), - direction.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Rot2::eq(_self.into(), other.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Rot2::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::Dir2>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xy_unchecked", - |x: f32, y: f32| { - let output: Val = ::bevy::math::prelude::Dir2::from_xy_unchecked( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slerp", - | - _self: Val, - rhs: Val, - s: f32| - { - let output: Val = ::bevy::math::prelude::Dir2::slerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotation_to", - | - _self: Val, - other: Val| - { - let output: Val = ::bevy::math::prelude::Dir2::rotation_to( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotation_from", - | - _self: Val, - other: Val| - { - let output: Val = ::bevy::math::prelude::Dir2::rotation_from( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotation_from_x", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_from_x( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotation_to_x", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_to_x( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotation_from_y", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_from_y( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotation_to_y", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_to_y( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fast_renormalize", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::fast_renormalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Dir2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::neg( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::Dir3>::new(world) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Dir3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xyz_unchecked", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::prelude::Dir3::from_xyz_unchecked( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slerp", - | - _self: Val, - rhs: Val, - s: f32| - { - let output: Val = ::bevy::math::prelude::Dir3::slerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fast_renormalize", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3::fast_renormalize( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::Dir3A>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir3A::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3A::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Dir3A::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xyz_unchecked", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::prelude::Dir3A::from_xyz_unchecked( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slerp", - | - _self: Val, - rhs: Val, - s: f32| - { - let output: Val = ::bevy::math::prelude::Dir3A::slerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fast_renormalize", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3A::fast_renormalize( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::IRect>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::IRect::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::prelude::IRect::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x0: i32, y0: i32, x1: i32, y1: i32| { - let output: Val = ::bevy::math::prelude::IRect::new( - x0.into(), - y0.into(), - x1.into(), - y1.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_empty", - |_self: Ref| { - let output: bool = ::bevy::math::prelude::IRect::is_empty( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "width", - |_self: Ref| { - let output: i32 = ::bevy::math::prelude::IRect::width(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "height", - |_self: Ref| { - let output: i32 = ::bevy::math::prelude::IRect::height(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "union", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::IRect::union( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "intersect", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::IRect::intersect( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inflate", - |_self: Ref, expansion: i32| { - let output: Val = ::bevy::math::prelude::IRect::inflate( - _self.into(), - expansion.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_rect", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::as_rect( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_urect", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::as_urect( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::Rect>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Rect::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x0: f32, y0: f32, x1: f32, y1: f32| { - let output: Val = ::bevy::math::prelude::Rect::new( - x0.into(), - y0.into(), - x1.into(), - y1.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_empty", - |_self: Ref| { - let output: bool = ::bevy::math::prelude::Rect::is_empty( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "width", - |_self: Ref| { - let output: f32 = ::bevy::math::prelude::Rect::width(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "height", - |_self: Ref| { - let output: f32 = ::bevy::math::prelude::Rect::height(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "union", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::Rect::union( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "intersect", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::Rect::intersect( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inflate", - |_self: Ref, expansion: f32| { - let output: Val = ::bevy::math::prelude::Rect::inflate( - _self.into(), - expansion.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::Rect::normalize( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_irect", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Rect::as_irect( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_urect", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Rect::as_urect( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Rect::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::URect>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::URect::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x0: u32, y0: u32, x1: u32, y1: u32| { - let output: Val = ::bevy::math::prelude::URect::new( - x0.into(), - y0.into(), - x1.into(), - y1.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_empty", - |_self: Ref| { - let output: bool = ::bevy::math::prelude::URect::is_empty( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "width", - |_self: Ref| { - let output: u32 = ::bevy::math::prelude::URect::width(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "height", - |_self: Ref| { - let output: u32 = ::bevy::math::prelude::URect::height(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "union", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::URect::union( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "intersect", - | - _self: Ref, - other: Val| - { - let output: Val = ::bevy::math::prelude::URect::intersect( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inflate", - |_self: Ref, expansion: i32| { - let output: Val = ::bevy::math::prelude::URect::inflate( - _self.into(), - expansion.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_rect", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::as_rect( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_irect", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::as_irect( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::prelude::URect::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Affine3>::new(world); - NamespaceBuilder::<::bevy::math::bounding::Aabb2d>::new(world) - .overwrite_script_function( - "bounding_circle", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb2d::bounding_circle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb2d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::BoundingCircle>::new(world) - .overwrite_script_function( - "radius", - |_self: Ref| { - let output: f32 = ::bevy::math::bounding::BoundingCircle::radius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "aabb_2d", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircle::aabb_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircle::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Circle>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Circle::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |radius: f32| { - let output: Val = ::bevy::math::primitives::Circle::new( - radius.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "diameter", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Circle::diameter( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Circle::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Annulus>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Annulus::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Annulus::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |inner_radius: f32, outer_radius: f32| { - let output: Val = ::bevy::math::primitives::Annulus::new( - inner_radius.into(), - outer_radius.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "diameter", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Annulus::diameter( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "thickness", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Annulus::thickness( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Arc2d>::new(world) - .overwrite_script_function( - "new", - |radius: f32, half_angle: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::new( - radius.into(), - half_angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_radians", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::from_radians( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_degrees", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::from_degrees( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_turns", - |radius: f32, fraction: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::from_turns( - radius.into(), - fraction.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::angle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "half_chord_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::half_chord_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "chord_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::chord_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "apothem", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::apothem( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sagitta", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::sagitta( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_minor", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::is_minor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_major", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::is_major( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Arc2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Arc2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Capsule2d>::new(world) - .overwrite_script_function( - "new", - |radius: f32, length: f32| { - let output: Val = ::bevy::math::primitives::Capsule2d::new( - radius.into(), - length.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_inner_rectangle", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule2d::to_inner_rectangle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Capsule2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule2d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::CircularSector>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::CircularSector::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::new( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_radians", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::from_radians( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_degrees", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::from_degrees( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_turns", - |radius: f32, fraction: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::from_turns( - radius.into(), - fraction.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "half_angle", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::half_angle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::angle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "radius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::radius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "arc_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::arc_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "half_chord_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::half_chord_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "chord_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::chord_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "apothem", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::apothem( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sagitta", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::sagitta( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::CircularSector::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::CircularSegment>::new(world) - .overwrite_script_function( - "new", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::new( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_radians", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::from_radians( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_degrees", - |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::from_degrees( - radius.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_turns", - |radius: f32, fraction: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::from_turns( - radius.into(), - fraction.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "half_angle", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::half_angle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::angle( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "radius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::radius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "arc_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::arc_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "half_chord_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::half_chord_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "chord_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::chord_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "apothem", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::apothem( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sagitta", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::sagitta( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::CircularSegment::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::CircularSegment::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Ellipse>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Ellipse::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |half_width: f32, half_height: f32| { - let output: Val = ::bevy::math::primitives::Ellipse::new( - half_width.into(), - half_height.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eccentricity", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::eccentricity( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "focal_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::focal_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "semi_major", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::semi_major( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "semi_minor", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::semi_minor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Ellipse::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Line2d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Line2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Line2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Plane2d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Plane2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Plane2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Rectangle>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Rectangle::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |width: f32, height: f32| { - let output: Val = ::bevy::math::primitives::Rectangle::new( - width.into(), - height.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_length", - |length: f32| { - let output: Val = ::bevy::math::primitives::Rectangle::from_length( - length.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Rectangle::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::RegularPolygon>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::RegularPolygon::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |circumradius: f32, sides: u32| { - let output: Val = ::bevy::math::primitives::RegularPolygon::new( - circumradius.into(), - sides.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "circumradius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::circumradius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inradius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::inradius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "side_length", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::side_length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "internal_angle_degrees", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_degrees( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "internal_angle_radians", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_radians( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "external_angle_degrees", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_degrees( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "external_angle_radians", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_radians( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::RegularPolygon::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Rhombus>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Rhombus::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |horizontal_diagonal: f32, vertical_diagonal: f32| { - let output: Val = ::bevy::math::primitives::Rhombus::new( - horizontal_diagonal.into(), - vertical_diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_side", - |side: f32| { - let output: Val = ::bevy::math::primitives::Rhombus::from_side( - side.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_inradius", - |inradius: f32| { - let output: Val = ::bevy::math::primitives::Rhombus::from_inradius( - inradius.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "side", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::side( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "circumradius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::circumradius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inradius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::inradius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Rhombus::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Segment2d>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Segment2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |direction: Val, length: f32| { - let output: Val = ::bevy::math::primitives::Segment2d::new( - direction.into(), - length.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Segment2d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Triangle2d>::new(world) - .overwrite_script_function( - "is_degenerate", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::is_degenerate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_acute", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::is_acute( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_obtuse", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::is_obtuse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reverse", - |_self: Mut| { - let output: () = ::bevy::math::primitives::Triangle2d::reverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reversed", - |_self: Val| { - let output: Val = ::bevy::math::primitives::Triangle2d::reversed( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Triangle2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Triangle2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::Aabb3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "bounding_sphere", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb3d::bounding_sphere( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::BoundingSphere>::new(world) - .overwrite_script_function( - "radius", - |_self: Ref| { - let output: f32 = ::bevy::math::bounding::BoundingSphere::radius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "aabb_3d", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphere::aabb_3d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphere::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Sphere>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Sphere::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Sphere::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |radius: f32| { - let output: Val = ::bevy::math::primitives::Sphere::new( - radius.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "diameter", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Sphere::diameter( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Cuboid>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cuboid::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Cuboid::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x_length: f32, y_length: f32, z_length: f32| { - let output: Val = ::bevy::math::primitives::Cuboid::new( - x_length.into(), - y_length.into(), - z_length.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_length", - |length: f32| { - let output: Val = ::bevy::math::primitives::Cuboid::from_length( - length.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Cylinder>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cylinder::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Cylinder::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |radius: f32, height: f32| { - let output: Val = ::bevy::math::primitives::Cylinder::new( - radius.into(), - height.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "base", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cylinder::base( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lateral_area", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cylinder::lateral_area( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "base_area", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cylinder::base_area( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Capsule3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Capsule3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |radius: f32, length: f32| { - let output: Val = ::bevy::math::primitives::Capsule3d::new( - radius.into(), - length.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cylinder", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule3d::to_cylinder( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Cone>::new(world) - .overwrite_script_function( - "new", - |radius: f32, height: f32| { - let output: Val = ::bevy::math::primitives::Cone::new( - radius.into(), - height.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "base", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cone::base( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slant_height", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::slant_height( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lateral_area", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::lateral_area( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "base_area", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::base_area( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cone::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Cone::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::ConicalFrustum>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::ConicalFrustum::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::ConicalFrustum::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::InfinitePlane3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::InfinitePlane3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::InfinitePlane3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Line3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Line3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Line3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Segment3d>::new(world) - .overwrite_script_function( - "new", - |direction: Val, length: f32| { - let output: Val = ::bevy::math::primitives::Segment3d::new( - direction.into(), - length.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Segment3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Segment3d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Torus>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Torus::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Torus::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |inner_radius: f32, outer_radius: f32| { - let output: Val = ::bevy::math::primitives::Torus::new( - inner_radius.into(), - outer_radius.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inner_radius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Torus::inner_radius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "outer_radius", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Torus::outer_radius( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Triangle3d>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Triangle3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_degenerate", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::is_degenerate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_acute", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::is_acute( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_obtuse", - |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::is_obtuse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reverse", - |_self: Mut| { - let output: () = ::bevy::math::primitives::Triangle3d::reverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reversed", - |_self: Val| { - let output: Val = ::bevy::math::primitives::Triangle3d::reversed( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Triangle3d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::RayCast2d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::RayCast2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_ray", - |ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::RayCast2d::from_ray( - ray.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "aabb_intersection_at", - | - _self: Ref, - aabb: Ref| - { - let output: std::option::Option = ::bevy::math::bounding::RayCast2d::aabb_intersection_at( - _self.into(), - aabb.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "circle_intersection_at", - | - _self: Ref, - circle: Ref| - { - let output: std::option::Option = ::bevy::math::bounding::RayCast2d::circle_intersection_at( - _self.into(), - circle.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::AabbCast2d>::new(world) - .overwrite_script_function( - "from_ray", - | - aabb: Val, - ray: Val, - max: f32| - { - let output: Val = ::bevy::math::bounding::AabbCast2d::from_ray( - aabb.into(), - ray.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "aabb_collision_at", - | - _self: Ref, - aabb: Val| - { - let output: std::option::Option = ::bevy::math::bounding::AabbCast2d::aabb_collision_at( - _self.into(), - aabb.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::AabbCast2d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::BoundingCircleCast>::new(world) - .overwrite_script_function( - "from_ray", - | - circle: Val, - ray: Val, - max: f32| - { - let output: Val = ::bevy::math::bounding::BoundingCircleCast::from_ray( - circle.into(), - ray.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "circle_collision_at", - | - _self: Ref, - circle: Val| - { - let output: std::option::Option = ::bevy::math::bounding::BoundingCircleCast::circle_collision_at( - _self.into(), - circle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircleCast::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::RayCast3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::RayCast3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_ray", - |ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::RayCast3d::from_ray( - ray.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "aabb_intersection_at", - | - _self: Ref, - aabb: Ref| - { - let output: std::option::Option = ::bevy::math::bounding::RayCast3d::aabb_intersection_at( - _self.into(), - aabb.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sphere_intersection_at", - | - _self: Ref, - sphere: Ref| - { - let output: std::option::Option = ::bevy::math::bounding::RayCast3d::sphere_intersection_at( - _self.into(), - sphere.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::AabbCast3d>::new(world) - .overwrite_script_function( - "from_ray", - | - aabb: Val, - ray: Val, - max: f32| - { - let output: Val = ::bevy::math::bounding::AabbCast3d::from_ray( - aabb.into(), - ray.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "aabb_collision_at", - | - _self: Ref, - aabb: Val| - { - let output: std::option::Option = ::bevy::math::bounding::AabbCast3d::aabb_collision_at( - _self.into(), - aabb.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::AabbCast3d::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::bounding::BoundingSphereCast>::new(world) - .overwrite_script_function( - "from_ray", - | - sphere: Val, - ray: Val, - max: f32| - { - let output: Val = ::bevy::math::bounding::BoundingSphereCast::from_ray( - sphere.into(), - ray.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sphere_collision_at", - | - _self: Ref, - sphere: Val| - { - let output: std::option::Option = ::bevy::math::bounding::BoundingSphereCast::sphere_collision_at( - _self.into(), - sphere.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphereCast::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::curve::interval::Interval>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::curve::interval::Interval::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "start", - |_self: Val| { - let output: f32 = ::bevy::math::curve::interval::Interval::start( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "end", - |_self: Val| { - let output: f32 = ::bevy::math::curve::interval::Interval::end( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::curve::interval::Interval::length( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_bounded", - |_self: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::is_bounded( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "has_finite_start", - |_self: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::has_finite_start( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "has_finite_end", - |_self: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::has_finite_end( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "contains", - |_self: Val, item: f32| { - let output: bool = ::bevy::math::curve::interval::Interval::contains( - _self.into(), - item.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "contains_interval", - | - _self: Val, - other: Val| - { - let output: bool = ::bevy::math::curve::interval::Interval::contains_interval( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - |_self: Val, value: f32| { - let output: f32 = ::bevy::math::curve::interval::Interval::clamp( - _self.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::curve::interval::Interval::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::FloatOrd>::new(world) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::FloatOrd::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::FloatOrd::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lt", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::lt( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "le", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::le( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "gt", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::gt( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ge", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::ge( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Plane3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Plane3d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Plane3d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Tetrahedron>::new(world) - .overwrite_script_function( - "signed_volume", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Tetrahedron::signed_volume( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Tetrahedron::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Tetrahedron::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::curve::easing::EaseFunction>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::curve::easing::EaseFunction::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::curve::easing::EaseFunction::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs deleted file mode 100644 index 603a8e68d0..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_reflect.rs +++ /dev/null @@ -1,22507 +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 bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyReflectScriptingPlugin; -impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::std::sync::atomic::AtomicBool>::new(world) - .overwrite_script_function( - "new", - |v: bool| { - let output: Val = ::std::sync::atomic::AtomicBool::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: bool = ::std::sync::atomic::AtomicBool::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicI16>::new(world) - .overwrite_script_function( - "new", - |v: i16| { - let output: Val = ::std::sync::atomic::AtomicI16::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: i16 = ::std::sync::atomic::AtomicI16::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicI32>::new(world) - .overwrite_script_function( - "new", - |v: i32| { - let output: Val = ::std::sync::atomic::AtomicI32::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: i32 = ::std::sync::atomic::AtomicI32::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicI64>::new(world) - .overwrite_script_function( - "new", - |v: i64| { - let output: Val = ::std::sync::atomic::AtomicI64::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: i64 = ::std::sync::atomic::AtomicI64::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicI8>::new(world) - .overwrite_script_function( - "new", - |v: i8| { - let output: Val = ::std::sync::atomic::AtomicI8::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: i8 = ::std::sync::atomic::AtomicI8::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicIsize>::new(world) - .overwrite_script_function( - "new", - |v: isize| { - let output: Val = ::std::sync::atomic::AtomicIsize::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: isize = ::std::sync::atomic::AtomicIsize::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicU16>::new(world) - .overwrite_script_function( - "new", - |v: u16| { - let output: Val = ::std::sync::atomic::AtomicU16::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: u16 = ::std::sync::atomic::AtomicU16::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicU32>::new(world) - .overwrite_script_function( - "new", - |v: u32| { - let output: Val = ::std::sync::atomic::AtomicU32::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: u32 = ::std::sync::atomic::AtomicU32::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicU64>::new(world) - .overwrite_script_function( - "new", - |v: u64| { - let output: Val = ::std::sync::atomic::AtomicU64::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: u64 = ::std::sync::atomic::AtomicU64::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicU8>::new(world) - .overwrite_script_function( - "new", - |v: u8| { - let output: Val = ::std::sync::atomic::AtomicU8::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: u8 = ::std::sync::atomic::AtomicU8::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::sync::atomic::AtomicUsize>::new(world) - .overwrite_script_function( - "new", - |v: usize| { - let output: Val = ::std::sync::atomic::AtomicUsize::new( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "into_inner", - |_self: Val| { - let output: usize = ::std::sync::atomic::AtomicUsize::into_inner( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::utils::Duration>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::utils::Duration::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::utils::Duration::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::utils::Duration::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::utils::Duration::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::utils::Duration::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |secs: u64, nanos: u32| { - let output: Val = ::bevy::utils::Duration::new( - secs.into(), - nanos.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_secs", - |secs: u64| { - let output: Val = ::bevy::utils::Duration::from_secs( - secs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_millis", - |millis: u64| { - let output: Val = ::bevy::utils::Duration::from_millis( - millis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_micros", - |micros: u64| { - let output: Val = ::bevy::utils::Duration::from_micros( - micros.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_nanos", - |nanos: u64| { - let output: Val = ::bevy::utils::Duration::from_nanos( - nanos.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_zero", - |_self: Ref| { - let output: bool = ::bevy::utils::Duration::is_zero(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_secs", - |_self: Ref| { - let output: u64 = ::bevy::utils::Duration::as_secs(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "subsec_millis", - |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_millis( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "subsec_micros", - |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_micros( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "subsec_nanos", - |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_nanos(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_millis", - |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_millis(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_micros", - |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_micros(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_nanos", - |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_nanos(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff", - |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Duration::abs_diff( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::utils::Duration::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_secs_f64", - |_self: Ref| { - let output: f64 = ::bevy::utils::Duration::as_secs_f64(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_secs_f32", - |_self: Ref| { - let output: f32 = ::bevy::utils::Duration::as_secs_f32(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "from_secs_f64", - |secs: f64| { - let output: Val = ::bevy::utils::Duration::from_secs_f64( - secs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_secs_f32", - |secs: f32| { - let output: Val = ::bevy::utils::Duration::from_secs_f32( - secs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_f64", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::utils::Duration::mul_f64( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_f32", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::utils::Duration::mul_f32( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_f64", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::utils::Duration::div_f64( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_f32", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::utils::Duration::div_f32( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_duration_f64", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::utils::Duration::div_duration_f64( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_duration_f32", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::utils::Duration::div_duration_f32( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::utils::Instant>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::utils::Instant::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::utils::Instant::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Instant::sub( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Instant::sub( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "now", - || { - let output: Val = ::bevy::utils::Instant::now() - .into(); - output - }, - ) - .overwrite_script_function( - "duration_since", - |_self: Ref, earlier: Val| { - let output: Val = ::bevy::utils::Instant::duration_since( - _self.into(), - earlier.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_duration_since", - |_self: Ref, earlier: Val| { - let output: Val = ::bevy::utils::Instant::saturating_duration_since( - _self.into(), - earlier.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "elapsed", - |_self: Ref| { - let output: Val = ::bevy::utils::Instant::elapsed( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::utils::Instant::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Instant::add( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::std::ops::RangeFull>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::std::ops::RangeFull::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::std::ops::RangeFull::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::std::ops::RangeFull::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Quat>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Quat::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Quat::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xyzw", - |x: f32, y: f32, z: f32, w: f32| { - let output: Val = ::bevy::math::Quat::from_xyzw( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f32; 4]| { - let output: Val = ::bevy::math::Quat::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_vec4", - |v: Val| { - let output: Val = ::bevy::math::Quat::from_vec4( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Quat::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scaled_axis", - |v: Val| { - let output: Val = ::bevy::math::Quat::from_scaled_axis( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f32| { - let output: Val = ::bevy::math::Quat::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f32| { - let output: Val = ::bevy::math::Quat::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f32| { - let output: Val = ::bevy::math::Quat::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |euler: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Quat::from_euler( - euler.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |mat: Ref| { - let output: Val = ::bevy::math::Quat::from_mat3( - mat.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3a", - |mat: Ref| { - let output: Val = ::bevy::math::Quat::from_mat3a( - mat.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |mat: Ref| { - let output: Val = ::bevy::math::Quat::from_mat4( - mat.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_arc", - |from: Val, to: Val| { - let output: Val = ::bevy::math::Quat::from_rotation_arc( - from.into(), - to.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_arc_colinear", - |from: Val, to: Val| { - let output: Val = ::bevy::math::Quat::from_rotation_arc_colinear( - from.into(), - to.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_arc_2d", - |from: Val, to: Val| { - let output: Val = ::bevy::math::Quat::from_rotation_arc_2d( - from.into(), - to.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_scaled_axis", - |_self: Val| { - let output: Val = ::bevy::math::Quat::to_scaled_axis( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Val, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Quat::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Quat::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "xyz", - |_self: Val| { - let output: Val = ::bevy::math::Quat::xyz( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "conjugate", - |_self: Val| { - let output: Val = ::bevy::math::Quat::conjugate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Val| { - let output: Val = ::bevy::math::Quat::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Quat::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::Quat::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f32 = ::bevy::math::Quat::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f32 = ::bevy::math::Quat::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::Quat::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::Quat::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::Quat::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::Quat::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_near_identity", - |_self: Val| { - let output: bool = ::bevy::math::Quat::is_near_identity(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Quat::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_towards", - | - _self: Ref, - rhs: Val, - max_angle: f32| - { - let output: Val = ::bevy::math::Quat::rotate_towards( - _self.into(), - rhs.into(), - max_angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Quat::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Quat::lerp( - _self.into(), - end.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slerp", - |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Quat::slerp( - _self.into(), - end.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul_vec3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_quat", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul_quat( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_affine3", - |a: Ref| { - let output: Val = ::bevy::math::Quat::from_affine3( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3a", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul_vec3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dquat", - |_self: Val| { - let output: Val = ::bevy::math::Quat::as_dquat( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Quat::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Quat::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Vec3>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Vec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f32| { - let output: Val = ::bevy::math::Vec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f32; 3]| { - let output: Val = ::bevy::math::Vec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f32; 3] = ::bevy::math::Vec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::Vec3::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::Vec3::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec3::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec3::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec3::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec3::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Vec3::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec3::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec3::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec3::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::Vec3::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec3::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - |_self: Val, normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec3::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "any_orthogonal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::any_orthogonal_vector( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "any_orthonormal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::any_orthonormal_vector( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_dvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_ivec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_uvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_i64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Vec3::eq(_self.into(), other.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::IVec2>::new(world) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::IVec2::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i32, y: i32| { - let output: Val = ::bevy::math::IVec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i32| { - let output: Val = ::bevy::math::IVec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::IVec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i32; 2]| { - let output: Val = ::bevy::math::IVec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i32; 2] = ::bevy::math::IVec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::IVec2::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: i32 = ::bevy::math::IVec2::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: i32 = ::bevy::math::IVec2::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: i32 = ::bevy::math::IVec2::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: i32 = ::bevy::math::IVec2::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::IVec2::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::IVec2::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::IVec2::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: i32 = ::bevy::math::IVec2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp", - |_self: Val| { - let output: Val = ::bevy::math::IVec2::perp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp_dot", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::perp_dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rotate( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec2", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec2", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_dvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec2", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_uvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_i64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_u64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::IVec2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::IVec3>::new(world) - .overwrite_script_function( - "rem", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::IVec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i32, y: i32, z: i32| { - let output: Val = ::bevy::math::IVec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i32| { - let output: Val = ::bevy::math::IVec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::IVec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i32; 3]| { - let output: Val = ::bevy::math::IVec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i32; 3] = ::bevy::math::IVec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: i32| { - let output: Val = ::bevy::math::IVec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::IVec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec3::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::IVec3::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: i32 = ::bevy::math::IVec3::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: i32 = ::bevy::math::IVec3::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: i32 = ::bevy::math::IVec3::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: i32 = ::bevy::math::IVec3::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::IVec3::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::IVec3::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::IVec3::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: i32 = ::bevy::math::IVec3::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec3::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3a", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_vec3a( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec3", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_dvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_uvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_i64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::IVec3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::IVec3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::IVec4>::new(world) - .overwrite_script_function( - "add", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i32, y: i32, z: i32, w: i32| { - let output: Val = ::bevy::math::IVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i32| { - let output: Val = ::bevy::math::IVec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::IVec4::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i32; 4]| { - let output: Val = ::bevy::math::IVec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i32; 4] = ::bevy::math::IVec4::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::IVec4::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec4::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec4::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec4::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_w", - |_self: Val, w: i32| { - let output: Val = ::bevy::math::IVec4::with_w( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec4::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::IVec4::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: i32 = ::bevy::math::IVec4::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: i32 = ::bevy::math::IVec4::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: i32 = ::bevy::math::IVec4::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: i32 = ::bevy::math::IVec4::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::IVec4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::IVec4::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::IVec4::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: i32 = ::bevy::math::IVec4::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec4::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec4", - |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec4", - |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_dvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec4", - |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_uvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_i64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_u64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::IVec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::IVec4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::IVec4::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::I64Vec2>::new(world) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::I64Vec2::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i64, y: i64| { - let output: Val = ::bevy::math::I64Vec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i64| { - let output: Val = ::bevy::math::I64Vec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::I64Vec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i64; 2]| { - let output: Val = ::bevy::math::I64Vec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i64; 2] = ::bevy::math::I64Vec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: i64| { - let output: Val = ::bevy::math::I64Vec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i64| { - let output: Val = ::bevy::math::I64Vec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i64| { - let output: Val = ::bevy::math::I64Vec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec2::dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::I64Vec2::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::element_product( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::I64Vec2::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec2::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::perp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp_dot", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec2::perp_dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rotate( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec2", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec2", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_dvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec2", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_ivec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec2", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_uvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_u64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::I64Vec3>::new(world) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::I64Vec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i64, y: i64, z: i64| { - let output: Val = ::bevy::math::I64Vec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i64| { - let output: Val = ::bevy::math::I64Vec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::I64Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i64; 3]| { - let output: Val = ::bevy::math::I64Vec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i64; 3] = ::bevy::math::I64Vec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: i64| { - let output: Val = ::bevy::math::I64Vec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i64| { - let output: Val = ::bevy::math::I64Vec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i64| { - let output: Val = ::bevy::math::I64Vec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: i64| { - let output: Val = ::bevy::math::I64Vec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec3::dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::I64Vec3::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::element_product( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::I64Vec3::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec3::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3a", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_vec3a( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec3", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_dvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_ivec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_uvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::I64Vec4>::new(world) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::I64Vec4::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i64, y: i64, z: i64, w: i64| { - let output: Val = ::bevy::math::I64Vec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i64| { - let output: Val = ::bevy::math::I64Vec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::I64Vec4::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i64; 4]| { - let output: Val = ::bevy::math::I64Vec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i64; 4] = ::bevy::math::I64Vec4::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i64| { - let output: Val = ::bevy::math::I64Vec4::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i64| { - let output: Val = ::bevy::math::I64Vec4::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: i64| { - let output: Val = ::bevy::math::I64Vec4::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_w", - |_self: Val, w: i64| { - let output: Val = ::bevy::math::I64Vec4::with_w( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec4::dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::I64Vec4::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::element_product( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::I64Vec4::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec4::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec4", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec4", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_dvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec4", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_ivec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec4", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_uvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_u64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_add_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub_unsigned", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_sub_unsigned( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::UVec2>::new(world) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::UVec2::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u32, y: u32| { - let output: Val = ::bevy::math::UVec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u32| { - let output: Val = ::bevy::math::UVec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::UVec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u32; 2]| { - let output: Val = ::bevy::math::UVec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u32; 2] = ::bevy::math::UVec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: u32| { - let output: Val = ::bevy::math::UVec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u32| { - let output: Val = ::bevy::math::UVec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u32| { - let output: Val = ::bevy::math::UVec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec2::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::UVec2::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec2::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec2::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: u32 = ::bevy::math::UVec2::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: u32 = ::bevy::math::UVec2::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: u32 = ::bevy::math::UVec2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec2", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec2", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_dvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec2", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_ivec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_i64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_u64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::UVec3>::new(world) - .overwrite_script_function( - "div", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u32, y: u32, z: u32| { - let output: Val = ::bevy::math::UVec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u32| { - let output: Val = ::bevy::math::UVec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::UVec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u32; 3]| { - let output: Val = ::bevy::math::UVec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u32; 3] = ::bevy::math::UVec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: u32| { - let output: Val = ::bevy::math::UVec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::UVec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u32| { - let output: Val = ::bevy::math::UVec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u32| { - let output: Val = ::bevy::math::UVec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: u32| { - let output: Val = ::bevy::math::UVec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec3::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::UVec3::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec3::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec3::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: u32 = ::bevy::math::UVec3::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: u32 = ::bevy::math::UVec3::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: u32 = ::bevy::math::UVec3::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3a", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_vec3a( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec3", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_dvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_ivec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_i64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::UVec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::UVec4>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::UVec4::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u32, y: u32, z: u32, w: u32| { - let output: Val = ::bevy::math::UVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u32| { - let output: Val = ::bevy::math::UVec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::UVec4::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u32; 4]| { - let output: Val = ::bevy::math::UVec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u32; 4] = ::bevy::math::UVec4::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::UVec4::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u32| { - let output: Val = ::bevy::math::UVec4::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u32| { - let output: Val = ::bevy::math::UVec4::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: u32| { - let output: Val = ::bevy::math::UVec4::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_w", - |_self: Val, w: u32| { - let output: Val = ::bevy::math::UVec4::with_w( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec4::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::UVec4::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec4::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec4::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: u32 = ::bevy::math::UVec4::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: u32 = ::bevy::math::UVec4::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: u32 = ::bevy::math::UVec4::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec4", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec4", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_dvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec4", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_ivec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_i64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_u64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::U64Vec2>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::U64Vec2::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u64, y: u64| { - let output: Val = ::bevy::math::U64Vec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u64| { - let output: Val = ::bevy::math::U64Vec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::U64Vec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u64; 2]| { - let output: Val = ::bevy::math::U64Vec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u64; 2] = ::bevy::math::U64Vec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: u64| { - let output: Val = ::bevy::math::U64Vec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: u64 = ::bevy::math::U64Vec2::dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::U64Vec2::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::element_product( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec2", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec2", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_dvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec2", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_ivec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec2", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_uvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_i64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::U64Vec3>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u64, y: u64, z: u64| { - let output: Val = ::bevy::math::U64Vec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u64| { - let output: Val = ::bevy::math::U64Vec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::U64Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u64; 3]| { - let output: Val = ::bevy::math::U64Vec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u64; 3] = ::bevy::math::U64Vec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: u64| { - let output: Val = ::bevy::math::U64Vec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::U64Vec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: u64| { - let output: Val = ::bevy::math::U64Vec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: u64 = ::bevy::math::U64Vec3::dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::U64Vec3::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::element_product( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3a", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_vec3a( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec3", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_dvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_ivec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_uvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_i64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::U64Vec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::U64Vec4>::new(world) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::U64Vec4::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u64, y: u64, z: u64, w: u64| { - let output: Val = ::bevy::math::U64Vec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u64| { - let output: Val = ::bevy::math::U64Vec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::U64Vec4::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u64; 4]| { - let output: Val = ::bevy::math::U64Vec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u64; 4] = ::bevy::math::U64Vec4::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::U64Vec4::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec4::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec4::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: u64| { - let output: Val = ::bevy::math::U64Vec4::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_w", - |_self: Val, w: u64| { - let output: Val = ::bevy::math::U64Vec4::with_w( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: u64 = ::bevy::math::U64Vec4::dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::U64Vec4::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::element_product( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec4", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec4", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_dvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec4", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_ivec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec4", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_uvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_i64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "wrapping_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "saturating_add_signed", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_add_signed( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Vec2>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: f32, y: f32| { - let output: Val = ::bevy::math::Vec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f32| { - let output: Val = ::bevy::math::Vec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::Vec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f32; 2]| { - let output: Val = ::bevy::math::Vec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f32; 2] = ::bevy::math::Vec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::Vec2::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::Vec2::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec2::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec2::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec2::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec2::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Vec2::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec2::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec2::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec2::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::Vec2::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec2::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - |_self: Val, normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec2::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f32| { - let output: Val = ::bevy::math::Vec2::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_angle", - |_self: Val| { - let output: f32 = ::bevy::math::Vec2::to_angle(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_to", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::angle_to( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::perp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp_dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::perp_dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rotate( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_towards", - | - _self: Ref, - rhs: Val, - max_angle: f32| - { - let output: Val = ::bevy::math::Vec2::rotate_towards( - _self.into(), - rhs.into(), - max_angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec2", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_dvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec2", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_ivec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec2", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_uvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_i64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_u64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Vec2::eq(_self.into(), other.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Vec3A>::new(world) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Vec3A::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f32| { - let output: Val = ::bevy::math::Vec3A::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::Vec3A::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f32; 3]| { - let output: Val = ::bevy::math::Vec3A::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f32; 3] = ::bevy::math::Vec3A::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "from_vec4", - |v: Val| { - let output: Val = ::bevy::math::Vec3A::from_vec4( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec3A::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec3A::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec3A::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec3A::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::Vec3A::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::Vec3A::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec3A::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec3A::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec3A::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec3A::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Vec3A::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec3A::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec3A::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec3A::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::Vec3A::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec3A::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - | - _self: Val, - normal: Val, - eta: f32| - { - let output: Val = ::bevy::math::Vec3A::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "any_orthogonal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::any_orthogonal_vector( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "any_orthonormal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::any_orthonormal_vector( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_dvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_ivec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_uvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_i64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Vec3A::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Vec4>::new(world) - .overwrite_script_function( - "new", - |x: f32, y: f32, z: f32, w: f32| { - let output: Val = ::bevy::math::Vec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f32| { - let output: Val = ::bevy::math::Vec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::Vec4::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f32; 4]| { - let output: Val = ::bevy::math::Vec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Vec4::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec4::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec4::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec4::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_w", - |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec4::with_w( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::Vec4::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::Vec4::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec4::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec4::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec4::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec4::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Vec4::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec4::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec4::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec4::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::Vec4::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec4::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - |_self: Val, normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec4::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dvec4", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_dvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec4", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_ivec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec4", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_uvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_i64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_u64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Vec4::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::BVec2>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::BVec2::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: bool, y: bool| { - let output: Val = ::bevy::math::BVec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: bool| { - let output: Val = ::bevy::math::BVec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [bool; 2]| { - let output: Val = ::bevy::math::BVec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::BVec2::bitmask(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "any", - |_self: Val| { - let output: bool = ::bevy::math::BVec2::any(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "all", - |_self: Val| { - let output: bool = ::bevy::math::BVec2::all(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "test", - |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec2::test( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set", - |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec2::set( - _self.into(), - index.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::BVec3>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::BVec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: bool, y: bool, z: bool| { - let output: Val = ::bevy::math::BVec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: bool| { - let output: Val = ::bevy::math::BVec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [bool; 3]| { - let output: Val = ::bevy::math::BVec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::BVec3::bitmask(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "any", - |_self: Val| { - let output: bool = ::bevy::math::BVec3::any(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "all", - |_self: Val| { - let output: bool = ::bevy::math::BVec3::all(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "test", - |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec3::test( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set", - |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3::set( - _self.into(), - index.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::BVec4>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::BVec4::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: bool, y: bool, z: bool, w: bool| { - let output: Val = ::bevy::math::BVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: bool| { - let output: Val = ::bevy::math::BVec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [bool; 4]| { - let output: Val = ::bevy::math::BVec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::BVec4::bitmask(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "any", - |_self: Val| { - let output: bool = ::bevy::math::BVec4::any(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "all", - |_self: Val| { - let output: bool = ::bevy::math::BVec4::all(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "test", - |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec4::test( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set", - |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4::set( - _self.into(), - index.into(), - value.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DVec2>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: f64, y: f64| { - let output: Val = ::bevy::math::DVec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f64| { - let output: Val = ::bevy::math::DVec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::DVec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f64; 2]| { - let output: Val = ::bevy::math::DVec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f64; 2] = ::bevy::math::DVec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: f64| { - let output: Val = ::bevy::math::DVec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f64| { - let output: Val = ::bevy::math::DVec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f64| { - let output: Val = ::bevy::math::DVec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::DVec2::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::DVec2::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::DVec2::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f64| { - let output: Val = ::bevy::math::DVec2::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f64| { - let output: Val = ::bevy::math::DVec2::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f64| { - let output: Val = ::bevy::math::DVec2::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DVec2::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f64, max: f64| { - let output: Val = ::bevy::math::DVec2::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f64| { - let output: Val = ::bevy::math::DVec2::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f64| { - let output: Val = ::bevy::math::DVec2::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::DVec2::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::DVec2::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - | - _self: Val, - normal: Val, - eta: f64| - { - let output: Val = ::bevy::math::DVec2::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f64| { - let output: Val = ::bevy::math::DVec2::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_angle", - |_self: Val| { - let output: f64 = ::bevy::math::DVec2::to_angle(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_to", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::angle_to( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::perp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perp_dot", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::perp_dot( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rotate( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_towards", - | - _self: Ref, - rhs: Val, - max_angle: f64| - { - let output: Val = ::bevy::math::DVec2::rotate_towards( - _self.into(), - rhs.into(), - max_angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec2", - |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec2", - |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_ivec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec2", - |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_uvec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_i64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec2", - |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_u64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec2::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DVec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DVec3>::new(world) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: f64, y: f64, z: f64| { - let output: Val = ::bevy::math::DVec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f64| { - let output: Val = ::bevy::math::DVec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::DVec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f64; 3]| { - let output: Val = ::bevy::math::DVec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f64; 3] = ::bevy::math::DVec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: f64| { - let output: Val = ::bevy::math::DVec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f64| { - let output: Val = ::bevy::math::DVec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f64| { - let output: Val = ::bevy::math::DVec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: f64| { - let output: Val = ::bevy::math::DVec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cross", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cross( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::DVec3::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::DVec3::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::DVec3::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f64| { - let output: Val = ::bevy::math::DVec3::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f64| { - let output: Val = ::bevy::math::DVec3::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f64| { - let output: Val = ::bevy::math::DVec3::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DVec3::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f64, max: f64| { - let output: Val = ::bevy::math::DVec3::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f64| { - let output: Val = ::bevy::math::DVec3::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f64| { - let output: Val = ::bevy::math::DVec3::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::DVec3::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::DVec3::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - | - _self: Val, - normal: Val, - eta: f64| - { - let output: Val = ::bevy::math::DVec3::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "any_orthogonal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::any_orthogonal_vector( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "any_orthonormal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::any_orthonormal_vector( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec3a", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_vec3a( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_ivec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_uvec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_i64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DVec4>::new(world) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: f64, y: f64, z: f64, w: f64| { - let output: Val = ::bevy::math::DVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f64| { - let output: Val = ::bevy::math::DVec4::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::DVec4::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f64; 4]| { - let output: Val = ::bevy::math::DVec4::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DVec4::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f64| { - let output: Val = ::bevy::math::DVec4::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f64| { - let output: Val = ::bevy::math::DVec4::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: f64| { - let output: Val = ::bevy::math::DVec4::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_w", - |_self: Val, w: f64| { - let output: Val = ::bevy::math::DVec4::with_w( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::min( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "max", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::max( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp", - | - _self: Val, - min: Val, - max: Val| - { - let output: Val = ::bevy::math::DVec4::clamp( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min_element", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::min_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "max_element", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::max_element(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_sum", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::element_sum(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "element_product", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::element_product(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpeq", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpeq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpne", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpne( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpge", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpge( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmpgt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpgt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmple", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmple( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "cmplt", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmplt( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "signum", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::signum( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "copysign", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::copysign( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_negative_bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::DVec4::is_negative_bitmask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite_mask", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::is_finite_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_nan_mask", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::is_nan_mask( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "distance", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::distance( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "distance_squared", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::distance_squared( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::div_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem_euclid", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::rem_euclid( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or", - |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::DVec4::normalize_or( - _self.into(), - fallback.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize_or_zero", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::normalize_or_zero( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::project_onto( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::reject_from( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_onto_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::project_onto_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reject_from_normalized", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::reject_from_normalized( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "round", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::round( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "floor", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::floor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "ceil", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::ceil( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "trunc", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::trunc( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::fract( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fract_gl", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::fract_gl( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "exp", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::exp( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "powf", - |_self: Val, n: f64| { - let output: Val = ::bevy::math::DVec4::powf( - _self.into(), - n.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "recip", - |_self: Val| { - let output: Val = ::bevy::math::DVec4::recip( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, rhs: Val, s: f64| { - let output: Val = ::bevy::math::DVec4::lerp( - _self.into(), - rhs.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "move_towards", - |_self: Ref, rhs: Val, d: f64| { - let output: Val = ::bevy::math::DVec4::move_towards( - _self.into(), - rhs.into(), - d.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "midpoint", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::midpoint( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DVec4::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length", - |_self: Val, min: f64, max: f64| { - let output: Val = ::bevy::math::DVec4::clamp_length( - _self.into(), - min.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_max", - |_self: Val, max: f64| { - let output: Val = ::bevy::math::DVec4::clamp_length_max( - _self.into(), - max.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clamp_length_min", - |_self: Val, min: f64| { - let output: Val = ::bevy::math::DVec4::clamp_length_min( - _self.into(), - min.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_add", - | - _self: Val, - a: Val, - b: Val| - { - let output: Val = ::bevy::math::DVec4::mul_add( - _self.into(), - a.into(), - b.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reflect", - |_self: Val, normal: Val| { - let output: Val = ::bevy::math::DVec4::reflect( - _self.into(), - normal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "refract", - | - _self: Val, - normal: Val, - eta: f64| - { - let output: Val = ::bevy::math::DVec4::refract( - _self.into(), - normal.into(), - eta.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_vec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_ivec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_uvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_i64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_u64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Mat2>::new(world) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat2::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - |x_axis: Val, y_axis: Val| { - let output: Val = ::bevy::math::Mat2::from_cols( - x_axis.into(), - y_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Mat2::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f32; 2]; 2] = ::bevy::math::Mat2::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::Mat2::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle", - |scale: Val, angle: f32| { - let output: Val = ::bevy::math::Mat2::from_scale_angle( - scale.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f32| { - let output: Val = ::bevy::math::Mat2::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |m: Val| { - let output: Val = ::bevy::math::Mat2::from_mat3( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3_minor", - |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat2::from_mat3_minor( - m.into(), - i.into(), - j.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3a", - |m: Val| { - let output: Val = ::bevy::math::Mat2::from_mat3a( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3a_minor", - |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat2::from_mat3a_minor( - m.into(), - i.into(), - j.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat2::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat2::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::Mat2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::Mat2::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::Mat2::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f32 = ::bevy::math::Mat2::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Mat2::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul_vec2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat2", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat2::mul_mat2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat2", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat2::add_mat2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat2", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat2::sub_mat2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat2::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat2::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Mat2::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::Mat2::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dmat2", - |_self: Ref| { - let output: Val = ::bevy::math::Mat2::as_dmat2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Mat3>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val| - { - let output: Val = ::bevy::math::Mat3::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f32; 9] = ::bevy::math::Mat3::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f32; 3]; 3] = ::bevy::math::Mat3::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::Mat3::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |m: Val| { - let output: Val = ::bevy::math::Mat3::from_mat4( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4_minor", - |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat3::from_mat4_minor( - m.into(), - i.into(), - j.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::Mat3::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Mat3::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |order: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Mat3::from_euler( - order.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Ref, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Mat3::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::Mat3::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle_translation", - | - scale: Val, - angle: f32, - translation: Val| - { - let output: Val = ::bevy::math::Mat3::from_scale_angle_translation( - scale.into(), - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::Mat3::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2", - |m: Val| { - let output: Val = ::bevy::math::Mat3::from_mat2( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::Mat3::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::Mat3::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f32 = ::bevy::math::Mat3::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::transform_point2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::transform_vector2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul_vec3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul_vec3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3::mul_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3::add_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3::sub_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Mat3::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dmat3", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3::as_dmat3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat3::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Mat3A>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat3A::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat3A::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val| - { - let output: Val = ::bevy::math::Mat3A::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f32; 9] = ::bevy::math::Mat3A::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f32; 3]; 3] = ::bevy::math::Mat3A::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::Mat3A::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |m: Val| { - let output: Val = ::bevy::math::Mat3A::from_mat4( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4_minor", - |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat3A::from_mat4_minor( - m.into(), - i.into(), - j.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::Mat3A::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |order: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Mat3A::from_euler( - order.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Ref, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Mat3A::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::Mat3A::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle_translation", - | - scale: Val, - angle: f32, - translation: Val| - { - let output: Val = ::bevy::math::Mat3A::from_scale_angle_translation( - scale.into(), - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::Mat3A::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2", - |m: Val| { - let output: Val = ::bevy::math::Mat3A::from_mat2( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3A::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3A::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::Mat3A::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::Mat3A::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f32 = ::bevy::math::Mat3A::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::transform_point2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::transform_vector2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul_vec3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul_vec3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3A::mul_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3A::add_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3A::sub_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Mat3A::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dmat3", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::as_dmat3( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Mat4>::new(world) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat4::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val, - w_axis: Val| - { - let output: Val = ::bevy::math::Mat4::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f32; 16] = ::bevy::math::Mat4::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f32; 4]; 4] = ::bevy::math::Mat4::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::Mat4::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_rotation_translation", - | - scale: Val, - rotation: Val, - translation: Val| - { - let output: Val = ::bevy::math::Mat4::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_translation", - |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::Mat4::from_rotation_translation( - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::Mat4::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |m: Val| { - let output: Val = ::bevy::math::Mat4::from_mat3( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3a", - |m: Val| { - let output: Val = ::bevy::math::Mat4::from_mat3a( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::Mat4::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Mat4::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |order: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Mat4::from_euler( - order.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Ref, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Mat4::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f32| { - let output: Val = ::bevy::math::Mat4::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f32| { - let output: Val = ::bevy::math::Mat4::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f32| { - let output: Val = ::bevy::math::Mat4::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::Mat4::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat4::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat4::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::Mat4::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::Mat4::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::Mat4::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f32 = ::bevy::math::Mat4::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Mat4::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_lh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::Mat4::look_to_lh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_rh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::Mat4::look_to_rh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_lh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::Mat4::look_at_lh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_rh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::Mat4::look_at_rh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_rh_gl", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = ::bevy::math::Mat4::perspective_rh_gl( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_lh", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = ::bevy::math::Mat4::perspective_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_rh", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = ::bevy::math::Mat4::perspective_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_lh", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_reverse_lh", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_rh", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_reverse_rh", - |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "orthographic_rh_gl", - |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = ::bevy::math::Mat4::orthographic_rh_gl( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "orthographic_lh", - |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = ::bevy::math::Mat4::orthographic_lh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "orthographic_rh", - |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = ::bevy::math::Mat4::orthographic_rh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_point3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::project_point3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_point3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_vector3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_point3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::project_point3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_point3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_vector3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec4", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul_vec4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat4::mul_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat4::add_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat4::sub_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat4::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat4::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Mat4::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::Mat4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_dmat4", - |_self: Ref| { - let output: Val = ::bevy::math::Mat4::as_dmat4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DMat2>::new(world) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat2::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DMat2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DMat2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - |x_axis: Val, y_axis: Val| { - let output: Val = ::bevy::math::DMat2::from_cols( - x_axis.into(), - y_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DMat2::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f64; 2]; 2] = ::bevy::math::DMat2::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::DMat2::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle", - |scale: Val, angle: f64| { - let output: Val = ::bevy::math::DMat2::from_scale_angle( - scale.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f64| { - let output: Val = ::bevy::math::DMat2::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |m: Val| { - let output: Val = ::bevy::math::DMat2::from_mat3( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3_minor", - |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::DMat2::from_mat3_minor( - m.into(), - i.into(), - j.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat2::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat2::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::DMat2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::DMat2::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::DMat2::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f64 = ::bevy::math::DMat2::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::DMat2::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul_vec2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat2", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat2::mul_mat2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat2", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat2::add_mat2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat2", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat2::sub_mat2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat2::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat2::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DMat2::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::DMat2::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_mat2", - |_self: Ref| { - let output: Val = ::bevy::math::DMat2::as_mat2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DMat3>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val| - { - let output: Val = ::bevy::math::DMat3::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f64; 9] = ::bevy::math::DMat3::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f64; 3]; 3] = ::bevy::math::DMat3::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::DMat3::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |m: Val| { - let output: Val = ::bevy::math::DMat3::from_mat4( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4_minor", - |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::DMat3::from_mat4_minor( - m.into(), - i.into(), - j.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::DMat3::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DMat3::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |order: Val, a: f64, b: f64, c: f64| { - let output: Val = ::bevy::math::DMat3::from_euler( - order.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Ref, order: Val| { - let output: (f64, f64, f64) = ::bevy::math::DMat3::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::DMat3::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle_translation", - | - scale: Val, - angle: f64, - translation: Val| - { - let output: Val = ::bevy::math::DMat3::from_scale_angle_translation( - scale.into(), - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::DMat3::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2", - |m: Val| { - let output: Val = ::bevy::math::DMat3::from_mat2( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat3::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat3::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::DMat3::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::DMat3::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::DMat3::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f64 = ::bevy::math::DMat3::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::DMat3::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat3::transform_point2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat3::transform_vector2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul_vec3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat3::mul_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat3::add_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat3", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat3::sub_mat3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat3::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat3::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DMat3::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::DMat3::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_mat3", - |_self: Ref| { - let output: Val = ::bevy::math::DMat3::as_mat3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat3::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DMat3::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DMat3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DMat4>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val, - w_axis: Val| - { - let output: Val = ::bevy::math::DMat4::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f64; 16] = ::bevy::math::DMat4::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f64; 4]; 4] = ::bevy::math::DMat4::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_diagonal", - |diagonal: Val| { - let output: Val = ::bevy::math::DMat4::from_diagonal( - diagonal.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_rotation_translation", - | - scale: Val, - rotation: Val, - translation: Val| - { - let output: Val = ::bevy::math::DMat4::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_translation", - |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::DMat4::from_rotation_translation( - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::DMat4::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |m: Val| { - let output: Val = ::bevy::math::DMat4::from_mat3( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::DMat4::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DMat4::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |order: Val, a: f64, b: f64, c: f64| { - let output: Val = ::bevy::math::DMat4::from_euler( - order.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Ref, order: Val| { - let output: (f64, f64, f64) = ::bevy::math::DMat4::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f64| { - let output: Val = ::bevy::math::DMat4::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f64| { - let output: Val = ::bevy::math::DMat4::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f64| { - let output: Val = ::bevy::math::DMat4::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::DMat4::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "col", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat4::col( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "row", - |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat4::row( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::DMat4::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::DMat4::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "transpose", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::transpose( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "determinant", - |_self: Ref| { - let output: f64 = ::bevy::math::DMat4::determinant(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_lh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::DMat4::look_to_lh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_rh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::DMat4::look_to_rh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_lh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::DMat4::look_at_lh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_rh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::DMat4::look_at_rh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_rh_gl", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = ::bevy::math::DMat4::perspective_rh_gl( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_lh", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = ::bevy::math::DMat4::perspective_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_rh", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = ::bevy::math::DMat4::perspective_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_lh", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_reverse_lh", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_rh", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "perspective_infinite_reverse_rh", - |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "orthographic_rh_gl", - |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = ::bevy::math::DMat4::orthographic_rh_gl( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "orthographic_lh", - |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = ::bevy::math::DMat4::orthographic_lh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "orthographic_rh", - |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = ::bevy::math::DMat4::orthographic_rh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "project_point3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::project_point3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::transform_point3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::transform_vector3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec4", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul_vec4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::mul_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::add_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::sub_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat4::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat4::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DMat4::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_mat4", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::as_mat4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DMat4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat4::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Affine2>::new(world) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Affine2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val| - { - let output: Val = ::bevy::math::Affine2::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f32; 6] = ::bevy::math::Affine2::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f32; 2]; 3] = ::bevy::math::Affine2::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::Affine2::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f32| { - let output: Val = ::bevy::math::Affine2::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::Affine2::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2", - |matrix2: Val| { - let output: Val = ::bevy::math::Affine2::from_mat2( - matrix2.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2_translation", - |matrix2: Val, translation: Val| { - let output: Val = ::bevy::math::Affine2::from_mat2_translation( - matrix2.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle_translation", - | - scale: Val, - angle: f32, - translation: Val| - { - let output: Val = ::bevy::math::Affine2::from_scale_angle_translation( - scale.into(), - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle_translation", - |angle: f32, translation: Val| { - let output: Val = ::bevy::math::Affine2::from_angle_translation( - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |m: Val| { - let output: Val = ::bevy::math::Affine2::from_mat3( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3a", - |m: Val| { - let output: Val = ::bevy::math::Affine2::from_mat3a( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine2::transform_point2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine2::transform_vector2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::Affine2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::Affine2::is_nan(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Affine2::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Affine2::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Affine2::eq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Affine3A>::new(world) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Affine3A::eq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Affine3A::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val, - w_axis: Val| - { - let output: Val = ::bevy::math::Affine3A::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f32; 12] = ::bevy::math::Affine3A::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f32; 3]; 4] = ::bevy::math::Affine3A::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::Affine3A::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::Affine3A::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |mat3: Val| { - let output: Val = ::bevy::math::Affine3A::from_mat3( - mat3.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3_translation", - |mat3: Val, translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_mat3_translation( - mat3.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_rotation_translation", - | - scale: Val, - rotation: Val, - translation: Val| - { - let output: Val = ::bevy::math::Affine3A::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_translation", - |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_rotation_translation( - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |m: Val| { - let output: Val = ::bevy::math::Affine3A::from_mat4( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_lh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::Affine3A::look_to_lh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_rh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::Affine3A::look_to_rh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_lh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::Affine3A::look_at_lh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_rh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::Affine3A::look_at_rh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_point3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_vector3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_point3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector3a", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_vector3a( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::Affine3A::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::Affine3A::is_nan(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f32| - { - let output: bool = ::bevy::math::Affine3A::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::Affine3A::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DAffine2>::new(world) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DAffine2::eq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val| - { - let output: Val = ::bevy::math::DAffine2::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f64; 6] = ::bevy::math::DAffine2::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f64; 2]; 3] = ::bevy::math::DAffine2::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::DAffine2::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle", - |angle: f64| { - let output: Val = ::bevy::math::DAffine2::from_angle( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2", - |matrix2: Val| { - let output: Val = ::bevy::math::DAffine2::from_mat2( - matrix2.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat2_translation", - |matrix2: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_mat2_translation( - matrix2.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_angle_translation", - | - scale: Val, - angle: f64, - translation: Val| - { - let output: Val = ::bevy::math::DAffine2::from_scale_angle_translation( - scale.into(), - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_angle_translation", - |angle: f64, translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_angle_translation( - angle.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |m: Val| { - let output: Val = ::bevy::math::DAffine2::from_mat3( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::transform_point2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector2", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::transform_vector2( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::DAffine2::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::DAffine2::is_nan(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DAffine2::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::DAffine2::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DAffine2::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DAffine3>::new(world) - .overwrite_script_function( - "from_cols", - | - x_axis: Val, - y_axis: Val, - z_axis: Val, - w_axis: Val| - { - let output: Val = ::bevy::math::DAffine3::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array", - |_self: Ref| { - let output: [f64; 12] = ::bevy::math::DAffine3::to_cols_array( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_cols_array_2d", - |_self: Ref| { - let output: [[f64; 3]; 4] = ::bevy::math::DAffine3::to_cols_array_2d( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale", - |scale: Val| { - let output: Val = ::bevy::math::DAffine3::from_scale( - scale.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_quat", - |rotation: Val| { - let output: Val = ::bevy::math::DAffine3::from_quat( - rotation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_translation", - |translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_translation( - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |mat3: Val| { - let output: Val = ::bevy::math::DAffine3::from_mat3( - mat3.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3_translation", - |mat3: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_mat3_translation( - mat3.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scale_rotation_translation", - | - scale: Val, - rotation: Val, - translation: Val| - { - let output: Val = ::bevy::math::DAffine3::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_translation", - |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_rotation_translation( - rotation.into(), - translation.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |m: Val| { - let output: Val = ::bevy::math::DAffine3::from_mat4( - m.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_lh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::DAffine3::look_to_lh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_to_rh", - | - eye: Val, - dir: Val, - up: Val| - { - let output: Val = ::bevy::math::DAffine3::look_to_rh( - eye.into(), - dir.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_lh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::DAffine3::look_at_lh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "look_at_rh", - | - eye: Val, - center: Val, - up: Val| - { - let output: Val = ::bevy::math::DAffine3::look_at_rh( - eye.into(), - center.into(), - up.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_point3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::transform_point3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "transform_vector3", - |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::transform_vector3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::math::DAffine3::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Ref| { - let output: bool = ::bevy::math::DAffine3::is_nan(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DAffine3::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Ref| { - let output: Val = ::bevy::math::DAffine3::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DAffine3::eq( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DAffine3::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DQuat>::new(world) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DQuat::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DQuat::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xyzw", - |x: f64, y: f64, z: f64, w: f64| { - let output: Val = ::bevy::math::DQuat::from_xyzw( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f64; 4]| { - let output: Val = ::bevy::math::DQuat::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_vec4", - |v: Val| { - let output: Val = ::bevy::math::DQuat::from_vec4( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_axis_angle", - |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DQuat::from_axis_angle( - axis.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_scaled_axis", - |v: Val| { - let output: Val = ::bevy::math::DQuat::from_scaled_axis( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_x", - |angle: f64| { - let output: Val = ::bevy::math::DQuat::from_rotation_x( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_y", - |angle: f64| { - let output: Val = ::bevy::math::DQuat::from_rotation_y( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_z", - |angle: f64| { - let output: Val = ::bevy::math::DQuat::from_rotation_z( - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_euler", - |euler: Val, a: f64, b: f64, c: f64| { - let output: Val = ::bevy::math::DQuat::from_euler( - euler.into(), - a.into(), - b.into(), - c.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat3", - |mat: Ref| { - let output: Val = ::bevy::math::DQuat::from_mat3( - mat.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_mat4", - |mat: Ref| { - let output: Val = ::bevy::math::DQuat::from_mat4( - mat.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_arc", - |from: Val, to: Val| { - let output: Val = ::bevy::math::DQuat::from_rotation_arc( - from.into(), - to.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_arc_colinear", - |from: Val, to: Val| { - let output: Val = ::bevy::math::DQuat::from_rotation_arc_colinear( - from.into(), - to.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_rotation_arc_2d", - |from: Val, to: Val| { - let output: Val = ::bevy::math::DQuat::from_rotation_arc_2d( - from.into(), - to.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_scaled_axis", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::to_scaled_axis( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_euler", - |_self: Val, order: Val| { - let output: (f64, f64, f64) = ::bevy::math::DQuat::to_euler( - _self.into(), - order.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DQuat::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "xyz", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::xyz( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "conjugate", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::conjugate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "inverse", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::inverse( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DQuat::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length", - |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "length_squared", - |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length_squared(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "length_recip", - |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length_recip(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "normalize", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::normalize( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_finite(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nan", - |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_nan(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_normalized", - |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_normalized(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_near_identity", - |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_near_identity( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "angle_between", - |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DQuat::angle_between( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_towards", - | - _self: Ref, - rhs: Val, - max_angle: f64| - { - let output: Val = ::bevy::math::DQuat::rotate_towards( - _self.into(), - rhs.into(), - max_angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Val, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DQuat::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "lerp", - |_self: Val, end: Val, s: f64| { - let output: Val = ::bevy::math::DQuat::lerp( - _self.into(), - end.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "slerp", - |_self: Val, end: Val, s: f64| { - let output: Val = ::bevy::math::DQuat::slerp( - _self.into(), - end.into(), - s.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_vec3", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul_vec3( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_quat", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul_quat( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_affine3", - |a: Ref| { - let output: Val = ::bevy::math::DQuat::from_affine3( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_quat", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::as_quat( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DQuat::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::EulerRot>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::EulerRot::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::EulerRot::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::EulerRot::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::BVec3A>::new(world) - .overwrite_script_function( - "new", - |x: bool, y: bool, z: bool| { - let output: Val = ::bevy::math::BVec3A::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: bool| { - let output: Val = ::bevy::math::BVec3A::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [bool; 3]| { - let output: Val = ::bevy::math::BVec3A::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::BVec3A::bitmask(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "any", - |_self: Val| { - let output: bool = ::bevy::math::BVec3A::any(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "all", - |_self: Val| { - let output: bool = ::bevy::math::BVec3A::all(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "test", - |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec3A::test( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set", - |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3A::set( - _self.into(), - index.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec3A::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::BVec3A::eq(_self.into(), rhs.into()) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::BVec4A>::new(world) - .overwrite_script_function( - "new", - |x: bool, y: bool, z: bool, w: bool| { - let output: Val = ::bevy::math::BVec4A::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: bool| { - let output: Val = ::bevy::math::BVec4A::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [bool; 4]| { - let output: Val = ::bevy::math::BVec4A::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::BVec4A::bitmask(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "any", - |_self: Val| { - let output: bool = ::bevy::math::BVec4A::any(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "all", - |_self: Val| { - let output: bool = ::bevy::math::BVec4A::all(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "test", - |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec4A::test( - _self.into(), - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set", - |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4A::set( - _self.into(), - index.into(), - value.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::BVec4A::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec4A::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::smol_str::SmolStr>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::smol_str::SmolStr::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::smol_str::SmolStr::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_string", - |_self: Ref| { - let output: std::string::String = ::smol_str::SmolStr::to_string( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "len", - |_self: Ref| { - let output: usize = ::smol_str::SmolStr::len(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_empty", - |_self: Ref| { - let output: bool = ::smol_str::SmolStr::is_empty(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_heap_allocated", - |_self: Ref| { - let output: bool = ::smol_str::SmolStr::is_heap_allocated( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::uuid::Uuid>::new(world) - .overwrite_script_function( - "get_version_num", - |_self: Ref| { - let output: usize = ::uuid::Uuid::get_version_num(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u128", - |_self: Ref| { - let output: u128 = ::uuid::Uuid::as_u128(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "to_u128_le", - |_self: Ref| { - let output: u128 = ::uuid::Uuid::to_u128_le(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "as_u64_pair", - |_self: Ref| { - let output: (u64, u64) = ::uuid::Uuid::as_u64_pair(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "into_bytes", - |_self: Val| { - let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "to_bytes_le", - |_self: Ref| { - let output: [u8; 16] = ::uuid::Uuid::to_bytes_le(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_nil", - |_self: Ref| { - let output: bool = ::uuid::Uuid::is_nil(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "is_max", - |_self: Ref| { - let output: bool = ::uuid::Uuid::is_max(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "encode_buffer", - || { - let output: [u8; 45] = ::uuid::Uuid::encode_buffer().into(); - output - }, - ) - .overwrite_script_function( - "get_node_id", - |_self: Ref| { - let output: bevy::reflect::erased_serde::__private::serde::__private::Option< - [u8; 6], - > = ::uuid::Uuid::get_node_id(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::uuid::Uuid::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "nil", - || { - let output: Val = ::uuid::Uuid::nil().into(); - output - }, - ) - .overwrite_script_function( - "max", - || { - let output: Val = ::uuid::Uuid::max().into(); - output - }, - ) - .overwrite_script_function( - "from_u128", - |v: u128| { - let output: Val = ::uuid::Uuid::from_u128(v.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "from_u128_le", - |v: u128| { - let output: Val = ::uuid::Uuid::from_u128_le(v.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "from_u64_pair", - |high_bits: u64, low_bits: u64| { - let output: Val = ::uuid::Uuid::from_u64_pair( - high_bits.into(), - low_bits.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_bytes", - |bytes: [u8; 16]| { - let output: Val = ::uuid::Uuid::from_bytes(bytes.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "from_bytes_le", - |b: [u8; 16]| { - let output: Val = ::uuid::Uuid::from_bytes_le(b.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::uuid::Uuid::eq(_self.into(), other.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::uuid::Uuid::clone(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "new_v4", - || { - let output: Val = ::uuid::Uuid::new_v4().into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs deleted file mode 100644 index 2a0259468a..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_time.rs +++ /dev/null @@ -1,355 +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::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyTimeScriptingPlugin; -impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::time::prelude::Fixed>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::Fixed::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::time::prelude::Real>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::Real::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::time::prelude::Timer>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::Timer::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::time::prelude::Timer::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_seconds", - |duration: f32, mode: Val| { - let output: Val = ::bevy::time::prelude::Timer::from_seconds( - duration.into(), - mode.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "finished", - |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::finished( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "just_finished", - |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::just_finished( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "elapsed_secs", - |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::elapsed_secs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "elapsed_secs_f64", - |_self: Ref| { - let output: f64 = ::bevy::time::prelude::Timer::elapsed_secs_f64( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mode", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::Timer::mode( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "set_mode", - | - _self: Mut, - mode: Val| - { - let output: () = ::bevy::time::prelude::Timer::set_mode( - _self.into(), - mode.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "pause", - |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::pause(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "unpause", - |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::unpause(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "paused", - |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::paused(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "reset", - |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::reset(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "fraction", - |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::fraction( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "fraction_remaining", - |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::fraction_remaining( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "remaining_secs", - |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::remaining_secs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "times_finished_this_tick", - |_self: Ref| { - let output: u32 = ::bevy::time::prelude::Timer::times_finished_this_tick( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::time::prelude::Timer::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::time::prelude::TimerMode>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::time::prelude::TimerMode::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::TimerMode::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::time::prelude::Virtual>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::Virtual::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::time::Stopwatch>::new(world) - .overwrite_script_function( - "new", - || { - let output: Val = ::bevy::time::Stopwatch::new() - .into(); - output - }, - ) - .overwrite_script_function( - "elapsed_secs", - |_self: Ref| { - let output: f32 = ::bevy::time::Stopwatch::elapsed_secs(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "elapsed_secs_f64", - |_self: Ref| { - let output: f64 = ::bevy::time::Stopwatch::elapsed_secs_f64( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "pause", - |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::pause(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "unpause", - |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::unpause(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "is_paused", - |_self: Ref| { - let output: bool = ::bevy::time::Stopwatch::is_paused(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "reset", - |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::reset(_self.into()).into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::time::Stopwatch::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::Stopwatch::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::time::Stopwatch::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs deleted file mode 100644 index c32d3ee20e..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/bevy_transform.rs +++ /dev/null @@ -1,278 +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::*; -use super::bevy_core::*; -use super::bevy_math::*; -use super::bevy_hierarchy::*; -use bevy_mod_scripting_core::{ - AddContextInitializer, StoreDocumentation, - bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, -}; -use crate::*; -pub struct BevyTransformScriptingPlugin; -impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - let mut world = app.world_mut(); - NamespaceBuilder::<::bevy::transform::components::GlobalTransform>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::transform::components::GlobalTransform::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - global_transform: Val| - { - let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into(), - global_transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - transform: Val| - { - let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into(), - transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::transform::components::GlobalTransform::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_xyz", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::transform::components::GlobalTransform::from_xyz( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "compute_transform", - |_self: Ref| { - let output: Val = ::bevy::transform::components::GlobalTransform::compute_transform( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "reparented_to", - | - _self: Ref, - parent: Ref| - { - let output: Val = ::bevy::transform::components::GlobalTransform::reparented_to( - _self.into(), - parent.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_transform", - | - _self: Ref, - transform: Val| - { - let output: Val = ::bevy::transform::components::GlobalTransform::mul_transform( - _self.into(), - transform.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::transform::components::Transform>::new(world) - .overwrite_script_function( - "from_xyz", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::transform::components::Transform::from_xyz( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_x", - |_self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_x( - _self.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_y", - |_self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_y( - _self.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_z", - |_self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_z( - _self.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_local_x", - |_self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_local_x( - _self.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_local_y", - |_self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_local_y( - _self.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rotate_local_z", - |_self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_local_z( - _self.into(), - angle.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_transform", - | - _self: Ref, - transform: Val| - { - let output: Val = ::bevy::transform::components::Transform::mul_transform( - _self.into(), - transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_finite", - |_self: Ref| { - let output: bool = ::bevy::transform::components::Transform::is_finite( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::transform::components::Transform::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - transform: Val| - { - let output: Val = ::bevy::transform::components::Transform::mul( - _self.into(), - transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - global_transform: Val| - { - let output: Val = ::bevy::transform::components::Transform::mul( - _self.into(), - global_transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::transform::components::Transform::clone( - _self.into(), - ) - .into(); - output - }, - ); - } -} diff --git a/crates/bevy_mod_scripting_functions/src/bevy/mod.rs b/crates/bevy_mod_scripting_functions/src/bevy/mod.rs deleted file mode 100644 index 7aa0977203..0000000000 --- a/crates/bevy_mod_scripting_functions/src/bevy/mod.rs +++ /dev/null @@ -1,25 +0,0 @@ -// @generated by cargo bevy-api-gen collect, modify the templates not this file -#![allow(clippy::all)] -#![allow(unused, deprecated, dead_code)] -#![cfg_attr(rustfmt, rustfmt_skip)] -pub mod bevy_reflect; -pub mod bevy_math; -pub mod bevy_input; -pub mod bevy_transform; -pub mod bevy_core; -pub mod bevy_hierarchy; -pub mod bevy_ecs; -pub mod bevy_time; -pub struct LuaBevyScriptingPlugin; -impl ::bevy::app::Plugin for LuaBevyScriptingPlugin { - fn build(&self, app: &mut ::bevy::prelude::App) { - bevy_reflect::BevyReflectScriptingPlugin.build(app); - bevy_math::BevyMathScriptingPlugin.build(app); - bevy_input::BevyInputScriptingPlugin.build(app); - bevy_transform::BevyTransformScriptingPlugin.build(app); - bevy_core::BevyCoreScriptingPlugin.build(app); - bevy_hierarchy::BevyHierarchyScriptingPlugin.build(app); - bevy_ecs::BevyEcsScriptingPlugin.build(app); - bevy_time::BevyTimeScriptingPlugin.build(app); - } -} From 183ec61d8fb7aebed5fbf1241afb7e2d7ecb37fc Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 13:42:06 +0000 Subject: [PATCH 101/217] change imports --- crates/bevy_api_gen/src/bin/main.rs | 2 +- crates/bevy_mod_scripting_functions/Cargo.toml | 3 ++- crates/bevy_mod_scripting_functions/src/lib.rs | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/bevy_api_gen/src/bin/main.rs b/crates/bevy_api_gen/src/bin/main.rs index 658afed6a0..137f00ee43 100644 --- a/crates/bevy_api_gen/src/bin/main.rs +++ b/crates/bevy_api_gen/src/bin/main.rs @@ -68,7 +68,7 @@ fn main() { let plugin_subdir = format!("plugin-{}", env!("RUSTC_CHANNEL")); let plugin_target_dir = metadata.target_directory.join(plugin_subdir); - info!("Computing wokrspace metadata"); + info!("Computing workspace metadata"); // inform the deps about the workspace crates, this is going to be useful when working with meta files as we will be able to // know when to panic if a crate is not found diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 38a841d46a..60170ee11e 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -17,7 +17,8 @@ core_functions = ["bevy_mod_scripting_core"] [dependencies] -bevy = { workspace = true, default-features = false, features = [ +bevy = { workspace = true, features = [ "reflect_functions", ] } +uuid = "*" bevy_mod_scripting_core = { workspace = true, optional = true } diff --git a/crates/bevy_mod_scripting_functions/src/lib.rs b/crates/bevy_mod_scripting_functions/src/lib.rs index b016d5c870..e70be77fbb 100644 --- a/crates/bevy_mod_scripting_functions/src/lib.rs +++ b/crates/bevy_mod_scripting_functions/src/lib.rs @@ -1,5 +1,6 @@ -use bevy::prelude::*; - +use ::bevy::prelude::*; +#[cfg(feature = "core_functions")] +pub mod bevy; #[cfg(feature = "core_functions")] pub mod core; From 34ff68459f7cf06c89353975d60e4ba521a278d4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 21:40:51 +0000 Subject: [PATCH 102/217] chore(codegen): update bevy bindings (#175) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_core.rs | 42 + .../src/bevy_bindings/bevy_ecs.rs | 385 + .../src/bevy_bindings/bevy_hierarchy.rs | 95 + .../src/bevy_bindings/bevy_input.rs | 1437 + .../src/bevy_bindings/bevy_math.rs | 3548 +++ .../src/bevy_bindings/bevy_reflect.rs | 22507 ++++++++++++++++ .../src/bevy_bindings/bevy_time.rs | 355 + .../src/bevy_bindings/bevy_transform.rs | 278 + .../src/bevy_bindings/mod.rs | 25 + 9 files changed, 28672 insertions(+) create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs create mode 100644 crates/bevy_mod_scripting_functions/src/bevy_bindings/mod.rs diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs new file mode 100644 index 0000000000..870b902312 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs @@ -0,0 +1,42 @@ +// @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::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyCoreScriptingPlugin; +impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::core::prelude::Name>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::core::prelude::Name::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::core::prelude::Name::clone( + _self.into(), + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs new file mode 100644 index 0000000000..6bf900abf5 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -0,0 +1,385 @@ +// @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_reflect::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyEcsScriptingPlugin; +impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::ecs::entity::Entity>::new(world) + .overwrite_script_function( + "from_raw", + |index: u32| { + let output: Val = ::bevy::ecs::entity::Entity::from_raw( + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_bits", + |_self: Val| { + let output: u64 = ::bevy::ecs::entity::Entity::to_bits(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "from_bits", + |bits: u64| { + let output: Val = ::bevy::ecs::entity::Entity::from_bits( + bits.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "index", + |_self: Val| { + let output: u32 = ::bevy::ecs::entity::Entity::index(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "generation", + |_self: Val| { + let output: u32 = ::bevy::ecs::entity::Entity::generation( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::ecs::entity::Entity::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::entity::Entity::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::world::OnAdd>::new(world); + NamespaceBuilder::<::bevy::ecs::world::OnInsert>::new(world); + NamespaceBuilder::<::bevy::ecs::world::OnRemove>::new(world); + NamespaceBuilder::<::bevy::ecs::world::OnReplace>::new(world); + NamespaceBuilder::<::bevy::ecs::component::ComponentId>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::ecs::component::ComponentId::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::component::ComponentId::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |index: usize| { + let output: Val = ::bevy::ecs::component::ComponentId::new( + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "index", + |_self: Val| { + let output: usize = ::bevy::ecs::component::ComponentId::index( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::component::Tick>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::ecs::component::Tick::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::ecs::component::Tick::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::component::Tick::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |tick: u32| { + let output: Val = ::bevy::ecs::component::Tick::new( + tick.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "get", + |_self: Val| { + let output: u32 = ::bevy::ecs::component::Tick::get(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, tick: u32| { + let output: () = ::bevy::ecs::component::Tick::set( + _self.into(), + tick.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_newer_than", + | + _self: Val, + last_run: Val, + this_run: Val| + { + let output: bool = ::bevy::ecs::component::Tick::is_newer_than( + _self.into(), + last_run.into(), + this_run.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::component::ComponentTicks>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::component::ComponentTicks::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_added", + | + _self: Ref, + last_run: Val, + this_run: Val| + { + let output: bool = ::bevy::ecs::component::ComponentTicks::is_added( + _self.into(), + last_run.into(), + this_run.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_changed", + | + _self: Ref, + last_run: Val, + this_run: Val| + { + let output: bool = ::bevy::ecs::component::ComponentTicks::is_changed( + _self.into(), + last_run.into(), + this_run.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |change_tick: Val| { + let output: Val = ::bevy::ecs::component::ComponentTicks::new( + change_tick.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_changed", + | + _self: Mut, + change_tick: Val| + { + let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( + _self.into(), + change_tick.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::identifier::Identifier>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::identifier::Identifier::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "low", + |_self: Val| { + let output: u32 = ::bevy::ecs::identifier::Identifier::low( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "masked_high", + |_self: Val| { + let output: u32 = ::bevy::ecs::identifier::Identifier::masked_high( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_bits", + |_self: Val| { + let output: u64 = ::bevy::ecs::identifier::Identifier::to_bits( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_bits", + |value: u64| { + let output: Val = ::bevy::ecs::identifier::Identifier::from_bits( + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::ecs::identifier::Identifier::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::entity::EntityHash>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::entity::EntityHash::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::< + ::bevy::ecs::removal_detection::RemovedComponentEntity, + >::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::ecs::removal_detection::RemovedComponentEntity, + > = ::bevy::ecs::removal_detection::RemovedComponentEntity::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::system::SystemIdMarker>::new(world); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs new file mode 100644 index 0000000000..faa3ed7af6 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs @@ -0,0 +1,95 @@ +// @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::*; +use super::bevy_core::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyHierarchyScriptingPlugin; +impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::hierarchy::prelude::Children>::new(world) + .overwrite_script_function( + "swap", + | + _self: Mut, + a_index: usize, + b_index: usize| + { + let output: () = ::bevy::hierarchy::prelude::Children::swap( + _self.into(), + a_index.into(), + b_index.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::hierarchy::prelude::Parent>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::hierarchy::prelude::Parent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::hierarchy::HierarchyEvent>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::hierarchy::HierarchyEvent::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::hierarchy::HierarchyEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs new file mode 100644 index 0000000000..db3d2207c3 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -0,0 +1,1437 @@ +// @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::*; +use super::bevy_core::*; +use super::bevy_math::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyInputScriptingPlugin; +impl ::bevy::app::Plugin for BevyInputScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::input::gamepad::Gamepad>::new(world) + .overwrite_script_function( + "vendor_id", + |_self: Ref| { + let output: std::option::Option = ::bevy::input::gamepad::Gamepad::vendor_id( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "product_id", + |_self: Ref| { + let output: std::option::Option = ::bevy::input::gamepad::Gamepad::product_id( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "pressed", + | + _self: Ref, + button_type: Val| + { + let output: bool = ::bevy::input::gamepad::Gamepad::pressed( + _self.into(), + button_type.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "just_pressed", + | + _self: Ref, + button_type: Val| + { + let output: bool = ::bevy::input::gamepad::Gamepad::just_pressed( + _self.into(), + button_type.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "just_released", + | + _self: Ref, + button_type: Val| + { + let output: bool = ::bevy::input::gamepad::Gamepad::just_released( + _self.into(), + button_type.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadAxis>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadAxis::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadAxis::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadButton>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadButton::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadButton::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadSettings>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadSettings::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::keyboard::KeyCode>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::KeyCode::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::KeyCode::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::MouseButton>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::MouseButton::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::MouseButton::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::touch::TouchInput>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::touch::TouchInput::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::touch::TouchInput::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::keyboard::KeyboardFocusLost>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::KeyboardFocusLost::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::KeyboardFocusLost::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::keyboard::KeyboardInput>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::KeyboardInput::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::KeyboardInput::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseMotion>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::AccumulatedMouseMotion::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::AccumulatedMouseMotion::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseScroll>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::AccumulatedMouseScroll::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::AccumulatedMouseScroll::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::MouseButtonInput>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::MouseButtonInput::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::MouseButtonInput::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::MouseMotion>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::MouseMotion::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::MouseMotion::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::MouseWheel>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::MouseWheel::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::MouseWheel::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadAxisChangedEvent>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadAxisChangedEvent::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadAxisChangedEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadButtonChangedEvent>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadButtonChangedEvent::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadButtonChangedEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::< + ::bevy::input::gamepad::GamepadButtonStateChangedEvent, + >::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::input::gamepad::GamepadButtonStateChangedEvent, + > = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadConnection>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadConnection::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadConnection::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadConnectionEvent>::new(world) + .overwrite_script_function( + "connected", + |_self: Ref| { + let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::connected( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "disconnected", + |_self: Ref| { + let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::disconnected( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadConnectionEvent::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadEvent>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadEvent::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadInput>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadInput::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadInput::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleRequest>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadRumbleRequest::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::< + ::bevy::input::gamepad::RawGamepadAxisChangedEvent, + >::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::< + ::bevy::input::gamepad::RawGamepadButtonChangedEvent, + >::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::input::gamepad::RawGamepadButtonChangedEvent, + > = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::RawGamepadEvent>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::RawGamepadEvent::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::RawGamepadEvent::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gestures::PinchGesture>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gestures::PinchGesture::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gestures::PinchGesture::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gestures::RotationGesture>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gestures::RotationGesture::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gestures::RotationGesture::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gestures::DoubleTapGesture>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gestures::DoubleTapGesture::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gestures::DoubleTapGesture::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gestures::PanGesture>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gestures::PanGesture::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gestures::PanGesture::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::ButtonState>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::ButtonState::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_pressed", + |_self: Ref| { + let output: bool = ::bevy::input::ButtonState::is_pressed( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::ButtonState::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::ButtonState::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::ButtonSettings>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::ButtonSettings::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::ButtonSettings::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_pressed", + |_self: Ref, value: f32| { + let output: bool = ::bevy::input::gamepad::ButtonSettings::is_pressed( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_released", + |_self: Ref, value: f32| { + let output: bool = ::bevy::input::gamepad::ButtonSettings::is_released( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "press_threshold", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::ButtonSettings::press_threshold( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_press_threshold", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "release_threshold", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::ButtonSettings::release_threshold( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_release_threshold", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( + _self.into(), + value.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::AxisSettings>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::AxisSettings::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "livezone_upperbound", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_upperbound( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_livezone_upperbound", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "deadzone_upperbound", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_upperbound( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_deadzone_upperbound", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "livezone_lowerbound", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_lowerbound( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_livezone_lowerbound", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "deadzone_lowerbound", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_lowerbound( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_deadzone_lowerbound", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "threshold", + |_self: Ref| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::threshold( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_threshold", + |_self: Mut, value: f32| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + |_self: Ref, new_value: f32| { + let output: f32 = ::bevy::input::gamepad::AxisSettings::clamp( + _self.into(), + new_value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "filter", + | + _self: Ref, + new_value: f32, + old_value: std::option::Option| + { + let output: std::option::Option = ::bevy::input::gamepad::AxisSettings::filter( + _self.into(), + new_value.into(), + old_value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::AxisSettings::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::ButtonAxisSettings>::new(world) + .overwrite_script_function( + "filter", + | + _self: Ref, + new_value: f32, + old_value: std::option::Option| + { + let output: std::option::Option = ::bevy::input::gamepad::ButtonAxisSettings::filter( + _self.into(), + new_value.into(), + old_value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::ButtonAxisSettings::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleIntensity>::new(world) + .overwrite_script_function( + "weak_motor", + |intensity: f32| { + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( + intensity.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "strong_motor", + |intensity: f32| { + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( + intensity.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadRumbleIntensity::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::keyboard::Key>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::Key::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::Key::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::Key::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::keyboard::NativeKeyCode>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::NativeKeyCode::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::NativeKeyCode::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::keyboard::NativeKey>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::NativeKey::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::NativeKey::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::mouse::MouseScrollUnit>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::MouseScrollUnit::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::MouseScrollUnit::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::touch::TouchPhase>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::touch::TouchPhase::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::touch::TouchPhase::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::input::touch::ForceTouch>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::touch::ForceTouch::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::touch::ForceTouch::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs new file mode 100644 index 0000000000..09e42ace0a --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -0,0 +1,3548 @@ +// @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_reflect::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyMathScriptingPlugin; +impl ::bevy::app::Plugin for BevyMathScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::math::AspectRatio>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::AspectRatio::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ratio", + |_self: Ref| { + let output: f32 = ::bevy::math::AspectRatio::ratio(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::AspectRatio::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_landscape", + |_self: Ref| { + let output: bool = ::bevy::math::AspectRatio::is_landscape( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_portrait", + |_self: Ref| { + let output: bool = ::bevy::math::AspectRatio::is_portrait( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_square", + |_self: Ref| { + let output: bool = ::bevy::math::AspectRatio::is_square(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::AspectRatio::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::CompassOctant>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::CompassOctant::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::CompassOctant::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::CompassOctant::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::CompassQuadrant>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::CompassQuadrant::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::CompassQuadrant::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::CompassQuadrant::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Isometry2d>::new(world) + .overwrite_script_function( + "mul", + | + _self: Val, + rhs: Val| + { + let output: Val = ::bevy::math::Isometry2d::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation", + |rotation: Val| { + let output: Val = ::bevy::math::Isometry2d::from_rotation( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xy", + |x: f32, y: f32| { + let output: Val = ::bevy::math::Isometry2d::from_xy( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Isometry2d::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse_mul", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Isometry2d::inverse_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Isometry2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Isometry2d::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Isometry2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Isometry3d>::new(world) + .overwrite_script_function( + "from_xyz", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::Isometry3d::from_xyz( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Isometry3d::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse_mul", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Isometry3d::inverse_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Isometry3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Isometry3d::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + rhs: Val| + { + let output: Val = ::bevy::math::Isometry3d::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Isometry3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Ray2d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Ray2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Ray2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Ray3d>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Ray3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Ray3d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Rot2>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Rot2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "radians", + |radians: f32| { + let output: Val = ::bevy::math::Rot2::radians( + radians.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "degrees", + |degrees: f32| { + let output: Val = ::bevy::math::Rot2::degrees( + degrees.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "turn_fraction", + |fraction: f32| { + let output: Val = ::bevy::math::Rot2::turn_fraction( + fraction.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_sin_cos", + |sin: f32, cos: f32| { + let output: Val = ::bevy::math::Rot2::from_sin_cos( + sin.into(), + cos.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_radians", + |_self: Val| { + let output: f32 = ::bevy::math::Rot2::as_radians(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_degrees", + |_self: Val| { + let output: f32 = ::bevy::math::Rot2::as_degrees(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_turn_fraction", + |_self: Val| { + let output: f32 = ::bevy::math::Rot2::as_turn_fraction(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "sin_cos", + |_self: Val| { + let output: (f32, f32) = ::bevy::math::Rot2::sin_cos(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::Rot2::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = ::bevy::math::Rot2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = ::bevy::math::Rot2::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::Rot2::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = ::bevy::math::Rot2::fast_renormalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::Rot2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::Rot2::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::Rot2::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_near_identity", + |_self: Val| { + let output: bool = ::bevy::math::Rot2::is_near_identity(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, other: Val| { + let output: f32 = ::bevy::math::Rot2::angle_between( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_to", + |_self: Val, other: Val| { + let output: f32 = ::bevy::math::Rot2::angle_to( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Val| { + let output: Val = ::bevy::math::Rot2::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "nlerp", + |_self: Val, end: Val, s: f32| { + let output: Val = ::bevy::math::Rot2::nlerp( + _self.into(), + end.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + |_self: Val, end: Val, s: f32| { + let output: Val = ::bevy::math::Rot2::slerp( + _self.into(), + end.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + direction: Val| + { + let output: Val = ::bevy::math::Rot2::mul( + _self.into(), + direction.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Rot2::eq(_self.into(), other.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Rot2::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::prelude::Dir2>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Dir2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xy_unchecked", + |x: f32, y: f32| { + let output: Val = ::bevy::math::prelude::Dir2::from_xy_unchecked( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + | + _self: Val, + rhs: Val, + s: f32| + { + let output: Val = ::bevy::math::prelude::Dir2::slerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_to", + | + _self: Val, + other: Val| + { + let output: Val = ::bevy::math::prelude::Dir2::rotation_to( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_from", + | + _self: Val, + other: Val| + { + let output: Val = ::bevy::math::prelude::Dir2::rotation_from( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_from_x", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::rotation_from_x( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_to_x", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::rotation_to_x( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_from_y", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::rotation_from_y( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotation_to_y", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::rotation_to_y( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::fast_renormalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::Dir2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::neg( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::prelude::Dir3>::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Dir3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::Dir3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xyz_unchecked", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::prelude::Dir3::from_xyz_unchecked( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + | + _self: Val, + rhs: Val, + s: f32| + { + let output: Val = ::bevy::math::prelude::Dir3::slerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir3::fast_renormalize( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::prelude::Dir3A>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Dir3A::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir3A::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::Dir3A::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xyz_unchecked", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::prelude::Dir3A::from_xyz_unchecked( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + | + _self: Val, + rhs: Val, + s: f32| + { + let output: Val = ::bevy::math::prelude::Dir3A::slerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fast_renormalize", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir3A::fast_renormalize( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::prelude::IRect>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::IRect::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::prelude::IRect::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::IRect::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x0: i32, y0: i32, x1: i32, y1: i32| { + let output: Val = ::bevy::math::prelude::IRect::new( + x0.into(), + y0.into(), + x1.into(), + y1.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = ::bevy::math::prelude::IRect::is_empty( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "width", + |_self: Ref| { + let output: i32 = ::bevy::math::prelude::IRect::width(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "height", + |_self: Ref| { + let output: i32 = ::bevy::math::prelude::IRect::height(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "union", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::IRect::union( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "intersect", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::IRect::intersect( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inflate", + |_self: Ref, expansion: i32| { + let output: Val = ::bevy::math::prelude::IRect::inflate( + _self.into(), + expansion.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_rect", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::IRect::as_rect( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_urect", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::IRect::as_urect( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::prelude::Rect>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::Rect::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x0: f32, y0: f32, x1: f32, y1: f32| { + let output: Val = ::bevy::math::prelude::Rect::new( + x0.into(), + y0.into(), + x1.into(), + y1.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = ::bevy::math::prelude::Rect::is_empty( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "width", + |_self: Ref| { + let output: f32 = ::bevy::math::prelude::Rect::width(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "height", + |_self: Ref| { + let output: f32 = ::bevy::math::prelude::Rect::height(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "union", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::Rect::union( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "intersect", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::Rect::intersect( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inflate", + |_self: Ref, expansion: f32| { + let output: Val = ::bevy::math::prelude::Rect::inflate( + _self.into(), + expansion.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::Rect::normalize( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_irect", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Rect::as_irect( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_urect", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Rect::as_urect( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Rect::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::prelude::URect>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::URect::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x0: u32, y0: u32, x1: u32, y1: u32| { + let output: Val = ::bevy::math::prelude::URect::new( + x0.into(), + y0.into(), + x1.into(), + y1.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = ::bevy::math::prelude::URect::is_empty( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "width", + |_self: Ref| { + let output: u32 = ::bevy::math::prelude::URect::width(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "height", + |_self: Ref| { + let output: u32 = ::bevy::math::prelude::URect::height(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "union", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::URect::union( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "intersect", + | + _self: Ref, + other: Val| + { + let output: Val = ::bevy::math::prelude::URect::intersect( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inflate", + |_self: Ref, expansion: i32| { + let output: Val = ::bevy::math::prelude::URect::inflate( + _self.into(), + expansion.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_rect", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::URect::as_rect( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_irect", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::URect::as_irect( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::URect::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::prelude::URect::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Affine3>::new(world); + NamespaceBuilder::<::bevy::math::bounding::Aabb2d>::new(world) + .overwrite_script_function( + "bounding_circle", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::Aabb2d::bounding_circle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::Aabb2d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::BoundingCircle>::new(world) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = ::bevy::math::bounding::BoundingCircle::radius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_2d", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingCircle::aabb_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingCircle::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Circle>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Circle::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32| { + let output: Val = ::bevy::math::primitives::Circle::new( + radius.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "diameter", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Circle::diameter( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Circle::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Annulus>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Annulus::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Annulus::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |inner_radius: f32, outer_radius: f32| { + let output: Val = ::bevy::math::primitives::Annulus::new( + inner_radius.into(), + outer_radius.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "diameter", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Annulus::diameter( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "thickness", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Annulus::thickness( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Arc2d>::new(world) + .overwrite_script_function( + "new", + |radius: f32, half_angle: f32| { + let output: Val = ::bevy::math::primitives::Arc2d::new( + radius.into(), + half_angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_radians", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::Arc2d::from_radians( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_degrees", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::Arc2d::from_degrees( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_turns", + |radius: f32, fraction: f32| { + let output: Val = ::bevy::math::primitives::Arc2d::from_turns( + radius.into(), + fraction.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Arc2d::angle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Arc2d::length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_chord_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Arc2d::half_chord_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "chord_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Arc2d::chord_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "apothem", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Arc2d::apothem( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sagitta", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Arc2d::sagitta( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_minor", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Arc2d::is_minor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_major", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Arc2d::is_major( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Arc2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Arc2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Capsule2d>::new(world) + .overwrite_script_function( + "new", + |radius: f32, length: f32| { + let output: Val = ::bevy::math::primitives::Capsule2d::new( + radius.into(), + length.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_inner_rectangle", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Capsule2d::to_inner_rectangle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Capsule2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Capsule2d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::CircularSector>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::CircularSector::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::CircularSector::new( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_radians", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::CircularSector::from_radians( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_degrees", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::CircularSector::from_degrees( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_turns", + |radius: f32, fraction: f32| { + let output: Val = ::bevy::math::primitives::CircularSector::from_turns( + radius.into(), + fraction.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_angle", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::half_angle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::angle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::radius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "arc_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::arc_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_chord_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::half_chord_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "chord_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::chord_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "apothem", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::apothem( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sagitta", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSector::sagitta( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::CircularSector::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::CircularSegment>::new(world) + .overwrite_script_function( + "new", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::CircularSegment::new( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_radians", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::CircularSegment::from_radians( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_degrees", + |radius: f32, angle: f32| { + let output: Val = ::bevy::math::primitives::CircularSegment::from_degrees( + radius.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_turns", + |radius: f32, fraction: f32| { + let output: Val = ::bevy::math::primitives::CircularSegment::from_turns( + radius.into(), + fraction.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_angle", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::half_angle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::angle( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::radius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "arc_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::arc_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "half_chord_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::half_chord_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "chord_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::chord_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "apothem", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::apothem( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sagitta", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::CircularSegment::sagitta( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::CircularSegment::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::CircularSegment::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Ellipse>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Ellipse::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |half_width: f32, half_height: f32| { + let output: Val = ::bevy::math::primitives::Ellipse::new( + half_width.into(), + half_height.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eccentricity", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Ellipse::eccentricity( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "focal_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Ellipse::focal_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "semi_major", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Ellipse::semi_major( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "semi_minor", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Ellipse::semi_minor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Ellipse::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Line2d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Line2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Line2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Plane2d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Plane2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Plane2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Rectangle>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Rectangle::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |width: f32, height: f32| { + let output: Val = ::bevy::math::primitives::Rectangle::new( + width.into(), + height.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_length", + |length: f32| { + let output: Val = ::bevy::math::primitives::Rectangle::from_length( + length.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Rectangle::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::RegularPolygon>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::RegularPolygon::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |circumradius: f32, sides: u32| { + let output: Val = ::bevy::math::primitives::RegularPolygon::new( + circumradius.into(), + sides.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circumradius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::circumradius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inradius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::inradius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "side_length", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::side_length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "internal_angle_degrees", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_degrees( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "internal_angle_radians", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_radians( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "external_angle_degrees", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_degrees( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "external_angle_radians", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_radians( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::RegularPolygon::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Rhombus>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Rhombus::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |horizontal_diagonal: f32, vertical_diagonal: f32| { + let output: Val = ::bevy::math::primitives::Rhombus::new( + horizontal_diagonal.into(), + vertical_diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_side", + |side: f32| { + let output: Val = ::bevy::math::primitives::Rhombus::from_side( + side.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_inradius", + |inradius: f32| { + let output: Val = ::bevy::math::primitives::Rhombus::from_inradius( + inradius.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "side", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Rhombus::side( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circumradius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Rhombus::circumradius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inradius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Rhombus::inradius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Rhombus::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Segment2d>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Segment2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |direction: Val, length: f32| { + let output: Val = ::bevy::math::primitives::Segment2d::new( + direction.into(), + length.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Segment2d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Triangle2d>::new(world) + .overwrite_script_function( + "is_degenerate", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Triangle2d::is_degenerate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_acute", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Triangle2d::is_acute( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_obtuse", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Triangle2d::is_obtuse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reverse", + |_self: Mut| { + let output: () = ::bevy::math::primitives::Triangle2d::reverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reversed", + |_self: Val| { + let output: Val = ::bevy::math::primitives::Triangle2d::reversed( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Triangle2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Triangle2d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::Aabb3d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::Aabb3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "bounding_sphere", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::Aabb3d::bounding_sphere( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::BoundingSphere>::new(world) + .overwrite_script_function( + "radius", + |_self: Ref| { + let output: f32 = ::bevy::math::bounding::BoundingSphere::radius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_3d", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingSphere::aabb_3d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingSphere::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Sphere>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Sphere::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Sphere::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32| { + let output: Val = ::bevy::math::primitives::Sphere::new( + radius.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "diameter", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Sphere::diameter( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Cuboid>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cuboid::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Cuboid::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x_length: f32, y_length: f32, z_length: f32| { + let output: Val = ::bevy::math::primitives::Cuboid::new( + x_length.into(), + y_length.into(), + z_length.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_length", + |length: f32| { + let output: Val = ::bevy::math::primitives::Cuboid::from_length( + length.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Cylinder>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cylinder::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Cylinder::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32, height: f32| { + let output: Val = ::bevy::math::primitives::Cylinder::new( + radius.into(), + height.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "base", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cylinder::base( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lateral_area", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Cylinder::lateral_area( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "base_area", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Cylinder::base_area( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Capsule3d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Capsule3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Capsule3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |radius: f32, length: f32| { + let output: Val = ::bevy::math::primitives::Capsule3d::new( + radius.into(), + length.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cylinder", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Capsule3d::to_cylinder( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Cone>::new(world) + .overwrite_script_function( + "new", + |radius: f32, height: f32| { + let output: Val = ::bevy::math::primitives::Cone::new( + radius.into(), + height.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "base", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cone::base( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slant_height", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Cone::slant_height( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lateral_area", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Cone::lateral_area( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "base_area", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Cone::base_area( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cone::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Cone::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::ConicalFrustum>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::ConicalFrustum::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::ConicalFrustum::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::InfinitePlane3d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::InfinitePlane3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::InfinitePlane3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Line3d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Line3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Line3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Segment3d>::new(world) + .overwrite_script_function( + "new", + |direction: Val, length: f32| { + let output: Val = ::bevy::math::primitives::Segment3d::new( + direction.into(), + length.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Segment3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Segment3d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Torus>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Torus::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Torus::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |inner_radius: f32, outer_radius: f32| { + let output: Val = ::bevy::math::primitives::Torus::new( + inner_radius.into(), + outer_radius.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inner_radius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Torus::inner_radius( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "outer_radius", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Torus::outer_radius( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Triangle3d>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Triangle3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_degenerate", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Triangle3d::is_degenerate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_acute", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Triangle3d::is_acute( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_obtuse", + |_self: Ref| { + let output: bool = ::bevy::math::primitives::Triangle3d::is_obtuse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reverse", + |_self: Mut| { + let output: () = ::bevy::math::primitives::Triangle3d::reverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reversed", + |_self: Val| { + let output: Val = ::bevy::math::primitives::Triangle3d::reversed( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Triangle3d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::RayCast2d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::RayCast2d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_ray", + |ray: Val, max: f32| { + let output: Val = ::bevy::math::bounding::RayCast2d::from_ray( + ray.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_intersection_at", + | + _self: Ref, + aabb: Ref| + { + let output: std::option::Option = ::bevy::math::bounding::RayCast2d::aabb_intersection_at( + _self.into(), + aabb.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circle_intersection_at", + | + _self: Ref, + circle: Ref| + { + let output: std::option::Option = ::bevy::math::bounding::RayCast2d::circle_intersection_at( + _self.into(), + circle.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::AabbCast2d>::new(world) + .overwrite_script_function( + "from_ray", + | + aabb: Val, + ray: Val, + max: f32| + { + let output: Val = ::bevy::math::bounding::AabbCast2d::from_ray( + aabb.into(), + ray.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_collision_at", + | + _self: Ref, + aabb: Val| + { + let output: std::option::Option = ::bevy::math::bounding::AabbCast2d::aabb_collision_at( + _self.into(), + aabb.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::AabbCast2d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::BoundingCircleCast>::new(world) + .overwrite_script_function( + "from_ray", + | + circle: Val, + ray: Val, + max: f32| + { + let output: Val = ::bevy::math::bounding::BoundingCircleCast::from_ray( + circle.into(), + ray.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "circle_collision_at", + | + _self: Ref, + circle: Val| + { + let output: std::option::Option = ::bevy::math::bounding::BoundingCircleCast::circle_collision_at( + _self.into(), + circle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingCircleCast::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::RayCast3d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::RayCast3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_ray", + |ray: Val, max: f32| { + let output: Val = ::bevy::math::bounding::RayCast3d::from_ray( + ray.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_intersection_at", + | + _self: Ref, + aabb: Ref| + { + let output: std::option::Option = ::bevy::math::bounding::RayCast3d::aabb_intersection_at( + _self.into(), + aabb.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sphere_intersection_at", + | + _self: Ref, + sphere: Ref| + { + let output: std::option::Option = ::bevy::math::bounding::RayCast3d::sphere_intersection_at( + _self.into(), + sphere.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::AabbCast3d>::new(world) + .overwrite_script_function( + "from_ray", + | + aabb: Val, + ray: Val, + max: f32| + { + let output: Val = ::bevy::math::bounding::AabbCast3d::from_ray( + aabb.into(), + ray.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "aabb_collision_at", + | + _self: Ref, + aabb: Val| + { + let output: std::option::Option = ::bevy::math::bounding::AabbCast3d::aabb_collision_at( + _self.into(), + aabb.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::AabbCast3d::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::bounding::BoundingSphereCast>::new(world) + .overwrite_script_function( + "from_ray", + | + sphere: Val, + ray: Val, + max: f32| + { + let output: Val = ::bevy::math::bounding::BoundingSphereCast::from_ray( + sphere.into(), + ray.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sphere_collision_at", + | + _self: Ref, + sphere: Val| + { + let output: std::option::Option = ::bevy::math::bounding::BoundingSphereCast::sphere_collision_at( + _self.into(), + sphere.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingSphereCast::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::curve::interval::Interval>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::curve::interval::Interval::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "start", + |_self: Val| { + let output: f32 = ::bevy::math::curve::interval::Interval::start( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "end", + |_self: Val| { + let output: f32 = ::bevy::math::curve::interval::Interval::end( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::curve::interval::Interval::length( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_bounded", + |_self: Val| { + let output: bool = ::bevy::math::curve::interval::Interval::is_bounded( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "has_finite_start", + |_self: Val| { + let output: bool = ::bevy::math::curve::interval::Interval::has_finite_start( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "has_finite_end", + |_self: Val| { + let output: bool = ::bevy::math::curve::interval::Interval::has_finite_end( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "contains", + |_self: Val, item: f32| { + let output: bool = ::bevy::math::curve::interval::Interval::contains( + _self.into(), + item.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "contains_interval", + | + _self: Val, + other: Val| + { + let output: bool = ::bevy::math::curve::interval::Interval::contains_interval( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + |_self: Val, value: f32| { + let output: f32 = ::bevy::math::curve::interval::Interval::clamp( + _self.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::curve::interval::Interval::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::FloatOrd>::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::FloatOrd::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::FloatOrd::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::FloatOrd::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lt", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::FloatOrd::lt( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "le", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::FloatOrd::le( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "gt", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::FloatOrd::gt( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ge", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::FloatOrd::ge( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Plane3d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Plane3d::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Plane3d::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Tetrahedron>::new(world) + .overwrite_script_function( + "signed_volume", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Tetrahedron::signed_volume( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Tetrahedron::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Tetrahedron::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::curve::easing::EaseFunction>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::curve::easing::EaseFunction::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::curve::easing::EaseFunction::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs new file mode 100644 index 0000000000..603a8e68d0 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -0,0 +1,22507 @@ +// @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 bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyReflectScriptingPlugin; +impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::std::sync::atomic::AtomicBool>::new(world) + .overwrite_script_function( + "new", + |v: bool| { + let output: Val = ::std::sync::atomic::AtomicBool::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: bool = ::std::sync::atomic::AtomicBool::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicI16>::new(world) + .overwrite_script_function( + "new", + |v: i16| { + let output: Val = ::std::sync::atomic::AtomicI16::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i16 = ::std::sync::atomic::AtomicI16::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicI32>::new(world) + .overwrite_script_function( + "new", + |v: i32| { + let output: Val = ::std::sync::atomic::AtomicI32::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i32 = ::std::sync::atomic::AtomicI32::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicI64>::new(world) + .overwrite_script_function( + "new", + |v: i64| { + let output: Val = ::std::sync::atomic::AtomicI64::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i64 = ::std::sync::atomic::AtomicI64::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicI8>::new(world) + .overwrite_script_function( + "new", + |v: i8| { + let output: Val = ::std::sync::atomic::AtomicI8::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: i8 = ::std::sync::atomic::AtomicI8::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicIsize>::new(world) + .overwrite_script_function( + "new", + |v: isize| { + let output: Val = ::std::sync::atomic::AtomicIsize::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: isize = ::std::sync::atomic::AtomicIsize::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicU16>::new(world) + .overwrite_script_function( + "new", + |v: u16| { + let output: Val = ::std::sync::atomic::AtomicU16::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u16 = ::std::sync::atomic::AtomicU16::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicU32>::new(world) + .overwrite_script_function( + "new", + |v: u32| { + let output: Val = ::std::sync::atomic::AtomicU32::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u32 = ::std::sync::atomic::AtomicU32::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicU64>::new(world) + .overwrite_script_function( + "new", + |v: u64| { + let output: Val = ::std::sync::atomic::AtomicU64::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u64 = ::std::sync::atomic::AtomicU64::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicU8>::new(world) + .overwrite_script_function( + "new", + |v: u8| { + let output: Val = ::std::sync::atomic::AtomicU8::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: u8 = ::std::sync::atomic::AtomicU8::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::sync::atomic::AtomicUsize>::new(world) + .overwrite_script_function( + "new", + |v: usize| { + let output: Val = ::std::sync::atomic::AtomicUsize::new( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "into_inner", + |_self: Val| { + let output: usize = ::std::sync::atomic::AtomicUsize::into_inner( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::utils::Duration>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::utils::Duration::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::utils::Duration::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::utils::Duration::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::utils::Duration::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::utils::Duration::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::utils::Duration::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::utils::Duration::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |secs: u64, nanos: u32| { + let output: Val = ::bevy::utils::Duration::new( + secs.into(), + nanos.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_secs", + |secs: u64| { + let output: Val = ::bevy::utils::Duration::from_secs( + secs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_millis", + |millis: u64| { + let output: Val = ::bevy::utils::Duration::from_millis( + millis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_micros", + |micros: u64| { + let output: Val = ::bevy::utils::Duration::from_micros( + micros.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_nanos", + |nanos: u64| { + let output: Val = ::bevy::utils::Duration::from_nanos( + nanos.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_zero", + |_self: Ref| { + let output: bool = ::bevy::utils::Duration::is_zero(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_secs", + |_self: Ref| { + let output: u64 = ::bevy::utils::Duration::as_secs(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "subsec_millis", + |_self: Ref| { + let output: u32 = ::bevy::utils::Duration::subsec_millis( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "subsec_micros", + |_self: Ref| { + let output: u32 = ::bevy::utils::Duration::subsec_micros( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "subsec_nanos", + |_self: Ref| { + let output: u32 = ::bevy::utils::Duration::subsec_nanos(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_millis", + |_self: Ref| { + let output: u128 = ::bevy::utils::Duration::as_millis(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_micros", + |_self: Ref| { + let output: u128 = ::bevy::utils::Duration::as_micros(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_nanos", + |_self: Ref| { + let output: u128 = ::bevy::utils::Duration::as_nanos(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff", + |_self: Val, other: Val| { + let output: Val = ::bevy::utils::Duration::abs_diff( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::utils::Duration::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::utils::Duration::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::utils::Duration::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_secs_f64", + |_self: Ref| { + let output: f64 = ::bevy::utils::Duration::as_secs_f64(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_secs_f32", + |_self: Ref| { + let output: f32 = ::bevy::utils::Duration::as_secs_f32(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "from_secs_f64", + |secs: f64| { + let output: Val = ::bevy::utils::Duration::from_secs_f64( + secs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_secs_f32", + |secs: f32| { + let output: Val = ::bevy::utils::Duration::from_secs_f32( + secs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_f64", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::utils::Duration::mul_f64( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_f32", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::utils::Duration::mul_f32( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_f64", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::utils::Duration::div_f64( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_f32", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::utils::Duration::div_f32( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_duration_f64", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::utils::Duration::div_duration_f64( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_duration_f32", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::utils::Duration::div_duration_f32( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::utils::Instant>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::utils::Instant::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::utils::Instant::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, other: Val| { + let output: Val = ::bevy::utils::Instant::sub( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, other: Val| { + let output: Val = ::bevy::utils::Instant::sub( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "now", + || { + let output: Val = ::bevy::utils::Instant::now() + .into(); + output + }, + ) + .overwrite_script_function( + "duration_since", + |_self: Ref, earlier: Val| { + let output: Val = ::bevy::utils::Instant::duration_since( + _self.into(), + earlier.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_duration_since", + |_self: Ref, earlier: Val| { + let output: Val = ::bevy::utils::Instant::saturating_duration_since( + _self.into(), + earlier.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "elapsed", + |_self: Ref| { + let output: Val = ::bevy::utils::Instant::elapsed( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::utils::Instant::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, other: Val| { + let output: Val = ::bevy::utils::Instant::add( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::std::ops::RangeFull>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::std::ops::RangeFull::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::std::ops::RangeFull::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::std::ops::RangeFull::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Quat>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Quat::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Quat::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xyzw", + |x: f32, y: f32, z: f32, w: f32| { + let output: Val = ::bevy::math::Quat::from_xyzw( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 4]| { + let output: Val = ::bevy::math::Quat::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_vec4", + |v: Val| { + let output: Val = ::bevy::math::Quat::from_vec4( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = ::bevy::math::Quat::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scaled_axis", + |v: Val| { + let output: Val = ::bevy::math::Quat::from_scaled_axis( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = ::bevy::math::Quat::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = ::bevy::math::Quat::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = ::bevy::math::Quat::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |euler: Val, a: f32, b: f32, c: f32| { + let output: Val = ::bevy::math::Quat::from_euler( + euler.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat: Ref| { + let output: Val = ::bevy::math::Quat::from_mat3( + mat.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |mat: Ref| { + let output: Val = ::bevy::math::Quat::from_mat3a( + mat.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |mat: Ref| { + let output: Val = ::bevy::math::Quat::from_mat4( + mat.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc", + |from: Val, to: Val| { + let output: Val = ::bevy::math::Quat::from_rotation_arc( + from.into(), + to.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_colinear", + |from: Val, to: Val| { + let output: Val = ::bevy::math::Quat::from_rotation_arc_colinear( + from.into(), + to.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_2d", + |from: Val, to: Val| { + let output: Val = ::bevy::math::Quat::from_rotation_arc_2d( + from.into(), + to.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_scaled_axis", + |_self: Val| { + let output: Val = ::bevy::math::Quat::to_scaled_axis( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Val, order: Val| { + let output: (f32, f32, f32) = ::bevy::math::Quat::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 4] = ::bevy::math::Quat::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "xyz", + |_self: Val| { + let output: Val = ::bevy::math::Quat::xyz( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "conjugate", + |_self: Val| { + let output: Val = ::bevy::math::Quat::conjugate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Val| { + let output: Val = ::bevy::math::Quat::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Quat::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::Quat::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = ::bevy::math::Quat::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = ::bevy::math::Quat::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::Quat::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::Quat::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::Quat::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::Quat::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_near_identity", + |_self: Val| { + let output: bool = ::bevy::math::Quat::is_near_identity(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Quat::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f32| + { + let output: Val = ::bevy::math::Quat::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Quat::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, end: Val, s: f32| { + let output: Val = ::bevy::math::Quat::lerp( + _self.into(), + end.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + |_self: Val, end: Val, s: f32| { + let output: Val = ::bevy::math::Quat::slerp( + _self.into(), + end.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul_vec3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_quat", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul_quat( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_affine3", + |a: Ref| { + let output: Val = ::bevy::math::Quat::from_affine3( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3a", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul_vec3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dquat", + |_self: Val| { + let output: Val = ::bevy::math::Quat::as_dquat( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Quat::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Quat::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Vec3>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::Vec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = ::bevy::math::Vec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 3]| { + let output: Val = ::bevy::math::Vec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 3] = ::bevy::math::Vec3::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: f32| { + let output: Val = ::bevy::math::Vec3::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = ::bevy::math::Vec3::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = ::bevy::math::Vec3::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f32| { + let output: Val = ::bevy::math::Vec3::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::Vec3::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::Vec3::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::Vec3::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::Vec3::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::Vec3::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::Vec3::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = ::bevy::math::Vec3::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = ::bevy::math::Vec3::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = ::bevy::math::Vec3::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Vec3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = ::bevy::math::Vec3::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = ::bevy::math::Vec3::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = ::bevy::math::Vec3::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::Vec3::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::Vec3::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + |_self: Val, normal: Val, eta: f32| { + let output: Val = ::bevy::math::Vec3::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::any_orthogonal_vector( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::any_orthonormal_vector( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::as_dvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::as_ivec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::as_uvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::as_i64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::as_u64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Vec3::eq(_self.into(), other.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::IVec2>::new(world) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::IVec2::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::IVec2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32| { + let output: Val = ::bevy::math::IVec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = ::bevy::math::IVec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::IVec2::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 2]| { + let output: Val = ::bevy::math::IVec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 2] = ::bevy::math::IVec2::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: i32| { + let output: Val = ::bevy::math::IVec2::extend( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = ::bevy::math::IVec2::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = ::bevy::math::IVec2::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec2::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::IVec2::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i32 = ::bevy::math::IVec2::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i32 = ::bevy::math::IVec2::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i32 = ::bevy::math::IVec2::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i32 = ::bevy::math::IVec2::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::IVec2::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::IVec2::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::IVec2::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i32 = ::bevy::math::IVec2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec2::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = ::bevy::math::IVec2::perp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::rotate( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::as_vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::as_dvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::as_uvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::as_i64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::as_u64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::wrapping_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::wrapping_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::saturating_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::saturating_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::IVec2::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::IVec3>::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::IVec3::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32, z: i32| { + let output: Val = ::bevy::math::IVec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = ::bevy::math::IVec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::IVec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 3]| { + let output: Val = ::bevy::math::IVec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 3] = ::bevy::math::IVec3::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: i32| { + let output: Val = ::bevy::math::IVec3::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::IVec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = ::bevy::math::IVec3::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = ::bevy::math::IVec3::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i32| { + let output: Val = ::bevy::math::IVec3::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec3::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::IVec3::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i32 = ::bevy::math::IVec3::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i32 = ::bevy::math::IVec3::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i32 = ::bevy::math::IVec3::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i32 = ::bevy::math::IVec3::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::IVec3::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::IVec3::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::IVec3::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i32 = ::bevy::math::IVec3::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec3::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::as_vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::as_vec3a( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::as_dvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::as_uvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::as_i64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::as_u64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::wrapping_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::wrapping_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::saturating_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::saturating_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::IVec3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::IVec3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::IVec3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::IVec4>::new(world) + .overwrite_script_function( + "add", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32, z: i32, w: i32| { + let output: Val = ::bevy::math::IVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = ::bevy::math::IVec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::IVec4::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 4]| { + let output: Val = ::bevy::math::IVec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 4] = ::bevy::math::IVec4::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::IVec4::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = ::bevy::math::IVec4::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = ::bevy::math::IVec4::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i32| { + let output: Val = ::bevy::math::IVec4::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: i32| { + let output: Val = ::bevy::math::IVec4::with_w( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec4::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::IVec4::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i32 = ::bevy::math::IVec4::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i32 = ::bevy::math::IVec4::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i32 = ::bevy::math::IVec4::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i32 = ::bevy::math::IVec4::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::IVec4::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::IVec4::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::IVec4::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i32 = ::bevy::math::IVec4::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec4::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = ::bevy::math::IVec4::as_vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = ::bevy::math::IVec4::as_dvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = ::bevy::math::IVec4::as_uvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::IVec4::as_i64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::IVec4::as_u64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::wrapping_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::wrapping_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::saturating_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::saturating_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::IVec4::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::IVec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::IVec4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::IVec4::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::I64Vec2>::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec2::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::I64Vec2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::I64Vec2::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i64, y: i64| { + let output: Val = ::bevy::math::I64Vec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i64| { + let output: Val = ::bevy::math::I64Vec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::I64Vec2::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i64; 2]| { + let output: Val = ::bevy::math::I64Vec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i64; 2] = ::bevy::math::I64Vec2::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: i64| { + let output: Val = ::bevy::math::I64Vec2::extend( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i64| { + let output: Val = ::bevy::math::I64Vec2::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i64| { + let output: Val = ::bevy::math::I64Vec2::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec2::dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::I64Vec2::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec2::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec2::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec2::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec2::element_product( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec2::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec2::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::I64Vec2::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec2::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec2::perp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::rotate( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::as_vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::as_dvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::as_ivec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::as_uvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::as_u64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::wrapping_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::wrapping_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::saturating_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::saturating_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::I64Vec3>::new(world) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::I64Vec3::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::I64Vec3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i64, y: i64, z: i64| { + let output: Val = ::bevy::math::I64Vec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i64| { + let output: Val = ::bevy::math::I64Vec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::I64Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i64; 3]| { + let output: Val = ::bevy::math::I64Vec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i64; 3] = ::bevy::math::I64Vec3::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: i64| { + let output: Val = ::bevy::math::I64Vec3::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i64| { + let output: Val = ::bevy::math::I64Vec3::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i64| { + let output: Val = ::bevy::math::I64Vec3::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i64| { + let output: Val = ::bevy::math::I64Vec3::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec3::dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::I64Vec3::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec3::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec3::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec3::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec3::element_product( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec3::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec3::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::I64Vec3::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec3::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec3::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::as_vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::as_vec3a( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::as_dvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::as_ivec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::as_uvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::as_u64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::wrapping_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::wrapping_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::saturating_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::saturating_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::I64Vec4>::new(world) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::I64Vec4::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::I64Vec4::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i64, y: i64, z: i64, w: i64| { + let output: Val = ::bevy::math::I64Vec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i64| { + let output: Val = ::bevy::math::I64Vec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::I64Vec4::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i64; 4]| { + let output: Val = ::bevy::math::I64Vec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i64; 4] = ::bevy::math::I64Vec4::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec4::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i64| { + let output: Val = ::bevy::math::I64Vec4::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i64| { + let output: Val = ::bevy::math::I64Vec4::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i64| { + let output: Val = ::bevy::math::I64Vec4::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: i64| { + let output: Val = ::bevy::math::I64Vec4::with_w( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec4::dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::I64Vec4::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec4::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec4::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec4::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec4::element_product( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec4::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec4::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::I64Vec4::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: i64 = ::bevy::math::I64Vec4::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: i64 = ::bevy::math::I64Vec4::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::as_vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::as_dvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::as_ivec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::as_uvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::as_u64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::wrapping_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::wrapping_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::saturating_add_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub_unsigned", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::saturating_sub_unsigned( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::UVec2>::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::UVec2::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::UVec2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u32, y: u32| { + let output: Val = ::bevy::math::UVec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u32| { + let output: Val = ::bevy::math::UVec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::UVec2::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u32; 2]| { + let output: Val = ::bevy::math::UVec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u32; 2] = ::bevy::math::UVec2::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: u32| { + let output: Val = ::bevy::math::UVec2::extend( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u32| { + let output: Val = ::bevy::math::UVec2::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u32| { + let output: Val = ::bevy::math::UVec2::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u32 = ::bevy::math::UVec2::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::UVec2::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u32 = ::bevy::math::UVec2::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u32 = ::bevy::math::UVec2::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u32 = ::bevy::math::UVec2::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u32 = ::bevy::math::UVec2::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u32 = ::bevy::math::UVec2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::as_vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::as_dvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::as_ivec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::as_i64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::as_u64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::wrapping_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::saturating_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::UVec3>::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u32, y: u32, z: u32| { + let output: Val = ::bevy::math::UVec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u32| { + let output: Val = ::bevy::math::UVec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::UVec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u32; 3]| { + let output: Val = ::bevy::math::UVec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u32; 3] = ::bevy::math::UVec3::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: u32| { + let output: Val = ::bevy::math::UVec3::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::UVec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u32| { + let output: Val = ::bevy::math::UVec3::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u32| { + let output: Val = ::bevy::math::UVec3::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u32| { + let output: Val = ::bevy::math::UVec3::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u32 = ::bevy::math::UVec3::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::UVec3::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u32 = ::bevy::math::UVec3::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u32 = ::bevy::math::UVec3::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u32 = ::bevy::math::UVec3::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u32 = ::bevy::math::UVec3::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u32 = ::bevy::math::UVec3::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::as_vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::as_vec3a( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::as_dvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::as_ivec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::as_i64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::as_u64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::wrapping_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::saturating_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::UVec3::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::UVec3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::UVec4>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::UVec4::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u32, y: u32, z: u32, w: u32| { + let output: Val = ::bevy::math::UVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u32| { + let output: Val = ::bevy::math::UVec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::UVec4::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u32; 4]| { + let output: Val = ::bevy::math::UVec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u32; 4] = ::bevy::math::UVec4::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::UVec4::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u32| { + let output: Val = ::bevy::math::UVec4::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u32| { + let output: Val = ::bevy::math::UVec4::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u32| { + let output: Val = ::bevy::math::UVec4::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: u32| { + let output: Val = ::bevy::math::UVec4::with_w( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u32 = ::bevy::math::UVec4::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::UVec4::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u32 = ::bevy::math::UVec4::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u32 = ::bevy::math::UVec4::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u32 = ::bevy::math::UVec4::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u32 = ::bevy::math::UVec4::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u32 = ::bevy::math::UVec4::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::as_vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::as_dvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::as_ivec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::as_i64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::as_u64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::wrapping_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::saturating_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::UVec4::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::U64Vec2>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::U64Vec2::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::U64Vec2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u64, y: u64| { + let output: Val = ::bevy::math::U64Vec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u64| { + let output: Val = ::bevy::math::U64Vec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::U64Vec2::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u64; 2]| { + let output: Val = ::bevy::math::U64Vec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u64; 2] = ::bevy::math::U64Vec2::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: u64| { + let output: Val = ::bevy::math::U64Vec2::extend( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u64| { + let output: Val = ::bevy::math::U64Vec2::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u64| { + let output: Val = ::bevy::math::U64Vec2::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u64 = ::bevy::math::U64Vec2::dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::U64Vec2::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec2::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec2::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec2::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec2::element_product( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::as_vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::as_dvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::as_ivec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::as_uvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::as_i64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::wrapping_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::saturating_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::U64Vec3>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u64, y: u64, z: u64| { + let output: Val = ::bevy::math::U64Vec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u64| { + let output: Val = ::bevy::math::U64Vec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::U64Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u64; 3]| { + let output: Val = ::bevy::math::U64Vec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u64; 3] = ::bevy::math::U64Vec3::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: u64| { + let output: Val = ::bevy::math::U64Vec3::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::U64Vec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u64| { + let output: Val = ::bevy::math::U64Vec3::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u64| { + let output: Val = ::bevy::math::U64Vec3::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u64| { + let output: Val = ::bevy::math::U64Vec3::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u64 = ::bevy::math::U64Vec3::dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::U64Vec3::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec3::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec3::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec3::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec3::element_product( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec3::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::as_vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::as_vec3a( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::as_dvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::as_ivec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::as_uvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::as_i64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::wrapping_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::saturating_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::U64Vec3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::U64Vec3::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::U64Vec4>::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::U64Vec4::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::U64Vec4::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: u64, y: u64, z: u64, w: u64| { + let output: Val = ::bevy::math::U64Vec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: u64| { + let output: Val = ::bevy::math::U64Vec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::U64Vec4::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [u64; 4]| { + let output: Val = ::bevy::math::U64Vec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [u64; 4] = ::bevy::math::U64Vec4::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::U64Vec4::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: u64| { + let output: Val = ::bevy::math::U64Vec4::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: u64| { + let output: Val = ::bevy::math::U64Vec4::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: u64| { + let output: Val = ::bevy::math::U64Vec4::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: u64| { + let output: Val = ::bevy::math::U64Vec4::with_w( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: u64 = ::bevy::math::U64Vec4::dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::U64Vec4::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec4::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec4::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec4::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec4::element_product( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: u64 = ::bevy::math::U64Vec4::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::as_vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::as_dvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::as_ivec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::as_uvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::as_i64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::wrapping_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::wrapping_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::wrapping_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::wrapping_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::saturating_add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::saturating_sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::saturating_mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::saturating_div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "wrapping_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::wrapping_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "saturating_add_signed", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::saturating_add_signed( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Vec2>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32| { + let output: Val = ::bevy::math::Vec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = ::bevy::math::Vec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::Vec2::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 2]| { + let output: Val = ::bevy::math::Vec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 2] = ::bevy::math::Vec2::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: f32| { + let output: Val = ::bevy::math::Vec2::extend( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = ::bevy::math::Vec2::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = ::bevy::math::Vec2::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec2::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::Vec2::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::Vec2::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::Vec2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::Vec2::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec2::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec2::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::Vec2::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::Vec2::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = ::bevy::math::Vec2::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = ::bevy::math::Vec2::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = ::bevy::math::Vec2::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Vec2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = ::bevy::math::Vec2::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = ::bevy::math::Vec2::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = ::bevy::math::Vec2::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::Vec2::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::Vec2::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + |_self: Val, normal: Val, eta: f32| { + let output: Val = ::bevy::math::Vec2::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = ::bevy::math::Vec2::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_angle", + |_self: Val| { + let output: f32 = ::bevy::math::Vec2::to_angle(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec2::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_to", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec2::angle_to( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::perp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::rotate( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f32| + { + let output: Val = ::bevy::math::Vec2::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec2", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::as_dvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::as_ivec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::as_uvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::as_i64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::as_u64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Vec2::eq(_self.into(), other.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Vec3A>::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::Vec3A::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = ::bevy::math::Vec3A::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::Vec3A::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 3]| { + let output: Val = ::bevy::math::Vec3A::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 3] = ::bevy::math::Vec3A::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "from_vec4", + |v: Val| { + let output: Val = ::bevy::math::Vec3A::from_vec4( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: f32| { + let output: Val = ::bevy::math::Vec3A::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = ::bevy::math::Vec3A::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = ::bevy::math::Vec3A::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f32| { + let output: Val = ::bevy::math::Vec3A::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3A::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::Vec3A::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::Vec3A::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::Vec3A::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::Vec3A::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = ::bevy::math::Vec3A::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3A::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3A::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::Vec3A::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::Vec3A::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = ::bevy::math::Vec3A::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = ::bevy::math::Vec3A::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = ::bevy::math::Vec3A::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Vec3A::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = ::bevy::math::Vec3A::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = ::bevy::math::Vec3A::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = ::bevy::math::Vec3A::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::Vec3A::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::Vec3A::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f32| + { + let output: Val = ::bevy::math::Vec3A::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3A::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::any_orthogonal_vector( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::any_orthonormal_vector( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::as_dvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::as_ivec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::as_uvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::as_i64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::as_u64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Vec3A::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Vec4>::new(world) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32, w: f32| { + let output: Val = ::bevy::math::Vec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f32| { + let output: Val = ::bevy::math::Vec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::Vec4::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f32; 4]| { + let output: Val = ::bevy::math::Vec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f32; 4] = ::bevy::math::Vec4::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f32| { + let output: Val = ::bevy::math::Vec4::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f32| { + let output: Val = ::bevy::math::Vec4::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f32| { + let output: Val = ::bevy::math::Vec4::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: f32| { + let output: Val = ::bevy::math::Vec4::with_w( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec4::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::Vec4::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::Vec4::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::Vec4::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::Vec4::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f32 = ::bevy::math::Vec4::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec4::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec4::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::Vec4::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::Vec4::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f32| { + let output: Val = ::bevy::math::Vec4::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f32| { + let output: Val = ::bevy::math::Vec4::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f32| { + let output: Val = ::bevy::math::Vec4::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Vec4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f32, max: f32| { + let output: Val = ::bevy::math::Vec4::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f32| { + let output: Val = ::bevy::math::Vec4::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f32| { + let output: Val = ::bevy::math::Vec4::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::Vec4::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::Vec4::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + |_self: Val, normal: Val, eta: f32| { + let output: Val = ::bevy::math::Vec4::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dvec4", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::as_dvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::as_ivec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::as_uvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::as_i64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::as_u64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Vec4::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::BVec2>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::BVec2::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: bool, y: bool| { + let output: Val = ::bevy::math::BVec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = ::bevy::math::BVec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 2]| { + let output: Val = ::bevy::math::BVec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::BVec2::bitmask(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = ::bevy::math::BVec2::any(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = ::bevy::math::BVec2::all(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = ::bevy::math::BVec2::test( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = ::bevy::math::BVec2::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::BVec2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::BVec3>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::BVec3::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool| { + let output: Val = ::bevy::math::BVec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = ::bevy::math::BVec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 3]| { + let output: Val = ::bevy::math::BVec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::BVec3::bitmask(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = ::bevy::math::BVec3::any(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = ::bevy::math::BVec3::all(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = ::bevy::math::BVec3::test( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = ::bevy::math::BVec3::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::BVec3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::BVec4>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::BVec4::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::BVec4::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool, w: bool| { + let output: Val = ::bevy::math::BVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = ::bevy::math::BVec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 4]| { + let output: Val = ::bevy::math::BVec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::BVec4::bitmask(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = ::bevy::math::BVec4::any(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = ::bevy::math::BVec4::all(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = ::bevy::math::BVec4::test( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = ::bevy::math::BVec4::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DVec2>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f64, y: f64| { + let output: Val = ::bevy::math::DVec2::new( + x.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f64| { + let output: Val = ::bevy::math::DVec2::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::DVec2::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 2]| { + let output: Val = ::bevy::math::DVec2::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 2] = ::bevy::math::DVec2::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: f64| { + let output: Val = ::bevy::math::DVec2::extend( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f64| { + let output: Val = ::bevy::math::DVec2::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f64| { + let output: Val = ::bevy::math::DVec2::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec2::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::DVec2::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::DVec2::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::DVec2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::DVec2::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec2::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec2::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::DVec2::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::DVec2::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f64| { + let output: Val = ::bevy::math::DVec2::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f64| { + let output: Val = ::bevy::math::DVec2::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f64| { + let output: Val = ::bevy::math::DVec2::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DVec2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f64, max: f64| { + let output: Val = ::bevy::math::DVec2::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f64| { + let output: Val = ::bevy::math::DVec2::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f64| { + let output: Val = ::bevy::math::DVec2::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::DVec2::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::DVec2::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f64| + { + let output: Val = ::bevy::math::DVec2::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = ::bevy::math::DVec2::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_angle", + |_self: Val| { + let output: f64 = ::bevy::math::DVec2::to_angle(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec2::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_to", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec2::angle_to( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::perp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perp_dot", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec2::perp_dot( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::rotate( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f64| + { + let output: Val = ::bevy::math::DVec2::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec2", + |_self: Ref| { + let output: Val = ::bevy::math::DVec2::as_vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec2", + |_self: Ref| { + let output: Val = ::bevy::math::DVec2::as_ivec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec2", + |_self: Ref| { + let output: Val = ::bevy::math::DVec2::as_uvec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::DVec2::as_i64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec2", + |_self: Ref| { + let output: Val = ::bevy::math::DVec2::as_u64vec2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::DVec2::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DVec2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DVec3>::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::DVec3::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f64, y: f64, z: f64| { + let output: Val = ::bevy::math::DVec3::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f64| { + let output: Val = ::bevy::math::DVec3::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::DVec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 3]| { + let output: Val = ::bevy::math::DVec3::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 3] = ::bevy::math::DVec3::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: f64| { + let output: Val = ::bevy::math::DVec3::extend( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f64| { + let output: Val = ::bevy::math::DVec3::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f64| { + let output: Val = ::bevy::math::DVec3::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f64| { + let output: Val = ::bevy::math::DVec3::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec3::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cross( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::DVec3::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::DVec3::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::DVec3::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::DVec3::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = ::bevy::math::DVec3::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec3::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec3::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::DVec3::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::DVec3::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f64| { + let output: Val = ::bevy::math::DVec3::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f64| { + let output: Val = ::bevy::math::DVec3::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f64| { + let output: Val = ::bevy::math::DVec3::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DVec3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f64, max: f64| { + let output: Val = ::bevy::math::DVec3::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f64| { + let output: Val = ::bevy::math::DVec3::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f64| { + let output: Val = ::bevy::math::DVec3::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::DVec3::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::DVec3::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f64| + { + let output: Val = ::bevy::math::DVec3::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec3::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::any_orthogonal_vector( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::any_orthonormal_vector( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_vec3a( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_ivec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_uvec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_i64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_u64vec3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DVec4>::new(world) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f64, y: f64, z: f64, w: f64| { + let output: Val = ::bevy::math::DVec4::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: f64| { + let output: Val = ::bevy::math::DVec4::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::DVec4::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 4]| { + let output: Val = ::bevy::math::DVec4::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 4] = ::bevy::math::DVec4::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: f64| { + let output: Val = ::bevy::math::DVec4::with_x( + _self.into(), + x.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: f64| { + let output: Val = ::bevy::math::DVec4::with_y( + _self.into(), + y.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: f64| { + let output: Val = ::bevy::math::DVec4::with_z( + _self.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_w", + |_self: Val, w: f64| { + let output: Val = ::bevy::math::DVec4::with_w( + _self.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec4::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::min( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "max", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::max( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp", + | + _self: Val, + min: Val, + max: Val| + { + let output: Val = ::bevy::math::DVec4::clamp( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "min_element", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::min_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "max_element", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::max_element(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_sum", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::element_sum(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "element_product", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::element_product(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpeq", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::cmpeq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpne", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::cmpne( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpge", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::cmpge( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmpgt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::cmpgt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmple", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::cmple( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cmplt", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::cmplt( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "signum", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::signum( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "copysign", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::copysign( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_negative_bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::DVec4::is_negative_bitmask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::DVec4::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite_mask", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::is_finite_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::DVec4::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_nan_mask", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::is_nan_mask( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = ::bevy::math::DVec4::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "distance", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec4::distance( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "distance_squared", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DVec4::distance_squared( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::div_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem_euclid", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::rem_euclid( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or", + |_self: Val, fallback: Val| { + let output: Val = ::bevy::math::DVec4::normalize_or( + _self.into(), + fallback.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize_or_zero", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::normalize_or_zero( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::DVec4::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::project_onto( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::reject_from( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_onto_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::project_onto_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reject_from_normalized", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::reject_from_normalized( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "round", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::round( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "floor", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::floor( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "ceil", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::ceil( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "trunc", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::trunc( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::fract( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fract_gl", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::fract_gl( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "exp", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::exp( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "powf", + |_self: Val, n: f64| { + let output: Val = ::bevy::math::DVec4::powf( + _self.into(), + n.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "recip", + |_self: Val| { + let output: Val = ::bevy::math::DVec4::recip( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, rhs: Val, s: f64| { + let output: Val = ::bevy::math::DVec4::lerp( + _self.into(), + rhs.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "move_towards", + |_self: Ref, rhs: Val, d: f64| { + let output: Val = ::bevy::math::DVec4::move_towards( + _self.into(), + rhs.into(), + d.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "midpoint", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::midpoint( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DVec4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length", + |_self: Val, min: f64, max: f64| { + let output: Val = ::bevy::math::DVec4::clamp_length( + _self.into(), + min.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_max", + |_self: Val, max: f64| { + let output: Val = ::bevy::math::DVec4::clamp_length_max( + _self.into(), + max.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clamp_length_min", + |_self: Val, min: f64| { + let output: Val = ::bevy::math::DVec4::clamp_length_min( + _self.into(), + min.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_add", + | + _self: Val, + a: Val, + b: Val| + { + let output: Val = ::bevy::math::DVec4::mul_add( + _self.into(), + a.into(), + b.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reflect", + |_self: Val, normal: Val| { + let output: Val = ::bevy::math::DVec4::reflect( + _self.into(), + normal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "refract", + | + _self: Val, + normal: Val, + eta: f64| + { + let output: Val = ::bevy::math::DVec4::refract( + _self.into(), + normal.into(), + eta.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_ivec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_uvec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_i64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_u64vec4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::DVec4::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Mat2>::new(world) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat2::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat2::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + |x_axis: Val, y_axis: Val| { + let output: Val = ::bevy::math::Mat2::from_cols( + x_axis.into(), + y_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 4] = ::bevy::math::Mat2::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 2]; 2] = ::bevy::math::Mat2::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::Mat2::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle", + |scale: Val, angle: f32| { + let output: Val = ::bevy::math::Mat2::from_scale_angle( + scale.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = ::bevy::math::Mat2::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = ::bevy::math::Mat2::from_mat3( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_minor", + |m: Val, i: usize, j: usize| { + let output: Val = ::bevy::math::Mat2::from_mat3_minor( + m.into(), + i.into(), + j.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |m: Val| { + let output: Val = ::bevy::math::Mat2::from_mat3a( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a_minor", + |m: Val, i: usize, j: usize| { + let output: Val = ::bevy::math::Mat2::from_mat3a_minor( + m.into(), + i.into(), + j.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat2::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat2::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::Mat2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::Mat2::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::Mat2::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = ::bevy::math::Mat2::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Mat2::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat2::mul_vec2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat2::mul_mat2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat2::add_mat2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat2::sub_mat2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat2::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat2::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Mat2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::Mat2::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dmat2", + |_self: Ref| { + let output: Val = ::bevy::math::Mat2::as_dmat2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Mat3>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = ::bevy::math::Mat3::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 9] = ::bevy::math::Mat3::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 3]; 3] = ::bevy::math::Mat3::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::Mat3::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = ::bevy::math::Mat3::from_mat4( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4_minor", + |m: Val, i: usize, j: usize| { + let output: Val = ::bevy::math::Mat3::from_mat4_minor( + m.into(), + i.into(), + j.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::Mat3::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = ::bevy::math::Mat3::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f32, b: f32, c: f32| { + let output: Val = ::bevy::math::Mat3::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f32, f32, f32) = ::bevy::math::Mat3::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = ::bevy::math::Mat3::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = ::bevy::math::Mat3::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = ::bevy::math::Mat3::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::Mat3::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = ::bevy::math::Mat3::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f32, + translation: Val| + { + let output: Val = ::bevy::math::Mat3::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::Mat3::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |m: Val| { + let output: Val = ::bevy::math::Mat3::from_mat2( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat3::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat3::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::Mat3::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::Mat3::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = ::bevy::math::Mat3::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3::transform_point2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3::transform_vector2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul_vec3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul_vec3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat3::mul_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat3::add_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat3::sub_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat3::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat3::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Mat3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dmat3", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3::as_dmat3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat3::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Mat3A>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3A::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat3A::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat3A::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3A::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = ::bevy::math::Mat3A::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 9] = ::bevy::math::Mat3A::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 3]; 3] = ::bevy::math::Mat3A::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::Mat3A::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = ::bevy::math::Mat3A::from_mat4( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4_minor", + |m: Val, i: usize, j: usize| { + let output: Val = ::bevy::math::Mat3A::from_mat4_minor( + m.into(), + i.into(), + j.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::Mat3A::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = ::bevy::math::Mat3A::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f32, b: f32, c: f32| { + let output: Val = ::bevy::math::Mat3A::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f32, f32, f32) = ::bevy::math::Mat3A::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = ::bevy::math::Mat3A::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = ::bevy::math::Mat3A::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = ::bevy::math::Mat3A::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::Mat3A::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = ::bevy::math::Mat3A::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f32, + translation: Val| + { + let output: Val = ::bevy::math::Mat3A::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::Mat3A::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |m: Val| { + let output: Val = ::bevy::math::Mat3A::from_mat2( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat3A::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat3A::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::Mat3A::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::Mat3A::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3A::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = ::bevy::math::Mat3A::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3A::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::transform_point2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::transform_vector2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul_vec3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul_vec3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat3A::mul_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat3A::add_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat3A::sub_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat3A::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat3A::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Mat3A::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3A::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dmat3", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3A::as_dmat3( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Mat4>::new(world) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat4::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = ::bevy::math::Mat4::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 16] = ::bevy::math::Mat4::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 4]; 4] = ::bevy::math::Mat4::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::Mat4::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = ::bevy::math::Mat4::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = ::bevy::math::Mat4::from_rotation_translation( + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::Mat4::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = ::bevy::math::Mat4::from_mat3( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |m: Val| { + let output: Val = ::bevy::math::Mat4::from_mat3a( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::Mat4::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = ::bevy::math::Mat4::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f32, b: f32, c: f32| { + let output: Val = ::bevy::math::Mat4::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f32, f32, f32) = ::bevy::math::Mat4::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = ::bevy::math::Mat4::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = ::bevy::math::Mat4::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = ::bevy::math::Mat4::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::Mat4::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat4::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::Mat4::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::Mat4::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::Mat4::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::Mat4::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f32 = ::bevy::math::Mat4::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Mat4::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::Mat4::look_to_lh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::Mat4::look_to_rh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::Mat4::look_at_lh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::Mat4::look_at_rh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh_gl", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { + let output: Val = ::bevy::math::Mat4::perspective_rh_gl( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_lh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { + let output: Val = ::bevy::math::Mat4::perspective_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { + let output: Val = ::bevy::math::Mat4::perspective_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_lh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = ::bevy::math::Mat4::perspective_infinite_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_lh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_rh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = ::bevy::math::Mat4::perspective_infinite_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_rh", + |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { + let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh_gl", + |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { + let output: Val = ::bevy::math::Mat4::orthographic_rh_gl( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_lh", + |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { + let output: Val = ::bevy::math::Mat4::orthographic_lh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh", + |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { + let output: Val = ::bevy::math::Mat4::orthographic_rh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_point3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::project_point3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::transform_point3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::transform_vector3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_point3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::project_point3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::transform_point3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::transform_vector3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec4", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul_vec4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat4::mul_mat4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat4::add_mat4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::Mat4::sub_mat4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat4::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f32| { + let output: Val = ::bevy::math::Mat4::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Mat4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::Mat4::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_dmat4", + |_self: Ref| { + let output: Val = ::bevy::math::Mat4::as_dmat4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DMat2>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DMat2::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DMat2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DMat2::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + |x_axis: Val, y_axis: Val| { + let output: Val = ::bevy::math::DMat2::from_cols( + x_axis.into(), + y_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 4] = ::bevy::math::DMat2::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 2]; 2] = ::bevy::math::DMat2::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::DMat2::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle", + |scale: Val, angle: f64| { + let output: Val = ::bevy::math::DMat2::from_scale_angle( + scale.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = ::bevy::math::DMat2::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = ::bevy::math::DMat2::from_mat3( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_minor", + |m: Val, i: usize, j: usize| { + let output: Val = ::bevy::math::DMat2::from_mat3_minor( + m.into(), + i.into(), + j.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::DMat2::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::DMat2::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::DMat2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::DMat2::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::DMat2::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f64 = ::bevy::math::DMat2::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::DMat2::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat2::mul_vec2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat2::mul_mat2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat2::add_mat2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat2", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat2::sub_mat2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat2::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat2::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DMat2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::DMat2::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_mat2", + |_self: Ref| { + let output: Val = ::bevy::math::DMat2::as_mat2( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat2::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DMat3>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = ::bevy::math::DMat3::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 9] = ::bevy::math::DMat3::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 3]; 3] = ::bevy::math::DMat3::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::DMat3::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = ::bevy::math::DMat3::from_mat4( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4_minor", + |m: Val, i: usize, j: usize| { + let output: Val = ::bevy::math::DMat3::from_mat4_minor( + m.into(), + i.into(), + j.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::DMat3::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = ::bevy::math::DMat3::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f64, b: f64, c: f64| { + let output: Val = ::bevy::math::DMat3::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f64, f64, f64) = ::bevy::math::DMat3::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = ::bevy::math::DMat3::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = ::bevy::math::DMat3::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = ::bevy::math::DMat3::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::DMat3::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = ::bevy::math::DMat3::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f64, + translation: Val| + { + let output: Val = ::bevy::math::DMat3::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::DMat3::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |m: Val| { + let output: Val = ::bevy::math::DMat3::from_mat2( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::DMat3::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::DMat3::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::DMat3::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::DMat3::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::DMat3::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f64 = ::bevy::math::DMat3::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::DMat3::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat3::transform_point2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat3::transform_vector2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat3::mul_vec3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat3::mul_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat3::add_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat3", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat3::sub_mat3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat3::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat3::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DMat3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::DMat3::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_mat3", + |_self: Ref| { + let output: Val = ::bevy::math::DMat3::as_mat3( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DMat3::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DMat3::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DMat3::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DMat4>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = ::bevy::math::DMat4::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 16] = ::bevy::math::DMat4::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 4]; 4] = ::bevy::math::DMat4::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_diagonal", + |diagonal: Val| { + let output: Val = ::bevy::math::DMat4::from_diagonal( + diagonal.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = ::bevy::math::DMat4::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = ::bevy::math::DMat4::from_rotation_translation( + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::DMat4::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = ::bevy::math::DMat4::from_mat3( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::DMat4::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = ::bevy::math::DMat4::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |order: Val, a: f64, b: f64, c: f64| { + let output: Val = ::bevy::math::DMat4::from_euler( + order.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Ref, order: Val| { + let output: (f64, f64, f64) = ::bevy::math::DMat4::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = ::bevy::math::DMat4::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = ::bevy::math::DMat4::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = ::bevy::math::DMat4::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::DMat4::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "col", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::DMat4::col( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "row", + |_self: Ref, index: usize| { + let output: Val = ::bevy::math::DMat4::row( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::DMat4::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::DMat4::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "transpose", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::transpose( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "determinant", + |_self: Ref| { + let output: f64 = ::bevy::math::DMat4::determinant(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::DMat4::look_to_lh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::DMat4::look_to_rh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::DMat4::look_at_lh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::DMat4::look_at_rh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh_gl", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { + let output: Val = ::bevy::math::DMat4::perspective_rh_gl( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_lh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { + let output: Val = ::bevy::math::DMat4::perspective_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_rh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { + let output: Val = ::bevy::math::DMat4::perspective_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + z_far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_lh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = ::bevy::math::DMat4::perspective_infinite_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_lh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_lh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_rh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = ::bevy::math::DMat4::perspective_infinite_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "perspective_infinite_reverse_rh", + |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { + let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_rh( + fov_y_radians.into(), + aspect_ratio.into(), + z_near.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh_gl", + |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { + let output: Val = ::bevy::math::DMat4::orthographic_rh_gl( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_lh", + |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { + let output: Val = ::bevy::math::DMat4::orthographic_lh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "orthographic_rh", + |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { + let output: Val = ::bevy::math::DMat4::orthographic_rh( + left.into(), + right.into(), + bottom.into(), + top.into(), + near.into(), + far.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "project_point3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat4::project_point3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat4::transform_point3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat4::transform_vector3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec4", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul_vec4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat4::mul_mat4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat4::add_mat4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat4::sub_mat4( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat4::mul_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat4::div_scalar( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DMat4::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::abs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_mat4", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::as_mat4( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DMat4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DMat4::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Affine2>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Affine2::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = ::bevy::math::Affine2::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 6] = ::bevy::math::Affine2::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 2]; 3] = ::bevy::math::Affine2::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::Affine2::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f32| { + let output: Val = ::bevy::math::Affine2::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::Affine2::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |matrix2: Val| { + let output: Val = ::bevy::math::Affine2::from_mat2( + matrix2.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2_translation", + |matrix2: Val, translation: Val| { + let output: Val = ::bevy::math::Affine2::from_mat2_translation( + matrix2.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f32, + translation: Val| + { + let output: Val = ::bevy::math::Affine2::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle_translation", + |angle: f32, translation: Val| { + let output: Val = ::bevy::math::Affine2::from_angle_translation( + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = ::bevy::math::Affine2::from_mat3( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3a", + |m: Val| { + let output: Val = ::bevy::math::Affine2::from_mat3a( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Affine2::transform_point2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Affine2::transform_vector2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::Affine2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::Affine2::is_nan(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Affine2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Affine2::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Affine2::eq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Affine3A>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Affine3A::eq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Affine3A::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = ::bevy::math::Affine3A::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f32; 12] = ::bevy::math::Affine3A::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f32; 3]; 4] = ::bevy::math::Affine3A::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::Affine3A::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::Affine3A::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f32| { + let output: Val = ::bevy::math::Affine3A::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f32| { + let output: Val = ::bevy::math::Affine3A::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f32| { + let output: Val = ::bevy::math::Affine3A::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f32| { + let output: Val = ::bevy::math::Affine3A::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::Affine3A::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat3: Val| { + let output: Val = ::bevy::math::Affine3A::from_mat3( + mat3.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_translation", + |mat3: Val, translation: Val| { + let output: Val = ::bevy::math::Affine3A::from_mat3_translation( + mat3.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = ::bevy::math::Affine3A::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = ::bevy::math::Affine3A::from_rotation_translation( + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = ::bevy::math::Affine3A::from_mat4( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::Affine3A::look_to_lh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::Affine3A::look_to_rh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::Affine3A::look_at_lh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::Affine3A::look_at_rh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::transform_point3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::transform_vector3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::transform_point3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3a", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::transform_vector3a( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::Affine3A::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::Affine3A::is_nan(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f32| + { + let output: bool = ::bevy::math::Affine3A::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::Affine3A::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DAffine2>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DAffine2::eq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val| + { + let output: Val = ::bevy::math::DAffine2::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 6] = ::bevy::math::DAffine2::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 2]; 3] = ::bevy::math::DAffine2::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::DAffine2::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle", + |angle: f64| { + let output: Val = ::bevy::math::DAffine2::from_angle( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::DAffine2::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2", + |matrix2: Val| { + let output: Val = ::bevy::math::DAffine2::from_mat2( + matrix2.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat2_translation", + |matrix2: Val, translation: Val| { + let output: Val = ::bevy::math::DAffine2::from_mat2_translation( + matrix2.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_angle_translation", + | + scale: Val, + angle: f64, + translation: Val| + { + let output: Val = ::bevy::math::DAffine2::from_scale_angle_translation( + scale.into(), + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_angle_translation", + |angle: f64, translation: Val| { + let output: Val = ::bevy::math::DAffine2::from_angle_translation( + angle.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |m: Val| { + let output: Val = ::bevy::math::DAffine2::from_mat3( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DAffine2::transform_point2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector2", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DAffine2::transform_vector2( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::DAffine2::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::DAffine2::is_nan(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DAffine2::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::DAffine2::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine2::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DAffine2::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DAffine3>::new(world) + .overwrite_script_function( + "from_cols", + | + x_axis: Val, + y_axis: Val, + z_axis: Val, + w_axis: Val| + { + let output: Val = ::bevy::math::DAffine3::from_cols( + x_axis.into(), + y_axis.into(), + z_axis.into(), + w_axis.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array", + |_self: Ref| { + let output: [f64; 12] = ::bevy::math::DAffine3::to_cols_array( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_cols_array_2d", + |_self: Ref| { + let output: [[f64; 3]; 4] = ::bevy::math::DAffine3::to_cols_array_2d( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale", + |scale: Val| { + let output: Val = ::bevy::math::DAffine3::from_scale( + scale.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_quat", + |rotation: Val| { + let output: Val = ::bevy::math::DAffine3::from_quat( + rotation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = ::bevy::math::DAffine3::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = ::bevy::math::DAffine3::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = ::bevy::math::DAffine3::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = ::bevy::math::DAffine3::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_translation", + |translation: Val| { + let output: Val = ::bevy::math::DAffine3::from_translation( + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat3: Val| { + let output: Val = ::bevy::math::DAffine3::from_mat3( + mat3.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3_translation", + |mat3: Val, translation: Val| { + let output: Val = ::bevy::math::DAffine3::from_mat3_translation( + mat3.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scale_rotation_translation", + | + scale: Val, + rotation: Val, + translation: Val| + { + let output: Val = ::bevy::math::DAffine3::from_scale_rotation_translation( + scale.into(), + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_translation", + |rotation: Val, translation: Val| { + let output: Val = ::bevy::math::DAffine3::from_rotation_translation( + rotation.into(), + translation.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |m: Val| { + let output: Val = ::bevy::math::DAffine3::from_mat4( + m.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_lh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::DAffine3::look_to_lh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_to_rh", + | + eye: Val, + dir: Val, + up: Val| + { + let output: Val = ::bevy::math::DAffine3::look_to_rh( + eye.into(), + dir.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_lh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::DAffine3::look_at_lh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "look_at_rh", + | + eye: Val, + center: Val, + up: Val| + { + let output: Val = ::bevy::math::DAffine3::look_at_rh( + eye.into(), + center.into(), + up.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_point3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DAffine3::transform_point3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "transform_vector3", + |_self: Ref, rhs: Val| { + let output: Val = ::bevy::math::DAffine3::transform_vector3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::math::DAffine3::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Ref| { + let output: bool = ::bevy::math::DAffine3::is_nan(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DAffine3::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Ref| { + let output: Val = ::bevy::math::DAffine3::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DAffine3::eq( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DAffine3::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DQuat>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DQuat::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DQuat::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xyzw", + |x: f64, y: f64, z: f64, w: f64| { + let output: Val = ::bevy::math::DQuat::from_xyzw( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [f64; 4]| { + let output: Val = ::bevy::math::DQuat::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_vec4", + |v: Val| { + let output: Val = ::bevy::math::DQuat::from_vec4( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_axis_angle", + |axis: Val, angle: f64| { + let output: Val = ::bevy::math::DQuat::from_axis_angle( + axis.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_scaled_axis", + |v: Val| { + let output: Val = ::bevy::math::DQuat::from_scaled_axis( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_x", + |angle: f64| { + let output: Val = ::bevy::math::DQuat::from_rotation_x( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_y", + |angle: f64| { + let output: Val = ::bevy::math::DQuat::from_rotation_y( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_z", + |angle: f64| { + let output: Val = ::bevy::math::DQuat::from_rotation_z( + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_euler", + |euler: Val, a: f64, b: f64, c: f64| { + let output: Val = ::bevy::math::DQuat::from_euler( + euler.into(), + a.into(), + b.into(), + c.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat3", + |mat: Ref| { + let output: Val = ::bevy::math::DQuat::from_mat3( + mat.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_mat4", + |mat: Ref| { + let output: Val = ::bevy::math::DQuat::from_mat4( + mat.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc", + |from: Val, to: Val| { + let output: Val = ::bevy::math::DQuat::from_rotation_arc( + from.into(), + to.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_colinear", + |from: Val, to: Val| { + let output: Val = ::bevy::math::DQuat::from_rotation_arc_colinear( + from.into(), + to.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_rotation_arc_2d", + |from: Val, to: Val| { + let output: Val = ::bevy::math::DQuat::from_rotation_arc_2d( + from.into(), + to.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_scaled_axis", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::to_scaled_axis( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_euler", + |_self: Val, order: Val| { + let output: (f64, f64, f64) = ::bevy::math::DQuat::to_euler( + _self.into(), + order.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [f64; 4] = ::bevy::math::DQuat::to_array(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "xyz", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::xyz( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "conjugate", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::conjugate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "inverse", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::inverse( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DQuat::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length", + |_self: Val| { + let output: f64 = ::bevy::math::DQuat::length(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "length_squared", + |_self: Val| { + let output: f64 = ::bevy::math::DQuat::length_squared(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "length_recip", + |_self: Val| { + let output: f64 = ::bevy::math::DQuat::length_recip(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "normalize", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::normalize( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Val| { + let output: bool = ::bevy::math::DQuat::is_finite(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nan", + |_self: Val| { + let output: bool = ::bevy::math::DQuat::is_nan(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_normalized", + |_self: Val| { + let output: bool = ::bevy::math::DQuat::is_normalized(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_near_identity", + |_self: Val| { + let output: bool = ::bevy::math::DQuat::is_near_identity( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "angle_between", + |_self: Val, rhs: Val| { + let output: f64 = ::bevy::math::DQuat::angle_between( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_towards", + | + _self: Ref, + rhs: Val, + max_angle: f64| + { + let output: Val = ::bevy::math::DQuat::rotate_towards( + _self.into(), + rhs.into(), + max_angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "abs_diff_eq", + | + _self: Val, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DQuat::abs_diff_eq( + _self.into(), + rhs.into(), + max_abs_diff.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "lerp", + |_self: Val, end: Val, s: f64| { + let output: Val = ::bevy::math::DQuat::lerp( + _self.into(), + end.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "slerp", + |_self: Val, end: Val, s: f64| { + let output: Val = ::bevy::math::DQuat::slerp( + _self.into(), + end.into(), + s.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_vec3", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::mul_vec3( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_quat", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::mul_quat( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_affine3", + |a: Ref| { + let output: Val = ::bevy::math::DQuat::from_affine3( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_quat", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::as_quat( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DQuat::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DQuat::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::EulerRot>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::EulerRot::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::EulerRot::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::EulerRot::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::BVec3A>::new(world) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool| { + let output: Val = ::bevy::math::BVec3A::new( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = ::bevy::math::BVec3A::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 3]| { + let output: Val = ::bevy::math::BVec3A::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::BVec3A::bitmask(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = ::bevy::math::BVec3A::any(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = ::bevy::math::BVec3A::all(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = ::bevy::math::BVec3A::test( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = ::bevy::math::BVec3A::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec3A::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::BVec3A::eq(_self.into(), rhs.into()) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::BVec4A>::new(world) + .overwrite_script_function( + "new", + |x: bool, y: bool, z: bool, w: bool| { + let output: Val = ::bevy::math::BVec4A::new( + x.into(), + y.into(), + z.into(), + w.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: bool| { + let output: Val = ::bevy::math::BVec4A::splat( + v.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [bool; 4]| { + let output: Val = ::bevy::math::BVec4A::from_array( + a.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::BVec4A::bitmask(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = ::bevy::math::BVec4A::any(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = ::bevy::math::BVec4A::all(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = ::bevy::math::BVec4A::test( + _self.into(), + index.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = ::bevy::math::BVec4A::set( + _self.into(), + index.into(), + value.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::BVec4A::eq(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec4A::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::smol_str::SmolStr>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::smol_str::SmolStr::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::smol_str::SmolStr::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_string", + |_self: Ref| { + let output: std::string::String = ::smol_str::SmolStr::to_string( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "len", + |_self: Ref| { + let output: usize = ::smol_str::SmolStr::len(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_empty", + |_self: Ref| { + let output: bool = ::smol_str::SmolStr::is_empty(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_heap_allocated", + |_self: Ref| { + let output: bool = ::smol_str::SmolStr::is_heap_allocated( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::uuid::Uuid>::new(world) + .overwrite_script_function( + "get_version_num", + |_self: Ref| { + let output: usize = ::uuid::Uuid::get_version_num(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u128", + |_self: Ref| { + let output: u128 = ::uuid::Uuid::as_u128(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "to_u128_le", + |_self: Ref| { + let output: u128 = ::uuid::Uuid::to_u128_le(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "as_u64_pair", + |_self: Ref| { + let output: (u64, u64) = ::uuid::Uuid::as_u64_pair(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "into_bytes", + |_self: Val| { + let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "to_bytes_le", + |_self: Ref| { + let output: [u8; 16] = ::uuid::Uuid::to_bytes_le(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_nil", + |_self: Ref| { + let output: bool = ::uuid::Uuid::is_nil(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "is_max", + |_self: Ref| { + let output: bool = ::uuid::Uuid::is_max(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "encode_buffer", + || { + let output: [u8; 45] = ::uuid::Uuid::encode_buffer().into(); + output + }, + ) + .overwrite_script_function( + "get_node_id", + |_self: Ref| { + let output: bevy::reflect::erased_serde::__private::serde::__private::Option< + [u8; 6], + > = ::uuid::Uuid::get_node_id(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::uuid::Uuid::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "nil", + || { + let output: Val = ::uuid::Uuid::nil().into(); + output + }, + ) + .overwrite_script_function( + "max", + || { + let output: Val = ::uuid::Uuid::max().into(); + output + }, + ) + .overwrite_script_function( + "from_u128", + |v: u128| { + let output: Val = ::uuid::Uuid::from_u128(v.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "from_u128_le", + |v: u128| { + let output: Val = ::uuid::Uuid::from_u128_le(v.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "from_u64_pair", + |high_bits: u64, low_bits: u64| { + let output: Val = ::uuid::Uuid::from_u64_pair( + high_bits.into(), + low_bits.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_bytes", + |bytes: [u8; 16]| { + let output: Val = ::uuid::Uuid::from_bytes(bytes.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "from_bytes_le", + |b: [u8; 16]| { + let output: Val = ::uuid::Uuid::from_bytes_le(b.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::uuid::Uuid::eq(_self.into(), other.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::uuid::Uuid::clone(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "new_v4", + || { + let output: Val = ::uuid::Uuid::new_v4().into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs new file mode 100644 index 0000000000..2a0259468a --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -0,0 +1,355 @@ +// @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::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyTimeScriptingPlugin; +impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::time::prelude::Fixed>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::Fixed::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::time::prelude::Real>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::Real::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::time::prelude::Timer>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::Timer::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::time::prelude::Timer::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_seconds", + |duration: f32, mode: Val| { + let output: Val = ::bevy::time::prelude::Timer::from_seconds( + duration.into(), + mode.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "finished", + |_self: Ref| { + let output: bool = ::bevy::time::prelude::Timer::finished( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "just_finished", + |_self: Ref| { + let output: bool = ::bevy::time::prelude::Timer::just_finished( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs", + |_self: Ref| { + let output: f32 = ::bevy::time::prelude::Timer::elapsed_secs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs_f64", + |_self: Ref| { + let output: f64 = ::bevy::time::prelude::Timer::elapsed_secs_f64( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mode", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::Timer::mode( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "set_mode", + | + _self: Mut, + mode: Val| + { + let output: () = ::bevy::time::prelude::Timer::set_mode( + _self.into(), + mode.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "pause", + |_self: Mut| { + let output: () = ::bevy::time::prelude::Timer::pause(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "unpause", + |_self: Mut| { + let output: () = ::bevy::time::prelude::Timer::unpause(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "paused", + |_self: Ref| { + let output: bool = ::bevy::time::prelude::Timer::paused(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "reset", + |_self: Mut| { + let output: () = ::bevy::time::prelude::Timer::reset(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "fraction", + |_self: Ref| { + let output: f32 = ::bevy::time::prelude::Timer::fraction( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "fraction_remaining", + |_self: Ref| { + let output: f32 = ::bevy::time::prelude::Timer::fraction_remaining( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "remaining_secs", + |_self: Ref| { + let output: f32 = ::bevy::time::prelude::Timer::remaining_secs( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "times_finished_this_tick", + |_self: Ref| { + let output: u32 = ::bevy::time::prelude::Timer::times_finished_this_tick( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::time::prelude::Timer::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::time::prelude::TimerMode>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::time::prelude::TimerMode::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::TimerMode::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::time::prelude::Virtual>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::Virtual::clone( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::time::Stopwatch>::new(world) + .overwrite_script_function( + "new", + || { + let output: Val = ::bevy::time::Stopwatch::new() + .into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs", + |_self: Ref| { + let output: f32 = ::bevy::time::Stopwatch::elapsed_secs(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "elapsed_secs_f64", + |_self: Ref| { + let output: f64 = ::bevy::time::Stopwatch::elapsed_secs_f64( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "pause", + |_self: Mut| { + let output: () = ::bevy::time::Stopwatch::pause(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "unpause", + |_self: Mut| { + let output: () = ::bevy::time::Stopwatch::unpause(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "is_paused", + |_self: Ref| { + let output: bool = ::bevy::time::Stopwatch::is_paused(_self.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "reset", + |_self: Mut| { + let output: () = ::bevy::time::Stopwatch::reset(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::time::Stopwatch::assert_receiver_is_total_eq( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::Stopwatch::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::time::Stopwatch::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs new file mode 100644 index 0000000000..c32d3ee20e --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -0,0 +1,278 @@ +// @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::*; +use super::bevy_core::*; +use super::bevy_math::*; +use super::bevy_hierarchy::*; +use bevy_mod_scripting_core::{ + AddContextInitializer, StoreDocumentation, + bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, +}; +use crate::*; +pub struct BevyTransformScriptingPlugin; +impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + let mut world = app.world_mut(); + NamespaceBuilder::<::bevy::transform::components::GlobalTransform>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::transform::components::GlobalTransform::clone( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + global_transform: Val| + { + let output: Val = ::bevy::transform::components::GlobalTransform::mul( + _self.into(), + global_transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + transform: Val| + { + let output: Val = ::bevy::transform::components::GlobalTransform::mul( + _self.into(), + transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::transform::components::GlobalTransform::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_xyz", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::transform::components::GlobalTransform::from_xyz( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "compute_transform", + |_self: Ref| { + let output: Val = ::bevy::transform::components::GlobalTransform::compute_transform( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "reparented_to", + | + _self: Ref, + parent: Ref| + { + let output: Val = ::bevy::transform::components::GlobalTransform::reparented_to( + _self.into(), + parent.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_transform", + | + _self: Ref, + transform: Val| + { + let output: Val = ::bevy::transform::components::GlobalTransform::mul_transform( + _self.into(), + transform.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::transform::components::Transform>::new(world) + .overwrite_script_function( + "from_xyz", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::transform::components::Transform::from_xyz( + x.into(), + y.into(), + z.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_x", + |_self: Mut, angle: f32| { + let output: () = ::bevy::transform::components::Transform::rotate_x( + _self.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_y", + |_self: Mut, angle: f32| { + let output: () = ::bevy::transform::components::Transform::rotate_y( + _self.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_z", + |_self: Mut, angle: f32| { + let output: () = ::bevy::transform::components::Transform::rotate_z( + _self.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_local_x", + |_self: Mut, angle: f32| { + let output: () = ::bevy::transform::components::Transform::rotate_local_x( + _self.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_local_y", + |_self: Mut, angle: f32| { + let output: () = ::bevy::transform::components::Transform::rotate_local_y( + _self.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rotate_local_z", + |_self: Mut, angle: f32| { + let output: () = ::bevy::transform::components::Transform::rotate_local_z( + _self.into(), + angle.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul_transform", + | + _self: Ref, + transform: Val| + { + let output: Val = ::bevy::transform::components::Transform::mul_transform( + _self.into(), + transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "is_finite", + |_self: Ref| { + let output: bool = ::bevy::transform::components::Transform::is_finite( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::transform::components::Transform::eq( + _self.into(), + other.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + transform: Val| + { + let output: Val = ::bevy::transform::components::Transform::mul( + _self.into(), + transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + global_transform: Val| + { + let output: Val = ::bevy::transform::components::Transform::mul( + _self.into(), + global_transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::transform::components::Transform::clone( + _self.into(), + ) + .into(); + output + }, + ); + } +} diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/mod.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/mod.rs new file mode 100644 index 0000000000..7aa0977203 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/mod.rs @@ -0,0 +1,25 @@ +// @generated by cargo bevy-api-gen collect, modify the templates not this file +#![allow(clippy::all)] +#![allow(unused, deprecated, dead_code)] +#![cfg_attr(rustfmt, rustfmt_skip)] +pub mod bevy_reflect; +pub mod bevy_math; +pub mod bevy_input; +pub mod bevy_transform; +pub mod bevy_core; +pub mod bevy_hierarchy; +pub mod bevy_ecs; +pub mod bevy_time; +pub struct LuaBevyScriptingPlugin; +impl ::bevy::app::Plugin for LuaBevyScriptingPlugin { + fn build(&self, app: &mut ::bevy::prelude::App) { + bevy_reflect::BevyReflectScriptingPlugin.build(app); + bevy_math::BevyMathScriptingPlugin.build(app); + bevy_input::BevyInputScriptingPlugin.build(app); + bevy_transform::BevyTransformScriptingPlugin.build(app); + bevy_core::BevyCoreScriptingPlugin.build(app); + bevy_hierarchy::BevyHierarchyScriptingPlugin.build(app); + bevy_ecs::BevyEcsScriptingPlugin.build(app); + bevy_time::BevyTimeScriptingPlugin.build(app); + } +} From 7d4af7719418b110188a04247ae42e6c7c22bf73 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:03:52 +0000 Subject: [PATCH 103/217] fix arg conversions and import --- crates/bevy_api_gen/templates/footer.tera | 11 ++++++++++- crates/bevy_api_gen/templates/header.tera | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index da71526f7f..8c90722332 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -26,11 +26,20 @@ impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_c | { let output: {{ function.output.proxy_ty }} = ::{{ item.import_path }}::{{ function.ident }}( {%- for arg in function.args -%} + {%- if arg.proxy_ty is matching("Ref.*")-%} + & + {%- endif -%} + {%- if arg.proxy_ty is matching ("Mut.*")-%} + &mut + {%- endif -%} {%- if arg.ident != "self" -%} {{- arg.ident -}} {%- else -%} _{{- arg.ident -}} - {%- endif -%}.into(), + {%- endif -%} + {%- if arg.proxy_ty is matching("Val.*")-%} + .into() + {%- endif -%}, {%- endfor -%} ).into(); output diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index cdab05cad8..ba39a17e92 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -18,7 +18,7 @@ use bevy_mod_scripting_core::{ } }; {% if args.self_is_bms_lua %} -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; {% else %} -use bevy_mod_scripting_lua::*; +use bevy_mod_scripting_lua::{*, namespaced_register::NamespaceBuilder};; {% endif %} \ No newline at end of file From 8cc21cfadcb608694e69d481ee94bd0c70013b6d Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:07:17 +0000 Subject: [PATCH 104/217] fix nightly toolchain in check ci --- .github/workflows/bevy_api_gen.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bevy_api_gen.yml b/.github/workflows/bevy_api_gen.yml index a14bb7767d..8c5ea41f0b 100644 --- a/.github/workflows/bevy_api_gen.yml +++ b/.github/workflows/bevy_api_gen.yml @@ -11,6 +11,9 @@ on: name: Check and Lint - bevy_api_gen +env: + RUST_TOOLCHAIN: nightly-2024-12-15 + jobs: check: name: Check - bevy_api_gen @@ -27,7 +30,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly-2024-11-05 + toolchain: ${{ env.RUST_TOOLCHAIN }} override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 @@ -54,7 +57,7 @@ jobs: with: profile: minimal components: rustfmt - toolchain: nightly-2024-11-05 + toolchain: ${{ env.RUST_TOOLCHAIN }} override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 @@ -77,7 +80,7 @@ jobs: rm -rf crates - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2024-11-05 + toolchain: ${{ env.RUST_TOOLCHAIN }} components: clippy override: true - name: Rust Cache @@ -100,7 +103,7 @@ jobs: rm -rf crates - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2024-11-05 + toolchain: ${{ env.RUST_TOOLCHAIN }} override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 @@ -122,7 +125,7 @@ jobs: rm -rf crates - uses: actions-rs/toolchain@v1 with: - toolchain: nightly-2024-11-05 + toolchain: ${{ env.RUST_TOOLCHAIN }} override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 From dde1d607895f33514544cd8921ea63ec9844ebdc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 22:08:46 +0000 Subject: [PATCH 105/217] chore(codegen): update bevy bindings (#176) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_core.rs | 9 +- .../src/bevy_bindings/bevy_ecs.rs | 179 +- .../src/bevy_bindings/bevy_hierarchy.rs | 40 +- .../src/bevy_bindings/bevy_input.rs | 720 +- .../src/bevy_bindings/bevy_math.rs | 1610 ++-- .../src/bevy_bindings/bevy_reflect.rs | 7119 ++++++++--------- .../src/bevy_bindings/bevy_time.rs | 134 +- .../src/bevy_bindings/bevy_transform.rs | 186 +- 8 files changed, 4760 insertions(+), 5237 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs index 870b902312..081708bbfc 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs @@ -8,7 +8,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyCoreScriptingPlugin; impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -20,10 +20,7 @@ impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::core::prelude::Name::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::core::prelude::Name::eq(&_self, &other) .into(); output }, @@ -32,7 +29,7 @@ impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::core::prelude::Name::clone( - _self.into(), + &_self, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs index 6bf900abf5..5a169ace0c 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -7,17 +7,38 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyEcsScriptingPlugin; impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::ecs::entity::Entity>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::entity::Entity::clone( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::ecs::entity::Entity::eq(&_self, &other) + .into(); + output + }, + ) .overwrite_script_function( "from_raw", |index: u32| { let output: Val = ::bevy::ecs::entity::Entity::from_raw( - index.into(), + index, ) .into(); output @@ -35,7 +56,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "from_bits", |bits: u64| { let output: Val = ::bevy::ecs::entity::Entity::from_bits( - bits.into(), + bits, ) .into(); output @@ -58,30 +79,6 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .into(); output }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::ecs::entity::Entity::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::entity::Entity::clone( - _self.into(), - ) - .into(); - output - }, ); NamespaceBuilder::<::bevy::ecs::world::OnAdd>::new(world); NamespaceBuilder::<::bevy::ecs::world::OnInsert>::new(world); @@ -95,8 +92,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { other: Ref| { let output: bool = ::bevy::ecs::component::ComponentId::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -106,27 +103,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::ecs::component::ComponentId::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |index: usize| { - let output: Val = ::bevy::ecs::component::ComponentId::new( - index.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "index", - |_self: Val| { - let output: usize = ::bevy::ecs::component::ComponentId::index( - _self.into(), + &_self, ) .into(); output @@ -136,52 +113,38 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::ecs::component::Tick>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::ecs::component::Tick::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::ecs::component::Tick::eq( - _self.into(), - other.into(), + "new", + |index: usize| { + let output: Val = ::bevy::ecs::component::ComponentId::new( + index, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::component::Tick::clone( + "index", + |_self: Val| { + let output: usize = ::bevy::ecs::component::ComponentId::index( _self.into(), ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::ecs::component::Tick>::new(world) .overwrite_script_function( "new", |tick: u32| { let output: Val = ::bevy::ecs::component::Tick::new( - tick.into(), + tick, ) .into(); output @@ -198,10 +161,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, tick: u32| { - let output: () = ::bevy::ecs::component::Tick::set( - _self.into(), - tick.into(), - ) + let output: () = ::bevy::ecs::component::Tick::set(&mut_self, tick) .into(); output }, @@ -221,18 +181,39 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .into(); output }, - ); - NamespaceBuilder::<::bevy::ecs::component::ComponentTicks>::new(world) + ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::ecs::component::ComponentTicks::clone( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::ecs::component::Tick::eq(&_self, &other) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::ecs::component::Tick::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::component::Tick::clone( + &_self, + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::ecs::component::ComponentTicks>::new(world) .overwrite_script_function( "is_added", | @@ -241,7 +222,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { this_run: Val| { let output: bool = ::bevy::ecs::component::ComponentTicks::is_added( - _self.into(), + &_self, last_run.into(), this_run.into(), ) @@ -257,7 +238,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { this_run: Val| { let output: bool = ::bevy::ecs::component::ComponentTicks::is_changed( - _self.into(), + &_self, last_run.into(), this_run.into(), ) @@ -282,19 +263,29 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { change_tick: Val| { let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( - _self.into(), + &mut_self, change_tick.into(), ) .into(); output }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::ecs::component::ComponentTicks::clone( + &_self, + ) + .into(); + output + }, ); NamespaceBuilder::<::bevy::ecs::identifier::Identifier>::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::ecs::identifier::Identifier::clone( - _self.into(), + &_self, ) .into(); output @@ -334,7 +325,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "from_bits", |value: u64| { let output: Val = ::bevy::ecs::identifier::Identifier::from_bits( - value.into(), + value, ) .into(); output @@ -347,8 +338,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { other: Ref| { let output: bool = ::bevy::ecs::identifier::Identifier::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -359,7 +350,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::ecs::entity::EntityHash::clone( - _self.into(), + &_self, ) .into(); output @@ -374,7 +365,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { let output: Val< bevy::ecs::removal_detection::RemovedComponentEntity, > = ::bevy::ecs::removal_detection::RemovedComponentEntity::clone( - _self.into(), + &_self, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs index faa3ed7af6..67d78778d3 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs @@ -9,7 +9,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyHierarchyScriptingPlugin; impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -23,9 +23,9 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { b_index: usize| { let output: () = ::bevy::hierarchy::prelude::Children::swap( - _self.into(), - a_index.into(), - b_index.into(), + &mut_self, + a_index, + b_index, ) .into(); output @@ -36,7 +36,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -49,24 +49,14 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { other: Ref| { let output: bool = ::bevy::hierarchy::prelude::Parent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::hierarchy::HierarchyEvent>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::hierarchy::HierarchyEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -74,8 +64,18 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { other: Ref| { let output: bool = ::bevy::hierarchy::HierarchyEvent::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::hierarchy::HierarchyEvent::clone( + &_self, ) .into(); output @@ -85,7 +85,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs index db3d2207c3..9a0785920b 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -10,7 +10,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyInputScriptingPlugin; impl ::bevy::app::Plugin for BevyInputScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -20,7 +20,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "vendor_id", |_self: Ref| { let output: std::option::Option = ::bevy::input::gamepad::Gamepad::vendor_id( - _self.into(), + &_self, ) .into(); output @@ -30,7 +30,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "product_id", |_self: Ref| { let output: std::option::Option = ::bevy::input::gamepad::Gamepad::product_id( - _self.into(), + &_self, ) .into(); output @@ -43,7 +43,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { button_type: Val| { let output: bool = ::bevy::input::gamepad::Gamepad::pressed( - _self.into(), + &_self, button_type.into(), ) .into(); @@ -57,7 +57,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { button_type: Val| { let output: bool = ::bevy::input::gamepad::Gamepad::just_pressed( - _self.into(), + &_self, button_type.into(), ) .into(); @@ -71,7 +71,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { button_type: Val| { let output: bool = ::bevy::input::gamepad::Gamepad::just_released( - _self.into(), + &_self, button_type.into(), ) .into(); @@ -83,7 +83,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -96,8 +96,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadAxis::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -107,7 +107,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadAxis::clone( - _self.into(), + &_self, ) .into(); output @@ -121,28 +121,28 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadButton::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadButton::clone( - _self.into(), + let output: () = ::bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "clone", |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( - _self.into(), + let output: Val = ::bevy::input::gamepad::GamepadButton::clone( + &_self, ) .into(); output @@ -153,13 +153,23 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadSettings::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::keyboard::KeyCode>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "eq", | @@ -167,8 +177,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::keyboard::KeyCode::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -178,28 +188,28 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::keyboard::KeyCode::clone( - _self.into(), + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::mouse::MouseButton>::new(world) .overwrite_script_function( "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( - _self.into(), + |_self: Ref| { + let output: () = ::bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::input::mouse::MouseButton>::new(world) + ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "clone", |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( - _self.into(), + let output: Val = ::bevy::input::mouse::MouseButton::clone( + &_self, ) .into(); output @@ -212,18 +222,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::mouse::MouseButton::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseButton::clone( - _self.into(), + &_self, + &other, ) .into(); output @@ -234,7 +234,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::touch::TouchInput::clone( - _self.into(), + &_self, ) .into(); output @@ -247,8 +247,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::touch::TouchInput::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -259,7 +259,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::keyboard::KeyboardFocusLost::clone( - _self.into(), + &_self, ) .into(); output @@ -269,7 +269,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -282,14 +282,24 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::keyboard::KeyboardFocusLost::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::keyboard::KeyboardInput>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::KeyboardInput::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "eq", | @@ -297,34 +307,34 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::keyboard::KeyboardInput::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyboardInput::clone( - _self.into(), + let output: () = ::bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseMotion>::new(world) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( - _self.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::AccumulatedMouseMotion::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseMotion>::new(world) + ) .overwrite_script_function( "eq", | @@ -332,18 +342,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::mouse::AccumulatedMouseMotion::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::AccumulatedMouseMotion::clone( - _self.into(), + &_self, + &other, ) .into(); output @@ -354,7 +354,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::mouse::AccumulatedMouseScroll::clone( - _self.into(), + &_self, ) .into(); output @@ -367,8 +367,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::mouse::AccumulatedMouseScroll::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -376,14 +376,10 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ); NamespaceBuilder::<::bevy::input::mouse::MouseButtonInput>::new(world) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::mouse::MouseButtonInput::eq( - _self.into(), - other.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( + &_self, ) .into(); output @@ -393,17 +389,21 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::mouse::MouseButtonInput::clone( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::mouse::MouseButtonInput::eq( + &_self, + &other, ) .into(); output @@ -417,8 +417,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::mouse::MouseMotion::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -428,23 +428,13 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::mouse::MouseMotion::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::mouse::MouseWheel>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseWheel::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -452,8 +442,18 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::mouse::MouseWheel::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::mouse::MouseWheel::clone( + &_self, ) .into(); output @@ -464,7 +464,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadAxisChangedEvent::clone( - _self.into(), + &_self, ) .into(); output @@ -477,8 +477,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadAxisChangedEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -489,7 +489,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadButtonChangedEvent::clone( - _self.into(), + &_self, ) .into(); output @@ -502,8 +502,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadButtonChangedEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -512,18 +512,6 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { NamespaceBuilder::< ::bevy::input::gamepad::GamepadButtonStateChangedEvent, >::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val< - bevy::input::gamepad::GamepadButtonStateChangedEvent, - > = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -531,8 +519,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -542,7 +530,19 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( - _self.into(), + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val< + bevy::input::gamepad::GamepadButtonStateChangedEvent, + > = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( + &_self, ) .into(); output @@ -556,8 +556,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadConnection::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -567,7 +567,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadConnection::clone( - _self.into(), + &_self, ) .into(); output @@ -578,7 +578,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "connected", |_self: Ref| { let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::connected( - _self.into(), + &_self, ) .into(); output @@ -588,7 +588,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "disconnected", |_self: Ref| { let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::disconnected( - _self.into(), + &_self, ) .into(); output @@ -601,8 +601,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -612,53 +612,43 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadConnectionEvent::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadEvent>::new(world) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::gamepad::GamepadEvent::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadEvent::clone( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadInput>::new(world) + ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::gamepad::GamepadEvent::eq( + &_self, + &other, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadInput>::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadInput::clone( - _self.into(), + &_self, ) .into(); output @@ -671,8 +661,18 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadInput::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( + &_self, ) .into(); output @@ -683,7 +683,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadRumbleRequest::clone( - _self.into(), + &_self, ) .into(); output @@ -699,8 +699,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -710,7 +710,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( - _self.into(), + &_self, ) .into(); output @@ -725,7 +725,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { let output: Val< bevy::input::gamepad::RawGamepadButtonChangedEvent, > = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::clone( - _self.into(), + &_self, ) .into(); output @@ -738,24 +738,14 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::gamepad::RawGamepadEvent>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::RawGamepadEvent::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -763,24 +753,24 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::RawGamepadEvent::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::input::gestures::PinchGesture>::new(world) + ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gestures::PinchGesture::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::RawGamepadEvent::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::gestures::PinchGesture>::new(world) .overwrite_script_function( "eq", | @@ -788,8 +778,18 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gestures::PinchGesture::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gestures::PinchGesture::clone( + &_self, ) .into(); output @@ -800,7 +800,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gestures::RotationGesture::clone( - _self.into(), + &_self, ) .into(); output @@ -813,8 +813,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gestures::RotationGesture::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -828,8 +828,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gestures::DoubleTapGesture::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -839,7 +839,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gestures::DoubleTapGesture::clone( - _self.into(), + &_self, ) .into(); output @@ -850,7 +850,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gestures::PanGesture::clone( - _self.into(), + &_self, ) .into(); output @@ -863,8 +863,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gestures::PanGesture::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -872,24 +872,10 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ); NamespaceBuilder::<::bevy::input::ButtonState>::new(world) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::ButtonState::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "is_pressed", + "clone", |_self: Ref| { - let output: bool = ::bevy::input::ButtonState::is_pressed( - _self.into(), + let output: Val = ::bevy::input::ButtonState::clone( + &_self, ) .into(); output @@ -899,53 +885,38 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::ButtonState::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output }, ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::ButtonState::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::ButtonSettings>::new(world) .overwrite_script_function( "eq", | - _self: Ref, - other: Ref| + _self: Ref, + other: Ref| { - let output: bool = ::bevy::input::gamepad::ButtonSettings::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::input::ButtonState::eq(&_self, &other) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::gamepad::ButtonSettings::clone( - _self.into(), - ) + "is_pressed", + |_self: Ref| { + let output: bool = ::bevy::input::ButtonState::is_pressed(&_self) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::gamepad::ButtonSettings>::new(world) .overwrite_script_function( "is_pressed", |_self: Ref, value: f32| { let output: bool = ::bevy::input::gamepad::ButtonSettings::is_pressed( - _self.into(), - value.into(), + &_self, + value, ) .into(); output @@ -955,8 +926,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "is_released", |_self: Ref, value: f32| { let output: bool = ::bevy::input::gamepad::ButtonSettings::is_released( - _self.into(), - value.into(), + &_self, + value, ) .into(); output @@ -966,7 +937,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "press_threshold", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::press_threshold( - _self.into(), + &_self, ) .into(); output @@ -976,8 +947,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_press_threshold", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output @@ -987,7 +958,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "release_threshold", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::release_threshold( - _self.into(), + &_self, ) .into(); output @@ -997,33 +968,43 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_release_threshold", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::input::gamepad::AxisSettings>::new(world) + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::gamepad::ButtonSettings::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "eq", | - _self: Ref, - other: Ref| + _self: Ref, + other: Ref| { - let output: bool = ::bevy::input::gamepad::AxisSettings::eq( - _self.into(), - other.into(), + let output: bool = ::bevy::input::gamepad::ButtonSettings::eq( + &_self, + &other, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::gamepad::AxisSettings>::new(world) .overwrite_script_function( "livezone_upperbound", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_upperbound( - _self.into(), + &_self, ) .into(); output @@ -1033,8 +1014,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_livezone_upperbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output @@ -1044,7 +1025,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "deadzone_upperbound", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_upperbound( - _self.into(), + &_self, ) .into(); output @@ -1054,8 +1035,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_deadzone_upperbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output @@ -1065,7 +1046,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "livezone_lowerbound", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_lowerbound( - _self.into(), + &_self, ) .into(); output @@ -1075,8 +1056,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_livezone_lowerbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output @@ -1086,7 +1067,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "deadzone_lowerbound", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_lowerbound( - _self.into(), + &_self, ) .into(); output @@ -1096,8 +1077,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_deadzone_lowerbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output @@ -1107,7 +1088,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "threshold", |_self: Ref| { let output: f32 = ::bevy::input::gamepad::AxisSettings::threshold( - _self.into(), + &_self, ) .into(); output @@ -1117,8 +1098,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_threshold", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( - _self.into(), - value.into(), + &mut_self, + value, ) .into(); output @@ -1128,8 +1109,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clamp", |_self: Ref, new_value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::clamp( - _self.into(), - new_value.into(), + &_self, + new_value, ) .into(); output @@ -1143,9 +1124,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { old_value: std::option::Option| { let output: std::option::Option = ::bevy::input::gamepad::AxisSettings::filter( - _self.into(), - new_value.into(), - old_value.into(), + &_self, + new_value, + old_value, ) .into(); output @@ -1155,65 +1136,59 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::AxisSettings::clone( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::input::gamepad::ButtonAxisSettings>::new(world) + ) .overwrite_script_function( - "filter", + "eq", | - _self: Ref, - new_value: f32, - old_value: std::option::Option| + _self: Ref, + other: Ref| { - let output: std::option::Option = ::bevy::input::gamepad::ButtonAxisSettings::filter( - _self.into(), - new_value.into(), - old_value.into(), + let output: bool = ::bevy::input::gamepad::AxisSettings::eq( + &_self, + &other, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::gamepad::ButtonAxisSettings>::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::ButtonAxisSettings::clone( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleIntensity>::new(world) - .overwrite_script_function( - "weak_motor", - |intensity: f32| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( - intensity.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "strong_motor", - |intensity: f32| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( - intensity.into(), + "filter", + | + _self: Ref, + new_value: f32, + old_value: std::option::Option| + { + let output: std::option::Option = ::bevy::input::gamepad::ButtonAxisSettings::filter( + &_self, + new_value, + old_value, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleIntensity>::new(world) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::clone( - _self.into(), + &_self, ) .into(); output @@ -1226,8 +1201,28 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::gamepad::GamepadRumbleIntensity::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "weak_motor", + |intensity: f32| { + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( + intensity, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "strong_motor", + |intensity: f32| { + let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( + intensity, ) .into(); output @@ -1238,7 +1233,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::keyboard::Key::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -1248,7 +1243,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::keyboard::Key::clone( - _self.into(), + &_self, ) .into(); output @@ -1260,44 +1255,41 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::Key::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::input::keyboard::Key::eq(&_self, &other) .into(); output }, ); NamespaceBuilder::<::bevy::input::keyboard::NativeKeyCode>::new(world) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::input::keyboard::NativeKeyCode::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::keyboard::NativeKeyCode::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::NativeKeyCode::clone( - _self.into(), + let output: () = ::bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::input::keyboard::NativeKeyCode::eq( + &_self, + &other, ) .into(); output @@ -1311,8 +1303,8 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::keyboard::NativeKey::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -1322,7 +1314,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -1332,7 +1324,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::input::keyboard::NativeKey::clone( - _self.into(), + &_self, ) .into(); output @@ -1340,20 +1332,20 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ); NamespaceBuilder::<::bevy::input::mouse::MouseScrollUnit>::new(world) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseScrollUnit::clone( - _self.into(), + let output: () = ::bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "clone", |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( - _self.into(), + let output: Val = ::bevy::input::mouse::MouseScrollUnit::clone( + &_self, ) .into(); output @@ -1366,19 +1358,29 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::mouse::MouseScrollUnit::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::touch::TouchPhase>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::touch::TouchPhase::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -1391,34 +1393,14 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::touch::TouchPhase::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::touch::TouchPhase::clone( - _self.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::input::touch::ForceTouch>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::input::touch::ForceTouch::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -1426,8 +1408,18 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { other: Ref| { let output: bool = ::bevy::input::touch::ForceTouch::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::input::touch::ForceTouch::clone( + &_self, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs index 09e42ace0a..a4874a9b60 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -7,22 +7,29 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyMathScriptingPlugin; impl ::bevy::app::Plugin for BevyMathScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::math::AspectRatio>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::AspectRatio::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ::bevy::math::AspectRatio::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::AspectRatio::eq(&_self, &other) .into(); output }, @@ -30,8 +37,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "ratio", |_self: Ref| { - let output: f32 = ::bevy::math::AspectRatio::ratio(_self.into()) - .into(); + let output: f32 = ::bevy::math::AspectRatio::ratio(&_self).into(); output }, ) @@ -39,7 +45,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::AspectRatio::inverse( - _self.into(), + &_self, ) .into(); output @@ -48,9 +54,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_landscape", |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_landscape( - _self.into(), - ) + let output: bool = ::bevy::math::AspectRatio::is_landscape(&_self) .into(); output }, @@ -58,9 +62,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_portrait", |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_portrait( - _self.into(), - ) + let output: bool = ::bevy::math::AspectRatio::is_portrait(&_self) .into(); output }, @@ -68,37 +70,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_square", |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_square(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::AspectRatio::clone( - _self.into(), - ) + let output: bool = ::bevy::math::AspectRatio::is_square(&_self) .into(); output }, ); NamespaceBuilder::<::bevy::math::CompassOctant>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::CompassOctant::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::math::CompassOctant::clone( - _self.into(), + &_self, ) .into(); output @@ -110,64 +92,54 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::CompassOctant::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::CompassOctant::eq(&_self, &other) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::CompassQuadrant>::new(world) + ) .overwrite_script_function( "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::CompassQuadrant::assert_receiver_is_total_eq( - _self.into(), + |_self: Ref| { + let output: () = ::bevy::math::CompassOctant::assert_receiver_is_total_eq( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::CompassQuadrant>::new(world) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ::bevy::math::CompassQuadrant::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::CompassQuadrant::eq(&_self, &other) .into(); output }, ) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::math::CompassQuadrant::clone( - _self.into(), + let output: () = ::bevy::math::CompassQuadrant::assert_receiver_is_total_eq( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Isometry2d>::new(world) + ) .overwrite_script_function( - "mul", - | - _self: Val, - rhs: Val| - { - let output: Val = ::bevy::math::Isometry2d::mul( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::CompassQuadrant::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::Isometry2d>::new(world) .overwrite_script_function( "from_rotation", |rotation: Val| { @@ -182,8 +154,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_xy", |x: f32, y: f32| { let output: Val = ::bevy::math::Isometry2d::from_xy( - x.into(), - y.into(), + x, + y, ) .into(); output @@ -193,7 +165,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Isometry2d::inverse( - _self.into(), + &_self, ) .into(); output @@ -203,7 +175,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inverse_mul", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Isometry2d::inverse_mul( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -214,7 +186,21 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::Isometry2d::clone( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + rhs: Val| + { + let output: Val = ::bevy::math::Isometry2d::mul( _self.into(), + rhs.into(), ) .into(); output @@ -234,22 +220,33 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Isometry2d::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::Isometry2d::eq(&_self, &other) .into(); output }, ); NamespaceBuilder::<::bevy::math::Isometry3d>::new(world) + .overwrite_script_function( + "mul", + | + _self: Val, + rhs: Val| + { + let output: Val = ::bevy::math::Isometry3d::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { let output: Val = ::bevy::math::Isometry3d::from_xyz( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -259,7 +256,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Isometry3d::inverse( - _self.into(), + &_self, ) .into(); output @@ -269,7 +266,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inverse_mul", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Isometry3d::inverse_mul( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -280,7 +277,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::Isometry3d::clone( - _self.into(), + &_self, ) .into(); output @@ -297,48 +294,27 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( - "mul", - | - _self: Val, - rhs: Val| - { - let output: Val = ::bevy::math::Isometry3d::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Isometry3d::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::Isometry3d::eq(&_self, &other) .into(); output }, ); NamespaceBuilder::<::bevy::math::Ray2d>::new(world) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Ray2d::clone( - _self.into(), - ) - .into(); + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Ray2d::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Ray2d::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Ray2d::clone( + &_self, ) .into(); output @@ -348,11 +324,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Ray3d::eq( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::Ray3d::eq(&_self, &other).into(); output }, ) @@ -360,13 +332,34 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::Ray3d::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::Rot2>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Rot2::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + direction: Val| + { + let output: Val = ::bevy::math::Rot2::mul( + _self.into(), + direction.into(), + ) + .into(); + output + }, + ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { @@ -382,7 +375,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "radians", |radians: f32| { let output: Val = ::bevy::math::Rot2::radians( - radians.into(), + radians, ) .into(); output @@ -392,7 +385,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "degrees", |degrees: f32| { let output: Val = ::bevy::math::Rot2::degrees( - degrees.into(), + degrees, ) .into(); output @@ -402,7 +395,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "turn_fraction", |fraction: f32| { let output: Val = ::bevy::math::Rot2::turn_fraction( - fraction.into(), + fraction, ) .into(); output @@ -412,8 +405,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_sin_cos", |sin: f32, cos: f32| { let output: Val = ::bevy::math::Rot2::from_sin_cos( - sin.into(), - cos.into(), + sin, + cos, ) .into(); output @@ -563,7 +556,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::Rot2::nlerp( _self.into(), end.into(), - s.into(), + s, ) .into(); output @@ -575,51 +568,48 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::Rot2::slerp( _self.into(), end.into(), - s.into(), + s, ) .into(); output }, ) .overwrite_script_function( - "mul", - | - _self: Val, - direction: Val| - { - let output: Val = ::bevy::math::Rot2::mul( - _self.into(), - direction.into(), - ) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Rot2::clone(&_self) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::prelude::Dir2>::new(world) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Rot2::eq(_self.into(), other.into()) + "neg", + |_self: Val| { + let output: Val = ::bevy::math::prelude::Dir2::neg( + _self.into(), + ) .into(); output }, ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Rot2::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Dir2::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::prelude::Dir2>::new(world) + ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir2::clone( - _self.into(), - ) + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::Dir2::eq(&_self, &other) .into(); output }, @@ -628,8 +618,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_xy_unchecked", |x: f32, y: f32| { let output: Val = ::bevy::math::prelude::Dir2::from_xy_unchecked( - x.into(), - y.into(), + x, + y, ) .into(); output @@ -645,7 +635,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::prelude::Dir2::slerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -728,32 +718,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::prelude::Dir3>::new(world) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Dir2::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Dir3::clone( + &_self, ) .into(); output }, ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::neg( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::prelude::Dir3>::new(world) .overwrite_script_function( "neg", |_self: Val| { @@ -764,26 +740,13 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir3::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::Dir3::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::prelude::Dir3::eq(&_self, &other) .into(); output }, @@ -792,9 +755,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_xyz_unchecked", |x: f32, y: f32, z: f32| { let output: Val = ::bevy::math::prelude::Dir3::from_xyz_unchecked( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -810,7 +773,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::prelude::Dir3::slerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -827,16 +790,6 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::Dir3A>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir3A::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "neg", |_self: Val| { @@ -847,27 +800,13 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Dir3A::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { let output: Val = ::bevy::math::prelude::Dir3A::from_xyz_unchecked( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -883,7 +822,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::prelude::Dir3A::slerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -898,6 +837,27 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .into(); output }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::Dir3A::clone( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::Dir3A::eq(&_self, &other) + .into(); + output + }, ); NamespaceBuilder::<::bevy::math::prelude::IRect>::new(world) .overwrite_script_function( @@ -906,10 +866,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::IRect::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::prelude::IRect::eq(&_self, &other) .into(); output }, @@ -918,17 +875,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::math::prelude::IRect::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::clone( - _self.into(), + &_self, ) .into(); output @@ -938,10 +885,10 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |x0: i32, y0: i32, x1: i32, y1: i32| { let output: Val = ::bevy::math::prelude::IRect::new( - x0.into(), - y0.into(), - x1.into(), - y1.into(), + x0, + y0, + x1, + y1, ) .into(); output @@ -950,9 +897,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::bevy::math::prelude::IRect::is_empty( - _self.into(), - ) + let output: bool = ::bevy::math::prelude::IRect::is_empty(&_self) .into(); output }, @@ -960,15 +905,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: i32 = ::bevy::math::prelude::IRect::width(_self.into()) - .into(); + let output: i32 = ::bevy::math::prelude::IRect::width(&_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: i32 = ::bevy::math::prelude::IRect::height(_self.into()) + let output: i32 = ::bevy::math::prelude::IRect::height(&_self) .into(); output }, @@ -980,7 +924,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::IRect::union( - _self.into(), + &_self, other.into(), ) .into(); @@ -994,7 +938,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::IRect::intersect( - _self.into(), + &_self, other.into(), ) .into(); @@ -1005,8 +949,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inflate", |_self: Ref, expansion: i32| { let output: Val = ::bevy::math::prelude::IRect::inflate( - _self.into(), - expansion.into(), + &_self, + expansion, ) .into(); output @@ -1016,7 +960,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "as_rect", |_self: Ref| { let output: Val = ::bevy::math::prelude::IRect::as_rect( - _self.into(), + &_self, ) .into(); output @@ -1026,35 +970,31 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "as_urect", |_self: Ref| { let output: Val = ::bevy::math::prelude::IRect::as_urect( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::prelude::Rect>::new(world) + ) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::prelude::Rect::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::prelude::IRect::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::prelude::Rect>::new(world) .overwrite_script_function( "new", |x0: f32, y0: f32, x1: f32, y1: f32| { let output: Val = ::bevy::math::prelude::Rect::new( - x0.into(), - y0.into(), - x1.into(), - y1.into(), + x0, + y0, + x1, + y1, ) .into(); output @@ -1063,9 +1003,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::bevy::math::prelude::Rect::is_empty( - _self.into(), - ) + let output: bool = ::bevy::math::prelude::Rect::is_empty(&_self) .into(); output }, @@ -1073,16 +1011,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: f32 = ::bevy::math::prelude::Rect::width(_self.into()) - .into(); + let output: f32 = ::bevy::math::prelude::Rect::width(&_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: f32 = ::bevy::math::prelude::Rect::height(_self.into()) - .into(); + let output: f32 = ::bevy::math::prelude::Rect::height(&_self).into(); output }, ) @@ -1093,7 +1029,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::Rect::union( - _self.into(), + &_self, other.into(), ) .into(); @@ -1107,7 +1043,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::Rect::intersect( - _self.into(), + &_self, other.into(), ) .into(); @@ -1118,8 +1054,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inflate", |_self: Ref, expansion: f32| { let output: Val = ::bevy::math::prelude::Rect::inflate( - _self.into(), - expansion.into(), + &_self, + expansion, ) .into(); output @@ -1132,7 +1068,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::Rect::normalize( - _self.into(), + &_self, other.into(), ) .into(); @@ -1143,7 +1079,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "as_irect", |_self: Ref| { let output: Val = ::bevy::math::prelude::Rect::as_irect( - _self.into(), + &_self, ) .into(); output @@ -1153,7 +1089,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "as_urect", |_self: Ref| { let output: Val = ::bevy::math::prelude::Rect::as_urect( - _self.into(), + &_self, ) .into(); output @@ -1163,35 +1099,32 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::prelude::Rect::clone( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::prelude::URect>::new(world) + ) .overwrite_script_function( "eq", | - _self: Ref, - other: Ref| + _self: Ref, + other: Ref| { - let output: bool = ::bevy::math::prelude::URect::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::math::prelude::Rect::eq(&_self, &other) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::prelude::URect>::new(world) .overwrite_script_function( "new", |x0: u32, y0: u32, x1: u32, y1: u32| { let output: Val = ::bevy::math::prelude::URect::new( - x0.into(), - y0.into(), - x1.into(), - y1.into(), + x0, + y0, + x1, + y1, ) .into(); output @@ -1200,9 +1133,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::bevy::math::prelude::URect::is_empty( - _self.into(), - ) + let output: bool = ::bevy::math::prelude::URect::is_empty(&_self) .into(); output }, @@ -1210,15 +1141,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: u32 = ::bevy::math::prelude::URect::width(_self.into()) - .into(); + let output: u32 = ::bevy::math::prelude::URect::width(&_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: u32 = ::bevy::math::prelude::URect::height(_self.into()) + let output: u32 = ::bevy::math::prelude::URect::height(&_self) .into(); output }, @@ -1230,7 +1160,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::URect::union( - _self.into(), + &_self, other.into(), ) .into(); @@ -1244,7 +1174,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::URect::intersect( - _self.into(), + &_self, other.into(), ) .into(); @@ -1255,8 +1185,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inflate", |_self: Ref, expansion: i32| { let output: Val = ::bevy::math::prelude::URect::inflate( - _self.into(), - expansion.into(), + &_self, + expansion, ) .into(); output @@ -1266,7 +1196,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "as_rect", |_self: Ref| { let output: Val = ::bevy::math::prelude::URect::as_rect( - _self.into(), + &_self, ) .into(); output @@ -1276,27 +1206,38 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "as_irect", |_self: Ref| { let output: Val = ::bevy::math::prelude::URect::as_irect( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::clone( - _self.into(), + let output: () = ::bevy::math::prelude::URect::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::prelude::URect::eq(&_self, &other) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", |_self: Ref| { - let output: () = ::bevy::math::prelude::URect::assert_receiver_is_total_eq( - _self.into(), + let output: Val = ::bevy::math::prelude::URect::clone( + &_self, ) .into(); output @@ -1308,7 +1249,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "bounding_circle", |_self: Ref| { let output: Val = ::bevy::math::bounding::Aabb2d::bounding_circle( - _self.into(), + &_self, ) .into(); output @@ -1318,18 +1259,28 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::bounding::Aabb2d::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingCircle>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingCircle::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "radius", |_self: Ref| { let output: f32 = ::bevy::math::bounding::BoundingCircle::radius( - _self.into(), + &_self, ) .into(); output @@ -1339,23 +1290,23 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "aabb_2d", |_self: Ref| { let output: Val = ::bevy::math::bounding::BoundingCircle::aabb_2d( - _self.into(), + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::Circle>::new(world) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircle::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Circle::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::Circle>::new(world) + ) .overwrite_script_function( "eq", | @@ -1363,8 +1314,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Circle::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -1374,7 +1325,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |radius: f32| { let output: Val = ::bevy::math::primitives::Circle::new( - radius.into(), + radius, ) .into(); output @@ -1383,74 +1334,60 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Circle::diameter( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Circle::clone( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Circle::diameter(&_self) .into(); output }, ); NamespaceBuilder::<::bevy::math::primitives::Annulus>::new(world) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Annulus::clone( - _self.into(), + "new", + |inner_radius: f32, outer_radius: f32| { + let output: Val = ::bevy::math::primitives::Annulus::new( + inner_radius, + outer_radius, ) .into(); output }, ) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Annulus::eq( - _self.into(), - other.into(), - ) + "diameter", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Annulus::diameter(&_self) .into(); output }, ) .overwrite_script_function( - "new", - |inner_radius: f32, outer_radius: f32| { - let output: Val = ::bevy::math::primitives::Annulus::new( - inner_radius.into(), - outer_radius.into(), + "thickness", + |_self: Ref| { + let output: f32 = ::bevy::math::primitives::Annulus::thickness( + &_self, ) .into(); output }, ) .overwrite_script_function( - "diameter", + "clone", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Annulus::diameter( - _self.into(), + let output: Val = ::bevy::math::primitives::Annulus::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "thickness", - |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Annulus::thickness( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Annulus::eq( + &_self, + &other, ) .into(); output @@ -1461,8 +1398,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |radius: f32, half_angle: f32| { let output: Val = ::bevy::math::primitives::Arc2d::new( - radius.into(), - half_angle.into(), + radius, + half_angle, ) .into(); output @@ -1472,8 +1409,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_radians", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::Arc2d::from_radians( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1483,8 +1420,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_degrees", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::Arc2d::from_degrees( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1494,8 +1431,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_turns", |radius: f32, fraction: f32| { let output: Val = ::bevy::math::primitives::Arc2d::from_turns( - radius.into(), - fraction.into(), + radius, + fraction, ) .into(); output @@ -1504,9 +1441,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::angle( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Arc2d::angle(&_self) .into(); output }, @@ -1514,9 +1449,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::length( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Arc2d::length(&_self) .into(); output }, @@ -1525,7 +1458,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "half_chord_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Arc2d::half_chord_length( - _self.into(), + &_self, ) .into(); output @@ -1535,7 +1468,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "chord_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Arc2d::chord_length( - _self.into(), + &_self, ) .into(); output @@ -1544,9 +1477,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::apothem( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Arc2d::apothem(&_self) .into(); output }, @@ -1554,9 +1485,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::sagitta( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Arc2d::sagitta(&_self) .into(); output }, @@ -1564,9 +1493,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_minor", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::is_minor( - _self.into(), - ) + let output: bool = ::bevy::math::primitives::Arc2d::is_minor(&_self) .into(); output }, @@ -1574,19 +1501,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_major", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::is_major( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Arc2d::clone( - _self.into(), - ) + let output: bool = ::bevy::math::primitives::Arc2d::is_major(&_self) .into(); output }, @@ -1598,8 +1513,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Arc2d::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Arc2d::clone( + &_self, ) .into(); output @@ -1610,8 +1535,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |radius: f32, length: f32| { let output: Val = ::bevy::math::primitives::Capsule2d::new( - radius.into(), - length.into(), + radius, + length, ) .into(); output @@ -1621,7 +1546,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "to_inner_rectangle", |_self: Ref| { let output: Val = ::bevy::math::primitives::Capsule2d::to_inner_rectangle( - _self.into(), + &_self, ) .into(); output @@ -1634,8 +1559,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Capsule2d::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -1645,13 +1570,23 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Capsule2d::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::primitives::CircularSector>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::CircularSector::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "eq", | @@ -1659,8 +1594,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::CircularSector::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -1670,8 +1605,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::CircularSector::new( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1681,8 +1616,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_radians", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::CircularSector::from_radians( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1692,8 +1627,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_degrees", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::CircularSector::from_degrees( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1703,8 +1638,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_turns", |radius: f32, fraction: f32| { let output: Val = ::bevy::math::primitives::CircularSector::from_turns( - radius.into(), - fraction.into(), + radius, + fraction, ) .into(); output @@ -1714,7 +1649,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "half_angle", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::half_angle( - _self.into(), + &_self, ) .into(); output @@ -1724,7 +1659,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "angle", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::angle( - _self.into(), + &_self, ) .into(); output @@ -1734,7 +1669,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "radius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::radius( - _self.into(), + &_self, ) .into(); output @@ -1744,7 +1679,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "arc_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::arc_length( - _self.into(), + &_self, ) .into(); output @@ -1754,7 +1689,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "half_chord_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::half_chord_length( - _self.into(), + &_self, ) .into(); output @@ -1764,7 +1699,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "chord_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::chord_length( - _self.into(), + &_self, ) .into(); output @@ -1774,7 +1709,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "apothem", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::apothem( - _self.into(), + &_self, ) .into(); output @@ -1784,29 +1719,29 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "sagitta", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSector::sagitta( - _self.into(), + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::CircularSegment>::new(world) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::CircularSector::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::primitives::CircularSegment::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::CircularSegment>::new(world) + ) .overwrite_script_function( "new", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::CircularSegment::new( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1816,8 +1751,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_radians", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::CircularSegment::from_radians( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1827,8 +1762,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_degrees", |radius: f32, angle: f32| { let output: Val = ::bevy::math::primitives::CircularSegment::from_degrees( - radius.into(), - angle.into(), + radius, + angle, ) .into(); output @@ -1838,8 +1773,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_turns", |radius: f32, fraction: f32| { let output: Val = ::bevy::math::primitives::CircularSegment::from_turns( - radius.into(), - fraction.into(), + radius, + fraction, ) .into(); output @@ -1849,7 +1784,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "half_angle", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::half_angle( - _self.into(), + &_self, ) .into(); output @@ -1859,7 +1794,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "angle", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::angle( - _self.into(), + &_self, ) .into(); output @@ -1869,7 +1804,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "radius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::radius( - _self.into(), + &_self, ) .into(); output @@ -1879,7 +1814,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "arc_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::arc_length( - _self.into(), + &_self, ) .into(); output @@ -1889,7 +1824,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "half_chord_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::half_chord_length( - _self.into(), + &_self, ) .into(); output @@ -1899,7 +1834,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "chord_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::chord_length( - _self.into(), + &_self, ) .into(); output @@ -1909,7 +1844,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "apothem", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::apothem( - _self.into(), + &_self, ) .into(); output @@ -1919,17 +1854,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "sagitta", |_self: Ref| { let output: f32 = ::bevy::math::primitives::CircularSegment::sagitta( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::CircularSegment::clone( - _self.into(), + &_self, ) .into(); output @@ -1942,14 +1867,24 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::CircularSegment::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::primitives::Ellipse>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Ellipse::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "eq", | @@ -1957,8 +1892,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Ellipse::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -1968,8 +1903,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |half_width: f32, half_height: f32| { let output: Val = ::bevy::math::primitives::Ellipse::new( - half_width.into(), - half_height.into(), + half_width, + half_height, ) .into(); output @@ -1979,7 +1914,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "eccentricity", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Ellipse::eccentricity( - _self.into(), + &_self, ) .into(); output @@ -1989,7 +1924,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "focal_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Ellipse::focal_length( - _self.into(), + &_self, ) .into(); output @@ -1999,7 +1934,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "semi_major", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Ellipse::semi_major( - _self.into(), + &_self, ) .into(); output @@ -2009,33 +1944,13 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "semi_minor", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Ellipse::semi_minor( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Ellipse::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::primitives::Line2d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Line2d::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -2043,24 +1958,24 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Line2d::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::Plane2d>::new(world) + ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Plane2d::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Line2d::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::Plane2d>::new(world) .overwrite_script_function( "eq", | @@ -2068,8 +1983,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Plane2d::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Plane2d::clone( + &_self, ) .into(); output @@ -2083,8 +2008,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Rectangle::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -2094,8 +2019,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |width: f32, height: f32| { let output: Val = ::bevy::math::primitives::Rectangle::new( - width.into(), - height.into(), + width, + height, ) .into(); output @@ -2105,7 +2030,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_length", |length: f32| { let output: Val = ::bevy::math::primitives::Rectangle::from_length( - length.into(), + length, ) .into(); output @@ -2115,7 +2040,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Rectangle::clone( - _self.into(), + &_self, ) .into(); output @@ -2123,10 +2048,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ); NamespaceBuilder::<::bevy::math::primitives::RegularPolygon>::new(world) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::RegularPolygon::clone( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::RegularPolygon::eq( + &_self, + &other, ) .into(); output @@ -2136,8 +2065,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |circumradius: f32, sides: u32| { let output: Val = ::bevy::math::primitives::RegularPolygon::new( - circumradius.into(), - sides.into(), + circumradius, + sides, ) .into(); output @@ -2147,7 +2076,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "circumradius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::circumradius( - _self.into(), + &_self, ) .into(); output @@ -2157,7 +2086,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inradius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::inradius( - _self.into(), + &_self, ) .into(); output @@ -2167,7 +2096,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "side_length", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::side_length( - _self.into(), + &_self, ) .into(); output @@ -2177,7 +2106,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "internal_angle_degrees", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_degrees( - _self.into(), + &_self, ) .into(); output @@ -2187,7 +2116,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "internal_angle_radians", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_radians( - _self.into(), + &_self, ) .into(); output @@ -2197,7 +2126,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "external_angle_degrees", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_degrees( - _self.into(), + &_self, ) .into(); output @@ -2207,21 +2136,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "external_angle_radians", |_self: Ref| { let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_radians( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::RegularPolygon::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::RegularPolygon::clone( + &_self, ) .into(); output @@ -2235,8 +2160,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Rhombus::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Rhombus::clone( + &_self, ) .into(); output @@ -2246,8 +2181,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |horizontal_diagonal: f32, vertical_diagonal: f32| { let output: Val = ::bevy::math::primitives::Rhombus::new( - horizontal_diagonal.into(), - vertical_diagonal.into(), + horizontal_diagonal, + vertical_diagonal, ) .into(); output @@ -2257,7 +2192,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_side", |side: f32| { let output: Val = ::bevy::math::primitives::Rhombus::from_side( - side.into(), + side, ) .into(); output @@ -2267,7 +2202,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_inradius", |inradius: f32| { let output: Val = ::bevy::math::primitives::Rhombus::from_inradius( - inradius.into(), + inradius, ) .into(); output @@ -2276,9 +2211,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "side", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::side( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Rhombus::side(&_self) .into(); output }, @@ -2287,7 +2220,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "circumradius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Rhombus::circumradius( - _self.into(), + &_self, ) .into(); output @@ -2296,19 +2229,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::inradius( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Rhombus::clone( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Rhombus::inradius(&_self) .into(); output }, @@ -2321,8 +2242,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Segment2d::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Segment2d::clone( + &_self, ) .into(); output @@ -2333,7 +2264,22 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { |direction: Val, length: f32| { let output: Val = ::bevy::math::primitives::Segment2d::new( direction.into(), - length.into(), + length, + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::Triangle2d>::new(world) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Triangle2d::eq( + &_self, + &other, ) .into(); output @@ -2341,20 +2287,19 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Segment2d::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Triangle2d::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::Triangle2d>::new(world) + ) .overwrite_script_function( "is_degenerate", |_self: Ref| { let output: bool = ::bevy::math::primitives::Triangle2d::is_degenerate( - _self.into(), + &_self, ) .into(); output @@ -2364,7 +2309,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "is_acute", |_self: Ref| { let output: bool = ::bevy::math::primitives::Triangle2d::is_acute( - _self.into(), + &_self, ) .into(); output @@ -2374,7 +2319,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "is_obtuse", |_self: Ref| { let output: bool = ::bevy::math::primitives::Triangle2d::is_obtuse( - _self.into(), + &_self, ) .into(); output @@ -2384,7 +2329,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "reverse", |_self: Mut| { let output: () = ::bevy::math::primitives::Triangle2d::reverse( - _self.into(), + &mut_self, ) .into(); output @@ -2399,47 +2344,23 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .into(); output }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Triangle2d::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Triangle2d::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, ); NamespaceBuilder::<::bevy::math::bounding::Aabb3d>::new(world) .overwrite_script_function( - "clone", + "bounding_sphere", |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb3d::clone( - _self.into(), + let output: Val = ::bevy::math::bounding::Aabb3d::bounding_sphere( + &_self, ) .into(); output }, ) .overwrite_script_function( - "bounding_sphere", + "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb3d::bounding_sphere( - _self.into(), + let output: Val = ::bevy::math::bounding::Aabb3d::clone( + &_self, ) .into(); output @@ -2450,7 +2371,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "radius", |_self: Ref| { let output: f32 = ::bevy::math::bounding::BoundingSphere::radius( - _self.into(), + &_self, ) .into(); output @@ -2460,7 +2381,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "aabb_3d", |_self: Ref| { let output: Val = ::bevy::math::bounding::BoundingSphere::aabb_3d( - _self.into(), + &_self, ) .into(); output @@ -2470,7 +2391,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::bounding::BoundingSphere::clone( - _self.into(), + &_self, ) .into(); output @@ -2484,18 +2405,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Sphere::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Sphere::clone( - _self.into(), + &_self, + &other, ) .into(); output @@ -2505,7 +2416,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |radius: f32| { let output: Val = ::bevy::math::primitives::Sphere::new( - radius.into(), + radius, ) .into(); output @@ -2514,45 +2425,29 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Sphere::diameter( - _self.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::primitives::Cuboid>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cuboid::clone( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Sphere::diameter(&_self) .into(); output }, ) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Cuboid::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Sphere::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::Cuboid>::new(world) .overwrite_script_function( "new", |x_length: f32, y_length: f32, z_length: f32| { let output: Val = ::bevy::math::primitives::Cuboid::new( - x_length.into(), - y_length.into(), - z_length.into(), + x_length, + y_length, + z_length, ) .into(); output @@ -2562,43 +2457,43 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_length", |length: f32| { let output: Val = ::bevy::math::primitives::Cuboid::from_length( - length.into(), + length, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::Cylinder>::new(world) + ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cylinder::clone( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Cuboid::eq( + &_self, + &other, ) .into(); output }, ) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Cylinder::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cuboid::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::Cylinder>::new(world) .overwrite_script_function( "new", |radius: f32, height: f32| { let output: Val = ::bevy::math::primitives::Cylinder::new( - radius.into(), - height.into(), + radius, + height, ) .into(); output @@ -2608,7 +2503,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "base", |_self: Ref| { let output: Val = ::bevy::math::primitives::Cylinder::base( - _self.into(), + &_self, ) .into(); output @@ -2618,7 +2513,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "lateral_area", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Cylinder::lateral_area( - _self.into(), + &_self, ) .into(); output @@ -2628,18 +2523,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "base_area", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Cylinder::base_area( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::Capsule3d>::new(world) + ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule3d::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Cylinder::clone( + &_self, ) .into(); output @@ -2648,23 +2542,24 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", | - _self: Ref, - other: Ref| + _self: Ref, + other: Ref| { - let output: bool = ::bevy::math::primitives::Capsule3d::eq( - _self.into(), - other.into(), + let output: bool = ::bevy::math::primitives::Cylinder::eq( + &_self, + &other, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::Capsule3d>::new(world) .overwrite_script_function( "new", |radius: f32, length: f32| { let output: Val = ::bevy::math::primitives::Capsule3d::new( - radius.into(), - length.into(), + radius, + length, ) .into(); output @@ -2674,7 +2569,31 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "to_cylinder", |_self: Ref| { let output: Val = ::bevy::math::primitives::Capsule3d::to_cylinder( - _self.into(), + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Capsule3d::eq( + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Capsule3d::clone( + &_self, ) .into(); output @@ -2685,8 +2604,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |radius: f32, height: f32| { let output: Val = ::bevy::math::primitives::Cone::new( - radius.into(), - height.into(), + radius, + height, ) .into(); output @@ -2696,7 +2615,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "base", |_self: Ref| { let output: Val = ::bevy::math::primitives::Cone::base( - _self.into(), + &_self, ) .into(); output @@ -2706,7 +2625,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "slant_height", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Cone::slant_height( - _self.into(), + &_self, ) .into(); output @@ -2716,7 +2635,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "lateral_area", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Cone::lateral_area( - _self.into(), + &_self, ) .into(); output @@ -2725,9 +2644,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::base_area( - _self.into(), - ) + let output: f32 = ::bevy::math::primitives::Cone::base_area(&_self) .into(); output }, @@ -2736,7 +2653,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Cone::clone( - _self.into(), + &_self, ) .into(); output @@ -2748,15 +2665,22 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Cone::eq( - _self.into(), - other.into(), + let output: bool = ::bevy::math::primitives::Cone::eq(&_self, &other) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::primitives::ConicalFrustum>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::ConicalFrustum::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::ConicalFrustum>::new(world) + ) .overwrite_script_function( "eq", | @@ -2764,18 +2688,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::ConicalFrustum::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::ConicalFrustum::clone( - _self.into(), + &_self, + &other, ) .into(); output @@ -2786,7 +2700,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::InfinitePlane3d::clone( - _self.into(), + &_self, ) .into(); output @@ -2799,24 +2713,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::InfinitePlane3d::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::primitives::Line3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Line3d::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", | @@ -2824,8 +2728,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Line3d::eq( - _self.into(), - other.into(), + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Line3d::clone( + &_self, ) .into(); output @@ -2837,7 +2751,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { |direction: Val, length: f32| { let output: Val = ::bevy::math::primitives::Segment3d::new( direction.into(), - length.into(), + length, ) .into(); output @@ -2850,8 +2764,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Segment3d::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -2861,7 +2775,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Segment3d::clone( - _self.into(), + &_self, ) .into(); output @@ -2872,21 +2786,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Torus::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::primitives::Torus::eq( - _self.into(), - other.into(), + &_self, ) .into(); output @@ -2896,8 +2796,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |inner_radius: f32, outer_radius: f32| { let output: Val = ::bevy::math::primitives::Torus::new( - inner_radius.into(), - outer_radius.into(), + inner_radius, + outer_radius, ) .into(); output @@ -2907,7 +2807,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inner_radius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Torus::inner_radius( - _self.into(), + &_self, ) .into(); output @@ -2917,32 +2817,32 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "outer_radius", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Torus::outer_radius( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::primitives::Triangle3d>::new(world) + ) .overwrite_script_function( "eq", | - _self: Ref, - other: Ref| + _self: Ref, + other: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::eq( - _self.into(), - other.into(), + let output: bool = ::bevy::math::primitives::Torus::eq( + &_self, + &other, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::primitives::Triangle3d>::new(world) .overwrite_script_function( "is_degenerate", |_self: Ref| { let output: bool = ::bevy::math::primitives::Triangle3d::is_degenerate( - _self.into(), + &_self, ) .into(); output @@ -2952,7 +2852,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "is_acute", |_self: Ref| { let output: bool = ::bevy::math::primitives::Triangle3d::is_acute( - _self.into(), + &_self, ) .into(); output @@ -2962,7 +2862,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "is_obtuse", |_self: Ref| { let output: bool = ::bevy::math::primitives::Triangle3d::is_obtuse( - _self.into(), + &_self, ) .into(); output @@ -2972,7 +2872,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "reverse", |_self: Mut| { let output: () = ::bevy::math::primitives::Triangle3d::reverse( - _self.into(), + &mut_self, ) .into(); output @@ -2989,32 +2889,36 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::primitives::Triangle3d::clone( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::primitives::Triangle3d::eq( + &_self, + &other, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::bounding::RayCast2d>::new(world) + ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::RayCast2d::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::primitives::Triangle3d::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::bounding::RayCast2d>::new(world) .overwrite_script_function( "from_ray", |ray: Val, max: f32| { let output: Val = ::bevy::math::bounding::RayCast2d::from_ray( ray.into(), - max.into(), + max, ) .into(); output @@ -3027,8 +2931,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { aabb: Ref| { let output: std::option::Option = ::bevy::math::bounding::RayCast2d::aabb_intersection_at( - _self.into(), - aabb.into(), + &_self, + &aabb, ) .into(); output @@ -3041,14 +2945,34 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { circle: Ref| { let output: std::option::Option = ::bevy::math::bounding::RayCast2d::circle_intersection_at( - _self.into(), - circle.into(), + &_self, + &circle, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::RayCast2d::clone( + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::bounding::AabbCast2d>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::AabbCast2d::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "from_ray", | @@ -3059,7 +2983,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::bounding::AabbCast2d::from_ray( aabb.into(), ray.into(), - max.into(), + max, ) .into(); output @@ -3072,22 +2996,12 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { aabb: Val| { let output: std::option::Option = ::bevy::math::bounding::AabbCast2d::aabb_collision_at( - _self.into(), + &_self, aabb.into(), ) .into(); output }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::AabbCast2d::clone( - _self.into(), - ) - .into(); - output - }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingCircleCast>::new(world) .overwrite_script_function( @@ -3100,7 +3014,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::bounding::BoundingCircleCast::from_ray( circle.into(), ray.into(), - max.into(), + max, ) .into(); output @@ -3113,7 +3027,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { circle: Val| { let output: std::option::Option = ::bevy::math::bounding::BoundingCircleCast::circle_collision_at( - _self.into(), + &_self, circle.into(), ) .into(); @@ -3124,29 +3038,19 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::bounding::BoundingCircleCast::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::bounding::RayCast3d>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::RayCast3d::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "from_ray", |ray: Val, max: f32| { let output: Val = ::bevy::math::bounding::RayCast3d::from_ray( ray.into(), - max.into(), + max, ) .into(); output @@ -3159,8 +3063,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { aabb: Ref| { let output: std::option::Option = ::bevy::math::bounding::RayCast3d::aabb_intersection_at( - _self.into(), - aabb.into(), + &_self, + &aabb, ) .into(); output @@ -3173,8 +3077,18 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { sphere: Ref| { let output: std::option::Option = ::bevy::math::bounding::RayCast3d::sphere_intersection_at( - _self.into(), - sphere.into(), + &_self, + &sphere, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::RayCast3d::clone( + &_self, ) .into(); output @@ -3191,7 +3105,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::bounding::AabbCast3d::from_ray( aabb.into(), ray.into(), - max.into(), + max, ) .into(); output @@ -3204,7 +3118,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { aabb: Val| { let output: std::option::Option = ::bevy::math::bounding::AabbCast3d::aabb_collision_at( - _self.into(), + &_self, aabb.into(), ) .into(); @@ -3215,13 +3129,23 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::bounding::AabbCast3d::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingSphereCast>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::bounding::BoundingSphereCast::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "from_ray", | @@ -3232,7 +3156,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { let output: Val = ::bevy::math::bounding::BoundingSphereCast::from_ray( sphere.into(), ray.into(), - max.into(), + max, ) .into(); output @@ -3245,33 +3169,19 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { sphere: Val| { let output: std::option::Option = ::bevy::math::bounding::BoundingSphereCast::sphere_collision_at( - _self.into(), + &_self, sphere.into(), ) .into(); output }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphereCast::clone( - _self.into(), - ) - .into(); - output - }, ); NamespaceBuilder::<::bevy::math::curve::interval::Interval>::new(world) .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::math::curve::interval::Interval::eq( - _self.into(), - other.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::curve::interval::Interval::clone( + &_self, ) .into(); output @@ -3342,7 +3252,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { |_self: Val, item: f32| { let output: bool = ::bevy::math::curve::interval::Interval::contains( _self.into(), - item.into(), + item, ) .into(); output @@ -3367,95 +3277,79 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { |_self: Val, value: f32| { let output: f32 = ::bevy::math::curve::interval::Interval::clamp( _self.into(), - value.into(), + value, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::curve::interval::Interval::clone( - _self.into(), + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::math::curve::interval::Interval::eq( + &_self, + &other, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::FloatOrd>::new(world) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::FloatOrd::neg( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::math::FloatOrd::clone( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", + "lt", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::eq( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::FloatOrd::lt(&_self, &other).into(); output }, ) .overwrite_script_function( - "lt", + "le", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::lt( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::FloatOrd::le(&_self, &other).into(); output }, ) .overwrite_script_function( - "le", + "gt", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::le( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::FloatOrd::gt(&_self, &other).into(); output }, ) .overwrite_script_function( - "gt", + "ge", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::gt( + let output: bool = ::bevy::math::FloatOrd::ge(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::FloatOrd::neg( _self.into(), - other.into(), ) .into(); output }, ) .overwrite_script_function( - "ge", + "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::ge( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::FloatOrd::eq(&_self, &other).into(); output }, ); @@ -3464,7 +3358,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Plane3d::clone( - _self.into(), + &_self, ) .into(); output @@ -3477,8 +3371,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Plane3d::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -3489,7 +3383,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "signed_volume", |_self: Ref| { let output: f32 = ::bevy::math::primitives::Tetrahedron::signed_volume( - _self.into(), + &_self, ) .into(); output @@ -3502,8 +3396,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::primitives::Tetrahedron::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -3513,7 +3407,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::primitives::Tetrahedron::clone( - _self.into(), + &_self, ) .into(); output @@ -3524,7 +3418,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::curve::easing::EaseFunction::clone( - _self.into(), + &_self, ) .into(); output @@ -3537,8 +3431,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Ref| { let output: bool = ::bevy::math::curve::easing::EaseFunction::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs index 603a8e68d0..7b3be573bb 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -6,7 +6,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyReflectScriptingPlugin; impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -16,7 +16,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: bool| { let output: Val = ::std::sync::atomic::AtomicBool::new( - v.into(), + v, ) .into(); output @@ -37,7 +37,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: i16| { let output: Val = ::std::sync::atomic::AtomicI16::new( - v.into(), + v, ) .into(); output @@ -58,7 +58,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: i32| { let output: Val = ::std::sync::atomic::AtomicI32::new( - v.into(), + v, ) .into(); output @@ -79,7 +79,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: i64| { let output: Val = ::std::sync::atomic::AtomicI64::new( - v.into(), + v, ) .into(); output @@ -100,7 +100,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: i8| { let output: Val = ::std::sync::atomic::AtomicI8::new( - v.into(), + v, ) .into(); output @@ -121,7 +121,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: isize| { let output: Val = ::std::sync::atomic::AtomicIsize::new( - v.into(), + v, ) .into(); output @@ -142,7 +142,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: u16| { let output: Val = ::std::sync::atomic::AtomicU16::new( - v.into(), + v, ) .into(); output @@ -163,7 +163,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: u32| { let output: Val = ::std::sync::atomic::AtomicU32::new( - v.into(), + v, ) .into(); output @@ -184,7 +184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: u64| { let output: Val = ::std::sync::atomic::AtomicU64::new( - v.into(), + v, ) .into(); output @@ -205,7 +205,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: u8| { let output: Val = ::std::sync::atomic::AtomicU8::new( - v.into(), + v, ) .into(); output @@ -226,7 +226,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |v: usize| { let output: Val = ::std::sync::atomic::AtomicUsize::new( - v.into(), + v, ) .into(); output @@ -248,7 +248,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: u32| { let output: Val = ::bevy::utils::Duration::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -258,7 +258,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::utils::Duration::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -268,7 +268,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::utils::Duration::clone( - _self.into(), + &_self, ) .into(); output @@ -299,10 +299,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::utils::Duration::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::utils::Duration::eq(&_self, &other) .into(); output }, @@ -312,7 +309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: u32| { let output: Val = ::bevy::utils::Duration::div( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -322,8 +319,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |secs: u64, nanos: u32| { let output: Val = ::bevy::utils::Duration::new( - secs.into(), - nanos.into(), + secs, + nanos, ) .into(); output @@ -333,7 +330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_secs", |secs: u64| { let output: Val = ::bevy::utils::Duration::from_secs( - secs.into(), + secs, ) .into(); output @@ -343,7 +340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_millis", |millis: u64| { let output: Val = ::bevy::utils::Duration::from_millis( - millis.into(), + millis, ) .into(); output @@ -353,7 +350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_micros", |micros: u64| { let output: Val = ::bevy::utils::Duration::from_micros( - micros.into(), + micros, ) .into(); output @@ -363,7 +360,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_nanos", |nanos: u64| { let output: Val = ::bevy::utils::Duration::from_nanos( - nanos.into(), + nanos, ) .into(); output @@ -372,25 +369,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_zero", |_self: Ref| { - let output: bool = ::bevy::utils::Duration::is_zero(_self.into()) - .into(); + let output: bool = ::bevy::utils::Duration::is_zero(&_self).into(); output }, ) .overwrite_script_function( "as_secs", |_self: Ref| { - let output: u64 = ::bevy::utils::Duration::as_secs(_self.into()) - .into(); + let output: u64 = ::bevy::utils::Duration::as_secs(&_self).into(); output }, ) .overwrite_script_function( "subsec_millis", |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_millis( - _self.into(), - ) + let output: u32 = ::bevy::utils::Duration::subsec_millis(&_self) .into(); output }, @@ -398,9 +391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "subsec_micros", |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_micros( - _self.into(), - ) + let output: u32 = ::bevy::utils::Duration::subsec_micros(&_self) .into(); output }, @@ -408,7 +399,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "subsec_nanos", |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_nanos(_self.into()) + let output: u32 = ::bevy::utils::Duration::subsec_nanos(&_self) .into(); output }, @@ -416,24 +407,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_millis", |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_millis(_self.into()) - .into(); + let output: u128 = ::bevy::utils::Duration::as_millis(&_self).into(); output }, ) .overwrite_script_function( "as_micros", |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_micros(_self.into()) - .into(); + let output: u128 = ::bevy::utils::Duration::as_micros(&_self).into(); output }, ) .overwrite_script_function( "as_nanos", |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_nanos(_self.into()) - .into(); + let output: u128 = ::bevy::utils::Duration::as_nanos(&_self).into(); output }, ) @@ -475,7 +463,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: u32| { let output: Val = ::bevy::utils::Duration::saturating_mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -484,7 +472,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_secs_f64", |_self: Ref| { - let output: f64 = ::bevy::utils::Duration::as_secs_f64(_self.into()) + let output: f64 = ::bevy::utils::Duration::as_secs_f64(&_self) .into(); output }, @@ -492,7 +480,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_secs_f32", |_self: Ref| { - let output: f32 = ::bevy::utils::Duration::as_secs_f32(_self.into()) + let output: f32 = ::bevy::utils::Duration::as_secs_f32(&_self) .into(); output }, @@ -501,7 +489,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_secs_f64", |secs: f64| { let output: Val = ::bevy::utils::Duration::from_secs_f64( - secs.into(), + secs, ) .into(); output @@ -511,7 +499,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_secs_f32", |secs: f32| { let output: Val = ::bevy::utils::Duration::from_secs_f32( - secs.into(), + secs, ) .into(); output @@ -522,7 +510,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f64| { let output: Val = ::bevy::utils::Duration::mul_f64( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -533,7 +521,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f32| { let output: Val = ::bevy::utils::Duration::mul_f32( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -544,7 +532,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f64| { let output: Val = ::bevy::utils::Duration::div_f64( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -555,7 +543,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f32| { let output: Val = ::bevy::utils::Duration::div_f32( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -588,7 +576,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::utils::Instant::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -597,11 +585,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::utils::Instant::eq( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::utils::Instant::eq(&_self, &other).into(); output }, ) @@ -639,7 +623,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "duration_since", |_self: Ref, earlier: Val| { let output: Val = ::bevy::utils::Instant::duration_since( - _self.into(), + &_self, earlier.into(), ) .into(); @@ -650,7 +634,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_duration_since", |_self: Ref, earlier: Val| { let output: Val = ::bevy::utils::Instant::saturating_duration_since( - _self.into(), + &_self, earlier.into(), ) .into(); @@ -661,7 +645,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "elapsed", |_self: Ref| { let output: Val = ::bevy::utils::Instant::elapsed( - _self.into(), + &_self, ) .into(); output @@ -671,7 +655,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::utils::Instant::clone( - _self.into(), + &_self, ) .into(); output @@ -693,7 +677,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::std::ops::RangeFull::clone( - _self.into(), + &_self, ) .into(); output @@ -703,7 +687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::std::ops::RangeFull::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -712,18 +696,51 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::std::ops::RangeFull::eq( + let output: bool = ::std::ops::RangeFull::eq(&_self, &other).into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Quat>::new(world) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul( _self.into(), - other.into(), + rhs.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Quat>::new(world) + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Quat::eq(&_self, &rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Quat::clone(&_self) + .into(); + output + }, + ) .overwrite_script_function( "mul", - |_self: Val, rhs: f32| { + |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul( _self.into(), rhs.into(), @@ -732,6 +749,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Quat::mul( + _self.into(), + rhs, + ) + .into(); + output + }, + ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { @@ -755,8 +783,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Quat::mul( _self.into(), rhs.into(), ) @@ -765,10 +793,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Quat::clone( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Quat::div( _self.into(), + rhs, ) .into(); output @@ -778,10 +807,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_xyzw", |x: f32, y: f32, z: f32, w: f32| { let output: Val = ::bevy::math::Quat::from_xyzw( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -790,9 +819,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = ::bevy::math::Quat::from_array( - a.into(), - ) + let output: Val = ::bevy::math::Quat::from_array(a) .into(); output }, @@ -812,7 +839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f32| { let output: Val = ::bevy::math::Quat::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -832,7 +859,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f32| { let output: Val = ::bevy::math::Quat::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -842,7 +869,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f32| { let output: Val = ::bevy::math::Quat::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -852,7 +879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f32| { let output: Val = ::bevy::math::Quat::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -863,9 +890,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |euler: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Quat::from_euler( euler.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -875,7 +902,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |mat: Ref| { let output: Val = ::bevy::math::Quat::from_mat3( - mat.into(), + &mat, ) .into(); output @@ -885,7 +912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3a", |mat: Ref| { let output: Val = ::bevy::math::Quat::from_mat3a( - mat.into(), + &mat, ) .into(); output @@ -895,7 +922,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |mat: Ref| { let output: Val = ::bevy::math::Quat::from_mat4( - mat.into(), + &mat, ) .into(); output @@ -958,8 +985,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Quat::to_array(_self.into()) - .into(); + let output: [f32; 4] = ::bevy::math::Quat::to_array(&_self).into(); output }, ) @@ -1084,9 +1110,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_angle: f32| { let output: Val = ::bevy::math::Quat::rotate_towards( - _self.into(), + &_self, rhs.into(), - max_angle.into(), + max_angle, ) .into(); output @@ -1102,7 +1128,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::Quat::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -1114,7 +1140,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Quat::lerp( _self.into(), end.into(), - s.into(), + s, ) .into(); output @@ -1126,7 +1152,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Quat::slerp( _self.into(), end.into(), - s.into(), + s, ) .into(); output @@ -1158,7 +1184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_affine3", |a: Ref| { let output: Val = ::bevy::math::Quat::from_affine3( - a.into(), + &a, ) .into(); output @@ -1184,21 +1210,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Quat::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) + ); + NamespaceBuilder::<::bevy::math::Vec3>::new(world) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -1206,8 +1225,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::mul( _self.into(), rhs.into(), ) @@ -1216,9 +1235,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Quat::div( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::add( _self.into(), rhs.into(), ) @@ -1227,23 +1246,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::add( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Vec3>::new(world) + ) .overwrite_script_function( - "mul", + "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::mul( + let output: Val = ::bevy::math::Vec3::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -1254,7 +1272,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -1262,259 +1280,141 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::add( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3::clone( + "add", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::add( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into(), - rhs.into(), - ) + "new", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::Vec3::new(x, y, z) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into(), - rhs.into(), - ) + "splat", + |v: f32| { + let output: Val = ::bevy::math::Vec3::splat(v) .into(); output }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::neg( - _self.into(), + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into(), - rhs.into(), - ) + "from_array", + |a: [f32; 3]| { + let output: Val = ::bevy::math::Vec3::from_array(a) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); + "to_array", + |_self: Ref| { + let output: [f32; 3] = ::bevy::math::Vec3::to_array(&_self).into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::div( + "extend", + |_self: Val, w: f32| { + let output: Val = ::bevy::math::Vec3::extend( _self.into(), - rhs.into(), + w, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::add( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::Vec3::truncate( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::rem( + "with_x", + |_self: Val, x: f32| { + let output: Val = ::bevy::math::Vec3::with_x( _self.into(), - rhs.into(), + x, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::rem( + "with_y", + |_self: Val, y: f32| { + let output: Val = ::bevy::math::Vec3::with_y( _self.into(), - rhs.into(), + y, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::div( + "with_z", + |_self: Val, z: f32| { + let output: Val = ::bevy::math::Vec3::with_z( _self.into(), - rhs.into(), + z, ) .into(); output }, ) .overwrite_script_function( - "new", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Vec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: f32| { - let output: Val = ::bevy::math::Vec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [f32; 3]| { - let output: Val = ::bevy::math::Vec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [f32; 3] = ::bevy::math::Vec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::Vec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec3::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_z", - |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec3::with_z( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::dot(_self.into(), rhs.into()) + "dot", + |_self: Val, rhs: Val| { + let output: f32 = ::bevy::math::Vec3::dot(_self.into(), rhs.into()) .into(); output }, @@ -1978,7 +1878,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec3::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -2000,7 +1900,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec3::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -2010,9 +1910,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec3::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -2039,7 +1939,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::Vec3::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -2050,8 +1950,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec3::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -2062,7 +1962,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec3::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -2073,7 +1973,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec3::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -2112,7 +2012,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec3::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -2133,7 +2033,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "any_orthogonal_vector", |_self: Ref| { let output: Val = ::bevy::math::Vec3::any_orthogonal_vector( - _self.into(), + &_self, ) .into(); output @@ -2143,7 +2043,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "any_orthonormal_vector", |_self: Ref| { let output: Val = ::bevy::math::Vec3::any_orthonormal_vector( - _self.into(), + &_self, ) .into(); output @@ -2153,7 +2053,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3::as_dvec3( - _self.into(), + &_self, ) .into(); output @@ -2163,7 +2063,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3::as_ivec3( - _self.into(), + &_self, ) .into(); output @@ -2173,7 +2073,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3::as_uvec3( - _self.into(), + &_self, ) .into(); output @@ -2183,7 +2083,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3::as_i64vec3( - _self.into(), + &_self, ) .into(); output @@ -2193,26 +2093,26 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3::as_u64vec3( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Vec3::eq(_self.into(), other.into()) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3::clone(&_self) .into(); output }, ) .overwrite_script_function( "add", - |_self: Val, rhs: f32| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -2228,23 +2128,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, - ); - NamespaceBuilder::<::bevy::math::IVec2>::new(world) + ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::sub( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::add( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::div( _self.into(), rhs.into(), ) @@ -2253,22 +2152,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::sub( + "rem", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::add( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -2276,8 +2175,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rem( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3::rem( _self.into(), rhs.into(), ) @@ -2286,22 +2185,30 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::mul( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Vec3::eq(&_self, &other).into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::IVec2>::new(world) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::rem( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -2319,85 +2226,99 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into(), - rhs.into(), - ) + "new", + |x: i32, y: i32| { + let output: Val = ::bevy::math::IVec2::new(x, y) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::div( - _self.into(), - rhs.into(), - ) + "splat", + |v: i32| { + let output: Val = ::bevy::math::IVec2::splat(v) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::IVec2::assert_receiver_is_total_eq( - _self.into(), + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::IVec2::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into(), - rhs.into(), + "from_array", + |a: [i32; 2]| { + let output: Val = ::bevy::math::IVec2::from_array( + a, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::add( + "to_array", + |_self: Ref| { + let output: [i32; 2] = ::bevy::math::IVec2::to_array(&_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, z: i32| { + let output: Val = ::bevy::math::IVec2::extend( _self.into(), - rhs.into(), + z, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::div( + "with_x", + |_self: Val, x: i32| { + let output: Val = ::bevy::math::IVec2::with_x( _self.into(), - rhs.into(), + x, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec2::eq( + "with_y", + |_self: Val, y: i32| { + let output: Val = ::bevy::math::IVec2::with_y( _self.into(), - other.into(), + y, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::div( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec2::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::dot_into_vec( _self.into(), rhs.into(), ) @@ -2406,127 +2327,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: i32, y: i32| { - let output: Val = ::bevy::math::IVec2::new( - x.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: i32| { - let output: Val = ::bevy::math::IVec2::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::IVec2::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [i32; 2]| { - let output: Val = ::bevy::math::IVec2::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i32; 2] = ::bevy::math::IVec2::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec2::extend( - _self.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec2::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec2::with_y( - _self.into(), - y.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::dot(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::dot_into_vec( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "min", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::min( + "min", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::min( _self.into(), rhs.into(), ) @@ -2766,7 +2569,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec2", |_self: Ref| { let output: Val = ::bevy::math::IVec2::as_vec2( - _self.into(), + &_self, ) .into(); output @@ -2776,7 +2579,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec2", |_self: Ref| { let output: Val = ::bevy::math::IVec2::as_dvec2( - _self.into(), + &_self, ) .into(); output @@ -2786,7 +2589,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec2", |_self: Ref| { let output: Val = ::bevy::math::IVec2::as_uvec2( - _self.into(), + &_self, ) .into(); output @@ -2796,7 +2599,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec2", |_self: Ref| { let output: Val = ::bevy::math::IVec2::as_i64vec2( - _self.into(), + &_self, ) .into(); output @@ -2806,7 +2609,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec2", |_self: Ref| { let output: Val = ::bevy::math::IVec2::as_u64vec2( - _self.into(), + &_self, ) .into(); output @@ -2945,200 +2748,358 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::IVec2::neg( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::rem( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::IVec2::clone( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::mul( _self.into(), + &rhs, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::IVec3>::new(world) + ) .overwrite_script_function( - "rem", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::rem( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::div( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::IVec2::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::IVec3::assert_receiver_is_total_eq( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::rem( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::sub( + "div", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "new", - |x: i32, y: i32, z: i32| { - let output: Val = ::bevy::math::IVec3::new( - x.into(), - y.into(), - z.into(), + "mul", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::mul( + _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "splat", - |v: i32| { - let output: Val = ::bevy::math::IVec3::splat( - v.into(), + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::sub( + _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::IVec3::select( - mask.into(), - if_true.into(), - if_false.into(), + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "from_array", - |a: [i32; 3]| { - let output: Val = ::bevy::math::IVec3::from_array( - a.into(), + "add", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::add( + _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [i32; 3] = ::bevy::math::IVec3::to_array(_self.into()) + "rem", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec2::rem( + _self.into(), + rhs, + ) .into(); output }, ) .overwrite_script_function( - "extend", - |_self: Val, w: i32| { - let output: Val = ::bevy::math::IVec3::extend( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::add( _self.into(), - w.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::IVec3::truncate( - _self.into(), - ) - .into(); + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::IVec2::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "with_x", - |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec3::with_x( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec2::div( _self.into(), - x.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "with_y", - |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec3::with_y( - _self.into(), - y.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::IVec2::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "with_z", - |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec3::with_z( - _self.into(), - z.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::IVec2::assert_receiver_is_total_eq( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::IVec3>::new(world) .overwrite_script_function( - "dot", - |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec3::dot(_self.into(), rhs.into()) + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::sub( + _self.into(), + &rhs, + ) .into(); output }, ) .overwrite_script_function( - "dot_into_vec", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::dot_into_vec( + "div", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "cross", + "rem", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: i32, y: i32, z: i32| { + let output: Val = ::bevy::math::IVec3::new( + x, + y, + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "splat", + |v: i32| { + let output: Val = ::bevy::math::IVec3::splat(v) + .into(); + output + }, + ) + .overwrite_script_function( + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::IVec3::select( + mask.into(), + if_true.into(), + if_false.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "from_array", + |a: [i32; 3]| { + let output: Val = ::bevy::math::IVec3::from_array( + a, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "to_array", + |_self: Ref| { + let output: [i32; 3] = ::bevy::math::IVec3::to_array(&_self).into(); + output + }, + ) + .overwrite_script_function( + "extend", + |_self: Val, w: i32| { + let output: Val = ::bevy::math::IVec3::extend( + _self.into(), + w, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::IVec3::truncate( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_x", + |_self: Val, x: i32| { + let output: Val = ::bevy::math::IVec3::with_x( + _self.into(), + x, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_y", + |_self: Val, y: i32| { + let output: Val = ::bevy::math::IVec3::with_y( + _self.into(), + y, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "with_z", + |_self: Val, z: i32| { + let output: Val = ::bevy::math::IVec3::with_z( + _self.into(), + z, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "dot", + |_self: Val, rhs: Val| { + let output: i32 = ::bevy::math::IVec3::dot(_self.into(), rhs.into()) + .into(); + output + }, + ) + .overwrite_script_function( + "dot_into_vec", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::dot_into_vec( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cross( _self.into(), @@ -3359,7 +3320,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3", |_self: Ref| { let output: Val = ::bevy::math::IVec3::as_vec3( - _self.into(), + &_self, ) .into(); output @@ -3369,7 +3330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3a", |_self: Ref| { let output: Val = ::bevy::math::IVec3::as_vec3a( - _self.into(), + &_self, ) .into(); output @@ -3379,7 +3340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec3", |_self: Ref| { let output: Val = ::bevy::math::IVec3::as_dvec3( - _self.into(), + &_self, ) .into(); output @@ -3389,7 +3350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec3", |_self: Ref| { let output: Val = ::bevy::math::IVec3::as_uvec3( - _self.into(), + &_self, ) .into(); output @@ -3399,7 +3360,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec3", |_self: Ref| { let output: Val = ::bevy::math::IVec3::as_i64vec3( - _self.into(), + &_self, ) .into(); output @@ -3409,7 +3370,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec3", |_self: Ref| { let output: Val = ::bevy::math::IVec3::as_u64vec3( - _self.into(), + &_self, ) .into(); output @@ -3547,32 +3508,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "mul", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec3::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::add( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::div( _self.into(), rhs.into(), ) @@ -3581,20 +3531,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::div( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::mul( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::add( _self.into(), rhs.into(), ) @@ -3603,21 +3553,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", + "sub", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::add( + let output: Val = ::bevy::math::IVec3::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::IVec3::neg( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec3::sub( _self.into(), + rhs.into(), ) .into(); output @@ -3627,7 +3578,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::IVec3::clone( - _self.into(), + &_self, ) .into(); output @@ -3636,75 +3587,69 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec3::eq( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::IVec3::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::mul( + "add", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec3::add( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::sub( + let output: Val = ::bevy::math::IVec3::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::add( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::IVec3::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "rem", + "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::rem( + let output: Val = ::bevy::math::IVec3::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::IVec3::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::rem( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec3::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -3712,44 +3657,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::IVec4>::new(world) .overwrite_script_function( - "add", + "rem", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::add( + let output: Val = ::bevy::math::IVec4::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::add( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::IVec4::neg( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into(), - rhs.into(), ) .into(); output @@ -3759,10 +3681,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: i32, y: i32, z: i32, w: i32| { let output: Val = ::bevy::math::IVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -3771,9 +3693,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = ::bevy::math::IVec4::splat( - v.into(), - ) + let output: Val = ::bevy::math::IVec4::splat(v) .into(); output }, @@ -3798,7 +3718,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [i32; 4]| { let output: Val = ::bevy::math::IVec4::from_array( - a.into(), + a, ) .into(); output @@ -3807,8 +3727,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 4] = ::bevy::math::IVec4::to_array(_self.into()) - .into(); + let output: [i32; 4] = ::bevy::math::IVec4::to_array(&_self).into(); output }, ) @@ -3827,7 +3746,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: i32| { let output: Val = ::bevy::math::IVec4::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -3838,7 +3757,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: i32| { let output: Val = ::bevy::math::IVec4::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -3849,7 +3768,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: i32| { let output: Val = ::bevy::math::IVec4::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -3860,7 +3779,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: i32| { let output: Val = ::bevy::math::IVec4::with_w( _self.into(), - w.into(), + w, ) .into(); output @@ -4096,7 +4015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec4", |_self: Ref| { let output: Val = ::bevy::math::IVec4::as_vec4( - _self.into(), + &_self, ) .into(); output @@ -4106,7 +4025,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec4", |_self: Ref| { let output: Val = ::bevy::math::IVec4::as_dvec4( - _self.into(), + &_self, ) .into(); output @@ -4116,7 +4035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec4", |_self: Ref| { let output: Val = ::bevy::math::IVec4::as_uvec4( - _self.into(), + &_self, ) .into(); output @@ -4126,7 +4045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec4", |_self: Ref| { let output: Val = ::bevy::math::IVec4::as_i64vec4( - _self.into(), + &_self, ) .into(); output @@ -4136,7 +4055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec4", |_self: Ref| { let output: Val = ::bevy::math::IVec4::as_u64vec4( - _self.into(), + &_self, ) .into(); output @@ -4275,33 +4194,32 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::add( + "sub", + |_self: Val, rhs: i32| { + let output: Val = ::bevy::math::IVec4::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::div( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::IVec4::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec4::eq( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::add( _self.into(), - other.into(), + &rhs, ) .into(); output @@ -4309,10 +4227,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "div", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::div( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -4330,9 +4248,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::rem( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::add( _self.into(), rhs.into(), ) @@ -4345,7 +4274,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -4355,50 +4284,58 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::IVec4::clone( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::mul( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::sub( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::IVec4::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "add", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::sub( + let output: Val = ::bevy::math::IVec4::add( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::IVec4::neg( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::sub( _self.into(), + rhs.into(), ) .into(); output @@ -4406,29 +4343,30 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "div", - |_self: Val, rhs: Val| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec4::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::IVec4::assert_receiver_is_total_eq( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::IVec4::sub( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::rem( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::IVec4::div( _self.into(), rhs.into(), ) @@ -4438,10 +4376,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::I64Vec2>::new(world) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::neg( + "sub", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::sub( _self.into(), + rhs, ) .into(); output @@ -4452,38 +4391,27 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::rem( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", + "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::rem( + let output: Val = ::bevy::math::I64Vec2::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::sub( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::div( _self.into(), rhs.into(), ) @@ -4492,95 +4420,84 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", + "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec2::eq( + let output: Val = ::bevy::math::I64Vec2::rem( _self.into(), - other.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rem( + "add", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::add( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::I64Vec2::assert_receiver_is_total_eq( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::mul( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::add( + let output: Val = ::bevy::math::I64Vec2::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::add( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec2::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::clone( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec2::sub( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::I64Vec2::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "mul", + "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::mul( + let output: Val = ::bevy::math::I64Vec2::sub( _self.into(), rhs.into(), ) @@ -4592,8 +4509,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: i64, y: i64| { let output: Val = ::bevy::math::I64Vec2::new( - x.into(), - y.into(), + x, + y, ) .into(); output @@ -4603,7 +4520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "splat", |v: i64| { let output: Val = ::bevy::math::I64Vec2::splat( - v.into(), + v, ) .into(); output @@ -4629,7 +4546,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [i64; 2]| { let output: Val = ::bevy::math::I64Vec2::from_array( - a.into(), + a, ) .into(); output @@ -4638,7 +4555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 2] = ::bevy::math::I64Vec2::to_array(_self.into()) + let output: [i64; 2] = ::bevy::math::I64Vec2::to_array(&_self) .into(); output }, @@ -4648,7 +4565,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: i64| { let output: Val = ::bevy::math::I64Vec2::extend( _self.into(), - z.into(), + z, ) .into(); output @@ -4659,7 +4576,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: i64| { let output: Val = ::bevy::math::I64Vec2::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -4670,7 +4587,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: i64| { let output: Val = ::bevy::math::I64Vec2::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -4943,7 +4860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec2", |_self: Ref| { let output: Val = ::bevy::math::I64Vec2::as_vec2( - _self.into(), + &_self, ) .into(); output @@ -4953,7 +4870,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec2", |_self: Ref| { let output: Val = ::bevy::math::I64Vec2::as_dvec2( - _self.into(), + &_self, ) .into(); output @@ -4963,7 +4880,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec2", |_self: Ref| { let output: Val = ::bevy::math::I64Vec2::as_ivec2( - _self.into(), + &_self, ) .into(); output @@ -4973,7 +4890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec2", |_self: Ref| { let output: Val = ::bevy::math::I64Vec2::as_uvec2( - _self.into(), + &_self, ) .into(); output @@ -4983,7 +4900,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec2", |_self: Ref| { let output: Val = ::bevy::math::I64Vec2::as_u64vec2( - _self.into(), + &_self, ) .into(); output @@ -5122,9 +5039,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::div( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::add( _self.into(), rhs.into(), ) @@ -5133,9 +5050,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::mul( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec2::rem( _self.into(), rhs.into(), ) @@ -5143,21 +5060,39 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::I64Vec2::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec2::div( + _self.into(), + rhs, + ) + .into(); + output + }, + ) .overwrite_script_function( "mul", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::sub( + let output: Val = ::bevy::math::I64Vec2::mul( _self.into(), rhs.into(), ) @@ -5166,120 +5101,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec2::clone( + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::I64Vec3>::new(world) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::I64Vec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec3::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "rem", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec3::rem( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -5287,21 +5124,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "sub", - |_self: Val, rhs: Val| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", + "sub", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::rem( + let output: Val = ::bevy::math::I64Vec3::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -5309,32 +5146,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: Val| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::rem( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec3::clone( + &_self, ) .into(); output @@ -5342,19 +5167,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "div", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::mul( + let output: Val = ::bevy::math::I64Vec3::div( _self.into(), rhs.into(), ) @@ -5366,9 +5180,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: i64, y: i64, z: i64| { let output: Val = ::bevy::math::I64Vec3::new( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -5378,7 +5192,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "splat", |v: i64| { let output: Val = ::bevy::math::I64Vec3::splat( - v.into(), + v, ) .into(); output @@ -5404,7 +5218,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [i64; 3]| { let output: Val = ::bevy::math::I64Vec3::from_array( - a.into(), + a, ) .into(); output @@ -5413,7 +5227,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 3] = ::bevy::math::I64Vec3::to_array(_self.into()) + let output: [i64; 3] = ::bevy::math::I64Vec3::to_array(&_self) .into(); output }, @@ -5423,7 +5237,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: i64| { let output: Val = ::bevy::math::I64Vec3::extend( _self.into(), - w.into(), + w, ) .into(); output @@ -5444,7 +5258,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: i64| { let output: Val = ::bevy::math::I64Vec3::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -5455,7 +5269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: i64| { let output: Val = ::bevy::math::I64Vec3::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -5466,7 +5280,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: i64| { let output: Val = ::bevy::math::I64Vec3::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -5718,7 +5532,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3", |_self: Ref| { let output: Val = ::bevy::math::I64Vec3::as_vec3( - _self.into(), + &_self, ) .into(); output @@ -5728,7 +5542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3a", |_self: Ref| { let output: Val = ::bevy::math::I64Vec3::as_vec3a( - _self.into(), + &_self, ) .into(); output @@ -5738,7 +5552,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec3", |_self: Ref| { let output: Val = ::bevy::math::I64Vec3::as_dvec3( - _self.into(), + &_self, ) .into(); output @@ -5748,7 +5562,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec3", |_self: Ref| { let output: Val = ::bevy::math::I64Vec3::as_ivec3( - _self.into(), + &_self, ) .into(); output @@ -5758,7 +5572,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec3", |_self: Ref| { let output: Val = ::bevy::math::I64Vec3::as_uvec3( - _self.into(), + &_self, ) .into(); output @@ -5768,7 +5582,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec3", |_self: Ref| { let output: Val = ::bevy::math::I64Vec3::as_u64vec3( - _self.into(), + &_self, ) .into(); output @@ -5907,106 +5721,106 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", + "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::sub( + let output: Val = ::bevy::math::I64Vec3::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::clone( + "add", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::add( _self.into(), + rhs, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::I64Vec4>::new(world) + ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::I64Vec3::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::I64Vec4::assert_receiver_is_total_eq( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::add( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::add( + "div", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::rem( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::add( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::I64Vec3::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::clone( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::sub( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::div( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec3::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::sub( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::mul( _self.into(), rhs.into(), ) @@ -6015,9 +5829,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::div( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec3::rem( _self.into(), rhs.into(), ) @@ -6026,54 +5840,101 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::add( + "mul", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec3::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::I64Vec3::eq(&_self, &other).into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::I64Vec4>::new(world) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec4::eq( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::I64Vec4::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "mul", + "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::mul( + let output: Val = ::bevy::math::I64Vec4::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", + "div", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::mul( + let output: Val = ::bevy::math::I64Vec4::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::I64Vec4::clone( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), rhs.into(), ) .into(); @@ -6084,6 +5945,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec4::rem( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::div( _self.into(), rhs.into(), ) @@ -6092,9 +5964,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", + "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::rem( + let output: Val = ::bevy::math::I64Vec4::add( _self.into(), rhs.into(), ) @@ -6102,14 +5974,79 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: i64| { + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::add( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::sub( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::I64Vec4::assert_receiver_is_total_eq( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "new", |x: i64, y: i64, z: i64, w: i64| { let output: Val = ::bevy::math::I64Vec4::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -6119,7 +6056,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "splat", |v: i64| { let output: Val = ::bevy::math::I64Vec4::splat( - v.into(), + v, ) .into(); output @@ -6145,7 +6082,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [i64; 4]| { let output: Val = ::bevy::math::I64Vec4::from_array( - a.into(), + a, ) .into(); output @@ -6154,7 +6091,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 4] = ::bevy::math::I64Vec4::to_array(_self.into()) + let output: [i64; 4] = ::bevy::math::I64Vec4::to_array(&_self) .into(); output }, @@ -6174,7 +6111,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: i64| { let output: Val = ::bevy::math::I64Vec4::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -6185,7 +6122,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: i64| { let output: Val = ::bevy::math::I64Vec4::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -6196,7 +6133,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: i64| { let output: Val = ::bevy::math::I64Vec4::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -6207,7 +6144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: i64| { let output: Val = ::bevy::math::I64Vec4::with_w( _self.into(), - w.into(), + w, ) .into(); output @@ -6448,7 +6385,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec4", |_self: Ref| { let output: Val = ::bevy::math::I64Vec4::as_vec4( - _self.into(), + &_self, ) .into(); output @@ -6458,7 +6395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec4", |_self: Ref| { let output: Val = ::bevy::math::I64Vec4::as_dvec4( - _self.into(), + &_self, ) .into(); output @@ -6468,7 +6405,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec4", |_self: Ref| { let output: Val = ::bevy::math::I64Vec4::as_ivec4( - _self.into(), + &_self, ) .into(); output @@ -6478,7 +6415,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec4", |_self: Ref| { let output: Val = ::bevy::math::I64Vec4::as_uvec4( - _self.into(), + &_self, ) .into(); output @@ -6488,7 +6425,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec4", |_self: Ref| { let output: Val = ::bevy::math::I64Vec4::as_u64vec4( - _self.into(), + &_self, ) .into(); output @@ -6626,6 +6563,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::I64Vec4::mul( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) .overwrite_script_function( "neg", |_self: Val| { @@ -6635,13 +6583,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, + ); + NamespaceBuilder::<::bevy::math::UVec2>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::UVec2::eq(&_self, &other).into(); + output + }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::sub( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -6649,16 +6605,25 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "div", - |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::div( + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::UVec2>::new(world) + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::UVec2::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { @@ -6671,9 +6636,31 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::sub( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::rem( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::add( + let output: Val = ::bevy::math::UVec2::rem( _self.into(), rhs.into(), ) @@ -6682,9 +6669,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::div( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::mul( _self.into(), rhs.into(), ) @@ -6697,18 +6684,18 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec2::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "mul", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::add( + let output: Val = ::bevy::math::UVec2::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -6716,19 +6703,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: Val| { + |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec2::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::rem( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::add( _self.into(), rhs.into(), ) @@ -6737,11 +6724,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec2::mul( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::div( + let output: Val = ::bevy::math::UVec2::add( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -6751,18 +6749,29 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::math::UVec2::assert_receiver_is_total_eq( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec2::sub( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec2::eq( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec2::sub( _self.into(), - other.into(), + rhs.into(), ) .into(); output @@ -6771,10 +6780,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u32, y: u32| { - let output: Val = ::bevy::math::UVec2::new( - x.into(), - y.into(), - ) + let output: Val = ::bevy::math::UVec2::new(x, y) .into(); output }, @@ -6782,9 +6788,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = ::bevy::math::UVec2::splat( - v.into(), - ) + let output: Val = ::bevy::math::UVec2::splat(v) .into(); output }, @@ -6809,7 +6813,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [u32; 2]| { let output: Val = ::bevy::math::UVec2::from_array( - a.into(), + a, ) .into(); output @@ -6818,8 +6822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 2] = ::bevy::math::UVec2::to_array(_self.into()) - .into(); + let output: [u32; 2] = ::bevy::math::UVec2::to_array(&_self).into(); output }, ) @@ -6828,7 +6831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: u32| { let output: Val = ::bevy::math::UVec2::extend( _self.into(), - z.into(), + z, ) .into(); output @@ -6839,7 +6842,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: u32| { let output: Val = ::bevy::math::UVec2::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -6850,7 +6853,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: u32| { let output: Val = ::bevy::math::UVec2::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -7023,7 +7026,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec2", |_self: Ref| { let output: Val = ::bevy::math::UVec2::as_vec2( - _self.into(), + &_self, ) .into(); output @@ -7033,7 +7036,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec2", |_self: Ref| { let output: Val = ::bevy::math::UVec2::as_dvec2( - _self.into(), + &_self, ) .into(); output @@ -7043,7 +7046,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec2", |_self: Ref| { let output: Val = ::bevy::math::UVec2::as_ivec2( - _self.into(), + &_self, ) .into(); output @@ -7053,7 +7056,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec2", |_self: Ref| { let output: Val = ::bevy::math::UVec2::as_i64vec2( - _self.into(), + &_self, ) .into(); output @@ -7063,7 +7066,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec2", |_self: Ref| { let output: Val = ::bevy::math::UVec2::as_u64vec2( - _self.into(), + &_self, ) .into(); output @@ -7178,45 +7181,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::UVec3>::new(world) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::mul( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::UVec2::clone( - _self.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::UVec3::assert_receiver_is_total_eq( + &_self, ) .into(); output @@ -7224,8 +7206,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::sub( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::sub( _self.into(), rhs.into(), ) @@ -7234,9 +7216,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::sub( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::add( _self.into(), rhs.into(), ) @@ -7245,32 +7227,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::UVec3::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::UVec3>::new(world) - .overwrite_script_function( - "div", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::div( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::mul( _self.into(), rhs.into(), ) @@ -7279,22 +7248,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", + "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::rem( + let output: Val = ::bevy::math::UVec3::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::add( + "mul", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -7304,9 +7273,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: u32, y: u32, z: u32| { let output: Val = ::bevy::math::UVec3::new( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -7315,9 +7284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = ::bevy::math::UVec3::splat( - v.into(), - ) + let output: Val = ::bevy::math::UVec3::splat(v) .into(); output }, @@ -7342,7 +7309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [u32; 3]| { let output: Val = ::bevy::math::UVec3::from_array( - a.into(), + a, ) .into(); output @@ -7351,8 +7318,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 3] = ::bevy::math::UVec3::to_array(_self.into()) - .into(); + let output: [u32; 3] = ::bevy::math::UVec3::to_array(&_self).into(); output }, ) @@ -7361,7 +7327,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: u32| { let output: Val = ::bevy::math::UVec3::extend( _self.into(), - w.into(), + w, ) .into(); output @@ -7382,7 +7348,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: u32| { let output: Val = ::bevy::math::UVec3::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -7393,7 +7359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: u32| { let output: Val = ::bevy::math::UVec3::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -7404,7 +7370,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: u32| { let output: Val = ::bevy::math::UVec3::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -7588,7 +7554,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3", |_self: Ref| { let output: Val = ::bevy::math::UVec3::as_vec3( - _self.into(), + &_self, ) .into(); output @@ -7598,7 +7564,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3a", |_self: Ref| { let output: Val = ::bevy::math::UVec3::as_vec3a( - _self.into(), + &_self, ) .into(); output @@ -7608,7 +7574,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec3", |_self: Ref| { let output: Val = ::bevy::math::UVec3::as_dvec3( - _self.into(), + &_self, ) .into(); output @@ -7618,7 +7584,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec3", |_self: Ref| { let output: Val = ::bevy::math::UVec3::as_ivec3( - _self.into(), + &_self, ) .into(); output @@ -7628,7 +7594,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec3", |_self: Ref| { let output: Val = ::bevy::math::UVec3::as_i64vec3( - _self.into(), + &_self, ) .into(); output @@ -7638,7 +7604,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec3", |_self: Ref| { let output: Val = ::bevy::math::UVec3::as_u64vec3( - _self.into(), + &_self, ) .into(); output @@ -7754,32 +7720,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "sub", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::mul( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec3::rem( _self.into(), rhs.into(), ) @@ -7788,31 +7743,27 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::sub( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into(), - rhs.into(), - ) - .into(); + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::UVec3::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "sub", + "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::sub( + let output: Val = ::bevy::math::UVec3::div( _self.into(), rhs.into(), ) @@ -7821,32 +7772,33 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", + "div", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::rem( + let output: Val = ::bevy::math::UVec3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::div( + "rem", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec3::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::UVec3::assert_receiver_is_total_eq( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec3::sub( _self.into(), + &rhs, ) .into(); output @@ -7857,37 +7809,39 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::add( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", + "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::mul( + let output: Val = ::bevy::math::UVec3::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::UVec4>::new(world) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::UVec3::clone( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::sub( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::rem( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::sub( _self.into(), rhs.into(), ) @@ -7896,33 +7850,32 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec3::eq( + "div", + |_self: Val, rhs: u32| { + let output: Val = ::bevy::math::UVec4::div( _self.into(), - other.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::div( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::UVec4::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::UVec4>::new(world) + ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::UVec4::assert_receiver_is_total_eq( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::add( _self.into(), + &rhs, ) .into(); output @@ -7930,7 +7883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::mul( _self.into(), rhs.into(), @@ -7940,9 +7893,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", + "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::add( + let output: Val = ::bevy::math::UVec4::rem( _self.into(), rhs.into(), ) @@ -7950,14 +7903,25 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::mul( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) .overwrite_script_function( "new", |x: u32, y: u32, z: u32, w: u32| { let output: Val = ::bevy::math::UVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -7966,9 +7930,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = ::bevy::math::UVec4::splat( - v.into(), - ) + let output: Val = ::bevy::math::UVec4::splat(v) .into(); output }, @@ -7993,7 +7955,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [u32; 4]| { let output: Val = ::bevy::math::UVec4::from_array( - a.into(), + a, ) .into(); output @@ -8002,8 +7964,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 4] = ::bevy::math::UVec4::to_array(_self.into()) - .into(); + let output: [u32; 4] = ::bevy::math::UVec4::to_array(&_self).into(); output }, ) @@ -8022,7 +7983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: u32| { let output: Val = ::bevy::math::UVec4::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -8033,7 +7994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: u32| { let output: Val = ::bevy::math::UVec4::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -8044,7 +8005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: u32| { let output: Val = ::bevy::math::UVec4::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -8055,7 +8016,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: u32| { let output: Val = ::bevy::math::UVec4::with_w( _self.into(), - w.into(), + w, ) .into(); output @@ -8228,7 +8189,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec4", |_self: Ref| { let output: Val = ::bevy::math::UVec4::as_vec4( - _self.into(), + &_self, ) .into(); output @@ -8238,7 +8199,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec4", |_self: Ref| { let output: Val = ::bevy::math::UVec4::as_dvec4( - _self.into(), + &_self, ) .into(); output @@ -8248,7 +8209,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec4", |_self: Ref| { let output: Val = ::bevy::math::UVec4::as_ivec4( - _self.into(), + &_self, ) .into(); output @@ -8258,7 +8219,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec4", |_self: Ref| { let output: Val = ::bevy::math::UVec4::as_i64vec4( - _self.into(), + &_self, ) .into(); output @@ -8268,7 +8229,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec4", |_self: Ref| { let output: Val = ::bevy::math::UVec4::as_u64vec4( - _self.into(), + &_self, ) .into(); output @@ -8385,21 +8346,18 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::UVec4::clone( - _self.into(), - ) - .into(); + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::UVec4::eq(&_self, &other).into(); output }, ) .overwrite_script_function( "sub", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -8416,89 +8374,44 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "mul", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::add( + let output: Val = ::bevy::math::UVec4::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::sub( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::UVec4::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::div( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::UVec4::assert_receiver_is_total_eq( + &_self, ) .into(); output @@ -8509,16 +8422,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::div( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::UVec4::add( _self.into(), rhs.into(), ) @@ -8526,23 +8439,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "add", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::add( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -8550,19 +8452,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::U64Vec2>::new(world) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::U64Vec2::assert_receiver_is_total_eq( + "mul", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::mul( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::sub( + let output: Val = ::bevy::math::U64Vec2::rem( _self.into(), rhs.into(), ) @@ -8572,7 +8475,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "add", - |_self: Val, rhs: u64| { + |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::add( _self.into(), rhs.into(), @@ -8582,22 +8485,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::rem( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::sub( + let output: Val = ::bevy::math::U64Vec2::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -8608,29 +8511,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec2::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec2::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::div( + "sub", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -8641,40 +8543,29 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec2::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "add", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::sub( + let output: Val = ::bevy::math::U64Vec2::add( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", + "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec2::eq( + let output: Val = ::bevy::math::U64Vec2::div( _self.into(), - other.into(), + &rhs, ) .into(); output @@ -8684,8 +8575,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: u64, y: u64| { let output: Val = ::bevy::math::U64Vec2::new( - x.into(), - y.into(), + x, + y, ) .into(); output @@ -8695,7 +8586,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "splat", |v: u64| { let output: Val = ::bevy::math::U64Vec2::splat( - v.into(), + v, ) .into(); output @@ -8721,7 +8612,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [u64; 2]| { let output: Val = ::bevy::math::U64Vec2::from_array( - a.into(), + a, ) .into(); output @@ -8730,7 +8621,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 2] = ::bevy::math::U64Vec2::to_array(_self.into()) + let output: [u64; 2] = ::bevy::math::U64Vec2::to_array(&_self) .into(); output }, @@ -8740,7 +8631,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: u64| { let output: Val = ::bevy::math::U64Vec2::extend( _self.into(), - z.into(), + z, ) .into(); output @@ -8751,7 +8642,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: u64| { let output: Val = ::bevy::math::U64Vec2::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -8762,7 +8653,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: u64| { let output: Val = ::bevy::math::U64Vec2::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -8940,7 +8831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec2", |_self: Ref| { let output: Val = ::bevy::math::U64Vec2::as_vec2( - _self.into(), + &_self, ) .into(); output @@ -8950,7 +8841,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec2", |_self: Ref| { let output: Val = ::bevy::math::U64Vec2::as_dvec2( - _self.into(), + &_self, ) .into(); output @@ -8960,7 +8851,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec2", |_self: Ref| { let output: Val = ::bevy::math::U64Vec2::as_ivec2( - _self.into(), + &_self, ) .into(); output @@ -8970,7 +8861,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec2", |_self: Ref| { let output: Val = ::bevy::math::U64Vec2::as_uvec2( - _self.into(), + &_self, ) .into(); output @@ -8980,7 +8871,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec2", |_self: Ref| { let output: Val = ::bevy::math::U64Vec2::as_i64vec2( - _self.into(), + &_self, ) .into(); output @@ -9097,41 +8988,49 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::mul( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec2::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::clone( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::div( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::mul( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::U64Vec2::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec2::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::add( + let output: Val = ::bevy::math::U64Vec2::mul( _self.into(), rhs.into(), ) @@ -9140,20 +9039,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::U64Vec2::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::add( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec2::sub( _self.into(), rhs.into(), ) @@ -9164,10 +9062,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { NamespaceBuilder::<::bevy::math::U64Vec3>::new(world) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { + |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -9175,230 +9073,109 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "sub", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), + "new", + |x: u64, y: u64, z: u64| { + let output: Val = ::bevy::math::U64Vec3::new( + x, + y, + z, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), - rhs.into(), + "splat", + |v: u64| { + let output: Val = ::bevy::math::U64Vec3::splat( + v, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), + "select", + | + mask: Val, + if_true: Val, + if_false: Val| + { + let output: Val = ::bevy::math::U64Vec3::select( + mask.into(), + if_true.into(), + if_false.into(), ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), + "from_array", + |a: [u64; 3]| { + let output: Val = ::bevy::math::U64Vec3::from_array( + a, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), - rhs.into(), - ) + "to_array", + |_self: Ref| { + let output: [u64; 3] = ::bevy::math::U64Vec3::to_array(&_self) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::mul( + "extend", + |_self: Val, w: u64| { + let output: Val = ::bevy::math::U64Vec3::extend( _self.into(), - rhs.into(), + w, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::rem( + "truncate", + |_self: Val| { + let output: Val = ::bevy::math::U64Vec3::truncate( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::add( + "with_x", + |_self: Val, x: u64| { + let output: Val = ::bevy::math::U64Vec3::with_x( _self.into(), - rhs.into(), + x, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::add( + "with_y", + |_self: Val, y: u64| { + let output: Val = ::bevy::math::U64Vec3::with_y( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "new", - |x: u64, y: u64, z: u64| { - let output: Val = ::bevy::math::U64Vec3::new( - x.into(), - y.into(), - z.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "splat", - |v: u64| { - let output: Val = ::bevy::math::U64Vec3::splat( - v.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "select", - | - mask: Val, - if_true: Val, - if_false: Val| - { - let output: Val = ::bevy::math::U64Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "from_array", - |a: [u64; 3]| { - let output: Val = ::bevy::math::U64Vec3::from_array( - a.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "to_array", - |_self: Ref| { - let output: [u64; 3] = ::bevy::math::U64Vec3::to_array(_self.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "extend", - |_self: Val, w: u64| { - let output: Val = ::bevy::math::U64Vec3::extend( - _self.into(), - w.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "truncate", - |_self: Val| { - let output: Val = ::bevy::math::U64Vec3::truncate( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_x", - |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec3::with_x( - _self.into(), - x.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "with_y", - |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec3::with_y( - _self.into(), - y.into(), + y, ) .into(); output @@ -9409,7 +9186,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: u64| { let output: Val = ::bevy::math::U64Vec3::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -9598,7 +9375,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3", |_self: Ref| { let output: Val = ::bevy::math::U64Vec3::as_vec3( - _self.into(), + &_self, ) .into(); output @@ -9608,7 +9385,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec3a", |_self: Ref| { let output: Val = ::bevy::math::U64Vec3::as_vec3a( - _self.into(), + &_self, ) .into(); output @@ -9618,7 +9395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec3", |_self: Ref| { let output: Val = ::bevy::math::U64Vec3::as_dvec3( - _self.into(), + &_self, ) .into(); output @@ -9628,7 +9405,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec3", |_self: Ref| { let output: Val = ::bevy::math::U64Vec3::as_ivec3( - _self.into(), + &_self, ) .into(); output @@ -9638,7 +9415,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec3", |_self: Ref| { let output: Val = ::bevy::math::U64Vec3::as_uvec3( - _self.into(), + &_self, ) .into(); output @@ -9648,7 +9425,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec3", |_self: Ref| { let output: Val = ::bevy::math::U64Vec3::as_i64vec3( - _self.into(), + &_self, ) .into(); output @@ -9765,9 +9542,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::rem( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::add( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::mul( _self.into(), rhs.into(), ) @@ -9776,22 +9564,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", + "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::add( + let output: Val = ::bevy::math::U64Vec3::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec3::eq( + "rem", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::rem( _self.into(), - other.into(), + rhs, ) .into(); output @@ -9801,27 +9589,27 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::math::U64Vec3::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::clone( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::div( _self.into(), + &rhs, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::U64Vec4>::new(world) + ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::rem( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::div( _self.into(), rhs.into(), ) @@ -9830,22 +9618,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::mul( + "div", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec3::clone( + &_self, ) .into(); output @@ -9853,8 +9640,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::rem( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::rem( _self.into(), rhs.into(), ) @@ -9863,40 +9650,49 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::U64Vec4::assert_receiver_is_total_eq( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::sub( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec4::eq( + "add", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec3::add( _self.into(), - other.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::clone( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::U64Vec3::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::mul( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::div( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec3::add( _self.into(), rhs.into(), ) @@ -9905,31 +9701,31 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::div( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec3::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::U64Vec4>::new(world) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), - rhs.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::U64Vec4::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "mul", + "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::mul( + let output: Val = ::bevy::math::U64Vec4::sub( _self.into(), rhs.into(), ) @@ -9939,41 +9735,41 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: u64| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec4::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", + "div", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::mul( + let output: Val = ::bevy::math::U64Vec4::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::add( + let output: Val = ::bevy::math::U64Vec4::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::sub( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::mul( _self.into(), rhs.into(), ) @@ -9982,9 +9778,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::div( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::add( _self.into(), rhs.into(), ) @@ -9992,14 +9788,101 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::sub( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: u64| { + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::add( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::U64Vec4::mul( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::U64Vec4::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::U64Vec4::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "new", |x: u64, y: u64, z: u64, w: u64| { let output: Val = ::bevy::math::U64Vec4::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -10009,7 +9892,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "splat", |v: u64| { let output: Val = ::bevy::math::U64Vec4::splat( - v.into(), + v, ) .into(); output @@ -10035,7 +9918,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [u64; 4]| { let output: Val = ::bevy::math::U64Vec4::from_array( - a.into(), + a, ) .into(); output @@ -10044,7 +9927,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 4] = ::bevy::math::U64Vec4::to_array(_self.into()) + let output: [u64; 4] = ::bevy::math::U64Vec4::to_array(&_self) .into(); output }, @@ -10064,7 +9947,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: u64| { let output: Val = ::bevy::math::U64Vec4::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -10075,7 +9958,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: u64| { let output: Val = ::bevy::math::U64Vec4::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -10086,7 +9969,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: u64| { let output: Val = ::bevy::math::U64Vec4::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -10097,7 +9980,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: u64| { let output: Val = ::bevy::math::U64Vec4::with_w( _self.into(), - w.into(), + w, ) .into(); output @@ -10275,7 +10158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec4", |_self: Ref| { let output: Val = ::bevy::math::U64Vec4::as_vec4( - _self.into(), + &_self, ) .into(); output @@ -10285,7 +10168,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec4", |_self: Ref| { let output: Val = ::bevy::math::U64Vec4::as_dvec4( - _self.into(), + &_self, ) .into(); output @@ -10295,7 +10178,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec4", |_self: Ref| { let output: Val = ::bevy::math::U64Vec4::as_ivec4( - _self.into(), + &_self, ) .into(); output @@ -10305,7 +10188,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec4", |_self: Ref| { let output: Val = ::bevy::math::U64Vec4::as_uvec4( - _self.into(), + &_self, ) .into(); output @@ -10315,7 +10198,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec4", |_self: Ref| { let output: Val = ::bevy::math::U64Vec4::as_i64vec4( - _self.into(), + &_self, ) .into(); output @@ -10432,22 +10315,29 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", + "rem", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::sub( + let output: Val = ::bevy::math::U64Vec4::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::U64Vec4::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "sub", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::add( + let output: Val = ::bevy::math::U64Vec4::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -10455,11 +10345,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::Vec2>::new(world) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::mul( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -10481,52 +10371,55 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec2::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::div( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::add( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::Vec2::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec2::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::sub( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into(), - rhs.into(), - ) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec2::clone(&_self) .into(); output }, @@ -10534,10 +10427,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32| { - let output: Val = ::bevy::math::Vec2::new( - x.into(), - y.into(), - ) + let output: Val = ::bevy::math::Vec2::new(x, y) .into(); output }, @@ -10545,9 +10435,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec2::splat( - v.into(), - ) + let output: Val = ::bevy::math::Vec2::splat(v) .into(); output }, @@ -10571,9 +10459,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 2]| { - let output: Val = ::bevy::math::Vec2::from_array( - a.into(), - ) + let output: Val = ::bevy::math::Vec2::from_array(a) .into(); output }, @@ -10581,8 +10467,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 2] = ::bevy::math::Vec2::to_array(_self.into()) - .into(); + let output: [f32; 2] = ::bevy::math::Vec2::to_array(&_self).into(); output }, ) @@ -10591,7 +10476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec2::extend( _self.into(), - z.into(), + z, ) .into(); output @@ -10602,7 +10487,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec2::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -10613,7 +10498,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec2::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -11075,7 +10960,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec2::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -11097,7 +10982,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec2::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -11107,9 +10992,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec2::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -11136,7 +11021,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::Vec2::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -11147,8 +11032,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec2::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -11159,7 +11044,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec2::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -11170,7 +11055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec2::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -11209,7 +11094,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec2::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -11219,7 +11104,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f32| { let output: Val = ::bevy::math::Vec2::from_angle( - angle.into(), + angle, ) .into(); output @@ -11294,9 +11179,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_angle: f32| { let output: Val = ::bevy::math::Vec2::rotate_towards( - _self.into(), + &_self, rhs.into(), - max_angle.into(), + max_angle, ) .into(); output @@ -11306,7 +11191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec2", |_self: Ref| { let output: Val = ::bevy::math::Vec2::as_dvec2( - _self.into(), + &_self, ) .into(); output @@ -11316,7 +11201,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec2", |_self: Ref| { let output: Val = ::bevy::math::Vec2::as_ivec2( - _self.into(), + &_self, ) .into(); output @@ -11326,7 +11211,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec2", |_self: Ref| { let output: Val = ::bevy::math::Vec2::as_uvec2( - _self.into(), + &_self, ) .into(); output @@ -11336,7 +11221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec2", |_self: Ref| { let output: Val = ::bevy::math::Vec2::as_i64vec2( - _self.into(), + &_self, ) .into(); output @@ -11346,34 +11231,27 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec2", |_self: Ref| { let output: Val = ::bevy::math::Vec2::as_u64vec2( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Vec2::eq(_self.into(), other.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec2::clone( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::sub( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::sub( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::mul( _self.into(), rhs.into(), ) @@ -11383,21 +11261,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::rem( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec2::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -11415,11 +11293,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "sub", + "add", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::sub( + let output: Val = ::bevy::math::Vec2::add( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -11430,39 +11308,40 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec2::neg( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec2::rem( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::add( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec2::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", + "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::div( + let output: Val = ::bevy::math::Vec2::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -11470,9 +11349,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::Vec3A>::new(world) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::rem( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::add( _self.into(), rhs.into(), ) @@ -11481,33 +11360,39 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::mul( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Vec3A::eq(&_self, &rhs).into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::sub( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec3A::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "div", + "rem", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::div( + let output: Val = ::bevy::math::Vec3A::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -11515,7 +11400,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "sub", - |_self: Val, rhs: f32| { + |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::sub( _self.into(), rhs.into(), @@ -11525,13 +11410,34 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "new", - |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Vec3A::new( - x.into(), - y.into(), - z.into(), - ) + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec3A::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "new", + |x: f32, y: f32, z: f32| { + let output: Val = ::bevy::math::Vec3A::new( + x, + y, + z, + ) .into(); output }, @@ -11539,9 +11445,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec3A::splat( - v.into(), - ) + let output: Val = ::bevy::math::Vec3A::splat(v) .into(); output }, @@ -11566,7 +11470,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [f32; 3]| { let output: Val = ::bevy::math::Vec3A::from_array( - a.into(), + a, ) .into(); output @@ -11575,8 +11479,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = ::bevy::math::Vec3A::to_array(_self.into()) - .into(); + let output: [f32; 3] = ::bevy::math::Vec3A::to_array(&_self).into(); output }, ) @@ -11595,7 +11498,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: f32| { let output: Val = ::bevy::math::Vec3A::extend( _self.into(), - w.into(), + w, ) .into(); output @@ -11616,7 +11519,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec3A::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -11627,7 +11530,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec3A::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -11638,7 +11541,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec3A::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -12111,7 +12014,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec3A::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -12133,7 +12036,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec3A::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -12143,9 +12046,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec3A::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -12172,7 +12075,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::Vec3A::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -12183,8 +12086,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec3A::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -12195,7 +12098,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec3A::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -12206,7 +12109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec3A::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -12249,7 +12152,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec3A::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -12270,7 +12173,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "any_orthogonal_vector", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::any_orthogonal_vector( - _self.into(), + &_self, ) .into(); output @@ -12280,7 +12183,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "any_orthonormal_vector", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::any_orthonormal_vector( - _self.into(), + &_self, ) .into(); output @@ -12290,7 +12193,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::as_dvec3( - _self.into(), + &_self, ) .into(); output @@ -12300,7 +12203,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::as_ivec3( - _self.into(), + &_self, ) .into(); output @@ -12310,7 +12213,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::as_uvec3( - _self.into(), + &_self, ) .into(); output @@ -12320,7 +12223,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::as_i64vec3( - _self.into(), + &_self, ) .into(); output @@ -12330,17 +12233,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec3", |_self: Ref| { let output: Val = ::bevy::math::Vec3A::as_u64vec3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec3A::neg( - _self.into(), + &_self, ) .into(); output @@ -12351,17 +12244,18 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::clone( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec3A::mul( _self.into(), + rhs, ) .into(); output @@ -12372,7 +12266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -12383,16 +12277,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::add( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", + "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::sub( + let output: Val = ::bevy::math::Vec3A::mul( _self.into(), rhs.into(), ) @@ -12402,19 +12296,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "div", - |_self: Val, rhs: Val| { + |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::add( + let output: Val = ::bevy::math::Vec3A::rem( _self.into(), rhs.into(), ) @@ -12423,30 +12317,45 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Vec3A::eq(_self.into(), rhs.into()) + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::rem( + _self.into(), + &rhs, + ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::rem( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::mul( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec3A::div( + _self.into(), + &rhs, + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::Vec4>::new(world) .overwrite_script_function( "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::rem( + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -12454,8 +12363,26 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::mul( + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::mul( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Vec4::eq(&_self, &rhs).into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::div( _self.into(), rhs.into(), ) @@ -12464,25 +12391,78 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::mul( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::div( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Vec4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Vec4::add( _self.into(), rhs.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Vec4>::new(world) + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::add( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Vec4::sub( + _self.into(), + rhs, + ) + .into(); + output + }, + ) .overwrite_script_function( "new", |x: f32, y: f32, z: f32, w: f32| { let output: Val = ::bevy::math::Vec4::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -12491,9 +12471,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec4::splat( - v.into(), - ) + let output: Val = ::bevy::math::Vec4::splat(v) .into(); output }, @@ -12517,9 +12495,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = ::bevy::math::Vec4::from_array( - a.into(), - ) + let output: Val = ::bevy::math::Vec4::from_array(a) .into(); output }, @@ -12527,8 +12503,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Vec4::to_array(_self.into()) - .into(); + let output: [f32; 4] = ::bevy::math::Vec4::to_array(&_self).into(); output }, ) @@ -12547,7 +12522,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec4::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -12558,7 +12533,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec4::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -12569,7 +12544,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec4::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -12580,7 +12555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: f32| { let output: Val = ::bevy::math::Vec4::with_w( _self.into(), - w.into(), + w, ) .into(); output @@ -13042,7 +13017,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec4::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -13064,7 +13039,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec4::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -13074,9 +13049,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec4::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -13103,7 +13078,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::Vec4::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -13114,8 +13089,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec4::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -13126,7 +13101,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec4::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -13137,7 +13112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec4::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -13176,7 +13151,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::Vec4::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -13186,7 +13161,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dvec4", |_self: Ref| { let output: Val = ::bevy::math::Vec4::as_dvec4( - _self.into(), + &_self, ) .into(); output @@ -13196,7 +13171,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec4", |_self: Ref| { let output: Val = ::bevy::math::Vec4::as_ivec4( - _self.into(), + &_self, ) .into(); output @@ -13206,7 +13181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec4", |_self: Ref| { let output: Val = ::bevy::math::Vec4::as_uvec4( - _self.into(), + &_self, ) .into(); output @@ -13216,7 +13191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec4", |_self: Ref| { let output: Val = ::bevy::math::Vec4::as_i64vec4( - _self.into(), + &_self, ) .into(); output @@ -13226,38 +13201,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec4", |_self: Ref| { let output: Val = ::bevy::math::Vec4::as_u64vec4( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", + "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::rem( + let output: Val = ::bevy::math::Vec4::sub( _self.into(), rhs.into(), ) @@ -13266,11 +13219,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", + "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::add( + let output: Val = ::bevy::math::Vec4::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -13287,56 +13240,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "rem", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Vec4::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), - ) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Vec4::clone(&_self) .into(); output }, @@ -13346,46 +13264,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Vec4::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::div( + let output: Val = ::bevy::math::Vec4::rem( _self.into(), rhs.into(), ) @@ -13393,33 +13281,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Vec4::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::mul( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -13430,19 +13297,23 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::math::BVec2::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::BVec2::eq(&_self, &other).into(); + output + }, + ) .overwrite_script_function( "new", |x: bool, y: bool| { - let output: Val = ::bevy::math::BVec2::new( - x.into(), - y.into(), - ) + let output: Val = ::bevy::math::BVec2::new(x, y) .into(); output }, @@ -13450,9 +13321,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec2::splat( - v.into(), - ) + let output: Val = ::bevy::math::BVec2::splat(v) .into(); output }, @@ -13461,7 +13330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [bool; 2]| { let output: Val = ::bevy::math::BVec2::from_array( - a.into(), + a, ) .into(); output @@ -13491,22 +13360,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec2::test( - _self.into(), - index.into(), - ) - .into(); + let output: bool = ::bevy::math::BVec2::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec2::set( - _self.into(), - index.into(), - value.into(), - ) + let output: () = ::bevy::math::BVec2::set(&mut_self, index, value) .into(); output }, @@ -13515,41 +13376,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::BVec2::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec2::eq( - _self.into(), - other.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::math::BVec3>::new(world) - .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::BVec3::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { let output: Val = ::bevy::math::BVec3::new( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -13558,9 +13398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec3::splat( - v.into(), - ) + let output: Val = ::bevy::math::BVec3::splat(v) .into(); output }, @@ -13569,7 +13407,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [bool; 3]| { let output: Val = ::bevy::math::BVec3::from_array( - a.into(), + a, ) .into(); output @@ -13599,42 +13437,40 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec3::test( - _self.into(), - index.into(), - ) - .into(); + let output: bool = ::bevy::math::BVec3::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3::set( - _self.into(), - index.into(), - value.into(), - ) + let output: () = ::bevy::math::BVec3::set(&mut_self, index, value) .into(); output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::BVec3::eq(&_self, &other).into(); + output + }, + ) .overwrite_script_function( "clone", |_self: Ref| { let output: Val = ::bevy::math::BVec3::clone( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec3::eq( - _self.into(), - other.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::BVec3::assert_receiver_is_total_eq( + &_self, ) .into(); output @@ -13642,120 +13478,149 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::BVec4>::new(world) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec4::clone( - _self.into(), + "new", + |x: bool, y: bool, z: bool, w: bool| { + let output: Val = ::bevy::math::BVec4::new( + x, + y, + z, + w, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec4::eq( - _self.into(), - other.into(), - ) + "splat", + |v: bool| { + let output: Val = ::bevy::math::BVec4::splat(v) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::math::BVec4::assert_receiver_is_total_eq( - _self.into(), + "from_array", + |a: [bool; 4]| { + let output: Val = ::bevy::math::BVec4::from_array( + a, ) .into(); output }, ) .overwrite_script_function( - "new", - |x: bool, y: bool, z: bool, w: bool| { - let output: Val = ::bevy::math::BVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), - ) + "bitmask", + |_self: Val| { + let output: u32 = ::bevy::math::BVec4::bitmask(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "any", + |_self: Val| { + let output: bool = ::bevy::math::BVec4::any(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "all", + |_self: Val| { + let output: bool = ::bevy::math::BVec4::all(_self.into()).into(); + output + }, + ) + .overwrite_script_function( + "test", + |_self: Ref, index: usize| { + let output: bool = ::bevy::math::BVec4::test(&_self, index).into(); + output + }, + ) + .overwrite_script_function( + "set", + |_self: Mut, index: usize, value: bool| { + let output: () = ::bevy::math::BVec4::set(&mut_self, index, value) .into(); output }, ) .overwrite_script_function( - "splat", - |v: bool| { - let output: Val = ::bevy::math::BVec4::splat( - v.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec4::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "from_array", - |a: [bool; 4]| { - let output: Val = ::bevy::math::BVec4::from_array( - a.into(), + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::BVec4::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::BVec4::assert_receiver_is_total_eq( + &_self, ) .into(); output }, - ) - .overwrite_script_function( - "bitmask", - |_self: Val| { - let output: u32 = ::bevy::math::BVec4::bitmask(_self.into()).into(); - output - }, - ) + ); + NamespaceBuilder::<::bevy::math::DVec2>::new(world) .overwrite_script_function( - "any", - |_self: Val| { - let output: bool = ::bevy::math::BVec4::any(_self.into()).into(); + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DVec2::neg( + _self.into(), + ) + .into(); output }, ) .overwrite_script_function( - "all", - |_self: Val| { - let output: bool = ::bevy::math::BVec4::all(_self.into()).into(); + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::mul( + _self.into(), + rhs.into(), + ) + .into(); output }, ) .overwrite_script_function( - "test", - |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec4::test( + "sub", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::sub( _self.into(), - index.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "set", - |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4::set( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::div( _self.into(), - index.into(), - value.into(), + rhs, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DVec2>::new(world) + ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::mul( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -13763,19 +13628,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "rem", - |_self: Val, rhs: f64| { + |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::rem( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::add( + let output: Val = ::bevy::math::DVec2::div( _self.into(), rhs.into(), ) @@ -13786,10 +13651,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64| { - let output: Val = ::bevy::math::DVec2::new( - x.into(), - y.into(), - ) + let output: Val = ::bevy::math::DVec2::new(x, y) .into(); output }, @@ -13797,9 +13659,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = ::bevy::math::DVec2::splat( - v.into(), - ) + let output: Val = ::bevy::math::DVec2::splat(v) .into(); output }, @@ -13824,7 +13684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [f64; 2]| { let output: Val = ::bevy::math::DVec2::from_array( - a.into(), + a, ) .into(); output @@ -13833,8 +13693,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 2] = ::bevy::math::DVec2::to_array(_self.into()) - .into(); + let output: [f64; 2] = ::bevy::math::DVec2::to_array(&_self).into(); output }, ) @@ -13843,7 +13702,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: f64| { let output: Val = ::bevy::math::DVec2::extend( _self.into(), - z.into(), + z, ) .into(); output @@ -13854,7 +13713,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: f64| { let output: Val = ::bevy::math::DVec2::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -13865,7 +13724,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: f64| { let output: Val = ::bevy::math::DVec2::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -14327,7 +14186,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f64| { let output: Val = ::bevy::math::DVec2::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -14349,7 +14208,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DVec2::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -14359,9 +14218,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f64| { let output: Val = ::bevy::math::DVec2::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -14388,7 +14247,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::DVec2::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -14399,8 +14258,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f64, max: f64| { let output: Val = ::bevy::math::DVec2::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -14411,7 +14270,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f64| { let output: Val = ::bevy::math::DVec2::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -14422,7 +14281,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f64| { let output: Val = ::bevy::math::DVec2::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -14465,7 +14324,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DVec2::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -14475,7 +14334,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f64| { let output: Val = ::bevy::math::DVec2::from_angle( - angle.into(), + angle, ) .into(); output @@ -14550,9 +14409,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_angle: f64| { let output: Val = ::bevy::math::DVec2::rotate_towards( - _self.into(), + &_self, rhs.into(), - max_angle.into(), + max_angle, ) .into(); output @@ -14562,7 +14421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec2", |_self: Ref| { let output: Val = ::bevy::math::DVec2::as_vec2( - _self.into(), + &_self, ) .into(); output @@ -14572,7 +14431,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_ivec2", |_self: Ref| { let output: Val = ::bevy::math::DVec2::as_ivec2( - _self.into(), + &_self, ) .into(); output @@ -14582,7 +14441,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_uvec2", |_self: Ref| { let output: Val = ::bevy::math::DVec2::as_uvec2( - _self.into(), + &_self, ) .into(); output @@ -14592,7 +14451,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_i64vec2", |_self: Ref| { let output: Val = ::bevy::math::DVec2::as_i64vec2( - _self.into(), + &_self, ) .into(); output @@ -14602,29 +14461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_u64vec2", |_self: Ref| { let output: Val = ::bevy::math::DVec2::as_u64vec2( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), + &_self, ) .into(); output @@ -14635,18 +14472,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::mul( _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -14654,7 +14480,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "sub", - |_self: Val, rhs: f64| { + |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::sub( _self.into(), rhs.into(), @@ -14663,75 +14489,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DVec2::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec2::eq( - _self.into(), - other.into(), - ) - .into(); + let output: bool = ::bevy::math::DVec2::eq(&_self, &other).into(); output }, ) .overwrite_script_function( "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::mul( + let output: Val = ::bevy::math::DVec2::rem( _self.into(), rhs.into(), ) @@ -14741,10 +14509,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "add", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec2::add( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -14754,41 +14522,18 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::DVec2::clone( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "div", + "rem", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::DVec3>::new(world) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::sub( + let output: Val = ::bevy::math::DVec2::rem( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -14796,19 +14541,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "add", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::div( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec2::add( _self.into(), rhs.into(), ) @@ -14817,32 +14551,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DVec3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec3::eq( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec2::mul( _self.into(), - other.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::rem( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -14850,43 +14574,32 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::sub( + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec2::add( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::DVec3>::new(world) .overwrite_script_function( - "add", + "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::add( + let output: Val = ::bevy::math::DVec3::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::mul( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DVec3::neg( _self.into(), - rhs.into(), ) .into(); output @@ -14894,19 +14607,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "div", - |_self: Val, rhs: Ref| { + |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::rem( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::mul( _self.into(), rhs.into(), ) @@ -14915,11 +14628,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::rem( + "sub", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output @@ -14929,9 +14642,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: f64, y: f64, z: f64| { let output: Val = ::bevy::math::DVec3::new( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -14940,9 +14653,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = ::bevy::math::DVec3::splat( - v.into(), - ) + let output: Val = ::bevy::math::DVec3::splat(v) .into(); output }, @@ -14967,7 +14678,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [f64; 3]| { let output: Val = ::bevy::math::DVec3::from_array( - a.into(), + a, ) .into(); output @@ -14976,8 +14687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 3] = ::bevy::math::DVec3::to_array(_self.into()) - .into(); + let output: [f64; 3] = ::bevy::math::DVec3::to_array(&_self).into(); output }, ) @@ -14986,7 +14696,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: f64| { let output: Val = ::bevy::math::DVec3::extend( _self.into(), - w.into(), + w, ) .into(); output @@ -15007,7 +14717,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: f64| { let output: Val = ::bevy::math::DVec3::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -15018,7 +14728,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: f64| { let output: Val = ::bevy::math::DVec3::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -15029,7 +14739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: f64| { let output: Val = ::bevy::math::DVec3::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -15502,7 +15212,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f64| { let output: Val = ::bevy::math::DVec3::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -15524,7 +15234,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DVec3::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -15534,9 +15244,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f64| { let output: Val = ::bevy::math::DVec3::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -15563,7 +15273,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::DVec3::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -15574,8 +15284,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f64, max: f64| { let output: Val = ::bevy::math::DVec3::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -15586,7 +15296,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f64| { let output: Val = ::bevy::math::DVec3::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -15597,7 +15307,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f64| { let output: Val = ::bevy::math::DVec3::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -15640,7 +15350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DVec3::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -15651,96 +15361,341 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec3::angle_between( _self.into(), - rhs.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthogonal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::any_orthogonal_vector( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "any_orthonormal_vector", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::any_orthonormal_vector( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_vec3( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_vec3a", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_vec3a( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_ivec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_ivec3( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_uvec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_uvec3( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_i64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_i64vec3( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "as_u64vec3", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::as_u64vec3( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::div( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::DVec3::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::sub( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + &rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec3::mul( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::rem( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec3::add( + _self.into(), + rhs.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DVec3::clone( + &_self, + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DVec4>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::DVec4::eq(&_self, &other).into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::mul( + _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "any_orthogonal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::any_orthogonal_vector( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::add( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "any_orthonormal_vector", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::any_orthonormal_vector( + "sub", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::sub( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "as_vec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_vec3( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::div( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "as_vec3a", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_vec3a( + "div", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::div( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "as_ivec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_ivec3( + "rem", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::rem( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "as_uvec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_uvec3( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::mul( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "as_i64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_i64vec3( + "rem", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DVec4::rem( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "as_u64vec3", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_u64vec3( + "add", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::add( _self.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::mul( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::sub( _self.into(), rhs.into(), ) @@ -15750,53 +15705,53 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DVec3::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::clone( + &_self, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::mul( + "div", + |_self: Val, rhs: Ref| { + let output: Val = ::bevy::math::DVec4::div( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::sub( + "rem", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::rem( _self.into(), rhs.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DVec4>::new(world) + ) .overwrite_script_function( - "rem", + "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::rem( + let output: Val = ::bevy::math::DVec4::sub( _self.into(), - rhs.into(), + &rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::clone( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DVec4::mul( _self.into(), + rhs.into(), ) .into(); output @@ -15816,10 +15771,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: f64, y: f64, z: f64, w: f64| { let output: Val = ::bevy::math::DVec4::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -15828,9 +15783,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = ::bevy::math::DVec4::splat( - v.into(), - ) + let output: Val = ::bevy::math::DVec4::splat(v) .into(); output }, @@ -15855,7 +15808,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [f64; 4]| { let output: Val = ::bevy::math::DVec4::from_array( - a.into(), + a, ) .into(); output @@ -15864,8 +15817,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DVec4::to_array(_self.into()) - .into(); + let output: [f64; 4] = ::bevy::math::DVec4::to_array(&_self).into(); output }, ) @@ -15884,7 +15836,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, x: f64| { let output: Val = ::bevy::math::DVec4::with_x( _self.into(), - x.into(), + x, ) .into(); output @@ -15895,7 +15847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, y: f64| { let output: Val = ::bevy::math::DVec4::with_y( _self.into(), - y.into(), + y, ) .into(); output @@ -15906,7 +15858,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, z: f64| { let output: Val = ::bevy::math::DVec4::with_z( _self.into(), - z.into(), + z, ) .into(); output @@ -15917,7 +15869,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, w: f64| { let output: Val = ::bevy::math::DVec4::with_w( _self.into(), - w.into(), + w, ) .into(); output @@ -16379,7 +16331,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, n: f64| { let output: Val = ::bevy::math::DVec4::powf( _self.into(), - n.into(), + n, ) .into(); output @@ -16401,7 +16353,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DVec4::lerp( _self.into(), rhs.into(), - s.into(), + s, ) .into(); output @@ -16411,9 +16363,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "move_towards", |_self: Ref, rhs: Val, d: f64| { let output: Val = ::bevy::math::DVec4::move_towards( - _self.into(), + &_self, rhs.into(), - d.into(), + d, ) .into(); output @@ -16440,7 +16392,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::DVec4::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -16451,8 +16403,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f64, max: f64| { let output: Val = ::bevy::math::DVec4::clamp_length( _self.into(), - min.into(), - max.into(), + min, + max, ) .into(); output @@ -16463,7 +16415,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, max: f64| { let output: Val = ::bevy::math::DVec4::clamp_length_max( _self.into(), - max.into(), + max, ) .into(); output @@ -16474,7 +16426,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, min: f64| { let output: Val = ::bevy::math::DVec4::clamp_length_min( _self.into(), - min.into(), + min, ) .into(); output @@ -16517,7 +16469,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DVec4::refract( _self.into(), normal.into(), - eta.into(), + eta, ) .into(); output @@ -16527,212 +16479,58 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_vec4", |_self: Ref| { let output: Val = ::bevy::math::DVec4::as_vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_ivec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_ivec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_uvec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_uvec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_i64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_i64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_u64vec4", - |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_u64vec4( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec4::eq( - _self.into(), - other.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "rem", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into(), - rhs.into(), + &_self, ) .into(); output }, ) - .overwrite_script_function( - "add", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), + .overwrite_script_function( + "as_ivec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_ivec4( + &_self, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), + "as_uvec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_uvec4( + &_self, ) .into(); output }, ) .overwrite_script_function( - "rem", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into(), - rhs.into(), + "as_i64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_i64vec4( + &_self, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), + "as_u64vec4", + |_self: Ref| { + let output: Val = ::bevy::math::DVec4::as_u64vec4( + &_self, ) .into(); output }, ) .overwrite_script_function( - "mul", + "add", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::mul( + let output: Val = ::bevy::math::DVec4::add( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -16740,9 +16538,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::Mat2>::new(world) .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat2::div( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::mul( _self.into(), rhs.into(), ) @@ -16751,28 +16549,22 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat2::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat2::neg( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat2::div( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat2::clone( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::sub( _self.into(), + rhs.into(), ) .into(); output @@ -16792,9 +16584,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Mat2::to_cols_array( - _self.into(), - ) + let output: [f32; 4] = ::bevy::math::Mat2::to_cols_array(&_self) .into(); output }, @@ -16803,7 +16593,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f32; 2]; 2] = ::bevy::math::Mat2::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -16824,7 +16614,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |scale: Val, angle: f32| { let output: Val = ::bevy::math::Mat2::from_scale_angle( scale.into(), - angle.into(), + angle, ) .into(); output @@ -16834,7 +16624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f32| { let output: Val = ::bevy::math::Mat2::from_angle( - angle.into(), + angle, ) .into(); output @@ -16855,8 +16645,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat2::from_mat3_minor( m.into(), - i.into(), - j.into(), + i, + j, ) .into(); output @@ -16877,8 +16667,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat2::from_mat3a_minor( m.into(), - i.into(), - j.into(), + i, + j, ) .into(); output @@ -16888,8 +16678,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat2::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -16899,8 +16689,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat2::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -16909,15 +16699,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat2::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::Mat2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat2::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Mat2::is_nan(&_self).into(); output }, ) @@ -16925,7 +16714,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::Mat2::transpose( - _self.into(), + &_self, ) .into(); output @@ -16934,8 +16723,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat2::determinant(_self.into()) - .into(); + let output: f32 = ::bevy::math::Mat2::determinant(&_self).into(); output }, ) @@ -16943,7 +16731,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Mat2::inverse( - _self.into(), + &_self, ) .into(); output @@ -16953,7 +16741,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat2::mul_vec2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -16964,8 +16752,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_mat2", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat2::mul_mat2( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -16975,8 +16763,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add_mat2", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat2::add_mat2( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -16986,8 +16774,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub_mat2", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat2::sub_mat2( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -16997,8 +16785,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat2::mul_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -17008,8 +16796,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat2::div_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -17023,9 +16811,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Mat2::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -17034,9 +16822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat2::abs( - _self.into(), - ) + let output: Val = ::bevy::math::Mat2::abs(&_self) .into(); output }, @@ -17045,27 +16831,23 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dmat2", |_self: Ref| { let output: Val = ::bevy::math::Mat2::as_dmat2( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::sub( - _self.into(), - rhs.into(), - ) - .into(); + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat2::eq(&_self, &rhs).into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat2::add( _self.into(), rhs.into(), ) @@ -17074,11 +16856,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat2::neg( _self.into(), - rhs.into(), ) .into(); output @@ -17089,35 +16870,32 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat2::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", + "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::add( + let output: Val = ::bevy::math::Mat2::mul( _self.into(), rhs.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Mat3>::new(world) + ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat2::clone(&_self) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::Mat3>::new(world) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { @@ -17130,9 +16908,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", + "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( + let output: Val = ::bevy::math::Mat3::add( _self.into(), rhs.into(), ) @@ -17142,29 +16920,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat3::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::add( + let output: Val = ::bevy::math::Mat3::mul( _self.into(), rhs.into(), ) @@ -17172,16 +16929,6 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "from_cols", | @@ -17201,9 +16948,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = ::bevy::math::Mat3::to_cols_array( - _self.into(), - ) + let output: [f32; 9] = ::bevy::math::Mat3::to_cols_array(&_self) .into(); output }, @@ -17212,7 +16957,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f32; 3]; 3] = ::bevy::math::Mat3::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -17243,8 +16988,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat3::from_mat4_minor( m.into(), - i.into(), - j.into(), + i, + j, ) .into(); output @@ -17265,7 +17010,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f32| { let output: Val = ::bevy::math::Mat3::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -17276,9 +17021,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |order: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Mat3::from_euler( order.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -17288,7 +17033,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Ref, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Mat3::to_euler( - _self.into(), + &_self, order.into(), ) .into(); @@ -17299,7 +17044,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f32| { let output: Val = ::bevy::math::Mat3::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -17309,7 +17054,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f32| { let output: Val = ::bevy::math::Mat3::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -17319,7 +17064,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f32| { let output: Val = ::bevy::math::Mat3::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -17339,7 +17084,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f32| { let output: Val = ::bevy::math::Mat3::from_angle( - angle.into(), + angle, ) .into(); output @@ -17354,7 +17099,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::Mat3::from_scale_angle_translation( scale.into(), - angle.into(), + angle, translation.into(), ) .into(); @@ -17385,8 +17130,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat3::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -17396,8 +17141,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat3::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -17406,15 +17151,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat3::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::Mat3::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat3::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Mat3::is_nan(&_self).into(); output }, ) @@ -17422,7 +17166,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::Mat3::transpose( - _self.into(), + &_self, ) .into(); output @@ -17431,8 +17175,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat3::determinant(_self.into()) - .into(); + let output: f32 = ::bevy::math::Mat3::determinant(&_self).into(); output }, ) @@ -17440,7 +17183,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Mat3::inverse( - _self.into(), + &_self, ) .into(); output @@ -17450,7 +17193,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::transform_point2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -17461,7 +17204,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::transform_vector2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -17472,7 +17215,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul_vec3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -17483,7 +17226,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul_vec3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -17494,8 +17237,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat3::mul_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -17505,8 +17248,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat3::add_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -17516,8 +17259,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat3::sub_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -17527,8 +17270,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat3::mul_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -17538,8 +17281,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat3::div_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -17553,9 +17296,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Mat3::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -17564,9 +17307,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat3::abs( - _self.into(), - ) + let output: Val = ::bevy::math::Mat3::abs(&_self) .into(); output }, @@ -17575,18 +17316,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dmat3", |_self: Ref| { let output: Val = ::bevy::math::Mat3::as_dmat3( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), + &_self, ) .into(); output @@ -17595,38 +17325,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat3::eq(_self.into(), rhs.into()) - .into(); + let output: bool = ::bevy::math::Mat3::eq(&_self, &rhs).into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3::div( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat3::neg( _self.into(), - rhs.into(), ) .into(); output }, ) - .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::sub( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ); - NamespaceBuilder::<::bevy::math::Mat3A>::new(world) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul( _self.into(), rhs.into(), ) @@ -17636,39 +17352,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat3A::neg( - _self.into(), - ) + |_self: Ref| { + let output: Val = ::bevy::math::Mat3::clone(&_self) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::add( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::sub( _self.into(), rhs.into(), ) @@ -17678,8 +17371,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3::mul( _self.into(), rhs.into(), ) @@ -17688,39 +17381,50 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat3A::eq(_self.into(), rhs.into()) + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3::mul( + _self.into(), + rhs, + ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::mul( + "div", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::Mat3A>::new(world) .overwrite_script_function( "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat3A::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat3A::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( _self.into(), rhs.into(), ) @@ -17739,6 +17443,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat3A::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "from_cols", | @@ -17758,9 +17472,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = ::bevy::math::Mat3A::to_cols_array( - _self.into(), - ) + let output: [f32; 9] = ::bevy::math::Mat3A::to_cols_array(&_self) .into(); output }, @@ -17769,7 +17481,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f32; 3]; 3] = ::bevy::math::Mat3A::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -17800,8 +17512,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat3A::from_mat4_minor( m.into(), - i.into(), - j.into(), + i, + j, ) .into(); output @@ -17822,7 +17534,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f32| { let output: Val = ::bevy::math::Mat3A::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -17833,9 +17545,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |order: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Mat3A::from_euler( order.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -17845,7 +17557,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Ref, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Mat3A::to_euler( - _self.into(), + &_self, order.into(), ) .into(); @@ -17856,7 +17568,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f32| { let output: Val = ::bevy::math::Mat3A::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -17866,7 +17578,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f32| { let output: Val = ::bevy::math::Mat3A::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -17876,7 +17588,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f32| { let output: Val = ::bevy::math::Mat3A::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -17896,7 +17608,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f32| { let output: Val = ::bevy::math::Mat3A::from_angle( - angle.into(), + angle, ) .into(); output @@ -17911,7 +17623,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::Mat3A::from_scale_angle_translation( scale.into(), - angle.into(), + angle, translation.into(), ) .into(); @@ -17942,8 +17654,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat3A::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -17953,8 +17665,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat3A::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -17963,15 +17675,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat3A::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::Mat3A::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat3A::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Mat3A::is_nan(&_self).into(); output }, ) @@ -17979,7 +17690,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::Mat3A::transpose( - _self.into(), + &_self, ) .into(); output @@ -17988,8 +17699,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat3A::determinant(_self.into()) - .into(); + let output: f32 = ::bevy::math::Mat3A::determinant(&_self).into(); output }, ) @@ -17997,7 +17707,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Mat3A::inverse( - _self.into(), + &_self, ) .into(); output @@ -18007,7 +17717,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::transform_point2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18018,7 +17728,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::transform_vector2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18029,7 +17739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul_vec3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18040,7 +17750,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul_vec3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18051,8 +17761,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat3A::mul_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -18062,8 +17772,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat3A::add_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -18073,8 +17783,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat3A::sub_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -18084,8 +17794,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat3A::mul_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -18095,8 +17805,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat3A::div_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -18110,9 +17820,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Mat3A::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -18121,9 +17831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::abs( - _self.into(), - ) + let output: Val = ::bevy::math::Mat3A::abs(&_self) .into(); output }, @@ -18132,37 +17840,38 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dmat3", |_self: Ref| { let output: Val = ::bevy::math::Mat3A::as_dmat3( - _self.into(), + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Mat4>::new(world) + ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::Mat4::neg( + "mul", + |_self: Val, rhs: f32| { + let output: Val = ::bevy::math::Mat3A::mul( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Mat4::clone( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( _self.into(), + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::add( _self.into(), rhs.into(), ) @@ -18170,10 +17879,20 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat3A::neg( + _self.into(), + ) + .into(); + output + }, + ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( _self.into(), rhs.into(), ) @@ -18182,20 +17901,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::add( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat3A::mul( _self.into(), rhs.into(), ) .into(); output }, + ); + NamespaceBuilder::<::bevy::math::Mat4>::new(world) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Mat4::eq(&_self, &rhs).into(); + output + }, ) .overwrite_script_function( "mul", - |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat4::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul( _self.into(), rhs.into(), ) @@ -18204,9 +17931,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat4::eq(_self.into(), rhs.into()) + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul( + _self.into(), + rhs.into(), + ) .into(); output }, @@ -18226,6 +17956,27 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat4::div( + _self.into(), + rhs, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::Mat4::neg( + _self.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::mul( _self.into(), rhs.into(), ) @@ -18233,6 +17984,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Mat4::clone(&_self) + .into(); + output + }, + ) .overwrite_script_function( "from_cols", | @@ -18254,9 +18013,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 16] = ::bevy::math::Mat4::to_cols_array( - _self.into(), - ) + let output: [f32; 16] = ::bevy::math::Mat4::to_cols_array(&_self) .into(); output }, @@ -18265,7 +18022,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f32; 4]; 4] = ::bevy::math::Mat4::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -18353,7 +18110,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f32| { let output: Val = ::bevy::math::Mat4::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -18364,9 +18121,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |order: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Mat4::from_euler( order.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -18376,7 +18133,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Ref, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Mat4::to_euler( - _self.into(), + &_self, order.into(), ) .into(); @@ -18387,7 +18144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f32| { let output: Val = ::bevy::math::Mat4::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -18397,7 +18154,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f32| { let output: Val = ::bevy::math::Mat4::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -18407,7 +18164,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f32| { let output: Val = ::bevy::math::Mat4::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -18427,8 +18184,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat4::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -18438,8 +18195,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::Mat4::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -18448,15 +18205,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat4::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::Mat4::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat4::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Mat4::is_nan(&_self).into(); output }, ) @@ -18464,7 +18220,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::Mat4::transpose( - _self.into(), + &_self, ) .into(); output @@ -18473,8 +18229,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat4::determinant(_self.into()) - .into(); + let output: f32 = ::bevy::math::Mat4::determinant(&_self).into(); output }, ) @@ -18482,7 +18237,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Mat4::inverse( - _self.into(), + &_self, ) .into(); output @@ -18556,10 +18311,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_rh_gl", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { let output: Val = ::bevy::math::Mat4::perspective_rh_gl( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), + fov_y_radians, + aspect_ratio, + z_near, + z_far, ) .into(); output @@ -18569,10 +18324,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { let output: Val = ::bevy::math::Mat4::perspective_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), + fov_y_radians, + aspect_ratio, + z_near, + z_far, ) .into(); output @@ -18582,10 +18337,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { let output: Val = ::bevy::math::Mat4::perspective_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), + fov_y_radians, + aspect_ratio, + z_near, + z_far, ) .into(); output @@ -18595,9 +18350,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = ::bevy::math::Mat4::perspective_infinite_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -18607,9 +18362,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_reverse_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -18619,9 +18374,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = ::bevy::math::Mat4::perspective_infinite_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -18631,9 +18386,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_reverse_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -18643,12 +18398,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "orthographic_rh_gl", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { let output: Val = ::bevy::math::Mat4::orthographic_rh_gl( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), + left, + right, + bottom, + top, + near, + far, ) .into(); output @@ -18658,12 +18413,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "orthographic_lh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { let output: Val = ::bevy::math::Mat4::orthographic_lh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), + left, + right, + bottom, + top, + near, + far, ) .into(); output @@ -18673,12 +18428,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "orthographic_rh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { let output: Val = ::bevy::math::Mat4::orthographic_rh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), + left, + right, + bottom, + top, + near, + far, ) .into(); output @@ -18688,7 +18443,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_point3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::project_point3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18699,7 +18454,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_point3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18710,7 +18465,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_vector3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18721,7 +18476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_point3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::project_point3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18732,7 +18487,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_point3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18743,7 +18498,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_vector3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18754,7 +18509,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec4", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::mul_vec4( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -18765,8 +18520,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_mat4", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat4::mul_mat4( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -18776,8 +18531,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add_mat4", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat4::add_mat4( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -18787,8 +18542,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub_mat4", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::Mat4::sub_mat4( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -18798,8 +18553,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat4::mul_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -18809,8 +18564,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_scalar", |_self: Ref, rhs: f32| { let output: Val = ::bevy::math::Mat4::div_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -18824,9 +18579,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Mat4::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -18835,9 +18590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat4::abs( - _self.into(), - ) + let output: Val = ::bevy::math::Mat4::abs(&_self) .into(); output }, @@ -18846,7 +18599,18 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dmat4", |_self: Ref| { let output: Val = ::bevy::math::Mat4::as_dmat4( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Mat4::add( _self.into(), + rhs.into(), ) .into(); output @@ -18854,10 +18618,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { + |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat4::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -18865,38 +18629,41 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::DMat2>::new(world) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat2::eq(_self.into(), rhs.into()) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DMat2::clone( + &_self, + ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DMat2::clone( + "mul", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat2::mul( _self.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::add( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat2::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::sub( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::mul( _self.into(), rhs.into(), ) @@ -18905,9 +18672,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "mul", + "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul( + let output: Val = ::bevy::math::DMat2::add( _self.into(), rhs.into(), ) @@ -18916,10 +18683,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DMat2::neg( + "sub", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::sub( _self.into(), + rhs.into(), ) .into(); output @@ -18927,8 +18695,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat2::mul( _self.into(), rhs.into(), ) @@ -18936,6 +18704,13 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DMat2::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { @@ -18950,9 +18725,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DMat2::to_cols_array( - _self.into(), - ) + let output: [f64; 4] = ::bevy::math::DMat2::to_cols_array(&_self) .into(); output }, @@ -18961,7 +18734,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f64; 2]; 2] = ::bevy::math::DMat2::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -18982,7 +18755,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |scale: Val, angle: f64| { let output: Val = ::bevy::math::DMat2::from_scale_angle( scale.into(), - angle.into(), + angle, ) .into(); output @@ -18992,7 +18765,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f64| { let output: Val = ::bevy::math::DMat2::from_angle( - angle.into(), + angle, ) .into(); output @@ -19013,8 +18786,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::DMat2::from_mat3_minor( m.into(), - i.into(), - j.into(), + i, + j, ) .into(); output @@ -19024,8 +18797,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::DMat2::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -19035,8 +18808,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::DMat2::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -19045,15 +18818,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DMat2::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::DMat2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DMat2::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DMat2::is_nan(&_self).into(); output }, ) @@ -19061,7 +18833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::DMat2::transpose( - _self.into(), + &_self, ) .into(); output @@ -19070,8 +18842,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = ::bevy::math::DMat2::determinant(_self.into()) - .into(); + let output: f64 = ::bevy::math::DMat2::determinant(&_self).into(); output }, ) @@ -19079,7 +18850,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::DMat2::inverse( - _self.into(), + &_self, ) .into(); output @@ -19089,7 +18860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat2::mul_vec2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -19100,8 +18871,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_mat2", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::DMat2::mul_mat2( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -19111,8 +18882,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add_mat2", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::DMat2::add_mat2( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -19122,8 +18893,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub_mat2", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::DMat2::sub_mat2( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -19133,8 +18904,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_scalar", |_self: Ref, rhs: f64| { let output: Val = ::bevy::math::DMat2::mul_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -19144,8 +18915,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_scalar", |_self: Ref, rhs: f64| { let output: Val = ::bevy::math::DMat2::div_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -19159,9 +18930,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DMat2::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -19170,9 +18941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::DMat2::abs( - _self.into(), - ) + let output: Val = ::bevy::math::DMat2::abs(&_self) .into(); output }, @@ -19181,39 +18950,48 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_mat2", |_self: Ref| { let output: Val = ::bevy::math::DMat2::as_mat2( - _self.into(), + &_self, ) .into(); output }, ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DMat2::neg( + _self.into(), + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DMat3>::new(world) .overwrite_script_function( "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat2::mul( + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat3::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat2::div( - _self.into(), - rhs.into(), + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DMat3::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DMat3>::new(world) + ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::add( _self.into(), rhs.into(), ) @@ -19233,9 +19011,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "add", + "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::add( + let output: Val = ::bevy::math::DMat3::sub( _self.into(), rhs.into(), ) @@ -19262,9 +19040,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 9] = ::bevy::math::DMat3::to_cols_array( - _self.into(), - ) + let output: [f64; 9] = ::bevy::math::DMat3::to_cols_array(&_self) .into(); output }, @@ -19273,7 +19049,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f64; 3]; 3] = ::bevy::math::DMat3::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -19304,8 +19080,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::DMat3::from_mat4_minor( m.into(), - i.into(), - j.into(), + i, + j, ) .into(); output @@ -19326,7 +19102,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f64| { let output: Val = ::bevy::math::DMat3::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -19337,9 +19113,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |order: Val, a: f64, b: f64, c: f64| { let output: Val = ::bevy::math::DMat3::from_euler( order.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -19349,7 +19125,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Ref, order: Val| { let output: (f64, f64, f64) = ::bevy::math::DMat3::to_euler( - _self.into(), + &_self, order.into(), ) .into(); @@ -19360,7 +19136,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f64| { let output: Val = ::bevy::math::DMat3::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -19370,7 +19146,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f64| { let output: Val = ::bevy::math::DMat3::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -19380,7 +19156,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f64| { let output: Val = ::bevy::math::DMat3::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -19400,7 +19176,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f64| { let output: Val = ::bevy::math::DMat3::from_angle( - angle.into(), + angle, ) .into(); output @@ -19415,7 +19191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::DMat3::from_scale_angle_translation( scale.into(), - angle.into(), + angle, translation.into(), ) .into(); @@ -19446,8 +19222,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::DMat3::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -19457,8 +19233,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::DMat3::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -19467,15 +19243,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DMat3::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::DMat3::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DMat3::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DMat3::is_nan(&_self).into(); output }, ) @@ -19483,7 +19258,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::DMat3::transpose( - _self.into(), + &_self, ) .into(); output @@ -19492,8 +19267,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = ::bevy::math::DMat3::determinant(_self.into()) - .into(); + let output: f64 = ::bevy::math::DMat3::determinant(&_self).into(); output }, ) @@ -19501,7 +19275,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::DMat3::inverse( - _self.into(), + &_self, ) .into(); output @@ -19511,7 +19285,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat3::transform_point2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -19522,7 +19296,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat3::transform_vector2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -19533,7 +19307,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat3::mul_vec3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -19544,8 +19318,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::DMat3::mul_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -19555,8 +19329,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::DMat3::add_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -19566,8 +19340,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub_mat3", |_self: Ref, rhs: Ref| { let output: Val = ::bevy::math::DMat3::sub_mat3( - _self.into(), - rhs.into(), + &_self, + &rhs, ) .into(); output @@ -19577,8 +19351,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_scalar", |_self: Ref, rhs: f64| { let output: Val = ::bevy::math::DMat3::mul_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -19588,8 +19362,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_scalar", |_self: Ref, rhs: f64| { let output: Val = ::bevy::math::DMat3::div_scalar( - _self.into(), - rhs.into(), + &_self, + rhs, ) .into(); output @@ -19603,9 +19377,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DMat3::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -19614,9 +19388,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::DMat3::abs( - _self.into(), - ) + let output: Val = ::bevy::math::DMat3::abs(&_self) .into(); output }, @@ -19625,25 +19397,29 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_mat3", |_self: Ref| { let output: Val = ::bevy::math::DMat3::as_mat3( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat3::eq(_self.into(), rhs.into()) + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat3::div( + _self.into(), + rhs, + ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DMat3::clone( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat3::mul( _self.into(), + rhs.into(), ) .into(); output @@ -19651,7 +19427,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: f64| { + |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat3::mul( _self.into(), rhs.into(), @@ -19660,6 +19436,13 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DMat3::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "neg", |_self: Val| { @@ -19669,11 +19452,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::DMat4>::new(world) .overwrite_script_function( "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::sub( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::sub( _self.into(), rhs.into(), ) @@ -19683,8 +19467,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul( _self.into(), rhs.into(), ) @@ -19693,23 +19477,39 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat3::div( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul( _self.into(), rhs.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DMat4>::new(world) + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::clone( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DMat4::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat4::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -19717,8 +19517,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::mul( _self.into(), rhs.into(), ) @@ -19747,9 +19547,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 16] = ::bevy::math::DMat4::to_cols_array( - _self.into(), - ) + let output: [f64; 16] = ::bevy::math::DMat4::to_cols_array(&_self) .into(); output }, @@ -19758,7 +19556,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f64; 4]; 4] = ::bevy::math::DMat4::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -19836,7 +19634,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f64| { let output: Val = ::bevy::math::DMat4::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -19847,9 +19645,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |order: Val, a: f64, b: f64, c: f64| { let output: Val = ::bevy::math::DMat4::from_euler( order.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -19859,7 +19657,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Ref, order: Val| { let output: (f64, f64, f64) = ::bevy::math::DMat4::to_euler( - _self.into(), + &_self, order.into(), ) .into(); @@ -19870,7 +19668,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f64| { let output: Val = ::bevy::math::DMat4::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -19880,7 +19678,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f64| { let output: Val = ::bevy::math::DMat4::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -19890,7 +19688,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f64| { let output: Val = ::bevy::math::DMat4::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -19910,8 +19708,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "col", |_self: Ref, index: usize| { let output: Val = ::bevy::math::DMat4::col( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -19921,8 +19719,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "row", |_self: Ref, index: usize| { let output: Val = ::bevy::math::DMat4::row( - _self.into(), - index.into(), + &_self, + index, ) .into(); output @@ -19931,15 +19729,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DMat4::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::DMat4::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DMat4::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DMat4::is_nan(&_self).into(); output }, ) @@ -19947,7 +19744,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transpose", |_self: Ref| { let output: Val = ::bevy::math::DMat4::transpose( - _self.into(), + &_self, ) .into(); output @@ -19956,8 +19753,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = ::bevy::math::DMat4::determinant(_self.into()) - .into(); + let output: f64 = ::bevy::math::DMat4::determinant(&_self).into(); output }, ) @@ -19965,7 +19761,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::DMat4::inverse( - _self.into(), + &_self, ) .into(); output @@ -20039,10 +19835,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_rh_gl", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { let output: Val = ::bevy::math::DMat4::perspective_rh_gl( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), + fov_y_radians, + aspect_ratio, + z_near, + z_far, ) .into(); output @@ -20052,10 +19848,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { let output: Val = ::bevy::math::DMat4::perspective_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), + fov_y_radians, + aspect_ratio, + z_near, + z_far, ) .into(); output @@ -20065,10 +19861,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { let output: Val = ::bevy::math::DMat4::perspective_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), - z_far.into(), + fov_y_radians, + aspect_ratio, + z_near, + z_far, ) .into(); output @@ -20078,9 +19874,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = ::bevy::math::DMat4::perspective_infinite_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -20090,9 +19886,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_reverse_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_lh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -20102,9 +19898,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = ::bevy::math::DMat4::perspective_infinite_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -20114,9 +19910,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perspective_infinite_reverse_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_rh( - fov_y_radians.into(), - aspect_ratio.into(), - z_near.into(), + fov_y_radians, + aspect_ratio, + z_near, ) .into(); output @@ -20126,12 +19922,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "orthographic_rh_gl", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { let output: Val = ::bevy::math::DMat4::orthographic_rh_gl( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), + left, + right, + bottom, + top, + near, + far, ) .into(); output @@ -20141,12 +19937,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "orthographic_lh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { let output: Val = ::bevy::math::DMat4::orthographic_lh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), + left, + right, + bottom, + top, + near, + far, ) .into(); output @@ -20156,12 +19952,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "orthographic_rh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { let output: Val = ::bevy::math::DMat4::orthographic_rh( - left.into(), - right.into(), - bottom.into(), - top.into(), - near.into(), - far.into(), + left, + right, + bottom, + top, + near, + far, ) .into(); output @@ -20171,7 +19967,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_point3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::project_point3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20182,7 +19978,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::transform_point3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20193,7 +19989,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::transform_vector3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20203,221 +19999,136 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul_vec4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::mul_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::add_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "sub_mat4", - |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::sub_mat4( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat4::mul_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "div_scalar", - |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat4::div_scalar( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs_diff_eq", - | - _self: Ref, - rhs: Val, - max_abs_diff: f64| - { - let output: bool = ::bevy::math::DMat4::abs_diff_eq( - _self.into(), - rhs.into(), - max_abs_diff.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "abs", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::abs( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "as_mat4", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::as_mat4( - _self.into(), + let output: Val = ::bevy::math::DMat4::mul_vec4( + &_self, + rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DMat4::neg( - _self.into(), + "mul_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat4::mul_mat4( + &_self, + &rhs, ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DMat4::clone( - _self.into(), + "add_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat4::add_mat4( + &_self, + &rhs, ) .into(); output }, ) .overwrite_script_function( - "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::sub( - _self.into(), - rhs.into(), + "sub_mat4", + |_self: Ref, rhs: Ref| { + let output: Val = ::bevy::math::DMat4::sub_mat4( + &_self, + &rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), + "mul_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat4::mul_scalar( + &_self, + rhs, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat4::eq(_self.into(), rhs.into()) + "div_scalar", + |_self: Ref, rhs: f64| { + let output: Val = ::bevy::math::DMat4::div_scalar( + &_self, + rhs, + ) .into(); output }, ) .overwrite_script_function( - "add", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::add( - _self.into(), + "abs_diff_eq", + | + _self: Ref, + rhs: Val, + max_abs_diff: f64| + { + let output: bool = ::bevy::math::DMat4::abs_diff_eq( + &_self, rhs.into(), + max_abs_diff, ) .into(); output }, ) .overwrite_script_function( - "div", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat4::div( - _self.into(), - rhs.into(), - ) + "abs", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::abs(&_self) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), + "as_mat4", + |_self: Ref| { + let output: Val = ::bevy::math::DMat4::as_mat4( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Affine2>::new(world) + ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( + "div", + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DMat4::div( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DMat4::neg( _self.into(), - rhs.into(), ) .into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Affine2::clone( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DMat4::add( _self.into(), + rhs.into(), ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::Affine2>::new(world) .overwrite_script_function( "from_cols", | @@ -20437,9 +20148,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 6] = ::bevy::math::Affine2::to_cols_array( - _self.into(), - ) + let output: [f32; 6] = ::bevy::math::Affine2::to_cols_array(&_self) .into(); output }, @@ -20448,7 +20157,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f32; 2]; 3] = ::bevy::math::Affine2::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -20468,7 +20177,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f32| { let output: Val = ::bevy::math::Affine2::from_angle( - angle.into(), + angle, ) .into(); output @@ -20514,7 +20223,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::Affine2::from_scale_angle_translation( scale.into(), - angle.into(), + angle, translation.into(), ) .into(); @@ -20525,7 +20234,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle_translation", |angle: f32, translation: Val| { let output: Val = ::bevy::math::Affine2::from_angle_translation( - angle.into(), + angle, translation.into(), ) .into(); @@ -20556,7 +20265,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine2::transform_point2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20567,7 +20276,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine2::transform_vector2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20577,16 +20286,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Affine2::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::Affine2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Affine2::is_nan(_self.into()) - .into(); + let output: bool = ::bevy::math::Affine2::is_nan(&_self).into(); output }, ) @@ -20598,9 +20305,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Affine2::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -20610,16 +20317,16 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Affine2::inverse( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Affine2::eq( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine2::mul( _self.into(), rhs.into(), ) @@ -20637,12 +20344,11 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, - ); - NamespaceBuilder::<::bevy::math::Affine3A>::new(world) + ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Affine3A::eq( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine2::mul( _self.into(), rhs.into(), ) @@ -20650,16 +20356,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Affine2::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::Affine3A::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::Affine2::clone( + &_self, ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::Affine3A>::new(world) .overwrite_script_function( "from_cols", | @@ -20681,9 +20395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 12] = ::bevy::math::Affine3A::to_cols_array( - _self.into(), - ) + let output: [f32; 12] = ::bevy::math::Affine3A::to_cols_array(&_self) .into(); output }, @@ -20692,7 +20404,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f32; 3]; 4] = ::bevy::math::Affine3A::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -20723,7 +20435,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f32| { let output: Val = ::bevy::math::Affine3A::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -20733,7 +20445,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f32| { let output: Val = ::bevy::math::Affine3A::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -20743,7 +20455,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f32| { let output: Val = ::bevy::math::Affine3A::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -20753,7 +20465,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f32| { let output: Val = ::bevy::math::Affine3A::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -20895,7 +20607,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_point3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20906,7 +20618,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_vector3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20917,7 +20629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_point3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20928,7 +20640,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector3a", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_vector3a( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -20938,16 +20650,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Affine3A::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::Affine3A::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Affine3A::is_nan(_self.into()) - .into(); + let output: bool = ::bevy::math::Affine3A::is_nan(&_self).into(); output }, ) @@ -20959,9 +20669,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Affine3A::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -20971,12 +20681,30 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::Affine3A::inverse( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::Affine3A::mul( _self.into(), + rhs.into(), ) .into(); output }, ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::Affine3A::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { @@ -20988,24 +20716,40 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::Affine3A::clone( + &_self, + ) + .into(); + output + }, + ); + NamespaceBuilder::<::bevy::math::DAffine2>::new(world) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine2::mul( _self.into(), rhs.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DAffine2>::new(world) + ) .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DAffine2::eq( - _self.into(), - rhs.into(), + let output: bool = ::bevy::math::DAffine2::eq(&_self, &rhs).into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DAffine2::clone( + &_self, ) .into(); output @@ -21030,9 +20774,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 6] = ::bevy::math::DAffine2::to_cols_array( - _self.into(), - ) + let output: [f64; 6] = ::bevy::math::DAffine2::to_cols_array(&_self) .into(); output }, @@ -21041,7 +20783,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f64; 2]; 3] = ::bevy::math::DAffine2::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -21061,7 +20803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle", |angle: f64| { let output: Val = ::bevy::math::DAffine2::from_angle( - angle.into(), + angle, ) .into(); output @@ -21107,7 +20849,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::DAffine2::from_scale_angle_translation( scale.into(), - angle.into(), + angle, translation.into(), ) .into(); @@ -21118,7 +20860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_angle_translation", |angle: f64, translation: Val| { let output: Val = ::bevy::math::DAffine2::from_angle_translation( - angle.into(), + angle, translation.into(), ) .into(); @@ -21139,7 +20881,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine2::transform_point2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -21150,7 +20892,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine2::transform_vector2( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -21160,16 +20902,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DAffine2::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::DAffine2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DAffine2::is_nan(_self.into()) - .into(); + let output: bool = ::bevy::math::DAffine2::is_nan(&_self).into(); output }, ) @@ -21181,9 +20921,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DAffine2::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -21193,7 +20933,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::DAffine2::inverse( - _self.into(), + &_self, ) .into(); output @@ -21209,11 +20949,12 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::DAffine3>::new(world) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine3::mul( _self.into(), rhs.into(), ) @@ -21223,15 +20964,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DAffine2::clone( - _self.into(), + |_self: Ref| { + let output: Val = ::bevy::math::DAffine3::clone( + &_self, ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DAffine3>::new(world) + ) + .overwrite_script_function( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DAffine3::eq(&_self, &rhs).into(); + output + }, + ) .overwrite_script_function( "from_cols", | @@ -21253,9 +21000,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 12] = ::bevy::math::DAffine3::to_cols_array( - _self.into(), - ) + let output: [f64; 12] = ::bevy::math::DAffine3::to_cols_array(&_self) .into(); output }, @@ -21264,7 +21009,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_cols_array_2d", |_self: Ref| { let output: [[f64; 3]; 4] = ::bevy::math::DAffine3::to_cols_array_2d( - _self.into(), + &_self, ) .into(); output @@ -21295,7 +21040,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f64| { let output: Val = ::bevy::math::DAffine3::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -21305,7 +21050,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f64| { let output: Val = ::bevy::math::DAffine3::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -21315,7 +21060,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f64| { let output: Val = ::bevy::math::DAffine3::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -21325,7 +21070,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f64| { let output: Val = ::bevy::math::DAffine3::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -21467,7 +21212,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_point3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine3::transform_point3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -21478,7 +21223,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine3::transform_vector3( - _self.into(), + &_self, rhs.into(), ) .into(); @@ -21488,16 +21233,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DAffine3::is_finite(_self.into()) - .into(); + let output: bool = ::bevy::math::DAffine3::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DAffine3::is_nan(_self.into()) - .into(); + let output: bool = ::bevy::math::DAffine3::is_nan(&_self).into(); output }, ) @@ -21509,9 +21252,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DAffine3::abs_diff_eq( - _self.into(), + &_self, rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -21521,38 +21264,39 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Ref| { let output: Val = ::bevy::math::DAffine3::inverse( - _self.into(), + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DAffine3::eq( + "mul", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DAffine3::mul( _self.into(), rhs.into(), ) .into(); output }, - ) + ); + NamespaceBuilder::<::bevy::math::DQuat>::new(world) .overwrite_script_function( "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::mul( + |_self: Val, rhs: f64| { + let output: Val = ::bevy::math::DQuat::mul( _self.into(), - rhs.into(), + rhs, ) .into(); output }, ) .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::mul( + "add", + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::add( _self.into(), rhs.into(), ) @@ -21561,20 +21305,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DAffine3::clone( + "eq", + |_self: Ref, rhs: Ref| { + let output: bool = ::bevy::math::DQuat::eq(&_self, &rhs).into(); + output + }, + ) + .overwrite_script_function( + "neg", + |_self: Val| { + let output: Val = ::bevy::math::DQuat::neg( _self.into(), ) .into(); output }, - ); - NamespaceBuilder::<::bevy::math::DQuat>::new(world) + ) .overwrite_script_function( - "eq", - |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DQuat::eq(_self.into(), rhs.into()) + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::DQuat::clone( + &_self, + ) .into(); output }, @@ -21584,7 +21336,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DQuat::div( _self.into(), - rhs.into(), + rhs, ) .into(); output @@ -21594,10 +21346,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_xyzw", |x: f64, y: f64, z: f64, w: f64| { let output: Val = ::bevy::math::DQuat::from_xyzw( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -21607,7 +21359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [f64; 4]| { let output: Val = ::bevy::math::DQuat::from_array( - a.into(), + a, ) .into(); output @@ -21628,7 +21380,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |axis: Val, angle: f64| { let output: Val = ::bevy::math::DQuat::from_axis_angle( axis.into(), - angle.into(), + angle, ) .into(); output @@ -21648,7 +21400,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_x", |angle: f64| { let output: Val = ::bevy::math::DQuat::from_rotation_x( - angle.into(), + angle, ) .into(); output @@ -21658,7 +21410,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_y", |angle: f64| { let output: Val = ::bevy::math::DQuat::from_rotation_y( - angle.into(), + angle, ) .into(); output @@ -21668,7 +21420,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_z", |angle: f64| { let output: Val = ::bevy::math::DQuat::from_rotation_z( - angle.into(), + angle, ) .into(); output @@ -21679,9 +21431,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |euler: Val, a: f64, b: f64, c: f64| { let output: Val = ::bevy::math::DQuat::from_euler( euler.into(), - a.into(), - b.into(), - c.into(), + a, + b, + c, ) .into(); output @@ -21691,7 +21443,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |mat: Ref| { let output: Val = ::bevy::math::DQuat::from_mat3( - mat.into(), + &mat, ) .into(); output @@ -21701,7 +21453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |mat: Ref| { let output: Val = ::bevy::math::DQuat::from_mat4( - mat.into(), + &mat, ) .into(); output @@ -21764,8 +21516,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DQuat::to_array(_self.into()) - .into(); + let output: [f64; 4] = ::bevy::math::DQuat::to_array(&_self).into(); output }, ) @@ -21892,9 +21643,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_angle: f64| { let output: Val = ::bevy::math::DQuat::rotate_towards( - _self.into(), + &_self, rhs.into(), - max_angle.into(), + max_angle, ) .into(); output @@ -21910,7 +21661,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: bool = ::bevy::math::DQuat::abs_diff_eq( _self.into(), rhs.into(), - max_abs_diff.into(), + max_abs_diff, ) .into(); output @@ -21922,7 +21673,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DQuat::lerp( _self.into(), end.into(), - s.into(), + s, ) .into(); output @@ -21934,7 +21685,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { let output: Val = ::bevy::math::DQuat::slerp( _self.into(), end.into(), - s.into(), + s, ) .into(); output @@ -21966,7 +21717,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_affine3", |a: Ref| { let output: Val = ::bevy::math::DQuat::from_affine3( - a.into(), + &a, ) .into(); output @@ -21982,38 +21733,6 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::DQuat::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "sub", |_self: Val, rhs: Val| { @@ -22027,8 +21746,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "mul", - |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DQuat::mul( + |_self: Val, rhs: Val| { + let output: Val = ::bevy::math::DQuat::mul( _self.into(), rhs.into(), ) @@ -22037,19 +21756,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ) .overwrite_script_function( - "neg", - |_self: Val| { - let output: Val = ::bevy::math::DQuat::neg( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "add", + "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::add( + let output: Val = ::bevy::math::DQuat::mul( _self.into(), rhs.into(), ) @@ -22059,31 +21768,27 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::bevy::math::EulerRot>::new(world) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::EulerRot::clone( - _self.into(), - ) - .into(); + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::math::EulerRot::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::EulerRot::eq( - _self.into(), - other.into(), + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::math::EulerRot::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "clone", |_self: Ref| { - let output: () = ::bevy::math::EulerRot::assert_receiver_is_total_eq( - _self.into(), + let output: Val = ::bevy::math::EulerRot::clone( + &_self, ) .into(); output @@ -22094,9 +21799,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "new", |x: bool, y: bool, z: bool| { let output: Val = ::bevy::math::BVec3A::new( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -22105,9 +21810,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec3A::splat( - v.into(), - ) + let output: Val = ::bevy::math::BVec3A::splat(v) .into(); output }, @@ -22116,7 +21819,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [bool; 3]| { let output: Val = ::bevy::math::BVec3A::from_array( - a.into(), + a, ) .into(); output @@ -22146,22 +21849,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec3A::test( - _self.into(), - index.into(), - ) - .into(); + let output: bool = ::bevy::math::BVec3A::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3A::set( - _self.into(), - index.into(), - value.into(), - ) + let output: () = ::bevy::math::BVec3A::set(&mut_self, index, value) .into(); output }, @@ -22170,7 +21865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::math::BVec3A::clone( - _self.into(), + &_self, ) .into(); output @@ -22179,20 +21874,29 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::BVec3A::eq(_self.into(), rhs.into()) - .into(); + let output: bool = ::bevy::math::BVec3A::eq(&_self, &rhs).into(); output }, ); NamespaceBuilder::<::bevy::math::BVec4A>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::math::BVec4A::clone( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { let output: Val = ::bevy::math::BVec4A::new( - x.into(), - y.into(), - z.into(), - w.into(), + x, + y, + z, + w, ) .into(); output @@ -22201,9 +21905,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec4A::splat( - v.into(), - ) + let output: Val = ::bevy::math::BVec4A::splat(v) .into(); output }, @@ -22212,7 +21914,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_array", |a: [bool; 4]| { let output: Val = ::bevy::math::BVec4A::from_array( - a.into(), + a, ) .into(); output @@ -22242,22 +21944,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec4A::test( - _self.into(), - index.into(), - ) - .into(); + let output: bool = ::bevy::math::BVec4A::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4A::set( - _self.into(), - index.into(), - value.into(), - ) + let output: () = ::bevy::math::BVec4A::set(&mut_self, index, value) .into(); output }, @@ -22265,73 +21959,55 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::BVec4A::eq(_self.into(), rhs.into()) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::math::BVec4A::clone( - _self.into(), - ) - .into(); + let output: bool = ::bevy::math::BVec4A::eq(&_self, &rhs).into(); output }, ); NamespaceBuilder::<::smol_str::SmolStr>::new(world) .overwrite_script_function( - "clone", + "to_string", |_self: Ref| { - let output: Val = ::smol_str::SmolStr::clone( - _self.into(), + let output: std::string::String = ::smol_str::SmolStr::to_string( + &_self, ) .into(); output }, ) .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::smol_str::SmolStr::eq( - _self.into(), - other.into(), - ) - .into(); + "len", + |_self: Ref| { + let output: usize = ::smol_str::SmolStr::len(&_self).into(); output }, ) .overwrite_script_function( - "to_string", + "is_empty", |_self: Ref| { - let output: std::string::String = ::smol_str::SmolStr::to_string( - _self.into(), - ) - .into(); + let output: bool = ::smol_str::SmolStr::is_empty(&_self).into(); output }, ) .overwrite_script_function( - "len", + "is_heap_allocated", |_self: Ref| { - let output: usize = ::smol_str::SmolStr::len(_self.into()).into(); + let output: bool = ::smol_str::SmolStr::is_heap_allocated(&_self) + .into(); output }, ) .overwrite_script_function( - "is_empty", - |_self: Ref| { - let output: bool = ::smol_str::SmolStr::is_empty(_self.into()) - .into(); + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::smol_str::SmolStr::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "is_heap_allocated", + "clone", |_self: Ref| { - let output: bool = ::smol_str::SmolStr::is_heap_allocated( - _self.into(), + let output: Val = ::smol_str::SmolStr::clone( + &_self, ) .into(); output @@ -22339,167 +22015,156 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ); NamespaceBuilder::<::uuid::Uuid>::new(world) .overwrite_script_function( - "get_version_num", - |_self: Ref| { - let output: usize = ::uuid::Uuid::get_version_num(_self.into()) - .into(); + "nil", + || { + let output: Val = ::uuid::Uuid::nil().into(); output }, ) .overwrite_script_function( - "as_u128", - |_self: Ref| { - let output: u128 = ::uuid::Uuid::as_u128(_self.into()).into(); + "max", + || { + let output: Val = ::uuid::Uuid::max().into(); output }, ) .overwrite_script_function( - "to_u128_le", - |_self: Ref| { - let output: u128 = ::uuid::Uuid::to_u128_le(_self.into()).into(); + "from_u128", + |v: u128| { + let output: Val = ::uuid::Uuid::from_u128(v).into(); output }, ) .overwrite_script_function( - "as_u64_pair", - |_self: Ref| { - let output: (u64, u64) = ::uuid::Uuid::as_u64_pair(_self.into()) - .into(); + "from_u128_le", + |v: u128| { + let output: Val = ::uuid::Uuid::from_u128_le(v).into(); output }, ) .overwrite_script_function( - "into_bytes", - |_self: Val| { - let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into()).into(); + "from_u64_pair", + |high_bits: u64, low_bits: u64| { + let output: Val = ::uuid::Uuid::from_u64_pair( + high_bits, + low_bits, + ) + .into(); output }, ) .overwrite_script_function( - "to_bytes_le", - |_self: Ref| { - let output: [u8; 16] = ::uuid::Uuid::to_bytes_le(_self.into()) - .into(); + "from_bytes", + |bytes: [u8; 16]| { + let output: Val = ::uuid::Uuid::from_bytes(bytes).into(); output }, ) .overwrite_script_function( - "is_nil", - |_self: Ref| { - let output: bool = ::uuid::Uuid::is_nil(_self.into()).into(); + "from_bytes_le", + |b: [u8; 16]| { + let output: Val = ::uuid::Uuid::from_bytes_le(b).into(); output }, ) .overwrite_script_function( - "is_max", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: bool = ::uuid::Uuid::is_max(_self.into()).into(); + let output: () = ::uuid::Uuid::assert_receiver_is_total_eq(&_self) + .into(); output }, ) .overwrite_script_function( - "encode_buffer", - || { - let output: [u8; 45] = ::uuid::Uuid::encode_buffer().into(); + "get_version_num", + |_self: Ref| { + let output: usize = ::uuid::Uuid::get_version_num(&_self).into(); output }, ) .overwrite_script_function( - "get_node_id", + "as_u128", |_self: Ref| { - let output: bevy::reflect::erased_serde::__private::serde::__private::Option< - [u8; 6], - > = ::uuid::Uuid::get_node_id(_self.into()).into(); + let output: u128 = ::uuid::Uuid::as_u128(&_self).into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "to_u128_le", |_self: Ref| { - let output: () = ::uuid::Uuid::assert_receiver_is_total_eq( - _self.into(), - ) - .into(); + let output: u128 = ::uuid::Uuid::to_u128_le(&_self).into(); output }, ) .overwrite_script_function( - "nil", - || { - let output: Val = ::uuid::Uuid::nil().into(); + "as_u64_pair", + |_self: Ref| { + let output: (u64, u64) = ::uuid::Uuid::as_u64_pair(&_self).into(); output }, ) .overwrite_script_function( - "max", - || { - let output: Val = ::uuid::Uuid::max().into(); + "into_bytes", + |_self: Val| { + let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into()).into(); output }, ) .overwrite_script_function( - "from_u128", - |v: u128| { - let output: Val = ::uuid::Uuid::from_u128(v.into()) - .into(); + "to_bytes_le", + |_self: Ref| { + let output: [u8; 16] = ::uuid::Uuid::to_bytes_le(&_self).into(); output }, ) .overwrite_script_function( - "from_u128_le", - |v: u128| { - let output: Val = ::uuid::Uuid::from_u128_le(v.into()) - .into(); + "is_nil", + |_self: Ref| { + let output: bool = ::uuid::Uuid::is_nil(&_self).into(); output }, ) .overwrite_script_function( - "from_u64_pair", - |high_bits: u64, low_bits: u64| { - let output: Val = ::uuid::Uuid::from_u64_pair( - high_bits.into(), - low_bits.into(), - ) - .into(); + "is_max", + |_self: Ref| { + let output: bool = ::uuid::Uuid::is_max(&_self).into(); output }, ) .overwrite_script_function( - "from_bytes", - |bytes: [u8; 16]| { - let output: Val = ::uuid::Uuid::from_bytes(bytes.into()) - .into(); + "encode_buffer", + || { + let output: [u8; 45] = ::uuid::Uuid::encode_buffer().into(); output }, ) .overwrite_script_function( - "from_bytes_le", - |b: [u8; 16]| { - let output: Val = ::uuid::Uuid::from_bytes_le(b.into()) - .into(); + "get_node_id", + |_self: Ref| { + let output: bevy::reflect::erased_serde::__private::serde::__private::Option< + [u8; 6], + > = ::uuid::Uuid::get_node_id(&_self).into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::uuid::Uuid::eq(_self.into(), other.into()) - .into(); + let output: bool = ::uuid::Uuid::eq(&_self, &other).into(); output }, ) .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::uuid::Uuid::clone(_self.into()) - .into(); + "new_v4", + || { + let output: Val = ::uuid::Uuid::new_v4().into(); output }, ) .overwrite_script_function( - "new_v4", - || { - let output: Val = ::uuid::Uuid::new_v4().into(); + "clone", + |_self: Ref| { + let output: Val = ::uuid::Uuid::clone(&_self).into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs index 2a0259468a..9f8557282e 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -8,7 +8,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyTimeScriptingPlugin; impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -18,7 +18,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::time::prelude::Fixed::clone( - _self.into(), + &_self, ) .into(); output @@ -29,28 +29,18 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::time::prelude::Real::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::time::prelude::Timer>::new(world) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::time::prelude::Timer::clone( - _self.into(), - ) - .into(); - output - }, - ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::bevy::time::prelude::Timer::assert_receiver_is_total_eq( - _self.into(), + &_self, ) .into(); output @@ -60,7 +50,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "from_seconds", |duration: f32, mode: Val| { let output: Val = ::bevy::time::prelude::Timer::from_seconds( - duration.into(), + duration, mode.into(), ) .into(); @@ -70,9 +60,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "finished", |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::finished( - _self.into(), - ) + let output: bool = ::bevy::time::prelude::Timer::finished(&_self) .into(); output }, @@ -81,7 +69,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "just_finished", |_self: Ref| { let output: bool = ::bevy::time::prelude::Timer::just_finished( - _self.into(), + &_self, ) .into(); output @@ -90,9 +78,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::elapsed_secs( - _self.into(), - ) + let output: f32 = ::bevy::time::prelude::Timer::elapsed_secs(&_self) .into(); output }, @@ -101,7 +87,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "elapsed_secs_f64", |_self: Ref| { let output: f64 = ::bevy::time::prelude::Timer::elapsed_secs_f64( - _self.into(), + &_self, ) .into(); output @@ -111,7 +97,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "mode", |_self: Ref| { let output: Val = ::bevy::time::prelude::Timer::mode( - _self.into(), + &_self, ) .into(); output @@ -124,7 +110,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { mode: Val| { let output: () = ::bevy::time::prelude::Timer::set_mode( - _self.into(), + &mut_self, mode.into(), ) .into(); @@ -134,7 +120,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::pause(_self.into()) + let output: () = ::bevy::time::prelude::Timer::pause(&mut_self) .into(); output }, @@ -142,7 +128,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::unpause(_self.into()) + let output: () = ::bevy::time::prelude::Timer::unpause(&mut_self) .into(); output }, @@ -150,7 +136,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "paused", |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::paused(_self.into()) + let output: bool = ::bevy::time::prelude::Timer::paused(&_self) .into(); output }, @@ -158,7 +144,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "reset", |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::reset(_self.into()) + let output: () = ::bevy::time::prelude::Timer::reset(&mut_self) .into(); output }, @@ -166,9 +152,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "fraction", |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::fraction( - _self.into(), - ) + let output: f32 = ::bevy::time::prelude::Timer::fraction(&_self) .into(); output }, @@ -177,7 +161,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "fraction_remaining", |_self: Ref| { let output: f32 = ::bevy::time::prelude::Timer::fraction_remaining( - _self.into(), + &_self, ) .into(); output @@ -187,7 +171,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "remaining_secs", |_self: Ref| { let output: f32 = ::bevy::time::prelude::Timer::remaining_secs( - _self.into(), + &_self, ) .into(); output @@ -197,7 +181,17 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "times_finished_this_tick", |_self: Ref| { let output: u32 = ::bevy::time::prelude::Timer::times_finished_this_tick( - _self.into(), + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::time::prelude::Timer::clone( + &_self, ) .into(); output @@ -209,10 +203,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::time::prelude::Timer::eq( - _self.into(), - other.into(), - ) + let output: bool = ::bevy::time::prelude::Timer::eq(&_self, &other) .into(); output }, @@ -225,28 +216,28 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { other: Ref| { let output: bool = ::bevy::time::prelude::TimerMode::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output }, ) .overwrite_script_function( - "clone", + "assert_receiver_is_total_eq", |_self: Ref| { - let output: Val = ::bevy::time::prelude::TimerMode::clone( - _self.into(), + let output: () = ::bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( + &_self, ) .into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", + "clone", |_self: Ref| { - let output: () = ::bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( - _self.into(), + let output: Val = ::bevy::time::prelude::TimerMode::clone( + &_self, ) .into(); output @@ -257,13 +248,23 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::time::prelude::Virtual::clone( - _self.into(), + &_self, ) .into(); output }, ); NamespaceBuilder::<::bevy::time::Stopwatch>::new(world) + .overwrite_script_function( + "assert_receiver_is_total_eq", + |_self: Ref| { + let output: () = ::bevy::time::Stopwatch::assert_receiver_is_total_eq( + &_self, + ) + .into(); + output + }, + ) .overwrite_script_function( "new", || { @@ -275,7 +276,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = ::bevy::time::Stopwatch::elapsed_secs(_self.into()) + let output: f32 = ::bevy::time::Stopwatch::elapsed_secs(&_self) .into(); output }, @@ -283,9 +284,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = ::bevy::time::Stopwatch::elapsed_secs_f64( - _self.into(), - ) + let output: f64 = ::bevy::time::Stopwatch::elapsed_secs_f64(&_self) .into(); output }, @@ -293,39 +292,35 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::pause(_self.into()).into(); + let output: () = ::bevy::time::Stopwatch::pause(&mut_self).into(); output }, ) .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::unpause(_self.into()) - .into(); + let output: () = ::bevy::time::Stopwatch::unpause(&mut_self).into(); output }, ) .overwrite_script_function( "is_paused", |_self: Ref| { - let output: bool = ::bevy::time::Stopwatch::is_paused(_self.into()) - .into(); + let output: bool = ::bevy::time::Stopwatch::is_paused(&_self).into(); output }, ) .overwrite_script_function( "reset", |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::reset(_self.into()).into(); + let output: () = ::bevy::time::Stopwatch::reset(&mut_self).into(); output }, ) .overwrite_script_function( - "assert_receiver_is_total_eq", - |_self: Ref| { - let output: () = ::bevy::time::Stopwatch::assert_receiver_is_total_eq( - _self.into(), - ) + "eq", + |_self: Ref, other: Ref| { + let output: bool = ::bevy::time::Stopwatch::eq(&_self, &other) .into(); output }, @@ -334,18 +329,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::time::Stopwatch::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - |_self: Ref, other: Ref| { - let output: bool = ::bevy::time::Stopwatch::eq( - _self.into(), - other.into(), + &_self, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs index c32d3ee20e..99a200579c 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -11,7 +11,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::*; +use crate::{*, namespaced_register::NamespaceBuilder}; pub struct BevyTransformScriptingPlugin; impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -21,35 +21,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "clone", |_self: Ref| { let output: Val = ::bevy::transform::components::GlobalTransform::clone( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - global_transform: Val| - { - let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into(), - global_transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - transform: Val| - { - let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into(), - transform.into(), + &_self, ) .into(); output @@ -62,8 +34,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { other: Ref| { let output: bool = ::bevy::transform::components::GlobalTransform::eq( - _self.into(), - other.into(), + &_self, + &other, ) .into(); output @@ -73,9 +45,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "from_xyz", |x: f32, y: f32, z: f32| { let output: Val = ::bevy::transform::components::GlobalTransform::from_xyz( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -85,7 +57,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "compute_transform", |_self: Ref| { let output: Val = ::bevy::transform::components::GlobalTransform::compute_transform( - _self.into(), + &_self, ) .into(); output @@ -98,8 +70,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { parent: Ref| { let output: Val = ::bevy::transform::components::GlobalTransform::reparented_to( - _self.into(), - parent.into(), + &_self, + &parent, ) .into(); output @@ -112,6 +84,34 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { transform: Val| { let output: Val = ::bevy::transform::components::GlobalTransform::mul_transform( + &_self, + transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + global_transform: Val| + { + let output: Val = ::bevy::transform::components::GlobalTransform::mul( + _self.into(), + global_transform.into(), + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + transform: Val| + { + let output: Val = ::bevy::transform::components::GlobalTransform::mul( _self.into(), transform.into(), ) @@ -120,13 +120,51 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { }, ); NamespaceBuilder::<::bevy::transform::components::Transform>::new(world) + .overwrite_script_function( + "clone", + |_self: Ref| { + let output: Val = ::bevy::transform::components::Transform::clone( + &_self, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "eq", + | + _self: Ref, + other: Ref| + { + let output: bool = ::bevy::transform::components::Transform::eq( + &_self, + &other, + ) + .into(); + output + }, + ) + .overwrite_script_function( + "mul", + | + _self: Val, + global_transform: Val| + { + let output: Val = ::bevy::transform::components::Transform::mul( + _self.into(), + global_transform.into(), + ) + .into(); + output + }, + ) .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { let output: Val = ::bevy::transform::components::Transform::from_xyz( - x.into(), - y.into(), - z.into(), + x, + y, + z, ) .into(); output @@ -136,8 +174,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_x", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_x( - _self.into(), - angle.into(), + &mut_self, + angle, ) .into(); output @@ -147,8 +185,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_y", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_y( - _self.into(), - angle.into(), + &mut_self, + angle, ) .into(); output @@ -158,8 +196,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_z", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_z( - _self.into(), - angle.into(), + &mut_self, + angle, ) .into(); output @@ -169,8 +207,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_local_x", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_x( - _self.into(), - angle.into(), + &mut_self, + angle, ) .into(); output @@ -180,8 +218,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_local_y", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_y( - _self.into(), - angle.into(), + &mut_self, + angle, ) .into(); output @@ -191,8 +229,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_local_z", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_z( - _self.into(), - angle.into(), + &mut_self, + angle, ) .into(); output @@ -205,7 +243,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { transform: Val| { let output: Val = ::bevy::transform::components::Transform::mul_transform( - _self.into(), + &_self, transform.into(), ) .into(); @@ -216,21 +254,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "is_finite", |_self: Ref| { let output: bool = ::bevy::transform::components::Transform::is_finite( - _self.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "eq", - | - _self: Ref, - other: Ref| - { - let output: bool = ::bevy::transform::components::Transform::eq( - _self.into(), - other.into(), + &_self, ) .into(); output @@ -249,30 +273,6 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .into(); output }, - ) - .overwrite_script_function( - "mul", - | - _self: Val, - global_transform: Val| - { - let output: Val = ::bevy::transform::components::Transform::mul( - _self.into(), - global_transform.into(), - ) - .into(); - output - }, - ) - .overwrite_script_function( - "clone", - |_self: Ref| { - let output: Val = ::bevy::transform::components::Transform::clone( - _self.into(), - ) - .into(); - output - }, ); } } From da0ed0c51855d7c35d6a8eb966537eb545402231 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:13:39 +0000 Subject: [PATCH 106/217] imports.. --- crates/bevy_api_gen/templates/header.tera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index ba39a17e92..cb9f2c6ea1 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -18,7 +18,7 @@ use bevy_mod_scripting_core::{ } }; {% if args.self_is_bms_lua %} -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::{*, namespaced_register::NamespaceBuilder, core::RegisterScriptFunction}; {% else %} -use bevy_mod_scripting_lua::{*, namespaced_register::NamespaceBuilder};; +use bevy_mod_scripting_lua::{*, namespaced_register::NamespaceBuilder, core::RegisterScriptFunction};; {% endif %} \ No newline at end of file From 0eb4d6ca04875329a1f6f64a513b722fae952b1b Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:16:14 +0000 Subject: [PATCH 107/217] clean up imports and fix spacing --- crates/bevy_api_gen/templates/footer.tera | 6 ++---- crates/bevy_api_gen/templates/header.tera | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 8c90722332..201355bd81 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -27,11 +27,9 @@ impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_c let output: {{ function.output.proxy_ty }} = ::{{ item.import_path }}::{{ function.ident }}( {%- for arg in function.args -%} {%- if arg.proxy_ty is matching("Ref.*")-%} - & - {%- endif -%} + &{% endif -%} {%- if arg.proxy_ty is matching ("Mut.*")-%} - &mut - {%- endif -%} + &mut {% endif -%} {%- if arg.ident != "self" -%} {{- arg.ident -}} {%- else -%} diff --git a/crates/bevy_api_gen/templates/header.tera b/crates/bevy_api_gen/templates/header.tera index cb9f2c6ea1..cdab05cad8 100644 --- a/crates/bevy_api_gen/templates/header.tera +++ b/crates/bevy_api_gen/templates/header.tera @@ -18,7 +18,7 @@ use bevy_mod_scripting_core::{ } }; {% if args.self_is_bms_lua %} -use crate::{*, namespaced_register::NamespaceBuilder, core::RegisterScriptFunction}; +use crate::*; {% else %} -use bevy_mod_scripting_lua::{*, namespaced_register::NamespaceBuilder, core::RegisterScriptFunction};; +use bevy_mod_scripting_lua::*; {% endif %} \ No newline at end of file From c499d159dd1d470277f06c17d0512cefb7029f33 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:16:57 +0000 Subject: [PATCH 108/217] add windows utils for local dev --- check.exe | Bin 0 -> 26112 bytes check.ps1 | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 check.exe create mode 100644 check.ps1 diff --git a/check.exe b/check.exe new file mode 100644 index 0000000000000000000000000000000000000000..692eda88fb76ea326f6770b04065bba2ff6e8b12 GIT binary patch literal 26112 zcmeHvdw3khm2Y)VPtQZrNIf%}k!;Bt%MZrZ!) z^=L-2$#TE_=YHSavFCK1N1Zx#>QvRK?jG&F82)K64R)yM zt0D0~;QNcetnB*!;(^hulNh(H5j#DW7)s~!Rv~fJOxP3oL^hx3?&(jASsAmvsw%kD zRo%Nyh+T?D_*RUL6kGebP?ZX$LWs*i@k{DAufjEf?=-$-T>=+X+Km$1Pgn6EzM#{` zBeq;CL=FEhU0qa)h*9Y6r}DHAkCPMTf9?>Xaz5?N;E7q&S=tZ$;<9?}1@mM9_(PWf zfX97x?FPo5gb+vCZO0x0#z^NkwiPjTo0RYMisoX%E1<6Lbpw&fm zJ(^sMR@-V?eDP!x2+NZRz_#B)4h)uqS;3X)Q)IO+ZbAR>-)MRzi3re1^%AggS&GY{ z_(7DGNy2hTaL&WEBJ4j?iwbJkf0n@Llov6{jJc{tr!at;;jat_+{%HNl*N@!#A(tj#~{K4BgP@nYii1>#x6Vcrj))c!-8pT#{`7GH|xaNTP6(1dOFu zOrl|gzTv4GjGa;Np93Hms|br^J4EAyt(vd?ND*By*y{B)RnFpdjMp5gNUnl#tKXNH zhC-mL3595aMLU2&;Tl|go&|18&RU={ro5sXUWcm;bc#l>+QSjFdUdh)9wx6z0H+`W zpN403P02WI28FL8>~Yn2&}5k!Ld(<; zS{7S`med3)%OYRpX*e72D$mejlt;W2=J10W4peK&3t-65*>y*YS#L#?TAVNQ*BF;v^t3Bn^z@rvPiWCBTTf^`En82B>o#;SeyD6^Avw26 zW)#<$Sj5{hL2Cw<0IU~DS|cb_dCYwp(`W@L8~bu9xw}kgUM%=#NKJ8laP3-ii{ZtB z;WfOjJ!_`jg%0x`(L!swDzLuOR%wLAnOZE53Wgm!SunYg>=Q}sa>3+g0G)Rg-buCq zMYvE;lbryFJE;eYFYCdoOM1>Hfvo^2ucLAofYieqSvOGV;f-t?%2>g+(*?WJ4!)|% zi|NXCVk@H*$7p($7Aifc(`u(z`0Cm{zBVKIDfjXl$t_ZoJGpt`LI2Wd zpFV0+GKIVYB5c+T<&?SiWL!)ztba*r}<>UC^OAAn8-stu^%&LEc`i-NceO zB?HzT*_>Fo+Aq#vkT4#GC)opPn@{yvy(nl!RAbcH3tG@?_2CjR*58LphG8L33syuc zebxX9T%ondSyet;>ms@QYf9sib4Gv@y=(5x>tG z1VwhGQMEDJ0l1IR{;BqWKN2#vg@XLOv&ulXMf#eVo1BPa!jqyYj21gP7 zH((Yhk*E=k8L%p9WgxZu8E+(L1h102YRk2#W0uvCLIrGMN~A(}ji_)S610W^)*mL_ zk;-VK%KtdVUAizi0@j893*q2@9O+m&@j(#FyH}}7jC0@O&QQQ5ZGsPapPRX$U@T(v)2 zRLE)~RnLfWjcvEK45&Oz^MG}X6o!mYq_SmAc@JZ%{X3|1NjWlxMlKquR;@9rQ*Bg7 zDvQ3YEcq5AQ)ARzg@DaN?4qtezW(|%m4?yk1H}U6DIIgV6N5;fC-H@t=)!n-aoqy9 z<085caFomU;983-g#gjt3)qkE)1VjSQ4~my#6u{&h%eQn&qC}m9|ayfd%mf1p2dRB zIQSLplS;33C6Gwv`ahzwQEA!0ssfgSODt{`h^I+3;+5B?l&b~)l`~BDN^w?x+9Qd(^}XX2x*`^56Uy1 z<%nLNeF#c~xJq#^FHqiK6rp*#q=eRo3SADXZo}sBU{OoG z-gFsHn%Jt4t54@mD5(3KccNaUpZr06xc5!;q4obg>lexSg|vsFADyATV40!uF`RdS z7L>H zr8C7R?`a^9qxM%`h4AMT=@imO&Hg@`^>EBnR;aIhflf?%Yb^O*GU}gaxz_urGU{U6 zMcNdnx+SixyMWyxzfd<6U^DlX;X%_yp#sRSX~)M8vPh91!l zJs3wrJw>E8HM&wgwG5?YZ3~vemqc`sW$Vd5L;YpJDdOoX5sK6xU8y0uQY$ML*ljSF zP;Q_-wlLPT$oU|uqUZA8uzHGYh+CIIt1Npc;nP>zGJ*EARoJ_s#rY7bT?Lbuljb$* zDZ29DuDn1Z9?q<1Sv2A$7GuR)ie`Qs->Q41=QQBd}s7A zh&s1INl=ekr%5w!w`fR#GJ%t0Vyp0YfZnd2T7hbw0uC$-HS0FWS|29x5dt42a67=t z_ZH=XCAp6g_YMNRB(mRQeH_=;O0}#4ZuQm%nI`Ei0lH6M{S{ce zXDo~8ZOjA2OojgeQ4UL6T=jg1?g~mebi{Qp0{#Yasi?~@=g&Jv!MH1^Z1wL&u z61UND!S2UYjVHeZ@it$)V*NkD_n;1fT5o+B)Yg8ZGJeBa40~j;u{dU53C<^s#dUG( zD`WtUCpTv6+Qaq)=)6Y8Ba5ECQ-hYO_-*kU-a-|djpkTW^GA(l>#L|!*)oY12C(5fAVW+ zcsa<_Qou+6CX9s9bYph&OGqJ;U#Gs{uw(xvDp}tk49A${H&JlDMHo&l)`L`VPo`}( ze#1!qH7GIk_W?``7+P?LzbPOcw!~Nxv%dohIRLHyi5kG_>>o&Sy&& z7tWDtuzw@TjYb8e7TGUKH2F8sVm$<~yajtUkS8nxDUP`GfK7`4_TC|lnJsNa$Yg#^Q~ zuGadBs@}M@!$pzSm2cQuY;J2U zLvJW~jy@G_Y-xjcu@K2&#vNdc(Jaq!=}di`dSyfr+_)*CBDPl|w$C**QkR`W7py0^ zl1q69QRMKs?RgDf)M$`POqP}y+9DziMnlxXK(#E_>D~^WDPiTMWwt3}{SX4JzjW=g zegv#oeiCKt?*SIBZFX1cIjnym{_OtoOw47rRu-i!2t0+w^~bm(v^9jb<_7wLNWFa% z4axQ38TG7&*P~~IueHYhCb8ZRR`MqRusRK^R~n08v*>)gJY!vpxq&ratio)r#FaiE zi4y>r6k_8%I#Mz*>J{QOe37*BhvbLw{Q_updPxs4FU9wJpf3j<*@)PJNW8-S4OvE; z6R!4<}?fxx*~9?Xrf_q-8}_uqv1xP9*2l zZ8NV-G#@pOPY$NXvx6gMzIjFBR8=s6&rsSPu@Wu$?8qqEZdbczOtK z_|J7gX4p&@CT!E$*qob4pT90)kEXMUf|<_Iqj?jL=#NjX8iun5PoxV&qoyq>V-vYT zcCavNo9T?1X@*UBfZYGKt%|%A#j$gIUHj_xwX4^5AQPcGQaQi|1j&-Cg}5Hqm+MjP zFWA}qh(i)@UkyHDW68dLaqIc=S^Sb6`%>NDeFpeVh?yl@b98%@KZrBsz~)aj1}cF5 ze%V?IK!k`mhHnkNtMEle$FWFs+Sdd4k~qaELYZ3P4@7E03Z6R=}Y6G*g~p%IgfTSBd*UhQDF>GGI`2=rLUv zoAmop9@clD?C2!6T?Fck2AbC^np-NJjU>MA<}bEHR=2rpe`C}$mUCG zi1O!vx_E#o9)l>KG)Vp{3?E|n3#R|Ui0MJm877(S3~ylgjWAjAeTF|}_$EYof_$P#lcz0DM=JOi3?GeuB_0${ z#i=j9kCRpB)h(X)yc%JubR!}@w^ z>rg%Q5o}I$} z`yqUANc(%hOBr6y@F>G!hB<=z7qwrB{nOvnegpV8!=EvHf#Dwki!vc^K-rJB2sWXt zh}GUWe1Cy=A>dAiM;M-9cq7A4GW;^b#~A*C;Tb?h{J`e`KIuCF_?qt&V3nU>(ti!$ zM*mHKI|9W0bj729_g6&FBa+v}6VdB6U2LxX2;e2PcL2`R-ZM-2S=D_S94n^92NRbn z3*87HYz!E!Tg1CLF|DlPl}=)}DVs4uy$Rwz?0-P%#t0v9u}72?ut67lR_PI8G2>z{ zDg(ei>|zz_B_bm3cCkh3Ah3sBtV1;sf8TepEov6nlM=&|iacWG1($b3?FROWixt!q zFtJ$R^Dv%C*jUCt(af0tUiBIg7k9bXgK7`3ue#Vz8GBS>IF!E=yn!WBONHmXqE6ho zRALFwEuul3q>x1m3D50fk@(Sa#{6qMmmq%C^CY&-GYG7~#SVIUVAk7QY{WAFEaPIw zJ$K`7z%duQ&hvR-^i*Dm>*{XtIw- z{n%$I3SQL*lncbA62l|ByTt_}!`O^i?mGnD&t2Xc#{R>_Qoh6Bt?iIHQ@+n*{=e15 zdVpOdE^)ELz}_luaj`L9UThF|%wmU?4dTa)&4?4wxmi@>o-NrqhI(5?+{JG7jVN8B z-o^eBylrB=i+u^$c5#p~^87oM9pX;O^SAlmhsb`$#d`f80`?0R8)EDQ7dz=c4c@CR z_HO^(A|?LlVmJA32hWSsKl$uq{!aokBql!V&qFfeV&7n_*2R9nSlq>)W31lAe(%qs z-de`U>c3XrCVD02-x=r@JH_QLmIe}ozc}CJ`6^Ptx?F5YMYk9by)L#Hya7^( z&%;%hR$L?YNd(vx72i=x*kpw%_RsRJtH=U7%vydCpn31Hy7Ks&`PFa51WP zP)wgsif$HPt9VQ~Bt|z#?5T<;l}p4s8Iv>oGBM5didX~JyH5NvdV_YE=ytK+0Xr;4 zT&$w@&$T1s`m%ay@nwmLWLoh@Uf2>dws;ESY>Jdi)HDLjI z#S|cMm2+}$DRQw--&v`k?iac4!zg>jPnr8H!{7W#_*>@w2ScrjvgHaukB9?mq5)75 zB%`|J#VkWlP84yr<_@O6m0>4KrT{%+?^%??plD+FEP8?IQ-EG^J)kb6ZROfZGK%;Z zWK?l4pl6Of)Nawjvt`bv$i94wwLQXhr3MKfWBQXm(s@4)8^q=jA{|e=Y-1?8X z#h?Aja;%nYD3|<5ZIxIpo)x!vo>E={%!}6;D#|U`&jJh$hV={=GhD&2128Kt1k8(0 zrlgbyl;@O`@`&OMH>J zUnj2kTP{D&k{v2(+oDn}kLPv3d)4Ql^N33A7Svy3zPQS zI<-xy3%~3TC`C)Ls&GJu@ zy!Zv^dj;h*dj;iH0YMp5N_n~F1L~v_Fz$hT#Gu|a8(8&~B$qGX@&<$YvJdox`dZw&k7!Z_6;cZB?bXs}dctKsk`)C7m zmx@4G^|Xq3IO=(iSQ5Tl+@%~0*L&_#t_U{++Tm+JxjMYU^A+XKz&)*eIJ^qTPjPzJDq^M_w4iy|YCToJK6lW2F!(;zO0yaSYr zBJV}5iz8I)VB|w6XCm)YR&Yi_dTxUr$}(P3J`}k|yr$e0$>aP&{oTNpceCX;i$_?) z-$h>ZoK~KSybAa)F69p>e>g0()5>o^S;y@Lctps;!%Be1D5VJBkJWYJ<%q6fagA1L zH?vjbtHa7^w76cokK0A8`gWikh??R)5slK=rF>7R_ld^nPA#QujAk@LrA&n+pHl19 z!RQrQy-ImTy-NATcg2;_ajk>3O^V6rg!Tl=)7oN{=GO|qyf~zOuJ#(SSG~XXJ4zaq zFKQ|Ed$nKJE>vHxHL<&k=s##zs%L7S))cieb~pS?In@Bu>jjNer&<@g23}3Z{!QzE zhVLko>iXCV+6-%(RI{;{wfCqG#{Qt)tUeR-cyCr;iXm%JUyTL5AD1mE@pz3lrLK&} z0k_2$dGAs;MwfaogSB7Oc8MeL_1+BkA_K4PL^&VN!v?Z{fVroY6Y;&?)5=ZpgMgol z9|3$Ie$4w_^~v~i;tBP+_?6x#RHg2O_gQsy-PPV-q1|_RUsCth-7Q{IkJR1hom9tA zrV;!QY`D7aHm~9#FDagT>OSr@JYT81Mg%-h)_ulX@A-M1DHeNPs{0%ye-FuekBEN3 zyTVglPZ}PGBYOk=>)Ss6SMHsovpjL+qyg5KJ-GMKm{1^VO176^z7I!i{!teyc8yS9*;g=ac#_$&m z&oKO81=(|Z1zA`s)2~rH=%LOY@c~mXN?v$}?rA9KwGZVAUuLJSRfLdB`J z8Zd&BuZpu`1Tysu7m8X?7BFnUnNksrfT~ytzKXNWLcq6zregG)05{@PsN(L*62Q$k z&8dio^8j~Xt}2KMf^Wm!4HX$b!JVQFlwAz>;2x!lJe^>V=m5PJP{mHN7Ue!bm2zd2 z2LM&%zi&Z#Kf{B3*X01iL$F8@moU5x7OA-FLhy1}q~Iq(n^7Lb?xKhzfb?c>7s^Kg z_3ED(x>~LNPW^*g>G_H0SJP z1B(;eZ3-e1yO*P>LYu}Q&G|f!dsLn>3i2Vwv@%*y_@RoTy7UPOgK0#e!oT89F~z=y zFO9MfBk#wz0wW#5XjbD}1NbTBU%e3Du-nQ^X>8NCGBI*kY(qxM_mnKe>yiIjqf>ng*j9Z z+wv1*ZsoZ(r9$fCV9&mR-hBgu7kBRI-nC8i;da04kDiIb_(VY*u(JhoE~$UWwsJX_ z2E;V;TPKExOrW9t4jIvw_ z?XoO8lg+0Kro)n56Sjj9u$(NrlceX7sBuY})mMgY&rLX^sXRLC_JYK>Tedmh*7-Ck z-eu-;@Y_%!ogYE8zy&TH51ug6(#Dal&uM~GI>$}(NYwALrpb|IXo)+JEua@Aw#3_q z3K-M*V=PVM&dnQ?@)4Nl>^a^#x2NWMXP-;l6x!2tPsX8co}x(;3QUWvPHC zR7WQ$nhxSPvCAAThyiO{^wBdsvDGSIqSC0&t_&%MgQd^RWNi$)nGq>RPL??&ei&Is zIZm^4a8PVd?bIfcNI`hSg^!f7c8jGbRhf$$f(!RsYn|5|cbZ426wkMCQ!FuSfj_0T# zIoLbQ9G3T@q9YyH7R+3x+jNHPEYCmzE5^nPqHEO34w+{&V6bwxwp|;uq&I#9woPxesgF7t29;vDwy(#E3GoUX~)6i;tVer zRHM_GBf@LDT;X}ZSSb@ZE=uU!67N8H>W(`^SpBFKu34l>%pKcOeK&}hAbT^Ow&5Ky zku7#-2c7_@bJ?rp?%0I~(dZN}f|i{f!NQ+A7j0jvoVsHon-OD^sSGc+y>|9Ewu|m` zAuR@nIq! zOzi#{Ii_OU$!uW`VUJbF4o_}1(KDn9IqV3$jY;yhe5Ra;mA!w|n#g5H3*2Ao);#-N zv}Ajk-E1@L9fZrt)^jclw7Q>@F zNL1&XjM*CVRn69z&!8G^T+d&dsLmU(%4*G5SXOI3i)s~T)VUgaBVKvE`8uh&V!io1 zs#g|aBwB_Nmm;qV3ncIVvq+iHEX^rJs#&Z=39;ChALYy%Q9NYwa=Ps}=3b|b*F@aF z?M8B(%@3X}DMsh!qPcOIVH6jSz6q?fV`e+AQPz0BX&=V|?I07kozZlz)9Ea3_b_9O z^YIMl``E!ttjvkByrqb6-YIh9wEXsAx?-xQ@})YtabEviPHtSLW~Ib1H{OL;fJ%7g z1hx&ln#9w+hgUWzN0yNj`BDDU6ok7n_{+(oB~uS_0;ax>6s>FBVyekvxp5b9wRhmgV%R|~tV^hwa ziCnJ7-iCC0Ql#jXhH0m9)I?T}{+Dp>uDgA3xfi}0GvU1AVz3>Gc;VvEaHk!W-5VBA zN7#0x_H!w$F6GQReOr!i;;AE4ZF=T(>;8!5F1Y=Y;Z_F**O;OlhxlF0lSGP-n>HOuuv5s}KvHZs zR!%6z3=!5i?sAz|P9VL8Ge-~+7n`~9-SQn&;%+PFb;})qZz~n|*V3uTDIW}u&pq^K zjZ)oNXWVl5Mu#k#$a&p;Ui4!LGjVuv3OI>T`@7Odan|aeI0~o04d_zFJlQjh6ZpRI zaacWI?ZO^oQ|}7tY~Cr(s}%01NdCEPf2DSONle4yxbW)F`@RuG8!0tIJT_Xav;l~PP^*fcaaNRG&*C%bZK z$61f)$YTWhOvFAXK4J{N->1U~hRDp6a-j{BEp0kFIJgFPJl*12k?M3N^FyeO&ACKh zhb>f`)z;CoNw^i-zjVW<^@D@>n^EZ;enr$v4(=bN+gKR5(c&i2MaP`nIjmVdPs32j ziVk55u5lopEx2>2-z>-#p7miThxJ`Z9VjgjeC+8jV0r58Cl8du3)7p22?-M=2^1?F z8*%_=1B&Ry_+=S~_R$=seMZP70|6nk$?}19DQD-GY`wJH7U@jpTq&p>U-fm~HrsO7h^S~rUYLDAM#qN+;JJSA%T-x4ta-1CR-lH8cPhzs;t$MKox4mTw z)ITwV?Ano(Qn+(FEal$R#%=O~=(Z;4hVg(si7f#?2}IkodxJnGLU%^Erd*@9T6m6; z#tR#nOmTgpGKLB#oeZWJZ3y!I0%j$77F!P8cyRZVvRO;T9=gRO=Vn<&N?&;A;^|gW zI7^??3{lxa8QfF{-lnMO%Hduh2Nh+@yjwyxQ(8IY!<})5-yjs5`|y<9S~K zZ#Lk)4Elq4)dSGeiMp8j^w-2zBt#NV<|gqAb`x@o@tiGzcbYBm6JiuJte9v6??!l8 zkC!CGjsxJ6JtMQyW6)Q?-#17=o@`FTCelcU9nwwQ1T4)1n?RYhRY+T<<^=d6LUxn= zmjjbM5Sxi}DcU94#n44Ik=+@ThoN}_6sg?-z1h{!469kQ2Np-9)&!ne7WFD_>qJxH z``BLUbsieWpjp<%o8+~<+#5%nV83J}$Jl^35PR@Evmftr_R+iPK0j*v@w^|uMyl-w zbt||#SX#C&YDuyWwff4b_4`@FR?tZowd=~)AHZ1kp&feLagL^@UdZ;L=M)n-Tp|)o z^y6Y!ND-uXC*W&Q(FU8-D1lWjQoT0XA1>Q5OY?Y?%T(!Cjcd z^l!c`7h%XZ%xW(V-zHF%0LkWIgW_#N04b3+4w?cxg~AjZ(8vxNbQ!viP~f;>4y&9{ zs$`v`z(*iG#2y*KPjuQL?_iRN2+8Kzsl`4B&nY45r|>vC!4tN?gHsG$#e+~^m=JFV zw+D5J+Yd-nnkJR9>M$rt1pQ$Shs*KUeFd-tFnSazXy>wf+oRrhPJ;4iR5gjcPL8kH&@vI_%0_^mOb z)kMP;{|U#hW|ca>mJmjxH=!s-BNZ2OaWNH_ad8<22||kEM?tAfC{bgDRN4lDswWhq z!#KYpp`$s(8Ie!_!xVQeg1?d5%fIlC2+`}@W3fXV@O9wg5k?y zZrBUmtMOfmZyIfw)Ydzp^j>LofaQg=e*nR`DZmYFG0iTnH>i4@1;LcplxJ z{Yi@X(&cQW*b`pC+T<0}%3aE9e|v4i%-Hjv0hA4LW}njW61 zCs&|XjWlNAnZ=k3>xsV1rLO>C0})nG6gSib5-Oy^GaU`o>P$y?3)y`>s$Pf=VF+o= zW)$)Sh#OTMJ_TW;RNv`?6*H-DJ)y?TZssk+XoI>}iojct-xs6^k$S0tLl9`JK&4_C zE(VvJh(+*6fhu_Q%Iz>iJ6|>$$bCV<*q-4Xw)v6c%U}F|Zix)w~N6A6nAgy5-Ayqo% zQ|Os7a~F)kSY6^<8eRu}67G;)!CJ>I^ZOBljiK;NmhGDep*Z6Y&s`hm(AcN0Q zIZ?vPOU1uOU7`(kSvXRebn`>-+fJs*x4TK=^<^Tlr6l^_rT?M_=og+mG}Cpsu1EGe zS0N3v!265mrjMS3PW7h=%=vKih?_vWV;ZmW(T?qYe*O+2el6Kd*`U(TWA-B{8w8}& zK|gZ+9%TE2obzu-nLgjp{{4)6kC4$>fRhb>G{7>oOzURaek55oQa_n`r;v8h>5e{2 z1=XU&ky17XX&9Z+WCF_q;`7=^pj3fPrPTCnO($7qHBN2v-#WaNNk6k|MFOVGw%m>M z4o}|DTDB~eq;?YcuBMG^R(3yR@$OuiEvu0>mc9aSFb5$|y`j^xjVmR(djQ9P)9>Z! z>?)IVN-K$mR10->p*+IUbiN)(ib@uZK)wK(1il+scaKY_1eA0a`&~Rc(= zwU8K3z=8tCb#8A;{h&Tk98%x${we;^$^R%?qr~|?tB0!M-@o>)4VzDn zHg~kIZcdo)eW8ubxGB`OzB%FG*=i=8v-0M~=1J3O-n^+QxB+)+`H5o!3i9~l2@`hy zA_uo5#?nsPSQc+UI@WNZZO9tCDD8~3AMa>R;2sO#lEMoBrPiP-k(gDM;unDmlXEP> zA5nl+c|5Dw*t~nP>~)WJJQ;0XB{krYfm5K{E^pGFHO*WPZ9DGUK`su8jVA!Obw;nG zWRK(K3!aX>Nv&&(S`+w`^k9jm8+BHGmwDXGC2|BeHmC8P96hG6n-de+PQL54v3VG` zoK3e=tYp|8~oRxYhCBpa1_n@P7bi Cma$j> literal 0 HcmV?d00001 diff --git a/check.ps1 b/check.ps1 new file mode 100644 index 0000000000..2f84d08820 --- /dev/null +++ b/check.ps1 @@ -0,0 +1,9 @@ +#!/usr/bin/env pwsh +Remove-Variable -Name RUSTUP_TOOLCHAIN -ErrorAction SilentlyContinue +$CURRENT_DIR = Split-Path -Leaf -Path (Get-Location) + +if ($CURRENT_DIR -eq "bevy_api_gen") { + cargo +nightly-2024-12-15 clippy --all-targets --message-format=json +} else { + cargo clippy --workspace --all-targets --message-format=json --features="lua54 rhai teal rune bevy/file_watcher bevy/multi_threaded" +} \ No newline at end of file From 427a92de1b274cc5929e602848c86f8d7919ed37 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:17:19 +0000 Subject: [PATCH 109/217] imports --- .../src/bindings/function/from.rs | 18 ++++++++++++++++++ crates/bevy_mod_scripting_functions/src/lib.rs | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index 75b286c418..f8155c0f72 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -166,6 +166,12 @@ impl DerefMut for Val { } } +impl From for Val { + fn from(value: T) -> Self { + Val(value) + } +} + impl FromScript for Val { type This<'w> = Self; fn from_script(value: ScriptValue, world: WorldGuard) -> Result { @@ -246,6 +252,12 @@ impl FromScript for Ref<'_, T> { } } +impl<'a, T> From<&'a T> for Ref<'a, T> { + fn from(value: &'a T) -> Self { + Ref(value) + } +} + /// A wrapper around a mutable reference to a value of type `T`. /// /// This can be used to retrieve a mutable reference out of a [`ScriptValue::Reference`] corresponding to the type `T`. @@ -269,6 +281,12 @@ impl DerefMut for Mut<'_, T> { } } +impl<'a, T> From<&'a mut T> for Mut<'a, T> { + fn from(value: &'a mut T) -> Self { + Mut(value) + } +} + impl FromScript for Mut<'_, T> { type This<'w> = Mut<'w, T>; diff --git a/crates/bevy_mod_scripting_functions/src/lib.rs b/crates/bevy_mod_scripting_functions/src/lib.rs index e70be77fbb..579ed2e3cc 100644 --- a/crates/bevy_mod_scripting_functions/src/lib.rs +++ b/crates/bevy_mod_scripting_functions/src/lib.rs @@ -1,11 +1,14 @@ use ::bevy::prelude::*; #[cfg(feature = "core_functions")] -pub mod bevy; +pub mod bevy_bindings; #[cfg(feature = "core_functions")] pub mod core; pub mod namespaced_register; +pub use core::*; +pub use namespaced_register::*; + pub struct BevyFunctionsPlugin; impl Plugin for BevyFunctionsPlugin { From 593f1c0ba2db0cd8489c653634893c18792d9a45 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:18:16 +0000 Subject: [PATCH 110/217] trigger CI --- .github/workflows/generate_bindings.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generate_bindings.yml b/.github/workflows/generate_bindings.yml index e1b38dc19e..95faf8365d 100644 --- a/.github/workflows/generate_bindings.yml +++ b/.github/workflows/generate_bindings.yml @@ -19,6 +19,7 @@ env: BEVY_FEATURES: bevy_asset,bevy_animation,bevy_core_pipeline,bevy_ui,bevy_pbr,bevy_render,bevy_text,bevy_sprite,file_watcher,multi_threaded BRANCH_NAME: __update-bevy-bindings-${{ github.head_ref || github.ref_name }} GH_TOKEN: ${{ github.token }} + jobs: generate_bindings: permissions: From 9724fd150e040eda1f807271944436ade888eaf5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 22:22:53 +0000 Subject: [PATCH 111/217] chore(codegen): update bevy bindings (#177) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_core.rs | 2 +- .../src/bevy_bindings/bevy_ecs.rs | 6 +++--- .../src/bevy_bindings/bevy_hierarchy.rs | 4 ++-- .../src/bevy_bindings/bevy_input.rs | 16 ++++++++-------- .../src/bevy_bindings/bevy_math.rs | 6 +++--- .../src/bevy_bindings/bevy_reflect.rs | 12 ++++++------ .../src/bevy_bindings/bevy_time.rs | 16 ++++++++-------- .../src/bevy_bindings/bevy_transform.rs | 14 +++++++------- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs index 081708bbfc..7f25f20894 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs @@ -8,7 +8,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyCoreScriptingPlugin; impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs index 5a169ace0c..92cd05c2f1 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -7,7 +7,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyEcsScriptingPlugin; impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -161,7 +161,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, tick: u32| { - let output: () = ::bevy::ecs::component::Tick::set(&mut_self, tick) + let output: () = ::bevy::ecs::component::Tick::set(&mut _self, tick) .into(); output }, @@ -263,7 +263,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { change_tick: Val| { let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( - &mut_self, + &mut _self, change_tick.into(), ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs index 67d78778d3..00288d97f7 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs @@ -9,7 +9,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyHierarchyScriptingPlugin; impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -23,7 +23,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { b_index: usize| { let output: () = ::bevy::hierarchy::prelude::Children::swap( - &mut_self, + &mut _self, a_index, b_index, ) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs index 9a0785920b..932e6fd4e7 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -10,7 +10,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyInputScriptingPlugin; impl ::bevy::app::Plugin for BevyInputScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -947,7 +947,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_press_threshold", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( - &mut_self, + &mut _self, value, ) .into(); @@ -968,7 +968,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_release_threshold", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( - &mut_self, + &mut _self, value, ) .into(); @@ -1014,7 +1014,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_livezone_upperbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( - &mut_self, + &mut _self, value, ) .into(); @@ -1035,7 +1035,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_deadzone_upperbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( - &mut_self, + &mut _self, value, ) .into(); @@ -1056,7 +1056,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_livezone_lowerbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( - &mut_self, + &mut _self, value, ) .into(); @@ -1077,7 +1077,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_deadzone_lowerbound", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( - &mut_self, + &mut _self, value, ) .into(); @@ -1098,7 +1098,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { "set_threshold", |_self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( - &mut_self, + &mut _self, value, ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs index a4874a9b60..13f698390c 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -7,7 +7,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyMathScriptingPlugin; impl ::bevy::app::Plugin for BevyMathScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -2329,7 +2329,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "reverse", |_self: Mut| { let output: () = ::bevy::math::primitives::Triangle2d::reverse( - &mut_self, + &mut _self, ) .into(); output @@ -2872,7 +2872,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "reverse", |_self: Mut| { let output: () = ::bevy::math::primitives::Triangle3d::reverse( - &mut_self, + &mut _self, ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs index 7b3be573bb..c55ce129aa 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -6,7 +6,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyReflectScriptingPlugin; impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -13367,7 +13367,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec2::set(&mut_self, index, value) + let output: () = ::bevy::math::BVec2::set(&mut _self, index, value) .into(); output }, @@ -13444,7 +13444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3::set(&mut_self, index, value) + let output: () = ::bevy::math::BVec3::set(&mut _self, index, value) .into(); output }, @@ -13539,7 +13539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4::set(&mut_self, index, value) + let output: () = ::bevy::math::BVec4::set(&mut _self, index, value) .into(); output }, @@ -21856,7 +21856,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3A::set(&mut_self, index, value) + let output: () = ::bevy::math::BVec3A::set(&mut _self, index, value) .into(); output }, @@ -21951,7 +21951,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "set", |_self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4A::set(&mut_self, index, value) + let output: () = ::bevy::math::BVec4A::set(&mut _self, index, value) .into(); output }, diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs index 9f8557282e..390e71408c 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -8,7 +8,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyTimeScriptingPlugin; impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -110,7 +110,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { mode: Val| { let output: () = ::bevy::time::prelude::Timer::set_mode( - &mut_self, + &mut _self, mode.into(), ) .into(); @@ -120,7 +120,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::pause(&mut_self) + let output: () = ::bevy::time::prelude::Timer::pause(&mut _self) .into(); output }, @@ -128,7 +128,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::unpause(&mut_self) + let output: () = ::bevy::time::prelude::Timer::unpause(&mut _self) .into(); output }, @@ -144,7 +144,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "reset", |_self: Mut| { - let output: () = ::bevy::time::prelude::Timer::reset(&mut_self) + let output: () = ::bevy::time::prelude::Timer::reset(&mut _self) .into(); output }, @@ -292,14 +292,14 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::pause(&mut_self).into(); + let output: () = ::bevy::time::Stopwatch::pause(&mut _self).into(); output }, ) .overwrite_script_function( "unpause", |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::unpause(&mut_self).into(); + let output: () = ::bevy::time::Stopwatch::unpause(&mut _self).into(); output }, ) @@ -313,7 +313,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "reset", |_self: Mut| { - let output: () = ::bevy::time::Stopwatch::reset(&mut_self).into(); + let output: () = ::bevy::time::Stopwatch::reset(&mut _self).into(); output }, ) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs index 99a200579c..690458b2f0 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -11,7 +11,7 @@ use bevy_mod_scripting_core::{ AddContextInitializer, StoreDocumentation, bindings::{ReflectReference, function::from::{Ref, Mut, Val}}, }; -use crate::{*, namespaced_register::NamespaceBuilder}; +use crate::*; pub struct BevyTransformScriptingPlugin; impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { @@ -174,7 +174,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_x", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_x( - &mut_self, + &mut _self, angle, ) .into(); @@ -185,7 +185,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_y", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_y( - &mut_self, + &mut _self, angle, ) .into(); @@ -196,7 +196,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_z", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_z( - &mut_self, + &mut _self, angle, ) .into(); @@ -207,7 +207,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_local_x", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_x( - &mut_self, + &mut _self, angle, ) .into(); @@ -218,7 +218,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_local_y", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_y( - &mut_self, + &mut _self, angle, ) .into(); @@ -229,7 +229,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { "rotate_local_z", |_self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_z( - &mut_self, + &mut _self, angle, ) .into(); From 3a3a8c152c07ff2226d43f86bc0e0d3fdd0eb672 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:26:05 +0000 Subject: [PATCH 112/217] trait things --- crates/bevy_api_gen/templates/footer.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 201355bd81..867624c59f 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -36,7 +36,7 @@ impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_c _{{- arg.ident -}} {%- endif -%} {%- if arg.proxy_ty is matching("Val.*")-%} - .into() + .into_inner() {%- endif -%}, {%- endfor -%} ).into(); From 972ee1f1a5172ea0df154a151cc25c98cd5b7407 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:28:24 +0000 Subject: [PATCH 113/217] clean up versions from last pre-release --- Cargo.toml | 14 +++++++------- crates/bevy_event_priority/Cargo.toml | 2 +- crates/bevy_mod_scripting_common/Cargo.toml | 2 +- crates/bevy_mod_scripting_core/Cargo.toml | 2 +- crates/bevy_mod_scripting_functions/Cargo.toml | 2 +- crates/bevy_script_api/Cargo.toml | 8 ++++---- crates/languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_lua_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rhai/Cargo.toml | 2 +- .../bevy_mod_scripting_rhai_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rune/Cargo.toml | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1a6f1083c9..977c563957 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting" -version = "0.8.0-alpha.2" +version = "0.8.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -54,16 +54,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.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_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.8.0", optional = true } +bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0", optional = true } +bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0", optional = true } bevy_mod_scripting_functions = { workspace = 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.2" } -bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0-alpha.2" } -bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.8.0-alpha.2" } +bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.8.0" } +bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0" } +bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.8.0" } test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } diff --git a/crates/bevy_event_priority/Cargo.toml b/crates/bevy_event_priority/Cargo.toml index 44b49b815a..e1d2a8f607 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.2" +version = "0.8.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 0d4ce7ee34..077e270cd6 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.2" +version = "0.8.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 1e47a8ee05..bdeacbfe12 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.2" +version = "0.8.0" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 60170ee11e..77444c8c30 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_functions" -version = "0.8.0-alpha.2" +version = "0.8.0" edition = "2021" authors = ["Maksymilian Mozolewski "] license = "MIT OR Apache-2.0" diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index faabc3bff8..63cea79603 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.2" +version = "0.8.0" 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.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 } +bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.8.0", optional = true } +bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0", optional = true } +bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0", optional = true } smol_str = "0.2" allocator-api2 = "0.2" diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 94a261292a..9707c5d9b6 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.2" +version = "0.8.0" 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 476d102e60..d98ff8f635 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.2" +version = "0.8.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.8.0-alpha.2" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.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 c19a9db60b..c3965c975c 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.2" +version = "0.8.0" 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 ae9005e157..8ffd9d2dce 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.2" +version = "0.8.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.8.0-alpha.2" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.8.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 c3d9bef3e8..b24a7c185c 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.2" +version = "0.8.0" edition = "2021" license = "MIT OR Apache-2.0" description = "Necessary functionality for Rune support with bevy_mod_scripting" From 287ea6b8307d4bd29b1836b265c61068f0e98998 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:29:48 +0000 Subject: [PATCH 114/217] select new pre-release version --- Cargo.toml | 14 +++++++------- crates/bevy_event_priority/Cargo.toml | 2 +- crates/bevy_mod_scripting_common/Cargo.toml | 2 +- crates/bevy_mod_scripting_core/Cargo.toml | 2 +- crates/bevy_mod_scripting_functions/Cargo.toml | 2 +- crates/bevy_script_api/Cargo.toml | 8 ++++---- crates/languages/bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_lua_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rhai/Cargo.toml | 2 +- .../bevy_mod_scripting_rhai_derive/Cargo.toml | 4 ++-- .../languages/bevy_mod_scripting_rune/Cargo.toml | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 977c563957..e22af7cd87 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting" -version = "0.8.0" +version = "0.9.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -54,16 +54,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", optional = true } -bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.8.0", optional = true } -bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.8.0", optional = true } +bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.9.0-alpha.1", optional = true } +bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.9.0-alpha.1", optional = true } +bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.9.0-alpha.1", optional = true } bevy_mod_scripting_functions = { workspace = 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" } -bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.8.0" } -bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.8.0" } +bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.9.0-alpha.1" } +bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.9.0-alpha.1" } +bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1" } test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } diff --git a/crates/bevy_event_priority/Cargo.toml b/crates/bevy_event_priority/Cargo.toml index e1d2a8f607..eaabdb5e11 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" +version = "0.9.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 077e270cd6..0adb317a98 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" +version = "0.9.0-alpha.1" 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 bdeacbfe12..d1e6d0a0c7 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" +version = "0.9.0-alpha.1" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 77444c8c30..db912de8c1 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_functions" -version = "0.8.0" +version = "0.9.0-alpha.1" edition = "2021" authors = ["Maksymilian Mozolewski "] license = "MIT OR Apache-2.0" diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml index 63cea79603..62cca97815 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" +version = "0.9.0-alpha.1" 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", optional = true } -bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.8.0", optional = true } -bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.8.0", optional = true } +bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua", version = "0.9.0-alpha.1", optional = true } +bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.9.0-alpha.1", optional = true } +bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.9.0-alpha.1", optional = true } smol_str = "0.2" allocator-api2 = "0.2" diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 9707c5d9b6..0f002f3940 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" +version = "0.9.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 d98ff8f635..68b9016e77 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" +version = "0.9.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" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.9.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/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index c3965c975c..deb65b5e2c 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" +version = "0.9.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 8ffd9d2dce..9977701fe6 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" +version = "0.9.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" } +bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.9.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/Cargo.toml b/crates/languages/bevy_mod_scripting_rune/Cargo.toml index b24a7c185c..c929657bd8 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" +version = "0.9.0-alpha.1" edition = "2021" license = "MIT OR Apache-2.0" description = "Necessary functionality for Rune support with bevy_mod_scripting" From 2311322d6596a6375c75dc4533402ff6c7ceb818 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 22:31:15 +0000 Subject: [PATCH 115/217] chore(codegen): update bevy bindings (#178) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_ecs.rs | 40 +- .../src/bevy_bindings/bevy_input.rs | 6 +- .../src/bevy_bindings/bevy_math.rs | 200 +- .../src/bevy_bindings/bevy_reflect.rs | 4971 +++++++++-------- .../src/bevy_bindings/bevy_time.rs | 4 +- .../src/bevy_bindings/bevy_transform.rs | 20 +- 6 files changed, 2772 insertions(+), 2469 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs index 92cd05c2f1..372a31ec2e 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -47,7 +47,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = ::bevy::ecs::entity::Entity::to_bits(_self.into()) + let output: u64 = ::bevy::ecs::entity::Entity::to_bits( + _self.into_inner(), + ) .into(); output }, @@ -65,7 +67,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: u32 = ::bevy::ecs::entity::Entity::index(_self.into()) + let output: u32 = ::bevy::ecs::entity::Entity::index( + _self.into_inner(), + ) .into(); output }, @@ -74,7 +78,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "generation", |_self: Val| { let output: u32 = ::bevy::ecs::entity::Entity::generation( - _self.into(), + _self.into_inner(), ) .into(); output @@ -133,7 +137,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "index", |_self: Val| { let output: usize = ::bevy::ecs::component::ComponentId::index( - _self.into(), + _self.into_inner(), ) .into(); output @@ -153,7 +157,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "get", |_self: Val| { - let output: u32 = ::bevy::ecs::component::Tick::get(_self.into()) + let output: u32 = ::bevy::ecs::component::Tick::get( + _self.into_inner(), + ) .into(); output }, @@ -174,9 +180,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { this_run: Val| { let output: bool = ::bevy::ecs::component::Tick::is_newer_than( - _self.into(), - last_run.into(), - this_run.into(), + _self.into_inner(), + last_run.into_inner(), + this_run.into_inner(), ) .into(); output @@ -223,8 +229,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { { let output: bool = ::bevy::ecs::component::ComponentTicks::is_added( &_self, - last_run.into(), - this_run.into(), + last_run.into_inner(), + this_run.into_inner(), ) .into(); output @@ -239,8 +245,8 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { { let output: bool = ::bevy::ecs::component::ComponentTicks::is_changed( &_self, - last_run.into(), - this_run.into(), + last_run.into_inner(), + this_run.into_inner(), ) .into(); output @@ -250,7 +256,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "new", |change_tick: Val| { let output: Val = ::bevy::ecs::component::ComponentTicks::new( - change_tick.into(), + change_tick.into_inner(), ) .into(); output @@ -264,7 +270,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { { let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( &mut _self, - change_tick.into(), + change_tick.into_inner(), ) .into(); output @@ -295,7 +301,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "low", |_self: Val| { let output: u32 = ::bevy::ecs::identifier::Identifier::low( - _self.into(), + _self.into_inner(), ) .into(); output @@ -305,7 +311,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "masked_high", |_self: Val| { let output: u32 = ::bevy::ecs::identifier::Identifier::masked_high( - _self.into(), + _self.into_inner(), ) .into(); output @@ -315,7 +321,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { "to_bits", |_self: Val| { let output: u64 = ::bevy::ecs::identifier::Identifier::to_bits( - _self.into(), + _self.into_inner(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs index 932e6fd4e7..9b9078f930 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -44,7 +44,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { { let output: bool = ::bevy::input::gamepad::Gamepad::pressed( &_self, - button_type.into(), + button_type.into_inner(), ) .into(); output @@ -58,7 +58,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { { let output: bool = ::bevy::input::gamepad::Gamepad::just_pressed( &_self, - button_type.into(), + button_type.into_inner(), ) .into(); output @@ -72,7 +72,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { { let output: bool = ::bevy::input::gamepad::Gamepad::just_released( &_self, - button_type.into(), + button_type.into_inner(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs index 13f698390c..1d0b196b97 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -144,7 +144,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_rotation", |rotation: Val| { let output: Val = ::bevy::math::Isometry2d::from_rotation( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -176,7 +176,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Isometry2d::inverse_mul( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -199,8 +199,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val| { let output: Val = ::bevy::math::Isometry2d::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -210,8 +210,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Isometry2d::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -233,8 +233,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val| { let output: Val = ::bevy::math::Isometry3d::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -267,7 +267,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Isometry3d::inverse_mul( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -287,8 +287,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Isometry3d::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -353,8 +353,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { direction: Val| { let output: Val = ::bevy::math::Rot2::mul( - _self.into(), - direction.into(), + _self.into_inner(), + direction.into_inner(), ) .into(); output @@ -364,8 +364,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Rot2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -415,7 +415,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_radians", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_radians(_self.into()) + let output: f32 = ::bevy::math::Rot2::as_radians(_self.into_inner()) .into(); output }, @@ -423,7 +423,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_degrees", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_degrees(_self.into()) + let output: f32 = ::bevy::math::Rot2::as_degrees(_self.into_inner()) .into(); output }, @@ -431,7 +431,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_turn_fraction", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_turn_fraction(_self.into()) + let output: f32 = ::bevy::math::Rot2::as_turn_fraction( + _self.into_inner(), + ) .into(); output }, @@ -439,7 +441,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sin_cos", |_self: Val| { - let output: (f32, f32) = ::bevy::math::Rot2::sin_cos(_self.into()) + let output: (f32, f32) = ::bevy::math::Rot2::sin_cos( + _self.into_inner(), + ) .into(); output }, @@ -447,14 +451,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length(_self.into()).into(); + let output: f32 = ::bevy::math::Rot2::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length_squared(_self.into()) + let output: f32 = ::bevy::math::Rot2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -462,7 +469,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length_recip(_self.into()) + let output: f32 = ::bevy::math::Rot2::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -471,7 +480,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::Rot2::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -481,7 +490,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "fast_renormalize", |_self: Val| { let output: Val = ::bevy::math::Rot2::fast_renormalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -490,7 +499,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_finite(_self.into()) + let output: bool = ::bevy::math::Rot2::is_finite(_self.into_inner()) .into(); output }, @@ -498,14 +507,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Rot2::is_nan(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_normalized(_self.into()) + let output: bool = ::bevy::math::Rot2::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -513,7 +525,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_near_identity(_self.into()) + let output: bool = ::bevy::math::Rot2::is_near_identity( + _self.into_inner(), + ) .into(); output }, @@ -522,8 +536,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "angle_between", |_self: Val, other: Val| { let output: f32 = ::bevy::math::Rot2::angle_between( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -533,8 +547,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "angle_to", |_self: Val, other: Val| { let output: f32 = ::bevy::math::Rot2::angle_to( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -544,7 +558,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "inverse", |_self: Val| { let output: Val = ::bevy::math::Rot2::inverse( - _self.into(), + _self.into_inner(), ) .into(); output @@ -554,8 +568,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "nlerp", |_self: Val, end: Val, s: f32| { let output: Val = ::bevy::math::Rot2::nlerp( - _self.into(), - end.into(), + _self.into_inner(), + end.into_inner(), s, ) .into(); @@ -566,8 +580,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "slerp", |_self: Val, end: Val, s: f32| { let output: Val = ::bevy::math::Rot2::slerp( - _self.into(), - end.into(), + _self.into_inner(), + end.into_inner(), s, ) .into(); @@ -587,7 +601,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -633,8 +647,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { s: f32| { let output: Val = ::bevy::math::prelude::Dir2::slerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -648,8 +662,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::Dir2::rotation_to( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -662,8 +676,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: Val = ::bevy::math::prelude::Dir2::rotation_from( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -673,7 +687,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "rotation_from_x", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir2::rotation_from_x( - _self.into(), + _self.into_inner(), ) .into(); output @@ -683,7 +697,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "rotation_to_x", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir2::rotation_to_x( - _self.into(), + _self.into_inner(), ) .into(); output @@ -693,7 +707,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "rotation_from_y", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir2::rotation_from_y( - _self.into(), + _self.into_inner(), ) .into(); output @@ -703,7 +717,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "rotation_to_y", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir2::rotation_to_y( - _self.into(), + _self.into_inner(), ) .into(); output @@ -713,7 +727,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "fast_renormalize", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir2::fast_renormalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -734,7 +748,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -771,8 +785,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { s: f32| { let output: Val = ::bevy::math::prelude::Dir3::slerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -783,7 +797,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "fast_renormalize", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir3::fast_renormalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -794,7 +808,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir3A::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -820,8 +834,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { s: f32| { let output: Val = ::bevy::math::prelude::Dir3A::slerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -832,7 +846,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "fast_renormalize", |_self: Val| { let output: Val = ::bevy::math::prelude::Dir3A::fast_renormalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -925,7 +939,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::IRect::union( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -939,7 +953,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::IRect::intersect( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -1030,7 +1044,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::Rect::union( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -1044,7 +1058,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::Rect::intersect( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -1069,7 +1083,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::Rect::normalize( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -1161,7 +1175,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::URect::union( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -1175,7 +1189,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: Val = ::bevy::math::prelude::URect::intersect( &_self, - other.into(), + other.into_inner(), ) .into(); output @@ -2263,7 +2277,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |direction: Val, length: f32| { let output: Val = ::bevy::math::primitives::Segment2d::new( - direction.into(), + direction.into_inner(), length, ) .into(); @@ -2339,7 +2353,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "reversed", |_self: Val| { let output: Val = ::bevy::math::primitives::Triangle2d::reversed( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2750,7 +2764,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "new", |direction: Val, length: f32| { let output: Val = ::bevy::math::primitives::Segment3d::new( - direction.into(), + direction.into_inner(), length, ) .into(); @@ -2882,7 +2896,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "reversed", |_self: Val| { let output: Val = ::bevy::math::primitives::Triangle3d::reversed( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2917,7 +2931,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_ray", |ray: Val, max: f32| { let output: Val = ::bevy::math::bounding::RayCast2d::from_ray( - ray.into(), + ray.into_inner(), max, ) .into(); @@ -2981,8 +2995,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { max: f32| { let output: Val = ::bevy::math::bounding::AabbCast2d::from_ray( - aabb.into(), - ray.into(), + aabb.into_inner(), + ray.into_inner(), max, ) .into(); @@ -2997,7 +3011,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: std::option::Option = ::bevy::math::bounding::AabbCast2d::aabb_collision_at( &_self, - aabb.into(), + aabb.into_inner(), ) .into(); output @@ -3012,8 +3026,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { max: f32| { let output: Val = ::bevy::math::bounding::BoundingCircleCast::from_ray( - circle.into(), - ray.into(), + circle.into_inner(), + ray.into_inner(), max, ) .into(); @@ -3028,7 +3042,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: std::option::Option = ::bevy::math::bounding::BoundingCircleCast::circle_collision_at( &_self, - circle.into(), + circle.into_inner(), ) .into(); output @@ -3049,7 +3063,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "from_ray", |ray: Val, max: f32| { let output: Val = ::bevy::math::bounding::RayCast3d::from_ray( - ray.into(), + ray.into_inner(), max, ) .into(); @@ -3103,8 +3117,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { max: f32| { let output: Val = ::bevy::math::bounding::AabbCast3d::from_ray( - aabb.into(), - ray.into(), + aabb.into_inner(), + ray.into_inner(), max, ) .into(); @@ -3119,7 +3133,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: std::option::Option = ::bevy::math::bounding::AabbCast3d::aabb_collision_at( &_self, - aabb.into(), + aabb.into_inner(), ) .into(); output @@ -3154,8 +3168,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { max: f32| { let output: Val = ::bevy::math::bounding::BoundingSphereCast::from_ray( - sphere.into(), - ray.into(), + sphere.into_inner(), + ray.into_inner(), max, ) .into(); @@ -3170,7 +3184,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { { let output: std::option::Option = ::bevy::math::bounding::BoundingSphereCast::sphere_collision_at( &_self, - sphere.into(), + sphere.into_inner(), ) .into(); output @@ -3191,7 +3205,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "start", |_self: Val| { let output: f32 = ::bevy::math::curve::interval::Interval::start( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3201,7 +3215,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "end", |_self: Val| { let output: f32 = ::bevy::math::curve::interval::Interval::end( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3211,7 +3225,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "length", |_self: Val| { let output: f32 = ::bevy::math::curve::interval::Interval::length( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3221,7 +3235,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "is_bounded", |_self: Val| { let output: bool = ::bevy::math::curve::interval::Interval::is_bounded( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3231,7 +3245,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "has_finite_start", |_self: Val| { let output: bool = ::bevy::math::curve::interval::Interval::has_finite_start( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3241,7 +3255,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "has_finite_end", |_self: Val| { let output: bool = ::bevy::math::curve::interval::Interval::has_finite_end( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3251,7 +3265,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "contains", |_self: Val, item: f32| { let output: bool = ::bevy::math::curve::interval::Interval::contains( - _self.into(), + _self.into_inner(), item, ) .into(); @@ -3265,8 +3279,8 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { other: Val| { let output: bool = ::bevy::math::curve::interval::Interval::contains_interval( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -3276,7 +3290,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "clamp", |_self: Val, value: f32| { let output: f32 = ::bevy::math::curve::interval::Interval::clamp( - _self.into(), + _self.into_inner(), value, ) .into(); @@ -3340,7 +3354,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::FloatOrd::neg( - _self.into(), + _self.into_inner(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs index c55ce129aa..beb1d85ddb 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -26,7 +26,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: bool = ::std::sync::atomic::AtomicBool::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -47,7 +47,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: i16 = ::std::sync::atomic::AtomicI16::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -68,7 +68,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: i32 = ::std::sync::atomic::AtomicI32::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -89,7 +89,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: i64 = ::std::sync::atomic::AtomicI64::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -110,7 +110,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: i8 = ::std::sync::atomic::AtomicI8::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -131,7 +131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: isize = ::std::sync::atomic::AtomicIsize::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -152,7 +152,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: u16 = ::std::sync::atomic::AtomicU16::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -173,7 +173,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: u32 = ::std::sync::atomic::AtomicU32::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -194,7 +194,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: u64 = ::std::sync::atomic::AtomicU64::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -215,7 +215,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: u8 = ::std::sync::atomic::AtomicU8::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -236,7 +236,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "into_inner", |_self: Val| { let output: usize = ::std::sync::atomic::AtomicUsize::into_inner( - _self.into(), + _self.into_inner(), ) .into(); output @@ -247,7 +247,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u32| { let output: Val = ::bevy::utils::Duration::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -278,8 +278,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::utils::Duration::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -289,8 +289,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::utils::Duration::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -308,7 +308,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u32| { let output: Val = ::bevy::utils::Duration::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -429,8 +429,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs_diff", |_self: Val, other: Val| { let output: Val = ::bevy::utils::Duration::abs_diff( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -440,8 +440,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::utils::Duration::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -451,8 +451,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::utils::Duration::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -462,7 +462,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: u32| { let output: Val = ::bevy::utils::Duration::saturating_mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -509,7 +509,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_f64", |_self: Val, rhs: f64| { let output: Val = ::bevy::utils::Duration::mul_f64( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -520,7 +520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_f32", |_self: Val, rhs: f32| { let output: Val = ::bevy::utils::Duration::mul_f32( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -531,7 +531,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_f64", |_self: Val, rhs: f64| { let output: Val = ::bevy::utils::Duration::div_f64( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -542,7 +542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_f32", |_self: Val, rhs: f32| { let output: Val = ::bevy::utils::Duration::div_f32( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -553,8 +553,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_duration_f64", |_self: Val, rhs: Val| { let output: f64 = ::bevy::utils::Duration::div_duration_f64( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -564,8 +564,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_duration_f32", |_self: Val, rhs: Val| { let output: f32 = ::bevy::utils::Duration::div_duration_f32( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -593,8 +593,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, other: Val| { let output: Val = ::bevy::utils::Instant::sub( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -604,8 +604,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, other: Val| { let output: Val = ::bevy::utils::Instant::sub( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -624,7 +624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, earlier: Val| { let output: Val = ::bevy::utils::Instant::duration_since( &_self, - earlier.into(), + earlier.into_inner(), ) .into(); output @@ -635,7 +635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, earlier: Val| { let output: Val = ::bevy::utils::Instant::saturating_duration_since( &_self, - earlier.into(), + earlier.into_inner(), ) .into(); output @@ -665,8 +665,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, other: Val| { let output: Val = ::bevy::utils::Instant::add( - _self.into(), - other.into(), + _self.into_inner(), + other.into_inner(), ) .into(); output @@ -705,8 +705,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -716,8 +716,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -742,8 +742,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -753,7 +753,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Quat::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -764,8 +764,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -775,7 +775,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Quat::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -785,8 +785,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -796,7 +796,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Quat::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -828,7 +828,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_vec4", |v: Val| { let output: Val = ::bevy::math::Quat::from_vec4( - v.into(), + v.into_inner(), ) .into(); output @@ -838,7 +838,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f32| { let output: Val = ::bevy::math::Quat::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -849,7 +849,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scaled_axis", |v: Val| { let output: Val = ::bevy::math::Quat::from_scaled_axis( - v.into(), + v.into_inner(), ) .into(); output @@ -889,7 +889,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |euler: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Quat::from_euler( - euler.into(), + euler.into_inner(), a, b, c, @@ -932,8 +932,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_arc", |from: Val, to: Val| { let output: Val = ::bevy::math::Quat::from_rotation_arc( - from.into(), - to.into(), + from.into_inner(), + to.into_inner(), ) .into(); output @@ -943,8 +943,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_arc_colinear", |from: Val, to: Val| { let output: Val = ::bevy::math::Quat::from_rotation_arc_colinear( - from.into(), - to.into(), + from.into_inner(), + to.into_inner(), ) .into(); output @@ -954,8 +954,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_arc_2d", |from: Val, to: Val| { let output: Val = ::bevy::math::Quat::from_rotation_arc_2d( - from.into(), - to.into(), + from.into_inner(), + to.into_inner(), ) .into(); output @@ -965,7 +965,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_scaled_axis", |_self: Val| { let output: Val = ::bevy::math::Quat::to_scaled_axis( - _self.into(), + _self.into_inner(), ) .into(); output @@ -975,8 +975,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Val, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Quat::to_euler( - _self.into(), - order.into(), + _self.into_inner(), + order.into_inner(), ) .into(); output @@ -993,7 +993,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "xyz", |_self: Val| { let output: Val = ::bevy::math::Quat::xyz( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1003,7 +1003,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "conjugate", |_self: Val| { let output: Val = ::bevy::math::Quat::conjugate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1013,7 +1013,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Val| { let output: Val = ::bevy::math::Quat::inverse( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1022,7 +1022,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Quat::dot(_self.into(), rhs.into()) + let output: f32 = ::bevy::math::Quat::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -1030,14 +1033,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Quat::length(_self.into()).into(); + let output: f32 = ::bevy::math::Quat::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Quat::length_squared(_self.into()) + let output: f32 = ::bevy::math::Quat::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -1045,7 +1051,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Quat::length_recip(_self.into()) + let output: f32 = ::bevy::math::Quat::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -1054,7 +1062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::Quat::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1063,7 +1071,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_finite(_self.into()) + let output: bool = ::bevy::math::Quat::is_finite(_self.into_inner()) .into(); output }, @@ -1071,14 +1079,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Quat::is_nan(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_normalized(_self.into()) + let output: bool = ::bevy::math::Quat::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -1086,7 +1097,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_near_identity(_self.into()) + let output: bool = ::bevy::math::Quat::is_near_identity( + _self.into_inner(), + ) .into(); output }, @@ -1095,8 +1108,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Quat::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1111,7 +1124,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::Quat::rotate_towards( &_self, - rhs.into(), + rhs.into_inner(), max_angle, ) .into(); @@ -1126,8 +1139,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Quat::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -1138,8 +1151,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, end: Val, s: f32| { let output: Val = ::bevy::math::Quat::lerp( - _self.into(), - end.into(), + _self.into_inner(), + end.into_inner(), s, ) .into(); @@ -1150,8 +1163,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "slerp", |_self: Val, end: Val, s: f32| { let output: Val = ::bevy::math::Quat::slerp( - _self.into(), - end.into(), + _self.into_inner(), + end.into_inner(), s, ) .into(); @@ -1162,8 +1175,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul_vec3( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1173,8 +1186,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_quat", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul_quat( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1194,8 +1207,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3a", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Quat::mul_vec3a( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1205,7 +1218,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_dquat", |_self: Val| { let output: Val = ::bevy::math::Quat::as_dquat( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1216,7 +1229,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -1227,8 +1240,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1238,8 +1251,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1249,7 +1262,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -1260,7 +1273,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -1271,7 +1284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -1282,7 +1295,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -1293,7 +1306,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Vec3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1303,7 +1316,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -1334,9 +1347,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -1361,7 +1374,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: f32| { let output: Val = ::bevy::math::Vec3::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -1372,7 +1385,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::Vec3::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1382,7 +1395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec3::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -1393,7 +1406,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec3::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -1404,7 +1417,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec3::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -1414,7 +1427,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::dot(_self.into(), rhs.into()) + let output: f32 = ::bevy::math::Vec3::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -1423,8 +1439,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1434,8 +1450,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1445,8 +1461,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1456,8 +1472,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1471,9 +1487,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::Vec3::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -1482,7 +1498,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::min_element(_self.into()) + let output: f32 = ::bevy::math::Vec3::min_element(_self.into_inner()) .into(); output }, @@ -1490,7 +1506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::max_element(_self.into()) + let output: f32 = ::bevy::math::Vec3::max_element(_self.into_inner()) .into(); output }, @@ -1498,7 +1514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::element_sum(_self.into()) + let output: f32 = ::bevy::math::Vec3::element_sum(_self.into_inner()) .into(); output }, @@ -1506,7 +1522,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::element_product(_self.into()) + let output: f32 = ::bevy::math::Vec3::element_product( + _self.into_inner(), + ) .into(); output }, @@ -1515,8 +1533,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1526,8 +1544,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1537,8 +1555,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1548,8 +1566,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1559,8 +1577,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1570,8 +1588,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1581,7 +1599,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::Vec3::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1591,7 +1609,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::Vec3::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1601,8 +1619,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1612,7 +1630,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::Vec3::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1621,7 +1639,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_finite(_self.into()) + let output: bool = ::bevy::math::Vec3::is_finite(_self.into_inner()) .into(); output }, @@ -1630,7 +1648,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::Vec3::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1639,7 +1657,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Vec3::is_nan(_self.into_inner()) + .into(); output }, ) @@ -1647,7 +1666,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::Vec3::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1656,14 +1675,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length(_self.into()).into(); + let output: f32 = ::bevy::math::Vec3::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length_squared(_self.into()) + let output: f32 = ::bevy::math::Vec3::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -1671,7 +1693,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length_recip(_self.into()) + let output: f32 = ::bevy::math::Vec3::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -1680,8 +1704,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec3::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1691,8 +1715,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec3::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1702,8 +1726,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1713,8 +1737,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1724,7 +1748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::Vec3::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1734,8 +1758,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::Vec3::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -1745,7 +1769,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::Vec3::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1754,7 +1778,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_normalized(_self.into()) + let output: bool = ::bevy::math::Vec3::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -1763,8 +1789,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1774,8 +1800,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1785,8 +1811,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1796,8 +1822,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1807,7 +1833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::Vec3::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1817,7 +1843,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::Vec3::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1827,7 +1853,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::Vec3::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1837,7 +1863,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::Vec3::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1847,7 +1873,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::Vec3::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1857,7 +1883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::Vec3::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1867,7 +1893,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::Vec3::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1877,7 +1903,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec3::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -1888,7 +1914,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::Vec3::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -1898,8 +1924,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = ::bevy::math::Vec3::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -1911,7 +1937,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec3::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -1922,8 +1948,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -1937,8 +1963,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Vec3::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -1949,7 +1975,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec3::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -1961,7 +1987,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec3::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -1972,7 +1998,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec3::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -1987,9 +2013,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::Vec3::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -1999,8 +2025,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::Vec3::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -2010,8 +2036,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "refract", |_self: Val, normal: Val, eta: f32| { let output: Val = ::bevy::math::Vec3::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -2022,8 +2048,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec3::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2111,7 +2137,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2122,8 +2148,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2133,7 +2159,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2144,8 +2170,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2155,7 +2181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2166,7 +2192,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2177,8 +2203,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2196,7 +2222,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec2::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2207,7 +2233,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec2::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2218,8 +2244,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2249,9 +2275,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::IVec2::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -2278,7 +2304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, z: i32| { let output: Val = ::bevy::math::IVec2::extend( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -2289,7 +2315,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: i32| { let output: Val = ::bevy::math::IVec2::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -2300,7 +2326,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: i32| { let output: Val = ::bevy::math::IVec2::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -2310,7 +2336,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::dot(_self.into(), rhs.into()) + let output: i32 = ::bevy::math::IVec2::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -2319,8 +2348,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2330,8 +2359,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2341,8 +2370,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2356,9 +2385,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::IVec2::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -2367,7 +2396,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::min_element(_self.into()) + let output: i32 = ::bevy::math::IVec2::min_element( + _self.into_inner(), + ) .into(); output }, @@ -2375,7 +2406,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::max_element(_self.into()) + let output: i32 = ::bevy::math::IVec2::max_element( + _self.into_inner(), + ) .into(); output }, @@ -2383,7 +2416,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::element_sum(_self.into()) + let output: i32 = ::bevy::math::IVec2::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -2391,7 +2426,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::element_product(_self.into()) + let output: i32 = ::bevy::math::IVec2::element_product( + _self.into_inner(), + ) .into(); output }, @@ -2400,8 +2437,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2411,8 +2448,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2422,8 +2459,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2433,8 +2470,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2444,8 +2481,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2455,8 +2492,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2466,7 +2503,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::IVec2::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2476,7 +2513,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::IVec2::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2486,7 +2523,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::IVec2::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2495,7 +2532,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::length_squared(_self.into()) + let output: i32 = ::bevy::math::IVec2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -2504,8 +2543,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: i32 = ::bevy::math::IVec2::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2515,8 +2554,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2526,8 +2565,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2537,7 +2576,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp", |_self: Val| { let output: Val = ::bevy::math::IVec2::perp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2547,8 +2586,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp_dot", |_self: Val, rhs: Val| { let output: i32 = ::bevy::math::IVec2::perp_dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2558,8 +2597,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rotate", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::rotate( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2619,8 +2658,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2630,8 +2669,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2641,8 +2680,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2652,8 +2691,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2663,8 +2702,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2674,8 +2713,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2685,8 +2724,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2696,8 +2735,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2707,8 +2746,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::wrapping_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2718,8 +2757,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::wrapping_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2729,8 +2768,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::saturating_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2740,8 +2779,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::saturating_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2751,8 +2790,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2762,7 +2801,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec2::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2773,7 +2812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec2::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2784,7 +2823,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::IVec2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -2794,7 +2833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec2::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2805,7 +2844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2816,7 +2855,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2827,8 +2866,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2838,7 +2877,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec2::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2849,7 +2888,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec2::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2860,7 +2899,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec2::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2871,8 +2910,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2889,8 +2928,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec2::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2921,7 +2960,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec3::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -2932,7 +2971,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2943,7 +2982,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec3::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -2954,8 +2993,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -2965,8 +3004,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3000,9 +3039,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::IVec3::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -3029,7 +3068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: i32| { let output: Val = ::bevy::math::IVec3::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -3040,7 +3079,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::IVec3::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3050,7 +3089,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: i32| { let output: Val = ::bevy::math::IVec3::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -3061,7 +3100,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: i32| { let output: Val = ::bevy::math::IVec3::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -3072,7 +3111,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: i32| { let output: Val = ::bevy::math::IVec3::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -3082,7 +3121,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec3::dot(_self.into(), rhs.into()) + let output: i32 = ::bevy::math::IVec3::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -3091,8 +3133,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3102,8 +3144,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3113,8 +3155,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3124,8 +3166,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3139,9 +3181,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::IVec3::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -3150,7 +3192,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::min_element(_self.into()) + let output: i32 = ::bevy::math::IVec3::min_element( + _self.into_inner(), + ) .into(); output }, @@ -3158,7 +3202,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::max_element(_self.into()) + let output: i32 = ::bevy::math::IVec3::max_element( + _self.into_inner(), + ) .into(); output }, @@ -3166,7 +3212,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::element_sum(_self.into()) + let output: i32 = ::bevy::math::IVec3::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -3174,7 +3222,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::element_product(_self.into()) + let output: i32 = ::bevy::math::IVec3::element_product( + _self.into_inner(), + ) .into(); output }, @@ -3183,8 +3233,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3194,8 +3244,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3205,8 +3255,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3216,8 +3266,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3227,8 +3277,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3238,8 +3288,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3249,7 +3299,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::IVec3::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3259,7 +3309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::IVec3::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3269,7 +3319,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::IVec3::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3278,7 +3328,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::length_squared(_self.into()) + let output: i32 = ::bevy::math::IVec3::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -3287,8 +3339,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: i32 = ::bevy::math::IVec3::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3298,8 +3350,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3309,8 +3361,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3380,8 +3432,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3391,8 +3443,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3402,8 +3454,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3413,8 +3465,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3424,8 +3476,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3435,8 +3487,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3446,8 +3498,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3457,8 +3509,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3468,8 +3520,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::wrapping_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3479,8 +3531,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::wrapping_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3490,8 +3542,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::saturating_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3501,8 +3553,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::saturating_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3512,7 +3564,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -3523,8 +3575,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3534,7 +3586,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec3::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -3545,8 +3597,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3556,7 +3608,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec3::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -3567,8 +3619,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3595,7 +3647,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec3::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -3606,7 +3658,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec3::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -3617,7 +3669,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::IVec3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3627,7 +3679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec3::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -3648,7 +3700,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec3::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -3660,7 +3712,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -3671,7 +3723,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::IVec4::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3706,9 +3758,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::IVec4::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -3735,7 +3787,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::IVec4::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3745,7 +3797,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: i32| { let output: Val = ::bevy::math::IVec4::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -3756,7 +3808,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: i32| { let output: Val = ::bevy::math::IVec4::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -3767,7 +3819,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: i32| { let output: Val = ::bevy::math::IVec4::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -3778,7 +3830,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_w", |_self: Val, w: i32| { let output: Val = ::bevy::math::IVec4::with_w( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -3788,7 +3840,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec4::dot(_self.into(), rhs.into()) + let output: i32 = ::bevy::math::IVec4::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -3797,8 +3852,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3808,8 +3863,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3819,8 +3874,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3834,9 +3889,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::IVec4::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -3845,7 +3900,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::min_element(_self.into()) + let output: i32 = ::bevy::math::IVec4::min_element( + _self.into_inner(), + ) .into(); output }, @@ -3853,7 +3910,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::max_element(_self.into()) + let output: i32 = ::bevy::math::IVec4::max_element( + _self.into_inner(), + ) .into(); output }, @@ -3861,7 +3920,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::element_sum(_self.into()) + let output: i32 = ::bevy::math::IVec4::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -3869,7 +3930,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::element_product(_self.into()) + let output: i32 = ::bevy::math::IVec4::element_product( + _self.into_inner(), + ) .into(); output }, @@ -3878,8 +3941,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3889,8 +3952,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3900,8 +3963,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3911,8 +3974,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3922,8 +3985,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3933,8 +3996,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3944,7 +4007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::IVec4::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3954,7 +4017,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::IVec4::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3964,7 +4027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::IVec4::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -3973,7 +4036,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::length_squared(_self.into()) + let output: i32 = ::bevy::math::IVec4::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -3982,8 +4047,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: i32 = ::bevy::math::IVec4::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -3993,8 +4058,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4004,8 +4069,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4065,8 +4130,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4076,8 +4141,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4087,8 +4152,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4098,8 +4163,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4109,8 +4174,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4120,8 +4185,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4131,8 +4196,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4142,8 +4207,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4153,8 +4218,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::wrapping_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4164,8 +4229,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::wrapping_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4175,8 +4240,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::saturating_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4186,8 +4251,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::saturating_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4197,7 +4262,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4218,7 +4283,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec4::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4229,7 +4294,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4240,8 +4305,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4251,8 +4316,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4262,8 +4327,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4273,7 +4338,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4294,7 +4359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec4::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4312,7 +4377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec4::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4323,7 +4388,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: i32| { let output: Val = ::bevy::math::IVec4::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4334,8 +4399,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4345,7 +4410,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec4::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4356,7 +4421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::IVec4::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4367,8 +4432,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::IVec4::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4379,7 +4444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4390,7 +4455,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4401,7 +4466,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4412,8 +4477,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4423,7 +4488,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec2::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4434,7 +4499,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -4445,7 +4510,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec2::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4456,7 +4521,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4467,7 +4532,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::I64Vec2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -4477,7 +4542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -4498,8 +4563,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4534,9 +4599,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::I64Vec2::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -4564,7 +4629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, z: i64| { let output: Val = ::bevy::math::I64Vec2::extend( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -4575,7 +4640,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: i64| { let output: Val = ::bevy::math::I64Vec2::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -4586,7 +4651,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: i64| { let output: Val = ::bevy::math::I64Vec2::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -4597,8 +4662,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec2::dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4608,8 +4673,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4619,8 +4684,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4630,8 +4695,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4645,9 +4710,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::I64Vec2::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -4656,7 +4721,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::min_element(_self.into()) + let output: i64 = ::bevy::math::I64Vec2::min_element( + _self.into_inner(), + ) .into(); output }, @@ -4664,7 +4731,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::max_element(_self.into()) + let output: i64 = ::bevy::math::I64Vec2::max_element( + _self.into_inner(), + ) .into(); output }, @@ -4672,7 +4741,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::element_sum(_self.into()) + let output: i64 = ::bevy::math::I64Vec2::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -4681,7 +4752,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "element_product", |_self: Val| { let output: i64 = ::bevy::math::I64Vec2::element_product( - _self.into(), + _self.into_inner(), ) .into(); output @@ -4691,8 +4762,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4702,8 +4773,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4713,8 +4784,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4724,8 +4795,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4735,8 +4806,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4746,8 +4817,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4757,7 +4828,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::I64Vec2::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -4767,7 +4838,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::I64Vec2::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -4777,7 +4848,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::I64Vec2::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -4786,7 +4857,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::length_squared(_self.into()) + let output: i64 = ::bevy::math::I64Vec2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -4795,8 +4868,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec2::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4806,8 +4879,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4817,8 +4890,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4828,7 +4901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp", |_self: Val| { let output: Val = ::bevy::math::I64Vec2::perp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -4838,8 +4911,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp_dot", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec2::perp_dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4849,8 +4922,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rotate", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::rotate( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4910,8 +4983,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4921,8 +4994,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4932,8 +5005,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4943,8 +5016,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4954,8 +5027,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4965,8 +5038,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4976,8 +5049,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4987,8 +5060,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -4998,8 +5071,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::wrapping_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5009,8 +5082,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::wrapping_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5020,8 +5093,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::saturating_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5031,8 +5104,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::saturating_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5042,8 +5115,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5053,8 +5126,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5071,7 +5144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5082,7 +5155,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5093,8 +5166,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5115,7 +5188,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec3::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5126,7 +5199,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5137,7 +5210,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5148,7 +5221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5169,8 +5242,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5206,9 +5279,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::I64Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -5236,7 +5309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: i64| { let output: Val = ::bevy::math::I64Vec3::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -5247,7 +5320,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::I64Vec3::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -5257,7 +5330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: i64| { let output: Val = ::bevy::math::I64Vec3::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -5268,7 +5341,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: i64| { let output: Val = ::bevy::math::I64Vec3::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -5279,7 +5352,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: i64| { let output: Val = ::bevy::math::I64Vec3::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -5290,8 +5363,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec3::dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5301,8 +5374,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5312,8 +5385,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5323,8 +5396,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5334,8 +5407,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5349,9 +5422,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::I64Vec3::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -5360,7 +5433,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::min_element(_self.into()) + let output: i64 = ::bevy::math::I64Vec3::min_element( + _self.into_inner(), + ) .into(); output }, @@ -5368,7 +5443,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::max_element(_self.into()) + let output: i64 = ::bevy::math::I64Vec3::max_element( + _self.into_inner(), + ) .into(); output }, @@ -5376,7 +5453,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::element_sum(_self.into()) + let output: i64 = ::bevy::math::I64Vec3::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -5385,7 +5464,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "element_product", |_self: Val| { let output: i64 = ::bevy::math::I64Vec3::element_product( - _self.into(), + _self.into_inner(), ) .into(); output @@ -5395,8 +5474,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5406,8 +5485,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5417,8 +5496,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5428,8 +5507,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5439,8 +5518,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5450,8 +5529,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5461,7 +5540,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::I64Vec3::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -5471,7 +5550,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::I64Vec3::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -5481,7 +5560,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::I64Vec3::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -5490,7 +5569,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::length_squared(_self.into()) + let output: i64 = ::bevy::math::I64Vec3::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -5499,8 +5580,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec3::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5510,8 +5591,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5521,8 +5602,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5592,8 +5673,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5603,8 +5684,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5614,8 +5695,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5625,8 +5706,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5636,8 +5717,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5647,8 +5728,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5658,8 +5739,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5669,8 +5750,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5680,8 +5761,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::wrapping_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5691,8 +5772,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::wrapping_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5702,8 +5783,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::saturating_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5713,8 +5794,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::saturating_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5724,7 +5805,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5735,7 +5816,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5756,8 +5837,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5767,7 +5848,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5778,7 +5859,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5789,7 +5870,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::I64Vec3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -5799,8 +5880,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5810,7 +5891,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5821,8 +5902,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5832,8 +5913,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec3::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5843,7 +5924,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5869,7 +5950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec4::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5880,7 +5961,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5891,7 +5972,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec4::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -5902,8 +5983,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5913,7 +5994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec4::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5934,8 +6015,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5945,7 +6026,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec4::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5956,8 +6037,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5967,8 +6048,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -5978,7 +6059,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -5989,7 +6070,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: i64| { let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -6000,7 +6081,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec4::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6011,7 +6092,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec4::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6022,7 +6103,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6070,9 +6151,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::I64Vec4::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -6100,7 +6181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::I64Vec4::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -6110,7 +6191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: i64| { let output: Val = ::bevy::math::I64Vec4::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -6121,7 +6202,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: i64| { let output: Val = ::bevy::math::I64Vec4::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -6132,7 +6213,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: i64| { let output: Val = ::bevy::math::I64Vec4::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -6143,7 +6224,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_w", |_self: Val, w: i64| { let output: Val = ::bevy::math::I64Vec4::with_w( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -6154,8 +6235,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec4::dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6165,8 +6246,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6176,8 +6257,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6187,8 +6268,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6202,9 +6283,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::I64Vec4::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -6213,7 +6294,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::min_element(_self.into()) + let output: i64 = ::bevy::math::I64Vec4::min_element( + _self.into_inner(), + ) .into(); output }, @@ -6221,7 +6304,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::max_element(_self.into()) + let output: i64 = ::bevy::math::I64Vec4::max_element( + _self.into_inner(), + ) .into(); output }, @@ -6229,7 +6314,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::element_sum(_self.into()) + let output: i64 = ::bevy::math::I64Vec4::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -6238,7 +6325,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "element_product", |_self: Val| { let output: i64 = ::bevy::math::I64Vec4::element_product( - _self.into(), + _self.into_inner(), ) .into(); output @@ -6248,8 +6335,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6259,8 +6346,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6270,8 +6357,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6281,8 +6368,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6292,8 +6379,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6303,8 +6390,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6314,7 +6401,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::I64Vec4::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -6324,7 +6411,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::I64Vec4::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -6334,7 +6421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::I64Vec4::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -6343,7 +6430,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::length_squared(_self.into()) + let output: i64 = ::bevy::math::I64Vec4::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -6352,8 +6441,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: i64 = ::bevy::math::I64Vec4::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6363,8 +6452,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6374,8 +6463,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6435,8 +6524,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6446,8 +6535,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6457,8 +6546,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6468,8 +6557,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6479,8 +6568,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6490,8 +6579,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6501,8 +6590,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6512,8 +6601,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6523,8 +6612,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::wrapping_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6534,8 +6623,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::wrapping_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6545,8 +6634,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::saturating_add_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6556,8 +6645,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::saturating_sub_unsigned( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6567,8 +6656,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::I64Vec4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6578,7 +6667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::I64Vec4::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -6596,7 +6685,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec2::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6607,7 +6696,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -6628,8 +6717,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6639,7 +6728,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec2::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6650,7 +6739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec2::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6661,8 +6750,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6672,8 +6761,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6683,7 +6772,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec2::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6694,7 +6783,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -6705,7 +6794,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec2::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -6716,8 +6805,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6727,7 +6816,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec2::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -6738,7 +6827,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec2::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -6759,7 +6848,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec2::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -6770,8 +6859,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6801,9 +6890,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::UVec2::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -6830,7 +6919,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, z: u32| { let output: Val = ::bevy::math::UVec2::extend( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -6841,7 +6930,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: u32| { let output: Val = ::bevy::math::UVec2::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -6852,7 +6941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: u32| { let output: Val = ::bevy::math::UVec2::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -6862,7 +6951,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec2::dot(_self.into(), rhs.into()) + let output: u32 = ::bevy::math::UVec2::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -6871,8 +6963,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6882,8 +6974,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6893,8 +6985,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6908,9 +7000,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::UVec2::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -6919,7 +7011,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::min_element(_self.into()) + let output: u32 = ::bevy::math::UVec2::min_element( + _self.into_inner(), + ) .into(); output }, @@ -6927,7 +7021,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::max_element(_self.into()) + let output: u32 = ::bevy::math::UVec2::max_element( + _self.into_inner(), + ) .into(); output }, @@ -6935,7 +7031,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::element_sum(_self.into()) + let output: u32 = ::bevy::math::UVec2::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -6943,7 +7041,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::element_product(_self.into()) + let output: u32 = ::bevy::math::UVec2::element_product( + _self.into_inner(), + ) .into(); output }, @@ -6952,8 +7052,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6963,8 +7063,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6974,8 +7074,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6985,8 +7085,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -6996,8 +7096,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7007,8 +7107,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7017,7 +7117,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::length_squared(_self.into()) + let output: u32 = ::bevy::math::UVec2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -7076,8 +7178,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7087,8 +7189,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7098,8 +7200,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7109,8 +7211,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7120,8 +7222,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7131,8 +7233,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7142,8 +7244,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7153,8 +7255,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7164,8 +7266,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::wrapping_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7175,8 +7277,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec2::saturating_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7187,7 +7289,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec3::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7208,8 +7310,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7219,8 +7321,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7240,8 +7342,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7251,7 +7353,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec3::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7262,7 +7364,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -7297,9 +7399,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::UVec3::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -7326,7 +7428,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: u32| { let output: Val = ::bevy::math::UVec3::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -7337,7 +7439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::UVec3::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -7347,7 +7449,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: u32| { let output: Val = ::bevy::math::UVec3::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -7358,7 +7460,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: u32| { let output: Val = ::bevy::math::UVec3::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -7369,7 +7471,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: u32| { let output: Val = ::bevy::math::UVec3::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -7379,7 +7481,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec3::dot(_self.into(), rhs.into()) + let output: u32 = ::bevy::math::UVec3::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -7388,8 +7493,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7399,8 +7504,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7410,8 +7515,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7421,8 +7526,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7436,9 +7541,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::UVec3::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -7447,7 +7552,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::min_element(_self.into()) + let output: u32 = ::bevy::math::UVec3::min_element( + _self.into_inner(), + ) .into(); output }, @@ -7455,7 +7562,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::max_element(_self.into()) + let output: u32 = ::bevy::math::UVec3::max_element( + _self.into_inner(), + ) .into(); output }, @@ -7463,7 +7572,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::element_sum(_self.into()) + let output: u32 = ::bevy::math::UVec3::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -7471,7 +7582,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::element_product(_self.into()) + let output: u32 = ::bevy::math::UVec3::element_product( + _self.into_inner(), + ) .into(); output }, @@ -7480,8 +7593,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7491,8 +7604,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7502,8 +7615,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7513,8 +7626,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7524,8 +7637,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7535,8 +7648,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7545,7 +7658,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::length_squared(_self.into()) + let output: u32 = ::bevy::math::UVec3::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -7614,8 +7729,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7625,8 +7740,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7636,8 +7751,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7647,8 +7762,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7658,8 +7773,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7669,8 +7784,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7680,8 +7795,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7691,8 +7806,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7702,8 +7817,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::wrapping_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7713,8 +7828,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::saturating_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7724,7 +7839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -7735,8 +7850,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7746,7 +7861,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec3::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7764,8 +7879,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec3::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7775,7 +7890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -7786,7 +7901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -7797,7 +7912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec3::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7808,7 +7923,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec3::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -7819,7 +7934,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec3::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7831,7 +7946,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec4::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7842,8 +7957,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7853,7 +7968,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -7874,7 +7989,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec4::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7885,8 +8000,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7896,8 +8011,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -7907,7 +8022,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec4::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -7943,9 +8058,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::UVec4::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -7972,7 +8087,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::UVec4::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -7982,7 +8097,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: u32| { let output: Val = ::bevy::math::UVec4::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -7993,7 +8108,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: u32| { let output: Val = ::bevy::math::UVec4::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -8004,7 +8119,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: u32| { let output: Val = ::bevy::math::UVec4::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -8015,7 +8130,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_w", |_self: Val, w: u32| { let output: Val = ::bevy::math::UVec4::with_w( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -8025,7 +8140,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec4::dot(_self.into(), rhs.into()) + let output: u32 = ::bevy::math::UVec4::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -8034,8 +8152,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8045,8 +8163,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8056,8 +8174,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8071,9 +8189,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::UVec4::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -8082,7 +8200,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::min_element(_self.into()) + let output: u32 = ::bevy::math::UVec4::min_element( + _self.into_inner(), + ) .into(); output }, @@ -8090,7 +8210,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::max_element(_self.into()) + let output: u32 = ::bevy::math::UVec4::max_element( + _self.into_inner(), + ) .into(); output }, @@ -8098,7 +8220,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::element_sum(_self.into()) + let output: u32 = ::bevy::math::UVec4::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -8106,7 +8230,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::element_product(_self.into()) + let output: u32 = ::bevy::math::UVec4::element_product( + _self.into_inner(), + ) .into(); output }, @@ -8115,8 +8241,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8126,8 +8252,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8137,8 +8263,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8148,8 +8274,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8159,8 +8285,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8170,8 +8296,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8180,7 +8306,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::length_squared(_self.into()) + let output: u32 = ::bevy::math::UVec4::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -8239,8 +8367,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8250,8 +8378,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8261,8 +8389,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8272,8 +8400,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8283,8 +8411,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8294,8 +8422,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8305,8 +8433,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8316,8 +8444,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8327,8 +8455,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::wrapping_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8338,8 +8466,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::saturating_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8356,7 +8484,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8367,8 +8495,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8378,7 +8506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8389,7 +8517,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec4::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -8400,7 +8528,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::UVec4::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -8421,7 +8549,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8432,8 +8560,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::UVec4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8443,7 +8571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: u32| { let output: Val = ::bevy::math::UVec4::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8455,7 +8583,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8466,8 +8594,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8477,8 +8605,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8488,7 +8616,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec2::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -8499,7 +8627,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -8510,7 +8638,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8531,7 +8659,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec2::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8542,7 +8670,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -8553,7 +8681,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec2::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -8564,7 +8692,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -8600,9 +8728,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::U64Vec2::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -8630,7 +8758,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, z: u64| { let output: Val = ::bevy::math::U64Vec2::extend( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -8641,7 +8769,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: u64| { let output: Val = ::bevy::math::U64Vec2::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -8652,7 +8780,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: u64| { let output: Val = ::bevy::math::U64Vec2::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -8663,8 +8791,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot", |_self: Val, rhs: Val| { let output: u64 = ::bevy::math::U64Vec2::dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8674,8 +8802,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8685,8 +8813,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8696,8 +8824,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8711,9 +8839,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::U64Vec2::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -8722,7 +8850,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::min_element(_self.into()) + let output: u64 = ::bevy::math::U64Vec2::min_element( + _self.into_inner(), + ) .into(); output }, @@ -8730,7 +8860,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::max_element(_self.into()) + let output: u64 = ::bevy::math::U64Vec2::max_element( + _self.into_inner(), + ) .into(); output }, @@ -8738,7 +8870,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::element_sum(_self.into()) + let output: u64 = ::bevy::math::U64Vec2::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -8747,7 +8881,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "element_product", |_self: Val| { let output: u64 = ::bevy::math::U64Vec2::element_product( - _self.into(), + _self.into_inner(), ) .into(); output @@ -8757,8 +8891,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8768,8 +8902,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8779,8 +8913,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8790,8 +8924,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8801,8 +8935,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8812,8 +8946,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8822,7 +8956,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::length_squared(_self.into()) + let output: u64 = ::bevy::math::U64Vec2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -8881,8 +9017,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8892,8 +9028,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8903,8 +9039,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8914,8 +9050,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8925,8 +9061,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8936,8 +9072,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8947,8 +9083,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8958,8 +9094,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8969,8 +9105,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::wrapping_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8980,8 +9116,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::saturating_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -8991,7 +9127,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec2::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9002,8 +9138,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9020,7 +9156,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec2::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9031,8 +9167,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9052,8 +9188,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9064,7 +9200,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9075,7 +9211,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9112,9 +9248,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::U64Vec3::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -9142,7 +9278,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: u64| { let output: Val = ::bevy::math::U64Vec3::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -9153,7 +9289,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::U64Vec3::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -9163,7 +9299,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: u64| { let output: Val = ::bevy::math::U64Vec3::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -9174,7 +9310,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: u64| { let output: Val = ::bevy::math::U64Vec3::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -9185,7 +9321,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: u64| { let output: Val = ::bevy::math::U64Vec3::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -9196,8 +9332,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot", |_self: Val, rhs: Val| { let output: u64 = ::bevy::math::U64Vec3::dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9207,8 +9343,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9218,8 +9354,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9229,8 +9365,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9240,8 +9376,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9255,9 +9391,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::U64Vec3::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -9266,7 +9402,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::min_element(_self.into()) + let output: u64 = ::bevy::math::U64Vec3::min_element( + _self.into_inner(), + ) .into(); output }, @@ -9274,7 +9412,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::max_element(_self.into()) + let output: u64 = ::bevy::math::U64Vec3::max_element( + _self.into_inner(), + ) .into(); output }, @@ -9282,7 +9422,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::element_sum(_self.into()) + let output: u64 = ::bevy::math::U64Vec3::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -9291,7 +9433,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "element_product", |_self: Val| { let output: u64 = ::bevy::math::U64Vec3::element_product( - _self.into(), + _self.into_inner(), ) .into(); output @@ -9301,8 +9443,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9312,8 +9454,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9323,8 +9465,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9334,8 +9476,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9345,8 +9487,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9356,8 +9498,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9366,7 +9508,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::length_squared(_self.into()) + let output: u64 = ::bevy::math::U64Vec3::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -9435,8 +9579,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9446,8 +9590,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9457,8 +9601,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9468,8 +9612,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9479,8 +9623,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9490,8 +9634,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9501,8 +9645,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9512,8 +9656,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9523,8 +9667,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::wrapping_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9534,8 +9678,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::saturating_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9545,7 +9689,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec3::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9556,8 +9700,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9567,7 +9711,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9578,7 +9722,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9599,7 +9743,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9610,8 +9754,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9621,7 +9765,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9642,8 +9786,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9653,8 +9797,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9664,7 +9808,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec3::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9682,7 +9826,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec3::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9693,8 +9837,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9704,7 +9848,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec3::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9726,8 +9870,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9737,7 +9881,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec4::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9748,7 +9892,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9759,7 +9903,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec4::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9770,8 +9914,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9781,8 +9925,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9792,8 +9936,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9803,7 +9947,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9814,7 +9958,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9825,7 +9969,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -9836,7 +9980,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec4::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9847,7 +9991,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::U64Vec4::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -9858,8 +10002,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -9906,9 +10050,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::U64Vec4::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -9936,7 +10080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::U64Vec4::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -9946,7 +10090,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: u64| { let output: Val = ::bevy::math::U64Vec4::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -9957,7 +10101,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: u64| { let output: Val = ::bevy::math::U64Vec4::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -9968,7 +10112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: u64| { let output: Val = ::bevy::math::U64Vec4::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -9979,7 +10123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_w", |_self: Val, w: u64| { let output: Val = ::bevy::math::U64Vec4::with_w( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -9990,8 +10134,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot", |_self: Val, rhs: Val| { let output: u64 = ::bevy::math::U64Vec4::dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10001,8 +10145,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10012,8 +10156,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10023,8 +10167,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10038,9 +10182,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::U64Vec4::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -10049,7 +10193,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::min_element(_self.into()) + let output: u64 = ::bevy::math::U64Vec4::min_element( + _self.into_inner(), + ) .into(); output }, @@ -10057,7 +10203,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::max_element(_self.into()) + let output: u64 = ::bevy::math::U64Vec4::max_element( + _self.into_inner(), + ) .into(); output }, @@ -10065,7 +10213,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::element_sum(_self.into()) + let output: u64 = ::bevy::math::U64Vec4::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -10074,7 +10224,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "element_product", |_self: Val| { let output: u64 = ::bevy::math::U64Vec4::element_product( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10084,8 +10234,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10095,8 +10245,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10106,8 +10256,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10117,8 +10267,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10128,8 +10278,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10139,8 +10289,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10149,7 +10299,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::length_squared(_self.into()) + let output: u64 = ::bevy::math::U64Vec4::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -10208,8 +10360,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::wrapping_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10219,8 +10371,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::wrapping_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10230,8 +10382,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::wrapping_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10241,8 +10393,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::wrapping_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10252,8 +10404,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::saturating_add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10263,8 +10415,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::saturating_sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10274,8 +10426,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::saturating_mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10285,8 +10437,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::saturating_div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10296,8 +10448,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::wrapping_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10307,8 +10459,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::U64Vec4::saturating_add_signed( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10318,7 +10470,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec4::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -10336,7 +10488,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: u64| { let output: Val = ::bevy::math::U64Vec4::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -10348,7 +10500,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec2::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -10359,8 +10511,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10370,7 +10522,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec2::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -10381,7 +10533,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec2::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -10399,7 +10551,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Vec2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10409,7 +10561,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -10448,9 +10600,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::Vec2::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -10475,7 +10627,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec2::extend( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -10486,7 +10638,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec2::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -10497,7 +10649,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec2::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -10507,7 +10659,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::dot(_self.into(), rhs.into()) + let output: f32 = ::bevy::math::Vec2::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -10516,8 +10671,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10527,8 +10682,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10538,8 +10693,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10553,9 +10708,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::Vec2::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -10564,7 +10719,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::min_element(_self.into()) + let output: f32 = ::bevy::math::Vec2::min_element(_self.into_inner()) .into(); output }, @@ -10572,7 +10727,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::max_element(_self.into()) + let output: f32 = ::bevy::math::Vec2::max_element(_self.into_inner()) .into(); output }, @@ -10580,7 +10735,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::element_sum(_self.into()) + let output: f32 = ::bevy::math::Vec2::element_sum(_self.into_inner()) .into(); output }, @@ -10588,7 +10743,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::element_product(_self.into()) + let output: f32 = ::bevy::math::Vec2::element_product( + _self.into_inner(), + ) .into(); output }, @@ -10597,8 +10754,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10608,8 +10765,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10619,8 +10776,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10630,8 +10787,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10641,8 +10798,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10652,8 +10809,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10663,7 +10820,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::Vec2::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10673,7 +10830,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::Vec2::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10683,8 +10840,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10694,7 +10851,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::Vec2::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10703,7 +10860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_finite(_self.into()) + let output: bool = ::bevy::math::Vec2::is_finite(_self.into_inner()) .into(); output }, @@ -10712,7 +10869,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::Vec2::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10721,7 +10878,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Vec2::is_nan(_self.into_inner()) + .into(); output }, ) @@ -10729,7 +10887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::Vec2::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10738,14 +10896,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length(_self.into()).into(); + let output: f32 = ::bevy::math::Vec2::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length_squared(_self.into()) + let output: f32 = ::bevy::math::Vec2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -10753,7 +10914,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length_recip(_self.into()) + let output: f32 = ::bevy::math::Vec2::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -10762,8 +10925,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec2::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10773,8 +10936,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec2::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10784,8 +10947,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10795,8 +10958,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10806,7 +10969,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::Vec2::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10816,8 +10979,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::Vec2::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -10827,7 +10990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::Vec2::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10836,7 +10999,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_normalized(_self.into()) + let output: bool = ::bevy::math::Vec2::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -10845,8 +11010,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10856,8 +11021,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10867,8 +11032,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10878,8 +11043,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -10889,7 +11054,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::Vec2::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10899,7 +11064,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::Vec2::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10909,7 +11074,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::Vec2::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10919,7 +11084,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::Vec2::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10929,7 +11094,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::Vec2::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10939,7 +11104,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::Vec2::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10949,7 +11114,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::Vec2::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10959,7 +11124,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec2::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -10970,7 +11135,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::Vec2::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -10980,8 +11145,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = ::bevy::math::Vec2::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -10993,7 +11158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec2::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -11004,8 +11169,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11019,8 +11184,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Vec2::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -11031,7 +11196,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec2::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -11043,7 +11208,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec2::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -11054,7 +11219,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec2::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -11069,9 +11234,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::Vec2::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -11081,8 +11246,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::Vec2::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -11092,8 +11257,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "refract", |_self: Val, normal: Val, eta: f32| { let output: Val = ::bevy::math::Vec2::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -11113,7 +11278,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_angle", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::to_angle(_self.into()).into(); + let output: f32 = ::bevy::math::Vec2::to_angle(_self.into_inner()) + .into(); output }, ) @@ -11121,8 +11287,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec2::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11132,8 +11298,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_to", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec2::angle_to( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11143,7 +11309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp", |_self: Val| { let output: Val = ::bevy::math::Vec2::perp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11153,8 +11319,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp_dot", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec2::perp_dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11164,8 +11330,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rotate", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::rotate( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11180,7 +11346,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::Vec2::rotate_towards( &_self, - rhs.into(), + rhs.into_inner(), max_angle, ) .into(); @@ -11241,8 +11407,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11252,8 +11418,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11263,7 +11429,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -11274,7 +11440,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec2::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -11285,8 +11451,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11296,7 +11462,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -11307,7 +11473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -11318,8 +11484,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec2::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11329,7 +11495,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec2::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -11340,7 +11506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec2::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -11352,8 +11518,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11370,7 +11536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -11391,7 +11557,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -11402,8 +11568,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11413,8 +11579,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11424,7 +11590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Vec3A::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11458,9 +11624,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::Vec3A::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -11487,7 +11653,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_vec4", |v: Val| { let output: Val = ::bevy::math::Vec3A::from_vec4( - v.into(), + v.into_inner(), ) .into(); output @@ -11497,7 +11663,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: f32| { let output: Val = ::bevy::math::Vec3A::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -11508,7 +11674,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::Vec3A::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11518,7 +11684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec3A::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -11529,7 +11695,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec3A::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -11540,7 +11706,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec3A::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -11550,7 +11716,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::dot(_self.into(), rhs.into()) + let output: f32 = ::bevy::math::Vec3A::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -11559,8 +11728,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11570,8 +11739,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11581,8 +11750,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11592,8 +11761,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11607,9 +11776,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::Vec3A::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -11618,7 +11787,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::min_element(_self.into()) + let output: f32 = ::bevy::math::Vec3A::min_element( + _self.into_inner(), + ) .into(); output }, @@ -11626,7 +11797,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::max_element(_self.into()) + let output: f32 = ::bevy::math::Vec3A::max_element( + _self.into_inner(), + ) .into(); output }, @@ -11634,7 +11807,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::element_sum(_self.into()) + let output: f32 = ::bevy::math::Vec3A::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -11642,7 +11817,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::element_product(_self.into()) + let output: f32 = ::bevy::math::Vec3A::element_product( + _self.into_inner(), + ) .into(); output }, @@ -11651,8 +11828,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11662,8 +11839,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11673,8 +11850,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11684,8 +11861,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11695,8 +11872,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11706,8 +11883,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11717,7 +11894,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::Vec3A::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11727,7 +11904,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::Vec3A::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11737,8 +11914,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11748,7 +11925,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::Vec3A::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11757,7 +11934,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_finite(_self.into()) + let output: bool = ::bevy::math::Vec3A::is_finite(_self.into_inner()) .into(); output }, @@ -11766,7 +11943,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::Vec3A::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11775,7 +11952,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Vec3A::is_nan(_self.into_inner()) + .into(); output }, ) @@ -11783,7 +11961,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::Vec3A::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11792,14 +11970,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length(_self.into()).into(); + let output: f32 = ::bevy::math::Vec3A::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length_squared(_self.into()) + let output: f32 = ::bevy::math::Vec3A::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -11807,7 +11988,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length_recip(_self.into()) + let output: f32 = ::bevy::math::Vec3A::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -11816,8 +11999,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec3A::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11827,8 +12010,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec3A::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11838,8 +12021,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11849,8 +12032,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11860,7 +12043,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::Vec3A::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11870,8 +12053,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::Vec3A::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -11881,7 +12064,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::Vec3A::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11890,7 +12073,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_normalized(_self.into()) + let output: bool = ::bevy::math::Vec3A::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -11899,8 +12084,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11910,8 +12095,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11921,8 +12106,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11932,8 +12117,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -11943,7 +12128,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::Vec3A::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11953,7 +12138,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::Vec3A::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11963,7 +12148,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::Vec3A::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11973,7 +12158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::Vec3A::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11983,7 +12168,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::Vec3A::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -11993,7 +12178,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::Vec3A::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12003,7 +12188,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::Vec3A::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12013,7 +12198,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec3A::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -12024,7 +12209,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::Vec3A::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12034,8 +12219,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = ::bevy::math::Vec3A::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -12047,7 +12232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec3A::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -12058,8 +12243,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12073,8 +12258,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Vec3A::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -12085,7 +12270,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec3A::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -12097,7 +12282,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec3A::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -12108,7 +12293,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec3A::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -12123,9 +12308,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::Vec3A::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -12135,8 +12320,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::Vec3A::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -12150,8 +12335,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { eta: f32| { let output: Val = ::bevy::math::Vec3A::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -12162,8 +12347,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec3A::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12243,7 +12428,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12254,7 +12439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -12265,7 +12450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12276,7 +12461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -12287,8 +12472,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12298,7 +12483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec3A::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -12309,8 +12494,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec3A::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12320,7 +12505,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12331,7 +12516,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12342,7 +12527,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec3A::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12354,7 +12539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec4::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12365,7 +12550,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec4::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12383,8 +12568,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12394,7 +12579,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec4::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12405,7 +12590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Vec4::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12415,8 +12600,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12426,7 +12611,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec4::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -12437,7 +12622,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -12448,7 +12633,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -12484,9 +12669,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::Vec4::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -12511,7 +12696,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::Vec4::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12521,7 +12706,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f32| { let output: Val = ::bevy::math::Vec4::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -12532,7 +12717,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f32| { let output: Val = ::bevy::math::Vec4::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -12543,7 +12728,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: f32| { let output: Val = ::bevy::math::Vec4::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -12554,7 +12739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_w", |_self: Val, w: f32| { let output: Val = ::bevy::math::Vec4::with_w( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -12564,7 +12749,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::dot(_self.into(), rhs.into()) + let output: f32 = ::bevy::math::Vec4::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -12573,8 +12761,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12584,8 +12772,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12595,8 +12783,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12610,9 +12798,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::Vec4::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -12621,7 +12809,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::min_element(_self.into()) + let output: f32 = ::bevy::math::Vec4::min_element(_self.into_inner()) .into(); output }, @@ -12629,7 +12817,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::max_element(_self.into()) + let output: f32 = ::bevy::math::Vec4::max_element(_self.into_inner()) .into(); output }, @@ -12637,7 +12825,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::element_sum(_self.into()) + let output: f32 = ::bevy::math::Vec4::element_sum(_self.into_inner()) .into(); output }, @@ -12645,7 +12833,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::element_product(_self.into()) + let output: f32 = ::bevy::math::Vec4::element_product( + _self.into_inner(), + ) .into(); output }, @@ -12654,8 +12844,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12665,8 +12855,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12676,8 +12866,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12687,8 +12877,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12698,8 +12888,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12709,8 +12899,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12720,7 +12910,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::Vec4::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12730,7 +12920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::Vec4::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12740,8 +12930,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12751,7 +12941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::Vec4::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12760,7 +12950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_finite(_self.into()) + let output: bool = ::bevy::math::Vec4::is_finite(_self.into_inner()) .into(); output }, @@ -12769,7 +12959,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::Vec4::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12778,7 +12968,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::Vec4::is_nan(_self.into_inner()) + .into(); output }, ) @@ -12786,7 +12977,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::Vec4::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12795,14 +12986,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length(_self.into()).into(); + let output: f32 = ::bevy::math::Vec4::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length_squared(_self.into()) + let output: f32 = ::bevy::math::Vec4::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -12810,7 +13004,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length_recip(_self.into()) + let output: f32 = ::bevy::math::Vec4::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -12819,8 +13015,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec4::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12830,8 +13026,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f32 = ::bevy::math::Vec4::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12841,8 +13037,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12852,8 +13048,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12863,7 +13059,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::Vec4::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12873,8 +13069,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::Vec4::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -12884,7 +13080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::Vec4::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12893,7 +13089,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_normalized(_self.into()) + let output: bool = ::bevy::math::Vec4::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -12902,8 +13100,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12913,8 +13111,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12924,8 +13122,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12935,8 +13133,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -12946,7 +13144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::Vec4::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12956,7 +13154,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::Vec4::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12966,7 +13164,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::Vec4::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12976,7 +13174,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::Vec4::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12986,7 +13184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::Vec4::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -12996,7 +13194,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::Vec4::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13006,7 +13204,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::Vec4::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13016,7 +13214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f32| { let output: Val = ::bevy::math::Vec4::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -13027,7 +13225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::Vec4::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13037,8 +13235,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = ::bevy::math::Vec4::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -13050,7 +13248,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f32| { let output: Val = ::bevy::math::Vec4::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -13061,8 +13259,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13076,8 +13274,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f32| { let output: bool = ::bevy::math::Vec4::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -13088,7 +13286,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = ::bevy::math::Vec4::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -13100,7 +13298,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f32| { let output: Val = ::bevy::math::Vec4::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -13111,7 +13309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f32| { let output: Val = ::bevy::math::Vec4::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -13126,9 +13324,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::Vec4::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -13138,8 +13336,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::Vec4::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -13149,8 +13347,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "refract", |_self: Val, normal: Val, eta: f32| { let output: Val = ::bevy::math::Vec4::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -13211,8 +13409,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13222,7 +13420,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::Vec4::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -13233,8 +13431,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13244,7 +13442,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -13263,7 +13461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -13274,8 +13472,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Vec4::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13285,7 +13483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Vec4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -13339,21 +13537,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec2::bitmask(_self.into()).into(); + let output: u32 = ::bevy::math::BVec2::bitmask(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec2::any(_self.into()).into(); + let output: bool = ::bevy::math::BVec2::any(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec2::all(_self.into()).into(); + let output: bool = ::bevy::math::BVec2::all(_self.into_inner()) + .into(); output }, ) @@ -13416,21 +13617,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec3::bitmask(_self.into()).into(); + let output: u32 = ::bevy::math::BVec3::bitmask(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec3::any(_self.into()).into(); + let output: bool = ::bevy::math::BVec3::any(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec3::all(_self.into()).into(); + let output: bool = ::bevy::math::BVec3::all(_self.into_inner()) + .into(); output }, ) @@ -13511,21 +13715,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec4::bitmask(_self.into()).into(); + let output: u32 = ::bevy::math::BVec4::bitmask(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec4::any(_self.into()).into(); + let output: bool = ::bevy::math::BVec4::any(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec4::all(_self.into()).into(); + let output: bool = ::bevy::math::BVec4::all(_self.into_inner()) + .into(); output }, ) @@ -13576,7 +13783,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DVec2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13586,8 +13793,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13597,7 +13804,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec2::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -13608,7 +13815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -13619,7 +13826,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -13630,7 +13837,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -13641,8 +13848,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13672,9 +13879,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::DVec2::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -13701,7 +13908,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, z: f64| { let output: Val = ::bevy::math::DVec2::extend( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -13712,7 +13919,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f64| { let output: Val = ::bevy::math::DVec2::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -13723,7 +13930,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f64| { let output: Val = ::bevy::math::DVec2::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -13733,7 +13940,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::dot(_self.into(), rhs.into()) + let output: f64 = ::bevy::math::DVec2::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -13742,8 +13952,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13753,8 +13963,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13764,8 +13974,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13779,9 +13989,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::DVec2::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -13790,7 +14000,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::min_element(_self.into()) + let output: f64 = ::bevy::math::DVec2::min_element( + _self.into_inner(), + ) .into(); output }, @@ -13798,7 +14010,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::max_element(_self.into()) + let output: f64 = ::bevy::math::DVec2::max_element( + _self.into_inner(), + ) .into(); output }, @@ -13806,7 +14020,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::element_sum(_self.into()) + let output: f64 = ::bevy::math::DVec2::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -13814,7 +14030,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::element_product(_self.into()) + let output: f64 = ::bevy::math::DVec2::element_product( + _self.into_inner(), + ) .into(); output }, @@ -13823,8 +14041,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13834,8 +14052,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13845,8 +14063,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13856,8 +14074,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13867,8 +14085,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13878,8 +14096,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13889,7 +14107,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::DVec2::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13899,7 +14117,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::DVec2::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13909,8 +14127,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13920,7 +14138,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::DVec2::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13929,7 +14147,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_finite(_self.into()) + let output: bool = ::bevy::math::DVec2::is_finite(_self.into_inner()) .into(); output }, @@ -13938,7 +14156,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::DVec2::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13947,7 +14165,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DVec2::is_nan(_self.into_inner()) + .into(); output }, ) @@ -13955,7 +14174,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::DVec2::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -13964,14 +14183,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length(_self.into()).into(); + let output: f64 = ::bevy::math::DVec2::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length_squared(_self.into()) + let output: f64 = ::bevy::math::DVec2::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -13979,7 +14201,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length_recip(_self.into()) + let output: f64 = ::bevy::math::DVec2::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -13988,8 +14212,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec2::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -13999,8 +14223,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec2::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14010,8 +14234,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14021,8 +14245,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14032,7 +14256,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::DVec2::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14042,8 +14266,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::DVec2::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -14053,7 +14277,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::DVec2::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14062,7 +14286,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_normalized(_self.into()) + let output: bool = ::bevy::math::DVec2::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -14071,8 +14297,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14082,8 +14308,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14093,8 +14319,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14104,8 +14330,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14115,7 +14341,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::DVec2::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14125,7 +14351,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::DVec2::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14135,7 +14361,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::DVec2::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14145,7 +14371,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::DVec2::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14155,7 +14381,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::DVec2::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14165,7 +14391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::DVec2::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14175,7 +14401,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::DVec2::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14185,7 +14411,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f64| { let output: Val = ::bevy::math::DVec2::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -14196,7 +14422,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::DVec2::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14206,8 +14432,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f64| { let output: Val = ::bevy::math::DVec2::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -14219,7 +14445,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f64| { let output: Val = ::bevy::math::DVec2::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -14230,8 +14456,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14245,8 +14471,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DVec2::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -14257,7 +14483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f64, max: f64| { let output: Val = ::bevy::math::DVec2::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -14269,7 +14495,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f64| { let output: Val = ::bevy::math::DVec2::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -14280,7 +14506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f64| { let output: Val = ::bevy::math::DVec2::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -14295,9 +14521,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::DVec2::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -14307,8 +14533,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::DVec2::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -14322,8 +14548,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { eta: f64| { let output: Val = ::bevy::math::DVec2::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -14343,7 +14569,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_angle", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::to_angle(_self.into()).into(); + let output: f64 = ::bevy::math::DVec2::to_angle(_self.into_inner()) + .into(); output }, ) @@ -14351,8 +14578,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec2::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14362,8 +14589,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_to", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec2::angle_to( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14373,7 +14600,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp", |_self: Val| { let output: Val = ::bevy::math::DVec2::perp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14383,8 +14610,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "perp_dot", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec2::perp_dot( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14394,8 +14621,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rotate", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::rotate( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14410,7 +14637,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::DVec2::rotate_towards( &_self, - rhs.into(), + rhs.into_inner(), max_angle, ) .into(); @@ -14471,7 +14698,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -14482,8 +14709,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14500,8 +14727,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14511,7 +14738,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec2::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -14532,7 +14759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec2::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -14543,8 +14770,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14554,7 +14781,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -14565,7 +14792,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -14576,7 +14803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec2::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -14588,7 +14815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec3::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -14599,7 +14826,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DVec3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14609,7 +14836,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -14620,8 +14847,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14631,7 +14858,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec3::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -14666,9 +14893,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::DVec3::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -14695,7 +14922,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "extend", |_self: Val, w: f64| { let output: Val = ::bevy::math::DVec3::extend( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -14706,7 +14933,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::DVec3::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14716,7 +14943,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f64| { let output: Val = ::bevy::math::DVec3::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -14727,7 +14954,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f64| { let output: Val = ::bevy::math::DVec3::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -14738,7 +14965,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: f64| { let output: Val = ::bevy::math::DVec3::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -14748,7 +14975,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::dot(_self.into(), rhs.into()) + let output: f64 = ::bevy::math::DVec3::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -14757,8 +14987,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14768,8 +14998,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cross", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cross( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14779,8 +15009,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14790,8 +15020,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14805,9 +15035,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::DVec3::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -14816,7 +15046,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::min_element(_self.into()) + let output: f64 = ::bevy::math::DVec3::min_element( + _self.into_inner(), + ) .into(); output }, @@ -14824,7 +15056,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::max_element(_self.into()) + let output: f64 = ::bevy::math::DVec3::max_element( + _self.into_inner(), + ) .into(); output }, @@ -14832,7 +15066,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::element_sum(_self.into()) + let output: f64 = ::bevy::math::DVec3::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -14840,7 +15076,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::element_product(_self.into()) + let output: f64 = ::bevy::math::DVec3::element_product( + _self.into_inner(), + ) .into(); output }, @@ -14849,8 +15087,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14860,8 +15098,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14871,8 +15109,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14882,8 +15120,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14893,8 +15131,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14904,8 +15142,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14915,7 +15153,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::DVec3::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14925,7 +15163,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::DVec3::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14935,8 +15173,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -14946,7 +15184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::DVec3::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14955,7 +15193,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_finite(_self.into()) + let output: bool = ::bevy::math::DVec3::is_finite(_self.into_inner()) .into(); output }, @@ -14964,7 +15202,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::DVec3::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14973,7 +15211,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DVec3::is_nan(_self.into_inner()) + .into(); output }, ) @@ -14981,7 +15220,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::DVec3::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -14990,14 +15229,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length(_self.into()).into(); + let output: f64 = ::bevy::math::DVec3::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length_squared(_self.into()) + let output: f64 = ::bevy::math::DVec3::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -15005,7 +15247,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length_recip(_self.into()) + let output: f64 = ::bevy::math::DVec3::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -15014,8 +15258,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec3::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15025,8 +15269,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec3::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15036,8 +15280,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15047,8 +15291,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15058,7 +15302,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::DVec3::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15068,8 +15312,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::DVec3::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -15079,7 +15323,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::DVec3::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15088,7 +15332,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_normalized(_self.into()) + let output: bool = ::bevy::math::DVec3::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -15097,8 +15343,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15108,8 +15354,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15119,8 +15365,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15130,8 +15376,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15141,7 +15387,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::DVec3::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15151,7 +15397,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::DVec3::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15161,7 +15407,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::DVec3::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15171,7 +15417,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::DVec3::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15181,7 +15427,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::DVec3::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15191,7 +15437,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::DVec3::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15201,7 +15447,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::DVec3::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15211,7 +15457,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f64| { let output: Val = ::bevy::math::DVec3::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -15222,7 +15468,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::DVec3::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15232,8 +15478,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f64| { let output: Val = ::bevy::math::DVec3::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -15245,7 +15491,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f64| { let output: Val = ::bevy::math::DVec3::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -15256,8 +15502,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15271,8 +15517,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DVec3::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -15283,7 +15529,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f64, max: f64| { let output: Val = ::bevy::math::DVec3::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -15295,7 +15541,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f64| { let output: Val = ::bevy::math::DVec3::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -15306,7 +15552,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f64| { let output: Val = ::bevy::math::DVec3::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -15321,9 +15567,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::DVec3::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -15333,8 +15579,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::DVec3::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -15348,8 +15594,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { eta: f64| { let output: Val = ::bevy::math::DVec3::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -15360,8 +15606,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec3::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15451,7 +15697,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec3::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15462,7 +15708,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec3::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15473,8 +15719,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15491,7 +15737,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec3::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15502,8 +15748,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15513,7 +15759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec3::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15524,7 +15770,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec3::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15535,7 +15781,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec3::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15546,7 +15792,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15557,8 +15803,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15568,8 +15814,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15597,7 +15843,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec4::mul( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15608,8 +15854,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15619,7 +15865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec4::sub( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15630,7 +15876,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15641,8 +15887,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::div( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15652,7 +15898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec4::rem( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15663,7 +15909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15674,7 +15920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec4::rem( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -15685,7 +15931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec4::add( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15696,8 +15942,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15717,7 +15963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec4::div( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15728,8 +15974,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::rem( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15739,7 +15985,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Ref| { let output: Val = ::bevy::math::DVec4::sub( - _self.into(), + _self.into_inner(), &rhs, ) .into(); @@ -15750,8 +15996,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15761,7 +16007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DVec4::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15796,9 +16042,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_false: Val| { let output: Val = ::bevy::math::DVec4::select( - mask.into(), - if_true.into(), - if_false.into(), + mask.into_inner(), + if_true.into_inner(), + if_false.into_inner(), ) .into(); output @@ -15825,7 +16071,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "truncate", |_self: Val| { let output: Val = ::bevy::math::DVec4::truncate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -15835,7 +16081,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_x", |_self: Val, x: f64| { let output: Val = ::bevy::math::DVec4::with_x( - _self.into(), + _self.into_inner(), x, ) .into(); @@ -15846,7 +16092,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_y", |_self: Val, y: f64| { let output: Val = ::bevy::math::DVec4::with_y( - _self.into(), + _self.into_inner(), y, ) .into(); @@ -15857,7 +16103,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_z", |_self: Val, z: f64| { let output: Val = ::bevy::math::DVec4::with_z( - _self.into(), + _self.into_inner(), z, ) .into(); @@ -15868,7 +16114,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "with_w", |_self: Val, w: f64| { let output: Val = ::bevy::math::DVec4::with_w( - _self.into(), + _self.into_inner(), w, ) .into(); @@ -15878,7 +16124,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::dot(_self.into(), rhs.into()) + let output: f64 = ::bevy::math::DVec4::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -15887,8 +16136,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::dot_into_vec( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15898,8 +16147,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "min", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::min( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15909,8 +16158,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "max", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::max( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15924,9 +16173,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max: Val| { let output: Val = ::bevy::math::DVec4::clamp( - _self.into(), - min.into(), - max.into(), + _self.into_inner(), + min.into_inner(), + max.into_inner(), ) .into(); output @@ -15935,7 +16184,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::min_element(_self.into()) + let output: f64 = ::bevy::math::DVec4::min_element( + _self.into_inner(), + ) .into(); output }, @@ -15943,7 +16194,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::max_element(_self.into()) + let output: f64 = ::bevy::math::DVec4::max_element( + _self.into_inner(), + ) .into(); output }, @@ -15951,7 +16204,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::element_sum(_self.into()) + let output: f64 = ::bevy::math::DVec4::element_sum( + _self.into_inner(), + ) .into(); output }, @@ -15959,7 +16214,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::element_product(_self.into()) + let output: f64 = ::bevy::math::DVec4::element_product( + _self.into_inner(), + ) .into(); output }, @@ -15968,8 +16225,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpeq", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::cmpeq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15979,8 +16236,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpne", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::cmpne( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -15990,8 +16247,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpge", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::cmpge( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16001,8 +16258,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmpgt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::cmpgt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16012,8 +16269,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmple", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::cmple( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16023,8 +16280,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "cmplt", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::cmplt( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16034,7 +16291,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "abs", |_self: Val| { let output: Val = ::bevy::math::DVec4::abs( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16044,7 +16301,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "signum", |_self: Val| { let output: Val = ::bevy::math::DVec4::signum( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16054,8 +16311,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "copysign", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::copysign( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16065,7 +16322,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_negative_bitmask", |_self: Val| { let output: u32 = ::bevy::math::DVec4::is_negative_bitmask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16074,7 +16331,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_finite(_self.into()) + let output: bool = ::bevy::math::DVec4::is_finite(_self.into_inner()) .into(); output }, @@ -16083,7 +16340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_finite_mask", |_self: Val| { let output: Val = ::bevy::math::DVec4::is_finite_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16092,7 +16349,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DVec4::is_nan(_self.into_inner()) + .into(); output }, ) @@ -16100,7 +16358,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_nan_mask", |_self: Val| { let output: Val = ::bevy::math::DVec4::is_nan_mask( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16109,14 +16367,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length(_self.into()).into(); + let output: f64 = ::bevy::math::DVec4::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length_squared(_self.into()) + let output: f64 = ::bevy::math::DVec4::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -16124,7 +16385,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length_recip(_self.into()) + let output: f64 = ::bevy::math::DVec4::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -16133,8 +16396,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec4::distance( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16144,8 +16407,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "distance_squared", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DVec4::distance_squared( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16155,8 +16418,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::div_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16166,8 +16429,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "rem_euclid", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::rem_euclid( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16177,7 +16440,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::DVec4::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16187,8 +16450,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or", |_self: Val, fallback: Val| { let output: Val = ::bevy::math::DVec4::normalize_or( - _self.into(), - fallback.into(), + _self.into_inner(), + fallback.into_inner(), ) .into(); output @@ -16198,7 +16461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize_or_zero", |_self: Val| { let output: Val = ::bevy::math::DVec4::normalize_or_zero( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16207,7 +16470,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_normalized(_self.into()) + let output: bool = ::bevy::math::DVec4::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -16216,8 +16481,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::project_onto( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16227,8 +16492,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::reject_from( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16238,8 +16503,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::project_onto_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16249,8 +16514,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::reject_from_normalized( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16260,7 +16525,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "round", |_self: Val| { let output: Val = ::bevy::math::DVec4::round( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16270,7 +16535,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "floor", |_self: Val| { let output: Val = ::bevy::math::DVec4::floor( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16280,7 +16545,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "ceil", |_self: Val| { let output: Val = ::bevy::math::DVec4::ceil( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16290,7 +16555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "trunc", |_self: Val| { let output: Val = ::bevy::math::DVec4::trunc( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16300,7 +16565,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract", |_self: Val| { let output: Val = ::bevy::math::DVec4::fract( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16310,7 +16575,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "fract_gl", |_self: Val| { let output: Val = ::bevy::math::DVec4::fract_gl( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16320,7 +16585,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "exp", |_self: Val| { let output: Val = ::bevy::math::DVec4::exp( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16330,7 +16595,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "powf", |_self: Val, n: f64| { let output: Val = ::bevy::math::DVec4::powf( - _self.into(), + _self.into_inner(), n, ) .into(); @@ -16341,7 +16606,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "recip", |_self: Val| { let output: Val = ::bevy::math::DVec4::recip( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16351,8 +16616,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, rhs: Val, s: f64| { let output: Val = ::bevy::math::DVec4::lerp( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), s, ) .into(); @@ -16364,7 +16629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val, d: f64| { let output: Val = ::bevy::math::DVec4::move_towards( &_self, - rhs.into(), + rhs.into_inner(), d, ) .into(); @@ -16375,8 +16640,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "midpoint", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DVec4::midpoint( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16390,8 +16655,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DVec4::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -16402,7 +16667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length", |_self: Val, min: f64, max: f64| { let output: Val = ::bevy::math::DVec4::clamp_length( - _self.into(), + _self.into_inner(), min, max, ) @@ -16414,7 +16679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_max", |_self: Val, max: f64| { let output: Val = ::bevy::math::DVec4::clamp_length_max( - _self.into(), + _self.into_inner(), max, ) .into(); @@ -16425,7 +16690,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "clamp_length_min", |_self: Val, min: f64| { let output: Val = ::bevy::math::DVec4::clamp_length_min( - _self.into(), + _self.into_inner(), min, ) .into(); @@ -16440,9 +16705,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { b: Val| { let output: Val = ::bevy::math::DVec4::mul_add( - _self.into(), - a.into(), - b.into(), + _self.into_inner(), + a.into_inner(), + b.into_inner(), ) .into(); output @@ -16452,8 +16717,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "reflect", |_self: Val, normal: Val| { let output: Val = ::bevy::math::DVec4::reflect( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), ) .into(); output @@ -16467,8 +16732,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { eta: f64| { let output: Val = ::bevy::math::DVec4::refract( - _self.into(), - normal.into(), + _self.into_inner(), + normal.into_inner(), eta, ) .into(); @@ -16529,7 +16794,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DVec4::add( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -16541,8 +16806,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16552,7 +16817,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -16563,8 +16828,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16574,8 +16839,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_cols", |x_axis: Val, y_axis: Val| { let output: Val = ::bevy::math::Mat2::from_cols( - x_axis.into(), - y_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), ) .into(); output @@ -16603,7 +16868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::Mat2::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -16613,7 +16878,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale_angle", |scale: Val, angle: f32| { let output: Val = ::bevy::math::Mat2::from_scale_angle( - scale.into(), + scale.into_inner(), angle, ) .into(); @@ -16634,7 +16899,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |m: Val| { let output: Val = ::bevy::math::Mat2::from_mat3( - m.into(), + m.into_inner(), ) .into(); output @@ -16644,7 +16909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3_minor", |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat2::from_mat3_minor( - m.into(), + m.into_inner(), i, j, ) @@ -16656,7 +16921,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3a", |m: Val| { let output: Val = ::bevy::math::Mat2::from_mat3a( - m.into(), + m.into_inner(), ) .into(); output @@ -16666,7 +16931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3a_minor", |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat2::from_mat3a_minor( - m.into(), + m.into_inner(), i, j, ) @@ -16742,7 +17007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat2::mul_vec2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -16812,7 +17077,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::Mat2::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -16848,8 +17113,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16859,7 +17124,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Mat2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -16869,7 +17134,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -16880,8 +17145,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16900,8 +17165,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16911,8 +17176,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16922,8 +17187,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -16937,9 +17202,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val| { let output: Val = ::bevy::math::Mat3::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), ) .into(); output @@ -16967,7 +17232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::Mat3::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -16977,7 +17242,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |m: Val| { let output: Val = ::bevy::math::Mat3::from_mat4( - m.into(), + m.into_inner(), ) .into(); output @@ -16987,7 +17252,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4_minor", |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat3::from_mat4_minor( - m.into(), + m.into_inner(), i, j, ) @@ -16999,7 +17264,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::Mat3::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -17009,7 +17274,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f32| { let output: Val = ::bevy::math::Mat3::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -17020,7 +17285,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |order: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Mat3::from_euler( - order.into(), + order.into_inner(), a, b, c, @@ -17034,7 +17299,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Mat3::to_euler( &_self, - order.into(), + order.into_inner(), ) .into(); output @@ -17074,7 +17339,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::Mat3::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -17098,9 +17363,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::Mat3::from_scale_angle_translation( - scale.into(), + scale.into_inner(), angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -17110,7 +17375,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::Mat3::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -17120,7 +17385,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2", |m: Val| { let output: Val = ::bevy::math::Mat3::from_mat2( - m.into(), + m.into_inner(), ) .into(); output @@ -17194,7 +17459,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::transform_point2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17205,7 +17470,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::transform_vector2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17216,7 +17481,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul_vec3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17227,7 +17492,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul_vec3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17297,7 +17562,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::Mat3::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -17333,7 +17598,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Mat3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -17343,8 +17608,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17362,8 +17627,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17373,8 +17638,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17384,7 +17649,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -17395,7 +17660,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -17407,7 +17672,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat3A::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -17425,8 +17690,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17436,8 +17701,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3A::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17461,9 +17726,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val| { let output: Val = ::bevy::math::Mat3A::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), ) .into(); output @@ -17491,7 +17756,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::Mat3A::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -17501,7 +17766,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |m: Val| { let output: Val = ::bevy::math::Mat3A::from_mat4( - m.into(), + m.into_inner(), ) .into(); output @@ -17511,7 +17776,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4_minor", |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::Mat3A::from_mat4_minor( - m.into(), + m.into_inner(), i, j, ) @@ -17523,7 +17788,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::Mat3A::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -17533,7 +17798,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f32| { let output: Val = ::bevy::math::Mat3A::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -17544,7 +17809,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |order: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Mat3A::from_euler( - order.into(), + order.into_inner(), a, b, c, @@ -17558,7 +17823,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Mat3A::to_euler( &_self, - order.into(), + order.into_inner(), ) .into(); output @@ -17598,7 +17863,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::Mat3A::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -17622,9 +17887,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::Mat3A::from_scale_angle_translation( - scale.into(), + scale.into_inner(), angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -17634,7 +17899,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::Mat3A::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -17644,7 +17909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2", |m: Val| { let output: Val = ::bevy::math::Mat3A::from_mat2( - m.into(), + m.into_inner(), ) .into(); output @@ -17718,7 +17983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::transform_point2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17729,7 +17994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::transform_vector2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17740,7 +18005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul_vec3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17751,7 +18016,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul_vec3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -17821,7 +18086,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::Mat3A::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -17850,7 +18115,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -17861,8 +18126,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17872,8 +18137,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3A::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17883,7 +18148,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Mat3A::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -17893,8 +18158,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17904,8 +18169,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17923,8 +18188,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17934,8 +18199,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17945,8 +18210,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -17956,7 +18221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -17967,7 +18232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::Mat4::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -17977,8 +18242,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -18001,10 +18266,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { w_axis: Val| { let output: Val = ::bevy::math::Mat4::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), + w_axis.into_inner(), ) .into(); output @@ -18032,7 +18297,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::Mat4::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -18046,9 +18311,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::Mat4::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), + scale.into_inner(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -18058,8 +18323,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = ::bevy::math::Mat4::from_rotation_translation( - rotation.into(), - translation.into(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -18069,7 +18334,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::Mat4::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -18079,7 +18344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |m: Val| { let output: Val = ::bevy::math::Mat4::from_mat3( - m.into(), + m.into_inner(), ) .into(); output @@ -18089,7 +18354,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3a", |m: Val| { let output: Val = ::bevy::math::Mat4::from_mat3a( - m.into(), + m.into_inner(), ) .into(); output @@ -18099,7 +18364,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::Mat4::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -18109,7 +18374,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f32| { let output: Val = ::bevy::math::Mat4::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -18120,7 +18385,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |order: Val, a: f32, b: f32, c: f32| { let output: Val = ::bevy::math::Mat4::from_euler( - order.into(), + order.into_inner(), a, b, c, @@ -18134,7 +18399,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, order: Val| { let output: (f32, f32, f32) = ::bevy::math::Mat4::to_euler( &_self, - order.into(), + order.into_inner(), ) .into(); output @@ -18174,7 +18439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::Mat4::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -18251,9 +18516,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Mat4::look_to_lh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -18267,9 +18532,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Mat4::look_to_rh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -18283,9 +18548,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Mat4::look_at_lh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -18299,9 +18564,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Mat4::look_at_rh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -18444,7 +18709,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::project_point3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18455,7 +18720,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_point3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18466,7 +18731,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_vector3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18477,7 +18742,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::project_point3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18488,7 +18753,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_point3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18499,7 +18764,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::transform_vector3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18510,7 +18775,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Mat4::mul_vec4( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18580,7 +18845,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::Mat4::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -18609,8 +18874,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Mat4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -18620,7 +18885,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f32| { let output: Val = ::bevy::math::Mat4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -18642,7 +18907,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DMat2::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -18653,7 +18918,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DMat2::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -18664,8 +18929,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -18675,8 +18940,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat2::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -18686,8 +18951,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat2::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -18697,8 +18962,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -18715,8 +18980,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_cols", |x_axis: Val, y_axis: Val| { let output: Val = ::bevy::math::DMat2::from_cols( - x_axis.into(), - y_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), ) .into(); output @@ -18744,7 +19009,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::DMat2::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -18754,7 +19019,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale_angle", |scale: Val, angle: f64| { let output: Val = ::bevy::math::DMat2::from_scale_angle( - scale.into(), + scale.into_inner(), angle, ) .into(); @@ -18775,7 +19040,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |m: Val| { let output: Val = ::bevy::math::DMat2::from_mat3( - m.into(), + m.into_inner(), ) .into(); output @@ -18785,7 +19050,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3_minor", |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::DMat2::from_mat3_minor( - m.into(), + m.into_inner(), i, j, ) @@ -18861,7 +19126,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat2::mul_vec2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -18931,7 +19196,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::DMat2::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -18960,7 +19225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DMat2::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -18971,7 +19236,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DMat3::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -18992,8 +19257,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat3::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19003,8 +19268,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19014,8 +19279,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat3::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19029,9 +19294,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val| { let output: Val = ::bevy::math::DMat3::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), ) .into(); output @@ -19059,7 +19324,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::DMat3::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -19069,7 +19334,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |m: Val| { let output: Val = ::bevy::math::DMat3::from_mat4( - m.into(), + m.into_inner(), ) .into(); output @@ -19079,7 +19344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4_minor", |m: Val, i: usize, j: usize| { let output: Val = ::bevy::math::DMat3::from_mat4_minor( - m.into(), + m.into_inner(), i, j, ) @@ -19091,7 +19356,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::DMat3::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -19101,7 +19366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f64| { let output: Val = ::bevy::math::DMat3::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -19112,7 +19377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |order: Val, a: f64, b: f64, c: f64| { let output: Val = ::bevy::math::DMat3::from_euler( - order.into(), + order.into_inner(), a, b, c, @@ -19126,7 +19391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, order: Val| { let output: (f64, f64, f64) = ::bevy::math::DMat3::to_euler( &_self, - order.into(), + order.into_inner(), ) .into(); output @@ -19166,7 +19431,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::DMat3::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -19190,9 +19455,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::DMat3::from_scale_angle_translation( - scale.into(), + scale.into_inner(), angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -19202,7 +19467,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::DMat3::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -19212,7 +19477,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2", |m: Val| { let output: Val = ::bevy::math::DMat3::from_mat2( - m.into(), + m.into_inner(), ) .into(); output @@ -19286,7 +19551,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat3::transform_point2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -19297,7 +19562,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat3::transform_vector2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -19308,7 +19573,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat3::mul_vec3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -19378,7 +19643,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::DMat3::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -19407,7 +19672,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DMat3::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -19418,8 +19683,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19429,8 +19694,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19447,7 +19712,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DMat3::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -19458,8 +19723,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat4::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19469,8 +19734,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19480,8 +19745,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19508,7 +19773,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DMat4::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -19519,8 +19784,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat4::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -19535,10 +19800,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { w_axis: Val| { let output: Val = ::bevy::math::DMat4::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), + w_axis.into_inner(), ) .into(); output @@ -19566,7 +19831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_diagonal", |diagonal: Val| { let output: Val = ::bevy::math::DMat4::from_diagonal( - diagonal.into(), + diagonal.into_inner(), ) .into(); output @@ -19580,9 +19845,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::DMat4::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), + scale.into_inner(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -19592,8 +19857,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = ::bevy::math::DMat4::from_rotation_translation( - rotation.into(), - translation.into(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -19603,7 +19868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::DMat4::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -19613,7 +19878,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |m: Val| { let output: Val = ::bevy::math::DMat4::from_mat3( - m.into(), + m.into_inner(), ) .into(); output @@ -19623,7 +19888,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::DMat4::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -19633,7 +19898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f64| { let output: Val = ::bevy::math::DMat4::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -19644,7 +19909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |order: Val, a: f64, b: f64, c: f64| { let output: Val = ::bevy::math::DMat4::from_euler( - order.into(), + order.into_inner(), a, b, c, @@ -19658,7 +19923,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, order: Val| { let output: (f64, f64, f64) = ::bevy::math::DMat4::to_euler( &_self, - order.into(), + order.into_inner(), ) .into(); output @@ -19698,7 +19963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::DMat4::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -19775,9 +20040,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DMat4::look_to_lh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -19791,9 +20056,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DMat4::look_to_rh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -19807,9 +20072,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DMat4::look_at_lh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -19823,9 +20088,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DMat4::look_at_rh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -19968,7 +20233,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::project_point3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -19979,7 +20244,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::transform_point3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -19990,7 +20255,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::transform_vector3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20001,7 +20266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DMat4::mul_vec4( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20071,7 +20336,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::DMat4::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -20100,7 +20365,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DMat4::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -20111,7 +20376,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DMat4::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -20121,8 +20386,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DMat4::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20137,9 +20402,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val| { let output: Val = ::bevy::math::Affine2::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), ) .into(); output @@ -20167,7 +20432,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::Affine2::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -20187,7 +20452,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::Affine2::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -20197,7 +20462,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2", |matrix2: Val| { let output: Val = ::bevy::math::Affine2::from_mat2( - matrix2.into(), + matrix2.into_inner(), ) .into(); output @@ -20207,8 +20472,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2_translation", |matrix2: Val, translation: Val| { let output: Val = ::bevy::math::Affine2::from_mat2_translation( - matrix2.into(), - translation.into(), + matrix2.into_inner(), + translation.into_inner(), ) .into(); output @@ -20222,9 +20487,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::Affine2::from_scale_angle_translation( - scale.into(), + scale.into_inner(), angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -20235,7 +20500,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |angle: f32, translation: Val| { let output: Val = ::bevy::math::Affine2::from_angle_translation( angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -20245,7 +20510,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |m: Val| { let output: Val = ::bevy::math::Affine2::from_mat3( - m.into(), + m.into_inner(), ) .into(); output @@ -20255,7 +20520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3a", |m: Val| { let output: Val = ::bevy::math::Affine2::from_mat3a( - m.into(), + m.into_inner(), ) .into(); output @@ -20266,7 +20531,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine2::transform_point2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20277,7 +20542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine2::transform_vector2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20306,7 +20571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::Affine2::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -20327,8 +20592,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Affine2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20338,8 +20603,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Affine2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20349,8 +20614,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Affine2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20383,10 +20648,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { w_axis: Val| { let output: Val = ::bevy::math::Affine3A::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), + w_axis.into_inner(), ) .into(); output @@ -20414,7 +20679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::Affine3A::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -20424,7 +20689,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::Affine3A::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -20434,7 +20699,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f32| { let output: Val = ::bevy::math::Affine3A::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -20475,7 +20740,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::Affine3A::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -20485,7 +20750,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |mat3: Val| { let output: Val = ::bevy::math::Affine3A::from_mat3( - mat3.into(), + mat3.into_inner(), ) .into(); output @@ -20495,8 +20760,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3_translation", |mat3: Val, translation: Val| { let output: Val = ::bevy::math::Affine3A::from_mat3_translation( - mat3.into(), - translation.into(), + mat3.into_inner(), + translation.into_inner(), ) .into(); output @@ -20510,9 +20775,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::Affine3A::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), + scale.into_inner(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -20522,8 +20787,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = ::bevy::math::Affine3A::from_rotation_translation( - rotation.into(), - translation.into(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -20533,7 +20798,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |m: Val| { let output: Val = ::bevy::math::Affine3A::from_mat4( - m.into(), + m.into_inner(), ) .into(); output @@ -20547,9 +20812,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Affine3A::look_to_lh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -20563,9 +20828,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Affine3A::look_to_rh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -20579,9 +20844,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Affine3A::look_at_lh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -20595,9 +20860,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::Affine3A::look_at_rh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -20608,7 +20873,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_point3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20619,7 +20884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_vector3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20630,7 +20895,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_point3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20641,7 +20906,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::Affine3A::transform_vector3a( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20670,7 +20935,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::Affine3A::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -20691,8 +20956,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Affine3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20709,8 +20974,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::Affine3A::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20731,8 +20996,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DAffine2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20763,9 +21028,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val| { let output: Val = ::bevy::math::DAffine2::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), ) .into(); output @@ -20793,7 +21058,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::DAffine2::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -20813,7 +21078,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::DAffine2::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -20823,7 +21088,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2", |matrix2: Val| { let output: Val = ::bevy::math::DAffine2::from_mat2( - matrix2.into(), + matrix2.into_inner(), ) .into(); output @@ -20833,8 +21098,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat2_translation", |matrix2: Val, translation: Val| { let output: Val = ::bevy::math::DAffine2::from_mat2_translation( - matrix2.into(), - translation.into(), + matrix2.into_inner(), + translation.into_inner(), ) .into(); output @@ -20848,9 +21113,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::DAffine2::from_scale_angle_translation( - scale.into(), + scale.into_inner(), angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -20861,7 +21126,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |angle: f64, translation: Val| { let output: Val = ::bevy::math::DAffine2::from_angle_translation( angle, - translation.into(), + translation.into_inner(), ) .into(); output @@ -20871,7 +21136,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |m: Val| { let output: Val = ::bevy::math::DAffine2::from_mat3( - m.into(), + m.into_inner(), ) .into(); output @@ -20882,7 +21147,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine2::transform_point2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20893,7 +21158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine2::transform_vector2( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -20922,7 +21187,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::DAffine2::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -20943,8 +21208,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DAffine2::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20955,8 +21220,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DAffine3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -20988,10 +21253,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { w_axis: Val| { let output: Val = ::bevy::math::DAffine3::from_cols( - x_axis.into(), - y_axis.into(), - z_axis.into(), - w_axis.into(), + x_axis.into_inner(), + y_axis.into_inner(), + z_axis.into_inner(), + w_axis.into_inner(), ) .into(); output @@ -21019,7 +21284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scale", |scale: Val| { let output: Val = ::bevy::math::DAffine3::from_scale( - scale.into(), + scale.into_inner(), ) .into(); output @@ -21029,7 +21294,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_quat", |rotation: Val| { let output: Val = ::bevy::math::DAffine3::from_quat( - rotation.into(), + rotation.into_inner(), ) .into(); output @@ -21039,7 +21304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f64| { let output: Val = ::bevy::math::DAffine3::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -21080,7 +21345,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_translation", |translation: Val| { let output: Val = ::bevy::math::DAffine3::from_translation( - translation.into(), + translation.into_inner(), ) .into(); output @@ -21090,7 +21355,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3", |mat3: Val| { let output: Val = ::bevy::math::DAffine3::from_mat3( - mat3.into(), + mat3.into_inner(), ) .into(); output @@ -21100,8 +21365,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat3_translation", |mat3: Val, translation: Val| { let output: Val = ::bevy::math::DAffine3::from_mat3_translation( - mat3.into(), - translation.into(), + mat3.into_inner(), + translation.into_inner(), ) .into(); output @@ -21115,9 +21380,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { translation: Val| { let output: Val = ::bevy::math::DAffine3::from_scale_rotation_translation( - scale.into(), - rotation.into(), - translation.into(), + scale.into_inner(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -21127,8 +21392,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = ::bevy::math::DAffine3::from_rotation_translation( - rotation.into(), - translation.into(), + rotation.into_inner(), + translation.into_inner(), ) .into(); output @@ -21138,7 +21403,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_mat4", |m: Val| { let output: Val = ::bevy::math::DAffine3::from_mat4( - m.into(), + m.into_inner(), ) .into(); output @@ -21152,9 +21417,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DAffine3::look_to_lh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -21168,9 +21433,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DAffine3::look_to_rh( - eye.into(), - dir.into(), - up.into(), + eye.into_inner(), + dir.into_inner(), + up.into_inner(), ) .into(); output @@ -21184,9 +21449,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DAffine3::look_at_lh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -21200,9 +21465,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { up: Val| { let output: Val = ::bevy::math::DAffine3::look_at_rh( - eye.into(), - center.into(), - up.into(), + eye.into_inner(), + center.into_inner(), + up.into_inner(), ) .into(); output @@ -21213,7 +21478,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine3::transform_point3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -21224,7 +21489,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref, rhs: Val| { let output: Val = ::bevy::math::DAffine3::transform_vector3( &_self, - rhs.into(), + rhs.into_inner(), ) .into(); output @@ -21253,7 +21518,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: bool = ::bevy::math::DAffine3::abs_diff_eq( &_self, - rhs.into(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -21274,8 +21539,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DAffine3::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21286,7 +21551,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DQuat::mul( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -21297,8 +21562,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "add", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DQuat::add( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21315,7 +21580,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "neg", |_self: Val| { let output: Val = ::bevy::math::DQuat::neg( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21335,7 +21600,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "div", |_self: Val, rhs: f64| { let output: Val = ::bevy::math::DQuat::div( - _self.into(), + _self.into_inner(), rhs, ) .into(); @@ -21369,7 +21634,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_vec4", |v: Val| { let output: Val = ::bevy::math::DQuat::from_vec4( - v.into(), + v.into_inner(), ) .into(); output @@ -21379,7 +21644,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_axis_angle", |axis: Val, angle: f64| { let output: Val = ::bevy::math::DQuat::from_axis_angle( - axis.into(), + axis.into_inner(), angle, ) .into(); @@ -21390,7 +21655,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_scaled_axis", |v: Val| { let output: Val = ::bevy::math::DQuat::from_scaled_axis( - v.into(), + v.into_inner(), ) .into(); output @@ -21430,7 +21695,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_euler", |euler: Val, a: f64, b: f64, c: f64| { let output: Val = ::bevy::math::DQuat::from_euler( - euler.into(), + euler.into_inner(), a, b, c, @@ -21463,8 +21728,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_arc", |from: Val, to: Val| { let output: Val = ::bevy::math::DQuat::from_rotation_arc( - from.into(), - to.into(), + from.into_inner(), + to.into_inner(), ) .into(); output @@ -21474,8 +21739,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_arc_colinear", |from: Val, to: Val| { let output: Val = ::bevy::math::DQuat::from_rotation_arc_colinear( - from.into(), - to.into(), + from.into_inner(), + to.into_inner(), ) .into(); output @@ -21485,8 +21750,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "from_rotation_arc_2d", |from: Val, to: Val| { let output: Val = ::bevy::math::DQuat::from_rotation_arc_2d( - from.into(), - to.into(), + from.into_inner(), + to.into_inner(), ) .into(); output @@ -21496,7 +21761,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_scaled_axis", |_self: Val| { let output: Val = ::bevy::math::DQuat::to_scaled_axis( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21506,8 +21771,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "to_euler", |_self: Val, order: Val| { let output: (f64, f64, f64) = ::bevy::math::DQuat::to_euler( - _self.into(), - order.into(), + _self.into_inner(), + order.into_inner(), ) .into(); output @@ -21524,7 +21789,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "xyz", |_self: Val| { let output: Val = ::bevy::math::DQuat::xyz( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21534,7 +21799,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "conjugate", |_self: Val| { let output: Val = ::bevy::math::DQuat::conjugate( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21544,7 +21809,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "inverse", |_self: Val| { let output: Val = ::bevy::math::DQuat::inverse( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21553,7 +21818,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DQuat::dot(_self.into(), rhs.into()) + let output: f64 = ::bevy::math::DQuat::dot( + _self.into_inner(), + rhs.into_inner(), + ) .into(); output }, @@ -21561,14 +21829,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length(_self.into()).into(); + let output: f64 = ::bevy::math::DQuat::length(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length_squared(_self.into()) + let output: f64 = ::bevy::math::DQuat::length_squared( + _self.into_inner(), + ) .into(); output }, @@ -21576,7 +21847,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length_recip(_self.into()) + let output: f64 = ::bevy::math::DQuat::length_recip( + _self.into_inner(), + ) .into(); output }, @@ -21585,7 +21858,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "normalize", |_self: Val| { let output: Val = ::bevy::math::DQuat::normalize( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21594,7 +21867,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_finite(_self.into()) + let output: bool = ::bevy::math::DQuat::is_finite(_self.into_inner()) .into(); output }, @@ -21602,14 +21875,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_nan(_self.into()).into(); + let output: bool = ::bevy::math::DQuat::is_nan(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_normalized(_self.into()) + let output: bool = ::bevy::math::DQuat::is_normalized( + _self.into_inner(), + ) .into(); output }, @@ -21618,7 +21894,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "is_near_identity", |_self: Val| { let output: bool = ::bevy::math::DQuat::is_near_identity( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21628,8 +21904,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "angle_between", |_self: Val, rhs: Val| { let output: f64 = ::bevy::math::DQuat::angle_between( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21644,7 +21920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { { let output: Val = ::bevy::math::DQuat::rotate_towards( &_self, - rhs.into(), + rhs.into_inner(), max_angle, ) .into(); @@ -21659,8 +21935,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { max_abs_diff: f64| { let output: bool = ::bevy::math::DQuat::abs_diff_eq( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), max_abs_diff, ) .into(); @@ -21671,8 +21947,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "lerp", |_self: Val, end: Val, s: f64| { let output: Val = ::bevy::math::DQuat::lerp( - _self.into(), - end.into(), + _self.into_inner(), + end.into_inner(), s, ) .into(); @@ -21683,8 +21959,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "slerp", |_self: Val, end: Val, s: f64| { let output: Val = ::bevy::math::DQuat::slerp( - _self.into(), - end.into(), + _self.into_inner(), + end.into_inner(), s, ) .into(); @@ -21695,8 +21971,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_vec3", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DQuat::mul_vec3( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21706,8 +21982,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul_quat", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DQuat::mul_quat( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21727,7 +22003,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "as_quat", |_self: Val| { let output: Val = ::bevy::math::DQuat::as_quat( - _self.into(), + _self.into_inner(), ) .into(); output @@ -21737,8 +22013,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "sub", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DQuat::sub( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21748,8 +22024,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21759,8 +22035,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { "mul", |_self: Val, rhs: Val| { let output: Val = ::bevy::math::DQuat::mul( - _self.into(), - rhs.into(), + _self.into_inner(), + rhs.into_inner(), ) .into(); output @@ -21828,21 +22104,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec3A::bitmask(_self.into()).into(); + let output: u32 = ::bevy::math::BVec3A::bitmask(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec3A::any(_self.into()).into(); + let output: bool = ::bevy::math::BVec3A::any(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec3A::all(_self.into()).into(); + let output: bool = ::bevy::math::BVec3A::all(_self.into_inner()) + .into(); output }, ) @@ -21923,21 +22202,24 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec4A::bitmask(_self.into()).into(); + let output: u32 = ::bevy::math::BVec4A::bitmask(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec4A::any(_self.into()).into(); + let output: bool = ::bevy::math::BVec4A::any(_self.into_inner()) + .into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec4A::all(_self.into()).into(); + let output: bool = ::bevy::math::BVec4A::all(_self.into_inner()) + .into(); output }, ) @@ -22106,7 +22388,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_bytes", |_self: Val| { - let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into()).into(); + let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into_inner()) + .into(); output }, ) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs index 390e71408c..aa222d4f93 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -51,7 +51,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { |duration: f32, mode: Val| { let output: Val = ::bevy::time::prelude::Timer::from_seconds( duration, - mode.into(), + mode.into_inner(), ) .into(); output @@ -111,7 +111,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { { let output: () = ::bevy::time::prelude::Timer::set_mode( &mut _self, - mode.into(), + mode.into_inner(), ) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs index 690458b2f0..f892d9b3f5 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -85,7 +85,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { { let output: Val = ::bevy::transform::components::GlobalTransform::mul_transform( &_self, - transform.into(), + transform.into_inner(), ) .into(); output @@ -98,8 +98,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { global_transform: Val| { let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into(), - global_transform.into(), + _self.into_inner(), + global_transform.into_inner(), ) .into(); output @@ -112,8 +112,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { transform: Val| { let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into(), - transform.into(), + _self.into_inner(), + transform.into_inner(), ) .into(); output @@ -151,8 +151,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { global_transform: Val| { let output: Val = ::bevy::transform::components::Transform::mul( - _self.into(), - global_transform.into(), + _self.into_inner(), + global_transform.into_inner(), ) .into(); output @@ -244,7 +244,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { { let output: Val = ::bevy::transform::components::Transform::mul_transform( &_self, - transform.into(), + transform.into_inner(), ) .into(); output @@ -267,8 +267,8 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { transform: Val| { let output: Val = ::bevy::transform::components::Transform::mul( - _self.into(), - transform.into(), + _self.into_inner(), + transform.into_inner(), ) .into(); output From 14bb044b11ac6c4b1951c13718813561e614e39e Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:33:33 +0000 Subject: [PATCH 116/217] fix mutability --- crates/bevy_api_gen/templates/footer.tera | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 867624c59f..17f680f791 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -16,6 +16,8 @@ impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_c {%- for function in item.functions -%} .overwrite_script_function("{{ function.ident }}", | {%- for arg in function.args -%} + {%- if arg.proxy_ty is matching("Mut.*")-%} + mut {% endif -%} {%- if arg.ident != "self" -%} {{- arg.ident -}} {%- else -%} From e62186beec70d876951b385a676dfccfd6d219ae Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 22:37:18 +0000 Subject: [PATCH 117/217] clippyies --- crates/bevy_api_gen/src/callback.rs | 5 ++--- crates/bevy_api_gen/src/context.rs | 10 +++++----- .../bevy_api_gen/src/passes/find_methods_and_fields.rs | 4 +--- crates/bevy_api_gen/src/passes/find_trait_impls.rs | 2 +- .../bevy_api_gen/src/passes/populate_template_data.rs | 9 ++++----- crates/bevy_api_gen/src/plugin.rs | 2 +- 6 files changed, 14 insertions(+), 18 deletions(-) diff --git a/crates/bevy_api_gen/src/callback.rs b/crates/bevy_api_gen/src/callback.rs index f1b87ab8ce..d2e7483b83 100644 --- a/crates/bevy_api_gen/src/callback.rs +++ b/crates/bevy_api_gen/src/callback.rs @@ -1,5 +1,4 @@ use log::{info, trace}; -use rustc_errors::FatalError; use rustc_hir::def_id::LOCAL_CRATE; use tera::Context; @@ -16,10 +15,10 @@ impl BevyAnalyzerCallbacks { } impl rustc_driver::Callbacks for BevyAnalyzerCallbacks { - fn after_expansion<'tcx>( + fn after_expansion( &mut self, compiler: &rustc_interface::interface::Compiler, - tcx: rustc_middle::ty::TyCtxt<'tcx>, + tcx: rustc_middle::ty::TyCtxt<'_>, ) -> rustc_driver::Compilation { trace!("After expansion callback"); diff --git a/crates/bevy_api_gen/src/context.rs b/crates/bevy_api_gen/src/context.rs index b1d4c234b8..1e282a7411 100644 --- a/crates/bevy_api_gen/src/context.rs +++ b/crates/bevy_api_gen/src/context.rs @@ -133,11 +133,11 @@ impl CachedTraits { self.bevy_reflect_reflect.is_some() && self.bevy_reflect_get_type_registration.is_some() } - pub(crate) fn has_all_std_source_traits(&self) -> bool { - STD_SOURCE_TRAITS - .iter() - .all(|t| self.std_source_traits.contains_key(*t)) - } + // pub(crate) fn has_all_std_source_traits(&self) -> bool { + // STD_SOURCE_TRAITS + // .iter() + // .all(|t| self.std_source_traits.contains_key(*t)) + // } // pub(crate) fn missing_std_source_traits(&self) -> Vec { // STD_SOURCE_TRAITS 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 150f4e7701..583ad0ae52 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,9 +6,7 @@ use rustc_hir::{ Safety, }; use rustc_infer::infer::TyCtxtInferExt; -use rustc_middle::ty::{ - AdtKind, AssocKind, FieldDef, FnSig, ParamEnv, Ty, TyCtxt, TyKind, TypingEnv, TypingMode, -}; +use rustc_middle::ty::{AdtKind, AssocKind, FieldDef, FnSig, Ty, TyCtxt, TyKind, TypingEnv}; use rustc_span::Symbol; use rustc_trait_selection::infer::InferCtxtExt; 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 72a5a1620e..7a6cb83288 100644 --- a/crates/bevy_api_gen/src/passes/find_trait_impls.rs +++ b/crates/bevy_api_gen/src/passes/find_trait_impls.rs @@ -8,7 +8,7 @@ use rustc_infer::{ }; use rustc_middle::ty::{Ty, TypingEnv, TypingMode}; use rustc_span::DUMMY_SP; -use rustc_trait_selection::{regions::InferCtxtRegionExt, traits::ObligationCtxt}; +use rustc_trait_selection::traits::ObligationCtxt; use crate::{Args, BevyCtxt}; diff --git a/crates/bevy_api_gen/src/passes/populate_template_data.rs b/crates/bevy_api_gen/src/passes/populate_template_data.rs index 9af1a3e89a..498066e59c 100644 --- a/crates/bevy_api_gen/src/passes/populate_template_data.rs +++ b/crates/bevy_api_gen/src/passes/populate_template_data.rs @@ -1,17 +1,16 @@ -use std::{any::Any, borrow::Cow, convert::identity}; +use std::{borrow::Cow, convert::identity}; use log::{trace, warn}; use rustc_ast::Attribute; use rustc_hir::def_id::{DefId, LOCAL_CRATE}; use rustc_middle::ty::{ - print::Print, AdtDef, FieldDef, GenericArg, GenericParamDefKind, ParamTy, TraitRef, Ty, TyKind, - TypeFoldable, TypingEnv, + AdtDef, FieldDef, GenericArg, GenericParamDefKind, TraitRef, Ty, TyKind, TypingEnv, }; use rustc_span::Symbol; use crate::{ - Arg, Args, BevyCtxt, Field, Function, FunctionContext, ImportPathFinder, Item, Output, - ReflectType, TemplateContext, Variant, + Arg, Args, BevyCtxt, Field, Function, FunctionContext, Item, Output, ReflectType, + TemplateContext, Variant, }; /// Converts the BevyCtxt into simpler data that can be used in templates directly, /// Clears the BevyCtxt by clearing data structures after it uses them. diff --git a/crates/bevy_api_gen/src/plugin.rs b/crates/bevy_api_gen/src/plugin.rs index ec45cf896f..cc4bc10cba 100644 --- a/crates/bevy_api_gen/src/plugin.rs +++ b/crates/bevy_api_gen/src/plugin.rs @@ -54,7 +54,7 @@ impl RustcPlugin for BevyAnalyzer { let mut callbacks = BevyAnalyzerCallbacks::new(plugin_args); let mut compiler = rustc_driver::RunCompiler::new(&compiler_args, &mut callbacks); compiler.set_file_loader(Some(Box::new(ModifyingFileLoader))); - let out = compiler.run(); + compiler.run(); log::trace!("Finished compiling with plugin"); Ok(()) } From 77222589c98bca285e0f9ea169277c8036ec5a84 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 22:39:21 +0000 Subject: [PATCH 118/217] chore(codegen): update bevy bindings (#179) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_ecs.rs | 4 ++-- .../src/bevy_bindings/bevy_hierarchy.rs | 2 +- .../src/bevy_bindings/bevy_input.rs | 14 +++++++------- .../src/bevy_bindings/bevy_math.rs | 4 ++-- .../src/bevy_bindings/bevy_reflect.rs | 10 +++++----- .../src/bevy_bindings/bevy_time.rs | 14 +++++++------- .../src/bevy_bindings/bevy_transform.rs | 12 ++++++------ 7 files changed, 30 insertions(+), 30 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs index 372a31ec2e..202f2f9033 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -166,7 +166,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { ) .overwrite_script_function( "set", - |_self: Mut, tick: u32| { + |mut _self: Mut, tick: u32| { let output: () = ::bevy::ecs::component::Tick::set(&mut _self, tick) .into(); output @@ -265,7 +265,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "set_changed", | - _self: Mut, + mut _self: Mut, change_tick: Val| { let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs index 00288d97f7..077abe92c0 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs @@ -18,7 +18,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { .overwrite_script_function( "swap", | - _self: Mut, + mut _self: Mut, a_index: usize, b_index: usize| { diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs index 9b9078f930..e81144868d 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -945,7 +945,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_press_threshold", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( &mut _self, value, @@ -966,7 +966,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_release_threshold", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( &mut _self, value, @@ -1012,7 +1012,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_livezone_upperbound", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( &mut _self, value, @@ -1033,7 +1033,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_deadzone_upperbound", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( &mut _self, value, @@ -1054,7 +1054,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_livezone_lowerbound", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( &mut _self, value, @@ -1075,7 +1075,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_deadzone_lowerbound", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( &mut _self, value, @@ -1096,7 +1096,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { ) .overwrite_script_function( "set_threshold", - |_self: Mut, value: f32| { + |mut _self: Mut, value: f32| { let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( &mut _self, value, diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs index 1d0b196b97..1f6746cc61 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -2341,7 +2341,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ) .overwrite_script_function( "reverse", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::math::primitives::Triangle2d::reverse( &mut _self, ) @@ -2884,7 +2884,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ) .overwrite_script_function( "reverse", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::math::primitives::Triangle3d::reverse( &mut _self, ) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs index beb1d85ddb..c23d6e952f 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -13567,7 +13567,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "set", - |_self: Mut, index: usize, value: bool| { + |mut _self: Mut, index: usize, value: bool| { let output: () = ::bevy::math::BVec2::set(&mut _self, index, value) .into(); output @@ -13647,7 +13647,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "set", - |_self: Mut, index: usize, value: bool| { + |mut _self: Mut, index: usize, value: bool| { let output: () = ::bevy::math::BVec3::set(&mut _self, index, value) .into(); output @@ -13745,7 +13745,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "set", - |_self: Mut, index: usize, value: bool| { + |mut _self: Mut, index: usize, value: bool| { let output: () = ::bevy::math::BVec4::set(&mut _self, index, value) .into(); output @@ -22134,7 +22134,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "set", - |_self: Mut, index: usize, value: bool| { + |mut _self: Mut, index: usize, value: bool| { let output: () = ::bevy::math::BVec3A::set(&mut _self, index, value) .into(); output @@ -22232,7 +22232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "set", - |_self: Mut, index: usize, value: bool| { + |mut _self: Mut, index: usize, value: bool| { let output: () = ::bevy::math::BVec4A::set(&mut _self, index, value) .into(); output diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs index aa222d4f93..325c38597b 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -106,7 +106,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "set_mode", | - _self: Mut, + mut _self: Mut, mode: Val| { let output: () = ::bevy::time::prelude::Timer::set_mode( @@ -119,7 +119,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { ) .overwrite_script_function( "pause", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::time::prelude::Timer::pause(&mut _self) .into(); output @@ -127,7 +127,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { ) .overwrite_script_function( "unpause", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::time::prelude::Timer::unpause(&mut _self) .into(); output @@ -143,7 +143,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { ) .overwrite_script_function( "reset", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::time::prelude::Timer::reset(&mut _self) .into(); output @@ -291,14 +291,14 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { ) .overwrite_script_function( "pause", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::time::Stopwatch::pause(&mut _self).into(); output }, ) .overwrite_script_function( "unpause", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::time::Stopwatch::unpause(&mut _self).into(); output }, @@ -312,7 +312,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { ) .overwrite_script_function( "reset", - |_self: Mut| { + |mut _self: Mut| { let output: () = ::bevy::time::Stopwatch::reset(&mut _self).into(); output }, diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs index f892d9b3f5..7a753a3bed 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -172,7 +172,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { ) .overwrite_script_function( "rotate_x", - |_self: Mut, angle: f32| { + |mut _self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_x( &mut _self, angle, @@ -183,7 +183,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { ) .overwrite_script_function( "rotate_y", - |_self: Mut, angle: f32| { + |mut _self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_y( &mut _self, angle, @@ -194,7 +194,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { ) .overwrite_script_function( "rotate_z", - |_self: Mut, angle: f32| { + |mut _self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_z( &mut _self, angle, @@ -205,7 +205,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { ) .overwrite_script_function( "rotate_local_x", - |_self: Mut, angle: f32| { + |mut _self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_x( &mut _self, angle, @@ -216,7 +216,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { ) .overwrite_script_function( "rotate_local_y", - |_self: Mut, angle: f32| { + |mut _self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_y( &mut _self, angle, @@ -227,7 +227,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { ) .overwrite_script_function( "rotate_local_z", - |_self: Mut, angle: f32| { + |mut _self: Mut, angle: f32| { let output: () = ::bevy::transform::components::Transform::rotate_local_z( &mut _self, angle, From 8e03e549ddd5c71a92894bd0f00ced8efefee972 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 28 Dec 2024 23:00:23 +0000 Subject: [PATCH 119/217] trait calls --- crates/bevy_api_gen/src/template.rs | 28 +++++++++++++++++++++++ crates/bevy_api_gen/templates/footer.tera | 20 ++++++++-------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/crates/bevy_api_gen/src/template.rs b/crates/bevy_api_gen/src/template.rs index 9be87a7811..2349dcafac 100644 --- a/crates/bevy_api_gen/src/template.rs +++ b/crates/bevy_api_gen/src/template.rs @@ -317,6 +317,34 @@ pub(crate) fn configure_tera_env(tera: &mut Tera, crate_name: &str) { let case = expect_str(expect_arg(args, "case")?)?; Ok(Value::String(str.to_case(case_from_str(case)?))) }, + ); + + tera.register_filter( + "to_arg_pattern", + |val: &Value, _args: &HashMap| { + let ty = expect_str(val)?; + if ty == "self" { + return Ok(Value::String("_self".to_owned())); + } + Ok(Value::String(ty.to_owned())) + }, + ); + + tera.register_function( + "function_call_expression", + |args: &HashMap| { + let ident = expect_str(expect_arg(args, "type")?)?; + let function_name = expect_str(expect_arg(args, "function")?)?; + let trait_name: Option<&str> = args.get("trait").and_then(|v| v.as_str()); + + if let Some(trait_name) = trait_name { + Ok(Value::String(format!( + "<{ident} as {trait_name}>::{function_name}" + ))) + } else { + Ok(Value::String(format!("{ident}::{function_name}"))) + } + }, ) } diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 17f680f791..405349fadf 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -18,25 +18,23 @@ impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_c {%- for arg in function.args -%} {%- if arg.proxy_ty is matching("Mut.*")-%} mut {% endif -%} - {%- if arg.ident != "self" -%} - {{- arg.ident -}} - {%- else -%} - _{{- arg.ident -}} - {%- endif -%} + {{- arg.ident | to_arg_pattern() -}} : {{- arg.proxy_ty -}}, {%- endfor -%} | { - let output: {{ function.output.proxy_ty }} = ::{{ item.import_path }}::{{ function.ident }}( + let output: {{ function.output.proxy_ty }} = + {%- if function.from_trait_path -%} + {{- function_call_expression(type=item.import_path, trait=function.from_trait_path, function=function.ident) -}} + {%- else -%} + {{- function_call_expression(type=item.import_path, function=function.ident) -}} + {%- endif -%} + ( {%- for arg in function.args -%} {%- if arg.proxy_ty is matching("Ref.*")-%} &{% endif -%} {%- if arg.proxy_ty is matching ("Mut.*")-%} &mut {% endif -%} - {%- if arg.ident != "self" -%} - {{- arg.ident -}} - {%- else -%} - _{{- arg.ident -}} - {%- endif -%} + {{- arg.ident | to_arg_pattern() -}} {%- if arg.proxy_ty is matching("Val.*")-%} .into_inner() {%- endif -%}, From f8f778cbc0bb13e9ba1f1e3ba88ab27c678b3d20 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 28 Dec 2024 23:05:03 +0000 Subject: [PATCH 120/217] chore(codegen): update bevy bindings (#180) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_core.rs | 6 +- .../src/bevy_bindings/bevy_ecs.rs | 80 +- .../src/bevy_bindings/bevy_hierarchy.rs | 22 +- .../src/bevy_bindings/bevy_input.rs | 412 +- .../src/bevy_bindings/bevy_math.rs | 877 ++- .../src/bevy_bindings/bevy_reflect.rs | 6358 ++++++++--------- .../src/bevy_bindings/bevy_time.rs | 83 +- .../src/bevy_bindings/bevy_transform.rs | 72 +- 8 files changed, 3737 insertions(+), 4173 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs index 7f25f20894..60ab838fba 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs @@ -20,7 +20,9 @@ impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::core::prelude::Name::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -28,7 +30,7 @@ impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::core::prelude::Name::clone( + let output: Val = ::clone( &_self, ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs index 202f2f9033..773eeb17ee 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -16,7 +16,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::ecs::entity::Entity::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -29,7 +29,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::ecs::entity::Entity::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -37,7 +39,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "from_raw", |index: u32| { - let output: Val = ::bevy::ecs::entity::Entity::from_raw( + let output: Val = bevy::ecs::entity::Entity::from_raw( index, ) .into(); @@ -47,7 +49,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = ::bevy::ecs::entity::Entity::to_bits( + let output: u64 = bevy::ecs::entity::Entity::to_bits( _self.into_inner(), ) .into(); @@ -57,7 +59,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "from_bits", |bits: u64| { - let output: Val = ::bevy::ecs::entity::Entity::from_bits( + let output: Val = bevy::ecs::entity::Entity::from_bits( bits, ) .into(); @@ -67,7 +69,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: u32 = ::bevy::ecs::entity::Entity::index( + let output: u32 = bevy::ecs::entity::Entity::index( _self.into_inner(), ) .into(); @@ -77,7 +79,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "generation", |_self: Val| { - let output: u32 = ::bevy::ecs::entity::Entity::generation( + let output: u32 = bevy::ecs::entity::Entity::generation( _self.into_inner(), ) .into(); @@ -95,10 +97,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::ecs::component::ComponentId::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -106,7 +107,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::ecs::component::ComponentId::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -116,7 +117,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::ecs::component::ComponentId::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -126,7 +127,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |index: usize| { - let output: Val = ::bevy::ecs::component::ComponentId::new( + let output: Val = bevy::ecs::component::ComponentId::new( index, ) .into(); @@ -136,7 +137,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "index", |_self: Val| { - let output: usize = ::bevy::ecs::component::ComponentId::index( + let output: usize = bevy::ecs::component::ComponentId::index( _self.into_inner(), ) .into(); @@ -147,7 +148,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |tick: u32| { - let output: Val = ::bevy::ecs::component::Tick::new( + let output: Val = bevy::ecs::component::Tick::new( tick, ) .into(); @@ -157,9 +158,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "get", |_self: Val| { - let output: u32 = ::bevy::ecs::component::Tick::get( - _self.into_inner(), - ) + let output: u32 = bevy::ecs::component::Tick::get(_self.into_inner()) .into(); output }, @@ -167,7 +166,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "set", |mut _self: Mut, tick: u32| { - let output: () = ::bevy::ecs::component::Tick::set(&mut _self, tick) + let output: () = bevy::ecs::component::Tick::set(&mut _self, tick) .into(); output }, @@ -179,7 +178,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = ::bevy::ecs::component::Tick::is_newer_than( + let output: bool = bevy::ecs::component::Tick::is_newer_than( _self.into_inner(), last_run.into_inner(), this_run.into_inner(), @@ -194,7 +193,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::ecs::component::Tick::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -202,7 +203,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::ecs::component::Tick::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -212,7 +213,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::ecs::component::Tick::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -227,7 +228,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = ::bevy::ecs::component::ComponentTicks::is_added( + let output: bool = bevy::ecs::component::ComponentTicks::is_added( &_self, last_run.into_inner(), this_run.into_inner(), @@ -243,7 +244,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { last_run: Val, this_run: Val| { - let output: bool = ::bevy::ecs::component::ComponentTicks::is_changed( + let output: bool = bevy::ecs::component::ComponentTicks::is_changed( &_self, last_run.into_inner(), this_run.into_inner(), @@ -255,7 +256,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "new", |change_tick: Val| { - let output: Val = ::bevy::ecs::component::ComponentTicks::new( + let output: Val = bevy::ecs::component::ComponentTicks::new( change_tick.into_inner(), ) .into(); @@ -268,7 +269,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { mut _self: Mut, change_tick: Val| { - let output: () = ::bevy::ecs::component::ComponentTicks::set_changed( + let output: () = bevy::ecs::component::ComponentTicks::set_changed( &mut _self, change_tick.into_inner(), ) @@ -279,7 +280,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::ecs::component::ComponentTicks::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -290,7 +291,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::ecs::identifier::Identifier::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -300,7 +301,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "low", |_self: Val| { - let output: u32 = ::bevy::ecs::identifier::Identifier::low( + let output: u32 = bevy::ecs::identifier::Identifier::low( _self.into_inner(), ) .into(); @@ -310,7 +311,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "masked_high", |_self: Val| { - let output: u32 = ::bevy::ecs::identifier::Identifier::masked_high( + let output: u32 = bevy::ecs::identifier::Identifier::masked_high( _self.into_inner(), ) .into(); @@ -320,7 +321,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "to_bits", |_self: Val| { - let output: u64 = ::bevy::ecs::identifier::Identifier::to_bits( + let output: u64 = bevy::ecs::identifier::Identifier::to_bits( _self.into_inner(), ) .into(); @@ -330,7 +331,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "from_bits", |value: u64| { - let output: Val = ::bevy::ecs::identifier::Identifier::from_bits( + let output: Val = bevy::ecs::identifier::Identifier::from_bits( value, ) .into(); @@ -343,10 +344,9 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::ecs::identifier::Identifier::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -355,7 +355,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::ecs::entity::EntityHash::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -370,7 +370,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { |_self: Ref| { let output: Val< bevy::ecs::removal_detection::RemovedComponentEntity, - > = ::bevy::ecs::removal_detection::RemovedComponentEntity::clone( + > = ::clone( &_self, ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs index 077abe92c0..c8a29c3d00 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs @@ -22,7 +22,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { a_index: usize, b_index: usize| { - let output: () = ::bevy::hierarchy::prelude::Children::swap( + let output: () = bevy::hierarchy::prelude::Children::swap( &mut _self, a_index, b_index, @@ -35,7 +35,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::hierarchy::prelude::Parent::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -48,10 +48,9 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::hierarchy::prelude::Parent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -63,10 +62,9 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::hierarchy::HierarchyEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -74,7 +72,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::hierarchy::HierarchyEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -84,7 +82,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::hierarchy::HierarchyEvent::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs index e81144868d..82c5c879ba 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -19,7 +19,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "vendor_id", |_self: Ref| { - let output: std::option::Option = ::bevy::input::gamepad::Gamepad::vendor_id( + let output: std::option::Option = bevy::input::gamepad::Gamepad::vendor_id( &_self, ) .into(); @@ -29,7 +29,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "product_id", |_self: Ref| { - let output: std::option::Option = ::bevy::input::gamepad::Gamepad::product_id( + let output: std::option::Option = bevy::input::gamepad::Gamepad::product_id( &_self, ) .into(); @@ -42,7 +42,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = ::bevy::input::gamepad::Gamepad::pressed( + let output: bool = bevy::input::gamepad::Gamepad::pressed( &_self, button_type.into_inner(), ) @@ -56,7 +56,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = ::bevy::input::gamepad::Gamepad::just_pressed( + let output: bool = bevy::input::gamepad::Gamepad::just_pressed( &_self, button_type.into_inner(), ) @@ -70,7 +70,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, button_type: Val| { - let output: bool = ::bevy::input::gamepad::Gamepad::just_released( + let output: bool = bevy::input::gamepad::Gamepad::just_released( &_self, button_type.into_inner(), ) @@ -82,7 +82,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadAxis::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -95,10 +95,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadAxis::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -106,7 +105,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadAxis::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -120,10 +119,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadButton::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -131,7 +129,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadButton::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -141,7 +139,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadButton::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -152,7 +150,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadSettings::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -163,7 +161,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyCode::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -176,10 +174,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::KeyCode::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -187,7 +184,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyCode::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -198,7 +195,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseButton::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -208,7 +205,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseButton::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -221,10 +218,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::MouseButton::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -233,7 +229,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::touch::TouchInput::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -246,10 +242,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::touch::TouchInput::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -258,7 +253,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyboardFocusLost::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -268,7 +263,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyboardFocusLost::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -281,10 +276,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::KeyboardFocusLost::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -293,7 +287,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::KeyboardInput::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -306,10 +300,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::KeyboardInput::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -317,7 +310,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::keyboard::KeyboardInput::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -328,7 +321,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::AccumulatedMouseMotion::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -341,10 +334,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::AccumulatedMouseMotion::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -353,7 +345,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::AccumulatedMouseScroll::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -366,10 +358,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::AccumulatedMouseScroll::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -378,7 +369,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseButtonInput::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -388,7 +379,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseButtonInput::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -401,10 +392,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::MouseButtonInput::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -416,10 +406,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::MouseMotion::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -427,7 +416,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseMotion::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -441,10 +430,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::MouseWheel::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -452,7 +440,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseWheel::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -463,7 +451,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadAxisChangedEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -476,10 +464,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadAxisChangedEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -488,7 +475,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadButtonChangedEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -501,10 +488,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadButtonChangedEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -518,10 +504,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -529,7 +514,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -541,7 +526,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { |_self: Ref| { let output: Val< bevy::input::gamepad::GamepadButtonStateChangedEvent, - > = ::bevy::input::gamepad::GamepadButtonStateChangedEvent::clone( + > = ::clone( &_self, ) .into(); @@ -555,10 +540,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadConnection::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -566,7 +550,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadConnection::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -577,7 +561,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "connected", |_self: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::connected( + let output: bool = bevy::input::gamepad::GamepadConnectionEvent::connected( &_self, ) .into(); @@ -587,7 +571,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "disconnected", |_self: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::disconnected( + let output: bool = bevy::input::gamepad::GamepadConnectionEvent::disconnected( &_self, ) .into(); @@ -600,10 +584,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadConnectionEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -611,7 +594,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadConnectionEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -622,7 +605,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -635,10 +618,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -647,7 +629,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadInput::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -660,10 +642,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadInput::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -671,7 +652,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::gamepad::GamepadInput::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -682,7 +663,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleRequest::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -698,10 +679,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -709,7 +689,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::RawGamepadAxisChangedEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -724,7 +704,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { |_self: Ref| { let output: Val< bevy::input::gamepad::RawGamepadButtonChangedEvent, - > = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::clone( + > = ::clone( &_self, ) .into(); @@ -737,10 +717,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::RawGamepadButtonChangedEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -752,10 +731,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::RawGamepadEvent::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -763,7 +741,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::RawGamepadEvent::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -777,10 +755,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gestures::PinchGesture::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -788,7 +765,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gestures::PinchGesture::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -799,7 +776,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gestures::RotationGesture::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -812,10 +789,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gestures::RotationGesture::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -827,10 +803,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gestures::DoubleTapGesture::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -838,7 +813,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gestures::DoubleTapGesture::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -849,7 +824,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gestures::PanGesture::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -862,10 +837,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gestures::PanGesture::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -874,7 +848,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::ButtonState::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -884,7 +858,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::ButtonState::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -897,7 +871,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::ButtonState::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -905,7 +881,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "is_pressed", |_self: Ref| { - let output: bool = ::bevy::input::ButtonState::is_pressed(&_self) + let output: bool = bevy::input::ButtonState::is_pressed(&_self) .into(); output }, @@ -914,7 +890,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "is_pressed", |_self: Ref, value: f32| { - let output: bool = ::bevy::input::gamepad::ButtonSettings::is_pressed( + let output: bool = bevy::input::gamepad::ButtonSettings::is_pressed( &_self, value, ) @@ -925,7 +901,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "is_released", |_self: Ref, value: f32| { - let output: bool = ::bevy::input::gamepad::ButtonSettings::is_released( + let output: bool = bevy::input::gamepad::ButtonSettings::is_released( &_self, value, ) @@ -936,7 +912,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "press_threshold", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::press_threshold( + let output: f32 = bevy::input::gamepad::ButtonSettings::press_threshold( &_self, ) .into(); @@ -946,7 +922,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_press_threshold", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_press_threshold( + let output: f32 = bevy::input::gamepad::ButtonSettings::set_press_threshold( &mut _self, value, ) @@ -957,7 +933,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "release_threshold", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::release_threshold( + let output: f32 = bevy::input::gamepad::ButtonSettings::release_threshold( &_self, ) .into(); @@ -967,7 +943,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_release_threshold", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::ButtonSettings::set_release_threshold( + let output: f32 = bevy::input::gamepad::ButtonSettings::set_release_threshold( &mut _self, value, ) @@ -978,7 +954,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::ButtonSettings::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -991,10 +967,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::ButtonSettings::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1003,7 +978,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "livezone_upperbound", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_upperbound( + let output: f32 = bevy::input::gamepad::AxisSettings::livezone_upperbound( &_self, ) .into(); @@ -1013,7 +988,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_livezone_upperbound", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_upperbound( + let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_upperbound( &mut _self, value, ) @@ -1024,7 +999,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "deadzone_upperbound", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_upperbound( + let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_upperbound( &_self, ) .into(); @@ -1034,7 +1009,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_deadzone_upperbound", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( + let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( &mut _self, value, ) @@ -1045,7 +1020,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "livezone_lowerbound", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::livezone_lowerbound( + let output: f32 = bevy::input::gamepad::AxisSettings::livezone_lowerbound( &_self, ) .into(); @@ -1055,7 +1030,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_livezone_lowerbound", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( + let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( &mut _self, value, ) @@ -1066,7 +1041,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "deadzone_lowerbound", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::deadzone_lowerbound( + let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_lowerbound( &_self, ) .into(); @@ -1076,7 +1051,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_deadzone_lowerbound", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( + let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( &mut _self, value, ) @@ -1087,7 +1062,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "threshold", |_self: Ref| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::threshold( + let output: f32 = bevy::input::gamepad::AxisSettings::threshold( &_self, ) .into(); @@ -1097,7 +1072,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "set_threshold", |mut _self: Mut, value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::set_threshold( + let output: f32 = bevy::input::gamepad::AxisSettings::set_threshold( &mut _self, value, ) @@ -1108,7 +1083,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clamp", |_self: Ref, new_value: f32| { - let output: f32 = ::bevy::input::gamepad::AxisSettings::clamp( + let output: f32 = bevy::input::gamepad::AxisSettings::clamp( &_self, new_value, ) @@ -1123,7 +1098,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { new_value: f32, old_value: std::option::Option| { - let output: std::option::Option = ::bevy::input::gamepad::AxisSettings::filter( + let output: std::option::Option = bevy::input::gamepad::AxisSettings::filter( &_self, new_value, old_value, @@ -1135,7 +1110,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::AxisSettings::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1148,10 +1123,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::AxisSettings::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1160,7 +1134,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::ButtonAxisSettings::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1174,7 +1148,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { new_value: f32, old_value: std::option::Option| { - let output: std::option::Option = ::bevy::input::gamepad::ButtonAxisSettings::filter( + let output: std::option::Option = bevy::input::gamepad::ButtonAxisSettings::filter( &_self, new_value, old_value, @@ -1187,7 +1161,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1200,10 +1174,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::gamepad::GamepadRumbleIntensity::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1211,7 +1184,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "weak_motor", |intensity: f32| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( + let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( intensity, ) .into(); @@ -1221,7 +1194,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "strong_motor", |intensity: f32| { - let output: Val = ::bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( + let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( intensity, ) .into(); @@ -1232,7 +1205,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::keyboard::Key::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -1242,7 +1215,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::Key::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1255,7 +1228,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::Key::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1264,7 +1239,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::NativeKeyCode::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1274,7 +1249,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::keyboard::NativeKeyCode::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -1287,10 +1262,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::NativeKeyCode::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1302,10 +1276,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::keyboard::NativeKey::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1313,7 +1286,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::keyboard::NativeKey::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -1323,7 +1296,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::keyboard::NativeKey::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1334,7 +1307,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::mouse::MouseScrollUnit::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -1344,7 +1317,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::mouse::MouseScrollUnit::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1357,10 +1330,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::mouse::MouseScrollUnit::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1369,7 +1341,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::touch::TouchPhase::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1379,7 +1351,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::input::touch::TouchPhase::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -1392,10 +1364,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::touch::TouchPhase::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1407,10 +1378,9 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::input::touch::ForceTouch::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1418,7 +1388,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::input::touch::ForceTouch::clone( + let output: Val = ::clone( &_self, ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs index 1f6746cc61..680453e866 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -16,7 +16,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::AspectRatio::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -29,7 +29,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::AspectRatio::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -37,14 +39,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "ratio", |_self: Ref| { - let output: f32 = ::bevy::math::AspectRatio::ratio(&_self).into(); + let output: f32 = bevy::math::AspectRatio::ratio(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::AspectRatio::inverse( + let output: Val = bevy::math::AspectRatio::inverse( &_self, ) .into(); @@ -54,7 +56,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_landscape", |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_landscape(&_self) + let output: bool = bevy::math::AspectRatio::is_landscape(&_self) .into(); output }, @@ -62,7 +64,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_portrait", |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_portrait(&_self) + let output: bool = bevy::math::AspectRatio::is_portrait(&_self) .into(); output }, @@ -70,8 +72,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_square", |_self: Ref| { - let output: bool = ::bevy::math::AspectRatio::is_square(&_self) - .into(); + let output: bool = bevy::math::AspectRatio::is_square(&_self).into(); output }, ); @@ -79,7 +80,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::CompassOctant::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -92,7 +93,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::CompassOctant::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -100,7 +103,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::CompassOctant::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -114,7 +117,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::CompassQuadrant::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -122,7 +127,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::CompassQuadrant::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -132,7 +137,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::CompassQuadrant::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -143,7 +148,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_rotation", |rotation: Val| { - let output: Val = ::bevy::math::Isometry2d::from_rotation( + let output: Val = bevy::math::Isometry2d::from_rotation( rotation.into_inner(), ) .into(); @@ -153,7 +158,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xy", |x: f32, y: f32| { - let output: Val = ::bevy::math::Isometry2d::from_xy( + let output: Val = bevy::math::Isometry2d::from_xy( x, y, ) @@ -164,7 +169,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Isometry2d::inverse( + let output: Val = bevy::math::Isometry2d::inverse( &_self, ) .into(); @@ -174,7 +179,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse_mul", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Isometry2d::inverse_mul( + let output: Val = bevy::math::Isometry2d::inverse_mul( &_self, rhs.into_inner(), ) @@ -185,7 +190,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Isometry2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -198,10 +203,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, rhs: Val| { - let output: Val = ::bevy::math::Isometry2d::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -209,10 +213,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Isometry2d::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -220,7 +223,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Isometry2d::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -232,10 +237,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, rhs: Val| { - let output: Val = ::bevy::math::Isometry3d::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -243,7 +247,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Isometry3d::from_xyz( + let output: Val = bevy::math::Isometry3d::from_xyz( x, y, z, @@ -255,7 +259,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Isometry3d::inverse( + let output: Val = bevy::math::Isometry3d::inverse( &_self, ) .into(); @@ -265,7 +269,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse_mul", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Isometry3d::inverse_mul( + let output: Val = bevy::math::Isometry3d::inverse_mul( &_self, rhs.into_inner(), ) @@ -276,7 +280,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Isometry3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -286,10 +290,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Isometry3d::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -297,7 +300,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Isometry3d::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -306,14 +311,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Ray2d::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Ray2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -324,14 +332,17 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Ray3d::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Ray3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -342,7 +353,10 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Rot2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) @@ -352,10 +366,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, direction: Val| { - let output: Val = ::bevy::math::Rot2::mul( - _self.into_inner(), - direction.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), direction.into_inner()) .into(); output }, @@ -363,10 +376,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Rot2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -374,7 +386,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radians", |radians: f32| { - let output: Val = ::bevy::math::Rot2::radians( + let output: Val = bevy::math::Rot2::radians( radians, ) .into(); @@ -384,7 +396,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "degrees", |degrees: f32| { - let output: Val = ::bevy::math::Rot2::degrees( + let output: Val = bevy::math::Rot2::degrees( degrees, ) .into(); @@ -394,7 +406,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "turn_fraction", |fraction: f32| { - let output: Val = ::bevy::math::Rot2::turn_fraction( + let output: Val = bevy::math::Rot2::turn_fraction( fraction, ) .into(); @@ -404,7 +416,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_sin_cos", |sin: f32, cos: f32| { - let output: Val = ::bevy::math::Rot2::from_sin_cos( + let output: Val = bevy::math::Rot2::from_sin_cos( sin, cos, ) @@ -415,7 +427,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_radians", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_radians(_self.into_inner()) + let output: f32 = bevy::math::Rot2::as_radians(_self.into_inner()) .into(); output }, @@ -423,7 +435,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_degrees", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_degrees(_self.into_inner()) + let output: f32 = bevy::math::Rot2::as_degrees(_self.into_inner()) .into(); output }, @@ -431,7 +443,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_turn_fraction", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::as_turn_fraction( + let output: f32 = bevy::math::Rot2::as_turn_fraction( _self.into_inner(), ) .into(); @@ -441,7 +453,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sin_cos", |_self: Val| { - let output: (f32, f32) = ::bevy::math::Rot2::sin_cos( + let output: (f32, f32) = bevy::math::Rot2::sin_cos( _self.into_inner(), ) .into(); @@ -451,7 +463,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length(_self.into_inner()) + let output: f32 = bevy::math::Rot2::length(_self.into_inner()) .into(); output }, @@ -459,7 +471,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length_squared( + let output: f32 = bevy::math::Rot2::length_squared( _self.into_inner(), ) .into(); @@ -469,9 +481,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Rot2::length_recip( - _self.into_inner(), - ) + let output: f32 = bevy::math::Rot2::length_recip(_self.into_inner()) .into(); output }, @@ -479,7 +489,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::Rot2::normalize( + let output: Val = bevy::math::Rot2::normalize( _self.into_inner(), ) .into(); @@ -489,7 +499,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = ::bevy::math::Rot2::fast_renormalize( + let output: Val = bevy::math::Rot2::fast_renormalize( _self.into_inner(), ) .into(); @@ -499,7 +509,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_finite(_self.into_inner()) + let output: bool = bevy::math::Rot2::is_finite(_self.into_inner()) .into(); output }, @@ -507,7 +517,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_nan(_self.into_inner()) + let output: bool = bevy::math::Rot2::is_nan(_self.into_inner()) .into(); output }, @@ -515,7 +525,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_normalized( + let output: bool = bevy::math::Rot2::is_normalized( _self.into_inner(), ) .into(); @@ -525,7 +535,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = ::bevy::math::Rot2::is_near_identity( + let output: bool = bevy::math::Rot2::is_near_identity( _self.into_inner(), ) .into(); @@ -535,7 +545,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, other: Val| { - let output: f32 = ::bevy::math::Rot2::angle_between( + let output: f32 = bevy::math::Rot2::angle_between( _self.into_inner(), other.into_inner(), ) @@ -546,7 +556,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle_to", |_self: Val, other: Val| { - let output: f32 = ::bevy::math::Rot2::angle_to( + let output: f32 = bevy::math::Rot2::angle_to( _self.into_inner(), other.into_inner(), ) @@ -557,7 +567,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = ::bevy::math::Rot2::inverse( + let output: Val = bevy::math::Rot2::inverse( _self.into_inner(), ) .into(); @@ -567,7 +577,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "nlerp", |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Rot2::nlerp( + let output: Val = bevy::math::Rot2::nlerp( _self.into_inner(), end.into_inner(), s, @@ -579,7 +589,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Rot2::slerp( + let output: Val = bevy::math::Rot2::slerp( _self.into_inner(), end.into_inner(), s, @@ -591,7 +601,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Rot2::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -600,7 +612,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -610,7 +622,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -623,7 +635,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::Dir2::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -631,7 +645,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xy_unchecked", |x: f32, y: f32| { - let output: Val = ::bevy::math::prelude::Dir2::from_xy_unchecked( + let output: Val = bevy::math::prelude::Dir2::from_xy_unchecked( x, y, ) @@ -646,7 +660,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = ::bevy::math::prelude::Dir2::slerp( + let output: Val = bevy::math::prelude::Dir2::slerp( _self.into_inner(), rhs.into_inner(), s, @@ -661,7 +675,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_to( + let output: Val = bevy::math::prelude::Dir2::rotation_to( _self.into_inner(), other.into_inner(), ) @@ -675,7 +689,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_from( + let output: Val = bevy::math::prelude::Dir2::rotation_from( _self.into_inner(), other.into_inner(), ) @@ -686,7 +700,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_from_x", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_from_x( + let output: Val = bevy::math::prelude::Dir2::rotation_from_x( _self.into_inner(), ) .into(); @@ -696,7 +710,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_to_x", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_to_x( + let output: Val = bevy::math::prelude::Dir2::rotation_to_x( _self.into_inner(), ) .into(); @@ -706,7 +720,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_from_y", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_from_y( + let output: Val = bevy::math::prelude::Dir2::rotation_from_y( _self.into_inner(), ) .into(); @@ -716,7 +730,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "rotation_to_y", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::rotation_to_y( + let output: Val = bevy::math::prelude::Dir2::rotation_to_y( _self.into_inner(), ) .into(); @@ -726,7 +740,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir2::fast_renormalize( + let output: Val = bevy::math::prelude::Dir2::fast_renormalize( _self.into_inner(), ) .into(); @@ -737,7 +751,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -747,7 +761,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -760,7 +774,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::Dir3::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -768,7 +784,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::prelude::Dir3::from_xyz_unchecked( + let output: Val = bevy::math::prelude::Dir3::from_xyz_unchecked( x, y, z, @@ -784,7 +800,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = ::bevy::math::prelude::Dir3::slerp( + let output: Val = bevy::math::prelude::Dir3::slerp( _self.into_inner(), rhs.into_inner(), s, @@ -796,7 +812,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3::fast_renormalize( + let output: Val = bevy::math::prelude::Dir3::fast_renormalize( _self.into_inner(), ) .into(); @@ -807,7 +823,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3A::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -817,7 +833,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::prelude::Dir3A::from_xyz_unchecked( + let output: Val = bevy::math::prelude::Dir3A::from_xyz_unchecked( x, y, z, @@ -833,7 +849,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { rhs: Val, s: f32| { - let output: Val = ::bevy::math::prelude::Dir3A::slerp( + let output: Val = bevy::math::prelude::Dir3A::slerp( _self.into_inner(), rhs.into_inner(), s, @@ -845,7 +861,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "fast_renormalize", |_self: Val| { - let output: Val = ::bevy::math::prelude::Dir3A::fast_renormalize( + let output: Val = bevy::math::prelude::Dir3A::fast_renormalize( _self.into_inner(), ) .into(); @@ -855,7 +871,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::prelude::Dir3A::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -868,7 +884,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::Dir3A::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -880,7 +898,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::IRect::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -888,7 +908,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::prelude::IRect::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -898,7 +918,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: i32, y0: i32, x1: i32, y1: i32| { - let output: Val = ::bevy::math::prelude::IRect::new( + let output: Val = bevy::math::prelude::IRect::new( x0, y0, x1, @@ -911,7 +931,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::bevy::math::prelude::IRect::is_empty(&_self) + let output: bool = bevy::math::prelude::IRect::is_empty(&_self) .into(); output }, @@ -919,15 +939,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: i32 = ::bevy::math::prelude::IRect::width(&_self).into(); + let output: i32 = bevy::math::prelude::IRect::width(&_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: i32 = ::bevy::math::prelude::IRect::height(&_self) - .into(); + let output: i32 = bevy::math::prelude::IRect::height(&_self).into(); output }, ) @@ -937,7 +956,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::IRect::union( + let output: Val = bevy::math::prelude::IRect::union( &_self, other.into_inner(), ) @@ -951,7 +970,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::IRect::intersect( + let output: Val = bevy::math::prelude::IRect::intersect( &_self, other.into_inner(), ) @@ -962,7 +981,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: i32| { - let output: Val = ::bevy::math::prelude::IRect::inflate( + let output: Val = bevy::math::prelude::IRect::inflate( &_self, expansion, ) @@ -973,7 +992,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_rect", |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::as_rect( + let output: Val = bevy::math::prelude::IRect::as_rect( &_self, ) .into(); @@ -983,7 +1002,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_urect", |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::as_urect( + let output: Val = bevy::math::prelude::IRect::as_urect( &_self, ) .into(); @@ -993,7 +1012,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::prelude::IRect::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1004,7 +1023,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: f32, y0: f32, x1: f32, y1: f32| { - let output: Val = ::bevy::math::prelude::Rect::new( + let output: Val = bevy::math::prelude::Rect::new( x0, y0, x1, @@ -1017,7 +1036,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::bevy::math::prelude::Rect::is_empty(&_self) + let output: bool = bevy::math::prelude::Rect::is_empty(&_self) .into(); output }, @@ -1025,14 +1044,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: f32 = ::bevy::math::prelude::Rect::width(&_self).into(); + let output: f32 = bevy::math::prelude::Rect::width(&_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: f32 = ::bevy::math::prelude::Rect::height(&_self).into(); + let output: f32 = bevy::math::prelude::Rect::height(&_self).into(); output }, ) @@ -1042,7 +1061,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::Rect::union( + let output: Val = bevy::math::prelude::Rect::union( &_self, other.into_inner(), ) @@ -1056,7 +1075,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::Rect::intersect( + let output: Val = bevy::math::prelude::Rect::intersect( &_self, other.into_inner(), ) @@ -1067,7 +1086,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: f32| { - let output: Val = ::bevy::math::prelude::Rect::inflate( + let output: Val = bevy::math::prelude::Rect::inflate( &_self, expansion, ) @@ -1081,7 +1100,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::Rect::normalize( + let output: Val = bevy::math::prelude::Rect::normalize( &_self, other.into_inner(), ) @@ -1092,7 +1111,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_irect", |_self: Ref| { - let output: Val = ::bevy::math::prelude::Rect::as_irect( + let output: Val = bevy::math::prelude::Rect::as_irect( &_self, ) .into(); @@ -1102,7 +1121,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_urect", |_self: Ref| { - let output: Val = ::bevy::math::prelude::Rect::as_urect( + let output: Val = bevy::math::prelude::Rect::as_urect( &_self, ) .into(); @@ -1112,7 +1131,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::prelude::Rect::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1125,7 +1144,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::Rect::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1134,7 +1155,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x0: u32, y0: u32, x1: u32, y1: u32| { - let output: Val = ::bevy::math::prelude::URect::new( + let output: Val = bevy::math::prelude::URect::new( x0, y0, x1, @@ -1147,7 +1168,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::bevy::math::prelude::URect::is_empty(&_self) + let output: bool = bevy::math::prelude::URect::is_empty(&_self) .into(); output }, @@ -1155,15 +1176,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "width", |_self: Ref| { - let output: u32 = ::bevy::math::prelude::URect::width(&_self).into(); + let output: u32 = bevy::math::prelude::URect::width(&_self).into(); output }, ) .overwrite_script_function( "height", |_self: Ref| { - let output: u32 = ::bevy::math::prelude::URect::height(&_self) - .into(); + let output: u32 = bevy::math::prelude::URect::height(&_self).into(); output }, ) @@ -1173,7 +1193,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::URect::union( + let output: Val = bevy::math::prelude::URect::union( &_self, other.into_inner(), ) @@ -1187,7 +1207,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Val| { - let output: Val = ::bevy::math::prelude::URect::intersect( + let output: Val = bevy::math::prelude::URect::intersect( &_self, other.into_inner(), ) @@ -1198,7 +1218,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inflate", |_self: Ref, expansion: i32| { - let output: Val = ::bevy::math::prelude::URect::inflate( + let output: Val = bevy::math::prelude::URect::inflate( &_self, expansion, ) @@ -1209,7 +1229,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_rect", |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::as_rect( + let output: Val = bevy::math::prelude::URect::as_rect( &_self, ) .into(); @@ -1219,7 +1239,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "as_irect", |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::as_irect( + let output: Val = bevy::math::prelude::URect::as_irect( &_self, ) .into(); @@ -1229,7 +1249,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::prelude::URect::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -1242,7 +1262,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::prelude::URect::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1250,7 +1272,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::prelude::URect::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1262,7 +1284,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "bounding_circle", |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb2d::bounding_circle( + let output: Val = bevy::math::bounding::Aabb2d::bounding_circle( &_self, ) .into(); @@ -1272,7 +1294,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1283,7 +1305,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircle::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1293,7 +1315,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = ::bevy::math::bounding::BoundingCircle::radius( + let output: f32 = bevy::math::bounding::BoundingCircle::radius( &_self, ) .into(); @@ -1303,7 +1325,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "aabb_2d", |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircle::aabb_2d( + let output: Val = bevy::math::bounding::BoundingCircle::aabb_2d( &_self, ) .into(); @@ -1314,7 +1336,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Circle::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1327,10 +1349,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Circle::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1338,7 +1359,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32| { - let output: Val = ::bevy::math::primitives::Circle::new( + let output: Val = bevy::math::primitives::Circle::new( radius, ) .into(); @@ -1348,7 +1369,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Circle::diameter(&_self) + let output: f32 = bevy::math::primitives::Circle::diameter(&_self) .into(); output }, @@ -1357,7 +1378,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |inner_radius: f32, outer_radius: f32| { - let output: Val = ::bevy::math::primitives::Annulus::new( + let output: Val = bevy::math::primitives::Annulus::new( inner_radius, outer_radius, ) @@ -1368,7 +1389,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Annulus::diameter(&_self) + let output: f32 = bevy::math::primitives::Annulus::diameter(&_self) .into(); output }, @@ -1376,9 +1397,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "thickness", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Annulus::thickness( - &_self, - ) + let output: f32 = bevy::math::primitives::Annulus::thickness(&_self) .into(); output }, @@ -1386,7 +1405,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Annulus::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1399,10 +1418,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Annulus::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1411,7 +1429,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, half_angle: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::new( + let output: Val = bevy::math::primitives::Arc2d::new( radius, half_angle, ) @@ -1422,7 +1440,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::from_radians( + let output: Val = bevy::math::primitives::Arc2d::from_radians( radius, angle, ) @@ -1433,7 +1451,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::from_degrees( + let output: Val = bevy::math::primitives::Arc2d::from_degrees( radius, angle, ) @@ -1444,7 +1462,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = ::bevy::math::primitives::Arc2d::from_turns( + let output: Val = bevy::math::primitives::Arc2d::from_turns( radius, fraction, ) @@ -1455,7 +1473,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::angle(&_self) + let output: f32 = bevy::math::primitives::Arc2d::angle(&_self) .into(); output }, @@ -1463,7 +1481,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::length(&_self) + let output: f32 = bevy::math::primitives::Arc2d::length(&_self) .into(); output }, @@ -1471,7 +1489,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::half_chord_length( + let output: f32 = bevy::math::primitives::Arc2d::half_chord_length( &_self, ) .into(); @@ -1481,9 +1499,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::chord_length( - &_self, - ) + let output: f32 = bevy::math::primitives::Arc2d::chord_length(&_self) .into(); output }, @@ -1491,7 +1507,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::apothem(&_self) + let output: f32 = bevy::math::primitives::Arc2d::apothem(&_self) .into(); output }, @@ -1499,7 +1515,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Arc2d::sagitta(&_self) + let output: f32 = bevy::math::primitives::Arc2d::sagitta(&_self) .into(); output }, @@ -1507,7 +1523,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_minor", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::is_minor(&_self) + let output: bool = bevy::math::primitives::Arc2d::is_minor(&_self) .into(); output }, @@ -1515,7 +1531,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_major", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::is_major(&_self) + let output: bool = bevy::math::primitives::Arc2d::is_major(&_self) .into(); output }, @@ -1526,10 +1542,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Arc2d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1537,7 +1552,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Arc2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1548,7 +1563,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, length: f32| { - let output: Val = ::bevy::math::primitives::Capsule2d::new( + let output: Val = bevy::math::primitives::Capsule2d::new( radius, length, ) @@ -1559,7 +1574,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "to_inner_rectangle", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule2d::to_inner_rectangle( + let output: Val = bevy::math::primitives::Capsule2d::to_inner_rectangle( &_self, ) .into(); @@ -1572,10 +1587,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Capsule2d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1583,7 +1597,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1594,7 +1608,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::CircularSector::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1607,10 +1621,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::CircularSector::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1618,7 +1631,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::new( + let output: Val = bevy::math::primitives::CircularSector::new( radius, angle, ) @@ -1629,7 +1642,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::from_radians( + let output: Val = bevy::math::primitives::CircularSector::from_radians( radius, angle, ) @@ -1640,7 +1653,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::from_degrees( + let output: Val = bevy::math::primitives::CircularSector::from_degrees( radius, angle, ) @@ -1651,7 +1664,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = ::bevy::math::primitives::CircularSector::from_turns( + let output: Val = bevy::math::primitives::CircularSector::from_turns( radius, fraction, ) @@ -1662,7 +1675,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_angle", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::half_angle( + let output: f32 = bevy::math::primitives::CircularSector::half_angle( &_self, ) .into(); @@ -1672,7 +1685,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::angle( + let output: f32 = bevy::math::primitives::CircularSector::angle( &_self, ) .into(); @@ -1682,7 +1695,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::radius( + let output: f32 = bevy::math::primitives::CircularSector::radius( &_self, ) .into(); @@ -1692,7 +1705,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "arc_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::arc_length( + let output: f32 = bevy::math::primitives::CircularSector::arc_length( &_self, ) .into(); @@ -1702,7 +1715,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::half_chord_length( + let output: f32 = bevy::math::primitives::CircularSector::half_chord_length( &_self, ) .into(); @@ -1712,7 +1725,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::chord_length( + let output: f32 = bevy::math::primitives::CircularSector::chord_length( &_self, ) .into(); @@ -1722,7 +1735,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::apothem( + let output: f32 = bevy::math::primitives::CircularSector::apothem( &_self, ) .into(); @@ -1732,7 +1745,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSector::sagitta( + let output: f32 = bevy::math::primitives::CircularSector::sagitta( &_self, ) .into(); @@ -1743,7 +1756,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::CircularSegment::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1753,7 +1766,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::new( + let output: Val = bevy::math::primitives::CircularSegment::new( radius, angle, ) @@ -1764,7 +1777,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_radians", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::from_radians( + let output: Val = bevy::math::primitives::CircularSegment::from_radians( radius, angle, ) @@ -1775,7 +1788,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_degrees", |radius: f32, angle: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::from_degrees( + let output: Val = bevy::math::primitives::CircularSegment::from_degrees( radius, angle, ) @@ -1786,7 +1799,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_turns", |radius: f32, fraction: f32| { - let output: Val = ::bevy::math::primitives::CircularSegment::from_turns( + let output: Val = bevy::math::primitives::CircularSegment::from_turns( radius, fraction, ) @@ -1797,7 +1810,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_angle", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::half_angle( + let output: f32 = bevy::math::primitives::CircularSegment::half_angle( &_self, ) .into(); @@ -1807,7 +1820,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "angle", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::angle( + let output: f32 = bevy::math::primitives::CircularSegment::angle( &_self, ) .into(); @@ -1817,7 +1830,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::radius( + let output: f32 = bevy::math::primitives::CircularSegment::radius( &_self, ) .into(); @@ -1827,7 +1840,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "arc_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::arc_length( + let output: f32 = bevy::math::primitives::CircularSegment::arc_length( &_self, ) .into(); @@ -1837,7 +1850,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "half_chord_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::half_chord_length( + let output: f32 = bevy::math::primitives::CircularSegment::half_chord_length( &_self, ) .into(); @@ -1847,7 +1860,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "chord_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::chord_length( + let output: f32 = bevy::math::primitives::CircularSegment::chord_length( &_self, ) .into(); @@ -1857,7 +1870,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "apothem", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::apothem( + let output: f32 = bevy::math::primitives::CircularSegment::apothem( &_self, ) .into(); @@ -1867,7 +1880,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "sagitta", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::CircularSegment::sagitta( + let output: f32 = bevy::math::primitives::CircularSegment::sagitta( &_self, ) .into(); @@ -1880,10 +1893,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::CircularSegment::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1892,7 +1904,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Ellipse::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1905,10 +1917,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Ellipse::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1916,7 +1927,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |half_width: f32, half_height: f32| { - let output: Val = ::bevy::math::primitives::Ellipse::new( + let output: Val = bevy::math::primitives::Ellipse::new( half_width, half_height, ) @@ -1927,7 +1938,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eccentricity", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::eccentricity( + let output: f32 = bevy::math::primitives::Ellipse::eccentricity( &_self, ) .into(); @@ -1937,7 +1948,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "focal_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::focal_length( + let output: f32 = bevy::math::primitives::Ellipse::focal_length( &_self, ) .into(); @@ -1947,9 +1958,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "semi_major", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::semi_major( - &_self, - ) + let output: f32 = bevy::math::primitives::Ellipse::semi_major(&_self) .into(); output }, @@ -1957,9 +1966,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "semi_minor", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Ellipse::semi_minor( - &_self, - ) + let output: f32 = bevy::math::primitives::Ellipse::semi_minor(&_self) .into(); output }, @@ -1971,10 +1978,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Line2d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -1982,7 +1988,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Line2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -1996,10 +2002,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Plane2d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2007,7 +2012,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Plane2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2021,10 +2026,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Rectangle::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2032,7 +2036,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |width: f32, height: f32| { - let output: Val = ::bevy::math::primitives::Rectangle::new( + let output: Val = bevy::math::primitives::Rectangle::new( width, height, ) @@ -2043,7 +2047,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_length", |length: f32| { - let output: Val = ::bevy::math::primitives::Rectangle::from_length( + let output: Val = bevy::math::primitives::Rectangle::from_length( length, ) .into(); @@ -2053,7 +2057,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Rectangle::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2067,10 +2071,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::RegularPolygon::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2078,7 +2081,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |circumradius: f32, sides: u32| { - let output: Val = ::bevy::math::primitives::RegularPolygon::new( + let output: Val = bevy::math::primitives::RegularPolygon::new( circumradius, sides, ) @@ -2089,7 +2092,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "circumradius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::circumradius( + let output: f32 = bevy::math::primitives::RegularPolygon::circumradius( &_self, ) .into(); @@ -2099,7 +2102,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::inradius( + let output: f32 = bevy::math::primitives::RegularPolygon::inradius( &_self, ) .into(); @@ -2109,7 +2112,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "side_length", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::side_length( + let output: f32 = bevy::math::primitives::RegularPolygon::side_length( &_self, ) .into(); @@ -2119,7 +2122,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "internal_angle_degrees", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_degrees( + let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_degrees( &_self, ) .into(); @@ -2129,7 +2132,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "internal_angle_radians", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::internal_angle_radians( + let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_radians( &_self, ) .into(); @@ -2139,7 +2142,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "external_angle_degrees", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_degrees( + let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_degrees( &_self, ) .into(); @@ -2149,7 +2152,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "external_angle_radians", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::RegularPolygon::external_angle_radians( + let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_radians( &_self, ) .into(); @@ -2159,7 +2162,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::RegularPolygon::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2173,10 +2176,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Rhombus::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2184,7 +2186,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Rhombus::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2194,7 +2196,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |horizontal_diagonal: f32, vertical_diagonal: f32| { - let output: Val = ::bevy::math::primitives::Rhombus::new( + let output: Val = bevy::math::primitives::Rhombus::new( horizontal_diagonal, vertical_diagonal, ) @@ -2205,7 +2207,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_side", |side: f32| { - let output: Val = ::bevy::math::primitives::Rhombus::from_side( + let output: Val = bevy::math::primitives::Rhombus::from_side( side, ) .into(); @@ -2215,7 +2217,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_inradius", |inradius: f32| { - let output: Val = ::bevy::math::primitives::Rhombus::from_inradius( + let output: Val = bevy::math::primitives::Rhombus::from_inradius( inradius, ) .into(); @@ -2225,7 +2227,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "side", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::side(&_self) + let output: f32 = bevy::math::primitives::Rhombus::side(&_self) .into(); output }, @@ -2233,7 +2235,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "circumradius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::circumradius( + let output: f32 = bevy::math::primitives::Rhombus::circumradius( &_self, ) .into(); @@ -2243,7 +2245,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inradius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Rhombus::inradius(&_self) + let output: f32 = bevy::math::primitives::Rhombus::inradius(&_self) .into(); output }, @@ -2255,10 +2257,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Segment2d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2266,7 +2267,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Segment2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2276,7 +2277,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |direction: Val, length: f32| { - let output: Val = ::bevy::math::primitives::Segment2d::new( + let output: Val = bevy::math::primitives::Segment2d::new( direction.into_inner(), length, ) @@ -2291,10 +2292,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2302,7 +2302,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Triangle2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2312,7 +2312,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_degenerate", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::is_degenerate( + let output: bool = bevy::math::primitives::Triangle2d::is_degenerate( &_self, ) .into(); @@ -2322,7 +2322,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_acute", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::is_acute( + let output: bool = bevy::math::primitives::Triangle2d::is_acute( &_self, ) .into(); @@ -2332,7 +2332,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_obtuse", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle2d::is_obtuse( + let output: bool = bevy::math::primitives::Triangle2d::is_obtuse( &_self, ) .into(); @@ -2342,7 +2342,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reverse", |mut _self: Mut| { - let output: () = ::bevy::math::primitives::Triangle2d::reverse( + let output: () = bevy::math::primitives::Triangle2d::reverse( &mut _self, ) .into(); @@ -2352,7 +2352,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reversed", |_self: Val| { - let output: Val = ::bevy::math::primitives::Triangle2d::reversed( + let output: Val = bevy::math::primitives::Triangle2d::reversed( _self.into_inner(), ) .into(); @@ -2363,7 +2363,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "bounding_sphere", |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb3d::bounding_sphere( + let output: Val = bevy::math::bounding::Aabb3d::bounding_sphere( &_self, ) .into(); @@ -2373,7 +2373,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::Aabb3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2384,7 +2384,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "radius", |_self: Ref| { - let output: f32 = ::bevy::math::bounding::BoundingSphere::radius( + let output: f32 = bevy::math::bounding::BoundingSphere::radius( &_self, ) .into(); @@ -2394,7 +2394,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "aabb_3d", |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphere::aabb_3d( + let output: Val = bevy::math::bounding::BoundingSphere::aabb_3d( &_self, ) .into(); @@ -2404,7 +2404,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphere::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2418,10 +2418,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Sphere::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2429,7 +2428,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32| { - let output: Val = ::bevy::math::primitives::Sphere::new( + let output: Val = bevy::math::primitives::Sphere::new( radius, ) .into(); @@ -2439,7 +2438,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "diameter", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Sphere::diameter(&_self) + let output: f32 = bevy::math::primitives::Sphere::diameter(&_self) .into(); output }, @@ -2447,7 +2446,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Sphere::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2458,7 +2457,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |x_length: f32, y_length: f32, z_length: f32| { - let output: Val = ::bevy::math::primitives::Cuboid::new( + let output: Val = bevy::math::primitives::Cuboid::new( x_length, y_length, z_length, @@ -2470,7 +2469,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_length", |length: f32| { - let output: Val = ::bevy::math::primitives::Cuboid::from_length( + let output: Val = bevy::math::primitives::Cuboid::from_length( length, ) .into(); @@ -2483,10 +2482,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Cuboid::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2494,7 +2492,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cuboid::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2505,7 +2503,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, height: f32| { - let output: Val = ::bevy::math::primitives::Cylinder::new( + let output: Val = bevy::math::primitives::Cylinder::new( radius, height, ) @@ -2516,7 +2514,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cylinder::base( + let output: Val = bevy::math::primitives::Cylinder::base( &_self, ) .into(); @@ -2526,7 +2524,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "lateral_area", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cylinder::lateral_area( + let output: f32 = bevy::math::primitives::Cylinder::lateral_area( &_self, ) .into(); @@ -2536,9 +2534,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cylinder::base_area( - &_self, - ) + let output: f32 = bevy::math::primitives::Cylinder::base_area(&_self) .into(); output }, @@ -2546,7 +2542,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cylinder::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2559,10 +2555,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Cylinder::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2571,7 +2566,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, length: f32| { - let output: Val = ::bevy::math::primitives::Capsule3d::new( + let output: Val = bevy::math::primitives::Capsule3d::new( radius, length, ) @@ -2582,7 +2577,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "to_cylinder", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule3d::to_cylinder( + let output: Val = bevy::math::primitives::Capsule3d::to_cylinder( &_self, ) .into(); @@ -2595,10 +2590,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Capsule3d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2606,7 +2600,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Capsule3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2617,7 +2611,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |radius: f32, height: f32| { - let output: Val = ::bevy::math::primitives::Cone::new( + let output: Val = bevy::math::primitives::Cone::new( radius, height, ) @@ -2628,7 +2622,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cone::base( + let output: Val = bevy::math::primitives::Cone::base( &_self, ) .into(); @@ -2638,9 +2632,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "slant_height", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::slant_height( - &_self, - ) + let output: f32 = bevy::math::primitives::Cone::slant_height(&_self) .into(); output }, @@ -2648,9 +2640,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "lateral_area", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::lateral_area( - &_self, - ) + let output: f32 = bevy::math::primitives::Cone::lateral_area(&_self) .into(); output }, @@ -2658,7 +2648,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "base_area", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Cone::base_area(&_self) + let output: f32 = bevy::math::primitives::Cone::base_area(&_self) .into(); output }, @@ -2666,7 +2656,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Cone::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2679,7 +2669,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Cone::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2688,7 +2680,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::ConicalFrustum::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2701,10 +2693,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::ConicalFrustum::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2713,7 +2704,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::InfinitePlane3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2726,10 +2717,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::InfinitePlane3d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2741,10 +2731,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Line3d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2752,7 +2741,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Line3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2763,7 +2752,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |direction: Val, length: f32| { - let output: Val = ::bevy::math::primitives::Segment3d::new( + let output: Val = bevy::math::primitives::Segment3d::new( direction.into_inner(), length, ) @@ -2777,10 +2766,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Segment3d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2788,7 +2776,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Segment3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2799,7 +2787,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Torus::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2809,7 +2797,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "new", |inner_radius: f32, outer_radius: f32| { - let output: Val = ::bevy::math::primitives::Torus::new( + let output: Val = bevy::math::primitives::Torus::new( inner_radius, outer_radius, ) @@ -2820,9 +2808,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "inner_radius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Torus::inner_radius( - &_self, - ) + let output: f32 = bevy::math::primitives::Torus::inner_radius(&_self) .into(); output }, @@ -2830,9 +2816,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "outer_radius", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Torus::outer_radius( - &_self, - ) + let output: f32 = bevy::math::primitives::Torus::outer_radius(&_self) .into(); output }, @@ -2843,10 +2827,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Torus::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2855,7 +2838,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_degenerate", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::is_degenerate( + let output: bool = bevy::math::primitives::Triangle3d::is_degenerate( &_self, ) .into(); @@ -2865,7 +2848,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_acute", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::is_acute( + let output: bool = bevy::math::primitives::Triangle3d::is_acute( &_self, ) .into(); @@ -2875,7 +2858,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_obtuse", |_self: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::is_obtuse( + let output: bool = bevy::math::primitives::Triangle3d::is_obtuse( &_self, ) .into(); @@ -2885,7 +2868,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reverse", |mut _self: Mut| { - let output: () = ::bevy::math::primitives::Triangle3d::reverse( + let output: () = bevy::math::primitives::Triangle3d::reverse( &mut _self, ) .into(); @@ -2895,7 +2878,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "reversed", |_self: Val| { - let output: Val = ::bevy::math::primitives::Triangle3d::reversed( + let output: Val = bevy::math::primitives::Triangle3d::reversed( _self.into_inner(), ) .into(); @@ -2908,10 +2891,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Triangle3d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -2919,7 +2901,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Triangle3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2930,7 +2912,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_ray", |ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::RayCast2d::from_ray( + let output: Val = bevy::math::bounding::RayCast2d::from_ray( ray.into_inner(), max, ) @@ -2944,7 +2926,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Ref| { - let output: std::option::Option = ::bevy::math::bounding::RayCast2d::aabb_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast2d::aabb_intersection_at( &_self, &aabb, ) @@ -2958,7 +2940,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, circle: Ref| { - let output: std::option::Option = ::bevy::math::bounding::RayCast2d::circle_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast2d::circle_intersection_at( &_self, &circle, ) @@ -2969,7 +2951,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::RayCast2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2980,7 +2962,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::AabbCast2d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2994,7 +2976,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::AabbCast2d::from_ray( + let output: Val = bevy::math::bounding::AabbCast2d::from_ray( aabb.into_inner(), ray.into_inner(), max, @@ -3009,7 +2991,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Val| { - let output: std::option::Option = ::bevy::math::bounding::AabbCast2d::aabb_collision_at( + let output: std::option::Option = bevy::math::bounding::AabbCast2d::aabb_collision_at( &_self, aabb.into_inner(), ) @@ -3025,7 +3007,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::BoundingCircleCast::from_ray( + let output: Val = bevy::math::bounding::BoundingCircleCast::from_ray( circle.into_inner(), ray.into_inner(), max, @@ -3040,7 +3022,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, circle: Val| { - let output: std::option::Option = ::bevy::math::bounding::BoundingCircleCast::circle_collision_at( + let output: std::option::Option = bevy::math::bounding::BoundingCircleCast::circle_collision_at( &_self, circle.into_inner(), ) @@ -3051,7 +3033,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingCircleCast::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3062,7 +3044,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "from_ray", |ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::RayCast3d::from_ray( + let output: Val = bevy::math::bounding::RayCast3d::from_ray( ray.into_inner(), max, ) @@ -3076,7 +3058,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Ref| { - let output: std::option::Option = ::bevy::math::bounding::RayCast3d::aabb_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast3d::aabb_intersection_at( &_self, &aabb, ) @@ -3090,7 +3072,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, sphere: Ref| { - let output: std::option::Option = ::bevy::math::bounding::RayCast3d::sphere_intersection_at( + let output: std::option::Option = bevy::math::bounding::RayCast3d::sphere_intersection_at( &_self, &sphere, ) @@ -3101,7 +3083,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::RayCast3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3116,7 +3098,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::AabbCast3d::from_ray( + let output: Val = bevy::math::bounding::AabbCast3d::from_ray( aabb.into_inner(), ray.into_inner(), max, @@ -3131,7 +3113,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, aabb: Val| { - let output: std::option::Option = ::bevy::math::bounding::AabbCast3d::aabb_collision_at( + let output: std::option::Option = bevy::math::bounding::AabbCast3d::aabb_collision_at( &_self, aabb.into_inner(), ) @@ -3142,7 +3124,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::AabbCast3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3153,7 +3135,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::bounding::BoundingSphereCast::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3167,7 +3149,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ray: Val, max: f32| { - let output: Val = ::bevy::math::bounding::BoundingSphereCast::from_ray( + let output: Val = bevy::math::bounding::BoundingSphereCast::from_ray( sphere.into_inner(), ray.into_inner(), max, @@ -3182,7 +3164,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, sphere: Val| { - let output: std::option::Option = ::bevy::math::bounding::BoundingSphereCast::sphere_collision_at( + let output: std::option::Option = bevy::math::bounding::BoundingSphereCast::sphere_collision_at( &_self, sphere.into_inner(), ) @@ -3194,7 +3176,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::curve::interval::Interval::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3204,7 +3186,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "start", |_self: Val| { - let output: f32 = ::bevy::math::curve::interval::Interval::start( + let output: f32 = bevy::math::curve::interval::Interval::start( _self.into_inner(), ) .into(); @@ -3214,7 +3196,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "end", |_self: Val| { - let output: f32 = ::bevy::math::curve::interval::Interval::end( + let output: f32 = bevy::math::curve::interval::Interval::end( _self.into_inner(), ) .into(); @@ -3224,7 +3206,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::curve::interval::Interval::length( + let output: f32 = bevy::math::curve::interval::Interval::length( _self.into_inner(), ) .into(); @@ -3234,7 +3216,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "is_bounded", |_self: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::is_bounded( + let output: bool = bevy::math::curve::interval::Interval::is_bounded( _self.into_inner(), ) .into(); @@ -3244,7 +3226,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "has_finite_start", |_self: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::has_finite_start( + let output: bool = bevy::math::curve::interval::Interval::has_finite_start( _self.into_inner(), ) .into(); @@ -3254,7 +3236,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "has_finite_end", |_self: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::has_finite_end( + let output: bool = bevy::math::curve::interval::Interval::has_finite_end( _self.into_inner(), ) .into(); @@ -3264,7 +3246,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "contains", |_self: Val, item: f32| { - let output: bool = ::bevy::math::curve::interval::Interval::contains( + let output: bool = bevy::math::curve::interval::Interval::contains( _self.into_inner(), item, ) @@ -3278,7 +3260,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Val, other: Val| { - let output: bool = ::bevy::math::curve::interval::Interval::contains_interval( + let output: bool = bevy::math::curve::interval::Interval::contains_interval( _self.into_inner(), other.into_inner(), ) @@ -3289,7 +3271,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clamp", |_self: Val, value: f32| { - let output: f32 = ::bevy::math::curve::interval::Interval::clamp( + let output: f32 = bevy::math::curve::interval::Interval::clamp( _self.into_inner(), value, ) @@ -3303,10 +3285,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::curve::interval::Interval::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -3315,7 +3296,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::FloatOrd::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3325,35 +3306,47 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "lt", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::lt(&_self, &other).into(); + let output: bool = >::lt(&_self, &other) + .into(); output }, ) .overwrite_script_function( "le", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::le(&_self, &other).into(); + let output: bool = >::le(&_self, &other) + .into(); output }, ) .overwrite_script_function( "gt", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::gt(&_self, &other).into(); + let output: bool = >::gt(&_self, &other) + .into(); output }, ) .overwrite_script_function( "ge", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::ge(&_self, &other).into(); + let output: bool = >::ge(&_self, &other) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::FloatOrd::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -3363,7 +3356,10 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::FloatOrd::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ); @@ -3371,7 +3367,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Plane3d::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3384,10 +3380,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Plane3d::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -3396,7 +3391,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "signed_volume", |_self: Ref| { - let output: f32 = ::bevy::math::primitives::Tetrahedron::signed_volume( + let output: f32 = bevy::math::primitives::Tetrahedron::signed_volume( &_self, ) .into(); @@ -3409,10 +3404,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::primitives::Tetrahedron::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -3420,7 +3414,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::primitives::Tetrahedron::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3431,7 +3425,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::curve::easing::EaseFunction::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3444,10 +3438,9 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::math::curve::easing::EaseFunction::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs index c23d6e952f..840e61ba15 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -15,7 +15,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: bool| { - let output: Val = ::std::sync::atomic::AtomicBool::new( + let output: Val = std::sync::atomic::AtomicBool::new( v, ) .into(); @@ -25,7 +25,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: bool = ::std::sync::atomic::AtomicBool::into_inner( + let output: bool = std::sync::atomic::AtomicBool::into_inner( _self.into_inner(), ) .into(); @@ -36,7 +36,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: i16| { - let output: Val = ::std::sync::atomic::AtomicI16::new( + let output: Val = std::sync::atomic::AtomicI16::new( v, ) .into(); @@ -46,7 +46,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i16 = ::std::sync::atomic::AtomicI16::into_inner( + let output: i16 = std::sync::atomic::AtomicI16::into_inner( _self.into_inner(), ) .into(); @@ -57,7 +57,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: i32| { - let output: Val = ::std::sync::atomic::AtomicI32::new( + let output: Val = std::sync::atomic::AtomicI32::new( v, ) .into(); @@ -67,7 +67,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i32 = ::std::sync::atomic::AtomicI32::into_inner( + let output: i32 = std::sync::atomic::AtomicI32::into_inner( _self.into_inner(), ) .into(); @@ -78,7 +78,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: i64| { - let output: Val = ::std::sync::atomic::AtomicI64::new( + let output: Val = std::sync::atomic::AtomicI64::new( v, ) .into(); @@ -88,7 +88,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i64 = ::std::sync::atomic::AtomicI64::into_inner( + let output: i64 = std::sync::atomic::AtomicI64::into_inner( _self.into_inner(), ) .into(); @@ -99,7 +99,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: i8| { - let output: Val = ::std::sync::atomic::AtomicI8::new( + let output: Val = std::sync::atomic::AtomicI8::new( v, ) .into(); @@ -109,7 +109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: i8 = ::std::sync::atomic::AtomicI8::into_inner( + let output: i8 = std::sync::atomic::AtomicI8::into_inner( _self.into_inner(), ) .into(); @@ -120,7 +120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: isize| { - let output: Val = ::std::sync::atomic::AtomicIsize::new( + let output: Val = std::sync::atomic::AtomicIsize::new( v, ) .into(); @@ -130,7 +130,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: isize = ::std::sync::atomic::AtomicIsize::into_inner( + let output: isize = std::sync::atomic::AtomicIsize::into_inner( _self.into_inner(), ) .into(); @@ -141,7 +141,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: u16| { - let output: Val = ::std::sync::atomic::AtomicU16::new( + let output: Val = std::sync::atomic::AtomicU16::new( v, ) .into(); @@ -151,7 +151,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u16 = ::std::sync::atomic::AtomicU16::into_inner( + let output: u16 = std::sync::atomic::AtomicU16::into_inner( _self.into_inner(), ) .into(); @@ -162,7 +162,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: u32| { - let output: Val = ::std::sync::atomic::AtomicU32::new( + let output: Val = std::sync::atomic::AtomicU32::new( v, ) .into(); @@ -172,7 +172,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u32 = ::std::sync::atomic::AtomicU32::into_inner( + let output: u32 = std::sync::atomic::AtomicU32::into_inner( _self.into_inner(), ) .into(); @@ -183,7 +183,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: u64| { - let output: Val = ::std::sync::atomic::AtomicU64::new( + let output: Val = std::sync::atomic::AtomicU64::new( v, ) .into(); @@ -193,7 +193,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u64 = ::std::sync::atomic::AtomicU64::into_inner( + let output: u64 = std::sync::atomic::AtomicU64::into_inner( _self.into_inner(), ) .into(); @@ -204,7 +204,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: u8| { - let output: Val = ::std::sync::atomic::AtomicU8::new( + let output: Val = std::sync::atomic::AtomicU8::new( v, ) .into(); @@ -214,7 +214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: u8 = ::std::sync::atomic::AtomicU8::into_inner( + let output: u8 = std::sync::atomic::AtomicU8::into_inner( _self.into_inner(), ) .into(); @@ -225,7 +225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |v: usize| { - let output: Val = ::std::sync::atomic::AtomicUsize::new( + let output: Val = std::sync::atomic::AtomicUsize::new( v, ) .into(); @@ -235,7 +235,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "into_inner", |_self: Val| { - let output: usize = ::std::sync::atomic::AtomicUsize::into_inner( + let output: usize = std::sync::atomic::AtomicUsize::into_inner( _self.into_inner(), ) .into(); @@ -246,10 +246,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = ::bevy::utils::Duration::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -257,7 +256,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::utils::Duration::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -267,7 +266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::utils::Duration::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -277,10 +276,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -288,10 +286,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -299,7 +296,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::utils::Duration::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -307,10 +306,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = ::bevy::utils::Duration::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -318,7 +316,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |secs: u64, nanos: u32| { - let output: Val = ::bevy::utils::Duration::new( + let output: Val = bevy::utils::Duration::new( secs, nanos, ) @@ -329,7 +327,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_secs", |secs: u64| { - let output: Val = ::bevy::utils::Duration::from_secs( + let output: Val = bevy::utils::Duration::from_secs( secs, ) .into(); @@ -339,7 +337,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_millis", |millis: u64| { - let output: Val = ::bevy::utils::Duration::from_millis( + let output: Val = bevy::utils::Duration::from_millis( millis, ) .into(); @@ -349,7 +347,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_micros", |micros: u64| { - let output: Val = ::bevy::utils::Duration::from_micros( + let output: Val = bevy::utils::Duration::from_micros( micros, ) .into(); @@ -359,7 +357,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_nanos", |nanos: u64| { - let output: Val = ::bevy::utils::Duration::from_nanos( + let output: Val = bevy::utils::Duration::from_nanos( nanos, ) .into(); @@ -369,21 +367,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_zero", |_self: Ref| { - let output: bool = ::bevy::utils::Duration::is_zero(&_self).into(); + let output: bool = bevy::utils::Duration::is_zero(&_self).into(); output }, ) .overwrite_script_function( "as_secs", |_self: Ref| { - let output: u64 = ::bevy::utils::Duration::as_secs(&_self).into(); + let output: u64 = bevy::utils::Duration::as_secs(&_self).into(); output }, ) .overwrite_script_function( "subsec_millis", |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_millis(&_self) + let output: u32 = bevy::utils::Duration::subsec_millis(&_self) .into(); output }, @@ -391,7 +389,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "subsec_micros", |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_micros(&_self) + let output: u32 = bevy::utils::Duration::subsec_micros(&_self) .into(); output }, @@ -399,36 +397,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "subsec_nanos", |_self: Ref| { - let output: u32 = ::bevy::utils::Duration::subsec_nanos(&_self) - .into(); + let output: u32 = bevy::utils::Duration::subsec_nanos(&_self).into(); output }, ) .overwrite_script_function( "as_millis", |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_millis(&_self).into(); + let output: u128 = bevy::utils::Duration::as_millis(&_self).into(); output }, ) .overwrite_script_function( "as_micros", |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_micros(&_self).into(); + let output: u128 = bevy::utils::Duration::as_micros(&_self).into(); output }, ) .overwrite_script_function( "as_nanos", |_self: Ref| { - let output: u128 = ::bevy::utils::Duration::as_nanos(&_self).into(); + let output: u128 = bevy::utils::Duration::as_nanos(&_self).into(); output }, ) .overwrite_script_function( "abs_diff", |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Duration::abs_diff( + let output: Val = bevy::utils::Duration::abs_diff( _self.into_inner(), other.into_inner(), ) @@ -439,7 +436,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::saturating_add( + let output: Val = bevy::utils::Duration::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -450,7 +447,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::utils::Duration::saturating_sub( + let output: Val = bevy::utils::Duration::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -461,7 +458,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: u32| { - let output: Val = ::bevy::utils::Duration::saturating_mul( + let output: Val = bevy::utils::Duration::saturating_mul( _self.into_inner(), rhs, ) @@ -472,23 +469,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_secs_f64", |_self: Ref| { - let output: f64 = ::bevy::utils::Duration::as_secs_f64(&_self) - .into(); + let output: f64 = bevy::utils::Duration::as_secs_f64(&_self).into(); output }, ) .overwrite_script_function( "as_secs_f32", |_self: Ref| { - let output: f32 = ::bevy::utils::Duration::as_secs_f32(&_self) - .into(); + let output: f32 = bevy::utils::Duration::as_secs_f32(&_self).into(); output }, ) .overwrite_script_function( "from_secs_f64", |secs: f64| { - let output: Val = ::bevy::utils::Duration::from_secs_f64( + let output: Val = bevy::utils::Duration::from_secs_f64( secs, ) .into(); @@ -498,7 +493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_secs_f32", |secs: f32| { - let output: Val = ::bevy::utils::Duration::from_secs_f32( + let output: Val = bevy::utils::Duration::from_secs_f32( secs, ) .into(); @@ -508,7 +503,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_f64", |_self: Val, rhs: f64| { - let output: Val = ::bevy::utils::Duration::mul_f64( + let output: Val = bevy::utils::Duration::mul_f64( _self.into_inner(), rhs, ) @@ -519,7 +514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_f32", |_self: Val, rhs: f32| { - let output: Val = ::bevy::utils::Duration::mul_f32( + let output: Val = bevy::utils::Duration::mul_f32( _self.into_inner(), rhs, ) @@ -530,7 +525,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_f64", |_self: Val, rhs: f64| { - let output: Val = ::bevy::utils::Duration::div_f64( + let output: Val = bevy::utils::Duration::div_f64( _self.into_inner(), rhs, ) @@ -541,7 +536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_f32", |_self: Val, rhs: f32| { - let output: Val = ::bevy::utils::Duration::div_f32( + let output: Val = bevy::utils::Duration::div_f32( _self.into_inner(), rhs, ) @@ -552,7 +547,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_duration_f64", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::utils::Duration::div_duration_f64( + let output: f64 = bevy::utils::Duration::div_duration_f64( _self.into_inner(), rhs.into_inner(), ) @@ -563,7 +558,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_duration_f32", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::utils::Duration::div_duration_f32( + let output: f32 = bevy::utils::Duration::div_duration_f32( _self.into_inner(), rhs.into_inner(), ) @@ -575,7 +570,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::utils::Instant::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -585,17 +580,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::utils::Instant::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Instant::sub( - _self.into_inner(), - other.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), other.into_inner()) .into(); output }, @@ -603,10 +600,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Instant::sub( - _self.into_inner(), - other.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), other.into_inner()) .into(); output }, @@ -614,7 +610,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "now", || { - let output: Val = ::bevy::utils::Instant::now() + let output: Val = bevy::utils::Instant::now() .into(); output }, @@ -622,7 +618,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "duration_since", |_self: Ref, earlier: Val| { - let output: Val = ::bevy::utils::Instant::duration_since( + let output: Val = bevy::utils::Instant::duration_since( &_self, earlier.into_inner(), ) @@ -633,7 +629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_duration_since", |_self: Ref, earlier: Val| { - let output: Val = ::bevy::utils::Instant::saturating_duration_since( + let output: Val = bevy::utils::Instant::saturating_duration_since( &_self, earlier.into_inner(), ) @@ -644,7 +640,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "elapsed", |_self: Ref| { - let output: Val = ::bevy::utils::Instant::elapsed( + let output: Val = bevy::utils::Instant::elapsed( &_self, ) .into(); @@ -654,7 +650,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::utils::Instant::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -664,10 +660,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, other: Val| { - let output: Val = ::bevy::utils::Instant::add( - _self.into_inner(), - other.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), other.into_inner()) .into(); output }, @@ -676,7 +671,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::std::ops::RangeFull::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -686,7 +681,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::std::ops::RangeFull::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -696,7 +691,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::std::ops::RangeFull::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ); @@ -704,10 +702,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -715,10 +712,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -726,14 +722,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Quat::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Quat::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -741,10 +742,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -752,10 +752,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Quat::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -763,10 +762,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -774,7 +772,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Quat::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -784,10 +782,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -795,10 +792,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Quat::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -806,7 +802,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_xyzw", |x: f32, y: f32, z: f32, w: f32| { - let output: Val = ::bevy::math::Quat::from_xyzw( + let output: Val = bevy::math::Quat::from_xyzw( x, y, z, @@ -819,7 +815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = ::bevy::math::Quat::from_array(a) + let output: Val = bevy::math::Quat::from_array(a) .into(); output }, @@ -827,7 +823,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = ::bevy::math::Quat::from_vec4( + let output: Val = bevy::math::Quat::from_vec4( v.into_inner(), ) .into(); @@ -837,7 +833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Quat::from_axis_angle( + let output: Val = bevy::math::Quat::from_axis_angle( axis.into_inner(), angle, ) @@ -848,7 +844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scaled_axis", |v: Val| { - let output: Val = ::bevy::math::Quat::from_scaled_axis( + let output: Val = bevy::math::Quat::from_scaled_axis( v.into_inner(), ) .into(); @@ -858,7 +854,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = ::bevy::math::Quat::from_rotation_x( + let output: Val = bevy::math::Quat::from_rotation_x( angle, ) .into(); @@ -868,7 +864,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = ::bevy::math::Quat::from_rotation_y( + let output: Val = bevy::math::Quat::from_rotation_y( angle, ) .into(); @@ -878,7 +874,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = ::bevy::math::Quat::from_rotation_z( + let output: Val = bevy::math::Quat::from_rotation_z( angle, ) .into(); @@ -888,7 +884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |euler: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Quat::from_euler( + let output: Val = bevy::math::Quat::from_euler( euler.into_inner(), a, b, @@ -901,9 +897,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat: Ref| { - let output: Val = ::bevy::math::Quat::from_mat3( - &mat, - ) + let output: Val = bevy::math::Quat::from_mat3(&mat) .into(); output }, @@ -911,7 +905,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |mat: Ref| { - let output: Val = ::bevy::math::Quat::from_mat3a( + let output: Val = bevy::math::Quat::from_mat3a( &mat, ) .into(); @@ -921,9 +915,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |mat: Ref| { - let output: Val = ::bevy::math::Quat::from_mat4( - &mat, - ) + let output: Val = bevy::math::Quat::from_mat4(&mat) .into(); output }, @@ -931,7 +923,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc", |from: Val, to: Val| { - let output: Val = ::bevy::math::Quat::from_rotation_arc( + let output: Val = bevy::math::Quat::from_rotation_arc( from.into_inner(), to.into_inner(), ) @@ -942,7 +934,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_colinear", |from: Val, to: Val| { - let output: Val = ::bevy::math::Quat::from_rotation_arc_colinear( + let output: Val = bevy::math::Quat::from_rotation_arc_colinear( from.into_inner(), to.into_inner(), ) @@ -953,7 +945,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_2d", |from: Val, to: Val| { - let output: Val = ::bevy::math::Quat::from_rotation_arc_2d( + let output: Val = bevy::math::Quat::from_rotation_arc_2d( from.into_inner(), to.into_inner(), ) @@ -964,7 +956,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_scaled_axis", |_self: Val| { - let output: Val = ::bevy::math::Quat::to_scaled_axis( + let output: Val = bevy::math::Quat::to_scaled_axis( _self.into_inner(), ) .into(); @@ -974,7 +966,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Val, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Quat::to_euler( + let output: (f32, f32, f32) = bevy::math::Quat::to_euler( _self.into_inner(), order.into_inner(), ) @@ -985,14 +977,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Quat::to_array(&_self).into(); + let output: [f32; 4] = bevy::math::Quat::to_array(&_self).into(); output }, ) .overwrite_script_function( "xyz", |_self: Val| { - let output: Val = ::bevy::math::Quat::xyz( + let output: Val = bevy::math::Quat::xyz( _self.into_inner(), ) .into(); @@ -1002,7 +994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "conjugate", |_self: Val| { - let output: Val = ::bevy::math::Quat::conjugate( + let output: Val = bevy::math::Quat::conjugate( _self.into_inner(), ) .into(); @@ -1012,7 +1004,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = ::bevy::math::Quat::inverse( + let output: Val = bevy::math::Quat::inverse( _self.into_inner(), ) .into(); @@ -1022,7 +1014,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Quat::dot( + let output: f32 = bevy::math::Quat::dot( _self.into_inner(), rhs.into_inner(), ) @@ -1033,7 +1025,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Quat::length(_self.into_inner()) + let output: f32 = bevy::math::Quat::length(_self.into_inner()) .into(); output }, @@ -1041,7 +1033,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Quat::length_squared( + let output: f32 = bevy::math::Quat::length_squared( _self.into_inner(), ) .into(); @@ -1051,9 +1043,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Quat::length_recip( - _self.into_inner(), - ) + let output: f32 = bevy::math::Quat::length_recip(_self.into_inner()) .into(); output }, @@ -1061,7 +1051,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::Quat::normalize( + let output: Val = bevy::math::Quat::normalize( _self.into_inner(), ) .into(); @@ -1071,7 +1061,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_finite(_self.into_inner()) + let output: bool = bevy::math::Quat::is_finite(_self.into_inner()) .into(); output }, @@ -1079,7 +1069,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_nan(_self.into_inner()) + let output: bool = bevy::math::Quat::is_nan(_self.into_inner()) .into(); output }, @@ -1087,7 +1077,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_normalized( + let output: bool = bevy::math::Quat::is_normalized( _self.into_inner(), ) .into(); @@ -1097,7 +1087,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = ::bevy::math::Quat::is_near_identity( + let output: bool = bevy::math::Quat::is_near_identity( _self.into_inner(), ) .into(); @@ -1107,7 +1097,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Quat::angle_between( + let output: f32 = bevy::math::Quat::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -1122,7 +1112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f32| { - let output: Val = ::bevy::math::Quat::rotate_towards( + let output: Val = bevy::math::Quat::rotate_towards( &_self, rhs.into_inner(), max_angle, @@ -1138,7 +1128,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Quat::abs_diff_eq( + let output: bool = bevy::math::Quat::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -1150,7 +1140,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Quat::lerp( + let output: Val = bevy::math::Quat::lerp( _self.into_inner(), end.into_inner(), s, @@ -1162,7 +1152,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f32| { - let output: Val = ::bevy::math::Quat::slerp( + let output: Val = bevy::math::Quat::slerp( _self.into_inner(), end.into_inner(), s, @@ -1174,7 +1164,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul_vec3( + let output: Val = bevy::math::Quat::mul_vec3( _self.into_inner(), rhs.into_inner(), ) @@ -1185,7 +1175,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_quat", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul_quat( + let output: Val = bevy::math::Quat::mul_quat( _self.into_inner(), rhs.into_inner(), ) @@ -1196,7 +1186,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_affine3", |a: Ref| { - let output: Val = ::bevy::math::Quat::from_affine3( + let output: Val = bevy::math::Quat::from_affine3( &a, ) .into(); @@ -1206,7 +1196,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Quat::mul_vec3a( + let output: Val = bevy::math::Quat::mul_vec3a( _self.into_inner(), rhs.into_inner(), ) @@ -1217,7 +1207,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dquat", |_self: Val| { - let output: Val = ::bevy::math::Quat::as_dquat( + let output: Val = bevy::math::Quat::as_dquat( _self.into_inner(), ) .into(); @@ -1228,10 +1218,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -1239,10 +1228,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -1250,10 +1238,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -1261,10 +1248,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -1272,10 +1258,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -1283,10 +1268,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -1294,10 +1278,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -1305,7 +1288,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Vec3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -1315,10 +1298,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -1326,7 +1308,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Vec3::new(x, y, z) + let output: Val = bevy::math::Vec3::new(x, y, z) .into(); output }, @@ -1334,7 +1316,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec3::splat(v) + let output: Val = bevy::math::Vec3::splat(v) .into(); output }, @@ -1346,7 +1328,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::Vec3::select( + let output: Val = bevy::math::Vec3::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -1358,7 +1340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 3]| { - let output: Val = ::bevy::math::Vec3::from_array(a) + let output: Val = bevy::math::Vec3::from_array(a) .into(); output }, @@ -1366,14 +1348,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = ::bevy::math::Vec3::to_array(&_self).into(); + let output: [f32; 3] = bevy::math::Vec3::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec3::extend( + let output: Val = bevy::math::Vec3::extend( _self.into_inner(), w, ) @@ -1384,7 +1366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::Vec3::truncate( + let output: Val = bevy::math::Vec3::truncate( _self.into_inner(), ) .into(); @@ -1394,7 +1376,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec3::with_x( + let output: Val = bevy::math::Vec3::with_x( _self.into_inner(), x, ) @@ -1405,7 +1387,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec3::with_y( + let output: Val = bevy::math::Vec3::with_y( _self.into_inner(), y, ) @@ -1416,7 +1398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec3::with_z( + let output: Val = bevy::math::Vec3::with_z( _self.into_inner(), z, ) @@ -1427,7 +1409,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::dot( + let output: f32 = bevy::math::Vec3::dot( _self.into_inner(), rhs.into_inner(), ) @@ -1438,7 +1420,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::dot_into_vec( + let output: Val = bevy::math::Vec3::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -1449,7 +1431,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cross( + let output: Val = bevy::math::Vec3::cross( _self.into_inner(), rhs.into_inner(), ) @@ -1460,7 +1442,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::min( + let output: Val = bevy::math::Vec3::min( _self.into_inner(), rhs.into_inner(), ) @@ -1471,7 +1453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::max( + let output: Val = bevy::math::Vec3::max( _self.into_inner(), rhs.into_inner(), ) @@ -1486,7 +1468,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::Vec3::clamp( + let output: Val = bevy::math::Vec3::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -1498,7 +1480,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::min_element(_self.into_inner()) + let output: f32 = bevy::math::Vec3::min_element(_self.into_inner()) .into(); output }, @@ -1506,7 +1488,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::max_element(_self.into_inner()) + let output: f32 = bevy::math::Vec3::max_element(_self.into_inner()) .into(); output }, @@ -1514,7 +1496,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::element_sum(_self.into_inner()) + let output: f32 = bevy::math::Vec3::element_sum(_self.into_inner()) .into(); output }, @@ -1522,7 +1504,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::element_product( + let output: f32 = bevy::math::Vec3::element_product( _self.into_inner(), ) .into(); @@ -1532,7 +1514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpeq( + let output: Val = bevy::math::Vec3::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -1543,7 +1525,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpne( + let output: Val = bevy::math::Vec3::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -1554,7 +1536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpge( + let output: Val = bevy::math::Vec3::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -1565,7 +1547,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmpgt( + let output: Val = bevy::math::Vec3::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -1576,7 +1558,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmple( + let output: Val = bevy::math::Vec3::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -1587,7 +1569,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::cmplt( + let output: Val = bevy::math::Vec3::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -1598,7 +1580,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::Vec3::abs( + let output: Val = bevy::math::Vec3::abs( _self.into_inner(), ) .into(); @@ -1608,7 +1590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::Vec3::signum( + let output: Val = bevy::math::Vec3::signum( _self.into_inner(), ) .into(); @@ -1618,7 +1600,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::copysign( + let output: Val = bevy::math::Vec3::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -1629,7 +1611,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::Vec3::is_negative_bitmask( + let output: u32 = bevy::math::Vec3::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -1639,7 +1621,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_finite(_self.into_inner()) + let output: bool = bevy::math::Vec3::is_finite(_self.into_inner()) .into(); output }, @@ -1647,7 +1629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec3::is_finite_mask( + let output: Val = bevy::math::Vec3::is_finite_mask( _self.into_inner(), ) .into(); @@ -1657,7 +1639,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_nan(_self.into_inner()) + let output: bool = bevy::math::Vec3::is_nan(_self.into_inner()) .into(); output }, @@ -1665,7 +1647,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec3::is_nan_mask( + let output: Val = bevy::math::Vec3::is_nan_mask( _self.into_inner(), ) .into(); @@ -1675,7 +1657,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length(_self.into_inner()) + let output: f32 = bevy::math::Vec3::length(_self.into_inner()) .into(); output }, @@ -1683,7 +1665,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length_squared( + let output: f32 = bevy::math::Vec3::length_squared( _self.into_inner(), ) .into(); @@ -1693,9 +1675,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec3::length_recip( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec3::length_recip(_self.into_inner()) .into(); output }, @@ -1703,7 +1683,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::distance( + let output: f32 = bevy::math::Vec3::distance( _self.into_inner(), rhs.into_inner(), ) @@ -1714,7 +1694,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::distance_squared( + let output: f32 = bevy::math::Vec3::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -1725,7 +1705,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::div_euclid( + let output: Val = bevy::math::Vec3::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -1736,7 +1716,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::rem_euclid( + let output: Val = bevy::math::Vec3::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -1747,7 +1727,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::Vec3::normalize( + let output: Val = bevy::math::Vec3::normalize( _self.into_inner(), ) .into(); @@ -1757,7 +1737,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec3::normalize_or( + let output: Val = bevy::math::Vec3::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -1768,7 +1748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::Vec3::normalize_or_zero( + let output: Val = bevy::math::Vec3::normalize_or_zero( _self.into_inner(), ) .into(); @@ -1778,7 +1758,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec3::is_normalized( + let output: bool = bevy::math::Vec3::is_normalized( _self.into_inner(), ) .into(); @@ -1788,7 +1768,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::project_onto( + let output: Val = bevy::math::Vec3::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -1799,7 +1779,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::reject_from( + let output: Val = bevy::math::Vec3::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -1810,7 +1790,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::project_onto_normalized( + let output: Val = bevy::math::Vec3::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -1821,7 +1801,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::reject_from_normalized( + let output: Val = bevy::math::Vec3::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -1832,7 +1812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::Vec3::round( + let output: Val = bevy::math::Vec3::round( _self.into_inner(), ) .into(); @@ -1842,7 +1822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::Vec3::floor( + let output: Val = bevy::math::Vec3::floor( _self.into_inner(), ) .into(); @@ -1852,7 +1832,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::Vec3::ceil( + let output: Val = bevy::math::Vec3::ceil( _self.into_inner(), ) .into(); @@ -1862,7 +1842,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::Vec3::trunc( + let output: Val = bevy::math::Vec3::trunc( _self.into_inner(), ) .into(); @@ -1872,7 +1852,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::Vec3::fract( + let output: Val = bevy::math::Vec3::fract( _self.into_inner(), ) .into(); @@ -1882,7 +1862,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::Vec3::fract_gl( + let output: Val = bevy::math::Vec3::fract_gl( _self.into_inner(), ) .into(); @@ -1892,7 +1872,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::Vec3::exp( + let output: Val = bevy::math::Vec3::exp( _self.into_inner(), ) .into(); @@ -1902,7 +1882,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec3::powf( + let output: Val = bevy::math::Vec3::powf( _self.into_inner(), n, ) @@ -1913,7 +1893,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::Vec3::recip( + let output: Val = bevy::math::Vec3::recip( _self.into_inner(), ) .into(); @@ -1923,7 +1903,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec3::lerp( + let output: Val = bevy::math::Vec3::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -1935,7 +1915,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec3::move_towards( + let output: Val = bevy::math::Vec3::move_towards( &_self, rhs.into_inner(), d, @@ -1947,7 +1927,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::midpoint( + let output: Val = bevy::math::Vec3::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -1962,7 +1942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Vec3::abs_diff_eq( + let output: bool = bevy::math::Vec3::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -1974,7 +1954,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec3::clamp_length( + let output: Val = bevy::math::Vec3::clamp_length( _self.into_inner(), min, max, @@ -1986,7 +1966,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec3::clamp_length_max( + let output: Val = bevy::math::Vec3::clamp_length_max( _self.into_inner(), max, ) @@ -1997,7 +1977,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec3::clamp_length_min( + let output: Val = bevy::math::Vec3::clamp_length_min( _self.into_inner(), min, ) @@ -2012,7 +1992,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::Vec3::mul_add( + let output: Val = bevy::math::Vec3::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -2024,7 +2004,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec3::reflect( + let output: Val = bevy::math::Vec3::reflect( _self.into_inner(), normal.into_inner(), ) @@ -2035,7 +2015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec3::refract( + let output: Val = bevy::math::Vec3::refract( _self.into_inner(), normal.into_inner(), eta, @@ -2047,7 +2027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3::angle_between( + let output: f32 = bevy::math::Vec3::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -2058,7 +2038,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::any_orthogonal_vector( + let output: Val = bevy::math::Vec3::any_orthogonal_vector( &_self, ) .into(); @@ -2068,7 +2048,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::any_orthonormal_vector( + let output: Val = bevy::math::Vec3::any_orthonormal_vector( &_self, ) .into(); @@ -2078,7 +2058,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_dvec3( + let output: Val = bevy::math::Vec3::as_dvec3( &_self, ) .into(); @@ -2088,7 +2068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_ivec3( + let output: Val = bevy::math::Vec3::as_ivec3( &_self, ) .into(); @@ -2098,7 +2078,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_uvec3( + let output: Val = bevy::math::Vec3::as_uvec3( &_self, ) .into(); @@ -2108,7 +2088,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_i64vec3( + let output: Val = bevy::math::Vec3::as_i64vec3( &_self, ) .into(); @@ -2118,7 +2098,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::as_u64vec3( + let output: Val = bevy::math::Vec3::as_u64vec3( &_self, ) .into(); @@ -2128,7 +2108,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Vec3::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -2136,10 +2118,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -2147,10 +2128,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2158,10 +2138,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -2169,10 +2148,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2180,10 +2158,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -2191,10 +2168,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -2202,10 +2178,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2213,7 +2188,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Vec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ); @@ -2221,10 +2199,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -2232,10 +2209,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -2243,10 +2219,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2254,7 +2229,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i32, y: i32| { - let output: Val = ::bevy::math::IVec2::new(x, y) + let output: Val = bevy::math::IVec2::new(x, y) .into(); output }, @@ -2262,7 +2237,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = ::bevy::math::IVec2::splat(v) + let output: Val = bevy::math::IVec2::splat(v) .into(); output }, @@ -2274,7 +2249,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::IVec2::select( + let output: Val = bevy::math::IVec2::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -2286,9 +2261,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 2]| { - let output: Val = ::bevy::math::IVec2::from_array( - a, - ) + let output: Val = bevy::math::IVec2::from_array(a) .into(); output }, @@ -2296,14 +2269,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 2] = ::bevy::math::IVec2::to_array(&_self).into(); + let output: [i32; 2] = bevy::math::IVec2::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec2::extend( + let output: Val = bevy::math::IVec2::extend( _self.into_inner(), z, ) @@ -2314,7 +2287,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec2::with_x( + let output: Val = bevy::math::IVec2::with_x( _self.into_inner(), x, ) @@ -2325,7 +2298,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec2::with_y( + let output: Val = bevy::math::IVec2::with_y( _self.into_inner(), y, ) @@ -2336,7 +2309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::dot( + let output: i32 = bevy::math::IVec2::dot( _self.into_inner(), rhs.into_inner(), ) @@ -2347,7 +2320,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::dot_into_vec( + let output: Val = bevy::math::IVec2::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -2358,7 +2331,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::min( + let output: Val = bevy::math::IVec2::min( _self.into_inner(), rhs.into_inner(), ) @@ -2369,7 +2342,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::max( + let output: Val = bevy::math::IVec2::max( _self.into_inner(), rhs.into_inner(), ) @@ -2384,7 +2357,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::IVec2::clamp( + let output: Val = bevy::math::IVec2::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -2396,9 +2369,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::min_element( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec2::min_element(_self.into_inner()) .into(); output }, @@ -2406,9 +2377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::max_element( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec2::max_element(_self.into_inner()) .into(); output }, @@ -2416,9 +2385,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::element_sum( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec2::element_sum(_self.into_inner()) .into(); output }, @@ -2426,7 +2393,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::element_product( + let output: i32 = bevy::math::IVec2::element_product( _self.into_inner(), ) .into(); @@ -2436,7 +2403,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpeq( + let output: Val = bevy::math::IVec2::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -2447,7 +2414,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpne( + let output: Val = bevy::math::IVec2::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -2458,7 +2425,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpge( + let output: Val = bevy::math::IVec2::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -2469,7 +2436,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmpgt( + let output: Val = bevy::math::IVec2::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -2480,7 +2447,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmple( + let output: Val = bevy::math::IVec2::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -2491,7 +2458,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::cmplt( + let output: Val = bevy::math::IVec2::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -2502,7 +2469,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::IVec2::abs( + let output: Val = bevy::math::IVec2::abs( _self.into_inner(), ) .into(); @@ -2512,7 +2479,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::IVec2::signum( + let output: Val = bevy::math::IVec2::signum( _self.into_inner(), ) .into(); @@ -2522,7 +2489,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::IVec2::is_negative_bitmask( + let output: u32 = bevy::math::IVec2::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -2532,7 +2499,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = ::bevy::math::IVec2::length_squared( + let output: i32 = bevy::math::IVec2::length_squared( _self.into_inner(), ) .into(); @@ -2542,7 +2509,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::distance_squared( + let output: i32 = bevy::math::IVec2::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -2553,7 +2520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::div_euclid( + let output: Val = bevy::math::IVec2::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -2564,7 +2531,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rem_euclid( + let output: Val = bevy::math::IVec2::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -2575,7 +2542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = ::bevy::math::IVec2::perp( + let output: Val = bevy::math::IVec2::perp( _self.into_inner(), ) .into(); @@ -2585,7 +2552,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec2::perp_dot( + let output: i32 = bevy::math::IVec2::perp_dot( _self.into_inner(), rhs.into_inner(), ) @@ -2596,7 +2563,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rotate( + let output: Val = bevy::math::IVec2::rotate( _self.into_inner(), rhs.into_inner(), ) @@ -2607,7 +2574,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_vec2( + let output: Val = bevy::math::IVec2::as_vec2( &_self, ) .into(); @@ -2617,7 +2584,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_dvec2( + let output: Val = bevy::math::IVec2::as_dvec2( &_self, ) .into(); @@ -2627,7 +2594,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_uvec2( + let output: Val = bevy::math::IVec2::as_uvec2( &_self, ) .into(); @@ -2637,7 +2604,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_i64vec2( + let output: Val = bevy::math::IVec2::as_i64vec2( &_self, ) .into(); @@ -2647,7 +2614,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = ::bevy::math::IVec2::as_u64vec2( + let output: Val = bevy::math::IVec2::as_u64vec2( &_self, ) .into(); @@ -2657,7 +2624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_add( + let output: Val = bevy::math::IVec2::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -2668,7 +2635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_sub( + let output: Val = bevy::math::IVec2::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -2679,7 +2646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_mul( + let output: Val = bevy::math::IVec2::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -2690,7 +2657,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_div( + let output: Val = bevy::math::IVec2::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -2701,7 +2668,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_add( + let output: Val = bevy::math::IVec2::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -2712,7 +2679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_sub( + let output: Val = bevy::math::IVec2::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -2723,7 +2690,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_mul( + let output: Val = bevy::math::IVec2::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -2734,7 +2701,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_div( + let output: Val = bevy::math::IVec2::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -2745,7 +2712,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_add_unsigned( + let output: Val = bevy::math::IVec2::wrapping_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -2756,7 +2723,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::wrapping_sub_unsigned( + let output: Val = bevy::math::IVec2::wrapping_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -2767,7 +2734,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_add_unsigned( + let output: Val = bevy::math::IVec2::saturating_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -2778,7 +2745,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::saturating_sub_unsigned( + let output: Val = bevy::math::IVec2::saturating_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -2789,10 +2756,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2800,10 +2766,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -2811,10 +2776,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -2822,7 +2786,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::IVec2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -2832,10 +2796,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -2843,10 +2806,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -2854,10 +2816,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -2865,10 +2826,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2876,10 +2836,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec2::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -2887,10 +2846,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -2898,10 +2856,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec2::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -2909,10 +2866,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2920,17 +2876,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec2::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -2938,7 +2896,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::IVec2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -2948,7 +2906,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::IVec2::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -2959,10 +2917,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -2970,10 +2927,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -2981,10 +2937,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -2992,10 +2947,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -3003,10 +2957,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -3014,11 +2967,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i32, y: i32, z: i32| { - let output: Val = ::bevy::math::IVec3::new( - x, - y, - z, - ) + let output: Val = bevy::math::IVec3::new(x, y, z) .into(); output }, @@ -3026,7 +2975,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = ::bevy::math::IVec3::splat(v) + let output: Val = bevy::math::IVec3::splat(v) .into(); output }, @@ -3038,7 +2987,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::IVec3::select( + let output: Val = bevy::math::IVec3::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -3050,9 +2999,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 3]| { - let output: Val = ::bevy::math::IVec3::from_array( - a, - ) + let output: Val = bevy::math::IVec3::from_array(a) .into(); output }, @@ -3060,14 +3007,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 3] = ::bevy::math::IVec3::to_array(&_self).into(); + let output: [i32; 3] = bevy::math::IVec3::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: i32| { - let output: Val = ::bevy::math::IVec3::extend( + let output: Val = bevy::math::IVec3::extend( _self.into_inner(), w, ) @@ -3078,7 +3025,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::IVec3::truncate( + let output: Val = bevy::math::IVec3::truncate( _self.into_inner(), ) .into(); @@ -3088,7 +3035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec3::with_x( + let output: Val = bevy::math::IVec3::with_x( _self.into_inner(), x, ) @@ -3099,7 +3046,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec3::with_y( + let output: Val = bevy::math::IVec3::with_y( _self.into_inner(), y, ) @@ -3110,7 +3057,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec3::with_z( + let output: Val = bevy::math::IVec3::with_z( _self.into_inner(), z, ) @@ -3121,7 +3068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec3::dot( + let output: i32 = bevy::math::IVec3::dot( _self.into_inner(), rhs.into_inner(), ) @@ -3132,7 +3079,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::dot_into_vec( + let output: Val = bevy::math::IVec3::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -3143,7 +3090,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cross( + let output: Val = bevy::math::IVec3::cross( _self.into_inner(), rhs.into_inner(), ) @@ -3154,7 +3101,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::min( + let output: Val = bevy::math::IVec3::min( _self.into_inner(), rhs.into_inner(), ) @@ -3165,7 +3112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::max( + let output: Val = bevy::math::IVec3::max( _self.into_inner(), rhs.into_inner(), ) @@ -3180,7 +3127,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::IVec3::clamp( + let output: Val = bevy::math::IVec3::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -3192,9 +3139,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::min_element( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec3::min_element(_self.into_inner()) .into(); output }, @@ -3202,9 +3147,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::max_element( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec3::max_element(_self.into_inner()) .into(); output }, @@ -3212,9 +3155,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::element_sum( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec3::element_sum(_self.into_inner()) .into(); output }, @@ -3222,7 +3163,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::element_product( + let output: i32 = bevy::math::IVec3::element_product( _self.into_inner(), ) .into(); @@ -3232,7 +3173,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpeq( + let output: Val = bevy::math::IVec3::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -3243,7 +3184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpne( + let output: Val = bevy::math::IVec3::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -3254,7 +3195,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpge( + let output: Val = bevy::math::IVec3::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -3265,7 +3206,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmpgt( + let output: Val = bevy::math::IVec3::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -3276,7 +3217,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmple( + let output: Val = bevy::math::IVec3::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -3287,7 +3228,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::cmplt( + let output: Val = bevy::math::IVec3::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -3298,7 +3239,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::IVec3::abs( + let output: Val = bevy::math::IVec3::abs( _self.into_inner(), ) .into(); @@ -3308,7 +3249,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::IVec3::signum( + let output: Val = bevy::math::IVec3::signum( _self.into_inner(), ) .into(); @@ -3318,7 +3259,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::IVec3::is_negative_bitmask( + let output: u32 = bevy::math::IVec3::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -3328,7 +3269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = ::bevy::math::IVec3::length_squared( + let output: i32 = bevy::math::IVec3::length_squared( _self.into_inner(), ) .into(); @@ -3338,7 +3279,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec3::distance_squared( + let output: i32 = bevy::math::IVec3::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -3349,7 +3290,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::div_euclid( + let output: Val = bevy::math::IVec3::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -3360,7 +3301,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::rem_euclid( + let output: Val = bevy::math::IVec3::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -3371,7 +3312,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_vec3( + let output: Val = bevy::math::IVec3::as_vec3( &_self, ) .into(); @@ -3381,7 +3322,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_vec3a( + let output: Val = bevy::math::IVec3::as_vec3a( &_self, ) .into(); @@ -3391,7 +3332,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_dvec3( + let output: Val = bevy::math::IVec3::as_dvec3( &_self, ) .into(); @@ -3401,7 +3342,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_uvec3( + let output: Val = bevy::math::IVec3::as_uvec3( &_self, ) .into(); @@ -3411,7 +3352,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_i64vec3( + let output: Val = bevy::math::IVec3::as_i64vec3( &_self, ) .into(); @@ -3421,7 +3362,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::as_u64vec3( + let output: Val = bevy::math::IVec3::as_u64vec3( &_self, ) .into(); @@ -3431,7 +3372,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_add( + let output: Val = bevy::math::IVec3::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -3442,7 +3383,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_sub( + let output: Val = bevy::math::IVec3::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -3453,7 +3394,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_mul( + let output: Val = bevy::math::IVec3::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -3464,7 +3405,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_div( + let output: Val = bevy::math::IVec3::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -3475,7 +3416,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_add( + let output: Val = bevy::math::IVec3::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -3486,7 +3427,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_sub( + let output: Val = bevy::math::IVec3::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -3497,7 +3438,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_mul( + let output: Val = bevy::math::IVec3::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -3508,7 +3449,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_div( + let output: Val = bevy::math::IVec3::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -3519,7 +3460,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_add_unsigned( + let output: Val = bevy::math::IVec3::wrapping_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -3530,7 +3471,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::wrapping_sub_unsigned( + let output: Val = bevy::math::IVec3::wrapping_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -3541,7 +3482,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_add_unsigned( + let output: Val = bevy::math::IVec3::saturating_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -3552,7 +3493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::saturating_sub_unsigned( + let output: Val = bevy::math::IVec3::saturating_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -3563,10 +3504,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -3574,10 +3514,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -3585,10 +3524,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -3596,10 +3534,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -3607,10 +3544,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -3618,10 +3554,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -3629,7 +3564,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::IVec3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -3639,17 +3574,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec3::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -3657,10 +3594,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -3668,7 +3604,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::IVec3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -3678,10 +3614,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -3689,7 +3624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::IVec3::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -3699,10 +3634,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec3::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -3711,10 +3645,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -3722,7 +3655,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::IVec4::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -3732,7 +3665,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i32, y: i32, z: i32, w: i32| { - let output: Val = ::bevy::math::IVec4::new( + let output: Val = bevy::math::IVec4::new( x, y, z, @@ -3745,7 +3678,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i32| { - let output: Val = ::bevy::math::IVec4::splat(v) + let output: Val = bevy::math::IVec4::splat(v) .into(); output }, @@ -3757,7 +3690,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::IVec4::select( + let output: Val = bevy::math::IVec4::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -3769,9 +3702,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i32; 4]| { - let output: Val = ::bevy::math::IVec4::from_array( - a, - ) + let output: Val = bevy::math::IVec4::from_array(a) .into(); output }, @@ -3779,14 +3710,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i32; 4] = ::bevy::math::IVec4::to_array(&_self).into(); + let output: [i32; 4] = bevy::math::IVec4::to_array(&_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::IVec4::truncate( + let output: Val = bevy::math::IVec4::truncate( _self.into_inner(), ) .into(); @@ -3796,7 +3727,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i32| { - let output: Val = ::bevy::math::IVec4::with_x( + let output: Val = bevy::math::IVec4::with_x( _self.into_inner(), x, ) @@ -3807,7 +3738,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i32| { - let output: Val = ::bevy::math::IVec4::with_y( + let output: Val = bevy::math::IVec4::with_y( _self.into_inner(), y, ) @@ -3818,7 +3749,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i32| { - let output: Val = ::bevy::math::IVec4::with_z( + let output: Val = bevy::math::IVec4::with_z( _self.into_inner(), z, ) @@ -3829,7 +3760,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: i32| { - let output: Val = ::bevy::math::IVec4::with_w( + let output: Val = bevy::math::IVec4::with_w( _self.into_inner(), w, ) @@ -3840,7 +3771,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec4::dot( + let output: i32 = bevy::math::IVec4::dot( _self.into_inner(), rhs.into_inner(), ) @@ -3851,7 +3782,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::dot_into_vec( + let output: Val = bevy::math::IVec4::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -3862,7 +3793,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::min( + let output: Val = bevy::math::IVec4::min( _self.into_inner(), rhs.into_inner(), ) @@ -3873,7 +3804,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::max( + let output: Val = bevy::math::IVec4::max( _self.into_inner(), rhs.into_inner(), ) @@ -3888,7 +3819,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::IVec4::clamp( + let output: Val = bevy::math::IVec4::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -3900,9 +3831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::min_element( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec4::min_element(_self.into_inner()) .into(); output }, @@ -3910,9 +3839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::max_element( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec4::max_element(_self.into_inner()) .into(); output }, @@ -3920,9 +3847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::element_sum( - _self.into_inner(), - ) + let output: i32 = bevy::math::IVec4::element_sum(_self.into_inner()) .into(); output }, @@ -3930,7 +3855,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::element_product( + let output: i32 = bevy::math::IVec4::element_product( _self.into_inner(), ) .into(); @@ -3940,7 +3865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpeq( + let output: Val = bevy::math::IVec4::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -3951,7 +3876,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpne( + let output: Val = bevy::math::IVec4::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -3962,7 +3887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpge( + let output: Val = bevy::math::IVec4::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -3973,7 +3898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmpgt( + let output: Val = bevy::math::IVec4::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -3984,7 +3909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmple( + let output: Val = bevy::math::IVec4::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -3995,7 +3920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::cmplt( + let output: Val = bevy::math::IVec4::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -4006,7 +3931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::IVec4::abs( + let output: Val = bevy::math::IVec4::abs( _self.into_inner(), ) .into(); @@ -4016,7 +3941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::IVec4::signum( + let output: Val = bevy::math::IVec4::signum( _self.into_inner(), ) .into(); @@ -4026,7 +3951,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::IVec4::is_negative_bitmask( + let output: u32 = bevy::math::IVec4::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -4036,7 +3961,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i32 = ::bevy::math::IVec4::length_squared( + let output: i32 = bevy::math::IVec4::length_squared( _self.into_inner(), ) .into(); @@ -4046,7 +3971,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i32 = ::bevy::math::IVec4::distance_squared( + let output: i32 = bevy::math::IVec4::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -4057,7 +3982,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::div_euclid( + let output: Val = bevy::math::IVec4::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -4068,7 +3993,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::rem_euclid( + let output: Val = bevy::math::IVec4::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -4079,7 +4004,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_vec4( + let output: Val = bevy::math::IVec4::as_vec4( &_self, ) .into(); @@ -4089,7 +4014,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_dvec4( + let output: Val = bevy::math::IVec4::as_dvec4( &_self, ) .into(); @@ -4099,7 +4024,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_uvec4( + let output: Val = bevy::math::IVec4::as_uvec4( &_self, ) .into(); @@ -4109,7 +4034,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_i64vec4( + let output: Val = bevy::math::IVec4::as_i64vec4( &_self, ) .into(); @@ -4119,7 +4044,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = ::bevy::math::IVec4::as_u64vec4( + let output: Val = bevy::math::IVec4::as_u64vec4( &_self, ) .into(); @@ -4129,7 +4054,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_add( + let output: Val = bevy::math::IVec4::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -4140,7 +4065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_sub( + let output: Val = bevy::math::IVec4::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -4151,7 +4076,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_mul( + let output: Val = bevy::math::IVec4::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -4162,7 +4087,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_div( + let output: Val = bevy::math::IVec4::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -4173,7 +4098,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_add( + let output: Val = bevy::math::IVec4::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -4184,7 +4109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_sub( + let output: Val = bevy::math::IVec4::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -4195,7 +4120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_mul( + let output: Val = bevy::math::IVec4::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -4206,7 +4131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_div( + let output: Val = bevy::math::IVec4::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -4217,7 +4142,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_add_unsigned( + let output: Val = bevy::math::IVec4::wrapping_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -4228,7 +4153,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::wrapping_sub_unsigned( + let output: Val = bevy::math::IVec4::wrapping_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -4239,7 +4164,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_add_unsigned( + let output: Val = bevy::math::IVec4::saturating_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -4250,7 +4175,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::saturating_sub_unsigned( + let output: Val = bevy::math::IVec4::saturating_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -4261,10 +4186,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -4272,7 +4196,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::IVec4::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -4282,10 +4206,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -4293,10 +4216,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -4304,10 +4226,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4315,10 +4236,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4326,10 +4246,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4337,10 +4256,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -4348,7 +4266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::IVec4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -4358,10 +4276,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -4369,17 +4286,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::IVec4::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -4387,10 +4306,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i32| { - let output: Val = ::bevy::math::IVec4::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -4398,10 +4316,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4409,10 +4326,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -4420,10 +4336,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::IVec4::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -4431,10 +4346,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::IVec4::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4443,10 +4357,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -4454,10 +4367,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -4465,10 +4377,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -4476,10 +4387,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4487,10 +4397,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -4498,10 +4407,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -4509,10 +4417,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -4520,10 +4427,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -4531,7 +4437,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -4541,10 +4447,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -4552,7 +4457,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::I64Vec2::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -4562,10 +4467,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -4573,10 +4477,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64| { - let output: Val = ::bevy::math::I64Vec2::new( - x, - y, - ) + let output: Val = bevy::math::I64Vec2::new(x, y) .into(); output }, @@ -4584,9 +4485,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = ::bevy::math::I64Vec2::splat( - v, - ) + let output: Val = bevy::math::I64Vec2::splat(v) .into(); output }, @@ -4598,7 +4497,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::I64Vec2::select( + let output: Val = bevy::math::I64Vec2::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -4610,7 +4509,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 2]| { - let output: Val = ::bevy::math::I64Vec2::from_array( + let output: Val = bevy::math::I64Vec2::from_array( a, ) .into(); @@ -4620,15 +4519,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 2] = ::bevy::math::I64Vec2::to_array(&_self) - .into(); + let output: [i64; 2] = bevy::math::I64Vec2::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: i64| { - let output: Val = ::bevy::math::I64Vec2::extend( + let output: Val = bevy::math::I64Vec2::extend( _self.into_inner(), z, ) @@ -4639,7 +4537,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = ::bevy::math::I64Vec2::with_x( + let output: Val = bevy::math::I64Vec2::with_x( _self.into_inner(), x, ) @@ -4650,7 +4548,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = ::bevy::math::I64Vec2::with_y( + let output: Val = bevy::math::I64Vec2::with_y( _self.into_inner(), y, ) @@ -4661,7 +4559,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec2::dot( + let output: i64 = bevy::math::I64Vec2::dot( _self.into_inner(), rhs.into_inner(), ) @@ -4672,7 +4570,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::dot_into_vec( + let output: Val = bevy::math::I64Vec2::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -4683,7 +4581,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::min( + let output: Val = bevy::math::I64Vec2::min( _self.into_inner(), rhs.into_inner(), ) @@ -4694,7 +4592,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::max( + let output: Val = bevy::math::I64Vec2::max( _self.into_inner(), rhs.into_inner(), ) @@ -4709,7 +4607,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::I64Vec2::clamp( + let output: Val = bevy::math::I64Vec2::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -4721,7 +4619,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::min_element( + let output: i64 = bevy::math::I64Vec2::min_element( _self.into_inner(), ) .into(); @@ -4731,7 +4629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::max_element( + let output: i64 = bevy::math::I64Vec2::max_element( _self.into_inner(), ) .into(); @@ -4741,7 +4639,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::element_sum( + let output: i64 = bevy::math::I64Vec2::element_sum( _self.into_inner(), ) .into(); @@ -4751,7 +4649,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::element_product( + let output: i64 = bevy::math::I64Vec2::element_product( _self.into_inner(), ) .into(); @@ -4761,7 +4659,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpeq( + let output: Val = bevy::math::I64Vec2::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -4772,7 +4670,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpne( + let output: Val = bevy::math::I64Vec2::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -4783,7 +4681,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpge( + let output: Val = bevy::math::I64Vec2::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -4794,7 +4692,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmpgt( + let output: Val = bevy::math::I64Vec2::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -4805,7 +4703,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmple( + let output: Val = bevy::math::I64Vec2::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -4816,7 +4714,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::cmplt( + let output: Val = bevy::math::I64Vec2::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -4827,7 +4725,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::abs( + let output: Val = bevy::math::I64Vec2::abs( _self.into_inner(), ) .into(); @@ -4837,7 +4735,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::signum( + let output: Val = bevy::math::I64Vec2::signum( _self.into_inner(), ) .into(); @@ -4847,7 +4745,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::I64Vec2::is_negative_bitmask( + let output: u32 = bevy::math::I64Vec2::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -4857,7 +4755,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec2::length_squared( + let output: i64 = bevy::math::I64Vec2::length_squared( _self.into_inner(), ) .into(); @@ -4867,7 +4765,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec2::distance_squared( + let output: i64 = bevy::math::I64Vec2::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -4878,7 +4776,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::div_euclid( + let output: Val = bevy::math::I64Vec2::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -4889,7 +4787,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rem_euclid( + let output: Val = bevy::math::I64Vec2::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -4900,7 +4798,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = ::bevy::math::I64Vec2::perp( + let output: Val = bevy::math::I64Vec2::perp( _self.into_inner(), ) .into(); @@ -4910,7 +4808,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec2::perp_dot( + let output: i64 = bevy::math::I64Vec2::perp_dot( _self.into_inner(), rhs.into_inner(), ) @@ -4921,7 +4819,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rotate( + let output: Val = bevy::math::I64Vec2::rotate( _self.into_inner(), rhs.into_inner(), ) @@ -4932,7 +4830,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_vec2( + let output: Val = bevy::math::I64Vec2::as_vec2( &_self, ) .into(); @@ -4942,7 +4840,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_dvec2( + let output: Val = bevy::math::I64Vec2::as_dvec2( &_self, ) .into(); @@ -4952,7 +4850,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_ivec2( + let output: Val = bevy::math::I64Vec2::as_ivec2( &_self, ) .into(); @@ -4962,7 +4860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_uvec2( + let output: Val = bevy::math::I64Vec2::as_uvec2( &_self, ) .into(); @@ -4972,7 +4870,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::as_u64vec2( + let output: Val = bevy::math::I64Vec2::as_u64vec2( &_self, ) .into(); @@ -4982,7 +4880,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_add( + let output: Val = bevy::math::I64Vec2::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -4993,7 +4891,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_sub( + let output: Val = bevy::math::I64Vec2::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -5004,7 +4902,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_mul( + let output: Val = bevy::math::I64Vec2::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -5015,7 +4913,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_div( + let output: Val = bevy::math::I64Vec2::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -5026,7 +4924,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_add( + let output: Val = bevy::math::I64Vec2::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -5037,7 +4935,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_sub( + let output: Val = bevy::math::I64Vec2::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -5048,7 +4946,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_mul( + let output: Val = bevy::math::I64Vec2::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -5059,7 +4957,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_div( + let output: Val = bevy::math::I64Vec2::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -5070,7 +4968,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_add_unsigned( + let output: Val = bevy::math::I64Vec2::wrapping_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5081,7 +4979,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::wrapping_sub_unsigned( + let output: Val = bevy::math::I64Vec2::wrapping_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5092,7 +4990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_add_unsigned( + let output: Val = bevy::math::I64Vec2::saturating_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5103,7 +5001,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::saturating_sub_unsigned( + let output: Val = bevy::math::I64Vec2::saturating_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5114,10 +5012,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5125,10 +5022,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5136,17 +5032,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -5154,10 +5052,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -5165,10 +5062,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5176,7 +5072,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -5187,10 +5083,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -5198,10 +5093,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -5209,10 +5103,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -5220,10 +5113,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -5231,7 +5123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -5241,10 +5133,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5252,7 +5143,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64, z: i64| { - let output: Val = ::bevy::math::I64Vec3::new( + let output: Val = bevy::math::I64Vec3::new( x, y, z, @@ -5264,9 +5155,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = ::bevy::math::I64Vec3::splat( - v, - ) + let output: Val = bevy::math::I64Vec3::splat(v) .into(); output }, @@ -5278,7 +5167,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::I64Vec3::select( + let output: Val = bevy::math::I64Vec3::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -5290,7 +5179,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 3]| { - let output: Val = ::bevy::math::I64Vec3::from_array( + let output: Val = bevy::math::I64Vec3::from_array( a, ) .into(); @@ -5300,15 +5189,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 3] = ::bevy::math::I64Vec3::to_array(&_self) - .into(); + let output: [i64; 3] = bevy::math::I64Vec3::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: i64| { - let output: Val = ::bevy::math::I64Vec3::extend( + let output: Val = bevy::math::I64Vec3::extend( _self.into_inner(), w, ) @@ -5319,7 +5207,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::truncate( + let output: Val = bevy::math::I64Vec3::truncate( _self.into_inner(), ) .into(); @@ -5329,7 +5217,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = ::bevy::math::I64Vec3::with_x( + let output: Val = bevy::math::I64Vec3::with_x( _self.into_inner(), x, ) @@ -5340,7 +5228,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = ::bevy::math::I64Vec3::with_y( + let output: Val = bevy::math::I64Vec3::with_y( _self.into_inner(), y, ) @@ -5351,7 +5239,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i64| { - let output: Val = ::bevy::math::I64Vec3::with_z( + let output: Val = bevy::math::I64Vec3::with_z( _self.into_inner(), z, ) @@ -5362,7 +5250,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec3::dot( + let output: i64 = bevy::math::I64Vec3::dot( _self.into_inner(), rhs.into_inner(), ) @@ -5373,7 +5261,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::dot_into_vec( + let output: Val = bevy::math::I64Vec3::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -5384,7 +5272,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cross( + let output: Val = bevy::math::I64Vec3::cross( _self.into_inner(), rhs.into_inner(), ) @@ -5395,7 +5283,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::min( + let output: Val = bevy::math::I64Vec3::min( _self.into_inner(), rhs.into_inner(), ) @@ -5406,7 +5294,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::max( + let output: Val = bevy::math::I64Vec3::max( _self.into_inner(), rhs.into_inner(), ) @@ -5421,7 +5309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::I64Vec3::clamp( + let output: Val = bevy::math::I64Vec3::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -5433,7 +5321,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::min_element( + let output: i64 = bevy::math::I64Vec3::min_element( _self.into_inner(), ) .into(); @@ -5443,7 +5331,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::max_element( + let output: i64 = bevy::math::I64Vec3::max_element( _self.into_inner(), ) .into(); @@ -5453,7 +5341,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::element_sum( + let output: i64 = bevy::math::I64Vec3::element_sum( _self.into_inner(), ) .into(); @@ -5463,7 +5351,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::element_product( + let output: i64 = bevy::math::I64Vec3::element_product( _self.into_inner(), ) .into(); @@ -5473,7 +5361,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpeq( + let output: Val = bevy::math::I64Vec3::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -5484,7 +5372,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpne( + let output: Val = bevy::math::I64Vec3::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -5495,7 +5383,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpge( + let output: Val = bevy::math::I64Vec3::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -5506,7 +5394,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmpgt( + let output: Val = bevy::math::I64Vec3::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -5517,7 +5405,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmple( + let output: Val = bevy::math::I64Vec3::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -5528,7 +5416,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::cmplt( + let output: Val = bevy::math::I64Vec3::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -5539,7 +5427,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::abs( + let output: Val = bevy::math::I64Vec3::abs( _self.into_inner(), ) .into(); @@ -5549,7 +5437,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::signum( + let output: Val = bevy::math::I64Vec3::signum( _self.into_inner(), ) .into(); @@ -5559,7 +5447,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::I64Vec3::is_negative_bitmask( + let output: u32 = bevy::math::I64Vec3::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -5569,7 +5457,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec3::length_squared( + let output: i64 = bevy::math::I64Vec3::length_squared( _self.into_inner(), ) .into(); @@ -5579,7 +5467,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec3::distance_squared( + let output: i64 = bevy::math::I64Vec3::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -5590,7 +5478,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::div_euclid( + let output: Val = bevy::math::I64Vec3::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -5601,7 +5489,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::rem_euclid( + let output: Val = bevy::math::I64Vec3::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -5612,7 +5500,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_vec3( + let output: Val = bevy::math::I64Vec3::as_vec3( &_self, ) .into(); @@ -5622,7 +5510,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_vec3a( + let output: Val = bevy::math::I64Vec3::as_vec3a( &_self, ) .into(); @@ -5632,7 +5520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_dvec3( + let output: Val = bevy::math::I64Vec3::as_dvec3( &_self, ) .into(); @@ -5642,7 +5530,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_ivec3( + let output: Val = bevy::math::I64Vec3::as_ivec3( &_self, ) .into(); @@ -5652,7 +5540,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_uvec3( + let output: Val = bevy::math::I64Vec3::as_uvec3( &_self, ) .into(); @@ -5662,7 +5550,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec3::as_u64vec3( + let output: Val = bevy::math::I64Vec3::as_u64vec3( &_self, ) .into(); @@ -5672,7 +5560,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_add( + let output: Val = bevy::math::I64Vec3::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -5683,7 +5571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_sub( + let output: Val = bevy::math::I64Vec3::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -5694,7 +5582,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_mul( + let output: Val = bevy::math::I64Vec3::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -5705,7 +5593,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_div( + let output: Val = bevy::math::I64Vec3::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -5716,7 +5604,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_add( + let output: Val = bevy::math::I64Vec3::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -5727,7 +5615,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_sub( + let output: Val = bevy::math::I64Vec3::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -5738,7 +5626,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_mul( + let output: Val = bevy::math::I64Vec3::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -5749,7 +5637,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_div( + let output: Val = bevy::math::I64Vec3::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -5760,7 +5648,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_add_unsigned( + let output: Val = bevy::math::I64Vec3::wrapping_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5771,7 +5659,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::wrapping_sub_unsigned( + let output: Val = bevy::math::I64Vec3::wrapping_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5782,7 +5670,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_add_unsigned( + let output: Val = bevy::math::I64Vec3::saturating_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5793,7 +5681,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::saturating_sub_unsigned( + let output: Val = bevy::math::I64Vec3::saturating_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -5804,10 +5692,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -5815,10 +5702,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -5826,7 +5712,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::I64Vec3::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -5836,10 +5722,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5847,10 +5732,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -5858,10 +5742,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -5869,7 +5752,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::I64Vec3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -5879,10 +5762,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5890,10 +5772,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -5901,10 +5782,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5912,10 +5792,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec3::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5923,10 +5802,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -5934,7 +5812,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ); @@ -5942,17 +5823,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::I64Vec4::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -5960,10 +5843,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -5971,10 +5853,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -5982,10 +5863,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -5993,10 +5873,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -6004,7 +5883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -6014,10 +5893,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6025,10 +5903,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -6036,10 +5913,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6047,10 +5923,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6058,10 +5933,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -6069,10 +5943,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: i64| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -6080,10 +5953,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -6091,10 +5963,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -6102,10 +5973,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -6113,7 +5983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::I64Vec4::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -6123,7 +5993,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: i64, y: i64, z: i64, w: i64| { - let output: Val = ::bevy::math::I64Vec4::new( + let output: Val = bevy::math::I64Vec4::new( x, y, z, @@ -6136,9 +6006,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: i64| { - let output: Val = ::bevy::math::I64Vec4::splat( - v, - ) + let output: Val = bevy::math::I64Vec4::splat(v) .into(); output }, @@ -6150,7 +6018,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::I64Vec4::select( + let output: Val = bevy::math::I64Vec4::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -6162,7 +6030,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [i64; 4]| { - let output: Val = ::bevy::math::I64Vec4::from_array( + let output: Val = bevy::math::I64Vec4::from_array( a, ) .into(); @@ -6172,15 +6040,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [i64; 4] = ::bevy::math::I64Vec4::to_array(&_self) - .into(); + let output: [i64; 4] = bevy::math::I64Vec4::to_array(&_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::truncate( + let output: Val = bevy::math::I64Vec4::truncate( _self.into_inner(), ) .into(); @@ -6190,7 +6057,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: i64| { - let output: Val = ::bevy::math::I64Vec4::with_x( + let output: Val = bevy::math::I64Vec4::with_x( _self.into_inner(), x, ) @@ -6201,7 +6068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: i64| { - let output: Val = ::bevy::math::I64Vec4::with_y( + let output: Val = bevy::math::I64Vec4::with_y( _self.into_inner(), y, ) @@ -6212,7 +6079,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: i64| { - let output: Val = ::bevy::math::I64Vec4::with_z( + let output: Val = bevy::math::I64Vec4::with_z( _self.into_inner(), z, ) @@ -6223,7 +6090,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: i64| { - let output: Val = ::bevy::math::I64Vec4::with_w( + let output: Val = bevy::math::I64Vec4::with_w( _self.into_inner(), w, ) @@ -6234,7 +6101,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec4::dot( + let output: i64 = bevy::math::I64Vec4::dot( _self.into_inner(), rhs.into_inner(), ) @@ -6245,7 +6112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::dot_into_vec( + let output: Val = bevy::math::I64Vec4::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -6256,7 +6123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::min( + let output: Val = bevy::math::I64Vec4::min( _self.into_inner(), rhs.into_inner(), ) @@ -6267,7 +6134,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::max( + let output: Val = bevy::math::I64Vec4::max( _self.into_inner(), rhs.into_inner(), ) @@ -6282,7 +6149,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::I64Vec4::clamp( + let output: Val = bevy::math::I64Vec4::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -6294,7 +6161,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::min_element( + let output: i64 = bevy::math::I64Vec4::min_element( _self.into_inner(), ) .into(); @@ -6304,7 +6171,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::max_element( + let output: i64 = bevy::math::I64Vec4::max_element( _self.into_inner(), ) .into(); @@ -6314,7 +6181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::element_sum( + let output: i64 = bevy::math::I64Vec4::element_sum( _self.into_inner(), ) .into(); @@ -6324,7 +6191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::element_product( + let output: i64 = bevy::math::I64Vec4::element_product( _self.into_inner(), ) .into(); @@ -6334,7 +6201,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpeq( + let output: Val = bevy::math::I64Vec4::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -6345,7 +6212,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpne( + let output: Val = bevy::math::I64Vec4::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -6356,7 +6223,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpge( + let output: Val = bevy::math::I64Vec4::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -6367,7 +6234,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmpgt( + let output: Val = bevy::math::I64Vec4::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -6378,7 +6245,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmple( + let output: Val = bevy::math::I64Vec4::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -6389,7 +6256,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::cmplt( + let output: Val = bevy::math::I64Vec4::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -6400,7 +6267,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::abs( + let output: Val = bevy::math::I64Vec4::abs( _self.into_inner(), ) .into(); @@ -6410,7 +6277,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::signum( + let output: Val = bevy::math::I64Vec4::signum( _self.into_inner(), ) .into(); @@ -6420,7 +6287,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::I64Vec4::is_negative_bitmask( + let output: u32 = bevy::math::I64Vec4::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -6430,7 +6297,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: i64 = ::bevy::math::I64Vec4::length_squared( + let output: i64 = bevy::math::I64Vec4::length_squared( _self.into_inner(), ) .into(); @@ -6440,7 +6307,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: i64 = ::bevy::math::I64Vec4::distance_squared( + let output: i64 = bevy::math::I64Vec4::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -6451,7 +6318,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::div_euclid( + let output: Val = bevy::math::I64Vec4::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -6462,7 +6329,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::rem_euclid( + let output: Val = bevy::math::I64Vec4::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -6473,7 +6340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_vec4( + let output: Val = bevy::math::I64Vec4::as_vec4( &_self, ) .into(); @@ -6483,7 +6350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_dvec4( + let output: Val = bevy::math::I64Vec4::as_dvec4( &_self, ) .into(); @@ -6493,7 +6360,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_ivec4( + let output: Val = bevy::math::I64Vec4::as_ivec4( &_self, ) .into(); @@ -6503,7 +6370,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_uvec4( + let output: Val = bevy::math::I64Vec4::as_uvec4( &_self, ) .into(); @@ -6513,7 +6380,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = ::bevy::math::I64Vec4::as_u64vec4( + let output: Val = bevy::math::I64Vec4::as_u64vec4( &_self, ) .into(); @@ -6523,7 +6390,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_add( + let output: Val = bevy::math::I64Vec4::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -6534,7 +6401,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_sub( + let output: Val = bevy::math::I64Vec4::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -6545,7 +6412,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_mul( + let output: Val = bevy::math::I64Vec4::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -6556,7 +6423,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_div( + let output: Val = bevy::math::I64Vec4::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -6567,7 +6434,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_add( + let output: Val = bevy::math::I64Vec4::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -6578,7 +6445,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_sub( + let output: Val = bevy::math::I64Vec4::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -6589,7 +6456,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_mul( + let output: Val = bevy::math::I64Vec4::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -6600,7 +6467,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_div( + let output: Val = bevy::math::I64Vec4::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -6611,7 +6478,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_add_unsigned( + let output: Val = bevy::math::I64Vec4::wrapping_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -6622,7 +6489,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::wrapping_sub_unsigned( + let output: Val = bevy::math::I64Vec4::wrapping_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -6633,7 +6500,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_add_unsigned( + let output: Val = bevy::math::I64Vec4::saturating_add_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -6644,7 +6511,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub_unsigned", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::saturating_sub_unsigned( + let output: Val = bevy::math::I64Vec4::saturating_sub_unsigned( _self.into_inner(), rhs.into_inner(), ) @@ -6655,10 +6522,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::I64Vec4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6666,7 +6532,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::I64Vec4::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -6677,17 +6543,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -6695,10 +6563,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -6706,7 +6573,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::UVec2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -6716,10 +6583,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6727,10 +6593,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -6738,10 +6603,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -6749,10 +6613,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6760,10 +6623,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6771,10 +6633,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -6782,10 +6643,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -6793,10 +6653,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -6804,10 +6663,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6815,10 +6673,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec2::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -6826,10 +6683,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -6837,7 +6693,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::UVec2::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -6847,10 +6703,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -6858,10 +6713,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -6869,7 +6723,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u32, y: u32| { - let output: Val = ::bevy::math::UVec2::new(x, y) + let output: Val = bevy::math::UVec2::new(x, y) .into(); output }, @@ -6877,7 +6731,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = ::bevy::math::UVec2::splat(v) + let output: Val = bevy::math::UVec2::splat(v) .into(); output }, @@ -6889,7 +6743,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::UVec2::select( + let output: Val = bevy::math::UVec2::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -6901,9 +6755,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 2]| { - let output: Val = ::bevy::math::UVec2::from_array( - a, - ) + let output: Val = bevy::math::UVec2::from_array(a) .into(); output }, @@ -6911,14 +6763,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 2] = ::bevy::math::UVec2::to_array(&_self).into(); + let output: [u32; 2] = bevy::math::UVec2::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: u32| { - let output: Val = ::bevy::math::UVec2::extend( + let output: Val = bevy::math::UVec2::extend( _self.into_inner(), z, ) @@ -6929,7 +6781,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = ::bevy::math::UVec2::with_x( + let output: Val = bevy::math::UVec2::with_x( _self.into_inner(), x, ) @@ -6940,7 +6792,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = ::bevy::math::UVec2::with_y( + let output: Val = bevy::math::UVec2::with_y( _self.into_inner(), y, ) @@ -6951,7 +6803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec2::dot( + let output: u32 = bevy::math::UVec2::dot( _self.into_inner(), rhs.into_inner(), ) @@ -6962,7 +6814,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::dot_into_vec( + let output: Val = bevy::math::UVec2::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -6973,7 +6825,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::min( + let output: Val = bevy::math::UVec2::min( _self.into_inner(), rhs.into_inner(), ) @@ -6984,7 +6836,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::max( + let output: Val = bevy::math::UVec2::max( _self.into_inner(), rhs.into_inner(), ) @@ -6999,7 +6851,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::UVec2::clamp( + let output: Val = bevy::math::UVec2::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -7011,9 +6863,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::min_element( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec2::min_element(_self.into_inner()) .into(); output }, @@ -7021,9 +6871,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::max_element( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec2::max_element(_self.into_inner()) .into(); output }, @@ -7031,9 +6879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::element_sum( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec2::element_sum(_self.into_inner()) .into(); output }, @@ -7041,7 +6887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::element_product( + let output: u32 = bevy::math::UVec2::element_product( _self.into_inner(), ) .into(); @@ -7051,7 +6897,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpeq( + let output: Val = bevy::math::UVec2::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -7062,7 +6908,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpne( + let output: Val = bevy::math::UVec2::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -7073,7 +6919,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpge( + let output: Val = bevy::math::UVec2::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -7084,7 +6930,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmpgt( + let output: Val = bevy::math::UVec2::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -7095,7 +6941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmple( + let output: Val = bevy::math::UVec2::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -7106,7 +6952,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::cmplt( + let output: Val = bevy::math::UVec2::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -7117,7 +6963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = ::bevy::math::UVec2::length_squared( + let output: u32 = bevy::math::UVec2::length_squared( _self.into_inner(), ) .into(); @@ -7127,7 +6973,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_vec2( + let output: Val = bevy::math::UVec2::as_vec2( &_self, ) .into(); @@ -7137,7 +6983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_dvec2( + let output: Val = bevy::math::UVec2::as_dvec2( &_self, ) .into(); @@ -7147,7 +6993,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_ivec2( + let output: Val = bevy::math::UVec2::as_ivec2( &_self, ) .into(); @@ -7157,7 +7003,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_i64vec2( + let output: Val = bevy::math::UVec2::as_i64vec2( &_self, ) .into(); @@ -7167,7 +7013,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = ::bevy::math::UVec2::as_u64vec2( + let output: Val = bevy::math::UVec2::as_u64vec2( &_self, ) .into(); @@ -7177,7 +7023,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_add( + let output: Val = bevy::math::UVec2::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -7188,7 +7034,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_sub( + let output: Val = bevy::math::UVec2::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -7199,7 +7045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_mul( + let output: Val = bevy::math::UVec2::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -7210,7 +7056,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_div( + let output: Val = bevy::math::UVec2::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -7221,7 +7067,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_add( + let output: Val = bevy::math::UVec2::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -7232,7 +7078,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_sub( + let output: Val = bevy::math::UVec2::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -7243,7 +7089,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_mul( + let output: Val = bevy::math::UVec2::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -7254,7 +7100,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_div( + let output: Val = bevy::math::UVec2::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -7265,7 +7111,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::wrapping_add_signed( + let output: Val = bevy::math::UVec2::wrapping_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -7276,7 +7122,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec2::saturating_add_signed( + let output: Val = bevy::math::UVec2::saturating_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -7288,10 +7134,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -7299,7 +7144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::UVec3::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -7309,10 +7154,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -7320,10 +7164,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -7331,7 +7174,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -7341,10 +7184,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -7352,10 +7194,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -7363,10 +7204,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -7374,11 +7214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u32, y: u32, z: u32| { - let output: Val = ::bevy::math::UVec3::new( - x, - y, - z, - ) + let output: Val = bevy::math::UVec3::new(x, y, z) .into(); output }, @@ -7386,7 +7222,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = ::bevy::math::UVec3::splat(v) + let output: Val = bevy::math::UVec3::splat(v) .into(); output }, @@ -7398,7 +7234,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::UVec3::select( + let output: Val = bevy::math::UVec3::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -7410,9 +7246,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 3]| { - let output: Val = ::bevy::math::UVec3::from_array( - a, - ) + let output: Val = bevy::math::UVec3::from_array(a) .into(); output }, @@ -7420,14 +7254,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 3] = ::bevy::math::UVec3::to_array(&_self).into(); + let output: [u32; 3] = bevy::math::UVec3::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: u32| { - let output: Val = ::bevy::math::UVec3::extend( + let output: Val = bevy::math::UVec3::extend( _self.into_inner(), w, ) @@ -7438,7 +7272,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::UVec3::truncate( + let output: Val = bevy::math::UVec3::truncate( _self.into_inner(), ) .into(); @@ -7448,7 +7282,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = ::bevy::math::UVec3::with_x( + let output: Val = bevy::math::UVec3::with_x( _self.into_inner(), x, ) @@ -7459,7 +7293,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = ::bevy::math::UVec3::with_y( + let output: Val = bevy::math::UVec3::with_y( _self.into_inner(), y, ) @@ -7470,7 +7304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u32| { - let output: Val = ::bevy::math::UVec3::with_z( + let output: Val = bevy::math::UVec3::with_z( _self.into_inner(), z, ) @@ -7481,7 +7315,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec3::dot( + let output: u32 = bevy::math::UVec3::dot( _self.into_inner(), rhs.into_inner(), ) @@ -7492,7 +7326,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::dot_into_vec( + let output: Val = bevy::math::UVec3::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -7503,7 +7337,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cross( + let output: Val = bevy::math::UVec3::cross( _self.into_inner(), rhs.into_inner(), ) @@ -7514,7 +7348,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::min( + let output: Val = bevy::math::UVec3::min( _self.into_inner(), rhs.into_inner(), ) @@ -7525,7 +7359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::max( + let output: Val = bevy::math::UVec3::max( _self.into_inner(), rhs.into_inner(), ) @@ -7540,7 +7374,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::UVec3::clamp( + let output: Val = bevy::math::UVec3::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -7552,9 +7386,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::min_element( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec3::min_element(_self.into_inner()) .into(); output }, @@ -7562,9 +7394,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::max_element( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec3::max_element(_self.into_inner()) .into(); output }, @@ -7572,9 +7402,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::element_sum( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec3::element_sum(_self.into_inner()) .into(); output }, @@ -7582,7 +7410,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::element_product( + let output: u32 = bevy::math::UVec3::element_product( _self.into_inner(), ) .into(); @@ -7592,7 +7420,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpeq( + let output: Val = bevy::math::UVec3::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -7603,7 +7431,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpne( + let output: Val = bevy::math::UVec3::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -7614,7 +7442,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpge( + let output: Val = bevy::math::UVec3::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -7625,7 +7453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmpgt( + let output: Val = bevy::math::UVec3::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -7636,7 +7464,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmple( + let output: Val = bevy::math::UVec3::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -7647,7 +7475,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::cmplt( + let output: Val = bevy::math::UVec3::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -7658,7 +7486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = ::bevy::math::UVec3::length_squared( + let output: u32 = bevy::math::UVec3::length_squared( _self.into_inner(), ) .into(); @@ -7668,7 +7496,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_vec3( + let output: Val = bevy::math::UVec3::as_vec3( &_self, ) .into(); @@ -7678,7 +7506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_vec3a( + let output: Val = bevy::math::UVec3::as_vec3a( &_self, ) .into(); @@ -7688,7 +7516,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_dvec3( + let output: Val = bevy::math::UVec3::as_dvec3( &_self, ) .into(); @@ -7698,7 +7526,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_ivec3( + let output: Val = bevy::math::UVec3::as_ivec3( &_self, ) .into(); @@ -7708,7 +7536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_i64vec3( + let output: Val = bevy::math::UVec3::as_i64vec3( &_self, ) .into(); @@ -7718,7 +7546,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = ::bevy::math::UVec3::as_u64vec3( + let output: Val = bevy::math::UVec3::as_u64vec3( &_self, ) .into(); @@ -7728,7 +7556,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_add( + let output: Val = bevy::math::UVec3::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -7739,7 +7567,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_sub( + let output: Val = bevy::math::UVec3::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -7750,7 +7578,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_mul( + let output: Val = bevy::math::UVec3::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -7761,7 +7589,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_div( + let output: Val = bevy::math::UVec3::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -7772,7 +7600,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_add( + let output: Val = bevy::math::UVec3::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -7783,7 +7611,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_sub( + let output: Val = bevy::math::UVec3::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -7794,7 +7622,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_mul( + let output: Val = bevy::math::UVec3::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -7805,7 +7633,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_div( + let output: Val = bevy::math::UVec3::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -7816,7 +7644,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::wrapping_add_signed( + let output: Val = bevy::math::UVec3::wrapping_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -7827,7 +7655,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::saturating_add_signed( + let output: Val = bevy::math::UVec3::saturating_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -7838,10 +7666,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -7849,10 +7676,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -7860,10 +7686,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -7871,17 +7696,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec3::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -7889,10 +7716,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -7900,10 +7726,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -7911,10 +7736,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -7922,10 +7746,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec3::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -7933,10 +7756,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec3::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -7945,10 +7767,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -7956,10 +7777,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -7967,10 +7787,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -7978,7 +7797,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::UVec4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -7988,10 +7807,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -7999,10 +7817,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -8010,10 +7827,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -8021,10 +7837,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -8032,7 +7847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u32, y: u32, z: u32, w: u32| { - let output: Val = ::bevy::math::UVec4::new( + let output: Val = bevy::math::UVec4::new( x, y, z, @@ -8045,7 +7860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u32| { - let output: Val = ::bevy::math::UVec4::splat(v) + let output: Val = bevy::math::UVec4::splat(v) .into(); output }, @@ -8057,7 +7872,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::UVec4::select( + let output: Val = bevy::math::UVec4::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -8069,9 +7884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u32; 4]| { - let output: Val = ::bevy::math::UVec4::from_array( - a, - ) + let output: Val = bevy::math::UVec4::from_array(a) .into(); output }, @@ -8079,14 +7892,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u32; 4] = ::bevy::math::UVec4::to_array(&_self).into(); + let output: [u32; 4] = bevy::math::UVec4::to_array(&_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::UVec4::truncate( + let output: Val = bevy::math::UVec4::truncate( _self.into_inner(), ) .into(); @@ -8096,7 +7909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u32| { - let output: Val = ::bevy::math::UVec4::with_x( + let output: Val = bevy::math::UVec4::with_x( _self.into_inner(), x, ) @@ -8107,7 +7920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u32| { - let output: Val = ::bevy::math::UVec4::with_y( + let output: Val = bevy::math::UVec4::with_y( _self.into_inner(), y, ) @@ -8118,7 +7931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u32| { - let output: Val = ::bevy::math::UVec4::with_z( + let output: Val = bevy::math::UVec4::with_z( _self.into_inner(), z, ) @@ -8129,7 +7942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: u32| { - let output: Val = ::bevy::math::UVec4::with_w( + let output: Val = bevy::math::UVec4::with_w( _self.into_inner(), w, ) @@ -8140,7 +7953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u32 = ::bevy::math::UVec4::dot( + let output: u32 = bevy::math::UVec4::dot( _self.into_inner(), rhs.into_inner(), ) @@ -8151,7 +7964,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::dot_into_vec( + let output: Val = bevy::math::UVec4::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -8162,7 +7975,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::min( + let output: Val = bevy::math::UVec4::min( _self.into_inner(), rhs.into_inner(), ) @@ -8173,7 +7986,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::max( + let output: Val = bevy::math::UVec4::max( _self.into_inner(), rhs.into_inner(), ) @@ -8188,7 +8001,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::UVec4::clamp( + let output: Val = bevy::math::UVec4::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -8199,10 +8012,8 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { ) .overwrite_script_function( "min_element", - |_self: Val| { - let output: u32 = ::bevy::math::UVec4::min_element( - _self.into_inner(), - ) + |_self: Val| { + let output: u32 = bevy::math::UVec4::min_element(_self.into_inner()) .into(); output }, @@ -8210,9 +8021,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::max_element( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec4::max_element(_self.into_inner()) .into(); output }, @@ -8220,9 +8029,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::element_sum( - _self.into_inner(), - ) + let output: u32 = bevy::math::UVec4::element_sum(_self.into_inner()) .into(); output }, @@ -8230,7 +8037,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::element_product( + let output: u32 = bevy::math::UVec4::element_product( _self.into_inner(), ) .into(); @@ -8240,7 +8047,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpeq( + let output: Val = bevy::math::UVec4::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -8251,7 +8058,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpne( + let output: Val = bevy::math::UVec4::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -8262,7 +8069,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpge( + let output: Val = bevy::math::UVec4::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -8273,7 +8080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmpgt( + let output: Val = bevy::math::UVec4::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -8284,7 +8091,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmple( + let output: Val = bevy::math::UVec4::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -8295,7 +8102,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::cmplt( + let output: Val = bevy::math::UVec4::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -8306,7 +8113,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u32 = ::bevy::math::UVec4::length_squared( + let output: u32 = bevy::math::UVec4::length_squared( _self.into_inner(), ) .into(); @@ -8316,7 +8123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_vec4( + let output: Val = bevy::math::UVec4::as_vec4( &_self, ) .into(); @@ -8326,7 +8133,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_dvec4( + let output: Val = bevy::math::UVec4::as_dvec4( &_self, ) .into(); @@ -8336,7 +8143,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_ivec4( + let output: Val = bevy::math::UVec4::as_ivec4( &_self, ) .into(); @@ -8346,7 +8153,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_i64vec4( + let output: Val = bevy::math::UVec4::as_i64vec4( &_self, ) .into(); @@ -8356,7 +8163,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = ::bevy::math::UVec4::as_u64vec4( + let output: Val = bevy::math::UVec4::as_u64vec4( &_self, ) .into(); @@ -8366,7 +8173,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_add( + let output: Val = bevy::math::UVec4::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -8377,7 +8184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_sub( + let output: Val = bevy::math::UVec4::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -8388,7 +8195,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_mul( + let output: Val = bevy::math::UVec4::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -8399,7 +8206,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_div( + let output: Val = bevy::math::UVec4::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -8410,7 +8217,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_add( + let output: Val = bevy::math::UVec4::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -8421,7 +8228,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_sub( + let output: Val = bevy::math::UVec4::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -8432,7 +8239,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_mul( + let output: Val = bevy::math::UVec4::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -8443,7 +8250,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_div( + let output: Val = bevy::math::UVec4::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -8454,7 +8261,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::wrapping_add_signed( + let output: Val = bevy::math::UVec4::wrapping_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -8465,7 +8272,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::saturating_add_signed( + let output: Val = bevy::math::UVec4::saturating_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -8476,17 +8283,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::UVec4::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -8494,10 +8303,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -8505,10 +8313,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -8516,10 +8323,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -8527,10 +8333,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::UVec4::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -8538,7 +8343,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::UVec4::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -8548,10 +8353,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -8559,10 +8363,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::UVec4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -8570,10 +8373,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u32| { - let output: Val = ::bevy::math::UVec4::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -8582,10 +8384,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -8593,10 +8394,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -8604,10 +8404,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -8615,10 +8414,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -8626,10 +8424,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -8637,10 +8434,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -8648,7 +8444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -8658,10 +8454,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -8669,10 +8464,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -8680,10 +8474,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -8691,10 +8484,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -8702,10 +8494,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64| { - let output: Val = ::bevy::math::U64Vec2::new( - x, - y, - ) + let output: Val = bevy::math::U64Vec2::new(x, y) .into(); output }, @@ -8713,9 +8502,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = ::bevy::math::U64Vec2::splat( - v, - ) + let output: Val = bevy::math::U64Vec2::splat(v) .into(); output }, @@ -8727,7 +8514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::U64Vec2::select( + let output: Val = bevy::math::U64Vec2::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -8739,7 +8526,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 2]| { - let output: Val = ::bevy::math::U64Vec2::from_array( + let output: Val = bevy::math::U64Vec2::from_array( a, ) .into(); @@ -8749,15 +8536,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 2] = ::bevy::math::U64Vec2::to_array(&_self) - .into(); + let output: [u64; 2] = bevy::math::U64Vec2::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: u64| { - let output: Val = ::bevy::math::U64Vec2::extend( + let output: Val = bevy::math::U64Vec2::extend( _self.into_inner(), z, ) @@ -8768,7 +8554,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec2::with_x( + let output: Val = bevy::math::U64Vec2::with_x( _self.into_inner(), x, ) @@ -8779,7 +8565,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec2::with_y( + let output: Val = bevy::math::U64Vec2::with_y( _self.into_inner(), y, ) @@ -8790,7 +8576,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = ::bevy::math::U64Vec2::dot( + let output: u64 = bevy::math::U64Vec2::dot( _self.into_inner(), rhs.into_inner(), ) @@ -8801,7 +8587,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::dot_into_vec( + let output: Val = bevy::math::U64Vec2::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -8812,7 +8598,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::min( + let output: Val = bevy::math::U64Vec2::min( _self.into_inner(), rhs.into_inner(), ) @@ -8823,7 +8609,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::max( + let output: Val = bevy::math::U64Vec2::max( _self.into_inner(), rhs.into_inner(), ) @@ -8838,7 +8624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::U64Vec2::clamp( + let output: Val = bevy::math::U64Vec2::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -8850,7 +8636,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::min_element( + let output: u64 = bevy::math::U64Vec2::min_element( _self.into_inner(), ) .into(); @@ -8860,7 +8646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::max_element( + let output: u64 = bevy::math::U64Vec2::max_element( _self.into_inner(), ) .into(); @@ -8870,7 +8656,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::element_sum( + let output: u64 = bevy::math::U64Vec2::element_sum( _self.into_inner(), ) .into(); @@ -8880,7 +8666,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::element_product( + let output: u64 = bevy::math::U64Vec2::element_product( _self.into_inner(), ) .into(); @@ -8890,7 +8676,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpeq( + let output: Val = bevy::math::U64Vec2::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -8901,7 +8687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpne( + let output: Val = bevy::math::U64Vec2::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -8912,7 +8698,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpge( + let output: Val = bevy::math::U64Vec2::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -8923,7 +8709,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmpgt( + let output: Val = bevy::math::U64Vec2::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -8934,7 +8720,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmple( + let output: Val = bevy::math::U64Vec2::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -8945,7 +8731,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::cmplt( + let output: Val = bevy::math::U64Vec2::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -8956,7 +8742,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec2::length_squared( + let output: u64 = bevy::math::U64Vec2::length_squared( _self.into_inner(), ) .into(); @@ -8966,7 +8752,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_vec2( + let output: Val = bevy::math::U64Vec2::as_vec2( &_self, ) .into(); @@ -8976,7 +8762,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_dvec2( + let output: Val = bevy::math::U64Vec2::as_dvec2( &_self, ) .into(); @@ -8986,7 +8772,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_ivec2( + let output: Val = bevy::math::U64Vec2::as_ivec2( &_self, ) .into(); @@ -8996,7 +8782,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_uvec2( + let output: Val = bevy::math::U64Vec2::as_uvec2( &_self, ) .into(); @@ -9006,7 +8792,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec2::as_i64vec2( + let output: Val = bevy::math::U64Vec2::as_i64vec2( &_self, ) .into(); @@ -9016,7 +8802,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_add( + let output: Val = bevy::math::U64Vec2::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -9027,7 +8813,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_sub( + let output: Val = bevy::math::U64Vec2::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -9038,7 +8824,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_mul( + let output: Val = bevy::math::U64Vec2::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -9049,7 +8835,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_div( + let output: Val = bevy::math::U64Vec2::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -9060,7 +8846,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_add( + let output: Val = bevy::math::U64Vec2::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -9071,7 +8857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_sub( + let output: Val = bevy::math::U64Vec2::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -9082,7 +8868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_mul( + let output: Val = bevy::math::U64Vec2::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -9093,7 +8879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_div( + let output: Val = bevy::math::U64Vec2::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -9104,7 +8890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::wrapping_add_signed( + let output: Val = bevy::math::U64Vec2::wrapping_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -9115,7 +8901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::saturating_add_signed( + let output: Val = bevy::math::U64Vec2::saturating_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -9126,10 +8912,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec2::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -9137,10 +8922,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9148,17 +8932,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec2::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -9166,10 +8952,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9177,7 +8962,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::U64Vec2::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -9187,10 +8972,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9199,10 +8983,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -9210,10 +8993,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -9221,7 +9003,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64, z: u64| { - let output: Val = ::bevy::math::U64Vec3::new( + let output: Val = bevy::math::U64Vec3::new( x, y, z, @@ -9233,9 +9015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = ::bevy::math::U64Vec3::splat( - v, - ) + let output: Val = bevy::math::U64Vec3::splat(v) .into(); output }, @@ -9247,7 +9027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::U64Vec3::select( + let output: Val = bevy::math::U64Vec3::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -9259,7 +9039,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 3]| { - let output: Val = ::bevy::math::U64Vec3::from_array( + let output: Val = bevy::math::U64Vec3::from_array( a, ) .into(); @@ -9269,15 +9049,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 3] = ::bevy::math::U64Vec3::to_array(&_self) - .into(); + let output: [u64; 3] = bevy::math::U64Vec3::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: u64| { - let output: Val = ::bevy::math::U64Vec3::extend( + let output: Val = bevy::math::U64Vec3::extend( _self.into_inner(), w, ) @@ -9288,7 +9067,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::U64Vec3::truncate( + let output: Val = bevy::math::U64Vec3::truncate( _self.into_inner(), ) .into(); @@ -9298,7 +9077,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec3::with_x( + let output: Val = bevy::math::U64Vec3::with_x( _self.into_inner(), x, ) @@ -9309,7 +9088,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec3::with_y( + let output: Val = bevy::math::U64Vec3::with_y( _self.into_inner(), y, ) @@ -9320,7 +9099,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u64| { - let output: Val = ::bevy::math::U64Vec3::with_z( + let output: Val = bevy::math::U64Vec3::with_z( _self.into_inner(), z, ) @@ -9331,7 +9110,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = ::bevy::math::U64Vec3::dot( + let output: u64 = bevy::math::U64Vec3::dot( _self.into_inner(), rhs.into_inner(), ) @@ -9342,7 +9121,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::dot_into_vec( + let output: Val = bevy::math::U64Vec3::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -9353,7 +9132,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cross( + let output: Val = bevy::math::U64Vec3::cross( _self.into_inner(), rhs.into_inner(), ) @@ -9364,7 +9143,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::min( + let output: Val = bevy::math::U64Vec3::min( _self.into_inner(), rhs.into_inner(), ) @@ -9375,7 +9154,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::max( + let output: Val = bevy::math::U64Vec3::max( _self.into_inner(), rhs.into_inner(), ) @@ -9390,7 +9169,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::U64Vec3::clamp( + let output: Val = bevy::math::U64Vec3::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -9402,7 +9181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::min_element( + let output: u64 = bevy::math::U64Vec3::min_element( _self.into_inner(), ) .into(); @@ -9412,7 +9191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::max_element( + let output: u64 = bevy::math::U64Vec3::max_element( _self.into_inner(), ) .into(); @@ -9422,7 +9201,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::element_sum( + let output: u64 = bevy::math::U64Vec3::element_sum( _self.into_inner(), ) .into(); @@ -9432,7 +9211,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::element_product( + let output: u64 = bevy::math::U64Vec3::element_product( _self.into_inner(), ) .into(); @@ -9442,7 +9221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpeq( + let output: Val = bevy::math::U64Vec3::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -9453,7 +9232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpne( + let output: Val = bevy::math::U64Vec3::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -9464,7 +9243,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpge( + let output: Val = bevy::math::U64Vec3::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -9475,7 +9254,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmpgt( + let output: Val = bevy::math::U64Vec3::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -9486,7 +9265,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmple( + let output: Val = bevy::math::U64Vec3::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -9497,7 +9276,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::cmplt( + let output: Val = bevy::math::U64Vec3::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -9508,7 +9287,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec3::length_squared( + let output: u64 = bevy::math::U64Vec3::length_squared( _self.into_inner(), ) .into(); @@ -9518,7 +9297,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_vec3( + let output: Val = bevy::math::U64Vec3::as_vec3( &_self, ) .into(); @@ -9528,7 +9307,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_vec3a( + let output: Val = bevy::math::U64Vec3::as_vec3a( &_self, ) .into(); @@ -9538,7 +9317,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_dvec3( + let output: Val = bevy::math::U64Vec3::as_dvec3( &_self, ) .into(); @@ -9548,7 +9327,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_ivec3( + let output: Val = bevy::math::U64Vec3::as_ivec3( &_self, ) .into(); @@ -9558,7 +9337,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_uvec3( + let output: Val = bevy::math::U64Vec3::as_uvec3( &_self, ) .into(); @@ -9568,7 +9347,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::as_i64vec3( + let output: Val = bevy::math::U64Vec3::as_i64vec3( &_self, ) .into(); @@ -9578,7 +9357,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_add( + let output: Val = bevy::math::U64Vec3::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -9589,7 +9368,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_sub( + let output: Val = bevy::math::U64Vec3::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -9600,7 +9379,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_mul( + let output: Val = bevy::math::U64Vec3::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -9611,7 +9390,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_div( + let output: Val = bevy::math::U64Vec3::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -9622,7 +9401,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_add( + let output: Val = bevy::math::U64Vec3::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -9633,7 +9412,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_sub( + let output: Val = bevy::math::U64Vec3::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -9644,7 +9423,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_mul( + let output: Val = bevy::math::U64Vec3::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -9655,7 +9434,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_div( + let output: Val = bevy::math::U64Vec3::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -9666,7 +9445,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::wrapping_add_signed( + let output: Val = bevy::math::U64Vec3::wrapping_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -9677,7 +9456,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::saturating_add_signed( + let output: Val = bevy::math::U64Vec3::saturating_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -9688,10 +9467,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -9699,10 +9477,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9710,10 +9487,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -9721,10 +9497,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -9732,7 +9507,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::U64Vec3::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -9742,10 +9517,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -9753,10 +9527,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9764,10 +9537,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -9775,7 +9547,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -9785,10 +9557,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9796,10 +9567,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9807,10 +9577,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec3::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -9818,17 +9587,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -9836,10 +9607,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9847,10 +9617,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec3::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -9859,7 +9628,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::U64Vec4::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -9869,10 +9638,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9880,10 +9648,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -9891,10 +9658,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -9902,10 +9668,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -9913,10 +9678,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9924,10 +9688,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9935,10 +9698,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -9946,10 +9708,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -9957,10 +9718,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -9968,10 +9728,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -9979,10 +9738,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -9990,10 +9748,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::U64Vec4::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -10001,10 +9758,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -10012,7 +9768,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -10022,7 +9778,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: u64, y: u64, z: u64, w: u64| { - let output: Val = ::bevy::math::U64Vec4::new( + let output: Val = bevy::math::U64Vec4::new( x, y, z, @@ -10035,9 +9791,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: u64| { - let output: Val = ::bevy::math::U64Vec4::splat( - v, - ) + let output: Val = bevy::math::U64Vec4::splat(v) .into(); output }, @@ -10049,7 +9803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::U64Vec4::select( + let output: Val = bevy::math::U64Vec4::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -10061,7 +9815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [u64; 4]| { - let output: Val = ::bevy::math::U64Vec4::from_array( + let output: Val = bevy::math::U64Vec4::from_array( a, ) .into(); @@ -10071,15 +9825,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [u64; 4] = ::bevy::math::U64Vec4::to_array(&_self) - .into(); + let output: [u64; 4] = bevy::math::U64Vec4::to_array(&_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::U64Vec4::truncate( + let output: Val = bevy::math::U64Vec4::truncate( _self.into_inner(), ) .into(); @@ -10089,7 +9842,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: u64| { - let output: Val = ::bevy::math::U64Vec4::with_x( + let output: Val = bevy::math::U64Vec4::with_x( _self.into_inner(), x, ) @@ -10100,7 +9853,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: u64| { - let output: Val = ::bevy::math::U64Vec4::with_y( + let output: Val = bevy::math::U64Vec4::with_y( _self.into_inner(), y, ) @@ -10111,7 +9864,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: u64| { - let output: Val = ::bevy::math::U64Vec4::with_z( + let output: Val = bevy::math::U64Vec4::with_z( _self.into_inner(), z, ) @@ -10122,7 +9875,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: u64| { - let output: Val = ::bevy::math::U64Vec4::with_w( + let output: Val = bevy::math::U64Vec4::with_w( _self.into_inner(), w, ) @@ -10133,7 +9886,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: u64 = ::bevy::math::U64Vec4::dot( + let output: u64 = bevy::math::U64Vec4::dot( _self.into_inner(), rhs.into_inner(), ) @@ -10144,7 +9897,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::dot_into_vec( + let output: Val = bevy::math::U64Vec4::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -10155,7 +9908,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::min( + let output: Val = bevy::math::U64Vec4::min( _self.into_inner(), rhs.into_inner(), ) @@ -10166,7 +9919,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::max( + let output: Val = bevy::math::U64Vec4::max( _self.into_inner(), rhs.into_inner(), ) @@ -10181,7 +9934,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::U64Vec4::clamp( + let output: Val = bevy::math::U64Vec4::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -10193,7 +9946,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::min_element( + let output: u64 = bevy::math::U64Vec4::min_element( _self.into_inner(), ) .into(); @@ -10203,7 +9956,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::max_element( + let output: u64 = bevy::math::U64Vec4::max_element( _self.into_inner(), ) .into(); @@ -10213,7 +9966,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::element_sum( + let output: u64 = bevy::math::U64Vec4::element_sum( _self.into_inner(), ) .into(); @@ -10223,7 +9976,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::element_product( + let output: u64 = bevy::math::U64Vec4::element_product( _self.into_inner(), ) .into(); @@ -10233,7 +9986,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpeq( + let output: Val = bevy::math::U64Vec4::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -10244,7 +9997,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpne( + let output: Val = bevy::math::U64Vec4::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -10255,7 +10008,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpge( + let output: Val = bevy::math::U64Vec4::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -10266,7 +10019,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmpgt( + let output: Val = bevy::math::U64Vec4::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -10277,7 +10030,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmple( + let output: Val = bevy::math::U64Vec4::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -10288,7 +10041,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::cmplt( + let output: Val = bevy::math::U64Vec4::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -10299,7 +10052,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: u64 = ::bevy::math::U64Vec4::length_squared( + let output: u64 = bevy::math::U64Vec4::length_squared( _self.into_inner(), ) .into(); @@ -10309,7 +10062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_vec4( + let output: Val = bevy::math::U64Vec4::as_vec4( &_self, ) .into(); @@ -10319,7 +10072,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_dvec4( + let output: Val = bevy::math::U64Vec4::as_dvec4( &_self, ) .into(); @@ -10329,7 +10082,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_ivec4( + let output: Val = bevy::math::U64Vec4::as_ivec4( &_self, ) .into(); @@ -10339,7 +10092,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_uvec4( + let output: Val = bevy::math::U64Vec4::as_uvec4( &_self, ) .into(); @@ -10349,7 +10102,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = ::bevy::math::U64Vec4::as_i64vec4( + let output: Val = bevy::math::U64Vec4::as_i64vec4( &_self, ) .into(); @@ -10359,7 +10112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_add( + let output: Val = bevy::math::U64Vec4::wrapping_add( _self.into_inner(), rhs.into_inner(), ) @@ -10370,7 +10123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_sub( + let output: Val = bevy::math::U64Vec4::wrapping_sub( _self.into_inner(), rhs.into_inner(), ) @@ -10381,7 +10134,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_mul( + let output: Val = bevy::math::U64Vec4::wrapping_mul( _self.into_inner(), rhs.into_inner(), ) @@ -10392,7 +10145,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_div( + let output: Val = bevy::math::U64Vec4::wrapping_div( _self.into_inner(), rhs.into_inner(), ) @@ -10403,7 +10156,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_add( + let output: Val = bevy::math::U64Vec4::saturating_add( _self.into_inner(), rhs.into_inner(), ) @@ -10414,7 +10167,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_sub( + let output: Val = bevy::math::U64Vec4::saturating_sub( _self.into_inner(), rhs.into_inner(), ) @@ -10425,7 +10178,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_mul( + let output: Val = bevy::math::U64Vec4::saturating_mul( _self.into_inner(), rhs.into_inner(), ) @@ -10436,7 +10189,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_div( + let output: Val = bevy::math::U64Vec4::saturating_div( _self.into_inner(), rhs.into_inner(), ) @@ -10447,7 +10200,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "wrapping_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::wrapping_add_signed( + let output: Val = bevy::math::U64Vec4::wrapping_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -10458,7 +10211,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "saturating_add_signed", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::U64Vec4::saturating_add_signed( + let output: Val = bevy::math::U64Vec4::saturating_add_signed( _self.into_inner(), rhs.into_inner(), ) @@ -10469,10 +10222,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -10480,17 +10232,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::U64Vec4::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: u64| { - let output: Val = ::bevy::math::U64Vec4::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -10499,10 +10253,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -10510,10 +10263,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -10521,10 +10273,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -10532,10 +10283,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -10543,14 +10293,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::Vec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Vec2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -10560,10 +10313,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -10571,7 +10323,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Vec2::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -10579,7 +10333,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32| { - let output: Val = ::bevy::math::Vec2::new(x, y) + let output: Val = bevy::math::Vec2::new(x, y) .into(); output }, @@ -10587,7 +10341,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec2::splat(v) + let output: Val = bevy::math::Vec2::splat(v) .into(); output }, @@ -10599,7 +10353,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::Vec2::select( + let output: Val = bevy::math::Vec2::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -10611,7 +10365,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 2]| { - let output: Val = ::bevy::math::Vec2::from_array(a) + let output: Val = bevy::math::Vec2::from_array(a) .into(); output }, @@ -10619,14 +10373,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 2] = ::bevy::math::Vec2::to_array(&_self).into(); + let output: [f32; 2] = bevy::math::Vec2::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec2::extend( + let output: Val = bevy::math::Vec2::extend( _self.into_inner(), z, ) @@ -10637,7 +10391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec2::with_x( + let output: Val = bevy::math::Vec2::with_x( _self.into_inner(), x, ) @@ -10648,7 +10402,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec2::with_y( + let output: Val = bevy::math::Vec2::with_y( _self.into_inner(), y, ) @@ -10659,7 +10413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::dot( + let output: f32 = bevy::math::Vec2::dot( _self.into_inner(), rhs.into_inner(), ) @@ -10670,7 +10424,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::dot_into_vec( + let output: Val = bevy::math::Vec2::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -10681,7 +10435,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::min( + let output: Val = bevy::math::Vec2::min( _self.into_inner(), rhs.into_inner(), ) @@ -10692,7 +10446,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::max( + let output: Val = bevy::math::Vec2::max( _self.into_inner(), rhs.into_inner(), ) @@ -10707,7 +10461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::Vec2::clamp( + let output: Val = bevy::math::Vec2::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -10719,7 +10473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::min_element(_self.into_inner()) + let output: f32 = bevy::math::Vec2::min_element(_self.into_inner()) .into(); output }, @@ -10727,7 +10481,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::max_element(_self.into_inner()) + let output: f32 = bevy::math::Vec2::max_element(_self.into_inner()) .into(); output }, @@ -10735,7 +10489,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::element_sum(_self.into_inner()) + let output: f32 = bevy::math::Vec2::element_sum(_self.into_inner()) .into(); output }, @@ -10743,7 +10497,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::element_product( + let output: f32 = bevy::math::Vec2::element_product( _self.into_inner(), ) .into(); @@ -10753,7 +10507,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpeq( + let output: Val = bevy::math::Vec2::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -10764,7 +10518,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpne( + let output: Val = bevy::math::Vec2::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -10775,7 +10529,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpge( + let output: Val = bevy::math::Vec2::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -10786,7 +10540,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmpgt( + let output: Val = bevy::math::Vec2::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -10797,7 +10551,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmple( + let output: Val = bevy::math::Vec2::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -10808,7 +10562,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::cmplt( + let output: Val = bevy::math::Vec2::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -10819,7 +10573,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::Vec2::abs( + let output: Val = bevy::math::Vec2::abs( _self.into_inner(), ) .into(); @@ -10829,7 +10583,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::Vec2::signum( + let output: Val = bevy::math::Vec2::signum( _self.into_inner(), ) .into(); @@ -10839,7 +10593,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::copysign( + let output: Val = bevy::math::Vec2::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -10850,7 +10604,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::Vec2::is_negative_bitmask( + let output: u32 = bevy::math::Vec2::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -10860,7 +10614,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_finite(_self.into_inner()) + let output: bool = bevy::math::Vec2::is_finite(_self.into_inner()) .into(); output }, @@ -10868,7 +10622,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec2::is_finite_mask( + let output: Val = bevy::math::Vec2::is_finite_mask( _self.into_inner(), ) .into(); @@ -10878,7 +10632,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_nan(_self.into_inner()) + let output: bool = bevy::math::Vec2::is_nan(_self.into_inner()) .into(); output }, @@ -10886,7 +10640,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec2::is_nan_mask( + let output: Val = bevy::math::Vec2::is_nan_mask( _self.into_inner(), ) .into(); @@ -10896,7 +10650,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length(_self.into_inner()) + let output: f32 = bevy::math::Vec2::length(_self.into_inner()) .into(); output }, @@ -10904,7 +10658,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length_squared( + let output: f32 = bevy::math::Vec2::length_squared( _self.into_inner(), ) .into(); @@ -10914,9 +10668,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::length_recip( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec2::length_recip(_self.into_inner()) .into(); output }, @@ -10924,7 +10676,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::distance( + let output: f32 = bevy::math::Vec2::distance( _self.into_inner(), rhs.into_inner(), ) @@ -10935,7 +10687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::distance_squared( + let output: f32 = bevy::math::Vec2::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -10946,7 +10698,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::div_euclid( + let output: Val = bevy::math::Vec2::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -10957,7 +10709,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rem_euclid( + let output: Val = bevy::math::Vec2::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -10968,7 +10720,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::Vec2::normalize( + let output: Val = bevy::math::Vec2::normalize( _self.into_inner(), ) .into(); @@ -10978,7 +10730,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec2::normalize_or( + let output: Val = bevy::math::Vec2::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -10989,7 +10741,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::Vec2::normalize_or_zero( + let output: Val = bevy::math::Vec2::normalize_or_zero( _self.into_inner(), ) .into(); @@ -10999,7 +10751,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec2::is_normalized( + let output: bool = bevy::math::Vec2::is_normalized( _self.into_inner(), ) .into(); @@ -11009,7 +10761,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::project_onto( + let output: Val = bevy::math::Vec2::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -11020,7 +10772,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::reject_from( + let output: Val = bevy::math::Vec2::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -11031,7 +10783,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::project_onto_normalized( + let output: Val = bevy::math::Vec2::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -11042,7 +10794,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::reject_from_normalized( + let output: Val = bevy::math::Vec2::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -11053,7 +10805,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::Vec2::round( + let output: Val = bevy::math::Vec2::round( _self.into_inner(), ) .into(); @@ -11063,7 +10815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::Vec2::floor( + let output: Val = bevy::math::Vec2::floor( _self.into_inner(), ) .into(); @@ -11073,7 +10825,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::Vec2::ceil( + let output: Val = bevy::math::Vec2::ceil( _self.into_inner(), ) .into(); @@ -11083,7 +10835,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::Vec2::trunc( + let output: Val = bevy::math::Vec2::trunc( _self.into_inner(), ) .into(); @@ -11093,7 +10845,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::Vec2::fract( + let output: Val = bevy::math::Vec2::fract( _self.into_inner(), ) .into(); @@ -11103,7 +10855,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::Vec2::fract_gl( + let output: Val = bevy::math::Vec2::fract_gl( _self.into_inner(), ) .into(); @@ -11113,7 +10865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::Vec2::exp( + let output: Val = bevy::math::Vec2::exp( _self.into_inner(), ) .into(); @@ -11123,7 +10875,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec2::powf( + let output: Val = bevy::math::Vec2::powf( _self.into_inner(), n, ) @@ -11134,7 +10886,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::Vec2::recip( + let output: Val = bevy::math::Vec2::recip( _self.into_inner(), ) .into(); @@ -11144,7 +10896,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec2::lerp( + let output: Val = bevy::math::Vec2::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -11156,7 +10908,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec2::move_towards( + let output: Val = bevy::math::Vec2::move_towards( &_self, rhs.into_inner(), d, @@ -11168,7 +10920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::midpoint( + let output: Val = bevy::math::Vec2::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -11183,7 +10935,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Vec2::abs_diff_eq( + let output: bool = bevy::math::Vec2::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -11195,7 +10947,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec2::clamp_length( + let output: Val = bevy::math::Vec2::clamp_length( _self.into_inner(), min, max, @@ -11207,7 +10959,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec2::clamp_length_max( + let output: Val = bevy::math::Vec2::clamp_length_max( _self.into_inner(), max, ) @@ -11218,7 +10970,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec2::clamp_length_min( + let output: Val = bevy::math::Vec2::clamp_length_min( _self.into_inner(), min, ) @@ -11233,7 +10985,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::Vec2::mul_add( + let output: Val = bevy::math::Vec2::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -11245,7 +10997,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec2::reflect( + let output: Val = bevy::math::Vec2::reflect( _self.into_inner(), normal.into_inner(), ) @@ -11256,7 +11008,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec2::refract( + let output: Val = bevy::math::Vec2::refract( _self.into_inner(), normal.into_inner(), eta, @@ -11268,7 +11020,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = ::bevy::math::Vec2::from_angle( + let output: Val = bevy::math::Vec2::from_angle( angle, ) .into(); @@ -11278,7 +11030,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_angle", |_self: Val| { - let output: f32 = ::bevy::math::Vec2::to_angle(_self.into_inner()) + let output: f32 = bevy::math::Vec2::to_angle(_self.into_inner()) .into(); output }, @@ -11286,7 +11038,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::angle_between( + let output: f32 = bevy::math::Vec2::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -11297,7 +11049,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_to", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::angle_to( + let output: f32 = bevy::math::Vec2::angle_to( _self.into_inner(), rhs.into_inner(), ) @@ -11308,7 +11060,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = ::bevy::math::Vec2::perp( + let output: Val = bevy::math::Vec2::perp( _self.into_inner(), ) .into(); @@ -11318,7 +11070,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec2::perp_dot( + let output: f32 = bevy::math::Vec2::perp_dot( _self.into_inner(), rhs.into_inner(), ) @@ -11329,7 +11081,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rotate( + let output: Val = bevy::math::Vec2::rotate( _self.into_inner(), rhs.into_inner(), ) @@ -11344,7 +11096,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f32| { - let output: Val = ::bevy::math::Vec2::rotate_towards( + let output: Val = bevy::math::Vec2::rotate_towards( &_self, rhs.into_inner(), max_angle, @@ -11356,7 +11108,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec2", |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_dvec2( + let output: Val = bevy::math::Vec2::as_dvec2( &_self, ) .into(); @@ -11366,7 +11118,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_ivec2( + let output: Val = bevy::math::Vec2::as_ivec2( &_self, ) .into(); @@ -11376,7 +11128,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_uvec2( + let output: Val = bevy::math::Vec2::as_uvec2( &_self, ) .into(); @@ -11386,7 +11138,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_i64vec2( + let output: Val = bevy::math::Vec2::as_i64vec2( &_self, ) .into(); @@ -11396,7 +11148,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = ::bevy::math::Vec2::as_u64vec2( + let output: Val = bevy::math::Vec2::as_u64vec2( &_self, ) .into(); @@ -11406,10 +11158,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11417,10 +11168,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11428,10 +11178,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -11439,10 +11188,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -11450,10 +11198,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11461,10 +11208,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -11472,10 +11218,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -11483,10 +11228,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11494,10 +11238,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec2::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -11505,10 +11248,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec2::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -11517,10 +11259,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11528,17 +11269,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Vec3A::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -11546,7 +11289,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -11556,10 +11299,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -11567,10 +11309,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11578,10 +11319,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -11589,7 +11329,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -11599,11 +11339,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::math::Vec3A::new( - x, - y, - z, - ) + let output: Val = bevy::math::Vec3A::new(x, y, z) .into(); output }, @@ -11611,7 +11347,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec3A::splat(v) + let output: Val = bevy::math::Vec3A::splat(v) .into(); output }, @@ -11623,7 +11359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::Vec3A::select( + let output: Val = bevy::math::Vec3A::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -11635,9 +11371,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 3]| { - let output: Val = ::bevy::math::Vec3A::from_array( - a, - ) + let output: Val = bevy::math::Vec3A::from_array(a) .into(); output }, @@ -11645,14 +11379,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 3] = ::bevy::math::Vec3A::to_array(&_self).into(); + let output: [f32; 3] = bevy::math::Vec3A::to_array(&_self).into(); output }, ) .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = ::bevy::math::Vec3A::from_vec4( + let output: Val = bevy::math::Vec3A::from_vec4( v.into_inner(), ) .into(); @@ -11662,7 +11396,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "extend", |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec3A::extend( + let output: Val = bevy::math::Vec3A::extend( _self.into_inner(), w, ) @@ -11673,7 +11407,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::truncate( + let output: Val = bevy::math::Vec3A::truncate( _self.into_inner(), ) .into(); @@ -11683,7 +11417,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec3A::with_x( + let output: Val = bevy::math::Vec3A::with_x( _self.into_inner(), x, ) @@ -11694,7 +11428,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec3A::with_y( + let output: Val = bevy::math::Vec3A::with_y( _self.into_inner(), y, ) @@ -11705,7 +11439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec3A::with_z( + let output: Val = bevy::math::Vec3A::with_z( _self.into_inner(), z, ) @@ -11716,7 +11450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::dot( + let output: f32 = bevy::math::Vec3A::dot( _self.into_inner(), rhs.into_inner(), ) @@ -11727,7 +11461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::dot_into_vec( + let output: Val = bevy::math::Vec3A::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -11738,7 +11472,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cross( + let output: Val = bevy::math::Vec3A::cross( _self.into_inner(), rhs.into_inner(), ) @@ -11749,7 +11483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::min( + let output: Val = bevy::math::Vec3A::min( _self.into_inner(), rhs.into_inner(), ) @@ -11760,7 +11494,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::max( + let output: Val = bevy::math::Vec3A::max( _self.into_inner(), rhs.into_inner(), ) @@ -11775,7 +11509,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::Vec3A::clamp( + let output: Val = bevy::math::Vec3A::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -11787,9 +11521,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::min_element( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec3A::min_element(_self.into_inner()) .into(); output }, @@ -11797,9 +11529,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::max_element( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec3A::max_element(_self.into_inner()) .into(); output }, @@ -11807,9 +11537,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::element_sum( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec3A::element_sum(_self.into_inner()) .into(); output }, @@ -11817,7 +11545,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::element_product( + let output: f32 = bevy::math::Vec3A::element_product( _self.into_inner(), ) .into(); @@ -11827,7 +11555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpeq( + let output: Val = bevy::math::Vec3A::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -11838,7 +11566,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpne( + let output: Val = bevy::math::Vec3A::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -11849,7 +11577,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpge( + let output: Val = bevy::math::Vec3A::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -11860,7 +11588,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmpgt( + let output: Val = bevy::math::Vec3A::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -11871,7 +11599,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmple( + let output: Val = bevy::math::Vec3A::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -11882,7 +11610,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::cmplt( + let output: Val = bevy::math::Vec3A::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -11893,7 +11621,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::abs( + let output: Val = bevy::math::Vec3A::abs( _self.into_inner(), ) .into(); @@ -11903,7 +11631,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::signum( + let output: Val = bevy::math::Vec3A::signum( _self.into_inner(), ) .into(); @@ -11913,7 +11641,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::copysign( + let output: Val = bevy::math::Vec3A::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -11924,7 +11652,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::Vec3A::is_negative_bitmask( + let output: u32 = bevy::math::Vec3A::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -11934,7 +11662,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_finite(_self.into_inner()) + let output: bool = bevy::math::Vec3A::is_finite(_self.into_inner()) .into(); output }, @@ -11942,7 +11670,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::is_finite_mask( + let output: Val = bevy::math::Vec3A::is_finite_mask( _self.into_inner(), ) .into(); @@ -11952,7 +11680,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_nan(_self.into_inner()) + let output: bool = bevy::math::Vec3A::is_nan(_self.into_inner()) .into(); output }, @@ -11960,7 +11688,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::is_nan_mask( + let output: Val = bevy::math::Vec3A::is_nan_mask( _self.into_inner(), ) .into(); @@ -11970,7 +11698,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length(_self.into_inner()) + let output: f32 = bevy::math::Vec3A::length(_self.into_inner()) .into(); output }, @@ -11978,7 +11706,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length_squared( + let output: f32 = bevy::math::Vec3A::length_squared( _self.into_inner(), ) .into(); @@ -11988,9 +11716,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec3A::length_recip( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec3A::length_recip(_self.into_inner()) .into(); output }, @@ -11998,7 +11724,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::distance( + let output: f32 = bevy::math::Vec3A::distance( _self.into_inner(), rhs.into_inner(), ) @@ -12009,7 +11735,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::distance_squared( + let output: f32 = bevy::math::Vec3A::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -12020,7 +11746,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::div_euclid( + let output: Val = bevy::math::Vec3A::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -12031,7 +11757,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::rem_euclid( + let output: Val = bevy::math::Vec3A::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -12042,7 +11768,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::normalize( + let output: Val = bevy::math::Vec3A::normalize( _self.into_inner(), ) .into(); @@ -12052,7 +11778,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec3A::normalize_or( + let output: Val = bevy::math::Vec3A::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -12063,7 +11789,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::normalize_or_zero( + let output: Val = bevy::math::Vec3A::normalize_or_zero( _self.into_inner(), ) .into(); @@ -12073,7 +11799,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec3A::is_normalized( + let output: bool = bevy::math::Vec3A::is_normalized( _self.into_inner(), ) .into(); @@ -12083,7 +11809,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::project_onto( + let output: Val = bevy::math::Vec3A::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -12094,7 +11820,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::reject_from( + let output: Val = bevy::math::Vec3A::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -12105,7 +11831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::project_onto_normalized( + let output: Val = bevy::math::Vec3A::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -12116,7 +11842,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::reject_from_normalized( + let output: Val = bevy::math::Vec3A::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -12127,7 +11853,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::round( + let output: Val = bevy::math::Vec3A::round( _self.into_inner(), ) .into(); @@ -12137,7 +11863,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::floor( + let output: Val = bevy::math::Vec3A::floor( _self.into_inner(), ) .into(); @@ -12147,7 +11873,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::ceil( + let output: Val = bevy::math::Vec3A::ceil( _self.into_inner(), ) .into(); @@ -12157,7 +11883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::trunc( + let output: Val = bevy::math::Vec3A::trunc( _self.into_inner(), ) .into(); @@ -12167,7 +11893,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::fract( + let output: Val = bevy::math::Vec3A::fract( _self.into_inner(), ) .into(); @@ -12177,7 +11903,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::fract_gl( + let output: Val = bevy::math::Vec3A::fract_gl( _self.into_inner(), ) .into(); @@ -12187,7 +11913,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::exp( + let output: Val = bevy::math::Vec3A::exp( _self.into_inner(), ) .into(); @@ -12197,7 +11923,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec3A::powf( + let output: Val = bevy::math::Vec3A::powf( _self.into_inner(), n, ) @@ -12208,7 +11934,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::Vec3A::recip( + let output: Val = bevy::math::Vec3A::recip( _self.into_inner(), ) .into(); @@ -12218,7 +11944,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec3A::lerp( + let output: Val = bevy::math::Vec3A::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -12230,7 +11956,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec3A::move_towards( + let output: Val = bevy::math::Vec3A::move_towards( &_self, rhs.into_inner(), d, @@ -12242,7 +11968,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::midpoint( + let output: Val = bevy::math::Vec3A::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -12257,7 +11983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Vec3A::abs_diff_eq( + let output: bool = bevy::math::Vec3A::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -12269,7 +11995,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec3A::clamp_length( + let output: Val = bevy::math::Vec3A::clamp_length( _self.into_inner(), min, max, @@ -12281,7 +12007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec3A::clamp_length_max( + let output: Val = bevy::math::Vec3A::clamp_length_max( _self.into_inner(), max, ) @@ -12292,7 +12018,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec3A::clamp_length_min( + let output: Val = bevy::math::Vec3A::clamp_length_min( _self.into_inner(), min, ) @@ -12307,7 +12033,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::Vec3A::mul_add( + let output: Val = bevy::math::Vec3A::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -12319,7 +12045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec3A::reflect( + let output: Val = bevy::math::Vec3A::reflect( _self.into_inner(), normal.into_inner(), ) @@ -12334,7 +12060,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec3A::refract( + let output: Val = bevy::math::Vec3A::refract( _self.into_inner(), normal.into_inner(), eta, @@ -12346,7 +12072,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec3A::angle_between( + let output: f32 = bevy::math::Vec3A::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -12357,7 +12083,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::any_orthogonal_vector( + let output: Val = bevy::math::Vec3A::any_orthogonal_vector( &_self, ) .into(); @@ -12367,7 +12093,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::any_orthonormal_vector( + let output: Val = bevy::math::Vec3A::any_orthonormal_vector( &_self, ) .into(); @@ -12377,7 +12103,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_dvec3( + let output: Val = bevy::math::Vec3A::as_dvec3( &_self, ) .into(); @@ -12387,7 +12113,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_ivec3( + let output: Val = bevy::math::Vec3A::as_ivec3( &_self, ) .into(); @@ -12397,7 +12123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_uvec3( + let output: Val = bevy::math::Vec3A::as_uvec3( &_self, ) .into(); @@ -12407,7 +12133,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_i64vec3( + let output: Val = bevy::math::Vec3A::as_i64vec3( &_self, ) .into(); @@ -12417,7 +12143,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = ::bevy::math::Vec3A::as_u64vec3( + let output: Val = bevy::math::Vec3A::as_u64vec3( &_self, ) .into(); @@ -12427,10 +12153,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -12438,10 +12163,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -12449,10 +12173,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -12460,10 +12183,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -12471,10 +12193,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -12482,10 +12203,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -12493,10 +12213,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec3A::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -12504,10 +12223,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -12515,10 +12233,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -12526,10 +12243,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec3A::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -12538,10 +12254,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -12549,10 +12264,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -12560,17 +12274,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Vec4::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -12578,10 +12294,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -12589,7 +12304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Vec4::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -12599,10 +12314,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -12610,10 +12324,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -12621,10 +12334,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -12632,10 +12344,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -12643,12 +12354,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f32, y: f32, z: f32, w: f32| { - let output: Val = ::bevy::math::Vec4::new( - x, - y, - z, - w, - ) + let output: Val = bevy::math::Vec4::new(x, y, z, w) .into(); output }, @@ -12656,7 +12362,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f32| { - let output: Val = ::bevy::math::Vec4::splat(v) + let output: Val = bevy::math::Vec4::splat(v) .into(); output }, @@ -12668,7 +12374,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::Vec4::select( + let output: Val = bevy::math::Vec4::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -12680,7 +12386,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f32; 4]| { - let output: Val = ::bevy::math::Vec4::from_array(a) + let output: Val = bevy::math::Vec4::from_array(a) .into(); output }, @@ -12688,14 +12394,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Vec4::to_array(&_self).into(); + let output: [f32; 4] = bevy::math::Vec4::to_array(&_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::Vec4::truncate( + let output: Val = bevy::math::Vec4::truncate( _self.into_inner(), ) .into(); @@ -12705,7 +12411,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f32| { - let output: Val = ::bevy::math::Vec4::with_x( + let output: Val = bevy::math::Vec4::with_x( _self.into_inner(), x, ) @@ -12716,7 +12422,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f32| { - let output: Val = ::bevy::math::Vec4::with_y( + let output: Val = bevy::math::Vec4::with_y( _self.into_inner(), y, ) @@ -12727,7 +12433,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f32| { - let output: Val = ::bevy::math::Vec4::with_z( + let output: Val = bevy::math::Vec4::with_z( _self.into_inner(), z, ) @@ -12738,7 +12444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: f32| { - let output: Val = ::bevy::math::Vec4::with_w( + let output: Val = bevy::math::Vec4::with_w( _self.into_inner(), w, ) @@ -12749,7 +12455,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::dot( + let output: f32 = bevy::math::Vec4::dot( _self.into_inner(), rhs.into_inner(), ) @@ -12760,7 +12466,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::dot_into_vec( + let output: Val = bevy::math::Vec4::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -12771,7 +12477,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::min( + let output: Val = bevy::math::Vec4::min( _self.into_inner(), rhs.into_inner(), ) @@ -12782,7 +12488,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::max( + let output: Val = bevy::math::Vec4::max( _self.into_inner(), rhs.into_inner(), ) @@ -12797,7 +12503,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::Vec4::clamp( + let output: Val = bevy::math::Vec4::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -12809,7 +12515,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::min_element(_self.into_inner()) + let output: f32 = bevy::math::Vec4::min_element(_self.into_inner()) .into(); output }, @@ -12817,7 +12523,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::max_element(_self.into_inner()) + let output: f32 = bevy::math::Vec4::max_element(_self.into_inner()) .into(); output }, @@ -12825,7 +12531,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::element_sum(_self.into_inner()) + let output: f32 = bevy::math::Vec4::element_sum(_self.into_inner()) .into(); output }, @@ -12833,7 +12539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::element_product( + let output: f32 = bevy::math::Vec4::element_product( _self.into_inner(), ) .into(); @@ -12843,7 +12549,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpeq( + let output: Val = bevy::math::Vec4::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -12854,7 +12560,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpne( + let output: Val = bevy::math::Vec4::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -12865,7 +12571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpge( + let output: Val = bevy::math::Vec4::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -12876,7 +12582,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmpgt( + let output: Val = bevy::math::Vec4::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -12887,7 +12593,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmple( + let output: Val = bevy::math::Vec4::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -12898,7 +12604,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::cmplt( + let output: Val = bevy::math::Vec4::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -12909,7 +12615,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::Vec4::abs( + let output: Val = bevy::math::Vec4::abs( _self.into_inner(), ) .into(); @@ -12919,7 +12625,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::Vec4::signum( + let output: Val = bevy::math::Vec4::signum( _self.into_inner(), ) .into(); @@ -12929,7 +12635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::copysign( + let output: Val = bevy::math::Vec4::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -12940,7 +12646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::Vec4::is_negative_bitmask( + let output: u32 = bevy::math::Vec4::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -12950,7 +12656,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_finite(_self.into_inner()) + let output: bool = bevy::math::Vec4::is_finite(_self.into_inner()) .into(); output }, @@ -12958,7 +12664,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec4::is_finite_mask( + let output: Val = bevy::math::Vec4::is_finite_mask( _self.into_inner(), ) .into(); @@ -12968,7 +12674,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_nan(_self.into_inner()) + let output: bool = bevy::math::Vec4::is_nan(_self.into_inner()) .into(); output }, @@ -12976,7 +12682,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::Vec4::is_nan_mask( + let output: Val = bevy::math::Vec4::is_nan_mask( _self.into_inner(), ) .into(); @@ -12986,7 +12692,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length(_self.into_inner()) + let output: f32 = bevy::math::Vec4::length(_self.into_inner()) .into(); output }, @@ -12994,7 +12700,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length_squared( + let output: f32 = bevy::math::Vec4::length_squared( _self.into_inner(), ) .into(); @@ -13004,9 +12710,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f32 = ::bevy::math::Vec4::length_recip( - _self.into_inner(), - ) + let output: f32 = bevy::math::Vec4::length_recip(_self.into_inner()) .into(); output }, @@ -13014,7 +12718,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::distance( + let output: f32 = bevy::math::Vec4::distance( _self.into_inner(), rhs.into_inner(), ) @@ -13025,7 +12729,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f32 = ::bevy::math::Vec4::distance_squared( + let output: f32 = bevy::math::Vec4::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -13036,7 +12740,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::div_euclid( + let output: Val = bevy::math::Vec4::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -13047,7 +12751,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::rem_euclid( + let output: Val = bevy::math::Vec4::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -13058,7 +12762,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::Vec4::normalize( + let output: Val = bevy::math::Vec4::normalize( _self.into_inner(), ) .into(); @@ -13068,7 +12772,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::Vec4::normalize_or( + let output: Val = bevy::math::Vec4::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -13079,7 +12783,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::Vec4::normalize_or_zero( + let output: Val = bevy::math::Vec4::normalize_or_zero( _self.into_inner(), ) .into(); @@ -13089,7 +12793,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::Vec4::is_normalized( + let output: bool = bevy::math::Vec4::is_normalized( _self.into_inner(), ) .into(); @@ -13099,7 +12803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::project_onto( + let output: Val = bevy::math::Vec4::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -13110,7 +12814,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::reject_from( + let output: Val = bevy::math::Vec4::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -13121,7 +12825,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::project_onto_normalized( + let output: Val = bevy::math::Vec4::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -13132,7 +12836,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::reject_from_normalized( + let output: Val = bevy::math::Vec4::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -13143,7 +12847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::Vec4::round( + let output: Val = bevy::math::Vec4::round( _self.into_inner(), ) .into(); @@ -13153,7 +12857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::Vec4::floor( + let output: Val = bevy::math::Vec4::floor( _self.into_inner(), ) .into(); @@ -13163,7 +12867,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::Vec4::ceil( + let output: Val = bevy::math::Vec4::ceil( _self.into_inner(), ) .into(); @@ -13173,7 +12877,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::Vec4::trunc( + let output: Val = bevy::math::Vec4::trunc( _self.into_inner(), ) .into(); @@ -13183,7 +12887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::Vec4::fract( + let output: Val = bevy::math::Vec4::fract( _self.into_inner(), ) .into(); @@ -13193,7 +12897,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::Vec4::fract_gl( + let output: Val = bevy::math::Vec4::fract_gl( _self.into_inner(), ) .into(); @@ -13203,7 +12907,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::Vec4::exp( + let output: Val = bevy::math::Vec4::exp( _self.into_inner(), ) .into(); @@ -13213,7 +12917,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f32| { - let output: Val = ::bevy::math::Vec4::powf( + let output: Val = bevy::math::Vec4::powf( _self.into_inner(), n, ) @@ -13224,7 +12928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::Vec4::recip( + let output: Val = bevy::math::Vec4::recip( _self.into_inner(), ) .into(); @@ -13234,7 +12938,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f32| { - let output: Val = ::bevy::math::Vec4::lerp( + let output: Val = bevy::math::Vec4::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -13246,7 +12950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f32| { - let output: Val = ::bevy::math::Vec4::move_towards( + let output: Val = bevy::math::Vec4::move_towards( &_self, rhs.into_inner(), d, @@ -13258,7 +12962,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::midpoint( + let output: Val = bevy::math::Vec4::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -13273,7 +12977,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Vec4::abs_diff_eq( + let output: bool = bevy::math::Vec4::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -13285,7 +12989,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f32, max: f32| { - let output: Val = ::bevy::math::Vec4::clamp_length( + let output: Val = bevy::math::Vec4::clamp_length( _self.into_inner(), min, max, @@ -13297,7 +13001,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f32| { - let output: Val = ::bevy::math::Vec4::clamp_length_max( + let output: Val = bevy::math::Vec4::clamp_length_max( _self.into_inner(), max, ) @@ -13308,7 +13012,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f32| { - let output: Val = ::bevy::math::Vec4::clamp_length_min( + let output: Val = bevy::math::Vec4::clamp_length_min( _self.into_inner(), min, ) @@ -13323,7 +13027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::Vec4::mul_add( + let output: Val = bevy::math::Vec4::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -13335,7 +13039,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::Vec4::reflect( + let output: Val = bevy::math::Vec4::reflect( _self.into_inner(), normal.into_inner(), ) @@ -13346,7 +13050,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "refract", |_self: Val, normal: Val, eta: f32| { - let output: Val = ::bevy::math::Vec4::refract( + let output: Val = bevy::math::Vec4::refract( _self.into_inner(), normal.into_inner(), eta, @@ -13358,7 +13062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dvec4", |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_dvec4( + let output: Val = bevy::math::Vec4::as_dvec4( &_self, ) .into(); @@ -13368,7 +13072,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_ivec4( + let output: Val = bevy::math::Vec4::as_ivec4( &_self, ) .into(); @@ -13378,7 +13082,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_uvec4( + let output: Val = bevy::math::Vec4::as_uvec4( &_self, ) .into(); @@ -13388,7 +13092,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_i64vec4( + let output: Val = bevy::math::Vec4::as_i64vec4( &_self, ) .into(); @@ -13398,7 +13102,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = ::bevy::math::Vec4::as_u64vec4( + let output: Val = bevy::math::Vec4::as_u64vec4( &_self, ) .into(); @@ -13408,10 +13112,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -13419,10 +13122,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::Vec4::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -13430,10 +13132,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -13441,10 +13142,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -13452,7 +13152,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Vec4::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -13460,10 +13162,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -13471,10 +13172,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Vec4::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -13482,10 +13182,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Vec4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -13494,7 +13193,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::BVec2::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -13504,14 +13203,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "new", |x: bool, y: bool| { - let output: Val = ::bevy::math::BVec2::new(x, y) + let output: Val = bevy::math::BVec2::new(x, y) .into(); output }, @@ -13519,7 +13221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec2::splat(v) + let output: Val = bevy::math::BVec2::splat(v) .into(); output }, @@ -13527,9 +13229,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 2]| { - let output: Val = ::bevy::math::BVec2::from_array( - a, - ) + let output: Val = bevy::math::BVec2::from_array(a) .into(); output }, @@ -13537,7 +13237,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec2::bitmask(_self.into_inner()) + let output: u32 = bevy::math::BVec2::bitmask(_self.into_inner()) .into(); output }, @@ -13545,30 +13245,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec2::any(_self.into_inner()) - .into(); + let output: bool = bevy::math::BVec2::any(_self.into_inner()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec2::all(_self.into_inner()) - .into(); + let output: bool = bevy::math::BVec2::all(_self.into_inner()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec2::test(&_self, index).into(); + let output: bool = bevy::math::BVec2::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |mut _self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec2::set(&mut _self, index, value) + let output: () = bevy::math::BVec2::set(&mut _self, index, value) .into(); output }, @@ -13576,7 +13274,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::BVec2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -13587,11 +13285,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { - let output: Val = ::bevy::math::BVec3::new( - x, - y, - z, - ) + let output: Val = bevy::math::BVec3::new(x, y, z) .into(); output }, @@ -13599,7 +13293,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec3::splat(v) + let output: Val = bevy::math::BVec3::splat(v) .into(); output }, @@ -13607,9 +13301,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 3]| { - let output: Val = ::bevy::math::BVec3::from_array( - a, - ) + let output: Val = bevy::math::BVec3::from_array(a) .into(); output }, @@ -13617,7 +13309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec3::bitmask(_self.into_inner()) + let output: u32 = bevy::math::BVec3::bitmask(_self.into_inner()) .into(); output }, @@ -13625,30 +13317,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec3::any(_self.into_inner()) - .into(); + let output: bool = bevy::math::BVec3::any(_self.into_inner()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec3::all(_self.into_inner()) - .into(); + let output: bool = bevy::math::BVec3::all(_self.into_inner()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec3::test(&_self, index).into(); + let output: bool = bevy::math::BVec3::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |mut _self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3::set(&mut _self, index, value) + let output: () = bevy::math::BVec3::set(&mut _self, index, value) .into(); output }, @@ -13656,14 +13346,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::BVec3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -13673,7 +13366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::BVec3::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -13684,7 +13377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { - let output: Val = ::bevy::math::BVec4::new( + let output: Val = bevy::math::BVec4::new( x, y, z, @@ -13697,7 +13390,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec4::splat(v) + let output: Val = bevy::math::BVec4::splat(v) .into(); output }, @@ -13705,9 +13398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 4]| { - let output: Val = ::bevy::math::BVec4::from_array( - a, - ) + let output: Val = bevy::math::BVec4::from_array(a) .into(); output }, @@ -13715,7 +13406,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec4::bitmask(_self.into_inner()) + let output: u32 = bevy::math::BVec4::bitmask(_self.into_inner()) .into(); output }, @@ -13723,30 +13414,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec4::any(_self.into_inner()) - .into(); + let output: bool = bevy::math::BVec4::any(_self.into_inner()).into(); output }, ) .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec4::all(_self.into_inner()) - .into(); + let output: bool = bevy::math::BVec4::all(_self.into_inner()).into(); output }, ) .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec4::test(&_self, index).into(); + let output: bool = bevy::math::BVec4::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |mut _self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4::set(&mut _self, index, value) + let output: () = bevy::math::BVec4::set(&mut _self, index, value) .into(); output }, @@ -13754,7 +13443,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::BVec4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -13764,14 +13453,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::BVec4::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::BVec4::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -13782,7 +13474,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DVec2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -13792,10 +13484,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -13803,10 +13494,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -13814,10 +13504,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -13825,10 +13514,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -13836,10 +13524,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -13847,10 +13534,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -13858,7 +13544,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64| { - let output: Val = ::bevy::math::DVec2::new(x, y) + let output: Val = bevy::math::DVec2::new(x, y) .into(); output }, @@ -13866,7 +13552,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = ::bevy::math::DVec2::splat(v) + let output: Val = bevy::math::DVec2::splat(v) .into(); output }, @@ -13878,7 +13564,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::DVec2::select( + let output: Val = bevy::math::DVec2::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -13890,9 +13576,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 2]| { - let output: Val = ::bevy::math::DVec2::from_array( - a, - ) + let output: Val = bevy::math::DVec2::from_array(a) .into(); output }, @@ -13900,14 +13584,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 2] = ::bevy::math::DVec2::to_array(&_self).into(); + let output: [f64; 2] = bevy::math::DVec2::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, z: f64| { - let output: Val = ::bevy::math::DVec2::extend( + let output: Val = bevy::math::DVec2::extend( _self.into_inner(), z, ) @@ -13918,7 +13602,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = ::bevy::math::DVec2::with_x( + let output: Val = bevy::math::DVec2::with_x( _self.into_inner(), x, ) @@ -13929,7 +13613,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = ::bevy::math::DVec2::with_y( + let output: Val = bevy::math::DVec2::with_y( _self.into_inner(), y, ) @@ -13940,7 +13624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::dot( + let output: f64 = bevy::math::DVec2::dot( _self.into_inner(), rhs.into_inner(), ) @@ -13951,7 +13635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::dot_into_vec( + let output: Val = bevy::math::DVec2::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -13962,7 +13646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::min( + let output: Val = bevy::math::DVec2::min( _self.into_inner(), rhs.into_inner(), ) @@ -13973,7 +13657,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::max( + let output: Val = bevy::math::DVec2::max( _self.into_inner(), rhs.into_inner(), ) @@ -13988,7 +13672,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::DVec2::clamp( + let output: Val = bevy::math::DVec2::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -14000,9 +13684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::min_element( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec2::min_element(_self.into_inner()) .into(); output }, @@ -14010,9 +13692,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::max_element( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec2::max_element(_self.into_inner()) .into(); output }, @@ -14020,9 +13700,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::element_sum( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec2::element_sum(_self.into_inner()) .into(); output }, @@ -14030,7 +13708,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::element_product( + let output: f64 = bevy::math::DVec2::element_product( _self.into_inner(), ) .into(); @@ -14040,7 +13718,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpeq( + let output: Val = bevy::math::DVec2::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -14051,7 +13729,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpne( + let output: Val = bevy::math::DVec2::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -14062,7 +13740,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpge( + let output: Val = bevy::math::DVec2::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -14073,7 +13751,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmpgt( + let output: Val = bevy::math::DVec2::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -14084,7 +13762,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmple( + let output: Val = bevy::math::DVec2::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -14095,7 +13773,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::cmplt( + let output: Val = bevy::math::DVec2::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -14106,7 +13784,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::DVec2::abs( + let output: Val = bevy::math::DVec2::abs( _self.into_inner(), ) .into(); @@ -14116,7 +13794,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::DVec2::signum( + let output: Val = bevy::math::DVec2::signum( _self.into_inner(), ) .into(); @@ -14126,7 +13804,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::copysign( + let output: Val = bevy::math::DVec2::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -14137,7 +13815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::DVec2::is_negative_bitmask( + let output: u32 = bevy::math::DVec2::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -14147,7 +13825,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_finite(_self.into_inner()) + let output: bool = bevy::math::DVec2::is_finite(_self.into_inner()) .into(); output }, @@ -14155,7 +13833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::DVec2::is_finite_mask( + let output: Val = bevy::math::DVec2::is_finite_mask( _self.into_inner(), ) .into(); @@ -14165,7 +13843,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_nan(_self.into_inner()) + let output: bool = bevy::math::DVec2::is_nan(_self.into_inner()) .into(); output }, @@ -14173,7 +13851,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::DVec2::is_nan_mask( + let output: Val = bevy::math::DVec2::is_nan_mask( _self.into_inner(), ) .into(); @@ -14183,7 +13861,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length(_self.into_inner()) + let output: f64 = bevy::math::DVec2::length(_self.into_inner()) .into(); output }, @@ -14191,7 +13869,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length_squared( + let output: f64 = bevy::math::DVec2::length_squared( _self.into_inner(), ) .into(); @@ -14201,9 +13879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::length_recip( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec2::length_recip(_self.into_inner()) .into(); output }, @@ -14211,7 +13887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::distance( + let output: f64 = bevy::math::DVec2::distance( _self.into_inner(), rhs.into_inner(), ) @@ -14222,7 +13898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::distance_squared( + let output: f64 = bevy::math::DVec2::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -14233,7 +13909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::div_euclid( + let output: Val = bevy::math::DVec2::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -14244,7 +13920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rem_euclid( + let output: Val = bevy::math::DVec2::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -14255,7 +13931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::DVec2::normalize( + let output: Val = bevy::math::DVec2::normalize( _self.into_inner(), ) .into(); @@ -14265,7 +13941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::DVec2::normalize_or( + let output: Val = bevy::math::DVec2::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -14276,7 +13952,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::DVec2::normalize_or_zero( + let output: Val = bevy::math::DVec2::normalize_or_zero( _self.into_inner(), ) .into(); @@ -14286,7 +13962,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DVec2::is_normalized( + let output: bool = bevy::math::DVec2::is_normalized( _self.into_inner(), ) .into(); @@ -14296,7 +13972,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::project_onto( + let output: Val = bevy::math::DVec2::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -14307,7 +13983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::reject_from( + let output: Val = bevy::math::DVec2::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -14318,7 +13994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::project_onto_normalized( + let output: Val = bevy::math::DVec2::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -14329,7 +14005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::reject_from_normalized( + let output: Val = bevy::math::DVec2::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -14340,7 +14016,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::DVec2::round( + let output: Val = bevy::math::DVec2::round( _self.into_inner(), ) .into(); @@ -14350,7 +14026,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::DVec2::floor( + let output: Val = bevy::math::DVec2::floor( _self.into_inner(), ) .into(); @@ -14360,7 +14036,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::DVec2::ceil( + let output: Val = bevy::math::DVec2::ceil( _self.into_inner(), ) .into(); @@ -14370,7 +14046,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::DVec2::trunc( + let output: Val = bevy::math::DVec2::trunc( _self.into_inner(), ) .into(); @@ -14380,7 +14056,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::DVec2::fract( + let output: Val = bevy::math::DVec2::fract( _self.into_inner(), ) .into(); @@ -14390,7 +14066,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::DVec2::fract_gl( + let output: Val = bevy::math::DVec2::fract_gl( _self.into_inner(), ) .into(); @@ -14400,7 +14076,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::DVec2::exp( + let output: Val = bevy::math::DVec2::exp( _self.into_inner(), ) .into(); @@ -14410,7 +14086,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = ::bevy::math::DVec2::powf( + let output: Val = bevy::math::DVec2::powf( _self.into_inner(), n, ) @@ -14421,7 +14097,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::DVec2::recip( + let output: Val = bevy::math::DVec2::recip( _self.into_inner(), ) .into(); @@ -14431,7 +14107,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = ::bevy::math::DVec2::lerp( + let output: Val = bevy::math::DVec2::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -14443,7 +14119,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = ::bevy::math::DVec2::move_towards( + let output: Val = bevy::math::DVec2::move_towards( &_self, rhs.into_inner(), d, @@ -14455,7 +14131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::midpoint( + let output: Val = bevy::math::DVec2::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -14470,7 +14146,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DVec2::abs_diff_eq( + let output: bool = bevy::math::DVec2::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -14482,7 +14158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = ::bevy::math::DVec2::clamp_length( + let output: Val = bevy::math::DVec2::clamp_length( _self.into_inner(), min, max, @@ -14494,7 +14170,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = ::bevy::math::DVec2::clamp_length_max( + let output: Val = bevy::math::DVec2::clamp_length_max( _self.into_inner(), max, ) @@ -14505,7 +14181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = ::bevy::math::DVec2::clamp_length_min( + let output: Val = bevy::math::DVec2::clamp_length_min( _self.into_inner(), min, ) @@ -14520,7 +14196,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::DVec2::mul_add( + let output: Val = bevy::math::DVec2::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -14532,7 +14208,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::DVec2::reflect( + let output: Val = bevy::math::DVec2::reflect( _self.into_inner(), normal.into_inner(), ) @@ -14547,7 +14223,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = ::bevy::math::DVec2::refract( + let output: Val = bevy::math::DVec2::refract( _self.into_inner(), normal.into_inner(), eta, @@ -14559,7 +14235,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = ::bevy::math::DVec2::from_angle( + let output: Val = bevy::math::DVec2::from_angle( angle, ) .into(); @@ -14569,7 +14245,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_angle", |_self: Val| { - let output: f64 = ::bevy::math::DVec2::to_angle(_self.into_inner()) + let output: f64 = bevy::math::DVec2::to_angle(_self.into_inner()) .into(); output }, @@ -14577,7 +14253,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::angle_between( + let output: f64 = bevy::math::DVec2::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -14588,7 +14264,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_to", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::angle_to( + let output: f64 = bevy::math::DVec2::angle_to( _self.into_inner(), rhs.into_inner(), ) @@ -14599,7 +14275,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp", |_self: Val| { - let output: Val = ::bevy::math::DVec2::perp( + let output: Val = bevy::math::DVec2::perp( _self.into_inner(), ) .into(); @@ -14609,7 +14285,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perp_dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec2::perp_dot( + let output: f64 = bevy::math::DVec2::perp_dot( _self.into_inner(), rhs.into_inner(), ) @@ -14620,7 +14296,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rotate", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rotate( + let output: Val = bevy::math::DVec2::rotate( _self.into_inner(), rhs.into_inner(), ) @@ -14635,7 +14311,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f64| { - let output: Val = ::bevy::math::DVec2::rotate_towards( + let output: Val = bevy::math::DVec2::rotate_towards( &_self, rhs.into_inner(), max_angle, @@ -14647,7 +14323,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec2", |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_vec2( + let output: Val = bevy::math::DVec2::as_vec2( &_self, ) .into(); @@ -14657,7 +14333,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec2", |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_ivec2( + let output: Val = bevy::math::DVec2::as_ivec2( &_self, ) .into(); @@ -14667,7 +14343,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec2", |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_uvec2( + let output: Val = bevy::math::DVec2::as_uvec2( &_self, ) .into(); @@ -14677,7 +14353,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec2", |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_i64vec2( + let output: Val = bevy::math::DVec2::as_i64vec2( &_self, ) .into(); @@ -14687,7 +14363,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec2", |_self: Ref| { - let output: Val = ::bevy::math::DVec2::as_u64vec2( + let output: Val = bevy::math::DVec2::as_u64vec2( &_self, ) .into(); @@ -14697,10 +14373,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -14708,10 +14383,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -14719,17 +14393,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec2::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -14737,10 +14413,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -14748,7 +14423,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DVec2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -14758,10 +14433,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -14769,10 +14443,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -14780,10 +14453,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -14791,10 +14463,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -14802,10 +14473,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec2::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -14814,10 +14484,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -14825,7 +14494,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DVec3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -14835,10 +14504,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -14846,10 +14514,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -14857,10 +14524,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -14868,11 +14534,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64, z: f64| { - let output: Val = ::bevy::math::DVec3::new( - x, - y, - z, - ) + let output: Val = bevy::math::DVec3::new(x, y, z) .into(); output }, @@ -14880,7 +14542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = ::bevy::math::DVec3::splat(v) + let output: Val = bevy::math::DVec3::splat(v) .into(); output }, @@ -14892,7 +14554,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::DVec3::select( + let output: Val = bevy::math::DVec3::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -14904,9 +14566,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 3]| { - let output: Val = ::bevy::math::DVec3::from_array( - a, - ) + let output: Val = bevy::math::DVec3::from_array(a) .into(); output }, @@ -14914,14 +14574,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 3] = ::bevy::math::DVec3::to_array(&_self).into(); + let output: [f64; 3] = bevy::math::DVec3::to_array(&_self).into(); output }, ) .overwrite_script_function( "extend", |_self: Val, w: f64| { - let output: Val = ::bevy::math::DVec3::extend( + let output: Val = bevy::math::DVec3::extend( _self.into_inner(), w, ) @@ -14932,7 +14592,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::DVec3::truncate( + let output: Val = bevy::math::DVec3::truncate( _self.into_inner(), ) .into(); @@ -14942,7 +14602,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = ::bevy::math::DVec3::with_x( + let output: Val = bevy::math::DVec3::with_x( _self.into_inner(), x, ) @@ -14953,7 +14613,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = ::bevy::math::DVec3::with_y( + let output: Val = bevy::math::DVec3::with_y( _self.into_inner(), y, ) @@ -14964,7 +14624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f64| { - let output: Val = ::bevy::math::DVec3::with_z( + let output: Val = bevy::math::DVec3::with_z( _self.into_inner(), z, ) @@ -14975,7 +14635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::dot( + let output: f64 = bevy::math::DVec3::dot( _self.into_inner(), rhs.into_inner(), ) @@ -14986,7 +14646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::dot_into_vec( + let output: Val = bevy::math::DVec3::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -14997,7 +14657,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cross", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cross( + let output: Val = bevy::math::DVec3::cross( _self.into_inner(), rhs.into_inner(), ) @@ -15008,7 +14668,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::min( + let output: Val = bevy::math::DVec3::min( _self.into_inner(), rhs.into_inner(), ) @@ -15019,7 +14679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::max( + let output: Val = bevy::math::DVec3::max( _self.into_inner(), rhs.into_inner(), ) @@ -15034,7 +14694,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::DVec3::clamp( + let output: Val = bevy::math::DVec3::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -15046,9 +14706,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::min_element( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec3::min_element(_self.into_inner()) .into(); output }, @@ -15056,9 +14714,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::max_element( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec3::max_element(_self.into_inner()) .into(); output }, @@ -15066,9 +14722,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::element_sum( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec3::element_sum(_self.into_inner()) .into(); output }, @@ -15076,7 +14730,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::element_product( + let output: f64 = bevy::math::DVec3::element_product( _self.into_inner(), ) .into(); @@ -15086,7 +14740,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpeq( + let output: Val = bevy::math::DVec3::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -15097,7 +14751,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpne( + let output: Val = bevy::math::DVec3::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -15108,7 +14762,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpge( + let output: Val = bevy::math::DVec3::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -15119,7 +14773,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmpgt( + let output: Val = bevy::math::DVec3::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -15130,7 +14784,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmple( + let output: Val = bevy::math::DVec3::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -15141,7 +14795,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::cmplt( + let output: Val = bevy::math::DVec3::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -15152,7 +14806,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::DVec3::abs( + let output: Val = bevy::math::DVec3::abs( _self.into_inner(), ) .into(); @@ -15162,7 +14816,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::DVec3::signum( + let output: Val = bevy::math::DVec3::signum( _self.into_inner(), ) .into(); @@ -15172,7 +14826,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::copysign( + let output: Val = bevy::math::DVec3::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -15183,7 +14837,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::DVec3::is_negative_bitmask( + let output: u32 = bevy::math::DVec3::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -15193,7 +14847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_finite(_self.into_inner()) + let output: bool = bevy::math::DVec3::is_finite(_self.into_inner()) .into(); output }, @@ -15201,7 +14855,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::DVec3::is_finite_mask( + let output: Val = bevy::math::DVec3::is_finite_mask( _self.into_inner(), ) .into(); @@ -15211,7 +14865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_nan(_self.into_inner()) + let output: bool = bevy::math::DVec3::is_nan(_self.into_inner()) .into(); output }, @@ -15219,7 +14873,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::DVec3::is_nan_mask( + let output: Val = bevy::math::DVec3::is_nan_mask( _self.into_inner(), ) .into(); @@ -15229,7 +14883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length(_self.into_inner()) + let output: f64 = bevy::math::DVec3::length(_self.into_inner()) .into(); output }, @@ -15237,7 +14891,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length_squared( + let output: f64 = bevy::math::DVec3::length_squared( _self.into_inner(), ) .into(); @@ -15247,9 +14901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DVec3::length_recip( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec3::length_recip(_self.into_inner()) .into(); output }, @@ -15257,7 +14909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::distance( + let output: f64 = bevy::math::DVec3::distance( _self.into_inner(), rhs.into_inner(), ) @@ -15268,7 +14920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::distance_squared( + let output: f64 = bevy::math::DVec3::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -15279,7 +14931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::div_euclid( + let output: Val = bevy::math::DVec3::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -15290,7 +14942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::rem_euclid( + let output: Val = bevy::math::DVec3::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -15301,7 +14953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::DVec3::normalize( + let output: Val = bevy::math::DVec3::normalize( _self.into_inner(), ) .into(); @@ -15311,7 +14963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::DVec3::normalize_or( + let output: Val = bevy::math::DVec3::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -15322,7 +14974,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::DVec3::normalize_or_zero( + let output: Val = bevy::math::DVec3::normalize_or_zero( _self.into_inner(), ) .into(); @@ -15332,7 +14984,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DVec3::is_normalized( + let output: bool = bevy::math::DVec3::is_normalized( _self.into_inner(), ) .into(); @@ -15342,7 +14994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::project_onto( + let output: Val = bevy::math::DVec3::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -15353,7 +15005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::reject_from( + let output: Val = bevy::math::DVec3::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -15364,7 +15016,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::project_onto_normalized( + let output: Val = bevy::math::DVec3::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -15375,7 +15027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::reject_from_normalized( + let output: Val = bevy::math::DVec3::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -15386,7 +15038,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::DVec3::round( + let output: Val = bevy::math::DVec3::round( _self.into_inner(), ) .into(); @@ -15396,7 +15048,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::DVec3::floor( + let output: Val = bevy::math::DVec3::floor( _self.into_inner(), ) .into(); @@ -15406,7 +15058,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::DVec3::ceil( + let output: Val = bevy::math::DVec3::ceil( _self.into_inner(), ) .into(); @@ -15416,7 +15068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::DVec3::trunc( + let output: Val = bevy::math::DVec3::trunc( _self.into_inner(), ) .into(); @@ -15426,7 +15078,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::DVec3::fract( + let output: Val = bevy::math::DVec3::fract( _self.into_inner(), ) .into(); @@ -15436,7 +15088,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::DVec3::fract_gl( + let output: Val = bevy::math::DVec3::fract_gl( _self.into_inner(), ) .into(); @@ -15446,7 +15098,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::DVec3::exp( + let output: Val = bevy::math::DVec3::exp( _self.into_inner(), ) .into(); @@ -15456,7 +15108,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = ::bevy::math::DVec3::powf( + let output: Val = bevy::math::DVec3::powf( _self.into_inner(), n, ) @@ -15467,7 +15119,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::DVec3::recip( + let output: Val = bevy::math::DVec3::recip( _self.into_inner(), ) .into(); @@ -15477,7 +15129,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = ::bevy::math::DVec3::lerp( + let output: Val = bevy::math::DVec3::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -15489,7 +15141,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = ::bevy::math::DVec3::move_towards( + let output: Val = bevy::math::DVec3::move_towards( &_self, rhs.into_inner(), d, @@ -15501,7 +15153,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::midpoint( + let output: Val = bevy::math::DVec3::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -15516,7 +15168,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DVec3::abs_diff_eq( + let output: bool = bevy::math::DVec3::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -15528,7 +15180,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = ::bevy::math::DVec3::clamp_length( + let output: Val = bevy::math::DVec3::clamp_length( _self.into_inner(), min, max, @@ -15540,7 +15192,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = ::bevy::math::DVec3::clamp_length_max( + let output: Val = bevy::math::DVec3::clamp_length_max( _self.into_inner(), max, ) @@ -15551,7 +15203,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = ::bevy::math::DVec3::clamp_length_min( + let output: Val = bevy::math::DVec3::clamp_length_min( _self.into_inner(), min, ) @@ -15566,7 +15218,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::DVec3::mul_add( + let output: Val = bevy::math::DVec3::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -15578,7 +15230,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::DVec3::reflect( + let output: Val = bevy::math::DVec3::reflect( _self.into_inner(), normal.into_inner(), ) @@ -15593,7 +15245,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = ::bevy::math::DVec3::refract( + let output: Val = bevy::math::DVec3::refract( _self.into_inner(), normal.into_inner(), eta, @@ -15605,7 +15257,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec3::angle_between( + let output: f64 = bevy::math::DVec3::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -15616,7 +15268,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthogonal_vector", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::any_orthogonal_vector( + let output: Val = bevy::math::DVec3::any_orthogonal_vector( &_self, ) .into(); @@ -15626,7 +15278,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any_orthonormal_vector", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::any_orthonormal_vector( + let output: Val = bevy::math::DVec3::any_orthonormal_vector( &_self, ) .into(); @@ -15636,7 +15288,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_vec3( + let output: Val = bevy::math::DVec3::as_vec3( &_self, ) .into(); @@ -15646,7 +15298,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec3a", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_vec3a( + let output: Val = bevy::math::DVec3::as_vec3a( &_self, ) .into(); @@ -15656,7 +15308,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec3", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_ivec3( + let output: Val = bevy::math::DVec3::as_ivec3( &_self, ) .into(); @@ -15666,7 +15318,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec3", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_uvec3( + let output: Val = bevy::math::DVec3::as_uvec3( &_self, ) .into(); @@ -15676,7 +15328,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec3", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_i64vec3( + let output: Val = bevy::math::DVec3::as_i64vec3( &_self, ) .into(); @@ -15686,7 +15338,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec3", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::as_u64vec3( + let output: Val = bevy::math::DVec3::as_u64vec3( &_self, ) .into(); @@ -15696,10 +15348,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -15707,10 +15358,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -15718,10 +15368,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15729,17 +15378,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec3::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -15747,10 +15398,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15758,10 +15408,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -15769,10 +15418,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, @@ -15780,10 +15428,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec3::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -15791,10 +15438,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -15802,10 +15448,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15813,10 +15458,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15824,7 +15468,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DVec3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -15835,17 +15479,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::DVec4::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into_inner(), - &rhs, - ) + let output: Val = >::mul(_self.into_inner(), &rhs) .into(); output }, @@ -15853,10 +15499,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15864,10 +15509,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into_inner(), - rhs, - ) + let output: Val = >::sub(_self.into_inner(), rhs) .into(); output }, @@ -15875,10 +15519,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -15886,10 +15529,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::div( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::div(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15897,10 +15539,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into_inner(), - &rhs, - ) + let output: Val = >::rem(_self.into_inner(), &rhs) .into(); output }, @@ -15908,10 +15549,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -15919,10 +15559,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into_inner(), - rhs, - ) + let output: Val = >::rem(_self.into_inner(), rhs) .into(); output }, @@ -15930,21 +15569,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::add( - _self.into_inner(), - &rhs, - ) + let output: Val = >::add(_self.into_inner(), &rhs) .into(); output }, ) .overwrite_script_function( "sub", - |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + |_self: Val, rhs: Val| { + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15952,7 +15589,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DVec4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -15962,10 +15599,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::div( - _self.into_inner(), - &rhs, - ) + let output: Val = >::div(_self.into_inner(), &rhs) .into(); output }, @@ -15973,10 +15609,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::rem( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::rem(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -15984,10 +15619,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Ref| { - let output: Val = ::bevy::math::DVec4::sub( - _self.into_inner(), - &rhs, - ) + let output: Val = >::sub(_self.into_inner(), &rhs) .into(); output }, @@ -15995,10 +15629,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -16006,7 +15639,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DVec4::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -16016,7 +15649,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: f64, y: f64, z: f64, w: f64| { - let output: Val = ::bevy::math::DVec4::new( + let output: Val = bevy::math::DVec4::new( x, y, z, @@ -16029,7 +15662,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: f64| { - let output: Val = ::bevy::math::DVec4::splat(v) + let output: Val = bevy::math::DVec4::splat(v) .into(); output }, @@ -16041,7 +15674,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { if_true: Val, if_false: Val| { - let output: Val = ::bevy::math::DVec4::select( + let output: Val = bevy::math::DVec4::select( mask.into_inner(), if_true.into_inner(), if_false.into_inner(), @@ -16053,9 +15686,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 4]| { - let output: Val = ::bevy::math::DVec4::from_array( - a, - ) + let output: Val = bevy::math::DVec4::from_array(a) .into(); output }, @@ -16063,14 +15694,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DVec4::to_array(&_self).into(); + let output: [f64; 4] = bevy::math::DVec4::to_array(&_self).into(); output }, ) .overwrite_script_function( "truncate", |_self: Val| { - let output: Val = ::bevy::math::DVec4::truncate( + let output: Val = bevy::math::DVec4::truncate( _self.into_inner(), ) .into(); @@ -16080,7 +15711,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_x", |_self: Val, x: f64| { - let output: Val = ::bevy::math::DVec4::with_x( + let output: Val = bevy::math::DVec4::with_x( _self.into_inner(), x, ) @@ -16091,7 +15722,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_y", |_self: Val, y: f64| { - let output: Val = ::bevy::math::DVec4::with_y( + let output: Val = bevy::math::DVec4::with_y( _self.into_inner(), y, ) @@ -16102,7 +15733,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_z", |_self: Val, z: f64| { - let output: Val = ::bevy::math::DVec4::with_z( + let output: Val = bevy::math::DVec4::with_z( _self.into_inner(), z, ) @@ -16113,7 +15744,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "with_w", |_self: Val, w: f64| { - let output: Val = ::bevy::math::DVec4::with_w( + let output: Val = bevy::math::DVec4::with_w( _self.into_inner(), w, ) @@ -16124,7 +15755,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::dot( + let output: f64 = bevy::math::DVec4::dot( _self.into_inner(), rhs.into_inner(), ) @@ -16135,7 +15766,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot_into_vec", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::dot_into_vec( + let output: Val = bevy::math::DVec4::dot_into_vec( _self.into_inner(), rhs.into_inner(), ) @@ -16146,7 +15777,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::min( + let output: Val = bevy::math::DVec4::min( _self.into_inner(), rhs.into_inner(), ) @@ -16157,7 +15788,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::max( + let output: Val = bevy::math::DVec4::max( _self.into_inner(), rhs.into_inner(), ) @@ -16172,7 +15803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { min: Val, max: Val| { - let output: Val = ::bevy::math::DVec4::clamp( + let output: Val = bevy::math::DVec4::clamp( _self.into_inner(), min.into_inner(), max.into_inner(), @@ -16184,9 +15815,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "min_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::min_element( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec4::min_element(_self.into_inner()) .into(); output }, @@ -16194,9 +15823,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "max_element", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::max_element( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec4::max_element(_self.into_inner()) .into(); output }, @@ -16204,9 +15831,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_sum", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::element_sum( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec4::element_sum(_self.into_inner()) .into(); output }, @@ -16214,7 +15839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "element_product", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::element_product( + let output: f64 = bevy::math::DVec4::element_product( _self.into_inner(), ) .into(); @@ -16224,7 +15849,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpeq", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpeq( + let output: Val = bevy::math::DVec4::cmpeq( _self.into_inner(), rhs.into_inner(), ) @@ -16235,7 +15860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpne", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpne( + let output: Val = bevy::math::DVec4::cmpne( _self.into_inner(), rhs.into_inner(), ) @@ -16246,7 +15871,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpge", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpge( + let output: Val = bevy::math::DVec4::cmpge( _self.into_inner(), rhs.into_inner(), ) @@ -16257,7 +15882,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmpgt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmpgt( + let output: Val = bevy::math::DVec4::cmpgt( _self.into_inner(), rhs.into_inner(), ) @@ -16268,7 +15893,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmple", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmple( + let output: Val = bevy::math::DVec4::cmple( _self.into_inner(), rhs.into_inner(), ) @@ -16279,7 +15904,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "cmplt", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::cmplt( + let output: Val = bevy::math::DVec4::cmplt( _self.into_inner(), rhs.into_inner(), ) @@ -16290,7 +15915,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Val| { - let output: Val = ::bevy::math::DVec4::abs( + let output: Val = bevy::math::DVec4::abs( _self.into_inner(), ) .into(); @@ -16300,7 +15925,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "signum", |_self: Val| { - let output: Val = ::bevy::math::DVec4::signum( + let output: Val = bevy::math::DVec4::signum( _self.into_inner(), ) .into(); @@ -16310,7 +15935,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "copysign", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::copysign( + let output: Val = bevy::math::DVec4::copysign( _self.into_inner(), rhs.into_inner(), ) @@ -16321,7 +15946,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_negative_bitmask", |_self: Val| { - let output: u32 = ::bevy::math::DVec4::is_negative_bitmask( + let output: u32 = bevy::math::DVec4::is_negative_bitmask( _self.into_inner(), ) .into(); @@ -16331,7 +15956,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_finite(_self.into_inner()) + let output: bool = bevy::math::DVec4::is_finite(_self.into_inner()) .into(); output }, @@ -16339,7 +15964,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite_mask", |_self: Val| { - let output: Val = ::bevy::math::DVec4::is_finite_mask( + let output: Val = bevy::math::DVec4::is_finite_mask( _self.into_inner(), ) .into(); @@ -16349,7 +15974,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_nan(_self.into_inner()) + let output: bool = bevy::math::DVec4::is_nan(_self.into_inner()) .into(); output }, @@ -16357,7 +15982,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan_mask", |_self: Val| { - let output: Val = ::bevy::math::DVec4::is_nan_mask( + let output: Val = bevy::math::DVec4::is_nan_mask( _self.into_inner(), ) .into(); @@ -16367,7 +15992,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length(_self.into_inner()) + let output: f64 = bevy::math::DVec4::length(_self.into_inner()) .into(); output }, @@ -16375,7 +16000,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length_squared( + let output: f64 = bevy::math::DVec4::length_squared( _self.into_inner(), ) .into(); @@ -16385,9 +16010,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DVec4::length_recip( - _self.into_inner(), - ) + let output: f64 = bevy::math::DVec4::length_recip(_self.into_inner()) .into(); output }, @@ -16395,7 +16018,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::distance( + let output: f64 = bevy::math::DVec4::distance( _self.into_inner(), rhs.into_inner(), ) @@ -16406,7 +16029,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "distance_squared", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DVec4::distance_squared( + let output: f64 = bevy::math::DVec4::distance_squared( _self.into_inner(), rhs.into_inner(), ) @@ -16417,7 +16040,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::div_euclid( + let output: Val = bevy::math::DVec4::div_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -16428,7 +16051,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "rem_euclid", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::rem_euclid( + let output: Val = bevy::math::DVec4::rem_euclid( _self.into_inner(), rhs.into_inner(), ) @@ -16439,7 +16062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::DVec4::normalize( + let output: Val = bevy::math::DVec4::normalize( _self.into_inner(), ) .into(); @@ -16449,7 +16072,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or", |_self: Val, fallback: Val| { - let output: Val = ::bevy::math::DVec4::normalize_or( + let output: Val = bevy::math::DVec4::normalize_or( _self.into_inner(), fallback.into_inner(), ) @@ -16460,7 +16083,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize_or_zero", |_self: Val| { - let output: Val = ::bevy::math::DVec4::normalize_or_zero( + let output: Val = bevy::math::DVec4::normalize_or_zero( _self.into_inner(), ) .into(); @@ -16470,7 +16093,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DVec4::is_normalized( + let output: bool = bevy::math::DVec4::is_normalized( _self.into_inner(), ) .into(); @@ -16480,7 +16103,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::project_onto( + let output: Val = bevy::math::DVec4::project_onto( _self.into_inner(), rhs.into_inner(), ) @@ -16491,7 +16114,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::reject_from( + let output: Val = bevy::math::DVec4::reject_from( _self.into_inner(), rhs.into_inner(), ) @@ -16502,7 +16125,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_onto_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::project_onto_normalized( + let output: Val = bevy::math::DVec4::project_onto_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -16513,7 +16136,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reject_from_normalized", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::reject_from_normalized( + let output: Val = bevy::math::DVec4::reject_from_normalized( _self.into_inner(), rhs.into_inner(), ) @@ -16524,7 +16147,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "round", |_self: Val| { - let output: Val = ::bevy::math::DVec4::round( + let output: Val = bevy::math::DVec4::round( _self.into_inner(), ) .into(); @@ -16534,7 +16157,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "floor", |_self: Val| { - let output: Val = ::bevy::math::DVec4::floor( + let output: Val = bevy::math::DVec4::floor( _self.into_inner(), ) .into(); @@ -16544,7 +16167,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "ceil", |_self: Val| { - let output: Val = ::bevy::math::DVec4::ceil( + let output: Val = bevy::math::DVec4::ceil( _self.into_inner(), ) .into(); @@ -16554,7 +16177,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "trunc", |_self: Val| { - let output: Val = ::bevy::math::DVec4::trunc( + let output: Val = bevy::math::DVec4::trunc( _self.into_inner(), ) .into(); @@ -16564,7 +16187,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract", |_self: Val| { - let output: Val = ::bevy::math::DVec4::fract( + let output: Val = bevy::math::DVec4::fract( _self.into_inner(), ) .into(); @@ -16574,7 +16197,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "fract_gl", |_self: Val| { - let output: Val = ::bevy::math::DVec4::fract_gl( + let output: Val = bevy::math::DVec4::fract_gl( _self.into_inner(), ) .into(); @@ -16584,7 +16207,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "exp", |_self: Val| { - let output: Val = ::bevy::math::DVec4::exp( + let output: Val = bevy::math::DVec4::exp( _self.into_inner(), ) .into(); @@ -16594,7 +16217,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "powf", |_self: Val, n: f64| { - let output: Val = ::bevy::math::DVec4::powf( + let output: Val = bevy::math::DVec4::powf( _self.into_inner(), n, ) @@ -16605,7 +16228,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "recip", |_self: Val| { - let output: Val = ::bevy::math::DVec4::recip( + let output: Val = bevy::math::DVec4::recip( _self.into_inner(), ) .into(); @@ -16615,7 +16238,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, rhs: Val, s: f64| { - let output: Val = ::bevy::math::DVec4::lerp( + let output: Val = bevy::math::DVec4::lerp( _self.into_inner(), rhs.into_inner(), s, @@ -16627,7 +16250,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "move_towards", |_self: Ref, rhs: Val, d: f64| { - let output: Val = ::bevy::math::DVec4::move_towards( + let output: Val = bevy::math::DVec4::move_towards( &_self, rhs.into_inner(), d, @@ -16639,7 +16262,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "midpoint", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DVec4::midpoint( + let output: Val = bevy::math::DVec4::midpoint( _self.into_inner(), rhs.into_inner(), ) @@ -16654,7 +16277,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DVec4::abs_diff_eq( + let output: bool = bevy::math::DVec4::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -16666,7 +16289,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length", |_self: Val, min: f64, max: f64| { - let output: Val = ::bevy::math::DVec4::clamp_length( + let output: Val = bevy::math::DVec4::clamp_length( _self.into_inner(), min, max, @@ -16678,7 +16301,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_max", |_self: Val, max: f64| { - let output: Val = ::bevy::math::DVec4::clamp_length_max( + let output: Val = bevy::math::DVec4::clamp_length_max( _self.into_inner(), max, ) @@ -16689,7 +16312,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clamp_length_min", |_self: Val, min: f64| { - let output: Val = ::bevy::math::DVec4::clamp_length_min( + let output: Val = bevy::math::DVec4::clamp_length_min( _self.into_inner(), min, ) @@ -16704,7 +16327,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { a: Val, b: Val| { - let output: Val = ::bevy::math::DVec4::mul_add( + let output: Val = bevy::math::DVec4::mul_add( _self.into_inner(), a.into_inner(), b.into_inner(), @@ -16716,7 +16339,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "reflect", |_self: Val, normal: Val| { - let output: Val = ::bevy::math::DVec4::reflect( + let output: Val = bevy::math::DVec4::reflect( _self.into_inner(), normal.into_inner(), ) @@ -16731,7 +16354,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { normal: Val, eta: f64| { - let output: Val = ::bevy::math::DVec4::refract( + let output: Val = bevy::math::DVec4::refract( _self.into_inner(), normal.into_inner(), eta, @@ -16743,7 +16366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_vec4", |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_vec4( + let output: Val = bevy::math::DVec4::as_vec4( &_self, ) .into(); @@ -16753,7 +16376,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_ivec4", |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_ivec4( + let output: Val = bevy::math::DVec4::as_ivec4( &_self, ) .into(); @@ -16763,7 +16386,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_uvec4", |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_uvec4( + let output: Val = bevy::math::DVec4::as_uvec4( &_self, ) .into(); @@ -16773,7 +16396,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_i64vec4", |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_i64vec4( + let output: Val = bevy::math::DVec4::as_i64vec4( &_self, ) .into(); @@ -16783,7 +16406,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_u64vec4", |_self: Ref| { - let output: Val = ::bevy::math::DVec4::as_u64vec4( + let output: Val = bevy::math::DVec4::as_u64vec4( &_self, ) .into(); @@ -16793,10 +16416,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DVec4::add( - _self.into_inner(), - rhs, - ) + let output: Val = >::add(_self.into_inner(), rhs) .into(); output }, @@ -16805,10 +16427,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -16816,10 +16437,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -16827,10 +16447,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -16838,7 +16457,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { - let output: Val = ::bevy::math::Mat2::from_cols( + let output: Val = bevy::math::Mat2::from_cols( x_axis.into_inner(), y_axis.into_inner(), ) @@ -16849,7 +16468,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 4] = ::bevy::math::Mat2::to_cols_array(&_self) + let output: [f32; 4] = bevy::math::Mat2::to_cols_array(&_self) .into(); output }, @@ -16857,7 +16476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 2]; 2] = ::bevy::math::Mat2::to_cols_array_2d( + let output: [[f32; 2]; 2] = bevy::math::Mat2::to_cols_array_2d( &_self, ) .into(); @@ -16867,7 +16486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::Mat2::from_diagonal( + let output: Val = bevy::math::Mat2::from_diagonal( diagonal.into_inner(), ) .into(); @@ -16877,7 +16496,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale_angle", |scale: Val, angle: f32| { - let output: Val = ::bevy::math::Mat2::from_scale_angle( + let output: Val = bevy::math::Mat2::from_scale_angle( scale.into_inner(), angle, ) @@ -16888,7 +16507,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = ::bevy::math::Mat2::from_angle( + let output: Val = bevy::math::Mat2::from_angle( angle, ) .into(); @@ -16898,7 +16517,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = ::bevy::math::Mat2::from_mat3( + let output: Val = bevy::math::Mat2::from_mat3( m.into_inner(), ) .into(); @@ -16908,7 +16527,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_minor", |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat2::from_mat3_minor( + let output: Val = bevy::math::Mat2::from_mat3_minor( m.into_inner(), i, j, @@ -16920,7 +16539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = ::bevy::math::Mat2::from_mat3a( + let output: Val = bevy::math::Mat2::from_mat3a( m.into_inner(), ) .into(); @@ -16930,7 +16549,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a_minor", |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat2::from_mat3a_minor( + let output: Val = bevy::math::Mat2::from_mat3a_minor( m.into_inner(), i, j, @@ -16942,7 +16561,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat2::col( + let output: Val = bevy::math::Mat2::col( &_self, index, ) @@ -16953,7 +16572,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat2::row( + let output: Val = bevy::math::Mat2::row( &_self, index, ) @@ -16964,21 +16583,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat2::is_finite(&_self).into(); + let output: bool = bevy::math::Mat2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat2::is_nan(&_self).into(); + let output: bool = bevy::math::Mat2::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::Mat2::transpose( + let output: Val = bevy::math::Mat2::transpose( &_self, ) .into(); @@ -16988,16 +16607,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat2::determinant(&_self).into(); + let output: f32 = bevy::math::Mat2::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Mat2::inverse( - &_self, - ) + let output: Val = bevy::math::Mat2::inverse(&_self) .into(); output }, @@ -17005,7 +16622,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul_vec2( + let output: Val = bevy::math::Mat2::mul_vec2( &_self, rhs.into_inner(), ) @@ -17016,7 +16633,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat2", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat2::mul_mat2( + let output: Val = bevy::math::Mat2::mul_mat2( &_self, &rhs, ) @@ -17027,7 +16644,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat2", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat2::add_mat2( + let output: Val = bevy::math::Mat2::add_mat2( &_self, &rhs, ) @@ -17038,7 +16655,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat2", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat2::sub_mat2( + let output: Val = bevy::math::Mat2::sub_mat2( &_self, &rhs, ) @@ -17049,7 +16666,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat2::mul_scalar( + let output: Val = bevy::math::Mat2::mul_scalar( &_self, rhs, ) @@ -17060,7 +16677,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat2::div_scalar( + let output: Val = bevy::math::Mat2::div_scalar( &_self, rhs, ) @@ -17075,7 +16692,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Mat2::abs_diff_eq( + let output: bool = bevy::math::Mat2::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -17087,7 +16704,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat2::abs(&_self) + let output: Val = bevy::math::Mat2::abs(&_self) .into(); output }, @@ -17095,7 +16712,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat2", |_self: Ref| { - let output: Val = ::bevy::math::Mat2::as_dmat2( + let output: Val = bevy::math::Mat2::as_dmat2( &_self, ) .into(); @@ -17105,17 +16722,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat2::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17123,7 +16742,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Mat2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -17133,10 +16752,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -17144,10 +16762,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17155,7 +16772,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Mat2::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -17164,10 +16783,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17175,10 +16793,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17186,10 +16803,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17201,7 +16817,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = ::bevy::math::Mat3::from_cols( + let output: Val = bevy::math::Mat3::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -17213,7 +16829,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = ::bevy::math::Mat3::to_cols_array(&_self) + let output: [f32; 9] = bevy::math::Mat3::to_cols_array(&_self) .into(); output }, @@ -17221,7 +16837,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 3] = ::bevy::math::Mat3::to_cols_array_2d( + let output: [[f32; 3]; 3] = bevy::math::Mat3::to_cols_array_2d( &_self, ) .into(); @@ -17231,7 +16847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::Mat3::from_diagonal( + let output: Val = bevy::math::Mat3::from_diagonal( diagonal.into_inner(), ) .into(); @@ -17241,7 +16857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = ::bevy::math::Mat3::from_mat4( + let output: Val = bevy::math::Mat3::from_mat4( m.into_inner(), ) .into(); @@ -17251,7 +16867,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat3::from_mat4_minor( + let output: Val = bevy::math::Mat3::from_mat4_minor( m.into_inner(), i, j, @@ -17263,7 +16879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::Mat3::from_quat( + let output: Val = bevy::math::Mat3::from_quat( rotation.into_inner(), ) .into(); @@ -17273,7 +16889,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Mat3::from_axis_angle( + let output: Val = bevy::math::Mat3::from_axis_angle( axis.into_inner(), angle, ) @@ -17284,7 +16900,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Mat3::from_euler( + let output: Val = bevy::math::Mat3::from_euler( order.into_inner(), a, b, @@ -17297,7 +16913,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Mat3::to_euler( + let output: (f32, f32, f32) = bevy::math::Mat3::to_euler( &_self, order.into_inner(), ) @@ -17308,7 +16924,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_rotation_x( + let output: Val = bevy::math::Mat3::from_rotation_x( angle, ) .into(); @@ -17318,7 +16934,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_rotation_y( + let output: Val = bevy::math::Mat3::from_rotation_y( angle, ) .into(); @@ -17328,7 +16944,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_rotation_z( + let output: Val = bevy::math::Mat3::from_rotation_z( angle, ) .into(); @@ -17338,7 +16954,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::Mat3::from_translation( + let output: Val = bevy::math::Mat3::from_translation( translation.into_inner(), ) .into(); @@ -17348,7 +16964,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = ::bevy::math::Mat3::from_angle( + let output: Val = bevy::math::Mat3::from_angle( angle, ) .into(); @@ -17362,7 +16978,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = ::bevy::math::Mat3::from_scale_angle_translation( + let output: Val = bevy::math::Mat3::from_scale_angle_translation( scale.into_inner(), angle, translation.into_inner(), @@ -17374,7 +16990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::Mat3::from_scale( + let output: Val = bevy::math::Mat3::from_scale( scale.into_inner(), ) .into(); @@ -17384,7 +17000,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = ::bevy::math::Mat3::from_mat2( + let output: Val = bevy::math::Mat3::from_mat2( m.into_inner(), ) .into(); @@ -17394,7 +17010,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3::col( + let output: Val = bevy::math::Mat3::col( &_self, index, ) @@ -17405,7 +17021,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3::row( + let output: Val = bevy::math::Mat3::row( &_self, index, ) @@ -17416,21 +17032,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat3::is_finite(&_self).into(); + let output: bool = bevy::math::Mat3::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat3::is_nan(&_self).into(); + let output: bool = bevy::math::Mat3::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::Mat3::transpose( + let output: Val = bevy::math::Mat3::transpose( &_self, ) .into(); @@ -17440,16 +17056,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat3::determinant(&_self).into(); + let output: f32 = bevy::math::Mat3::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Mat3::inverse( - &_self, - ) + let output: Val = bevy::math::Mat3::inverse(&_self) .into(); output }, @@ -17457,7 +17071,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::transform_point2( + let output: Val = bevy::math::Mat3::transform_point2( &_self, rhs.into_inner(), ) @@ -17468,7 +17082,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::transform_vector2( + let output: Val = bevy::math::Mat3::transform_vector2( &_self, rhs.into_inner(), ) @@ -17479,7 +17093,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul_vec3( + let output: Val = bevy::math::Mat3::mul_vec3( &_self, rhs.into_inner(), ) @@ -17490,7 +17104,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul_vec3a( + let output: Val = bevy::math::Mat3::mul_vec3a( &_self, rhs.into_inner(), ) @@ -17501,7 +17115,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3::mul_mat3( + let output: Val = bevy::math::Mat3::mul_mat3( &_self, &rhs, ) @@ -17512,7 +17126,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3::add_mat3( + let output: Val = bevy::math::Mat3::add_mat3( &_self, &rhs, ) @@ -17523,7 +17137,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3::sub_mat3( + let output: Val = bevy::math::Mat3::sub_mat3( &_self, &rhs, ) @@ -17534,7 +17148,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3::mul_scalar( + let output: Val = bevy::math::Mat3::mul_scalar( &_self, rhs, ) @@ -17545,7 +17159,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3::div_scalar( + let output: Val = bevy::math::Mat3::div_scalar( &_self, rhs, ) @@ -17560,7 +17174,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Mat3::abs_diff_eq( + let output: bool = bevy::math::Mat3::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -17572,7 +17186,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat3::abs(&_self) + let output: Val = bevy::math::Mat3::abs(&_self) .into(); output }, @@ -17580,7 +17194,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat3", |_self: Ref| { - let output: Val = ::bevy::math::Mat3::as_dmat3( + let output: Val = bevy::math::Mat3::as_dmat3( &_self, ) .into(); @@ -17590,14 +17204,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat3::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Mat3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -17607,10 +17224,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17618,7 +17234,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Mat3::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -17626,10 +17244,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17637,10 +17254,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17648,10 +17264,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -17659,10 +17274,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -17671,10 +17285,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -17682,17 +17295,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat3A::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17700,10 +17315,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -17711,7 +17325,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -17725,7 +17339,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = ::bevy::math::Mat3A::from_cols( + let output: Val = bevy::math::Mat3A::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -17737,7 +17351,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 9] = ::bevy::math::Mat3A::to_cols_array(&_self) + let output: [f32; 9] = bevy::math::Mat3A::to_cols_array(&_self) .into(); output }, @@ -17745,7 +17359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 3] = ::bevy::math::Mat3A::to_cols_array_2d( + let output: [[f32; 3]; 3] = bevy::math::Mat3A::to_cols_array_2d( &_self, ) .into(); @@ -17755,7 +17369,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::Mat3A::from_diagonal( + let output: Val = bevy::math::Mat3A::from_diagonal( diagonal.into_inner(), ) .into(); @@ -17765,7 +17379,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = ::bevy::math::Mat3A::from_mat4( + let output: Val = bevy::math::Mat3A::from_mat4( m.into_inner(), ) .into(); @@ -17775,7 +17389,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::Mat3A::from_mat4_minor( + let output: Val = bevy::math::Mat3A::from_mat4_minor( m.into_inner(), i, j, @@ -17787,7 +17401,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::Mat3A::from_quat( + let output: Val = bevy::math::Mat3A::from_quat( rotation.into_inner(), ) .into(); @@ -17797,7 +17411,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_axis_angle( + let output: Val = bevy::math::Mat3A::from_axis_angle( axis.into_inner(), angle, ) @@ -17808,7 +17422,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Mat3A::from_euler( + let output: Val = bevy::math::Mat3A::from_euler( order.into_inner(), a, b, @@ -17821,7 +17435,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Mat3A::to_euler( + let output: (f32, f32, f32) = bevy::math::Mat3A::to_euler( &_self, order.into_inner(), ) @@ -17832,7 +17446,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_rotation_x( + let output: Val = bevy::math::Mat3A::from_rotation_x( angle, ) .into(); @@ -17842,7 +17456,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_rotation_y( + let output: Val = bevy::math::Mat3A::from_rotation_y( angle, ) .into(); @@ -17852,7 +17466,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_rotation_z( + let output: Val = bevy::math::Mat3A::from_rotation_z( angle, ) .into(); @@ -17862,7 +17476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::Mat3A::from_translation( + let output: Val = bevy::math::Mat3A::from_translation( translation.into_inner(), ) .into(); @@ -17872,7 +17486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = ::bevy::math::Mat3A::from_angle( + let output: Val = bevy::math::Mat3A::from_angle( angle, ) .into(); @@ -17886,7 +17500,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = ::bevy::math::Mat3A::from_scale_angle_translation( + let output: Val = bevy::math::Mat3A::from_scale_angle_translation( scale.into_inner(), angle, translation.into_inner(), @@ -17898,7 +17512,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::Mat3A::from_scale( + let output: Val = bevy::math::Mat3A::from_scale( scale.into_inner(), ) .into(); @@ -17908,7 +17522,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = ::bevy::math::Mat3A::from_mat2( + let output: Val = bevy::math::Mat3A::from_mat2( m.into_inner(), ) .into(); @@ -17918,7 +17532,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3A::col( + let output: Val = bevy::math::Mat3A::col( &_self, index, ) @@ -17929,7 +17543,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat3A::row( + let output: Val = bevy::math::Mat3A::row( &_self, index, ) @@ -17940,21 +17554,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat3A::is_finite(&_self).into(); + let output: bool = bevy::math::Mat3A::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat3A::is_nan(&_self).into(); + let output: bool = bevy::math::Mat3A::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::transpose( + let output: Val = bevy::math::Mat3A::transpose( &_self, ) .into(); @@ -17964,14 +17578,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat3A::determinant(&_self).into(); + let output: f32 = bevy::math::Mat3A::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::inverse( + let output: Val = bevy::math::Mat3A::inverse( &_self, ) .into(); @@ -17981,7 +17595,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::transform_point2( + let output: Val = bevy::math::Mat3A::transform_point2( &_self, rhs.into_inner(), ) @@ -17992,7 +17606,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::transform_vector2( + let output: Val = bevy::math::Mat3A::transform_vector2( &_self, rhs.into_inner(), ) @@ -18003,7 +17617,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul_vec3( + let output: Val = bevy::math::Mat3A::mul_vec3( &_self, rhs.into_inner(), ) @@ -18014,7 +17628,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul_vec3a( + let output: Val = bevy::math::Mat3A::mul_vec3a( &_self, rhs.into_inner(), ) @@ -18025,7 +17639,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3A::mul_mat3( + let output: Val = bevy::math::Mat3A::mul_mat3( &_self, &rhs, ) @@ -18036,7 +17650,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3A::add_mat3( + let output: Val = bevy::math::Mat3A::add_mat3( &_self, &rhs, ) @@ -18047,7 +17661,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat3A::sub_mat3( + let output: Val = bevy::math::Mat3A::sub_mat3( &_self, &rhs, ) @@ -18058,7 +17672,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::mul_scalar( + let output: Val = bevy::math::Mat3A::mul_scalar( &_self, rhs, ) @@ -18069,7 +17683,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::div_scalar( + let output: Val = bevy::math::Mat3A::div_scalar( &_self, rhs, ) @@ -18084,7 +17698,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Mat3A::abs_diff_eq( + let output: bool = bevy::math::Mat3A::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -18096,7 +17710,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::abs(&_self) + let output: Val = bevy::math::Mat3A::abs(&_self) .into(); output }, @@ -18104,7 +17718,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat3", |_self: Ref| { - let output: Val = ::bevy::math::Mat3A::as_dmat3( + let output: Val = bevy::math::Mat3A::as_dmat3( &_self, ) .into(); @@ -18114,10 +17728,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -18125,10 +17738,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18136,10 +17748,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18147,7 +17758,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Mat3A::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -18157,10 +17768,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18168,10 +17778,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18180,17 +17789,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Mat4::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18198,10 +17809,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18209,10 +17819,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18220,10 +17829,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -18231,7 +17839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::Mat4::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -18241,10 +17849,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18252,7 +17859,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Mat4::clone(&_self) + let output: Val = ::clone( + &_self, + ) .into(); output }, @@ -18265,7 +17874,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = ::bevy::math::Mat4::from_cols( + let output: Val = bevy::math::Mat4::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -18278,7 +17887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 16] = ::bevy::math::Mat4::to_cols_array(&_self) + let output: [f32; 16] = bevy::math::Mat4::to_cols_array(&_self) .into(); output }, @@ -18286,7 +17895,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 4]; 4] = ::bevy::math::Mat4::to_cols_array_2d( + let output: [[f32; 4]; 4] = bevy::math::Mat4::to_cols_array_2d( &_self, ) .into(); @@ -18296,7 +17905,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::Mat4::from_diagonal( + let output: Val = bevy::math::Mat4::from_diagonal( diagonal.into_inner(), ) .into(); @@ -18310,7 +17919,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = ::bevy::math::Mat4::from_scale_rotation_translation( + let output: Val = bevy::math::Mat4::from_scale_rotation_translation( scale.into_inner(), rotation.into_inner(), translation.into_inner(), @@ -18322,7 +17931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::Mat4::from_rotation_translation( + let output: Val = bevy::math::Mat4::from_rotation_translation( rotation.into_inner(), translation.into_inner(), ) @@ -18333,7 +17942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::Mat4::from_quat( + let output: Val = bevy::math::Mat4::from_quat( rotation.into_inner(), ) .into(); @@ -18343,7 +17952,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = ::bevy::math::Mat4::from_mat3( + let output: Val = bevy::math::Mat4::from_mat3( m.into_inner(), ) .into(); @@ -18353,7 +17962,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = ::bevy::math::Mat4::from_mat3a( + let output: Val = bevy::math::Mat4::from_mat3a( m.into_inner(), ) .into(); @@ -18363,7 +17972,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::Mat4::from_translation( + let output: Val = bevy::math::Mat4::from_translation( translation.into_inner(), ) .into(); @@ -18373,7 +17982,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Mat4::from_axis_angle( + let output: Val = bevy::math::Mat4::from_axis_angle( axis.into_inner(), angle, ) @@ -18384,7 +17993,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f32, b: f32, c: f32| { - let output: Val = ::bevy::math::Mat4::from_euler( + let output: Val = bevy::math::Mat4::from_euler( order.into_inner(), a, b, @@ -18397,7 +18006,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f32, f32, f32) = ::bevy::math::Mat4::to_euler( + let output: (f32, f32, f32) = bevy::math::Mat4::to_euler( &_self, order.into_inner(), ) @@ -18408,7 +18017,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = ::bevy::math::Mat4::from_rotation_x( + let output: Val = bevy::math::Mat4::from_rotation_x( angle, ) .into(); @@ -18418,7 +18027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = ::bevy::math::Mat4::from_rotation_y( + let output: Val = bevy::math::Mat4::from_rotation_y( angle, ) .into(); @@ -18428,7 +18037,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = ::bevy::math::Mat4::from_rotation_z( + let output: Val = bevy::math::Mat4::from_rotation_z( angle, ) .into(); @@ -18438,7 +18047,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::Mat4::from_scale( + let output: Val = bevy::math::Mat4::from_scale( scale.into_inner(), ) .into(); @@ -18448,7 +18057,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat4::col( + let output: Val = bevy::math::Mat4::col( &_self, index, ) @@ -18459,7 +18068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::Mat4::row( + let output: Val = bevy::math::Mat4::row( &_self, index, ) @@ -18470,21 +18079,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Mat4::is_finite(&_self).into(); + let output: bool = bevy::math::Mat4::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Mat4::is_nan(&_self).into(); + let output: bool = bevy::math::Mat4::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::Mat4::transpose( + let output: Val = bevy::math::Mat4::transpose( &_self, ) .into(); @@ -18494,16 +18103,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f32 = ::bevy::math::Mat4::determinant(&_self).into(); + let output: f32 = bevy::math::Mat4::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Mat4::inverse( - &_self, - ) + let output: Val = bevy::math::Mat4::inverse(&_self) .into(); output }, @@ -18515,7 +18122,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::Mat4::look_to_lh( + let output: Val = bevy::math::Mat4::look_to_lh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -18531,7 +18138,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::Mat4::look_to_rh( + let output: Val = bevy::math::Mat4::look_to_rh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -18547,7 +18154,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::Mat4::look_at_lh( + let output: Val = bevy::math::Mat4::look_at_lh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -18563,7 +18170,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::Mat4::look_at_rh( + let output: Val = bevy::math::Mat4::look_at_rh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -18575,7 +18182,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh_gl", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = ::bevy::math::Mat4::perspective_rh_gl( + let output: Val = bevy::math::Mat4::perspective_rh_gl( fov_y_radians, aspect_ratio, z_near, @@ -18588,7 +18195,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = ::bevy::math::Mat4::perspective_lh( + let output: Val = bevy::math::Mat4::perspective_lh( fov_y_radians, aspect_ratio, z_near, @@ -18601,7 +18208,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { - let output: Val = ::bevy::math::Mat4::perspective_rh( + let output: Val = bevy::math::Mat4::perspective_rh( fov_y_radians, aspect_ratio, z_near, @@ -18614,7 +18221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_lh( + let output: Val = bevy::math::Mat4::perspective_infinite_lh( fov_y_radians, aspect_ratio, z_near, @@ -18626,7 +18233,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_lh( + let output: Val = bevy::math::Mat4::perspective_infinite_reverse_lh( fov_y_radians, aspect_ratio, z_near, @@ -18638,7 +18245,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_rh( + let output: Val = bevy::math::Mat4::perspective_infinite_rh( fov_y_radians, aspect_ratio, z_near, @@ -18650,7 +18257,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { - let output: Val = ::bevy::math::Mat4::perspective_infinite_reverse_rh( + let output: Val = bevy::math::Mat4::perspective_infinite_reverse_rh( fov_y_radians, aspect_ratio, z_near, @@ -18662,7 +18269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh_gl", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = ::bevy::math::Mat4::orthographic_rh_gl( + let output: Val = bevy::math::Mat4::orthographic_rh_gl( left, right, bottom, @@ -18677,7 +18284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_lh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = ::bevy::math::Mat4::orthographic_lh( + let output: Val = bevy::math::Mat4::orthographic_lh( left, right, bottom, @@ -18692,7 +18299,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { - let output: Val = ::bevy::math::Mat4::orthographic_rh( + let output: Val = bevy::math::Mat4::orthographic_rh( left, right, bottom, @@ -18707,7 +18314,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::project_point3( + let output: Val = bevy::math::Mat4::project_point3( &_self, rhs.into_inner(), ) @@ -18718,7 +18325,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_point3( + let output: Val = bevy::math::Mat4::transform_point3( &_self, rhs.into_inner(), ) @@ -18729,7 +18336,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_vector3( + let output: Val = bevy::math::Mat4::transform_vector3( &_self, rhs.into_inner(), ) @@ -18740,7 +18347,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::project_point3a( + let output: Val = bevy::math::Mat4::project_point3a( &_self, rhs.into_inner(), ) @@ -18751,7 +18358,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_point3a( + let output: Val = bevy::math::Mat4::transform_point3a( &_self, rhs.into_inner(), ) @@ -18762,7 +18369,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::transform_vector3a( + let output: Val = bevy::math::Mat4::transform_vector3a( &_self, rhs.into_inner(), ) @@ -18773,7 +18380,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Mat4::mul_vec4( + let output: Val = bevy::math::Mat4::mul_vec4( &_self, rhs.into_inner(), ) @@ -18784,7 +18391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat4", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat4::mul_mat4( + let output: Val = bevy::math::Mat4::mul_mat4( &_self, &rhs, ) @@ -18795,7 +18402,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat4", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat4::add_mat4( + let output: Val = bevy::math::Mat4::add_mat4( &_self, &rhs, ) @@ -18806,7 +18413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat4", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::Mat4::sub_mat4( + let output: Val = bevy::math::Mat4::sub_mat4( &_self, &rhs, ) @@ -18817,7 +18424,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat4::mul_scalar( + let output: Val = bevy::math::Mat4::mul_scalar( &_self, rhs, ) @@ -18828,7 +18435,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f32| { - let output: Val = ::bevy::math::Mat4::div_scalar( + let output: Val = bevy::math::Mat4::div_scalar( &_self, rhs, ) @@ -18843,7 +18450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Mat4::abs_diff_eq( + let output: bool = bevy::math::Mat4::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -18855,7 +18462,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::Mat4::abs(&_self) + let output: Val = bevy::math::Mat4::abs(&_self) .into(); output }, @@ -18863,7 +18470,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_dmat4", |_self: Ref| { - let output: Val = ::bevy::math::Mat4::as_dmat4( + let output: Val = bevy::math::Mat4::as_dmat4( &_self, ) .into(); @@ -18873,10 +18480,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Mat4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18884,10 +18490,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f32| { - let output: Val = ::bevy::math::Mat4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -18896,7 +18501,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DMat2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -18906,10 +18511,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat2::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -18917,10 +18521,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat2::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -18928,10 +18531,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18939,10 +18541,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18950,10 +18551,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18961,10 +18561,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -18972,14 +18571,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat2::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "from_cols", |x_axis: Val, y_axis: Val| { - let output: Val = ::bevy::math::DMat2::from_cols( + let output: Val = bevy::math::DMat2::from_cols( x_axis.into_inner(), y_axis.into_inner(), ) @@ -18990,7 +18592,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DMat2::to_cols_array(&_self) + let output: [f64; 4] = bevy::math::DMat2::to_cols_array(&_self) .into(); output }, @@ -18998,7 +18600,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 2]; 2] = ::bevy::math::DMat2::to_cols_array_2d( + let output: [[f64; 2]; 2] = bevy::math::DMat2::to_cols_array_2d( &_self, ) .into(); @@ -19008,7 +18610,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::DMat2::from_diagonal( + let output: Val = bevy::math::DMat2::from_diagonal( diagonal.into_inner(), ) .into(); @@ -19018,7 +18620,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale_angle", |scale: Val, angle: f64| { - let output: Val = ::bevy::math::DMat2::from_scale_angle( + let output: Val = bevy::math::DMat2::from_scale_angle( scale.into_inner(), angle, ) @@ -19029,7 +18631,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = ::bevy::math::DMat2::from_angle( + let output: Val = bevy::math::DMat2::from_angle( angle, ) .into(); @@ -19039,7 +18641,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = ::bevy::math::DMat2::from_mat3( + let output: Val = bevy::math::DMat2::from_mat3( m.into_inner(), ) .into(); @@ -19049,7 +18651,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_minor", |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::DMat2::from_mat3_minor( + let output: Val = bevy::math::DMat2::from_mat3_minor( m.into_inner(), i, j, @@ -19061,7 +18663,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat2::col( + let output: Val = bevy::math::DMat2::col( &_self, index, ) @@ -19072,7 +18674,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat2::row( + let output: Val = bevy::math::DMat2::row( &_self, index, ) @@ -19083,21 +18685,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DMat2::is_finite(&_self).into(); + let output: bool = bevy::math::DMat2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DMat2::is_nan(&_self).into(); + let output: bool = bevy::math::DMat2::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::DMat2::transpose( + let output: Val = bevy::math::DMat2::transpose( &_self, ) .into(); @@ -19107,14 +18709,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = ::bevy::math::DMat2::determinant(&_self).into(); + let output: f64 = bevy::math::DMat2::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::DMat2::inverse( + let output: Val = bevy::math::DMat2::inverse( &_self, ) .into(); @@ -19124,7 +18726,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat2::mul_vec2( + let output: Val = bevy::math::DMat2::mul_vec2( &_self, rhs.into_inner(), ) @@ -19135,7 +18737,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat2", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat2::mul_mat2( + let output: Val = bevy::math::DMat2::mul_mat2( &_self, &rhs, ) @@ -19146,7 +18748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat2", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat2::add_mat2( + let output: Val = bevy::math::DMat2::add_mat2( &_self, &rhs, ) @@ -19157,7 +18759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat2", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat2::sub_mat2( + let output: Val = bevy::math::DMat2::sub_mat2( &_self, &rhs, ) @@ -19168,7 +18770,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat2::mul_scalar( + let output: Val = bevy::math::DMat2::mul_scalar( &_self, rhs, ) @@ -19179,7 +18781,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat2::div_scalar( + let output: Val = bevy::math::DMat2::div_scalar( &_self, rhs, ) @@ -19194,7 +18796,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DMat2::abs_diff_eq( + let output: bool = bevy::math::DMat2::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -19206,7 +18808,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::DMat2::abs(&_self) + let output: Val = bevy::math::DMat2::abs(&_self) .into(); output }, @@ -19214,7 +18816,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_mat2", |_self: Ref| { - let output: Val = ::bevy::math::DMat2::as_mat2( + let output: Val = bevy::math::DMat2::as_mat2( &_self, ) .into(); @@ -19224,7 +18826,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DMat2::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -19235,10 +18837,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -19246,7 +18847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DMat3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -19256,10 +18857,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19267,10 +18867,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19278,10 +18877,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19293,7 +18891,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = ::bevy::math::DMat3::from_cols( + let output: Val = bevy::math::DMat3::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -19305,7 +18903,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 9] = ::bevy::math::DMat3::to_cols_array(&_self) + let output: [f64; 9] = bevy::math::DMat3::to_cols_array(&_self) .into(); output }, @@ -19313,7 +18911,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 3]; 3] = ::bevy::math::DMat3::to_cols_array_2d( + let output: [[f64; 3]; 3] = bevy::math::DMat3::to_cols_array_2d( &_self, ) .into(); @@ -19323,7 +18921,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::DMat3::from_diagonal( + let output: Val = bevy::math::DMat3::from_diagonal( diagonal.into_inner(), ) .into(); @@ -19333,7 +18931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = ::bevy::math::DMat3::from_mat4( + let output: Val = bevy::math::DMat3::from_mat4( m.into_inner(), ) .into(); @@ -19343,7 +18941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4_minor", |m: Val, i: usize, j: usize| { - let output: Val = ::bevy::math::DMat3::from_mat4_minor( + let output: Val = bevy::math::DMat3::from_mat4_minor( m.into_inner(), i, j, @@ -19355,7 +18953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::DMat3::from_quat( + let output: Val = bevy::math::DMat3::from_quat( rotation.into_inner(), ) .into(); @@ -19365,7 +18963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DMat3::from_axis_angle( + let output: Val = bevy::math::DMat3::from_axis_angle( axis.into_inner(), angle, ) @@ -19376,7 +18974,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f64, b: f64, c: f64| { - let output: Val = ::bevy::math::DMat3::from_euler( + let output: Val = bevy::math::DMat3::from_euler( order.into_inner(), a, b, @@ -19389,7 +18987,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f64, f64, f64) = ::bevy::math::DMat3::to_euler( + let output: (f64, f64, f64) = bevy::math::DMat3::to_euler( &_self, order.into_inner(), ) @@ -19400,7 +18998,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_rotation_x( + let output: Val = bevy::math::DMat3::from_rotation_x( angle, ) .into(); @@ -19410,7 +19008,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_rotation_y( + let output: Val = bevy::math::DMat3::from_rotation_y( angle, ) .into(); @@ -19420,7 +19018,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_rotation_z( + let output: Val = bevy::math::DMat3::from_rotation_z( angle, ) .into(); @@ -19430,7 +19028,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::DMat3::from_translation( + let output: Val = bevy::math::DMat3::from_translation( translation.into_inner(), ) .into(); @@ -19440,7 +19038,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = ::bevy::math::DMat3::from_angle( + let output: Val = bevy::math::DMat3::from_angle( angle, ) .into(); @@ -19454,7 +19052,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f64, translation: Val| { - let output: Val = ::bevy::math::DMat3::from_scale_angle_translation( + let output: Val = bevy::math::DMat3::from_scale_angle_translation( scale.into_inner(), angle, translation.into_inner(), @@ -19466,7 +19064,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::DMat3::from_scale( + let output: Val = bevy::math::DMat3::from_scale( scale.into_inner(), ) .into(); @@ -19476,7 +19074,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |m: Val| { - let output: Val = ::bevy::math::DMat3::from_mat2( + let output: Val = bevy::math::DMat3::from_mat2( m.into_inner(), ) .into(); @@ -19486,7 +19084,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat3::col( + let output: Val = bevy::math::DMat3::col( &_self, index, ) @@ -19497,7 +19095,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat3::row( + let output: Val = bevy::math::DMat3::row( &_self, index, ) @@ -19508,21 +19106,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DMat3::is_finite(&_self).into(); + let output: bool = bevy::math::DMat3::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DMat3::is_nan(&_self).into(); + let output: bool = bevy::math::DMat3::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::DMat3::transpose( + let output: Val = bevy::math::DMat3::transpose( &_self, ) .into(); @@ -19532,14 +19130,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = ::bevy::math::DMat3::determinant(&_self).into(); + let output: f64 = bevy::math::DMat3::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::DMat3::inverse( + let output: Val = bevy::math::DMat3::inverse( &_self, ) .into(); @@ -19549,7 +19147,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat3::transform_point2( + let output: Val = bevy::math::DMat3::transform_point2( &_self, rhs.into_inner(), ) @@ -19560,7 +19158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat3::transform_vector2( + let output: Val = bevy::math::DMat3::transform_vector2( &_self, rhs.into_inner(), ) @@ -19571,7 +19169,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul_vec3( + let output: Val = bevy::math::DMat3::mul_vec3( &_self, rhs.into_inner(), ) @@ -19582,7 +19180,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat3::mul_mat3( + let output: Val = bevy::math::DMat3::mul_mat3( &_self, &rhs, ) @@ -19593,7 +19191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat3::add_mat3( + let output: Val = bevy::math::DMat3::add_mat3( &_self, &rhs, ) @@ -19604,7 +19202,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat3", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat3::sub_mat3( + let output: Val = bevy::math::DMat3::sub_mat3( &_self, &rhs, ) @@ -19615,7 +19213,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat3::mul_scalar( + let output: Val = bevy::math::DMat3::mul_scalar( &_self, rhs, ) @@ -19626,7 +19224,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat3::div_scalar( + let output: Val = bevy::math::DMat3::div_scalar( &_self, rhs, ) @@ -19641,7 +19239,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DMat3::abs_diff_eq( + let output: bool = bevy::math::DMat3::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -19653,7 +19251,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::DMat3::abs(&_self) + let output: Val = bevy::math::DMat3::abs(&_self) .into(); output }, @@ -19661,7 +19259,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_mat3", |_self: Ref| { - let output: Val = ::bevy::math::DMat3::as_mat3( + let output: Val = bevy::math::DMat3::as_mat3( &_self, ) .into(); @@ -19671,10 +19269,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat3::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -19682,10 +19279,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19693,10 +19289,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19704,14 +19299,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat3::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DMat3::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -19722,10 +19320,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19733,10 +19330,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19744,10 +19340,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19755,7 +19350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DMat4::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -19765,17 +19360,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DMat4::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -19783,10 +19380,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -19799,7 +19395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = ::bevy::math::DMat4::from_cols( + let output: Val = bevy::math::DMat4::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -19812,7 +19408,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 16] = ::bevy::math::DMat4::to_cols_array(&_self) + let output: [f64; 16] = bevy::math::DMat4::to_cols_array(&_self) .into(); output }, @@ -19820,7 +19416,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 4]; 4] = ::bevy::math::DMat4::to_cols_array_2d( + let output: [[f64; 4]; 4] = bevy::math::DMat4::to_cols_array_2d( &_self, ) .into(); @@ -19830,7 +19426,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_diagonal", |diagonal: Val| { - let output: Val = ::bevy::math::DMat4::from_diagonal( + let output: Val = bevy::math::DMat4::from_diagonal( diagonal.into_inner(), ) .into(); @@ -19844,7 +19440,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = ::bevy::math::DMat4::from_scale_rotation_translation( + let output: Val = bevy::math::DMat4::from_scale_rotation_translation( scale.into_inner(), rotation.into_inner(), translation.into_inner(), @@ -19856,7 +19452,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::DMat4::from_rotation_translation( + let output: Val = bevy::math::DMat4::from_rotation_translation( rotation.into_inner(), translation.into_inner(), ) @@ -19867,7 +19463,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::DMat4::from_quat( + let output: Val = bevy::math::DMat4::from_quat( rotation.into_inner(), ) .into(); @@ -19877,7 +19473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = ::bevy::math::DMat4::from_mat3( + let output: Val = bevy::math::DMat4::from_mat3( m.into_inner(), ) .into(); @@ -19887,7 +19483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::DMat4::from_translation( + let output: Val = bevy::math::DMat4::from_translation( translation.into_inner(), ) .into(); @@ -19897,7 +19493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DMat4::from_axis_angle( + let output: Val = bevy::math::DMat4::from_axis_angle( axis.into_inner(), angle, ) @@ -19908,7 +19504,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |order: Val, a: f64, b: f64, c: f64| { - let output: Val = ::bevy::math::DMat4::from_euler( + let output: Val = bevy::math::DMat4::from_euler( order.into_inner(), a, b, @@ -19921,7 +19517,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Ref, order: Val| { - let output: (f64, f64, f64) = ::bevy::math::DMat4::to_euler( + let output: (f64, f64, f64) = bevy::math::DMat4::to_euler( &_self, order.into_inner(), ) @@ -19932,7 +19528,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = ::bevy::math::DMat4::from_rotation_x( + let output: Val = bevy::math::DMat4::from_rotation_x( angle, ) .into(); @@ -19942,7 +19538,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = ::bevy::math::DMat4::from_rotation_y( + let output: Val = bevy::math::DMat4::from_rotation_y( angle, ) .into(); @@ -19952,7 +19548,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = ::bevy::math::DMat4::from_rotation_z( + let output: Val = bevy::math::DMat4::from_rotation_z( angle, ) .into(); @@ -19962,7 +19558,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::DMat4::from_scale( + let output: Val = bevy::math::DMat4::from_scale( scale.into_inner(), ) .into(); @@ -19972,7 +19568,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "col", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat4::col( + let output: Val = bevy::math::DMat4::col( &_self, index, ) @@ -19983,7 +19579,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "row", |_self: Ref, index: usize| { - let output: Val = ::bevy::math::DMat4::row( + let output: Val = bevy::math::DMat4::row( &_self, index, ) @@ -19994,21 +19590,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DMat4::is_finite(&_self).into(); + let output: bool = bevy::math::DMat4::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DMat4::is_nan(&_self).into(); + let output: bool = bevy::math::DMat4::is_nan(&_self).into(); output }, ) .overwrite_script_function( "transpose", |_self: Ref| { - let output: Val = ::bevy::math::DMat4::transpose( + let output: Val = bevy::math::DMat4::transpose( &_self, ) .into(); @@ -20018,14 +19614,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "determinant", |_self: Ref| { - let output: f64 = ::bevy::math::DMat4::determinant(&_self).into(); + let output: f64 = bevy::math::DMat4::determinant(&_self).into(); output }, ) .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::DMat4::inverse( + let output: Val = bevy::math::DMat4::inverse( &_self, ) .into(); @@ -20039,7 +19635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::DMat4::look_to_lh( + let output: Val = bevy::math::DMat4::look_to_lh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -20055,7 +19651,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::DMat4::look_to_rh( + let output: Val = bevy::math::DMat4::look_to_rh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -20071,7 +19667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::DMat4::look_at_lh( + let output: Val = bevy::math::DMat4::look_at_lh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -20087,7 +19683,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::DMat4::look_at_rh( + let output: Val = bevy::math::DMat4::look_at_rh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -20099,7 +19695,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh_gl", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = ::bevy::math::DMat4::perspective_rh_gl( + let output: Val = bevy::math::DMat4::perspective_rh_gl( fov_y_radians, aspect_ratio, z_near, @@ -20112,7 +19708,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = ::bevy::math::DMat4::perspective_lh( + let output: Val = bevy::math::DMat4::perspective_lh( fov_y_radians, aspect_ratio, z_near, @@ -20125,7 +19721,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { - let output: Val = ::bevy::math::DMat4::perspective_rh( + let output: Val = bevy::math::DMat4::perspective_rh( fov_y_radians, aspect_ratio, z_near, @@ -20138,7 +19734,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_lh( + let output: Val = bevy::math::DMat4::perspective_infinite_lh( fov_y_radians, aspect_ratio, z_near, @@ -20150,7 +19746,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_lh( + let output: Val = bevy::math::DMat4::perspective_infinite_reverse_lh( fov_y_radians, aspect_ratio, z_near, @@ -20162,7 +19758,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_rh( + let output: Val = bevy::math::DMat4::perspective_infinite_rh( fov_y_radians, aspect_ratio, z_near, @@ -20174,7 +19770,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "perspective_infinite_reverse_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { - let output: Val = ::bevy::math::DMat4::perspective_infinite_reverse_rh( + let output: Val = bevy::math::DMat4::perspective_infinite_reverse_rh( fov_y_radians, aspect_ratio, z_near, @@ -20186,7 +19782,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh_gl", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = ::bevy::math::DMat4::orthographic_rh_gl( + let output: Val = bevy::math::DMat4::orthographic_rh_gl( left, right, bottom, @@ -20201,7 +19797,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_lh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = ::bevy::math::DMat4::orthographic_lh( + let output: Val = bevy::math::DMat4::orthographic_lh( left, right, bottom, @@ -20216,7 +19812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "orthographic_rh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { - let output: Val = ::bevy::math::DMat4::orthographic_rh( + let output: Val = bevy::math::DMat4::orthographic_rh( left, right, bottom, @@ -20231,7 +19827,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "project_point3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::project_point3( + let output: Val = bevy::math::DMat4::project_point3( &_self, rhs.into_inner(), ) @@ -20242,7 +19838,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::transform_point3( + let output: Val = bevy::math::DMat4::transform_point3( &_self, rhs.into_inner(), ) @@ -20253,7 +19849,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::transform_vector3( + let output: Val = bevy::math::DMat4::transform_vector3( &_self, rhs.into_inner(), ) @@ -20264,7 +19860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec4", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DMat4::mul_vec4( + let output: Val = bevy::math::DMat4::mul_vec4( &_self, rhs.into_inner(), ) @@ -20275,7 +19871,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_mat4", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::mul_mat4( + let output: Val = bevy::math::DMat4::mul_mat4( &_self, &rhs, ) @@ -20286,7 +19882,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add_mat4", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::add_mat4( + let output: Val = bevy::math::DMat4::add_mat4( &_self, &rhs, ) @@ -20297,7 +19893,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub_mat4", |_self: Ref, rhs: Ref| { - let output: Val = ::bevy::math::DMat4::sub_mat4( + let output: Val = bevy::math::DMat4::sub_mat4( &_self, &rhs, ) @@ -20308,7 +19904,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_scalar", |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat4::mul_scalar( + let output: Val = bevy::math::DMat4::mul_scalar( &_self, rhs, ) @@ -20319,7 +19915,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div_scalar", |_self: Ref, rhs: f64| { - let output: Val = ::bevy::math::DMat4::div_scalar( + let output: Val = bevy::math::DMat4::div_scalar( &_self, rhs, ) @@ -20334,7 +19930,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DMat4::abs_diff_eq( + let output: bool = bevy::math::DMat4::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -20346,7 +19942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "abs", |_self: Ref| { - let output: Val = ::bevy::math::DMat4::abs(&_self) + let output: Val = bevy::math::DMat4::abs(&_self) .into(); output }, @@ -20354,7 +19950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_mat4", |_self: Ref| { - let output: Val = ::bevy::math::DMat4::as_mat4( + let output: Val = bevy::math::DMat4::as_mat4( &_self, ) .into(); @@ -20364,10 +19960,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DMat4::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -20375,7 +19970,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DMat4::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -20385,10 +19980,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DMat4::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -20401,7 +19995,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = ::bevy::math::Affine2::from_cols( + let output: Val = bevy::math::Affine2::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -20413,7 +20007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 6] = ::bevy::math::Affine2::to_cols_array(&_self) + let output: [f32; 6] = bevy::math::Affine2::to_cols_array(&_self) .into(); output }, @@ -20421,7 +20015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 2]; 3] = ::bevy::math::Affine2::to_cols_array_2d( + let output: [[f32; 2]; 3] = bevy::math::Affine2::to_cols_array_2d( &_self, ) .into(); @@ -20431,7 +20025,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::Affine2::from_scale( + let output: Val = bevy::math::Affine2::from_scale( scale.into_inner(), ) .into(); @@ -20441,7 +20035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f32| { - let output: Val = ::bevy::math::Affine2::from_angle( + let output: Val = bevy::math::Affine2::from_angle( angle, ) .into(); @@ -20451,7 +20045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::Affine2::from_translation( + let output: Val = bevy::math::Affine2::from_translation( translation.into_inner(), ) .into(); @@ -20461,7 +20055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |matrix2: Val| { - let output: Val = ::bevy::math::Affine2::from_mat2( + let output: Val = bevy::math::Affine2::from_mat2( matrix2.into_inner(), ) .into(); @@ -20471,7 +20065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2_translation", |matrix2: Val, translation: Val| { - let output: Val = ::bevy::math::Affine2::from_mat2_translation( + let output: Val = bevy::math::Affine2::from_mat2_translation( matrix2.into_inner(), translation.into_inner(), ) @@ -20486,7 +20080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f32, translation: Val| { - let output: Val = ::bevy::math::Affine2::from_scale_angle_translation( + let output: Val = bevy::math::Affine2::from_scale_angle_translation( scale.into_inner(), angle, translation.into_inner(), @@ -20498,7 +20092,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle_translation", |angle: f32, translation: Val| { - let output: Val = ::bevy::math::Affine2::from_angle_translation( + let output: Val = bevy::math::Affine2::from_angle_translation( angle, translation.into_inner(), ) @@ -20509,7 +20103,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = ::bevy::math::Affine2::from_mat3( + let output: Val = bevy::math::Affine2::from_mat3( m.into_inner(), ) .into(); @@ -20519,7 +20113,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3a", |m: Val| { - let output: Val = ::bevy::math::Affine2::from_mat3a( + let output: Val = bevy::math::Affine2::from_mat3a( m.into_inner(), ) .into(); @@ -20529,7 +20123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine2::transform_point2( + let output: Val = bevy::math::Affine2::transform_point2( &_self, rhs.into_inner(), ) @@ -20540,7 +20134,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine2::transform_vector2( + let output: Val = bevy::math::Affine2::transform_vector2( &_self, rhs.into_inner(), ) @@ -20551,14 +20145,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Affine2::is_finite(&_self).into(); + let output: bool = bevy::math::Affine2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Affine2::is_nan(&_self).into(); + let output: bool = bevy::math::Affine2::is_nan(&_self).into(); output }, ) @@ -20569,7 +20163,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Affine2::abs_diff_eq( + let output: bool = bevy::math::Affine2::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -20581,7 +20175,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Affine2::inverse( + let output: Val = bevy::math::Affine2::inverse( &_self, ) .into(); @@ -20591,10 +20185,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -20602,10 +20195,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -20613,10 +20205,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -20624,14 +20215,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Affine2::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Affine2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -20647,7 +20241,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = ::bevy::math::Affine3A::from_cols( + let output: Val = bevy::math::Affine3A::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -20660,7 +20254,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f32; 12] = ::bevy::math::Affine3A::to_cols_array(&_self) + let output: [f32; 12] = bevy::math::Affine3A::to_cols_array(&_self) .into(); output }, @@ -20668,7 +20262,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f32; 3]; 4] = ::bevy::math::Affine3A::to_cols_array_2d( + let output: [[f32; 3]; 4] = bevy::math::Affine3A::to_cols_array_2d( &_self, ) .into(); @@ -20678,7 +20272,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::Affine3A::from_scale( + let output: Val = bevy::math::Affine3A::from_scale( scale.into_inner(), ) .into(); @@ -20688,7 +20282,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::Affine3A::from_quat( + let output: Val = bevy::math::Affine3A::from_quat( rotation.into_inner(), ) .into(); @@ -20698,7 +20292,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_axis_angle( + let output: Val = bevy::math::Affine3A::from_axis_angle( axis.into_inner(), angle, ) @@ -20709,7 +20303,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_rotation_x( + let output: Val = bevy::math::Affine3A::from_rotation_x( angle, ) .into(); @@ -20719,7 +20313,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_rotation_y( + let output: Val = bevy::math::Affine3A::from_rotation_y( angle, ) .into(); @@ -20729,7 +20323,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f32| { - let output: Val = ::bevy::math::Affine3A::from_rotation_z( + let output: Val = bevy::math::Affine3A::from_rotation_z( angle, ) .into(); @@ -20739,7 +20333,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_translation( + let output: Val = bevy::math::Affine3A::from_translation( translation.into_inner(), ) .into(); @@ -20749,7 +20343,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat3: Val| { - let output: Val = ::bevy::math::Affine3A::from_mat3( + let output: Val = bevy::math::Affine3A::from_mat3( mat3.into_inner(), ) .into(); @@ -20759,7 +20353,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_translation", |mat3: Val, translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_mat3_translation( + let output: Val = bevy::math::Affine3A::from_mat3_translation( mat3.into_inner(), translation.into_inner(), ) @@ -20774,7 +20368,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_scale_rotation_translation( + let output: Val = bevy::math::Affine3A::from_scale_rotation_translation( scale.into_inner(), rotation.into_inner(), translation.into_inner(), @@ -20786,7 +20380,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::Affine3A::from_rotation_translation( + let output: Val = bevy::math::Affine3A::from_rotation_translation( rotation.into_inner(), translation.into_inner(), ) @@ -20797,7 +20391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = ::bevy::math::Affine3A::from_mat4( + let output: Val = bevy::math::Affine3A::from_mat4( m.into_inner(), ) .into(); @@ -20811,7 +20405,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::Affine3A::look_to_lh( + let output: Val = bevy::math::Affine3A::look_to_lh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -20827,7 +20421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::Affine3A::look_to_rh( + let output: Val = bevy::math::Affine3A::look_to_rh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -20843,7 +20437,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::Affine3A::look_at_lh( + let output: Val = bevy::math::Affine3A::look_at_lh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -20859,7 +20453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::Affine3A::look_at_rh( + let output: Val = bevy::math::Affine3A::look_at_rh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -20871,7 +20465,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_point3( + let output: Val = bevy::math::Affine3A::transform_point3( &_self, rhs.into_inner(), ) @@ -20882,7 +20476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_vector3( + let output: Val = bevy::math::Affine3A::transform_vector3( &_self, rhs.into_inner(), ) @@ -20893,7 +20487,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_point3a( + let output: Val = bevy::math::Affine3A::transform_point3a( &_self, rhs.into_inner(), ) @@ -20904,7 +20498,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3a", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::transform_vector3a( + let output: Val = bevy::math::Affine3A::transform_vector3a( &_self, rhs.into_inner(), ) @@ -20915,14 +20509,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::Affine3A::is_finite(&_self).into(); + let output: bool = bevy::math::Affine3A::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::Affine3A::is_nan(&_self).into(); + let output: bool = bevy::math::Affine3A::is_nan(&_self).into(); output }, ) @@ -20933,7 +20527,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f32| { - let output: bool = ::bevy::math::Affine3A::abs_diff_eq( + let output: bool = bevy::math::Affine3A::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -20945,7 +20539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::Affine3A::inverse( + let output: Val = bevy::math::Affine3A::inverse( &_self, ) .into(); @@ -20955,10 +20549,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -20966,17 +20559,19 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::Affine3A::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::Affine3A::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -20984,7 +20579,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::Affine3A::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -20995,10 +20590,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -21006,14 +20600,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DAffine2::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DAffine2::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -21027,7 +20624,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { y_axis: Val, z_axis: Val| { - let output: Val = ::bevy::math::DAffine2::from_cols( + let output: Val = bevy::math::DAffine2::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -21039,7 +20636,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 6] = ::bevy::math::DAffine2::to_cols_array(&_self) + let output: [f64; 6] = bevy::math::DAffine2::to_cols_array(&_self) .into(); output }, @@ -21047,7 +20644,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 2]; 3] = ::bevy::math::DAffine2::to_cols_array_2d( + let output: [[f64; 2]; 3] = bevy::math::DAffine2::to_cols_array_2d( &_self, ) .into(); @@ -21057,7 +20654,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::DAffine2::from_scale( + let output: Val = bevy::math::DAffine2::from_scale( scale.into_inner(), ) .into(); @@ -21067,7 +20664,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle", |angle: f64| { - let output: Val = ::bevy::math::DAffine2::from_angle( + let output: Val = bevy::math::DAffine2::from_angle( angle, ) .into(); @@ -21077,7 +20674,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_translation( + let output: Val = bevy::math::DAffine2::from_translation( translation.into_inner(), ) .into(); @@ -21087,7 +20684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2", |matrix2: Val| { - let output: Val = ::bevy::math::DAffine2::from_mat2( + let output: Val = bevy::math::DAffine2::from_mat2( matrix2.into_inner(), ) .into(); @@ -21097,7 +20694,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat2_translation", |matrix2: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_mat2_translation( + let output: Val = bevy::math::DAffine2::from_mat2_translation( matrix2.into_inner(), translation.into_inner(), ) @@ -21112,7 +20709,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { angle: f64, translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_scale_angle_translation( + let output: Val = bevy::math::DAffine2::from_scale_angle_translation( scale.into_inner(), angle, translation.into_inner(), @@ -21124,7 +20721,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_angle_translation", |angle: f64, translation: Val| { - let output: Val = ::bevy::math::DAffine2::from_angle_translation( + let output: Val = bevy::math::DAffine2::from_angle_translation( angle, translation.into_inner(), ) @@ -21135,7 +20732,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |m: Val| { - let output: Val = ::bevy::math::DAffine2::from_mat3( + let output: Val = bevy::math::DAffine2::from_mat3( m.into_inner(), ) .into(); @@ -21145,7 +20742,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::transform_point2( + let output: Val = bevy::math::DAffine2::transform_point2( &_self, rhs.into_inner(), ) @@ -21156,7 +20753,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector2", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::transform_vector2( + let output: Val = bevy::math::DAffine2::transform_vector2( &_self, rhs.into_inner(), ) @@ -21167,14 +20764,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DAffine2::is_finite(&_self).into(); + let output: bool = bevy::math::DAffine2::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DAffine2::is_nan(&_self).into(); + let output: bool = bevy::math::DAffine2::is_nan(&_self).into(); output }, ) @@ -21185,7 +20782,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DAffine2::abs_diff_eq( + let output: bool = bevy::math::DAffine2::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -21197,7 +20794,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::DAffine2::inverse( + let output: Val = bevy::math::DAffine2::inverse( &_self, ) .into(); @@ -21207,10 +20804,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine2::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -21219,10 +20815,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -21230,7 +20825,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DAffine3::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -21240,7 +20835,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DAffine3::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) @@ -21252,7 +20850,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { z_axis: Val, w_axis: Val| { - let output: Val = ::bevy::math::DAffine3::from_cols( + let output: Val = bevy::math::DAffine3::from_cols( x_axis.into_inner(), y_axis.into_inner(), z_axis.into_inner(), @@ -21265,7 +20863,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array", |_self: Ref| { - let output: [f64; 12] = ::bevy::math::DAffine3::to_cols_array(&_self) + let output: [f64; 12] = bevy::math::DAffine3::to_cols_array(&_self) .into(); output }, @@ -21273,7 +20871,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_cols_array_2d", |_self: Ref| { - let output: [[f64; 3]; 4] = ::bevy::math::DAffine3::to_cols_array_2d( + let output: [[f64; 3]; 4] = bevy::math::DAffine3::to_cols_array_2d( &_self, ) .into(); @@ -21283,7 +20881,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scale", |scale: Val| { - let output: Val = ::bevy::math::DAffine3::from_scale( + let output: Val = bevy::math::DAffine3::from_scale( scale.into_inner(), ) .into(); @@ -21293,7 +20891,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_quat", |rotation: Val| { - let output: Val = ::bevy::math::DAffine3::from_quat( + let output: Val = bevy::math::DAffine3::from_quat( rotation.into_inner(), ) .into(); @@ -21303,7 +20901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_axis_angle( + let output: Val = bevy::math::DAffine3::from_axis_angle( axis.into_inner(), angle, ) @@ -21314,7 +20912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_rotation_x( + let output: Val = bevy::math::DAffine3::from_rotation_x( angle, ) .into(); @@ -21324,7 +20922,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_rotation_y( + let output: Val = bevy::math::DAffine3::from_rotation_y( angle, ) .into(); @@ -21334,7 +20932,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = ::bevy::math::DAffine3::from_rotation_z( + let output: Val = bevy::math::DAffine3::from_rotation_z( angle, ) .into(); @@ -21344,7 +20942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_translation", |translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_translation( + let output: Val = bevy::math::DAffine3::from_translation( translation.into_inner(), ) .into(); @@ -21354,7 +20952,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat3: Val| { - let output: Val = ::bevy::math::DAffine3::from_mat3( + let output: Val = bevy::math::DAffine3::from_mat3( mat3.into_inner(), ) .into(); @@ -21364,7 +20962,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3_translation", |mat3: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_mat3_translation( + let output: Val = bevy::math::DAffine3::from_mat3_translation( mat3.into_inner(), translation.into_inner(), ) @@ -21379,7 +20977,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rotation: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_scale_rotation_translation( + let output: Val = bevy::math::DAffine3::from_scale_rotation_translation( scale.into_inner(), rotation.into_inner(), translation.into_inner(), @@ -21391,7 +20989,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_translation", |rotation: Val, translation: Val| { - let output: Val = ::bevy::math::DAffine3::from_rotation_translation( + let output: Val = bevy::math::DAffine3::from_rotation_translation( rotation.into_inner(), translation.into_inner(), ) @@ -21402,7 +21000,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |m: Val| { - let output: Val = ::bevy::math::DAffine3::from_mat4( + let output: Val = bevy::math::DAffine3::from_mat4( m.into_inner(), ) .into(); @@ -21416,7 +21014,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::DAffine3::look_to_lh( + let output: Val = bevy::math::DAffine3::look_to_lh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -21432,7 +21030,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { dir: Val, up: Val| { - let output: Val = ::bevy::math::DAffine3::look_to_rh( + let output: Val = bevy::math::DAffine3::look_to_rh( eye.into_inner(), dir.into_inner(), up.into_inner(), @@ -21448,7 +21046,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::DAffine3::look_at_lh( + let output: Val = bevy::math::DAffine3::look_at_lh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -21464,7 +21062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { center: Val, up: Val| { - let output: Val = ::bevy::math::DAffine3::look_at_rh( + let output: Val = bevy::math::DAffine3::look_at_rh( eye.into_inner(), center.into_inner(), up.into_inner(), @@ -21476,7 +21074,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_point3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::transform_point3( + let output: Val = bevy::math::DAffine3::transform_point3( &_self, rhs.into_inner(), ) @@ -21487,7 +21085,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "transform_vector3", |_self: Ref, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::transform_vector3( + let output: Val = bevy::math::DAffine3::transform_vector3( &_self, rhs.into_inner(), ) @@ -21498,14 +21096,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::math::DAffine3::is_finite(&_self).into(); + let output: bool = bevy::math::DAffine3::is_finite(&_self).into(); output }, ) .overwrite_script_function( "is_nan", |_self: Ref| { - let output: bool = ::bevy::math::DAffine3::is_nan(&_self).into(); + let output: bool = bevy::math::DAffine3::is_nan(&_self).into(); output }, ) @@ -21516,7 +21114,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DAffine3::abs_diff_eq( + let output: bool = bevy::math::DAffine3::abs_diff_eq( &_self, rhs.into_inner(), max_abs_diff, @@ -21528,7 +21126,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Ref| { - let output: Val = ::bevy::math::DAffine3::inverse( + let output: Val = bevy::math::DAffine3::inverse( &_self, ) .into(); @@ -21538,10 +21136,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DAffine3::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -21550,10 +21147,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into_inner(), - rhs, - ) + let output: Val = >::mul(_self.into_inner(), rhs) .into(); output }, @@ -21561,10 +21157,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "add", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::add( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::add(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -21572,14 +21167,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::DQuat::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ) .overwrite_script_function( "neg", |_self: Val| { - let output: Val = ::bevy::math::DQuat::neg( + let output: Val = ::neg( _self.into_inner(), ) .into(); @@ -21589,7 +21187,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::DQuat::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -21599,10 +21197,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "div", |_self: Val, rhs: f64| { - let output: Val = ::bevy::math::DQuat::div( - _self.into_inner(), - rhs, - ) + let output: Val = >::div(_self.into_inner(), rhs) .into(); output }, @@ -21610,7 +21207,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_xyzw", |x: f64, y: f64, z: f64, w: f64| { - let output: Val = ::bevy::math::DQuat::from_xyzw( + let output: Val = bevy::math::DQuat::from_xyzw( x, y, z, @@ -21623,9 +21220,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [f64; 4]| { - let output: Val = ::bevy::math::DQuat::from_array( - a, - ) + let output: Val = bevy::math::DQuat::from_array(a) .into(); output }, @@ -21633,7 +21228,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_vec4", |v: Val| { - let output: Val = ::bevy::math::DQuat::from_vec4( + let output: Val = bevy::math::DQuat::from_vec4( v.into_inner(), ) .into(); @@ -21643,7 +21238,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_axis_angle", |axis: Val, angle: f64| { - let output: Val = ::bevy::math::DQuat::from_axis_angle( + let output: Val = bevy::math::DQuat::from_axis_angle( axis.into_inner(), angle, ) @@ -21654,7 +21249,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_scaled_axis", |v: Val| { - let output: Val = ::bevy::math::DQuat::from_scaled_axis( + let output: Val = bevy::math::DQuat::from_scaled_axis( v.into_inner(), ) .into(); @@ -21664,7 +21259,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_x", |angle: f64| { - let output: Val = ::bevy::math::DQuat::from_rotation_x( + let output: Val = bevy::math::DQuat::from_rotation_x( angle, ) .into(); @@ -21674,7 +21269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_y", |angle: f64| { - let output: Val = ::bevy::math::DQuat::from_rotation_y( + let output: Val = bevy::math::DQuat::from_rotation_y( angle, ) .into(); @@ -21684,7 +21279,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_z", |angle: f64| { - let output: Val = ::bevy::math::DQuat::from_rotation_z( + let output: Val = bevy::math::DQuat::from_rotation_z( angle, ) .into(); @@ -21694,7 +21289,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_euler", |euler: Val, a: f64, b: f64, c: f64| { - let output: Val = ::bevy::math::DQuat::from_euler( + let output: Val = bevy::math::DQuat::from_euler( euler.into_inner(), a, b, @@ -21707,7 +21302,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat3", |mat: Ref| { - let output: Val = ::bevy::math::DQuat::from_mat3( + let output: Val = bevy::math::DQuat::from_mat3( &mat, ) .into(); @@ -21717,7 +21312,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_mat4", |mat: Ref| { - let output: Val = ::bevy::math::DQuat::from_mat4( + let output: Val = bevy::math::DQuat::from_mat4( &mat, ) .into(); @@ -21727,7 +21322,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc", |from: Val, to: Val| { - let output: Val = ::bevy::math::DQuat::from_rotation_arc( + let output: Val = bevy::math::DQuat::from_rotation_arc( from.into_inner(), to.into_inner(), ) @@ -21738,7 +21333,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_colinear", |from: Val, to: Val| { - let output: Val = ::bevy::math::DQuat::from_rotation_arc_colinear( + let output: Val = bevy::math::DQuat::from_rotation_arc_colinear( from.into_inner(), to.into_inner(), ) @@ -21749,7 +21344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_rotation_arc_2d", |from: Val, to: Val| { - let output: Val = ::bevy::math::DQuat::from_rotation_arc_2d( + let output: Val = bevy::math::DQuat::from_rotation_arc_2d( from.into_inner(), to.into_inner(), ) @@ -21760,7 +21355,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_scaled_axis", |_self: Val| { - let output: Val = ::bevy::math::DQuat::to_scaled_axis( + let output: Val = bevy::math::DQuat::to_scaled_axis( _self.into_inner(), ) .into(); @@ -21770,7 +21365,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_euler", |_self: Val, order: Val| { - let output: (f64, f64, f64) = ::bevy::math::DQuat::to_euler( + let output: (f64, f64, f64) = bevy::math::DQuat::to_euler( _self.into_inner(), order.into_inner(), ) @@ -21781,14 +21376,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_array", |_self: Ref| { - let output: [f64; 4] = ::bevy::math::DQuat::to_array(&_self).into(); + let output: [f64; 4] = bevy::math::DQuat::to_array(&_self).into(); output }, ) .overwrite_script_function( "xyz", |_self: Val| { - let output: Val = ::bevy::math::DQuat::xyz( + let output: Val = bevy::math::DQuat::xyz( _self.into_inner(), ) .into(); @@ -21798,7 +21393,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "conjugate", |_self: Val| { - let output: Val = ::bevy::math::DQuat::conjugate( + let output: Val = bevy::math::DQuat::conjugate( _self.into_inner(), ) .into(); @@ -21808,7 +21403,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "inverse", |_self: Val| { - let output: Val = ::bevy::math::DQuat::inverse( + let output: Val = bevy::math::DQuat::inverse( _self.into_inner(), ) .into(); @@ -21818,7 +21413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "dot", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DQuat::dot( + let output: f64 = bevy::math::DQuat::dot( _self.into_inner(), rhs.into_inner(), ) @@ -21829,7 +21424,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length", |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length(_self.into_inner()) + let output: f64 = bevy::math::DQuat::length(_self.into_inner()) .into(); output }, @@ -21837,7 +21432,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_squared", |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length_squared( + let output: f64 = bevy::math::DQuat::length_squared( _self.into_inner(), ) .into(); @@ -21847,9 +21442,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "length_recip", |_self: Val| { - let output: f64 = ::bevy::math::DQuat::length_recip( - _self.into_inner(), - ) + let output: f64 = bevy::math::DQuat::length_recip(_self.into_inner()) .into(); output }, @@ -21857,7 +21450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "normalize", |_self: Val| { - let output: Val = ::bevy::math::DQuat::normalize( + let output: Val = bevy::math::DQuat::normalize( _self.into_inner(), ) .into(); @@ -21867,7 +21460,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_finite(_self.into_inner()) + let output: bool = bevy::math::DQuat::is_finite(_self.into_inner()) .into(); output }, @@ -21875,7 +21468,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_nan", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_nan(_self.into_inner()) + let output: bool = bevy::math::DQuat::is_nan(_self.into_inner()) .into(); output }, @@ -21883,7 +21476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_normalized", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_normalized( + let output: bool = bevy::math::DQuat::is_normalized( _self.into_inner(), ) .into(); @@ -21893,7 +21486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "is_near_identity", |_self: Val| { - let output: bool = ::bevy::math::DQuat::is_near_identity( + let output: bool = bevy::math::DQuat::is_near_identity( _self.into_inner(), ) .into(); @@ -21903,7 +21496,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "angle_between", |_self: Val, rhs: Val| { - let output: f64 = ::bevy::math::DQuat::angle_between( + let output: f64 = bevy::math::DQuat::angle_between( _self.into_inner(), rhs.into_inner(), ) @@ -21918,7 +21511,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_angle: f64| { - let output: Val = ::bevy::math::DQuat::rotate_towards( + let output: Val = bevy::math::DQuat::rotate_towards( &_self, rhs.into_inner(), max_angle, @@ -21934,7 +21527,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { rhs: Val, max_abs_diff: f64| { - let output: bool = ::bevy::math::DQuat::abs_diff_eq( + let output: bool = bevy::math::DQuat::abs_diff_eq( _self.into_inner(), rhs.into_inner(), max_abs_diff, @@ -21946,7 +21539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "lerp", |_self: Val, end: Val, s: f64| { - let output: Val = ::bevy::math::DQuat::lerp( + let output: Val = bevy::math::DQuat::lerp( _self.into_inner(), end.into_inner(), s, @@ -21958,7 +21551,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "slerp", |_self: Val, end: Val, s: f64| { - let output: Val = ::bevy::math::DQuat::slerp( + let output: Val = bevy::math::DQuat::slerp( _self.into_inner(), end.into_inner(), s, @@ -21970,7 +21563,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_vec3", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul_vec3( + let output: Val = bevy::math::DQuat::mul_vec3( _self.into_inner(), rhs.into_inner(), ) @@ -21981,7 +21574,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul_quat", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul_quat( + let output: Val = bevy::math::DQuat::mul_quat( _self.into_inner(), rhs.into_inner(), ) @@ -21992,7 +21585,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_affine3", |a: Ref| { - let output: Val = ::bevy::math::DQuat::from_affine3( + let output: Val = bevy::math::DQuat::from_affine3( &a, ) .into(); @@ -22002,7 +21595,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "as_quat", |_self: Val| { - let output: Val = ::bevy::math::DQuat::as_quat( + let output: Val = bevy::math::DQuat::as_quat( _self.into_inner(), ) .into(); @@ -22012,10 +21605,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "sub", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::sub( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::sub(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -22023,10 +21615,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -22034,10 +21625,9 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "mul", |_self: Val, rhs: Val| { - let output: Val = ::bevy::math::DQuat::mul( - _self.into_inner(), - rhs.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), rhs.into_inner()) .into(); output }, @@ -22046,14 +21636,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::math::EulerRot::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::math::EulerRot::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -22063,7 +21656,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::EulerRot::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -22074,7 +21667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool, z: bool| { - let output: Val = ::bevy::math::BVec3A::new( + let output: Val = bevy::math::BVec3A::new( x, y, z, @@ -22086,7 +21679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec3A::splat(v) + let output: Val = bevy::math::BVec3A::splat(v) .into(); output }, @@ -22094,7 +21687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 3]| { - let output: Val = ::bevy::math::BVec3A::from_array( + let output: Val = bevy::math::BVec3A::from_array( a, ) .into(); @@ -22104,7 +21697,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec3A::bitmask(_self.into_inner()) + let output: u32 = bevy::math::BVec3A::bitmask(_self.into_inner()) .into(); output }, @@ -22112,7 +21705,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec3A::any(_self.into_inner()) + let output: bool = bevy::math::BVec3A::any(_self.into_inner()) .into(); output }, @@ -22120,7 +21713,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec3A::all(_self.into_inner()) + let output: bool = bevy::math::BVec3A::all(_self.into_inner()) .into(); output }, @@ -22128,14 +21721,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec3A::test(&_self, index).into(); + let output: bool = bevy::math::BVec3A::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |mut _self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec3A::set(&mut _self, index, value) + let output: () = bevy::math::BVec3A::set(&mut _self, index, value) .into(); output }, @@ -22143,7 +21736,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::BVec3A::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -22153,7 +21746,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::BVec3A::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ); @@ -22161,7 +21757,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::math::BVec4A::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -22171,7 +21767,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "new", |x: bool, y: bool, z: bool, w: bool| { - let output: Val = ::bevy::math::BVec4A::new( + let output: Val = bevy::math::BVec4A::new( x, y, z, @@ -22184,7 +21780,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "splat", |v: bool| { - let output: Val = ::bevy::math::BVec4A::splat(v) + let output: Val = bevy::math::BVec4A::splat(v) .into(); output }, @@ -22192,7 +21788,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_array", |a: [bool; 4]| { - let output: Val = ::bevy::math::BVec4A::from_array( + let output: Val = bevy::math::BVec4A::from_array( a, ) .into(); @@ -22202,7 +21798,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "bitmask", |_self: Val| { - let output: u32 = ::bevy::math::BVec4A::bitmask(_self.into_inner()) + let output: u32 = bevy::math::BVec4A::bitmask(_self.into_inner()) .into(); output }, @@ -22210,7 +21806,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "any", |_self: Val| { - let output: bool = ::bevy::math::BVec4A::any(_self.into_inner()) + let output: bool = bevy::math::BVec4A::any(_self.into_inner()) .into(); output }, @@ -22218,7 +21814,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "all", |_self: Val| { - let output: bool = ::bevy::math::BVec4A::all(_self.into_inner()) + let output: bool = bevy::math::BVec4A::all(_self.into_inner()) .into(); output }, @@ -22226,14 +21822,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "test", |_self: Ref, index: usize| { - let output: bool = ::bevy::math::BVec4A::test(&_self, index).into(); + let output: bool = bevy::math::BVec4A::test(&_self, index).into(); output }, ) .overwrite_script_function( "set", |mut _self: Mut, index: usize, value: bool| { - let output: () = ::bevy::math::BVec4A::set(&mut _self, index, value) + let output: () = bevy::math::BVec4A::set(&mut _self, index, value) .into(); output }, @@ -22241,7 +21837,10 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, rhs: Ref| { - let output: bool = ::bevy::math::BVec4A::eq(&_self, &rhs).into(); + let output: bool = >::eq(&_self, &rhs) + .into(); output }, ); @@ -22249,7 +21848,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_string", |_self: Ref| { - let output: std::string::String = ::smol_str::SmolStr::to_string( + let output: std::string::String = smol_str::SmolStr::to_string( &_self, ) .into(); @@ -22259,21 +21858,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "len", |_self: Ref| { - let output: usize = ::smol_str::SmolStr::len(&_self).into(); + let output: usize = smol_str::SmolStr::len(&_self).into(); output }, ) .overwrite_script_function( "is_empty", |_self: Ref| { - let output: bool = ::smol_str::SmolStr::is_empty(&_self).into(); + let output: bool = smol_str::SmolStr::is_empty(&_self).into(); output }, ) .overwrite_script_function( "is_heap_allocated", |_self: Ref| { - let output: bool = ::smol_str::SmolStr::is_heap_allocated(&_self) + let output: bool = smol_str::SmolStr::is_heap_allocated(&_self) .into(); output }, @@ -22281,14 +21880,17 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::smol_str::SmolStr::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::smol_str::SmolStr::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -22299,35 +21901,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "nil", || { - let output: Val = ::uuid::Uuid::nil().into(); + let output: Val = uuid::Uuid::nil().into(); output }, ) .overwrite_script_function( "max", || { - let output: Val = ::uuid::Uuid::max().into(); + let output: Val = uuid::Uuid::max().into(); output }, ) .overwrite_script_function( "from_u128", |v: u128| { - let output: Val = ::uuid::Uuid::from_u128(v).into(); + let output: Val = uuid::Uuid::from_u128(v).into(); output }, ) .overwrite_script_function( "from_u128_le", |v: u128| { - let output: Val = ::uuid::Uuid::from_u128_le(v).into(); + let output: Val = uuid::Uuid::from_u128_le(v).into(); output }, ) .overwrite_script_function( "from_u64_pair", |high_bits: u64, low_bits: u64| { - let output: Val = ::uuid::Uuid::from_u64_pair( + let output: Val = uuid::Uuid::from_u64_pair( high_bits, low_bits, ) @@ -22338,21 +21940,23 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "from_bytes", |bytes: [u8; 16]| { - let output: Val = ::uuid::Uuid::from_bytes(bytes).into(); + let output: Val = uuid::Uuid::from_bytes(bytes).into(); output }, ) .overwrite_script_function( "from_bytes_le", |b: [u8; 16]| { - let output: Val = ::uuid::Uuid::from_bytes_le(b).into(); + let output: Val = uuid::Uuid::from_bytes_le(b).into(); output }, ) .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::uuid::Uuid::assert_receiver_is_total_eq(&_self) + let output: () = ::assert_receiver_is_total_eq( + &_self, + ) .into(); output }, @@ -22360,35 +21964,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "get_version_num", |_self: Ref| { - let output: usize = ::uuid::Uuid::get_version_num(&_self).into(); + let output: usize = uuid::Uuid::get_version_num(&_self).into(); output }, ) .overwrite_script_function( "as_u128", |_self: Ref| { - let output: u128 = ::uuid::Uuid::as_u128(&_self).into(); + let output: u128 = uuid::Uuid::as_u128(&_self).into(); output }, ) .overwrite_script_function( "to_u128_le", |_self: Ref| { - let output: u128 = ::uuid::Uuid::to_u128_le(&_self).into(); + let output: u128 = uuid::Uuid::to_u128_le(&_self).into(); output }, ) .overwrite_script_function( "as_u64_pair", |_self: Ref| { - let output: (u64, u64) = ::uuid::Uuid::as_u64_pair(&_self).into(); + let output: (u64, u64) = uuid::Uuid::as_u64_pair(&_self).into(); output }, ) .overwrite_script_function( "into_bytes", |_self: Val| { - let output: [u8; 16] = ::uuid::Uuid::into_bytes(_self.into_inner()) + let output: [u8; 16] = uuid::Uuid::into_bytes(_self.into_inner()) .into(); output }, @@ -22396,28 +22000,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { .overwrite_script_function( "to_bytes_le", |_self: Ref| { - let output: [u8; 16] = ::uuid::Uuid::to_bytes_le(&_self).into(); + let output: [u8; 16] = uuid::Uuid::to_bytes_le(&_self).into(); output }, ) .overwrite_script_function( "is_nil", |_self: Ref| { - let output: bool = ::uuid::Uuid::is_nil(&_self).into(); + let output: bool = uuid::Uuid::is_nil(&_self).into(); output }, ) .overwrite_script_function( "is_max", |_self: Ref| { - let output: bool = ::uuid::Uuid::is_max(&_self).into(); + let output: bool = uuid::Uuid::is_max(&_self).into(); output }, ) .overwrite_script_function( "encode_buffer", || { - let output: [u8; 45] = ::uuid::Uuid::encode_buffer().into(); + let output: [u8; 45] = uuid::Uuid::encode_buffer().into(); output }, ) @@ -22426,28 +22030,34 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { |_self: Ref| { let output: bevy::reflect::erased_serde::__private::serde::__private::Option< [u8; 6], - > = ::uuid::Uuid::get_node_id(&_self).into(); + > = uuid::Uuid::get_node_id(&_self).into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::uuid::Uuid::eq(&_self, &other).into(); + let output: bool = >::eq(&_self, &other) + .into(); output }, ) .overwrite_script_function( "new_v4", || { - let output: Val = ::uuid::Uuid::new_v4().into(); + let output: Val = uuid::Uuid::new_v4().into(); output }, ) .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::uuid::Uuid::clone(&_self).into(); + let output: Val = ::clone( + &_self, + ) + .into(); output }, ); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs index 325c38597b..ecbed790e0 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -17,7 +17,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::time::prelude::Fixed::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -28,7 +28,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::time::prelude::Real::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -39,7 +39,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::time::prelude::Timer::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -49,7 +49,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "from_seconds", |duration: f32, mode: Val| { - let output: Val = ::bevy::time::prelude::Timer::from_seconds( + let output: Val = bevy::time::prelude::Timer::from_seconds( duration, mode.into_inner(), ) @@ -60,7 +60,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "finished", |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::finished(&_self) + let output: bool = bevy::time::prelude::Timer::finished(&_self) .into(); output }, @@ -68,9 +68,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "just_finished", |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::just_finished( - &_self, - ) + let output: bool = bevy::time::prelude::Timer::just_finished(&_self) .into(); output }, @@ -78,7 +76,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::elapsed_secs(&_self) + let output: f32 = bevy::time::prelude::Timer::elapsed_secs(&_self) .into(); output }, @@ -86,7 +84,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = ::bevy::time::prelude::Timer::elapsed_secs_f64( + let output: f64 = bevy::time::prelude::Timer::elapsed_secs_f64( &_self, ) .into(); @@ -96,7 +94,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "mode", |_self: Ref| { - let output: Val = ::bevy::time::prelude::Timer::mode( + let output: Val = bevy::time::prelude::Timer::mode( &_self, ) .into(); @@ -109,7 +107,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { mut _self: Mut, mode: Val| { - let output: () = ::bevy::time::prelude::Timer::set_mode( + let output: () = bevy::time::prelude::Timer::set_mode( &mut _self, mode.into_inner(), ) @@ -120,7 +118,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |mut _self: Mut| { - let output: () = ::bevy::time::prelude::Timer::pause(&mut _self) + let output: () = bevy::time::prelude::Timer::pause(&mut _self) .into(); output }, @@ -128,7 +126,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "unpause", |mut _self: Mut| { - let output: () = ::bevy::time::prelude::Timer::unpause(&mut _self) + let output: () = bevy::time::prelude::Timer::unpause(&mut _self) .into(); output }, @@ -136,15 +134,14 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "paused", |_self: Ref| { - let output: bool = ::bevy::time::prelude::Timer::paused(&_self) - .into(); + let output: bool = bevy::time::prelude::Timer::paused(&_self).into(); output }, ) .overwrite_script_function( "reset", |mut _self: Mut| { - let output: () = ::bevy::time::prelude::Timer::reset(&mut _self) + let output: () = bevy::time::prelude::Timer::reset(&mut _self) .into(); output }, @@ -152,7 +149,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "fraction", |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::fraction(&_self) + let output: f32 = bevy::time::prelude::Timer::fraction(&_self) .into(); output }, @@ -160,7 +157,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "fraction_remaining", |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::fraction_remaining( + let output: f32 = bevy::time::prelude::Timer::fraction_remaining( &_self, ) .into(); @@ -170,9 +167,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "remaining_secs", |_self: Ref| { - let output: f32 = ::bevy::time::prelude::Timer::remaining_secs( - &_self, - ) + let output: f32 = bevy::time::prelude::Timer::remaining_secs(&_self) .into(); output }, @@ -180,7 +175,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "times_finished_this_tick", |_self: Ref| { - let output: u32 = ::bevy::time::prelude::Timer::times_finished_this_tick( + let output: u32 = bevy::time::prelude::Timer::times_finished_this_tick( &_self, ) .into(); @@ -190,7 +185,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::time::prelude::Timer::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -203,7 +198,9 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::time::prelude::Timer::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -215,10 +212,9 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::time::prelude::TimerMode::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -226,7 +222,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::time::prelude::TimerMode::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -236,7 +232,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::time::prelude::TimerMode::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -247,7 +243,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::time::prelude::Virtual::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -258,7 +254,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "assert_receiver_is_total_eq", |_self: Ref| { - let output: () = ::bevy::time::Stopwatch::assert_receiver_is_total_eq( + let output: () = ::assert_receiver_is_total_eq( &_self, ) .into(); @@ -268,7 +264,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "new", || { - let output: Val = ::bevy::time::Stopwatch::new() + let output: Val = bevy::time::Stopwatch::new() .into(); output }, @@ -276,15 +272,14 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "elapsed_secs", |_self: Ref| { - let output: f32 = ::bevy::time::Stopwatch::elapsed_secs(&_self) - .into(); + let output: f32 = bevy::time::Stopwatch::elapsed_secs(&_self).into(); output }, ) .overwrite_script_function( "elapsed_secs_f64", |_self: Ref| { - let output: f64 = ::bevy::time::Stopwatch::elapsed_secs_f64(&_self) + let output: f64 = bevy::time::Stopwatch::elapsed_secs_f64(&_self) .into(); output }, @@ -292,35 +287,37 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "pause", |mut _self: Mut| { - let output: () = ::bevy::time::Stopwatch::pause(&mut _self).into(); + let output: () = bevy::time::Stopwatch::pause(&mut _self).into(); output }, ) .overwrite_script_function( "unpause", |mut _self: Mut| { - let output: () = ::bevy::time::Stopwatch::unpause(&mut _self).into(); + let output: () = bevy::time::Stopwatch::unpause(&mut _self).into(); output }, ) .overwrite_script_function( "is_paused", |_self: Ref| { - let output: bool = ::bevy::time::Stopwatch::is_paused(&_self).into(); + let output: bool = bevy::time::Stopwatch::is_paused(&_self).into(); output }, ) .overwrite_script_function( "reset", |mut _self: Mut| { - let output: () = ::bevy::time::Stopwatch::reset(&mut _self).into(); + let output: () = bevy::time::Stopwatch::reset(&mut _self).into(); output }, ) .overwrite_script_function( "eq", |_self: Ref, other: Ref| { - let output: bool = ::bevy::time::Stopwatch::eq(&_self, &other) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -328,7 +325,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::time::Stopwatch::clone( + let output: Val = ::clone( &_self, ) .into(); diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs index 7a753a3bed..5f675b030d 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -20,7 +20,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::transform::components::GlobalTransform::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -33,10 +33,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::transform::components::GlobalTransform::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -44,7 +43,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::transform::components::GlobalTransform::from_xyz( + let output: Val = bevy::transform::components::GlobalTransform::from_xyz( x, y, z, @@ -56,7 +55,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "compute_transform", |_self: Ref| { - let output: Val = ::bevy::transform::components::GlobalTransform::compute_transform( + let output: Val = bevy::transform::components::GlobalTransform::compute_transform( &_self, ) .into(); @@ -69,7 +68,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, parent: Ref| { - let output: Val = ::bevy::transform::components::GlobalTransform::reparented_to( + let output: Val = bevy::transform::components::GlobalTransform::reparented_to( &_self, &parent, ) @@ -83,7 +82,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, transform: Val| { - let output: Val = ::bevy::transform::components::GlobalTransform::mul_transform( + let output: Val = bevy::transform::components::GlobalTransform::mul_transform( &_self, transform.into_inner(), ) @@ -97,10 +96,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, global_transform: Val| { - let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into_inner(), - global_transform.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), global_transform.into_inner()) .into(); output }, @@ -111,10 +109,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, transform: Val| { - let output: Val = ::bevy::transform::components::GlobalTransform::mul( - _self.into_inner(), - transform.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), transform.into_inner()) .into(); output }, @@ -123,7 +120,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "clone", |_self: Ref| { - let output: Val = ::bevy::transform::components::Transform::clone( + let output: Val = ::clone( &_self, ) .into(); @@ -136,10 +133,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, other: Ref| { - let output: bool = ::bevy::transform::components::Transform::eq( - &_self, - &other, - ) + let output: bool = >::eq(&_self, &other) .into(); output }, @@ -150,10 +146,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, global_transform: Val| { - let output: Val = ::bevy::transform::components::Transform::mul( - _self.into_inner(), - global_transform.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), global_transform.into_inner()) .into(); output }, @@ -161,7 +156,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "from_xyz", |x: f32, y: f32, z: f32| { - let output: Val = ::bevy::transform::components::Transform::from_xyz( + let output: Val = bevy::transform::components::Transform::from_xyz( x, y, z, @@ -173,7 +168,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_x", |mut _self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_x( + let output: () = bevy::transform::components::Transform::rotate_x( &mut _self, angle, ) @@ -184,7 +179,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_y", |mut _self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_y( + let output: () = bevy::transform::components::Transform::rotate_y( &mut _self, angle, ) @@ -195,7 +190,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_z", |mut _self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_z( + let output: () = bevy::transform::components::Transform::rotate_z( &mut _self, angle, ) @@ -206,7 +201,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_local_x", |mut _self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_local_x( + let output: () = bevy::transform::components::Transform::rotate_local_x( &mut _self, angle, ) @@ -217,7 +212,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_local_y", |mut _self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_local_y( + let output: () = bevy::transform::components::Transform::rotate_local_y( &mut _self, angle, ) @@ -228,7 +223,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "rotate_local_z", |mut _self: Mut, angle: f32| { - let output: () = ::bevy::transform::components::Transform::rotate_local_z( + let output: () = bevy::transform::components::Transform::rotate_local_z( &mut _self, angle, ) @@ -242,7 +237,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Ref, transform: Val| { - let output: Val = ::bevy::transform::components::Transform::mul_transform( + let output: Val = bevy::transform::components::Transform::mul_transform( &_self, transform.into_inner(), ) @@ -253,7 +248,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { .overwrite_script_function( "is_finite", |_self: Ref| { - let output: bool = ::bevy::transform::components::Transform::is_finite( + let output: bool = bevy::transform::components::Transform::is_finite( &_self, ) .into(); @@ -266,10 +261,9 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { _self: Val, transform: Val| { - let output: Val = ::bevy::transform::components::Transform::mul( - _self.into_inner(), - transform.into_inner(), - ) + let output: Val = >::mul(_self.into_inner(), transform.into_inner()) .into(); output }, From 98319a2acbad5a7d7e32d9f7b948d889ec9ef2c2 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 29 Dec 2024 00:36:39 +0000 Subject: [PATCH 121/217] get bindings compiling, add more impls --- .../src/bindings/function/from.rs | 25 +++++++++++++++++ .../src/bindings/function/into.rs | 24 +++++++++++++++++ .../src/bindings/function/script_function.rs | 27 ++++++++++++++----- crates/bevy_mod_scripting_core/src/error.rs | 12 ++++++++- .../bevy_mod_scripting_functions/Cargo.toml | 1 + 5 files changed, 81 insertions(+), 8 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index f8155c0f72..00a354c882 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -360,3 +360,28 @@ where } } } + +impl FromScript for [T; N] +where + for<'w> T::This<'w>: Into, +{ + type This<'w> = Self; + + fn from_script(value: ScriptValue, world: WorldGuard) -> Result { + match value { + ScriptValue::List(list) if list.len() == N => { + let converted_list = list + .into_iter() + .map(|item| T::from_script(item, world.clone()).map(Into::into)) + .collect::, _>>()? + .try_into() + .map_err(|list: Vec| InteropError::length_mismatch(N, list.len()))?; + Ok(converted_list) + } + _ => Err(InteropError::value_mismatch( + std::any::TypeId::of::<[T; N]>(), + value, + )), + } + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index 96c28fd439..704e748c0e 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -132,8 +132,32 @@ impl IntoScript for Vec { } } +impl IntoScript for [T; N] { + fn into_script(self, world: WorldGuard) -> Result { + let mut values = Vec::with_capacity(N); + for val in self { + values.push(val.into_script(world.clone())?); + } + Ok(ScriptValue::List(values)) + } +} + impl IntoScript for InteropError { fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Error(self)) } } + +macro_rules! impl_into_script_tuple { + ($( $ty:ident ),* ) => { + #[allow(non_snake_case)] + impl<$($ty: IntoScript),*> IntoScript for ($($ty,)*) { + fn into_script(self, world: WorldGuard) -> Result { + let ($($ty,)*) = self; + Ok(ScriptValue::List(vec![$($ty.into_script(world.clone())?),*])) + } + } +} +} + +bevy::utils::all_tuples!(impl_into_script_tuple, 1, 14, T); diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index aab708cabd..6acec8477c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -15,6 +15,7 @@ use bevy::{ }, }; use std::collections::HashMap; +use std::hash::Hash; use std::sync::Arc; #[diagnostic::on_unimplemented( @@ -25,6 +26,7 @@ pub trait ScriptFunction<'env, Marker> { fn into_dynamic_function(self) -> DynamicFunction<'static>; } +/// Functionally identical to [`GetTypeRegistration`] but without the 'static bound pub trait GetInnerTypeDependencies { fn register_type_dependencies(registry: &mut TypeRegistry); } @@ -54,9 +56,9 @@ macro_rules! self_type_dependency_only { } macro_rules! recursive_type_dependencies { - ($( ($path:path where $($bound:ident : $($bound_val:path);*),* $(=> with $self_:ident)?) ),* ) => { + ($( ($path:ty where $($bound:ident : $($bound_val:path);*),* $(,,const $const:ident : $const_ty:ty)? $(=> with $self_:ident)?) ),* ) => { $( - impl<$($bound : $($bound_val +)*),*> GetInnerTypeDependencies for $path { + impl<$($bound : $($bound_val +)*),* , $(const $const : $const_ty )?> GetInnerTypeDependencies for $path { fn register_type_dependencies(registry: &mut TypeRegistry) { $( registry.register::<$bound>(); @@ -70,6 +72,18 @@ macro_rules! recursive_type_dependencies { }; } +macro_rules! register_tuple_dependencies { + ($($ty:ident),*) => { + impl<$($ty: GetTypeRegistration + Typed),*> GetInnerTypeDependencies for ($($ty,)*) { + fn register_type_dependencies(registry: &mut TypeRegistry) { + $( + registry.register::<$ty>(); + )* + } + } + }; +} + no_type_dependencies!(ReflectReference, InteropError); self_type_dependency_only!(WorldCallbackAccess); @@ -78,14 +92,13 @@ recursive_type_dependencies!( (Ref<'_, T> where T: GetTypeRegistration), (Mut<'_, T> where T: GetTypeRegistration), (Result where T: GetTypeRegistration), + ([T; N] where T: GetTypeRegistration;Typed,, const N: usize => with Self), (Option where T: GetTypeRegistration;FromReflect;Typed => with Self), - (Vec where T: GetTypeRegistration;FromReflect;Typed => with Self) -); - -recursive_type_dependencies!( - (HashMap where K: GetTypeRegistration, V: GetTypeRegistration) + (Vec where T: GetTypeRegistration;FromReflect;Typed => with Self), + (HashMap where K: GetTypeRegistration;FromReflect;Typed;Hash;Eq, V: GetTypeRegistration;FromReflect;Typed => with Self) ); +bevy::utils::all_tuples!(register_tuple_dependencies, 1, 14, T); pub trait GetFunctionTypeDependencies { fn register_type_dependencies(registry: &mut TypeRegistry); } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index c93a8d00a7..c5e862aa3e 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -369,7 +369,10 @@ impl InteropError { error })) } - + pub fn length_mismatch(expected: usize, got: usize) -> Self { + Self(Arc::new(InteropErrorInner::LengthMismatch { expected, got })) + } + pub fn external_error(error: Box) -> Self { Self(Arc::new(InteropErrorInner::OtherError { error })) } @@ -429,6 +432,10 @@ pub enum InteropErrorInner { expected: TypeId, got: ScriptValue, }, + LengthMismatch { + expected: usize, + got: usize, + }, CouldNotDowncast { from: ReflectReference, to: TypeId, @@ -610,6 +617,9 @@ impl DisplayWithWorld for InteropErrorInner { format!("Unfinished conversion in context of: {}. A better conversion exists but caller didn't handle the case.", context) }, InteropErrorInner::OtherError { error } => error.to_string(), + InteropErrorInner::LengthMismatch { expected, got } => { + format!("Array/List Length mismatch, expected: {}, got: {}", expected, got) + }, } } } diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index db912de8c1..8b5486d770 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -21,4 +21,5 @@ bevy = { workspace = true, features = [ "reflect_functions", ] } uuid = "*" +smol_str = "*" bevy_mod_scripting_core = { workspace = true, optional = true } From ef9087246d8c8d9c7a204a1f76f98a0016bcf360 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 29 Dec 2024 02:48:03 +0000 Subject: [PATCH 122/217] get static calls working --- .../src/bindings/query.rs | 10 +- crates/bevy_mod_scripting_core/src/error.rs | 65 +- .../bevy_mod_scripting_functions/Cargo.toml | 5 +- .../bevy_mod_scripting_functions/src/core.rs | 49 +- .../bevy_mod_scripting_functions/src/lib.rs | 24 +- .../bevy_mod_scripting_lua/Cargo.toml | 4 +- .../bevy_mod_scripting_lua/src/assets.rs | 156 ---- .../src/bindings/mod.rs | 4 - .../src/bindings/query.rs | 121 --- .../src/bindings/reference.rs | 28 + .../src/bindings/type_registration.rs | 41 - .../bevy_mod_scripting_lua/src/docs.rs | 190 ---- .../bevy_mod_scripting_lua/src/lib.rs | 37 +- .../bevy_mod_scripting_lua/src/type_data.rs | 877 ------------------ .../data/despawn/invalid_entity_errors.lua | 2 +- .../invalid_entity_errors.lua | 2 +- .../invalid_entity_errors.lua | 2 +- .../has_children_returns_them.lua | 2 +- .../get_children/invalid_entity_errors.lua | 2 +- .../data/get_parent/invalid_entity_errors.lua | 2 +- .../insert_children/invalid_entity_errors.lua | 4 +- .../push_children/invalid_entity_errors.lua | 4 +- .../query/empty_query_returns_nothing.lua | 2 +- .../query_returns_all_entities_matching.lua | 6 +- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 3 +- 25 files changed, 170 insertions(+), 1472 deletions(-) delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/assets.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/docs.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/type_data.rs diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index 875602831e..a99f38fa21 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -104,7 +104,10 @@ impl ScriptQueryBuilder { #[derive(Clone, Reflect)] #[reflect(opaque)] -pub struct ScriptQueryResult(pub Entity, pub Vec); +pub struct ScriptQueryResult { + pub entity: Entity, + pub components: Vec, +} impl WorldCallbackAccess { pub fn query( @@ -159,7 +162,10 @@ impl<'w> WorldAccessGuard<'w> { reflect_path: ParsedPath(vec![]), }) .collect(); - ScriptQueryResult(r.id(), references) + ScriptQueryResult { + entity: r.id(), + components: references, + } }) .collect()) }) diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index c5e862aa3e..b59d8d3cac 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -18,7 +18,9 @@ use thiserror::Error; use crate::{ bindings::{ - access_map::DisplayCodeLocation, pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference + access_map::DisplayCodeLocation, + pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, + ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference, }, impl_dummy_display, prelude::ScriptValue, @@ -201,16 +203,16 @@ impl From for ScriptError { } } -pub trait FlattenError { +pub trait FlattenError { fn flatten_interop_error(self) -> Result; } -impl FlattenError for Result, InteropError> { +impl FlattenError for Result, InteropError> { fn flatten_interop_error(self) -> Result { match self { Ok(Ok(o)) => Ok(o), Ok(Err(e)) => Err(e), - Err(e) => Err(e) + Err(e) => Err(e), } } } @@ -254,8 +256,14 @@ impl InteropError { /// Thrown if access to the given reflection base is required but cannot be claimed. /// This is likely due to some other script already claiming access to the base. - pub fn cannot_claim_access(base: ReflectBaseType, location: Option>) -> Self { - Self(Arc::new(InteropErrorInner::CannotClaimAccess { base, location })) + pub fn cannot_claim_access( + base: ReflectBaseType, + location: Option>, + ) -> Self { + Self(Arc::new(InteropErrorInner::CannotClaimAccess { + base, + location, + })) } /// Thrown if a conversion into the given type is impossible. @@ -266,11 +274,11 @@ impl InteropError { /// Thrown if a conversion was not fully completed, as a better conversion exists. /// If a function might throw this error it should be handled by the caller. - /// + /// /// A user seeing this error is evidence of unfinished logic. pub fn better_conversion_exists() -> Self { - Self(Arc::new(InteropErrorInner::BetterConversionExists{ - context: std::any::type_name::().to_string() + Self(Arc::new(InteropErrorInner::BetterConversionExists { + context: std::any::type_name::().to_string(), })) } @@ -343,10 +351,7 @@ impl InteropError { } /// Thrown when an error happens in a function call. The inner error provides details on the error. - pub fn function_interop_error( - function_info: &FunctionInfo, - error: InteropError, - ) -> Self { + pub fn function_interop_error(function_info: &FunctionInfo, error: InteropError) -> Self { Self(Arc::new(InteropErrorInner::FunctionInteropError { function_name: function_info .name() @@ -366,17 +371,27 @@ impl InteropError { pub fn function_arg_conversion_error(argument: String, error: InteropError) -> Self { Self(Arc::new(InteropErrorInner::FunctionArgConversionError { argument, - error + error, })) } pub fn length_mismatch(expected: usize, got: usize) -> Self { - Self(Arc::new(InteropErrorInner::LengthMismatch { expected, got })) + Self(Arc::new(InteropErrorInner::LengthMismatch { + expected, + got, + })) } - + pub fn external_error(error: Box) -> Self { Self(Arc::new(InteropErrorInner::OtherError { error })) } + pub fn missing_function(on: TypeId, function_name: String) -> Self { + Self(Arc::new(InteropErrorInner::MissingFunctionError { + on, + function_name, + })) + } + pub fn inner(&self) -> &InteropErrorInner { &self.0 } @@ -418,7 +433,7 @@ pub enum InteropErrorInner { into: TypeId, }, BetterConversionExists { - context: String + context: String, }, TypeMismatch { expected: TypeId, @@ -465,13 +480,17 @@ pub enum InteropErrorInner { FunctionCallError { inner: FunctionError, }, + MissingFunctionError { + on: TypeId, + function_name: String, + }, FunctionInteropError { function_name: String, error: InteropError, }, FunctionArgConversionError { argument: String, - error: InteropError + error: InteropError, }, OtherError { error: Box, @@ -487,7 +506,13 @@ impl PartialEq for InteropErrorInner { impl DisplayWithWorld for InteropErrorInner { fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { match self { - + InteropErrorInner::MissingFunctionError { on, function_name } => { + format!( + "Could not find function: {} for type: {}", + function_name, + on.display_with_world(world) + ) + }, InteropErrorInner::UnregisteredBase { base } => { format!("Unregistered base type: {}", base.display_with_world(world)) } @@ -629,4 +654,4 @@ impl Default for InteropErrorInner { fn default() -> Self { InteropErrorInner::StaleWorldAccess } -} \ No newline at end of file +} diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 8b5486d770..da75c7b755 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -12,8 +12,7 @@ categories = ["game-development"] readme = "readme.md" [features] -default = ["core_functions"] -core_functions = ["bevy_mod_scripting_core"] + [dependencies] @@ -22,4 +21,4 @@ bevy = { workspace = true, features = [ ] } uuid = "*" smol_str = "*" -bevy_mod_scripting_core = { workspace = true, optional = true } +bevy_mod_scripting_core = { workspace = true } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index fa3431f3a8..3cf2828485 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -24,9 +24,7 @@ use bindings::{ use error::InteropError; use reflection_extensions::TypeIdExtensions; -use crate::namespaced_register::NamespaceBuilder; - -pub struct CoreFunctionsPlugin; +use crate::{bevy_bindings::LuaBevyScriptingPlugin, namespaced_register::NamespaceBuilder}; pub trait RegisterScriptFunction { fn overwrite_script_function(&mut self, name: N, f: F) -> &mut Self @@ -52,23 +50,11 @@ impl RegisterScriptFunction for NamespaceBuilder<'_, S> { } } -impl Plugin for CoreFunctionsPlugin { - fn build(&self, app: &mut App) { - let world = app.world_mut(); - register_world_functions(world).expect("Failed to register world functions"); - - register_reflect_reference_functions(world) - .expect("Failed to register reflect reference functions"); - - register_script_type_registration_functions(world) - .expect("Failed to register script type registration functions"); - - register_script_query_builder_functions(world) - .expect("Failed to register script query builder functions"); - } +pub fn register_bevy_bindings(app: &mut App) { + app.add_plugins(LuaBevyScriptingPlugin); } -fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { +pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) .overwrite_script_function("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) .overwrite_script_function( @@ -180,7 +166,9 @@ fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationE Ok(()) } -fn register_reflect_reference_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { +pub fn register_reflect_reference_functions( + reg: &mut World, +) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) .overwrite_script_function( "display_ref", @@ -273,7 +261,7 @@ fn register_reflect_reference_functions(reg: &mut World) -> Result<(), FunctionR Ok(()) } -fn register_script_type_registration_functions( +pub fn register_script_type_registration_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) @@ -290,7 +278,7 @@ fn register_script_type_registration_functions( Ok(()) } -fn register_script_query_builder_functions( +pub fn register_script_query_builder_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) @@ -322,11 +310,14 @@ fn register_script_query_builder_functions( Ok(()) } -// fn register_script_query_result_functions( -// registry: &mut FunctionRegistry, -// ) -> Result<(), FunctionRegistrationError> { -// NamespaceBuilder::::new(registry) -// .overwrite_script_function("entity", |s: Ref| s.entity()) -// .overwrite_script_function("components", |s: Ref| s.components()); -// Ok(()) -// } +pub fn register_script_query_result_functions( + world: &mut World, +) -> Result<(), FunctionRegistrationError> { + NamespaceBuilder::::new(world) + .overwrite_script_function("entity", |s: Ref| Val::new(s.entity)) + .overwrite_script_function("components", |s: Ref| { + let components = s.components.to_vec(); + Val::new(components) + }); + Ok(()) +} diff --git a/crates/bevy_mod_scripting_functions/src/lib.rs b/crates/bevy_mod_scripting_functions/src/lib.rs index 579ed2e3cc..0dcc70afee 100644 --- a/crates/bevy_mod_scripting_functions/src/lib.rs +++ b/crates/bevy_mod_scripting_functions/src/lib.rs @@ -1,7 +1,5 @@ use ::bevy::prelude::*; -#[cfg(feature = "core_functions")] pub mod bevy_bindings; -#[cfg(feature = "core_functions")] pub mod core; pub mod namespaced_register; @@ -9,11 +7,25 @@ pub mod namespaced_register; pub use core::*; pub use namespaced_register::*; -pub struct BevyFunctionsPlugin; +pub struct ScriptFunctionsPlugin; -impl Plugin for BevyFunctionsPlugin { +impl Plugin for ScriptFunctionsPlugin { fn build(&self, app: &mut App) { - #[cfg(feature = "core_functions")] - app.add_plugins(core::CoreFunctionsPlugin); + register_bevy_bindings(app); + let world = app.world_mut(); + + register_world_functions(world).expect("Failed to register world functions"); + + register_reflect_reference_functions(world) + .expect("Failed to register reflect reference functions"); + + register_script_type_registration_functions(world) + .expect("Failed to register script type registration functions"); + + register_script_query_builder_functions(world) + .expect("Failed to register script query builder functions"); + + register_script_query_result_functions(world) + .expect("Failed to register script query result functions"); } } diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 0f002f3940..ca166968b5 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -42,9 +42,7 @@ path = "src/lib.rs" [dependencies] bevy = { workspace = true, default-features = false } bevy_mod_scripting_core = { workspace = true, features = ["mlua_impls"] } -bevy_mod_scripting_functions = { workspace = true, features = [ - "core_functions", -] } +bevy_mod_scripting_functions = { workspace = true, features = [] } bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } mlua = { workspace = true, features = ["vendored", "send", "macros"] } parking_lot = "0.12.1" diff --git a/crates/languages/bevy_mod_scripting_lua/src/assets.rs b/crates/languages/bevy_mod_scripting_lua/src/assets.rs deleted file mode 100644 index 79352f5d45..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/assets.rs +++ /dev/null @@ -1,156 +0,0 @@ -// use bevy::{ -// asset::{io::Reader, Asset, AssetLoader}, -// reflect::TypePath, -// utils::BoxedFuture, -// }; - -// use anyhow::Error; - -// #[derive(Asset, TypePath, Debug)] -// /// A lua code file in bytes -// pub struct LuaFile { -// pub bytes: Vec, -// } - -// impl CodeAsset for LuaFile { -// fn bytes(&self) -> &[u8] { -// self.bytes.as_slice() -// } -// } - -// #[derive(Default)] -// /// Asset loader for lua scripts -// pub struct LuaLoader; - -// fn old_lua_load<'a>( -// bytes: &'a [u8], -// load_context: &'a mut bevy::asset::LoadContext, -// ) -> BoxedFuture<'a, Result, Error>> { -// match load_context.path().extension().map(|s| s.to_str().unwrap()) { -// #[cfg(all(feature = "teal", debug_assertions))] -// Some("tl") => { -// use bevy::asset::io::file::FileAssetReader; -// use std::fs; -// use std::path::PathBuf; -// use std::process::Command; - -// let scripts_dir = &FileAssetReader::get_base_path() -// .join("assets") -// .join("scripts"); - -// let temp_file_path = &std::env::temp_dir().join("bevy_mod_scripting.temp.lua"); -// bevy::prelude::info!("tl file path {}", scripts_dir.to_str().unwrap()); -// // optionally put the output in the /build folder -// let build_dir_path: Option = -// if load_context.path().starts_with("scripts/build/") { -// Some( -// load_context -// .path() -// .strip_prefix("scripts/") -// .unwrap() -// .to_owned(), -// ) -// } else if load_context.path().starts_with("scripts/") { -// Some( -// PathBuf::from("build/") -// .join(load_context.path().strip_prefix("scripts/").unwrap()), -// ) -// } else { -// None -// }; - -// let full_path = &FileAssetReader::get_base_path() -// .join("assets") -// .join(load_context.path()); -// bevy::log::info!( -// "tl check {} : {}", -// full_path.to_str().unwrap(), -// scripts_dir.to_str().unwrap() -// ); -// if let Ok(e) = Command::new("tl") -// .args(["check", full_path.to_str().unwrap()]) -// .current_dir(scripts_dir) -// .status() -// { -// if !e.success() { -// return Box::pin(async move { -// Err(Error::msg(format!( -// "Teal file `{}` has errors", -// load_context.path().to_str().unwrap() -// ))) -// }); -// } -// } else { -// fs::remove_file(temp_file_path).expect("Something went wrong running `tl check`"); -// panic!("Something went wrong running `tl check`"); -// } - -// if let Ok(e) = Command::new("tl") -// .args([ -// "gen", -// full_path.to_str().unwrap(), -// "-o", -// temp_file_path.to_str().unwrap(), -// ]) -// .current_dir(scripts_dir) -// .status() -// { -// if !e.success() { -// return Box::pin(async move { -// Err(Error::msg(format!( -// "Teal file `{}` could not be compiled!", -// load_context.path().to_str().unwrap() -// ))) -// }); -// } -// } else { -// fs::remove_file(temp_file_path).expect("Something went wrong running `tl gen`"); -// panic!("Something went wrong running `tl gen`") -// } - -// if let Some(mut build_dir_path) = build_dir_path { -// build_dir_path = scripts_dir.join(build_dir_path); -// let _ = fs::create_dir_all(build_dir_path.parent().unwrap()); -// let _ = fs::copy(temp_file_path, build_dir_path.with_extension("lua")); -// } - -// let lua_code = -// fs::read_to_string(temp_file_path).expect("Could not find output lua file"); -// fs::remove_file(temp_file_path).unwrap(); - -// Box::pin(async move { Ok(lua_code.as_bytes().into()) }) -// } - -// _ => Box::pin(async move { Ok(bytes.into()) }), -// } -// } -// impl AssetLoader for LuaLoader { -// type Asset = LuaFile; -// type Settings = (); -// type Error = 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()); -// 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")] -// fn extensions(&self) -> &[&str] { -// &["lua", "tl"] -// } -// #[cfg(not(feature = "teal"))] -// fn extensions(&self) -> &[&str] { -// &["lua"] -// } -// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs index b4f4e7d1b7..c589a51f46 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/mod.rs @@ -1,7 +1,3 @@ -// pub mod providers; -// pub mod proxy; -// pub mod query; pub mod reference; -// pub mod type_registration; pub mod script_value; pub mod world; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs deleted file mode 100644 index 80291f2f81..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/query.rs +++ /dev/null @@ -1,121 +0,0 @@ -use std::ops::{Deref, DerefMut}; - -use bevy::prelude::Entity; -use bevy_mod_scripting_core::bindings::{ - ReflectAllocator, ReflectReference, ScriptQueryBuilder, ScriptTypeRegistration, -}; -use tealr::{ - mlu::{ - mlua::{IntoLua, Value}, - TealData, TypedFunction, - }, - ToTypename, -}; - -use crate::{impl_userdata_from_lua, impl_userdata_with_tealdata, util::Variadic}; - -use super::{ - // proxy::{LuaProxied, LuaValProxy}, - reference::LuaReflectReference, - world::GetWorld, -}; - -#[derive(Default, Clone)] -pub struct LuaQueryBuilder(pub(crate) ScriptQueryBuilder); - -impl Deref for LuaQueryBuilder { - type Target = ScriptQueryBuilder; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for LuaQueryBuilder { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl LuaQueryBuilder {} - -// impl LuaProxied for ScriptQueryBuilder { -// type Proxy = LuaQueryBuilder; -// } - -impl_userdata_from_lua!(LuaQueryBuilder); -impl_userdata_with_tealdata!(LuaQueryBuilder); - -impl TealData for LuaQueryBuilder { - fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.add_function( - "with", - |_, (mut this, mut query): (Self, Variadic>)| { - let registrations: Vec<_> = query - .iter_mut() - .map(|v| v.unproxy()) - .collect::>() - .map_err(tealr::mlu::mlua::Error::external)?; - this.0.with(registrations); - Ok(this) - }, - ); - - methods.add_function( - "without", - |_, (mut this, mut query): (Self, Variadic>)| { - let registrations: Vec<_> = query - .iter_mut() - .map(|v| v.unproxy()) - .collect::>() - .map_err(tealr::mlu::mlua::Error::external)?; - this.0.without(registrations); - Ok(this) - }, - ); - - methods.add_function("iter", |l, this: LuaQueryBuilder| { - let world = l.get_world(); - let mut result = world - .query(this.0) - .map_err(tealr::mlu::mlua::Error::external)?; - let mut len = result.len(); - let iterator = TypedFunction::from_rust_mut( - move |lua, ()| { - if len > 0 { - let result = result - .pop_front() - .expect("invariant: len of array = len && len > 0"); - let entity = - world.with_resource::(|_, mut allocator| { - ReflectReference::new_allocated(result.0, &mut allocator) - }); - let proxy_entity = - ::Proxy::from(entity).into_lua(lua)?; - let component_refs: Vec<_> = result - .1 - .into_iter() - .map(|r| LuaReflectReference(r).to_lua_proxy(lua)) - .collect::>()?; - - len -= 1; - - Ok(Variadic::new( - std::iter::once(proxy_entity).chain(component_refs.into_iter()), - )) - } else { - Ok(Variadic::new(vec![Value::Nil, Value::Nil])) - } - }, - l, - )?; - Ok(iterator) - }); - } -} - -impl ToTypename for LuaQueryBuilder { - fn to_typename() -> tealr::Type { - tealr::Type::new_single("QueryBuilder", tealr::KindOfType::External) - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index f3614ad95a..51b9ba37e1 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -294,6 +294,34 @@ impl UserData for LuaReflectReference { } } +/// A reference to just a type. This is used to provide a static call mechanism when we know the type we want to call a function on. +/// +/// For example if we want `Entity::from_raw(usize)` to be callable as `Entity.from_raw(usize)` in lua, we can set the global `Entity` to a `LuaStaticReflectReference(Entity::type_id())`. + +#[derive(Debug, Clone, Copy, PartialEq, mlua::FromLua)] +pub struct LuaStaticReflectReference(pub TypeId); + +impl UserData for LuaStaticReflectReference { + fn add_methods>(m: &mut T) { + m.add_meta_function( + MetaMethod::Index, + |lua, (self_, key): (LuaStaticReflectReference, LuaScriptValue)| { + let type_id = self_.0; + + let key: ScriptValue = key.into(); + + if let ScriptValue::String(ref key) = key { + if let Some(func) = lookup_function(lua, key, type_id) { + return func?.into_lua(lua); + } + }; + + Err(InteropError::missing_function(type_id, key.to_string()).into()) + }, + ); + } +} + // #[cfg(test)] // mod test { diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs deleted file mode 100644 index 6adc131333..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/type_registration.rs +++ /dev/null @@ -1,41 +0,0 @@ -use std::sync::Arc; - -use bevy::reflect::TypeRegistration; -use bevy_mod_scripting_core::bindings::ScriptTypeRegistration; -use tealr::mlu::TealData; - -use crate::impl_userdata_from_lua; - -// use super::proxy::LuaProxied; - -/// Caches information about type data -#[derive(Clone, tealr::mlu::UserData, tealr::ToTypename)] -pub struct LuaTypeRegistration(pub ScriptTypeRegistration); - -impl_userdata_from_lua!(LuaTypeRegistration); - -impl TealData for LuaTypeRegistration { - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(fields: &mut F) { - fields.document("The [short name](https://docs.rs/bevy/latest/bevy/reflect/struct.TypeRegistration.html#method.get_short_name) of a type"); - fields.add_field_method_get("short_name", |_, s| Ok(s.0.short_name().to_owned())); - - fields.document("The full name of the type"); - fields.add_field_method_get("type_name", |_, s| Ok(s.0.type_name())); - } -} - -impl From for LuaTypeRegistration { - fn from(value: ScriptTypeRegistration) -> Self { - Self(value) - } -} - -impl From<&LuaTypeRegistration> for ScriptTypeRegistration { - fn from(value: &LuaTypeRegistration) -> Self { - value.0.clone() - } -} - -impl LuaProxied for ScriptTypeRegistration { - type Proxy = LuaTypeRegistration; -} diff --git a/crates/languages/bevy_mod_scripting_lua/src/docs.rs b/crates/languages/bevy_mod_scripting_lua/src/docs.rs deleted file mode 100644 index 63a56ca965..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/docs.rs +++ /dev/null @@ -1,190 +0,0 @@ -use core::str; -use std::{ - borrow::Cow, - env, - fs::{self, File}, - io::Write, - ops::Deref, - process::Command, -}; - -//use bevy::asset::FileAssetIo; -use bevy::asset::io::file::FileAssetReader; -use bevy_mod_scripting_core::prelude::*; - -static DEFAULT_DOC_CONFIG: fn(&str) -> String = |s| { - format!( - r#" -{{ - "doc_template": "Builtin", - "page_root": "", - "store_in": "{s}", - "name": "{s}", - "is_global": true, - "type_def_files": {{ - "runner": "Builtin", - "templates": {{ - "teal": {{ - "extension": ".d.tl", - "template": "Teal" - }} - }} - }} - }} - -"# - ) -}; - -#[cfg(feature = "teal")] -static DEFAULT_TEAL_CONFIG: &str = r#" -return { - global_env_def="types/types", - build_dir="build/" -} -"#; - -struct Fragment { - builder: (), -} - -pub struct LuaDocumentationFragment { - name: &'static str, - walker: Vec, -} - -impl DocumentationFragment for LuaDocumentationFragment { - fn name(&self) -> &'static str { - self.name - } - - fn merge(mut self, o: Self) -> Self { - self.walker.extend(o.walker); - self - } - - fn gen_docs(self) -> Result<(), Box> { - todo!() - // let script_asset_path = &FileAssetReader::get_base_path() - // .join("assets") - // .join("scripts"); - - // let script_doc_dir = &env::var("SCRIPT_DOC_DIR") - // .map(|v| v.into()) - // .unwrap_or_else(|_e| script_asset_path.join("doc")); - - // fs::create_dir_all(script_doc_dir) - // .expect("Could not create `.../assets/scripts/doc` directories"); - - // let docs_name = self.name().to_owned(); - - // // build the type walker - // let mut tw = self - // .walker - // .into_iter() - // .fold(TypeWalker::new(), |a, v| (v.builder)(a)); - - // // fixes bug in tealr which causes syntax errors in teal due to duplicate fields (from having both getters and setters) - // 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())); - // rg.fields.dedup_by(|a, b| a.name == b.name); - // rg.static_fields - // .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); - // } - // for func in rg - // .functions - // .iter_mut() - // .chain(rg.mut_functions.iter_mut()) - // .chain(rg.methods.iter_mut()) - // .chain(rg.mut_methods.iter_mut()) - // { - // escape_name(&mut func.name); - // } - // } - // }); - - // // generate json file - // let json = serde_json::to_string_pretty(&tw)?; - - // let json_path = script_doc_dir.join(format!("{}.json", docs_name)); - - // (File::create(json_path).and_then(|mut file| { - // file.write_all(json.as_bytes())?; - // file.flush() - // }))?; - // // generate doc config files if they don't exist - // if !script_doc_dir.join("tealr_doc_gen_config.json").exists() { - // let config_path = script_doc_dir.join("tealr_doc_gen_config.json"); - // (File::create(config_path) - // .and_then(|mut file| file.write_all(DEFAULT_DOC_CONFIG(&docs_name).as_bytes())))? - // } - - // // generate docs - // (Command::new("tealr_doc_gen") - // .current_dir(script_doc_dir) - // .args(["run"]) - // .status())?; - - // #[cfg(feature = "teal")] - // { - // // now manage the definition (d.tl) file - // let definition_directory = script_asset_path.join("types"); - // (fs::create_dir_all(&definition_directory))?; - - // let definition_file_path = script_doc_dir - // .join(&docs_name) - // .join("definitions") - // .join(docs_name + ".d.tl"); - // let output_definition_file_path = script_asset_path.join("types").join("types.d.tl"); - // (fs::copy(&definition_file_path, &output_definition_file_path))?; - - // // finally create a tlconfig.lua file if doesn't exist - // // we do this to avoid problems with varying teal configurations - // // keep em settings consistent everywhere - // let tl_config_path = script_asset_path.join("tlconfig.lua"); - // if !tl_config_path.exists() { - // let mut tl_file = (File::create(tl_config_path))?; - // (tl_file.write_all(DEFAULT_TEAL_CONFIG.as_bytes()))?; - // } - // } - // Ok(()) - } -} - -// /// Escapes a name of a table field, if that table field is a reserved keyword. -// /// -// /// ## Background -// /// -// /// String keys in a Lua table are allowed to be anything, even reserved -// /// keywords. By default when tealr generates the type definition for a table -// /// field, the string it generates is `{name} : {type}`. This causes a syntax -// /// error when writing a bare keyword, since `nil : {type}` is considered trying -// /// to add a type to the *value* nil (which is invalid). -// /// -// /// To get around this tealr allows us to escape table fields using the -// /// `["{name}"] : {value}` syntax. This function detects if a name is one of the -// /// Lua reserved words and fixes it if so. -// fn escape_name(raw: &mut NameContainer) { -// // List of Lua reserved keywords -// const KEYWORD_FIELDS: &[&str] = &[ -// "false", "true", "nil", // Values -// "and", "not", "or", // Operators -// "if", "then", "else", "elseif", "end", // If-Else -// "for", "in", "break", "do", "repeat", "until", "while", // Loops -// "function", "return", // Funcs -// "local", // Declarations -// "record", // Teal extra -// ]; -// let Ok(name) = str::from_utf8(raw) else { -// return; -// }; -// if KEYWORD_FIELDS.contains(&name) { -// let mapped = format!("[\"{name}\"]"); -// *raw = NameContainer::from(Cow::Owned(mapped)); -// } -// } diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index c4ddf46b9c..c0e2b1e5b2 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -1,6 +1,3 @@ -pub mod assets; -pub mod docs; -// pub mod type_data; pub mod util; use bevy::{ app::{App, Plugin, Startup}, @@ -16,12 +13,12 @@ use bevy_mod_scripting_core::{ handler::Args, reflection_extensions::PartialReflectExt, script::ScriptId, - AddContextPreHandlingInitializer, ScriptingPlugin, + AddContextInitializer, AddContextPreHandlingInitializer, ScriptingPlugin, }; use bindings::{ // providers::bevy_ecs::LuaEntity, // proxy::LuaProxied, - reference::LuaReflectReference, + reference::{LuaReflectReference, LuaStaticReflectReference}, world::{GetWorld, LuaWorld}, }; pub use mlua; @@ -81,6 +78,36 @@ impl Plugin for LuaScriptingPlugin { } fn cleanup(&self, app: &mut App) { + // find all registered types, and insert dummy for calls + // let mut type_registry = app.world_mut().get_resource_or_init::(); + // let mut type_registry = type_registry.read(); + + // type_registry.iter().map(|t| { + // t. + // }) + app.add_context_initializer::<()>(|_script_id, context: &mut Lua| { + let world = context.get_world(); + let type_registry = world.type_registry(); + let type_registry = type_registry.read(); + + for registration in type_registry.iter() { + // only do this for non generic types + // we don't want to see `Vec:function()` in lua + if !registration.type_info().generics().is_empty() { + continue; + } + + if let Some(global_name) = registration.type_info().type_path_table().ident() { + let ref_ = LuaStaticReflectReference(registration.type_id()); + context + .globals() + .set(global_name, ref_) + .map_err(ScriptError::from_mlua_error)?; + } + } + Ok(()) + }); + // let mut type_registry = app.world_mut().get_resource_mut().unwrap(); // we register up to two levels of nesting, if more are needed, the user will have to do this manually diff --git a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs b/crates/languages/bevy_mod_scripting_lua/src/type_data.rs deleted file mode 100644 index cc9418b075..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/type_data.rs +++ /dev/null @@ -1,877 +0,0 @@ -use std::{ - any::{Any, TypeId}, - clone, - collections::{HashMap, HashSet}, - sync::Arc, -}; - -use bevy::{ - app::App, - log::debug, - prelude::{AppTypeRegistry, Mut}, - reflect::{ - impl_reflect, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, FromType, - GetTypeRegistration, List, ParsedPath, PartialReflect, Reflect, ReflectFromReflect, - ReflectMut, ReflectPathError, TypeInfo, TypePath, TypeRegistration, - }, -}; -use bevy_mod_scripting_core::{ - bindings::{DeferredReflection, ReflectAllocator, ReflectReference, ReflectionPathElem}, error::ScriptError, new_deferred_reflection, reflection_extensions::PartialReflectExt -}; -use tealr::mlu::mlua::{FromLua, IntoLua, Lua, Table, Value}; - -use crate::bindings::{reference::LuaReflectReference, world::GetWorld}; - -/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented in lua via proxies which store -/// a reference to the actual value. -/// This is used for types which are represented in lua with pass by reference semantics -#[derive(Clone)] -pub struct ReflectLuaProxied { - // TODO: should these be script errors? - pub into_proxy: Arc< - dyn for<'l> Fn(ReflectReference, &'l Lua) -> Result, tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, - pub from_proxy: Arc< - dyn for<'l> Fn(Value<'l>, &'l Lua) -> Result - + Send - + Sync - + 'static, - >, - /// Optional override for setting behavior, should be respected by all handling types for unproxying to work recurively. - /// Normally used when [`PartialReflect::apply`] does not do the right thing. - pub opt_set: Option< - Arc< - dyn for<'l> Fn( - &mut dyn PartialReflect, - Box, - ) -> Result<(), ScriptError> - + Send - + Sync - + 'static, - >, - >, -} - -impl ReflectLuaProxied { - /// Generates a type data which can be used on [`Option`] types which are represented in lua with pass by reference semantics - fn new_for_option(inner_lua_proxied_data: &ReflectLuaProxied, container_type_info: &'static TypeInfo) -> Self { - let ref_into_option = |mut r: ReflectReference| { - r.index_path(ParsedPath::parse_static("0").expect("Invalid reflection path")); - // why is this necessary? well we need for the from_proxy to work correctly - // we need to know if the reference came from this impl so we can pop the last element - r.index_path(ReflectionPathElem::Identity); - r - }; - let into_proxy_clone = inner_lua_proxied_data.into_proxy.clone(); - let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); - Self { - into_proxy: Arc::new(move |reflect_ref, l| { - // read the value and check if it is None, if so return nil - // otherwise use the inner type's into_proxy - let world = l.get_world(); - let is_some = reflect_ref - .with_reflect(&world, |s, _, _| s.as_option().map(|r| r.is_some()))??; - - if is_some { - (into_proxy_clone)(ref_into_option(reflect_ref), l) - } else { - Ok(Value::Nil) - } - }), - from_proxy: Arc::new(move |v, l| { - if v.is_nil() { - bevy::log::debug!("Option from proxy: Nil"); - // we need to allocate a new reflect reference since we don't have one existing - let mut dynamic_value = DynamicEnum::new("None", DynamicVariant::Unit); - dynamic_value.set_represented_type(Some(container_type_info)); - let world = l.get_world(); - let reflect_ref = - world.with_resource(|_, mut allocator: Mut| { - Ok::<_, tealr::mlu::mlua::Error>(ReflectReference::new_allocated( - dynamic_value, - &mut allocator, - )) - })?; - - Ok(reflect_ref) - } else { - // this ref could've come from this into_proxy or from something else, we need to differentiate here - // we need to - let mut inner_ref = (from_proxy_clone)(v, l)?; - if inner_ref.reflect_path.last().is_some_and(|p| p == &ReflectionPathElem::Identity) { - // if the last path element is identity, then it came from this impl - // we need to remove the path derefing to the inner value and we're done - inner_ref.reflect_path.pop(); - Ok(inner_ref) - } else { - // otherwise we need to wrap it in an option dynamically so it's an option, to do that we need to reflect the value and box it - let world = l.get_world(); - let reflect_ref = inner_ref.with_reflect(&world, |r,_, mut allocator| { - let mut dynamic = DynamicEnum::new("Some", DynamicVariant::Tuple([r.clone_value()].into_iter().collect())); - dynamic.set_represented_type(Some(container_type_info)); - ReflectReference::new_allocated( - dynamic, - &mut allocator, - ) - })?; - Ok(reflect_ref) - } - } - }), - opt_set: None, - } - } - - fn dynamic_list_from_value<'lua>( - v: Table<'lua>, - lua: &'lua Lua, - from_proxy: &Arc< - dyn for<'l> Fn( - Value<'l>, - &'l Lua, - ) - -> Result, tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, - container_type_info: &'static TypeInfo - ) -> Result { - let lua_values = v.sequence_values().collect::, _>>()?; - - let converted_values = lua_values - .into_iter() - .map(|v| (from_proxy)(v, lua)) - .collect::, _>>()?; - - let mut dynamic_type = DynamicList::from_iter(converted_values); - dynamic_type.set_represented_type(Some(container_type_info)); - Ok(dynamic_type) - } - - fn dynamic_list_from_proxy<'lua>( - v: Table<'lua>, - lua: &'lua Lua, - from_proxy: &Arc< - dyn for<'l> Fn(Value<'l>, &'l Lua) -> Result - + Send - + Sync - + 'static, - >, - container_type_info: &'static TypeInfo, - ) -> Result { - let lua_values = v.sequence_values().collect::, _>>()?; - - // TODO: less allocations plz, i can't be bothered to do this right now - let converted_values = lua_values - .into_iter() - .map(|v| (from_proxy)(v, lua)) - .collect::, _>>()?; - let world = lua.get_world(); - - let boxed_values = converted_values - .into_iter() - .map(|v| v.with_reflect(&world, |r, _, _| r.clone_value())) - .collect::, _>>()?; - - let mut dynamic_type = DynamicList::from_iter(boxed_values); - // TODO: what to do with this memory, I think it's fine to leave hanging till exit - dynamic_type.set_represented_type(Some(container_type_info)); - Ok(dynamic_type) - } - - fn new_for_listlike_value( - inner_lua_value_data: &ReflectLuaValue, - container_type_info: &'static TypeInfo, - ) -> Self { - let from_value_clone = inner_lua_value_data.from_value.clone(); - Self { - into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), - from_proxy: Arc::new(move |v, l| { - bevy::log::debug!("Building listlike type from lua value: {:?}", v); - if let Value::Table(t) = v { - let dynamic_table = Self::dynamic_list_from_value(t, l, &from_value_clone, container_type_info)?; - let world = l.get_world(); - let allocated = - world.with_resource(|_, mut allocator: Mut| { - ReflectReference::new_allocated(dynamic_table, &mut allocator) - }); - Ok(allocated) - } else { - LuaReflectReference::from_lua(v, l).map(|v| v.0) - } - }), - opt_set: Some(Arc::new(|r, other| { - r.set_as_list(other, |a, b| { - Ok(a.try_apply(b)?) - }) - })), - } - } - - fn new_for_listlike_proxy(inner_lua_proxied_data: &ReflectLuaProxied) -> Self { - // let from_proxy_clone = inner_lua_proxied_data.from_proxy.clone(); - Self { - into_proxy: Arc::new(|r, l| LuaReflectReference(r).into_lua(l)), - from_proxy: Arc::new(|v, l| { - bevy::log::debug!("Building listlike type from proxied value: {:?}", v); - todo!() - }), - opt_set: todo!(), - } - } -} - -/// Temp for compat -pub trait LuaProxied { - type Proxy; -} - -impl FromType for ReflectLuaProxied -where - T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T::Proxy: From + AsRef, -{ - fn from_type() -> Self { - Self { - into_proxy: Arc::new(|p, l| T::Proxy::from(p).into_lua(l)), - from_proxy: Arc::new(|v, l| { - bevy::log::debug!("Building proxied type from lua value: {:?}", v); - T::Proxy::from_lua(v, l).map(|p| p.as_ref().clone()) - }), - opt_set: None, - } - } -} - -/// Stores the procedure used to convert a lua value to a reflect value and vice versa, Used for types which are represented directly in lua with -/// pass by value semantics, These need to implement [`Clone`] -#[derive(Clone)] -pub struct ReflectLuaValue { - pub into_value: Arc< - dyn for<'l> Fn(&dyn PartialReflect, &'l Lua) -> Result, tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, - pub from_value: Arc< - dyn for<'l> Fn( - Value<'l>, - &'l Lua, - ) -> Result, tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, -} - -impl ReflectLuaValue { - fn dynamic_option_from_value<'lua>( - v: Value<'lua>, - lua: &'lua Lua, - from_value: &Arc< - dyn for<'l> Fn( - Value<'l>, - &'l Lua, - ) - -> Result, tealr::mlu::mlua::Error> - + Send - + Sync - + 'static, - >, - container_type_info: &'static TypeInfo, - ) -> Result { - let mut dynamic_enum = if v.is_nil() { - DynamicEnum::new("None", DynamicVariant::Unit) - } else { - let inner = (from_value)(v, lua)?; - DynamicEnum::new("Some", DynamicVariant::Tuple([inner].into_iter().collect())) - }; - - dynamic_enum.set_represented_type(Some(container_type_info)); - - Ok(dynamic_enum) - } - - /// generates implementation for an inner type wrapped by an option - /// - /// the option should check if the value is None if so return nil, - /// if the value is some use ReflectLuaValue implementation of the inner type. - /// - /// If there is a type mismatch at any point will return an error - pub fn new_for_option(inner_reflect_lua_value: &ReflectLuaValue, container_type_info: &'static TypeInfo) -> Self { - let into_value_clone = inner_reflect_lua_value.into_value.clone(); - // we have to do this so the closures can be moved into the arc - let from_value_clone2 = inner_reflect_lua_value.from_value.clone(); - Self { - into_value: Arc::new(move |r, lua| { - r.as_option() - .map_err(tealr::mlu::mlua::Error::external)? - .map(|inner| (into_value_clone)(inner, lua)) - .unwrap_or_else(|| Ok(Value::Nil)) - }), - from_value: Arc::new(move |v, l| { - let dynamic_option = Self::dynamic_option_from_value(v, l, &from_value_clone2, container_type_info)?; - - Ok(Box::new(dynamic_option)) - }), - } - } -} - -impl IntoLua<'l> + for<'l> FromLua<'l>> FromType - for ReflectLuaValue -{ - fn from_type() -> Self { - Self { - into_value: Arc::new(|v, l| { - bevy::log::debug!("Converting lua value to lua: {:?}", v); - v.try_downcast_ref::() - .unwrap_or_else(|| { - panic!( - "Expected type: {}, got: {}", - std::any::type_name::(), - v.reflect_type_path() - ) - }) - .clone() - .into_lua(l) - }), - // set_value: Arc::new(|t, v, l| { - // bevy::log::debug!("Setting lua value: {:?}, with {:?}", t, v); - // let t = t.try_downcast_mut::().unwrap(); - // *t = T::from_lua(v, l)?; - // Ok(()) - // }), - from_value: Arc::new(|v, l| { - bevy::log::debug!("Building concrete type from lua value: {:?}", v); - T::from_lua(v, l).map(|v| Box::new(v) as Box) - }), - } - } -} - -/// Registers a lua proxy object via the reflection system -pub trait RegisterLua { - fn register_lua_proxy( - &mut self, - ) -> &mut Self - where - T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T::Proxy: From + AsRef; - - fn register_lua_value(&mut self) -> &mut Self - where - T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T: Reflect + Clone + TypePath + GetTypeRegistration; -} - -impl RegisterLua for App { - fn register_lua_proxy( - &mut self, - ) -> &mut Self - where - T::Proxy: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T::Proxy: From + AsRef, - { - self.register_type::(); - self.register_type_data::() - } - - fn register_lua_value(&mut self) -> &mut Self - where - T: for<'l> IntoLua<'l> + for<'l> FromLua<'l>, - T: Reflect + Clone + TypePath + GetTypeRegistration, - { - self.register_type::(); - self.register_type_data::() - } -} - -/// Checks if the type registration is for a type which matches the pattern `core::option::Option`, and extracts `T`'s typeId as well as the Option's typeId -fn destructure_option_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { - let type_path_table = reg.type_info().type_path_table(); - let is_core = type_path_table.crate_name().is_some_and(|s| s == "core"); - let is_option = type_path_table.ident().is_some_and(|s| s == "Option"); - - if is_core && is_option { - reg.type_info() - .generics() - .get_named("T") - .map(|t| (reg.type_id(), t.type_id())) - } else { - None - } -} - -fn destructure_list_type(reg: &TypeRegistration) -> Option<(TypeId, TypeId)> { - let type_path_table = reg.type_info().as_list().ok()?; - - let inner_type_id = type_path_table.item_ty().id(); - Some((reg.type_id(), inner_type_id)) -} - -/// iterates over type data for all types which have registered [`ReflectLuaProxied`] and [`ReflectLuaValue`] implementations, -/// and registers corresponding [`Option`] [`Result`] etc type data equivalents. -/// for combinations of nested containers, this should be run more times per level of nesting required. -pub fn pre_register_common_containers(type_registry: &mut AppTypeRegistry) { - let mut type_registry = type_registry.write(); - - let mut lua_value_insertions: HashMap = Default::default(); - let mut lua_proxied_insertions: HashMap = Default::default(); - for (option_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_option_type) - { - let container_type_info = type_registry.get(option_type_id).expect("invariant").type_info(); - // TODO: reuse the leaked box in both branches when either is true - if let Some(inner_lua_value_data) = - type_registry.get_type_data::(inner_type_id) - { - let option_lua_proxied_data = ReflectLuaValue::new_for_option(inner_lua_value_data, Box::leak(Box::new(container_type_info.clone()))); - lua_value_insertions.insert(option_type_id, option_lua_proxied_data); - } - - if let Some(inner_lua_proxied_data) = - type_registry.get_type_data::(inner_type_id) - { - let option_lua_proxied_data = ReflectLuaProxied::new_for_option(inner_lua_proxied_data, Box::leak(Box::new(container_type_info.clone()))); - - lua_proxied_insertions.insert(option_type_id, option_lua_proxied_data); - } - } - - for (vec_type_id, inner_type_id) in type_registry.iter().filter_map(destructure_list_type) { - let container_type_info = type_registry.get(vec_type_id).expect("invariant").type_info(); - if let Some(inner_lua_value_data) = - type_registry.get_type_data::(inner_type_id) - { - let vec_lua_proxied_data = - ReflectLuaProxied::new_for_listlike_value(inner_lua_value_data, Box::leak(Box::new(container_type_info.clone()))); - lua_proxied_insertions.insert(vec_type_id, vec_lua_proxied_data); - } - } - - for (type_id, lua_value_data) in lua_value_insertions { - type_registry - .get_mut(type_id) - .expect("We just found the type id from the type registry") - .insert(lua_value_data); - } - - for (type_id, lua_proxied_data) in lua_proxied_insertions { - type_registry - .get_mut(type_id) - .expect("We just found the type id from the type registry") - .insert(lua_proxied_data); - } -} - -pub fn register_lua_values(app: &mut bevy::prelude::App) { - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); - app.register_lua_value::(); -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::bindings::{reference::LuaReflectReference, world::LuaWorld}; - use bevy::{ - prelude::World, - reflect::{TypeRegistry, TypeRegistryArc}, - }; - use bevy_mod_scripting_core::bindings::WorldCallbackAccess; - use std::sync::Arc; - - #[derive(Reflect, Debug, PartialEq)] - struct Proxied(usize); - - impl LuaProxied for Proxied { - type Proxy = LuaReflectReference; - } - - fn setup_type_registry() -> AppTypeRegistry - where - T1: GetTypeRegistration, - T2: GetTypeRegistration, - { - let mut type_registry = TypeRegistry::default(); - type_registry.register::(); - type_registry.register::(); - - let type_registry_arc = TypeRegistryArc { - internal: Arc::new(type_registry.into()), - }; - AppTypeRegistry(type_registry_arc) - } - - macro_rules! prepare_type_registry_with_common_containers { - ($target_type:ty, $container_type:ty, $type_data:ty) => {{ - { - let mut type_registry = setup_type_registry::<$target_type, $container_type>(); - type_registry - .write() - .register_type_data::<$target_type, $type_data>(); - - pre_register_common_containers(&mut type_registry); - type_registry - } - }}; - } - - macro_rules! assert_transitively_registers { - ($target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty) => {{ - let type_registry = prepare_type_registry_with_common_containers!( - $target_type, - $container_type, - $inner_type_data - ); - - let type_registry = type_registry.read(); - let container_type_id = std::any::TypeId::of::<$container_type>(); - let container_type_registration = type_registry.get(container_type_id).unwrap(); - - let type_data = container_type_registration.contains::<$type_data>(); - assert!( - type_data, - "{:?} should have type data {:?}", - std::any::type_name::<$container_type>(), - std::any::type_name::<$type_data>() - ); - }}; - } - - macro_rules! assert_lua_value_into_equals { - ($target_type:ty, $container_type:ty, $type_data:ty, $val:expr => $exp:expr) => {{ - let type_registry = prepare_type_registry_with_common_containers!( - $target_type, - $container_type, - $type_data - ); - - let type_registry = type_registry.read(); - let container_type_id = std::any::TypeId::of::<$container_type>(); - let container_type_data = type_registry - .get_type_data::<$type_data>(container_type_id) - .unwrap(); - let l = Lua::new(); - let out = (container_type_data.into_value)(&$val, &l).unwrap(); - assert_eq!(out, $exp); - }}; - } - - macro_rules! assert_lua_container_value_from_equals { - ($target_type:ty, $container_type:ty, $type_data:ty, $val:expr => $exp:expr) => {{ - let type_registry = prepare_type_registry_with_common_containers!( - $target_type, - $container_type, - $type_data - ); - - let type_registry = type_registry.read(); - let container_type_id = std::any::TypeId::of::<$container_type>(); - let container_type_data = type_registry - .get_type_data::<$type_data>(container_type_id) - .unwrap(); - let l = Lua::new(); - let out = (container_type_data.from_value)($val, &l).unwrap(); - assert!(out.reflect_partial_eq(&$exp).unwrap()); - }}; - } - - // macro_rules! assert_lua_container_value_after_set_equals { - // ($target_type:ty, $container_type:ty, $type_data:ty, $val:expr => $set:expr => $exp:expr) => {{ - // let type_registry = prepare_type_registry_with_common_containers!( - // $target_type, - // $container_type, - // $type_data - // ); - - // let type_registry = type_registry.read(); - // let container_type_id = std::any::TypeId::of::<$container_type>(); - // let container_type_data = type_registry - // .get_type_data::<$type_data>(container_type_id) - // .unwrap(); - // let l = Lua::new(); - // let mut target = $val; - // (container_type_data.set_value)(&mut target, $set, &l).unwrap(); - // assert!( - // target.reflect_partial_eq(&$exp).unwrap(), - // "Expected {:?} got: {:?}", - // $exp, - // target - // ); - // }}; - // } - - macro_rules! assert_lua_container_proxy_into_proxy { - (;WITH; $target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty ;FROM; $val:expr ;INTO; $exp:expr) => {{ - let app_type_registry = prepare_type_registry_with_common_containers!( - $target_type, - $container_type, - $inner_type_data - ); - let mut world = World::new(); - - let type_registry = app_type_registry.read(); - let container_type_id = std::any::TypeId::of::<$container_type>(); - let container_type_data = type_registry - .get_type_data::<$type_data>(container_type_id) - .unwrap() - .clone(); - - let mut allocator = ReflectAllocator::default(); - let allocated_value = ReflectReference::new_allocated($val, &mut allocator); - world.insert_resource(allocator); - drop(type_registry); - world.insert_resource(app_type_registry); - let lua = Lua::new(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - lua.globals().set("world", LuaWorld(world.clone())).unwrap(); - - let gotten_into_value = - (container_type_data.into_proxy)(allocated_value, &lua).unwrap(); - let converted_ref = LuaReflectReference::from_lua(gotten_into_value.clone(), &lua) - .expect(&format!( - "Could not convert to lua reflect reference got: {:?}", - gotten_into_value - )) - .0; - let world = world.read().unwrap(); - converted_ref.with_reflect(&world, |r, _, _| { - assert!( - r.reflect_partial_eq(&$exp).unwrap(), - "Expected {:?} got {:?}", - $exp, - r - ); - }); - }); - }}; - } - - macro_rules! assert_lua_container_proxy_opt_set { - ($allocator:ident, $lua:ident ;WITH; $target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty ;SET; $val:expr ;TO; $set:expr ;EXPECT; $exp:expr) => {{ - let app_type_registry = prepare_type_registry_with_common_containers!( - $target_type, - $container_type, - $inner_type_data - ); - let mut world = World::new(); - - let type_registry = app_type_registry.read(); - let container_type_id = std::any::TypeId::of::<$container_type>(); - let container_type_data = type_registry - .get_type_data::<$type_data>(container_type_id) - .unwrap() - .clone(); - - let mut $allocator = ReflectAllocator::default(); - drop(type_registry); - world.insert_resource(app_type_registry); - let $lua = Lua::new(); - let set_expr = Box::new($set); - world.insert_resource($allocator); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - $lua.globals() - .set("world", LuaWorld(world.clone())) - .unwrap(); - let mut target = $val; - (container_type_data.opt_set.unwrap())(&mut target, set_expr).unwrap(); - assert!(target.reflect_partial_eq(&$exp).unwrap()); - }); - }}; - } - - macro_rules! assert_lua_container_proxy_into_proxy_lua_only { - (;WITH; $target_type:ty = $inner_type_data:ty, $container_type:ty = $type_data:ty ;FROM; $val:expr ;INTO; $exp:expr) => {{ - let app_type_registry = prepare_type_registry_with_common_containers!( - $target_type, - $container_type, - $inner_type_data - ); - let mut world = World::new(); - - let type_registry = app_type_registry.read(); - let container_type_id = std::any::TypeId::of::<$container_type>(); - let container_type_data = type_registry - .get_type_data::<$type_data>(container_type_id) - .unwrap() - .clone(); - - let mut allocator = ReflectAllocator::default(); - let allocated_value = ReflectReference::new_allocated($val, &mut allocator); - world.insert_resource(allocator); - drop(type_registry); - world.insert_resource(app_type_registry); - let lua = Lua::new(); - WorldCallbackAccess::with_callback_access(&mut world, |world| { - lua.globals().set("world", LuaWorld(world.clone())).unwrap(); - - let gotten_into_value = - (container_type_data.into_proxy)(allocated_value, &lua).unwrap(); - assert_eq!(gotten_into_value, $exp); - }); - }}; - } - - #[test] - fn test_pre_register_common_containers_lua_value() { - assert_transitively_registers!(usize = ReflectLuaValue, Option = ReflectLuaValue); - assert_transitively_registers!(usize = ReflectLuaValue, Vec = ReflectLuaProxied); - } - - #[test] - fn test_pre_register_common_containers_lua_proxy() { - assert_transitively_registers!(Proxied = ReflectLuaProxied, Option = ReflectLuaProxied ); - } - - #[test] - fn test_option_container_impls() { - // Inner Value - // into - assert_lua_value_into_equals!( - usize, - Option, - ReflectLuaValue, - Some(2usize) => Value::Integer(2) - ); - assert_lua_value_into_equals!( - usize, - Option, - ReflectLuaValue, - None:: => Value::Nil - ); - - // from - assert_lua_container_value_from_equals!( - usize, - Option, - ReflectLuaValue, - Value::Integer(2) => Some(2usize) - ); - assert_lua_container_value_from_equals!( - usize,Option, - ReflectLuaValue, - Value::Nil => None:: - ); - - // set - // assert_lua_container_value_after_set_equals!( - // usize, Option, - // ReflectLuaValue, - // Some(2usize) => Value::Nil => None:: - // ); - // assert_lua_container_value_after_set_equals!( - // usize, Option, - // ReflectLuaValue, - // None:: => Value::Integer(2) => Some(2usize) - // ); - // assert_lua_container_value_after_set_equals!( - // usize, Option, - // ReflectLuaValue, - // None:: => Value::Nil => None:: - // ); - // assert_lua_container_value_after_set_equals!( - // usize, Option, - // ReflectLuaValue, - // Some(2usize) => Value::Integer(3) => Some(3usize) - // ); - - // Inner Proxy - // into - assert_lua_container_proxy_into_proxy!( - ;WITH; Proxied = ReflectLuaProxied, Option = ReflectLuaProxied - ;FROM; Some(Proxied(2)) - ;INTO; Proxied(2usize)); - assert_lua_container_proxy_into_proxy_lua_only!( - ;WITH; Proxied = ReflectLuaProxied, Option = ReflectLuaProxied - ;FROM; None:: - ;INTO; Value::Nil - ); - - // set from - // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, - // Some(Proxied(2)) - // => None:: - // => None::); - // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, - // None:: - // => Proxied(2)// LuaReflectReference(ReflectReference::new_allocated(Proxied(2), &mut alloc)) - // => Some(Proxied(2))); - // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, - // Some(Proxied(2)) - // => Proxied(3) // LuaReflectReference(ReflectReference::new_allocated(Proxied(3), &mut alloc)) - // => Some(Proxied(3))); - // assert_lua_container_proxy_opt_set!(alloc, lua, Proxied, Option, ReflectLuaProxied, - // None:: - // => None:: - // => None::); - } - - #[test] - fn test_listlike_container_impls() { - // Inner Value - // into - assert_lua_container_proxy_into_proxy!( - ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied - ;FROM; vec![Proxied(2), Proxied(3)] - ;INTO; vec![Proxied(2), Proxied(3)] - ); - assert_lua_container_proxy_into_proxy!( - ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied - ;FROM; Vec::::default() - ;INTO; Vec::::default() - ); - - assert_lua_container_proxy_opt_set!(alloc, lua - ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied - ;SET; Vec::::default() - ;TO; Vec::::default() - ;EXPECT; Vec::::default() - ); - - assert_lua_container_proxy_opt_set!(alloc, lua - ;WITH; usize = ReflectLuaValue, Vec = ReflectLuaProxied - ;SET; Vec::::default() - ;TO; vec![Proxied(2)] - ;EXPECT; vec![Proxied(2)] - ); - } - - #[test] - fn test_get_inner_type_id_option() { - let app_type_registry = setup_type_registry::>(); - - let type_registry = app_type_registry.read(); - let option_type_id = std::any::TypeId::of::>(); - let inner_type_id = std::any::TypeId::of::(); - let option_type_registration = type_registry.get(option_type_id).unwrap(); - - let (gotten_option_type_id, gotten_inner_type_id) = - destructure_option_type(option_type_registration).unwrap(); - assert_eq!( - gotten_inner_type_id, inner_type_id, - "Option should have inner type usize" - ); - assert_eq!( - gotten_option_type_id, option_type_id, - "Option should have type id Option" - ); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua index de6961bebb..b399f4f8db 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua @@ -1,3 +1,3 @@ assert_throws(function() world:despawn_recursive(Entity.from_raw(9999)) -end, "parent Entity does not exist") \ No newline at end of file +end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua index de6961bebb..b399f4f8db 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua @@ -1,3 +1,3 @@ assert_throws(function() world:despawn_recursive(Entity.from_raw(9999)) -end, "parent Entity does not exist") \ No newline at end of file +end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua index de6961bebb..b399f4f8db 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua @@ -1,3 +1,3 @@ assert_throws(function() world:despawn_recursive(Entity.from_raw(9999)) -end, "parent Entity does not exist") \ No newline at end of file +end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua index 7640c6f9c0..16745e86d0 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua @@ -1,5 +1,5 @@ local entity = world:spawn() -local child = world:spawn(entity) +local child = world:spawn() world:push_children(entity, {child}) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua index 2516a20860..c5ca9cdaf3 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua @@ -1,4 +1,4 @@ assert_throws(function() world:get_children(Entity.from_raw(9999)) -end, "Entity does not exist") +end, "Missing or invalid entity") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua index 06500f3360..04125b72bb 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua @@ -1,4 +1,4 @@ assert_throws(function() world:get_parent(Entity.from_raw(9999)) -end, "Entity does not exist") +end, "Missing or invalid entity") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua index 528f1eb64d..f82a9bb170 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua @@ -2,9 +2,9 @@ local fake_entity = Entity.from_raw(9999) assert_throws(function() world:insert_children(fake_entity, 1, {fake_entity}) -end, "parent Entity does not exist") +end, "Missing or invalid entity") local entity = world:spawn() assert_throws(function() world:insert_children(entity, 1, {fake_entity}) -end, "the Entity does not exist") \ No newline at end of file +end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua index eae6c3b0c4..166e487ec2 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua @@ -2,9 +2,9 @@ local fake_entity = Entity.from_raw(9999) assert_throws(function() world:push_children(fake_entity, {fake_entity}) -end, "The parent Entity does not exist") +end, "Missing or invalid entity") local entity = world:spawn() assert_throws(function() world:push_children(entity, {fake_entity}) -end, "the Entity does not exist") \ No newline at end of file +end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua index bbf6b9d9ce..54a81b2366 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua @@ -1,5 +1,5 @@ local component_a = world:get_type_by_name("TestComponent") -for entity in pairs(world:query({component_a}):with(component_a):without(component_a):build()) do +for i,result in pairs(world:query({component_a}):with(component_a):without(component_a):build()) do assert(false, "This should not be reached") end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua index 72fcdd2f22..78fd2a119f 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua @@ -13,16 +13,16 @@ world:add_default_component(entity_c, component_with) world:add_default_component(entity_b, component_without) local found_entities = {} -for entity, comp in pairs(world:query({component_with}):with(component_with):without(component_without):build()) do - table.insert(found_entities, entity) +for i,result in pairs(world:query({component_with}):with(component_with):without(component_without):build()) do + table.insert(found_entities, result:entity()) end assert(#found_entities == 3, "Expected 3 entities, got " .. #found_entities) expected_entities = { + entity_c, entity_d, entity_a, - entity_c, } for i, entity in ipairs(found_entities) do diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 53afa442a9..2c174fd527 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -15,6 +15,7 @@ use bevy_mod_scripting_core::{ event::CallbackLabel, script::ScriptId, }; +use bevy_mod_scripting_functions::ScriptFunctionsPlugin; use bevy_mod_scripting_lua::{ bindings::{ reference::LuaReflectReference, @@ -47,7 +48,7 @@ fn init_app() -> App { app.add_plugins(AssetPlugin::default()) .add_plugins(HierarchyPlugin) .add_plugins(LuaScriptingPlugin::<()>::default()) - .add_plugins(bevy_mod_scripting_functions::BevyFunctionsPlugin); + .add_plugins(ScriptFunctionsPlugin); // for some reason hierarchy plugin doesn't register the children component app.world_mut().register_component::(); From 4034c1c2ef97b7e94ca672af2a437473fe429441 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 29 Dec 2024 11:04:48 +0000 Subject: [PATCH 123/217] delete deprecated code --- Cargo.toml | 3 - crates/bevy_mod_scripting_derive/src/input.rs | 115 - crates/bevy_mod_scripting_derive/src/lib.rs | 567 - crates/bevy_mod_scripting_derive/src/utils.rs | 59 - crates/bevy_script_api/CHANGELOG.md | 31 - crates/bevy_script_api/Cargo.toml | 41 - crates/bevy_script_api/readme.md | 3 - crates/bevy_script_api/src/common/bevy/mod.rs | 443 - crates/bevy_script_api/src/common/mod.rs | 2 - crates/bevy_script_api/src/common/std.rs | 141 - crates/bevy_script_api/src/core_providers.rs | 115 - crates/bevy_script_api/src/error.rs | 37 - crates/bevy_script_api/src/lib.rs | 45 - crates/bevy_script_api/src/lua/bevy/mod.rs | 386 - crates/bevy_script_api/src/lua/mod.rs | 306 - crates/bevy_script_api/src/lua/std.rs | 492 - crates/bevy_script_api/src/lua/util.rs | 427 - .../src/providers/bevy_core.rs | 95 - .../bevy_script_api/src/providers/bevy_ecs.rs | 560 - .../src/providers/bevy_hierarchy.rs | 161 - .../src/providers/bevy_input.rs | 1887 -- .../src/providers/bevy_math.rs | 5539 ---- .../src/providers/bevy_reflect.rs | 22578 ---------------- .../src/providers/bevy_time.rs | 736 - .../src/providers/bevy_transform.rs | 819 - crates/bevy_script_api/src/providers/mod.rs | 80 - crates/bevy_script_api/src/rhai/bevy/mod.rs | 359 - crates/bevy_script_api/src/rhai/mod.rs | 194 - crates/bevy_script_api/src/rhai/std.rs | 454 - crates/bevy_script_api/src/script_ref.rs | 185 - crates/bevy_script_api/src/sub_reflect.rs | 390 - crates/bevy_script_api/src/wrappers.rs | 107 - .../bevy_mod_scripting_lua/Cargo.toml | 1 - .../src/bindings/world.rs | 395 +- .../CHANGELOG.md | 16 - .../bevy_mod_scripting_lua_derive/Cargo.toml | 38 - .../bevy_mod_scripting_lua_derive/readme.md | 3 - .../bevy_mod_scripting_lua_derive/src/arg.rs | 119 - .../src/function.rs | 602 - .../bevy_mod_scripting_lua_derive/src/lib.rs | 543 - .../src/signature.rs | 143 - .../src/visitor.rs | 386 - .../CHANGELOG.md | 14 - .../bevy_mod_scripting_rhai_derive/Cargo.toml | 29 - .../bevy_mod_scripting_rhai_derive/readme.md | 3 - .../bevy_mod_scripting_rhai_derive/src/lib.rs | 13 - crates/macro_tests/Cargo.toml | 1 - release-plz.toml | 17 +- 48 files changed, 2 insertions(+), 39678 deletions(-) delete mode 100644 crates/bevy_mod_scripting_derive/src/input.rs delete mode 100644 crates/bevy_mod_scripting_derive/src/utils.rs delete mode 100644 crates/bevy_script_api/CHANGELOG.md delete mode 100644 crates/bevy_script_api/Cargo.toml delete mode 100644 crates/bevy_script_api/readme.md delete mode 100644 crates/bevy_script_api/src/common/bevy/mod.rs delete mode 100644 crates/bevy_script_api/src/common/mod.rs delete mode 100644 crates/bevy_script_api/src/common/std.rs delete mode 100644 crates/bevy_script_api/src/core_providers.rs delete mode 100644 crates/bevy_script_api/src/error.rs delete mode 100644 crates/bevy_script_api/src/lib.rs delete mode 100644 crates/bevy_script_api/src/lua/bevy/mod.rs delete mode 100644 crates/bevy_script_api/src/lua/mod.rs delete mode 100644 crates/bevy_script_api/src/lua/std.rs delete mode 100644 crates/bevy_script_api/src/lua/util.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_core.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_ecs.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_hierarchy.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_input.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_math.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_reflect.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_time.rs delete mode 100644 crates/bevy_script_api/src/providers/bevy_transform.rs delete mode 100644 crates/bevy_script_api/src/providers/mod.rs delete mode 100644 crates/bevy_script_api/src/rhai/bevy/mod.rs delete mode 100644 crates/bevy_script_api/src/rhai/mod.rs delete mode 100644 crates/bevy_script_api/src/rhai/std.rs delete mode 100644 crates/bevy_script_api/src/script_ref.rs delete mode 100644 crates/bevy_script_api/src/sub_reflect.rs delete mode 100644 crates/bevy_script_api/src/wrappers.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/CHANGELOG.md delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/readme.md delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/src/arg.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/src/function.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/src/lib.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/src/signature.rs delete mode 100644 crates/languages/bevy_mod_scripting_lua_derive/src/visitor.rs delete mode 100644 crates/languages/bevy_mod_scripting_rhai_derive/CHANGELOG.md delete mode 100644 crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml delete mode 100644 crates/languages/bevy_mod_scripting_rhai_derive/readme.md delete mode 100644 crates/languages/bevy_mod_scripting_rhai_derive/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index e22af7cd87..a21bbb7eb5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,12 +79,9 @@ members = [ "crates/bevy_mod_scripting_core", "crates/bevy_event_priority", "crates/languages/bevy_mod_scripting_lua", - "crates/languages/bevy_mod_scripting_lua_derive", "crates/languages/bevy_mod_scripting_rhai", - "crates/languages/bevy_mod_scripting_rhai_derive", "crates/languages/bevy_mod_scripting_rune", "crates/bevy_mod_scripting_common", - "crates/bevy_mod_scripting_derive", "crates/test_utils", "crates/bevy_mod_scripting_functions", ] diff --git a/crates/bevy_mod_scripting_derive/src/input.rs b/crates/bevy_mod_scripting_derive/src/input.rs deleted file mode 100644 index 4fc68695f6..0000000000 --- a/crates/bevy_mod_scripting_derive/src/input.rs +++ /dev/null @@ -1,115 +0,0 @@ -use darling::{util::Flag, FromDeriveInput, FromMeta}; -use proc_macro2::Ident; -use std::ops::{Deref, DerefMut}; -use syn::{spanned::Spanned, visit_mut::VisitMut, Attribute, Field, TraitItemFn, Variant}; - -#[derive(FromMeta)] -pub struct BMSCorePath(pub syn::Path); - -impl Default for BMSCorePath { - fn default() -> Self { - Self(syn::parse_quote!(bevy_mod_scripting::core)) - } -} - -#[derive(FromMeta)] -pub struct BMSLuaPath(pub syn::Path); - -impl Default for BMSLuaPath { - fn default() -> Self { - Self(syn::parse_quote!(bevy_mod_scripting::lua)) - } -} - -#[derive(FromDeriveInput)] -#[darling(attributes(proxy), forward_attrs(allow, doc, cfg))] -pub struct ProxyInput { - /// The name of the type for which we are generating a proxy (target type) - pub ident: syn::Ident, - /// The visibility of the target type - pub vis: syn::Visibility, - /// The generics on the target type - pub generics: syn::Generics, - /// The attributes on the target type - pub attrs: Vec, - - /// The path to the type for which we are generating a proxy if it's a foreign type - pub remote: Option, - - /// if provided will call the function at this path to get the world callback access. Normally this is retrieved using a global variable. - pub get_world_callback_access_fn: Option, - - /// If set will use the given path as the type for the proxy instead of generating a new one - /// Only used for the special world proxies, probably not useful for anything else, the macro assumes we have an inner ReflectReference in the wrapper - pub proxy_as_type: Option, - - /// The path to the bevy_mod_scripting_core crate - #[darling(default)] - pub bms_core_path: BMSCorePath, - /// The path to the bevy_mod_scripting_lua crate - #[darling(default)] - pub bms_lua_path: BMSLuaPath, - - /// The name to use for the proxy type, if not provided the language derive macro - /// will generate one using a standard prefix. - #[darling(rename = "name")] - pub proxy_name: Option, - - /// The body of the type for which we are generating a proxy - pub data: darling::ast::Data, - - /// A list of multi-lang function definitions to be generated on the proxy type - #[darling(default)] - pub functions: TraitItemFnsWrapper, -} - -#[derive(Default)] -pub struct TraitItemFnsWrapper(pub Vec); - -impl FromMeta for TraitItemFnsWrapper { - fn from_string(value: &str) -> darling::Result { - let token_stream: proc_macro2::TokenStream = value.parse().map_err(syn::Error::from)?; - let trait_items_vec = vec![syn::parse2(token_stream)?]; - Ok(TraitItemFnsWrapper(trait_items_vec)) - } - - fn from_list(items: &[darling::ast::NestedMeta]) -> darling::Result { - Ok(TraitItemFnsWrapper( - items - .iter() - .map(Self::from_nested_meta) - .collect::, _>>()? - .into_iter() - .flat_map(|v| v.0.into_iter()) - .collect::>(), - )) - } -} - -impl Deref for TraitItemFnsWrapper { - type Target = Vec; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl DerefMut for TraitItemFnsWrapper { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -/// Replaces every occurence of an identifier with -/// the given string while preserving the original span -pub struct IdentifierRenamingVisitor<'a> { - pub target: &'a str, - pub replacement: &'a str, -} - -impl VisitMut for IdentifierRenamingVisitor<'_> { - fn visit_ident_mut(&mut self, i: &mut Ident) { - if *i == self.target { - *i = Ident::new(self.replacement, i.span()); - } - } -} diff --git a/crates/bevy_mod_scripting_derive/src/lib.rs b/crates/bevy_mod_scripting_derive/src/lib.rs index 0173ccebaa..8b13789179 100644 --- a/crates/bevy_mod_scripting_derive/src/lib.rs +++ b/crates/bevy_mod_scripting_derive/src/lib.rs @@ -1,568 +1 @@ -mod input; -mod utils; -use crate::{input::*, utils::doc_attribute_to_string_lit}; - -use darling::util::Flag; -use std::collections::HashMap; -use syn::{ - parse_macro_input, parse_quote, parse_quote_spanned, punctuated::Punctuated, spanned::Spanned, - DeriveInput, ExprClosure, FnArg, Path, Token, TraitItemFn, -}; - -use darling::{FromAttributes, FromDeriveInput}; -use proc_macro::TokenStream; -use proc_macro2::*; -use quote::*; - -const SELF_ALIAS: &str = "_self"; -const CTXT_ALIAS: &str = "lua"; -const PROXY_PREFIX: &str = "Lua"; - -/// Convert receiver to a standardised form, for example: -/// - instead o a `&self` receiver we have a `_self: LuaRefProxy` -/// - instead of a `&mut self` receiver we have a `_self: LuaRefMutProxy` -/// - instead of a `self` receiver we have a `_self: ValLuaProxy` -/// Returns true if the receiver was changed -fn standardise_receiver( - receiver: &mut FnArg, - target_type: &Path, - bms_lua_path: &Path, - proxy_as_type: Option<&Path>, -) -> bool { - let replacement = if let FnArg::Receiver(receiver) = receiver { - let ref_ = &receiver.reference.as_ref().map(|(amp, lifetime)| { - quote_spanned! {receiver.span()=> - #amp #lifetime - } - }); - - let self_ident = syn::Ident::new(SELF_ALIAS, receiver.span()); - let self_ident_type = match proxy_as_type { - Some(target_type) => { - quote_spanned! {receiver.span()=> - #target_type - } - } - None => { - let unproxy_container_name = match (ref_.is_some(), receiver.mutability.is_some()) { - (true, true) => "LuaReflectRefMutProxy", - (true, false) => "LuaReflectRefProxy", - (false, _) => "LuaReflectValProxy", - }; - let unproxy_ident = syn::Ident::new(unproxy_container_name, receiver.span()); - - quote_spanned! {receiver.span()=> - #bms_lua_path::bindings::proxy::#unproxy_ident::<#target_type> - } - } - }; - - Some(syn::FnArg::Typed(parse_quote_spanned! {receiver.span()=> - #self_ident: #self_ident_type - })) - } else { - None - }; - if let Some(replacement) = replacement { - *receiver = replacement; - true - } else { - false - } -} - -/// Collect all arguments into a tuple, for example: -/// - `fn foo(a: i32, b: f32)` becomes `(name: (i32, f32))` -fn collect_args_in_tuple<'a, I: Iterator>( - args: I, - name: &Ident, - outer_mut: bool, -) -> FnArg { - let (_, arg_types) = args - .map(|arg| { - if let FnArg::Typed(arg) = arg { - (arg.pat.clone(), arg.ty.clone()) - } else { - panic!("Function arguments must be typed") - } - }) - .unzip::<_, _, Vec<_>, Vec<_>>(); - - let outer_mut = if outer_mut { - Some(Token![mut](name.span())) - } else { - None - }; - - parse_quote!( #outer_mut #name : (#(#arg_types),*) ) -} - -/// Convert a function definition to a closure, for example: -/// - `fn foo(a: i32, b: f32) -> f32 { a + b }` becomes `|a: i32, b: f32| { a + b} ` -fn convert_function_def_to_closure(f: &TraitItemFn) -> ExprClosure { - let span = f.span(); - let sig = &f.sig.inputs; - let body = f - .default - .as_ref() - .unwrap_or_else(|| panic!("Function {} must have a body", f.sig.ident)); - parse_quote_spanned! {span => - |#sig| #body - } -} - -/// Processes the function def to wrap it in the necessary proxying logic -/// Will convert the function signature to take in two arguments: -/// - a context argument -/// - a tuple of all arguments passed to the underlying function -fn proxy_wrap_function_def( - f: &mut TraitItemFn, - target_type: &Path, - bms_core: &Path, - bms_lua: &Path, - get_world_callback_access_fn: Option<&Path>, - proxy_as_type: Option<&Path>, - mlua: &Path, - attrs: &FunctionAttrs, -) { - // collect all args into tuple and add lua context arg - let ctxt_alias = syn::Ident::new(CTXT_ALIAS, f.sig.inputs.span()); - - let ctxt_arg = if attrs.with_context.is_present() { - f.sig - .inputs - .pop() - .expect("Expected at least one argument for the context") - .into_value() - } else { - parse_quote_spanned! {f.span()=> - #ctxt_alias: &#mlua::Lua - } - }; - - let ctxt_arg_ident = match &ctxt_arg { - FnArg::Typed(arg) => arg.pat.clone(), - _ => panic!("Expected a typed argument, not a receiver for the context argument"), - }; - - let mut has_receiver = false; - if let Some(first_arg) = f.sig.inputs.first_mut() { - has_receiver = standardise_receiver(first_arg, target_type, bms_lua, proxy_as_type); - }; - - let func_name = &f.sig.ident; - let (mut original_arg_idents, mut original_arg_types) = f - .sig - .inputs - .iter() - .map(|arg| { - if let FnArg::Typed(arg) = arg { - (arg.pat.clone(), arg.ty.clone()) - } else { - panic!("Function arguments must be typed") - } - }) - .unzip::<_, _, Vec<_>, Vec<_>>(); - - let span = f.span(); - let args_ident = format_ident!("args", span = f.sig.inputs.span()); - let args_tail_ident = format_ident!("args_tail", span = f.sig.inputs.span()); - let args_head_ident = format_ident!("args_head", span = f.sig.inputs.span()); - let args_split = if get_world_callback_access_fn.is_some() { - let tail = (1..original_arg_idents.len()).map(|i| { - let i = syn::Index::from(i); - quote_spanned!(span=> #args_ident.#i) - }); - quote_spanned!(span=> - let #args_head_ident = #args_ident.0; - let #args_tail_ident = (#(#tail),*); - ) - } else { - Default::default() - }; - - // change signature to take in a single args tuple instead of multiple arguments (on top of a context arg) - f.sig.inputs = Punctuated::from_iter(vec![ - ctxt_arg, - collect_args_in_tuple(f.sig.inputs.iter(), &args_ident, true), - ]); - - let args_var_to_use = if get_world_callback_access_fn.is_some() { - original_arg_idents.remove(0); - original_arg_types.remove(0); - args_tail_ident - } else { - args_ident - }; - - let out_type = match &f.sig.output { - syn::ReturnType::Default => quote_spanned! {f.span()=> - () - }, - syn::ReturnType::Type(_, ty) => ty.to_token_stream(), - }; - - // wrap function body in our unwrapping and wrapping logic, ignore pre-existing body - let mut fn_call = //std::panic::catch_unwind(|| { - match ( - &f.default, - &attrs.as_trait, - get_world_callback_access_fn.is_some(), - ) { - (_, _, true) => quote_spanned!(span=> - world.#func_name(#(#original_arg_idents),*) - ), - (Some(body), _, _) => { - if attrs.no_proxy.is_present() { - // in this case the entire thing is just this - quote_spanned!(span=> - {(|#ctxt_arg_ident, (#(#original_arg_idents),*) : (#(#original_arg_types),*)|{ #body })(#ctxt_alias, #args_var_to_use)} - ) - } else { - // in this case we are just using this to contain any ? calls and early returns - quote_spanned!(span=> - (|| { #body })() - ) - } - }, - (_, None, _) => quote_spanned!(span=> - #target_type::#func_name(#(#original_arg_idents),*) - ), - (_, Some(trait_path), _) => { - let trait_path = quote_spanned!(span=> #trait_path); - quote_spanned!(span=> - <#target_type as #trait_path>::#func_name(#(#original_arg_idents),*) - ) - } - }; - //}) - // .unwrap(); // todo: handle the error nicer - - if f.sig.unsafety.is_some() { - fn_call = quote_spanned!(span=> - unsafe { #fn_call } - ); - } - - if attrs.no_proxy.is_present() { - f.default = Some(parse_quote_spanned! {span=> - - #fn_call - - }); - } else { - let world = if let Some(world_getter_fn_path) = get_world_callback_access_fn { - quote_spanned!(span=> - let mut world: #bms_core::bindings::WorldCallbackAccess = #world_getter_fn_path(#args_head_ident); - let mut world = world.read().ok_or_else(|| #mlua::Error::external("World no longer exists"))?; - ) - } else { - quote_spanned!(span=> - let mut world: #bms_lua::bindings::proxy::LuaValProxy<#bms_core::bindings::WorldCallbackAccess> = #ctxt_arg_ident.globals().get("world")?; - let mut world = <#bms_lua::bindings::proxy::LuaValProxy<#bms_core::bindings::WorldCallbackAccess> as #bms_core::bindings::Unproxy>::unproxy(&mut world).map_err(#mlua::Error::external)?; - let mut world = world.read().ok_or_else(|| #mlua::Error::external("World no longer exists"))?; - ) - }; - - let proxy_call_name: Ident = if attrs.fallible.is_present() { - format_ident!("try_proxy_call", span = span) - } else { - format_ident!("proxy_call", span = span) - }; - - f.default = Some(parse_quote_spanned! {span=> - { - #args_split - #world - let out: #out_type = world.#proxy_call_name(#args_var_to_use, |(#(#original_arg_idents),*)| { - #fn_call - }).map_err(|e| #mlua::Error::external(e))?; - Ok(out) - } - }); - } -} - -fn generate_methods_registration( - attrs: &FunctionAttrs, - span: Span, - name: proc_macro2::TokenStream, - closure: ExprClosure, -) -> proc_macro2::TokenStream { - let registration_method = if attrs.metamethod.is_some() { - quote_spanned!(span=>add_meta_function) - } else { - quote_spanned!(span=>add_function) - }; - let docs = attrs.doc.iter().map(|doc| { - quote_spanned! {span=> - methods.document(#doc); - } - }); - quote_spanned! {span=> - #(#docs)* - methods.#registration_method(#name, #closure); - } -} - -#[derive(FromAttributes, Clone)] -#[darling(attributes(lua))] -struct FunctionAttrs { - #[darling(multiple)] - pub doc: Vec, - - /// Marks the function as a composite with the given ID, at least one another function with the same composite - /// ID must exist resulting in a combined function being generated. The actual function to dispatch to will be decided based on - /// the types of arguments. If the signature is invalid (i.e. doesn't allow us to dispatch) an error will be thrown - #[darling(default)] - pub composite: Option, - - /// Marks this to be ignored, only used for fields as functions are opt-in - pub skip: Flag, - - /// If passed will generate statement before calling the method - /// on the type - pub as_trait: Option, - - /// If passed will generate a metamethod call instead of using the function name - pub metamethod: Option, - - /// If true will pass in the context as the last argument, - /// i.e. will remove that argument from the function signature and use it's name as the context alias - pub with_context: Flag, - - /// if true will treat output as a fallible result - pub fallible: Flag, - - /// Skips the unproxying & proxying call, useful for functions that don't need to access the world - pub no_proxy: Flag, -} - -#[proc_macro_derive(LuaProxy, attributes(lua, proxy))] -pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { - let derive_input = parse_macro_input!(input as DeriveInput); - - let mut meta: ProxyInput = match ProxyInput::from_derive_input(&derive_input) { - Ok(v) => v, - Err(e) => return darling::Error::write_errors(e).into(), - }; - if meta.proxy_name.is_some() { - // throw error - return syn::Error::new( - derive_input.span(), - "The `name` attribute is not supported for lua proxies", - ) - .to_compile_error() - .into(); - } - - let target_type = meta.remote.unwrap_or(meta.ident.clone().into()); - let target_type_str = target_type.segments.last().unwrap().ident.to_string(); - let proxy_type_ident = match meta.proxy_as_type.as_ref() { - Some(proxy_as_type) => proxy_as_type.clone(), - None => meta - .proxy_name - .unwrap_or_else(|| { - format_ident!( - "{PROXY_PREFIX}{}", - &target_type_str, - span = meta.ident.span() - ) - }) - .into(), - }; - - let bms_core = meta.bms_core_path.0; - let bms_lua = meta.bms_lua_path.0; - let tealr: Path = parse_quote_spanned!(bms_lua.span()=> - #bms_lua::tealr - ); - let mlua: Path = parse_quote_spanned!(bms_core.span()=> - #tealr::mlu::mlua - ); - - // generate type level tealr documentation calls - let type_level_document_calls = meta - .attrs - .iter() - .filter(|&a| a.meta.path().is_ident("doc")) - .map(doc_attribute_to_string_lit) - .map(|tkns| { - quote_spanned!(meta.ident.span()=> - methods.document_type(#tkns); - ) - }); - - // extract composites first - let mut composites: HashMap> = HashMap::new(); - meta.functions.0.retain(|f| { - let attrs = FunctionAttrs::from_attributes(&f.attrs).expect("Function attributes must be valid"); - if let Some(composite_id) = &attrs.composite { - composites - .entry(composite_id.to_owned()) - .or_default() - .push((f.clone(), attrs)); - false - } else { - true - } - }); - - let add_composite_function_stmts = composites.into_values().map(|functions| { - let (first_function, first_function_attrs) = functions - .first() - .cloned() - .expect("At least one function must be a composite for this code to be reached"); - - let name = match &first_function_attrs.metamethod { - Some(metamethod) => quote_spanned!(metamethod.span()=> - #mlua::MetaMethod::#metamethod - ), - None => first_function.sig.ident.to_string().to_token_stream(), - }; - - let value_arg_types = (0..first_function.sig.inputs.len()) - .map(|_| { - quote_spanned!(first_function.span()=> - #mlua::Value - ) - }) - .collect::>(); - - let value_arg_names = (0..first_function.sig.inputs.len()).map(|i| { - format_ident!("arg{}", i, span = first_function.span()) - }).collect::>(); - - let closures = functions - .into_iter() - .map(|(mut f, attrs)| { - proxy_wrap_function_def(&mut f, &target_type, &bms_core, &bms_lua, meta.get_world_callback_access_fn.as_ref() ,meta.proxy_as_type.as_ref(), &mlua, &attrs); - convert_function_def_to_closure(&f) - }) - .collect::>(); - - let closure_args_types = closures.iter().map(|closure| { - let last = closure.inputs.last().expect("Closure must have at least one argument"); - if let syn::Pat::Type(pat_type) = last { - &pat_type.ty - } else { - panic!("Closure must have a single argument tuple as its last argument") - } - }); - - let closure = parse_quote_spanned! {first_function.span()=> - |ctxt, (#(#value_arg_names,)*): (#(#value_arg_types,)*)| { - let args = #mlua::MultiValue::from_vec(vec![#(#value_arg_names,)*]); - #( - if let Ok(args) = <#closure_args_types as #mlua::FromLuaMulti>::from_lua_multi(args.clone(), ctxt) { - let out : Result<_, #mlua::Error> = (#closures)(ctxt, args); - return out?.into_lua(ctxt) - } - )* - Err(#mlua::Error::external("Invalid arguments for composite function")) - } - }; - - generate_methods_registration(&first_function_attrs, first_function.span(), name, closure) - }); - - let add_function_stmts = meta.functions.0.into_iter().filter_map(|mut f| { - let attrs = FunctionAttrs::from_attributes(&f.attrs).expect("Function attributes must be valid"); - - if attrs.skip.is_present() { - return None; - } - - proxy_wrap_function_def( - &mut f, - &target_type, - &bms_core, - &bms_lua, - meta.get_world_callback_access_fn.as_ref(), - meta.proxy_as_type.as_ref(), - &mlua, - &attrs, - ); - - let name = match &attrs.metamethod { - Some(metamethod) => quote_spanned!(metamethod.span()=> - #mlua::MetaMethod::#metamethod - ), - None => f.sig.ident.to_string().to_token_stream(), - }; - let span = f.span(); - - let closure = convert_function_def_to_closure(&f); - - Some(generate_methods_registration(&attrs, span, name, closure)) - }); - - let vis = &meta.vis; - - let definition = if let Some(proxy_as_type) = meta.proxy_as_type.as_ref() { - Default::default() - } else { - quote_spanned!(derive_input.span()=> - #[derive(Clone, Debug, #tealr::mlu::UserData, #tealr::ToTypename)] - #vis struct #proxy_type_ident (pub #bms_core::bindings::ReflectReference); - ) - }; - - let conversions = if let Some(proxy_as_type) = meta.proxy_as_type.as_ref() { - Default::default() - } else { - quote_spanned!(derive_input.span()=> - impl AsRef<#bms_core::bindings::ReflectReference> for #proxy_type_ident { - fn as_ref(&self) -> &#bms_core::bindings::ReflectReference { - &self.0 - } - } - - impl From<#bms_core::bindings::ReflectReference> for #proxy_type_ident { - fn from(r: #bms_core::bindings::ReflectReference) -> Self { - Self(r) - } - } - ) - }; - - quote_spanned! {meta.ident.span()=> - - #definition - - impl #bms_lua::bindings::proxy::LuaProxied for #target_type { - type Proxy = #proxy_type_ident; - } - - impl #tealr::mlu::TealData for #proxy_type_ident { - fn add_methods<'lua, M: #tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut M) { - #(#type_level_document_calls)* - #(#add_composite_function_stmts)* - #(#add_function_stmts)* - } - } - - - impl<'lua> #tealr::mlu::mlua::FromLua<'lua> for #proxy_type_ident { - fn from_lua( - value: #tealr::mlu::mlua::Value<'lua>, - _lua: &#tealr::mlu::mlua::Lua, - ) -> Result { - match value { - tealr::mlu::mlua::Value::UserData(ud) => Ok(ud.borrow::()?.clone()), - _ => { - return Err(#tealr::mlu::mlua::Error::FromLuaConversionError { - from: value.type_name(), - to: stringify!(#proxy_type_ident), - message: None, - }) - } - } - } - } - - #conversions - } - .into() -} diff --git a/crates/bevy_mod_scripting_derive/src/utils.rs b/crates/bevy_mod_scripting_derive/src/utils.rs deleted file mode 100644 index d8df6bb792..0000000000 --- a/crates/bevy_mod_scripting_derive/src/utils.rs +++ /dev/null @@ -1,59 +0,0 @@ -use proc_macro2::{Ident, TokenStream}; -use quote::ToTokens; -use syn::{ - parse::{Parse, ParseStream}, - Attribute, Path, PathArguments, PathSegment, Type, TypePath, -}; - -pub fn doc_attribute_to_string_lit(attrs: &Attribute) -> Option { - attrs - .meta - .require_name_value() - .map(|v| v.value.to_token_stream()) - .ok() -} - -pub fn ident_to_type_path(ident: Ident) -> TypePath { - TypePath { - qself: None, - path: Path { - leading_colon: None, - segments: [PathSegment { - ident, - arguments: PathArguments::None, - }] - .into_iter() - .collect(), - }, - } -} -/// Converts the given ToTokens into token stream, stringifies it and removes whitespace -pub fn stringify_token_group(t: &T) -> String { - let mut k = t.into_token_stream().to_string(); - k.retain(|c| !c.is_whitespace()); - k -} - -/// Converts simple type to base string (i.e. one which has a single type identifier) -pub fn type_base_string(t: &Type) -> Option { - match t { - Type::Paren(v) => type_base_string(&v.elem), - Type::Path(p) => Some(p.path.segments.last()?.ident.to_string()), - Type::Ptr(p) => type_base_string(&p.elem), - Type::Reference(r) => type_base_string(&r.elem), - Type::Slice(v) => type_base_string(&v.elem), - _ => None, - } -} - -#[derive(Default, Debug, Clone)] -pub struct EmptyToken; - -impl Parse for EmptyToken { - fn parse(_: ParseStream) -> Result { - Ok(Self) - } -} -impl ToTokens for EmptyToken { - fn to_tokens(&self, _: &mut TokenStream) {} -} diff --git a/crates/bevy_script_api/CHANGELOG.md b/crates/bevy_script_api/CHANGELOG.md deleted file mode 100644 index c5726fa0ad..0000000000 --- a/crates/bevy_script_api/CHANGELOG.md +++ /dev/null @@ -1,31 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [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 - -- 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 - -- Migrate to bevy 0.14 ([#127](https://github.com/makspll/bevy_mod_scripting/pull/127)) -- Dynamic Queries ([#118](https://github.com/makspll/bevy_mod_scripting/pull/118)) -- Make generated wrappers publically accessible ([#114](https://github.com/makspll/bevy_mod_scripting/pull/114)) -- update metadata diff --git a/crates/bevy_script_api/Cargo.toml b/crates/bevy_script_api/Cargo.toml deleted file mode 100644 index 62cca97815..0000000000 --- a/crates/bevy_script_api/Cargo.toml +++ /dev/null @@ -1,41 +0,0 @@ -[package] -name = "bevy_script_api" -version = "0.9.0-alpha.1" -authors = ["Maksymilian Mozolewski "] -edition = "2021" -license = "MIT OR Apache-2.0" -description = "Bevy API for multiple script languages, part of bevy_mod_scripting." -repository = "https://github.com/makspll/bevy_mod_scripting" -homepage = "https://github.com/makspll/bevy_mod_scripting" -keywords = ["bevy", "gamedev", "scripting", "lua", "rhai"] -categories = ["game-development"] -readme = "readme.md" - -[features] -lua = ["bevy_mod_scripting_lua", "bevy_mod_scripting_lua_derive"] -rhai = ["bevy_mod_scripting_rhai"] - -[dependencies] -bevy = { workspace = true, default-features = false, features = [ - "bevy_asset", - "bevy_animation", - "bevy_core_pipeline", - "bevy_ui", - "bevy_pbr", - "bevy_render", - "bevy_text", - "bevy_sprite", - "file_watcher", - "multi_threaded", -] } -uuid = "1.10" -bevy_mod_scripting_core = { workspace = true } -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.9.0-alpha.1", optional = true } -bevy_mod_scripting_lua_derive = { path = "../languages/bevy_mod_scripting_lua_derive", version = "0.9.0-alpha.1", optional = true } -bevy_mod_scripting_rhai = { path = "../languages/bevy_mod_scripting_rhai", version = "0.9.0-alpha.1", optional = true } -smol_str = "0.2" -allocator-api2 = "0.2" diff --git a/crates/bevy_script_api/readme.md b/crates/bevy_script_api/readme.md deleted file mode 100644 index 2a766e099a..0000000000 --- a/crates/bevy_script_api/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# bevy_script_api - -This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/bevy_script_api/src/common/bevy/mod.rs b/crates/bevy_script_api/src/common/bevy/mod.rs deleted file mode 100644 index 6df4b72e6e..0000000000 --- a/crates/bevy_script_api/src/common/bevy/mod.rs +++ /dev/null @@ -1,443 +0,0 @@ -use crate::ReflectReference; -/// Common functionality for all script hosts -use bevy::{ - ecs::{ - component::ComponentId, - query::QueryBuilder, - world::{Command, EntityRef, World}, - }, - prelude::{ - AppTypeRegistry, BuildChildren, Children, DespawnChildrenRecursive, DespawnRecursive, - Entity, Parent, ReflectComponent, ReflectDefault, ReflectResource, - }, - reflect::{ - DynamicArray, DynamicEnum, DynamicList, DynamicMap, DynamicSet, DynamicStruct, - DynamicTuple, DynamicTupleStruct, TypeRegistration, - }, -}; -use bevy_mod_scripting_core::{prelude::ScriptError, world::WorldPointer}; -use parking_lot::MappedRwLockWriteGuard; -use std::{ - any::Any, - ops::{Deref, DerefMut}, - sync::Arc, -}; - -/// Helper trait for retrieving a world pointer from a script context. -pub trait GetWorld { - type Error; - fn get_world(&self) -> Result; -} - -#[derive(Clone)] -pub struct ScriptTypeRegistration(pub(crate) Arc); - -impl ScriptTypeRegistration { - pub fn new(arc: Arc) -> Self { - Self(arc) - } - - #[inline(always)] - pub fn short_name(&self) -> &str { - self.0.type_info().type_path_table().short_path() - } - - #[inline(always)] - pub fn type_name(&self) -> &'static str { - self.0.type_info().type_path_table().path() - } -} - -impl std::fmt::Debug for ScriptTypeRegistration { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_tuple("ScriptTypeRegistration") - .field(&self.0.type_info().type_path()) - .finish() - } -} - -impl std::fmt::Display for ScriptTypeRegistration { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(self.0.type_info().type_path()) - } -} - -impl Deref for ScriptTypeRegistration { - type Target = TypeRegistration; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -#[derive(Clone)] -pub struct ScriptQueryBuilder { - world: ScriptWorld, - components: Vec, - with: Vec, - without: Vec, -} - -impl ScriptQueryBuilder { - pub fn new(world: ScriptWorld) -> Self { - Self { - world, - components: vec![], - with: vec![], - without: vec![], - } - } - - pub fn components(&mut self, components: Vec) -> &mut Self { - self.components.extend(components); - self - } - - pub fn with(&mut self, with: Vec) -> &mut Self { - self.with.extend(with); - self - } - - pub fn without(&mut self, without: Vec) -> &mut Self { - self.without.extend(without); - self - } - - pub fn build(&mut self) -> Result, ScriptError> { - self.world.query( - std::mem::take(&mut self.components), - std::mem::take(&mut self.with), - std::mem::take(&mut self.without), - ) - } -} - -#[derive(Clone)] -pub struct ScriptQueryResult(pub Entity, pub Vec); - -#[derive(Clone, Debug)] -pub struct ScriptWorld(WorldPointer); - -impl std::fmt::Display for ScriptWorld { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str("World") - } -} - -impl Deref for ScriptWorld { - type Target = WorldPointer; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for ScriptWorld { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl AsRef for ScriptWorld { - fn as_ref(&self) -> &WorldPointer { - &self.0 - } -} - -impl From for WorldPointer { - fn from(val: ScriptWorld) -> Self { - val.0 - } -} - -impl ScriptWorld { - pub fn new(ptr: WorldPointer) -> Self { - Self(ptr) - } - - pub fn get_children(&self, parent: Entity) -> Vec { - let w = self.read(); - w.get::(parent) - .map(|v| v.to_vec()) - .unwrap_or_default() - } - - pub fn get_parent(&self, entity: Entity) -> Option { - let w = self.read(); - w.get::(entity).map(|parent| parent.get()) - } - - pub fn push_child(&self, parent: Entity, child: Entity) { - let mut w = self.write(); - 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 Ok(mut entity) = w.get_entity_mut(parent) { - entity.remove_children(children); - } - } - - pub fn insert_children(&self, parent: Entity, index: usize, children: &[Entity]) { - let mut w = self.write(); - - 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, warn: true }.apply(&mut w); - } - - pub fn despawn_recursive(&self, entity: Entity) { - let mut w = self.write(); - DespawnRecursive { entity, warn: true }.apply(&mut w); - } - - pub fn get_type_by_name(&self, type_name: &str) -> Option { - let w = self.read(); - - let registry: &AppTypeRegistry = w.get_resource().unwrap(); - - let registry = registry.read(); - - registry - .get_with_short_type_path(type_name) - .or_else(|| registry.get_with_type_path(type_name)) - .map(|registration| ScriptTypeRegistration::new(Arc::new(registration.clone()))) - } - - pub fn add_default_component( - &self, - entity: Entity, - comp_type: ScriptTypeRegistration, - ) -> Result { - let mut w = self.write(); - - // Remove: AppTypeRegistry - let registry: AppTypeRegistry = w.remove_resource().unwrap(); - - let mut entity_ref = w - .get_entity_mut(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())) - })?; - - let registry_lock = registry.read(); - - // this is just a formality - // TODO: maybe get an add_default impl added to ReflectComponent - // this means that we don't require ReflectDefault for adding components! - match comp_type.0.type_info(){ - bevy::reflect::TypeInfo::Struct(_) => component_data.insert(&mut entity_ref, &DynamicStruct::default(), ®istry_lock), - bevy::reflect::TypeInfo::TupleStruct(_) => component_data.insert(&mut entity_ref, &DynamicTupleStruct::default(), ®istry_lock), - bevy::reflect::TypeInfo::Tuple(_) => component_data.insert(&mut entity_ref, &DynamicTuple::default(), ®istry_lock), - 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::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_partial_reflect(), - ®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); - - // Insert: AppTypeRegistry - w.insert_resource(registry); - - Ok(ReflectReference::new_component_ref( - component_data.clone(), - entity, - self.clone().into(), - )) - } - - pub fn get_component( - &self, - entity: Entity, - comp_type: ScriptTypeRegistration, - ) -> Result, ScriptError> { - let w = self.read(); - - let entity_ref = w - .get_entity(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())) - })?; - - Ok(component_data.reflect(entity_ref).map(|_component| { - ReflectReference::new_component_ref(component_data.clone(), entity, self.clone().into()) - })) - } - - pub fn has_component( - &self, - entity: Entity, - comp_type: ScriptTypeRegistration, - ) -> Result { - let w = self.read(); - let component_data = comp_type.data::().ok_or_else(|| { - ScriptError::Other(format!("Not a component {}", comp_type.short_name())) - })?; - - let entity_ref = w - .get_entity(entity) - .map_err(|e| ScriptError::Other(format!("Entity is not valid {:#?}. {e}", entity)))?; - - Ok(component_data.reflect(entity_ref).is_some()) - } - - pub fn remove_component( - &mut self, - entity: Entity, - comp_type: ScriptTypeRegistration, - ) -> Result<(), ScriptError> { - let mut w = self.write(); - - let mut entity_ref = w - .get_entity_mut(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())) - })?; - component_data.remove(&mut entity_ref); - Ok(()) - } - - pub fn get_resource( - &self, - res_type: ScriptTypeRegistration, - ) -> Result, ScriptError> { - let w = self.read(); - - let resource_data = res_type.data::().ok_or_else(|| { - ScriptError::Other(format!("Not a resource {}", res_type.short_name())) - })?; - - Ok(resource_data.reflect(&w).map(|_res| { - ReflectReference::new_resource_ref(resource_data.clone(), self.clone().into()) - })) - } - - pub fn has_resource(&self, res_type: ScriptTypeRegistration) -> Result { - let w = self.read(); - - let resource_data = res_type.data::().ok_or_else(|| { - ScriptError::Other(format!("Not a resource {}", res_type.short_name())) - })?; - - Ok(resource_data.reflect(&w).is_some()) - } - - pub fn remove_resource(&mut self, res_type: ScriptTypeRegistration) -> Result<(), ScriptError> { - let mut w = self.write(); - - let resource_data = res_type.data::().ok_or_else(|| { - ScriptError::Other(format!("Not a resource {}", res_type.short_name())) - })?; - resource_data.remove(&mut w); - Ok(()) - } - - pub fn query( - &mut self, - components: Vec, - with: Vec, - without: Vec, - ) -> Result, ScriptError> { - let mut w = self.write(); - - let get_id = |component: &ScriptTypeRegistration, - w: &MappedRwLockWriteGuard| - -> Result { - w.components() - .get_id(component.type_info().type_id()) - .ok_or_else(|| { - ScriptError::Other(format!("Not a component {}", component.short_name())) - }) - }; - - let components: Vec<(ReflectComponent, ComponentId)> = components - .into_iter() - .map(|component| { - let reflect_component = component.data::().ok_or_else(|| { - ScriptError::Other(format!("Not a component {}", component.short_name())) - }); - - let component_id = get_id(&component, &w); - reflect_component.map(|v1| component_id.map(|v2| (v1.clone(), v2)))? - }) - .collect::, ScriptError>>()?; - - let with_ids: Vec = with - .iter() - .map(|component| get_id(component, &w)) - .collect::, ScriptError>>()?; - - let without_ids: Vec = without - .iter() - .map(|component| get_id(component, &w)) - .collect::, ScriptError>>()?; - - let mut q = QueryBuilder::::new(&mut w); - - for (_, id) in &components { - q.ref_id(*id); - } - - for with_id in with_ids { - q.with_id(with_id); - } - - for without_id in without_ids { - q.without_id(without_id); - } - - let query_result: Vec> = q.build().iter_mut(&mut w).collect(); - - query_result - .into_iter() - .map(|filtered_entity| { - components - .clone() - .into_iter() - .map(|(reflect_component, _)| { - let type_id = reflect_component.type_id(); - reflect_component - .reflect(filtered_entity) - .map(|_component| { - ReflectReference::new_component_ref( - reflect_component, - filtered_entity.id(), - self.clone().into(), - ) - }) - .ok_or_else(|| { - ScriptError::Other(format!( - "Failed to reflect component during query: {:?}", - type_id - )) - }) - }) - .collect::, ScriptError>>() - .map(|references| ScriptQueryResult(filtered_entity.id(), references)) - }) - .collect::, ScriptError>>() - } -} diff --git a/crates/bevy_script_api/src/common/mod.rs b/crates/bevy_script_api/src/common/mod.rs deleted file mode 100644 index 70b747d31c..0000000000 --- a/crates/bevy_script_api/src/common/mod.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod bevy; -pub mod std; diff --git a/crates/bevy_script_api/src/common/std.rs b/crates/bevy_script_api/src/common/std.rs deleted file mode 100644 index f3da1234ff..0000000000 --- a/crates/bevy_script_api/src/common/std.rs +++ /dev/null @@ -1,141 +0,0 @@ -use std::marker::PhantomData; - -use bevy::reflect::{FromReflect, GetTypeRegistration, TypePath, Typed}; - -use crate::{error::ReflectionError, ReflectReference, ValueIndex}; - -pub struct ScriptVec { - pub(crate) ref_: ReflectReference, - _ph: PhantomData, -} - -impl Clone for ScriptVec { - fn clone(&self) -> Self { - Self { - ref_: self.ref_.clone(), - _ph: PhantomData, - } - } -} - -impl std::fmt::Debug for ScriptVec { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("ScriptVec") - .field("ref_", &self.ref_) - .finish() - } -} - -impl std::fmt::Display - for ScriptVec -{ - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - let str = self - .ref_ - .get_typed(|s: &Vec| s.iter().map(|v| format!("{v}")).collect::>()) - .map_err(|_| std::fmt::Error)? - .join(","); - f.write_str("[")?; - f.write_str(&str)?; - f.write_str("]") - } -} - -impl ScriptVec { - pub fn new_ref(ref_: ReflectReference) -> Self { - Self { - ref_, - _ph: PhantomData, - } - } - - pub fn is_empty(&self) -> Result { - Ok(self.len()? == 0) - } - - pub fn len(&self) -> Result { - self.ref_.get_typed(|s: &Vec| s.len()) - } - - pub fn push(&mut self, val: T) -> Result<(), ReflectionError> { - self.ref_.get_mut_typed(|s: &mut Vec| { - s.push(val); - Ok(()) - })? - } - - pub fn pop(&mut self) -> Result, ReflectionError> { - self.ref_.get_mut_typed(|s: &mut Vec| s.pop()) - } - - pub fn clear(&mut self) -> Result<(), ReflectionError> { - self.ref_.get_mut_typed(|s: &mut Vec| { - s.clear(); - Ok(()) - })? - } - - pub fn insert(&mut self, idx: usize, val: T) -> Result<(), ReflectionError> { - self.ref_.get_mut_typed(|s: &mut Vec| { - s.insert(idx, val); - Ok(()) - })? - } - - pub fn remove(&mut self, idx: usize) -> Result { - self.ref_ - .get_mut_typed(|s: &mut Vec| Ok(s.remove(idx)))? - } -} - -impl ValueIndex for ScriptVec { - type Output = ReflectReference; - - fn index(&self, index: usize) -> Self::Output { - self.ref_.index(index) - } -} - -impl From> for ReflectReference { - fn from(v: ScriptVec) -> Self { - v.ref_ - } -} - -pub struct ScriptVecIterator { - current: usize, - len: usize, - base: ScriptVec, -} - -impl Iterator for ScriptVecIterator { - type Item = ReflectReference; - - fn next(&mut self) -> Option { - let nxt = (self.current < self.len).then(|| self.base.index(self.current)); - self.current += 1; - nxt - } -} - -impl IntoIterator for ScriptVec { - type Item = ReflectReference; - - type IntoIter = ScriptVecIterator; - - /// Converts the vector into an iterator over references - /// - /// # Panics - /// will panic if the base reference is invalid or mutably locked - fn into_iter(self) -> Self::IntoIter { - ScriptVecIterator { - current: 0, - // TODO?: end used to be an Option, and this check moved into the next method but - // I am not sure if this will ever realistically fail, so if you do get this exception happening - // hit me with an issue - // if len > 0, subtract 1, otherwise set to 0 - len: self.len().expect("Failed to get length of ScriptVec"), - base: self, - } - } -} diff --git a/crates/bevy_script_api/src/core_providers.rs b/crates/bevy_script_api/src/core_providers.rs deleted file mode 100644 index 814a499c86..0000000000 --- a/crates/bevy_script_api/src/core_providers.rs +++ /dev/null @@ -1,115 +0,0 @@ -use crate::lua::RegisterForeignLuaType; - -pub struct LuaCoreBevyAPIProvider; - -#[derive(Default)] -pub(crate) struct CoreBevyGlobals; - -crate::impl_tealr_generic!(pub(crate) struct T); - -impl bevy_mod_scripting_lua::tealr::mlu::ExportInstances for CoreBevyGlobals { - 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( - "world", - crate::lua::util::DummyTypeName::::new, - )?; - instances.add_instance( - "script", - crate::lua::util::DummyTypeName::::new, - )?; - instances.add_instance( - "entity", - crate::lua::util::DummyTypeName::::new, - )?; - Ok(()) - } -} - -impl bevy_mod_scripting_core::hosts::APIProvider for LuaCoreBevyAPIProvider { - 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(CoreBevyGlobals, 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( - "CoreBevyAPI", - |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::() - }, - )) - } - - fn setup_script( - &mut self, - script_data: &bevy_mod_scripting_core::hosts::ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { - let ctx = ctx.get_mut().expect("Could not get context"); - let globals = ctx.globals(); - globals - .set( - "entity", - crate::providers::bevy_ecs::LuaEntity::new(script_data.entity), - ) - .map_err(bevy_mod_scripting_core::error::ScriptError::new_other)?; - globals - .set::<_, crate::lua::bevy::LuaScriptData>("script", script_data.into()) - .map_err(bevy_mod_scripting_core::error::ScriptError::new_other)?; - - 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> { - let ctx = ctx.get_mut().expect("Could not get context"); - let globals = ctx.globals(); - globals - .set("world", crate::lua::bevy::LuaWorld::new(world_ptr)) - .map_err(bevy_mod_scripting_core::error::ScriptError::new_other) - } - - 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::(); - } -} diff --git a/crates/bevy_script_api/src/error.rs b/crates/bevy_script_api/src/error.rs deleted file mode 100644 index aa2ae6226b..0000000000 --- a/crates/bevy_script_api/src/error.rs +++ /dev/null @@ -1,37 +0,0 @@ -use std::borrow::Cow; -use thiserror::Error; - -#[derive(Error, Debug, Clone)] -pub enum ReflectionError { - #[error("Base reference `{base}` is invalid. {reason}")] - InvalidBaseReference { base: String, reason: String }, - #[error("Insuficient provenance error while accessing `{path}`. {msg}")] - InsufficientProvenance { path: String, msg: String }, - #[error("Invalid reflection path: `{path}`. {msg}")] - InvalidReflectionPath { path: String, msg: String }, - #[error("Cannot downcast from `{from}` to `{to}`")] - CannotDowncast { - from: Cow<'static, str>, - to: Cow<'static, str>, - }, - #[error("{0}")] - Other(String), -} - -#[cfg(feature = "lua")] -impl From for bevy_mod_scripting_lua::tealr::mlu::mlua::Error { - fn from(e: ReflectionError) -> Self { - bevy_mod_scripting_lua::tealr::mlu::mlua::Error::RuntimeError(e.to_string()) - } -} - -#[cfg(feature = "rhai")] -impl From for Box { - fn from(e: ReflectionError) -> Self { - bevy_mod_scripting_rhai::rhai::EvalAltResult::ErrorRuntime( - e.to_string().into(), - bevy_mod_scripting_rhai::rhai::Position::NONE, - ) - .into() - } -} diff --git a/crates/bevy_script_api/src/lib.rs b/crates/bevy_script_api/src/lib.rs deleted file mode 100644 index ca79c6d111..0000000000 --- a/crates/bevy_script_api/src/lib.rs +++ /dev/null @@ -1,45 +0,0 @@ -extern crate bevy; - -pub mod error; -#[cfg(feature = "lua")] -pub mod lua; -#[cfg(feature = "rhai")] -pub mod rhai; - -pub mod common; - -#[cfg(feature = "lua")] -pub mod core_providers; -// for now providers do not support any other lang so just remove this whole module if they are not needed -#[cfg(feature = "lua")] -pub mod providers; - -pub mod script_ref; -pub mod sub_reflect; -pub mod wrappers; - -pub use {script_ref::*, sub_reflect::*}; - -pub mod prelude { - #[cfg(feature = "lua")] - pub use crate::{ - core_providers::LuaCoreBevyAPIProvider, - lua::{std::LuaVec, FromLuaProxy, IntoLuaProxy, LuaProxyable, ReflectLuaProxyable}, - providers::LuaBevyAPIProvider, - LuaProxy, - }; - - #[cfg(feature = "rhai")] - pub use crate::rhai::{ - bevy::RhaiBevyAPIProvider, - std::{RhaiCopy, RhaiVec}, - FromRhaiProxy, ReflectRhaiProxyable, RhaiProxyable, ToRhaiProxy, - }; - - pub use crate::{common::bevy::GetWorld, ValueIndex}; -} - -#[cfg(feature = "lua")] -pub use bevy_mod_scripting_lua_derive::LuaProxy; - -pub use parking_lot; diff --git a/crates/bevy_script_api/src/lua/bevy/mod.rs b/crates/bevy_script_api/src/lua/bevy/mod.rs deleted file mode 100644 index 54715102b7..0000000000 --- a/crates/bevy_script_api/src/lua/bevy/mod.rs +++ /dev/null @@ -1,386 +0,0 @@ -use crate::common::bevy::{ - ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, ScriptWorld, -}; -use crate::lua::{ - mlua::prelude::{IntoLuaMulti, LuaError, LuaMultiValue}, - tealr::{mlu::TypedFunction, ToTypename}, - util::{VariadicComponents, VariadicQueryResult}, - Lua, -}; -use crate::providers::bevy_ecs::LuaEntity; -use crate::{impl_from_lua_with_clone, impl_tealr_type}; -use bevy::hierarchy::BuildChildren; -use bevy::prelude::{AppTypeRegistry, ReflectResource}; -use bevy_mod_scripting_core::prelude::*; -use bevy_mod_scripting_lua::{prelude::IntoLua, tealr}; -use std::sync::Arc; - -use tealr::mlu::{ - mlua::{self}, - TealData, TealDataMethods, -}; - -use super::util::LuaIndex; - -pub type LuaTypeRegistration = ScriptTypeRegistration; -impl_tealr_type!(LuaTypeRegistration); -impl_from_lua_with_clone!(LuaTypeRegistration); - -impl TealData for LuaTypeRegistration { - fn add_methods<'lua, T: TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.document_type("An object representing an existing and registered rust type."); - methods.document_type("Can be obtained via [`LuaWorld::get_type_by_name`]."); - } - - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(fields: &mut F) { - fields.document("The [short name](https://docs.rs/bevy/latest/bevy/reflect/struct.TypeRegistration.html#method.get_short_name) of a type"); - fields.add_field_method_get("short_name", |_, s| Ok(s.short_name().to_string())); - - fields.document("The full name of the type"); - fields.add_field_method_get("type_name", |_, s| Ok(s.type_name())); - } -} - -#[derive(Debug)] -pub struct LuaScriptData { - sid: u32, -} - -impl From<&ScriptData<'_>> for LuaScriptData { - fn from(sd: &ScriptData) -> Self { - Self { sid: sd.sid } - } -} - -impl_tealr_type!(LuaScriptData); - -impl TealData for LuaScriptData { - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(fields: &mut F) { - fields.document("The unique ID of this script"); - fields.add_field_method_get("sid", |_, s| Ok(s.sid)) - } - - fn add_methods<'lua, T: TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.add_meta_method(tealr::mlu::mlua::MetaMethod::ToString, |_, s, ()| { - Ok(format!("{:?}", s)) - }); - } -} - -pub type LuaQueryResult = ScriptQueryResult; - -impl_from_lua_with_clone!(LuaQueryResult); - -impl IntoLuaMulti<'_> for LuaQueryResult { - fn into_lua_multi(self, lua: &Lua) -> Result, LuaError> { - let mut values = LuaMultiValue::from_vec( - self.1 - .into_iter() - .map(|v| v.into_lua(lua)) - .collect::, LuaError>>()?, - ); - values.push_front(LuaEntity::new(self.0).into_lua(lua)?); - Ok(values) - } -} - -impl ToTypename for LuaQueryResult { - fn to_typename() -> bevy_mod_scripting_lua::tealr::Type { - bevy_mod_scripting_lua::tealr::Type::new_single( - stringify!(QueryResult), - bevy_mod_scripting_lua::tealr::KindOfType::External, - ) - } -} - -pub type LuaQueryBuilder = ScriptQueryBuilder; - -impl_tealr_type!(LuaQueryBuilder); -impl_from_lua_with_clone!(LuaQueryBuilder); - -impl TealData for LuaQueryBuilder { - fn add_fields<'lua, F: tealr::mlu::TealDataFields<'lua, Self>>(fields: &mut F) { - fields.document("A Builder object which allows for filtering and iterating over components and entities in the world."); - } - - fn add_methods<'lua, T: TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.document("Filters out entities without any of the components passed"); - methods.add_method_mut("with", |_, s, components: VariadicComponents| { - s.with(components.0); - Ok(s.clone()) - }); - - methods.document("Filters out entities with any components passed"); - methods.add_method_mut("without", |_, s, components: VariadicComponents| { - s.without(components.0); - Ok(s.clone()) - }); - - methods - .document("Queries the world and returns an iterator over the entity and components."); - methods.add_method_mut("iter", |ctx, s, _: ()| { - let query_result = s - .build() - .map_err(|e| mlua::Error::RuntimeError(e.to_string()))?; - - let len = query_result.len(); - let mut curr_idx = 0; - TypedFunction::from_rust_mut( - move |_, ()| { - let o = if curr_idx < len { - let query_result = query_result.get(curr_idx).unwrap(); - VariadicQueryResult::Some( - LuaEntity::new(query_result.0), - query_result.1.clone(), - ) - } else { - VariadicQueryResult::None - }; - curr_idx += 1; - Ok(o) - }, - ctx, - ) - }); - } -} - -pub type LuaWorld = ScriptWorld; - -impl_tealr_type!(LuaWorld); -impl_from_lua_with_clone!(LuaWorld); - -impl TealData for LuaWorld { - fn add_methods<'lua, T: TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.document_type("Represents the bevy world all scripts live in."); - methods.document_type("Provides ways to interact with and modify the world."); - - methods.add_meta_method(tealr::mlu::mlua::MetaMethod::ToString, |_, s, ()| { - Ok(format!("{s:?}")) - }); - - methods.document("Retrieves type information given either a short (`MyType`) or fully qualified rust type name (`MyModule::MyType`)."); - methods.document( - "Returns `nil` if no such type exists or if one wasn't registered on the rust side.", - ); - methods.document("\n"); - methods.document("This is used extensively in [`LuaWorld`]"); - methods.add_method("get_type_by_name", |_, world, type_name: String| { - let w = world.read(); - - let registry: &AppTypeRegistry = w.get_resource().unwrap(); - - let registry = registry.read(); - - Ok(registry - .get_with_short_type_path(&type_name) - .or_else(|| registry.get_with_type_path(&type_name)) - .map(|registration| LuaTypeRegistration::new(Arc::new(registration.clone())))) - }); - - methods.document("Inserts a component of the given type to the given entity by instantiating a default version of it."); - methods.document("The component can then be modified using field access."); - methods.add_method( - "add_default_component", - |_, world, (entity, comp_type): (LuaEntity, LuaTypeRegistration)| { - world - .add_default_component(entity.inner()?, comp_type) - .map_err(|e| mlua::Error::RuntimeError(e.to_string())) - }, - ); - - methods.document("Retrieves a component of the given type from the given entity."); - methods.document("If such a component does not exist returns `nil`."); - methods.add_method( - "get_component", - |_, world, (entity, comp_type): (LuaEntity, LuaTypeRegistration)| { - world - .get_component(entity.inner()?, comp_type) - .map_err(|e| mlua::Error::RuntimeError(e.to_string())) - }, - ); - - methods.document("Creates a LuaQueryBuilder, querying for the passed components types."); - methods.document("Can be iterated over using `LuaQueryBuilder:iter()`"); - methods.add_method_mut("query", |_, world, components: VariadicComponents| { - Ok(LuaQueryBuilder::new(world.clone()) - .components(components.0) - .clone()) - }); - - methods - .document("Returns `true` if the given entity contains a component of the given type."); - methods.add_method( - "has_component", - |_, world, (entity, comp_type): (LuaEntity, LuaTypeRegistration)| { - world - .has_component(entity.inner()?, comp_type) - .map_err(|e| mlua::Error::RuntimeError(e.to_string())) - }, - ); - - methods.document("Removes the given component from the given entity, does nothing if it doesn't exist on the entity."); - methods.add_method_mut( - "remove_component", - |_, world, (entity, comp_type): (LuaEntity, LuaTypeRegistration)| { - world - .remove_component(entity.inner()?, comp_type) - .map_err(|e| mlua::Error::RuntimeError(e.to_string())) - }, - ); - - methods.document("Retrieves a resource of the given type from the world."); - methods.document("If such a resource does not exist returns `nil`."); - methods.add_method("get_resource", |_, world, res_type: LuaTypeRegistration| { - world - .get_resource(res_type) - .map_err(|e| mlua::Error::RuntimeError(e.to_string())) - }); - - methods.document( - "Removes the given resource from the world, if one doesn't exist it does nothing.", - ); - methods.add_method( - "remove_resource", - |_, world, res_type: LuaTypeRegistration| { - let mut w = world.write(); - - let resource_data = res_type.data::().ok_or_else(|| { - mlua::Error::RuntimeError(format!("Not a resource {}", res_type.short_name())) - })?; - resource_data.remove(&mut w); - Ok(()) - }, - ); - - methods.document("Returns `true` if the world contains a resource of the given type."); - methods.add_method("has_resource", |_, world, res_type: LuaTypeRegistration| { - let w = world.read(); - - let resource_data = res_type.data::().ok_or_else(|| { - mlua::Error::RuntimeError(format!("Not a resource {}", res_type.short_name())) - })?; - - Ok(resource_data.reflect(&w).is_some()) - }); - - methods.document("Retrieves children entities of the parent entity if it has any."); - methods.add_method("get_children", |_, world, parent: LuaEntity| { - Ok(world - .get_children(parent.inner()?) - .into_iter() - .map(LuaEntity::new) - .collect::>()) - }); - - methods.document("Retrieves the parent entity of the given entity if it has any."); - methods.add_method("get_parent", |_, world, parent: LuaEntity| { - Ok(world.get_parent(parent.inner()?).map(LuaEntity::new)) - }); - - methods.document("Attaches children entities to the given parent entity."); - methods.add_method( - "push_children", - |_, world, (parent, children): (LuaEntity, Vec)| { - let mut w = world.write(); - let children = children - .iter() - .map(|e| e.inner()) - .collect::, _>>()?; - - if let Ok(mut entity) = w.get_entity_mut(parent.inner()?) { - entity.add_children(&children); - } - - Ok(()) - }, - ); - - methods.document("Attaches child entity to the given parent entity."); - methods.add_method_mut( - "push_child", - |_, world, (parent, child): (LuaEntity, LuaEntity)| { - world.push_child(parent.inner()?, child.inner()?); - Ok(()) - }, - ); - - methods.document("Removes children entities from the given parent entity."); - methods.add_method( - "remove_children", - |_, world, (parent, children): (LuaEntity, Vec)| { - let children = children - .iter() - .map(|e| e.inner()) - .collect::, _>>()?; - - world.remove_children(parent.inner()?, &children); - Ok(()) - }, - ); - - methods.document("Removes child entity from the given parent entity."); - methods.add_method( - "remove_child", - |_, world, (parent, child): (LuaEntity, LuaEntity)| { - world.remove_children(parent.inner()?, &[child.inner()?]); - Ok(()) - }, - ); - - methods - .document("Inserts children entities to the given parent entity at the given index."); - methods.add_method( - "insert_children", - |_, world, (parent, index, children): (LuaEntity, LuaIndex, Vec)| { - let children = children - .iter() - .map(|e| e.inner()) - .collect::, _>>()?; - - world.insert_children(parent.inner()?, *index, &children); - Ok(()) - }, - ); - - methods.document("Inserts child entity to the given parent entity at the given index."); - methods.add_method( - "insert_child", - |_, world, (parent, index, child): (LuaEntity, LuaIndex, LuaEntity)| { - world.insert_children(parent.inner()?, *index, &[child.inner()?]); - Ok(()) - }, - ); - - methods.document("Despawns the given entity's children recursively"); - methods.add_method( - "despawn_children_recursive", - |_, world, entity: LuaEntity| { - world.despawn_children_recursive(entity.inner()?); - Ok(()) - }, - ); - - methods.document("Despawns the given entity and the entity's children recursively"); - methods.add_method("despawn_recursive", |_, world, entity: LuaEntity| { - world.despawn_recursive(entity.inner()?); - Ok(()) - }); - - methods.document("Spawns a new entity and returns its Entity ID"); - methods.add_method("spawn", |_, world, ()| { - let mut w = world.write(); - - Ok(LuaEntity::new(w.spawn(()).id())) - }); - - methods.document( - "Despawns the given entity if it exists, returns true if deletion was successfull", - ); - methods.add_method("despawn", |_, world, entity: LuaEntity| { - let mut w = world.write(); - - Ok(w.despawn(entity.inner()?)) - }); - } -} diff --git a/crates/bevy_script_api/src/lua/mod.rs b/crates/bevy_script_api/src/lua/mod.rs deleted file mode 100644 index 5338fb9c93..0000000000 --- a/crates/bevy_script_api/src/lua/mod.rs +++ /dev/null @@ -1,306 +0,0 @@ -use ::std::any::TypeId; -use ::std::borrow::Cow; - -use crate::common::bevy::GetWorld; -use crate::{impl_from_lua_with_clone, impl_tealr_type}; -use ::bevy::prelude::{App, AppTypeRegistry}; - -use ::bevy::reflect::{FromType, GetTypeRegistration, Reflect}; - -use bevy_mod_scripting_core::world::WorldPointer; -use bevy_mod_scripting_lua::tealr::{self, ToTypename}; - -use tealr::mlu::mlua::MetaMethod; -use tealr::mlu::{ - mlua::{self, FromLua, IntoLua, Lua, UserData, Value}, - TealData, TealDataMethods, -}; - -use crate::script_ref::{ReflectReference, ReflectedValue, ValueIndex}; - -use self::bevy::LuaWorld; -use self::util::to_host_idx; - -pub mod bevy; -pub mod std; -pub mod util; - -/// A trait allowing to register the [`LuaProxyable`] trait with the type registry for foreign types -/// -/// If you have access to the type you should prefer to use `#[reflect(LuaProxyable)]` instead. -/// This is exactly equivalent. -pub trait RegisterForeignLuaType { - /// Register an instance of `ReflecLuaProxyable` type data on this type's registration, - /// if a registration does not yet exist, creates one. - fn register_foreign_lua_type( - &mut self, - ) -> &mut Self; -} - -impl RegisterForeignLuaType for App { - fn register_foreign_lua_type( - &mut self, - ) -> &mut Self { - { - let registry = self.world_mut().resource_mut::(); - let mut registry = registry.write(); - - let user_data = >::from_type(); - - if let Some(registration) = registry.get_mut(TypeId::of::()) { - registration.insert(user_data) - } else { - let mut registration = T::get_type_registration(); - registration.insert(user_data); - registry.add_registration(registration); - } - } - - self - } -} - -impl ValueIndex> for ReflectReference { - type Output = Result; - - fn index(&self, index: Value<'_>) -> Self::Output { - match index { - Value::Integer(idx) => Ok(self.index(to_host_idx(idx as usize))), - Value::String(field) => { - let str_ = field.to_str()?.to_string(); - // TODO: hopefully possible to use a &'_ str here - // but this requires Reflect implementation for &str - Ok(>>::index( - self, - str_.into(), - )) - } - _ => Err(mlua::Error::RuntimeError(format!( - "Cannot index a rust object with {:?}", - index - ))), - } - } -} - -/// For internal use only. -/// -/// Mainly necessary for separation of concerns on the [`ReflectReference`] type, but might have other uses potentially. -/// -/// This is not the same as [`LuaProxyable`], internally this in fact will use [`LuaProxyable`] so treating it like so will cause inifnite loops. -pub(crate) trait ApplyLua { - /// set the proxied object with the given lua value - fn apply_lua<'lua>(&mut self, ctx: &'lua Lua, v: Value<'lua>) -> mlua::Result<()>; -} -impl ApplyLua for ReflectReference { - /// Applies the given lua value to the proxied reflect type. Semantically equivalent to `Reflect::apply` - fn apply_lua<'lua>(&mut self, ctx: &'lua Lua, v: Value<'lua>) -> Result<(), mlua::Error> { - let luaworld = ctx.globals().get::<_, LuaWorld>("world").unwrap(); - - // remove typedata from the world to be able to manipulate world - let proxyable = { - let world = luaworld.read(); - let type_registry = world.resource::().read(); - type_registry - .get_type_data::(self.get(|s| s.type_id())?) - .cloned() - }; - - if let Some(ud) = proxyable { - return ud.apply_lua(self, ctx, v); - } else if let Value::UserData(v) = &v { - if v.is::() { - let b = v.take::().unwrap(); - self.apply(&b.into())?; - return Ok(()); - } - } - - Err(mlua::Error::RuntimeError(self.get(|s| - format!("Attempted to assign `{}` = {v:?}. Did you forget to call `app.register_foreign_lua_type::<{}>`?", - self.path, - s.get_represented_type_info().unwrap().type_path() - ))?) - ) - } -} - -impl<'lua> IntoLua<'lua> for ReflectReference { - /// Converts the LuaRef to the most convenient representation - /// checking conversions in this order: - /// - A primitive or bevy type which has a reflect interface is converted to a custom UserData exposing its API to lua conveniently - /// - A type implementing CustomUserData is converted with its `ref_to_lua` method - /// - Finally the method is represented as a `ReflectedValue` which exposes the Reflect interface - fn into_lua(self, ctx: &'lua Lua) -> mlua::Result> { - let world = self.world_ptr.clone(); - let world = world.read(); - - let typedata = &world.resource::(); - let g = typedata.read(); - - let type_id = self.get(|s| s.type_id())?; - if let Some(v) = g.get_type_data::(type_id) { - v.ref_to_lua(self, ctx) - } else { - ReflectedValue { ref_: self }.into_lua(ctx) - } - } -} - -impl ToTypename for ReflectReference { - fn to_typename() -> tealr::Type { - tealr::Type::new_single("ReflectedValue", tealr::KindOfType::External) - } -} - -impl_tealr_type!(ReflectedValue); -impl_from_lua_with_clone!(ReflectedValue); -impl TealData for ReflectedValue { - fn add_methods<'lua, T: TealDataMethods<'lua, Self>>(methods: &mut T) { - methods.document_type("This type represents a generic reflected value."); - methods.document_type("If you know the reflected value converts to a LuaType (via LuaProxyable), use the `as` operator to convert to said type."); - - methods.add_meta_method(MetaMethod::ToString, |_, val, ()| { - val.ref_.get(|s| Ok(format!("{:?}", &s)))? - }); - - methods.add_meta_method_mut(MetaMethod::Index, |_, val, field: Value| { - let r = val.ref_.index(field)?; - Ok(r) - }); - - methods.add_meta_method_mut( - MetaMethod::NewIndex, - |ctx, val, (field, new_val): (Value, Value)| { - val.ref_.index(field)?.apply_lua(ctx, new_val)?; - Ok(()) - }, - ); - } -} -/// A higher level trait for allowing types to be interpreted as custom lua proxy types (or just normal types, this interface is flexible). -/// Types implementing this trait can have [`ReflectLuaProxyable`] type data registrations inserted into the reflection API. -/// -/// Types registered via the reflection API this way can be accessed from Lua via [`ReflectReference`] objects (via field access). -pub trait LuaProxyable { - /// a version of [`mlua::ToLua::to_lua`] which does not consume the object. - /// - /// Note: The self reference is sourced from the given ReflectReference, attempting to get another mutable reference from the ReflectReference might - /// cause a runtime error to prevent breaking of aliasing rules - fn ref_to_lua(self_: ReflectReference, lua: &Lua) -> mlua::Result; - - /// similar to [`Reflect::apply`] - /// - /// Note: - /// The self reference is sourced from the given ReflectReference, attempting to get another reference from the ReflectReference might - /// cause a runtime error to prevent breaking of aliasing rules - fn apply_lua<'lua>( - self_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()>; -} - -/// Exactly alike to [`mlua::ToLua`] -pub trait FromLuaProxy<'lua>: Sized { - fn from_lua_proxy(new_val: Value<'lua>, lua: &'lua Lua) -> mlua::Result; -} - -/// Exactly alike to [`mlua::FromLua`] -pub trait IntoLuaProxy<'lua> { - fn to_lua_proxy(self, lua: &'lua Lua) -> mlua::Result>; -} - -/// A struct providing type data for the `LuaProxyable` trait. -/// -/// This allows casting static methods from the `LuaProxyable trait`. -#[derive(Clone)] -pub struct ReflectLuaProxyable { - ref_to_lua: for<'lua> fn(ref_: ReflectReference, lua: &'lua Lua) -> mlua::Result>, - apply_lua: for<'lua> fn( - ref_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()>, -} - -impl ReflectLuaProxyable { - pub fn ref_to_lua<'lua>( - &self, - ref_: ReflectReference, - lua: &'lua Lua, - ) -> mlua::Result> { - (self.ref_to_lua)(ref_, lua) - } - - pub fn apply_lua<'lua>( - &self, - ref_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()> { - (self.apply_lua)(ref_, lua, new_val) - } -} - -impl ::bevy::reflect::FromType - for ReflectLuaProxyable -{ - fn from_type() -> Self { - Self { - ref_to_lua: T::ref_to_lua, - apply_lua: T::apply_lua, - } - } -} - -/// A dummy trait used to combat rust's orphan rules -/// -/// In the future when trait specialization is a thing, this might be a companion trait -/// to `RefLuaType` which allows non Clone types to be used -pub trait ValueLuaType {} - -impl LuaProxyable for T { - fn ref_to_lua(self_: ReflectReference, lua: &Lua) -> mlua::Result { - self_.get_typed(|s: &Self| s.clone().into_lua(lua))? - } - - fn apply_lua<'lua>( - self_: &mut ReflectReference, - _: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()> { - if let Value::UserData(v) = new_val { - let o = v.borrow::()?; - - self_.get_mut_typed(|s| *s = o.clone())?; - - Ok(()) - } else { - Err(mlua::Error::RuntimeError( - "Error in assigning to custom user data".to_owned(), - )) - } - } -} - -impl<'lua, T: Clone + UserData + FromLua<'lua> + Send + ValueLuaType + Reflect + 'static> - FromLuaProxy<'lua> for T -{ - fn from_lua_proxy(new_val: Value<'lua>, lua: &'lua Lua) -> mlua::Result { - T::from_lua(new_val, lua) - } -} - -impl<'lua, T: Clone + UserData + Send + ValueLuaType + Reflect + 'static> IntoLuaProxy<'lua> for T { - fn to_lua_proxy(self, lua: &'lua Lua) -> mlua::Result> { - self.into_lua(lua) - } -} - -impl GetWorld for Lua { - type Error = mlua::Error; - fn get_world(&self) -> Result { - self.globals().get::<_, LuaWorld>("world").map(Into::into) - } -} diff --git a/crates/bevy_script_api/src/lua/std.rs b/crates/bevy_script_api/src/lua/std.rs deleted file mode 100644 index 945b4c16b6..0000000000 --- a/crates/bevy_script_api/src/lua/std.rs +++ /dev/null @@ -1,492 +0,0 @@ -use std::sync::Arc; - -use bevy::reflect::FromReflect; -use bevy::reflect::Reflect; - -use bevy::reflect::{GetTypeRegistration, TypePath}; -use bevy_mod_scripting_lua::tealr; - -use bevy_mod_scripting_lua::tealr::ToTypename; -use tealr::mlu::mlua::MetaMethod; -use tealr::mlu::TypedFunction; -use tealr::mlu::{ - mlua::{self, FromLua, IntoLua, Lua, UserData, Value}, - TealData, TealDataMethods, -}; -use tealr::TypeBody; - -use paste::paste; - -use crate::common::std::ScriptVec; -use crate::{ - error::ReflectionError, - script_ref::{ReflectReference, ValueIndex}, - sub_reflect::ReflectionPathElement, -}; - -use super::util::to_lua_idx; -use super::util::LuaIndex; -use super::ApplyLua; -use super::FromLuaProxy; -use super::IntoLuaProxy; -use super::LuaProxyable; - -/// Implements custom user data for simple copy types which implement to and from lua -macro_rules! impl_proxyable_by_copy( - ( $($num_ty:ty),*) => { - paste! { - $( - impl $crate::lua::LuaProxyable for $num_ty { - fn ref_to_lua(self_: $crate::script_ref::ReflectReference,lua: & tealr::mlu::mlua::Lua) -> tealr::mlu::mlua::Result > { - self_.get_typed(|self_ : &Self| self_.into_lua(lua))? - } - - fn apply_lua< 'lua>(self_: &mut $crate::script_ref::ReflectReference,lua: & 'lua tealr::mlu::mlua::Lua,new_val:tealr::mlu::mlua::Value< 'lua>) -> tealr::mlu::mlua::Result<()> { - self_.set_val(Self::from_lua(new_val,lua)?)?; - Ok(()) - } - } - - impl <'lua>$crate::lua::FromLuaProxy<'lua> for $num_ty { - #[inline(always)] - fn from_lua_proxy(new_value: Value<'lua>, lua: &'lua Lua) -> tealr::mlu::mlua::Result { - Self::from_lua(new_value,lua) - } - } - - impl <'lua>$crate::lua::IntoLuaProxy<'lua> for $num_ty { - #[inline(always)] - fn to_lua_proxy(self, lua: &'lua Lua) -> tealr::mlu::mlua::Result> { - self.into_lua(lua) - } - } - )* - } - } -); - -impl_proxyable_by_copy!(bool); -impl_proxyable_by_copy!(f32, f64); -impl_proxyable_by_copy!(i8, i16, i32, i64, i128, isize); -impl_proxyable_by_copy!(u8, u16, u32, u64, u128, usize); - -impl LuaProxyable for String { - fn ref_to_lua(self_: ReflectReference, lua: &Lua) -> mlua::Result { - self_.get_typed(|self_: &String| self_.as_str().into_lua(lua))? - } - - fn apply_lua<'lua>( - self_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()> { - self_.get_mut_typed(|self_| { - *self_ = Self::from_lua(new_val, lua)?; - Ok(()) - })? - } -} - -impl<'lua> FromLuaProxy<'lua> for String { - fn from_lua_proxy(new_val: Value<'lua>, lua: &'lua Lua) -> mlua::Result { - Self::from_lua(new_val, lua) - } -} - -impl<'lua> IntoLuaProxy<'lua> for String { - fn to_lua_proxy(self, lua: &'lua Lua) -> mlua::Result> { - self.into_lua(lua) - } -} - -impl< - T: LuaProxyable - + Reflect - + FromReflect - + GetTypeRegistration - + TypePath - + for<'a> FromLuaProxy<'a> - + Clone - + bevy::reflect::Typed, - > LuaProxyable for Option -{ - fn ref_to_lua(self_: ReflectReference, lua: &Lua) -> mlua::Result { - self_.get_typed(|s: &Option| match s { - Some(_) => T::ref_to_lua( - self_.sub_ref(ReflectionPathElement::SubReflection { - label: "as_ref", - get: Arc::new(|ref_| { - ref_.downcast_ref::>() - .ok_or_else(|| ReflectionError::CannotDowncast { - from: ref_.get_represented_type_info().unwrap().type_path().into(), - to: stringify!(Option).into(), - })? - .as_ref() - .map(|t| t as &dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - }), - get_mut: Arc::new(|ref_| { - ref_.downcast_mut::>() - // TODO: there is some weird borrow checker fuckery going on here - // i tried having from: ref_.get_represented_type_info().unwrap().type_path().into() instead of "Reflect" - // and lying this out in an if let expression, but nothing will satisfy the borrow checker here, so leaving this for now - .ok_or_else(|| ReflectionError::CannotDowncast { - from: "Reflect".into(), - to: stringify!(Option).into(), - })? - .as_mut() - .map(|t| t as &mut dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - }), - }), - lua, - ), - None => Ok(Value::Nil), - })? - } - - fn apply_lua<'lua>( - self_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()> { - if let Value::Nil = new_val { - self_.get_mut_typed(|s: &mut Option| { - *s = None; - Ok(()) - })? - } else { - // we need to do this in two passes, first - // ensure that the target type is the 'some' variant to allow a sub reference - let is_none = self_.get_typed(|s: &Option| s.is_none())?; - - if is_none { - return self_.get_mut_typed(|s: &mut Option| { - *s = Some(T::from_lua_proxy(new_val, lua)?); - Ok::<_, mlua::Error>(()) - })?; - } - - T::apply_lua( - &mut self_.sub_ref(ReflectionPathElement::SubReflection { - label: "", - get: Arc::new(|ref_| { - ref_.downcast_ref::>() - .ok_or_else(|| ReflectionError::CannotDowncast { - from: ref_.get_represented_type_info().unwrap().type_path().into(), - to: stringify!(Option).into(), - })? - .as_ref() - .map(|t| t as &dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - }), - get_mut: Arc::new(|ref_| { - if ref_.is::>() { - ref_.downcast_mut::>() - .unwrap() - .as_mut() - .map(|t| t as &mut dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - } else { - Err(ReflectionError::CannotDowncast { - from: ref_.get_represented_type_info().unwrap().type_path().into(), - to: stringify!(Option).into(), - }) - } - }), - }), - lua, - new_val, - ) - } - } -} - -impl<'lua, T: for<'a> FromLuaProxy<'a>> FromLuaProxy<'lua> for Option { - fn from_lua_proxy(new_val: Value<'lua>, lua: &'lua Lua) -> mlua::Result { - if let Value::Nil = new_val { - Ok(None) - } else { - T::from_lua_proxy(new_val, lua).map(Option::Some) - } - } -} - -impl<'lua, T: for<'a> IntoLuaProxy<'a>> IntoLuaProxy<'lua> for Option { - fn to_lua_proxy(self, lua: &'lua Lua) -> mlua::Result> { - match self { - Some(v) => v.to_lua_proxy(lua), - None => Ok(Value::Nil), - } - } -} - -/// A reference to a rust vec (vec reference proxy), does not need an owned variant since -/// lua can natively represent lists of things -pub type LuaVec = ScriptVec; - -impl< - T: ToTypename - + FromReflect - + GetTypeRegistration - + TypePath - + LuaProxyable - + bevy::reflect::Typed - + for<'a> FromLuaProxy<'a> - + for<'a> IntoLuaProxy<'a> - + std::fmt::Debug, - > UserData for LuaVec -{ - fn add_methods<'lua, M: tealr::mlu::mlua::UserDataMethods<'lua, Self>>(methods: &mut M) { - let mut x = tealr::mlu::UserDataWrapper::from_user_data_methods(methods); - ::add_methods(&mut x); - } - fn add_fields<'lua, F: tealr::mlu::mlua::UserDataFields<'lua, Self>>(fields: &mut F) { - let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_fields(fields); - ::add_fields(&mut wrapper) - } -} - -impl ToTypename for LuaVec { - /// Before tealr deprecated TypeName, this used to incorporate generics here, but right now I don't think they're supported anymore - fn to_typename() -> tealr::Type { - tealr::Type::new_single("LuaVec", tealr::KindOfType::External) - } -} - -impl< - T: ToTypename - + FromReflect - + GetTypeRegistration - + TypePath - + LuaProxyable - + bevy::reflect::Typed - + for<'a> FromLuaProxy<'a> - + for<'a> IntoLuaProxy<'a> - + std::fmt::Debug, - > TypeBody for LuaVec -{ - fn get_type_body() -> tealr::TypeGenerator { - let mut gen = tealr::RecordGenerator::new::(false); - gen.is_user_data = true; - ::add_fields(&mut gen); - ::add_methods(&mut gen); - gen.into() - } -} - -impl< - T: ToTypename - + FromReflect - + GetTypeRegistration - + TypePath - + LuaProxyable - + bevy::reflect::Typed - + for<'a> FromLuaProxy<'a> - + for<'a> IntoLuaProxy<'a>, - > TealData for LuaVec -{ - fn add_methods<'lua, M: TealDataMethods<'lua, Self>>(methods: &mut M) { - methods.document_type("A reference to the Vec Rust type."); - methods.document_type("All indexing begins at 1."); - - methods.add_meta_method(MetaMethod::ToString, |_, s, ()| { - Ok(s.ref_.get(|s| format!("{:?}", s))?) - }); - - methods.add_meta_method(MetaMethod::Index, |_, s, index: LuaIndex| { - Ok(s.index(*index)) - }); - - methods.add_meta_method_mut( - MetaMethod::NewIndex, - |ctx, s, (index, value): (LuaIndex, Value)| s.index(*index).apply_lua(ctx, value), - ); - - bevy_mod_scripting_lua::__cfg_feature_any_lua52_lua53_lua54_luajit52!( - methods.add_meta_method( - MetaMethod::Pairs, - |ctx, s, _: ()| { - let len = s.len()?; - let mut curr_idx = 0; - let ref_: ReflectReference = s.clone().into(); - TypedFunction::from_rust_mut( - move |ctx, ()| { - let o = if curr_idx < len { - ( - to_lua_idx(curr_idx).into_lua(ctx)?, - ref_.index(curr_idx).into_lua(ctx)?, - ) - } else { - (Value::Nil, Value::Nil) - }; - curr_idx += 1; - Ok(o) - }, - ctx, - ) - }, - ); - ); - methods.add_meta_method(MetaMethod::Len, |_, s, ()| Ok(s.len()?)); - - methods.add_method("to_table", |ctx, s, ()| { - let table = ctx.create_table()?; - let len = s.len()?; - - for i in 0..len { - table.raw_set(to_lua_idx(i), s.index(i).into_lua(ctx)?)?; - } - - Ok(table) - }); - - methods.add_method_mut("push", |ctx, s, v: Value| { - let new_val = T::from_lua_proxy(v, ctx)?; - s.push(new_val)?; - Ok(()) - }); - - methods.add_method_mut("pop", |ctx, s, ()| s.pop().map(|v| v.to_lua_proxy(ctx))?); - - methods.add_method_mut("clear", |_, s, ()| { - s.clear()?; - Ok(()) - }); - - methods.add_method_mut("insert", |ctx, s, (idx, v): (LuaIndex, Value<'lua>)| { - s.insert(*idx, T::from_lua_proxy(v, ctx)?)?; - Ok(()) - }); - - methods.add_method_mut("remove", |ctx, s, idx: LuaIndex| { - let removed = s.remove(*idx)?; - removed.to_lua_proxy(ctx) - }); - } -} - -impl< - T: ToTypename - + FromReflect - + GetTypeRegistration - + TypePath - + LuaProxyable - + bevy::reflect::Typed - + for<'a> FromLuaProxy<'a> - + for<'a> IntoLuaProxy<'a> - + std::fmt::Debug, - > LuaProxyable for Vec -{ - fn ref_to_lua(self_: ReflectReference, lua: &Lua) -> mlua::Result { - LuaVec::::new_ref(self_).into_lua(lua) - } - - fn apply_lua<'lua>( - self_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua>, - ) -> mlua::Result<()> { - match &new_val { - Value::UserData(ud) => { - let lua_vec = ud.borrow::>()?; - self_.apply(&lua_vec.ref_)?; - } - Value::Table(table) => { - let last_target_idx = self_.get_typed(|s: &Vec| s.len())? - 1; - // there is also another case to consider, Vec has a lua representation available as well (table) - // if we receive one of those, we should also apply it - for entry in table.clone().pairs::() { - let (lua_idx, v) = entry?; - let idx = lua_idx - 1; - if idx > last_target_idx { - // here we don't need to do anything special just use LuaProxyable impl - T::apply_lua(&mut self_.index(idx), lua, v)?; - } else { - // here we don't have anything to apply this to - // use FromLua impl - self_.get_mut_typed(|s: &mut Vec| { - s[idx] = T::from_lua_proxy(v, lua)?; - Ok::<_, mlua::Error>(()) - })??; - } - } - } - _ => { - return Err(mlua::Error::FromLuaConversionError { - from: new_val.type_name(), - to: "userdata or table", - message: Some("LuaVec can only be assigned with itself or a table".to_owned()), - }) - } - } - - Ok(()) - } -} - -impl< - 'lua, - T: ToTypename - + for<'a> FromLuaProxy<'a> - + for<'a> IntoLuaProxy<'a> - + Clone - + FromReflect - + GetTypeRegistration - + TypePath - + LuaProxyable - + bevy::reflect::Typed - + std::fmt::Debug, - > FromLuaProxy<'lua> for Vec -{ - fn from_lua_proxy(new_val: Value<'lua>, lua: &'lua Lua) -> mlua::Result { - match new_val { - Value::UserData(ud) => { - let lua_vec = ud.borrow::>()?; - lua_vec.ref_.get_typed(|s: &Vec| Ok(s.clone()))? - } - Value::Table(table) => { - // there is also another case to consider, Vec has a lua representation available as well (table) - // if we receive one of those, we should clone it one by one - table - .pairs::() - .map(|v| v.and_then(|(_, v)| T::from_lua_proxy(v, lua))) - .collect::, _>>() - } - _ => Err(mlua::Error::FromLuaConversionError { - from: new_val.type_name(), - to: "userdata or table", - message: Some("LuaVec can only be assigned with itself or a table".to_owned()), - }), - } - } -} - -impl<'lua, T: for<'a> IntoLuaProxy<'a> + Clone + FromReflect + LuaProxyable> IntoLuaProxy<'lua> - for Vec -{ - fn to_lua_proxy(self, lua: &'lua Lua) -> mlua::Result> { - let proxies = lua.create_table()?; - for (idx, elem) in self.into_iter().enumerate() { - proxies.raw_set(idx, elem.to_lua_proxy(lua)?)?; - } - - proxies.into_lua(lua) - } -} diff --git a/crates/bevy_script_api/src/lua/util.rs b/crates/bevy_script_api/src/lua/util.rs deleted file mode 100644 index 6c611e0b81..0000000000 --- a/crates/bevy_script_api/src/lua/util.rs +++ /dev/null @@ -1,427 +0,0 @@ -use crate::{lua::bevy::LuaTypeRegistration, providers::bevy_ecs::LuaEntity, ReflectReference}; -use bevy_mod_scripting_lua::{ - prelude::{ - FromLua, FromLuaMulti, IntoLua, IntoLuaMulti, Lua, LuaError, LuaMultiValue, LuaValue, - }, - tealr::{self, FunctionParam, KindOfType, Name, SingleType, TealMultiValue, ToTypename, Type}, -}; -use std::{ - marker::PhantomData, - ops::{Deref, DerefMut}, -}; - -/// Newtype abstraction of usize to represent a lua integer indexing things. -/// Lua is 1 based, host is 0 based, and this type performs this conversion automatically via ToLua and FromLua traits. -#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct LuaIndex(usize); - -impl ToTypename for LuaIndex { - fn to_typename() -> tealr::Type { - ::to_typename() - } -} - -impl Deref for LuaIndex { - type Target = usize; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for LuaIndex { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl IntoLua<'_> for LuaIndex { - fn into_lua(self, lua: &Lua) -> Result { - to_lua_idx(self.0).into_lua(lua) - } -} - -impl FromLua<'_> for LuaIndex { - fn from_lua(value: LuaValue, lua: &Lua) -> Result { - Ok(LuaIndex(to_host_idx(usize::from_lua(value, lua)?))) - } -} - -/// Converts lua index to host index (Lua is 1 based, host is 0 based) -pub fn to_host_idx(lua_idx: usize) -> usize { - lua_idx - 1 -} - -/// Converts host index to lua index (Lua is 1 based, host is 0 based) -pub fn to_lua_idx(host_idx: usize) -> usize { - host_idx + 1 -} - -/// forwards the TypeName implementation of T, useful for internal 'fake' global instances -pub struct DummyTypeName { - _ph: PhantomData, -} - -impl DummyTypeName { - pub fn new( - _: &bevy_mod_scripting_lua::tealr::mlu::mlua::Lua, - ) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result { - Ok(Self { - _ph: PhantomData::, - }) - } -} - -impl<'lua, T> bevy_mod_scripting_lua::tealr::mlu::mlua::IntoLua<'lua> for DummyTypeName { - fn into_lua( - self, - _: &'lua bevy_mod_scripting_lua::tealr::mlu::mlua::Lua, - ) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result< - bevy_mod_scripting_lua::tealr::mlu::mlua::Value<'lua>, - > { - Ok(bevy_mod_scripting_lua::tealr::mlu::mlua::Value::Nil) - } -} - -impl ToTypename for DummyTypeName { - fn to_typename() -> bevy_mod_scripting_lua::tealr::Type { - T::to_typename() - } -} - -/// A utility type that allows us to accept any number of components as a parameter into a function. -#[derive(Clone)] -pub struct VariadicComponents(pub Vec); - -impl IntoLuaMulti<'_> for VariadicComponents { - fn into_lua_multi(self, lua: &Lua) -> Result, LuaError> { - let values = LuaMultiValue::from_vec( - self.0 - .into_iter() - .map(|v| v.into_lua(lua).unwrap()) - .collect(), - ); - - Ok(values) - } -} - -impl FromLuaMulti<'_> for VariadicComponents { - fn from_lua_multi(value: LuaMultiValue<'_>, lua: &Lua) -> Result { - Ok(VariadicComponents( - value - .into_vec() - .into_iter() - .map(|v| LuaTypeRegistration::from_lua(v, lua).unwrap()) - .collect(), - )) - } -} - -impl TealMultiValue for VariadicComponents { - fn get_types_as_params() -> Vec { - vec![FunctionParam { - // `...:T` will be a variadic type - param_name: Some(Name("...".into())), - ty: LuaTypeRegistration::to_typename(), - }] - } -} - -/// A utility enum that allows us to return an entity and any number of components from a function. -#[derive(Clone)] -pub enum VariadicQueryResult { - Some(LuaEntity, Vec), - None, -} - -impl IntoLuaMulti<'_> for VariadicQueryResult { - fn into_lua_multi(self, lua: &Lua) -> Result, LuaError> { - match self { - VariadicQueryResult::Some(entity, vec) => { - let mut values = LuaMultiValue::from_vec( - vec.into_iter() - .map(|v| v.into_lua(lua)) - .collect::, LuaError>>()?, - ); - - values.push_front(entity.into_lua(lua)?); - Ok(values) - } - VariadicQueryResult::None => Ok(().into_lua_multi(lua)?), - } - } -} - -impl TealMultiValue for VariadicQueryResult { - fn get_types_as_params() -> Vec { - vec![ - FunctionParam { - param_name: None, - ty: LuaEntity::to_typename(), - }, - FunctionParam { - param_name: None, - ty: Type::Single(SingleType { - kind: KindOfType::External, - // tealr doesn't have a way to add variadic return types, so it's inserted into the type name instead - name: Name(format!("{}...", stringify!(ReflectedValue)).into()), - }), - }, - ] - } -} - -#[macro_export] -macro_rules! impl_from_lua_with_clone { - ($v:ty) => { - impl<'lua> bevy_mod_scripting_lua::tealr::mlu::mlua::FromLua<'lua> for $v { - #[inline] - fn from_lua( - value: bevy_mod_scripting_lua::tealr::mlu::mlua::Value<'lua>, - _: &'lua bevy_mod_scripting_lua::tealr::mlu::mlua::Lua, - ) -> bevy_mod_scripting_lua::tealr::mlu::mlua::Result<$v> { - match value { - bevy_mod_scripting_lua::tealr::mlu::mlua::Value::UserData(ud) => { - Ok(ud.borrow::<$v>()?.clone()) - } - _ => Err( - bevy_mod_scripting_lua::tealr::mlu::mlua::Error::FromLuaConversionError { - from: value.type_name(), - to: "userdata", - message: None, - }, - ), - } - } - } - }; -} - -/// Implements :tealr::TypeName, tealr::TypeBody and mlua::Userdata based on non-generic single token type name implementing TealData -#[macro_export] -macro_rules! impl_tealr_type { - ($v:ty) => { - impl bevy_mod_scripting_lua::tealr::ToTypename for $v { - fn to_typename() -> bevy_mod_scripting_lua::tealr::Type { - bevy_mod_scripting_lua::tealr::Type::new_single(stringify!($v), bevy_mod_scripting_lua::tealr::KindOfType::External) - } - } - - impl bevy_mod_scripting_lua::tealr::mlu::mlua::UserData for $v { - fn add_fields<'lua, F: bevy_mod_scripting_lua::tealr::mlu::mlua::prelude::LuaUserDataFields<'lua, Self>>(fields: &mut F) { - let mut wrapper = ::bevy_mod_scripting_lua::tealr::mlu::UserDataWrapper::from_user_data_fields(fields); - ::add_fields(&mut wrapper) - } - - fn add_methods<'lua, M: bevy_mod_scripting_lua::tealr::mlu::mlua::prelude::LuaUserDataMethods<'lua, Self>>( - methods: &mut M, - ) { - let mut x = ::bevy_mod_scripting_lua::tealr::mlu::UserDataWrapper::from_user_data_methods(methods); - ::add_methods(&mut x); - } - } - - impl bevy_mod_scripting_lua::tealr::TypeBody for $v { - fn get_type_body() -> bevy_mod_scripting_lua::tealr::TypeGenerator { - let mut gen = ::bevy_mod_scripting_lua::tealr::RecordGenerator::new::(false); - gen.is_user_data = true; - ::add_fields(&mut gen); - ::add_methods(&mut gen); - <_ as ::std::convert::From<_>>::from(gen) - } - } - }; -} - -/// like create_bevy_mod_scripting_lua::tealr_union but translates to `any` in the lua declaration file, -/// a fill in to allow multiple userdata types -#[macro_export] -macro_rules! impl_tealr_any_union { - ($visibility:vis $(Derives($($derives:ident), +))? enum $type_name:ident = $($sub_types_ident:ident: $sub_types_type:ty) | +) => { - #[derive($($($derives ,)*)*)] - #[allow(non_camel_case_types)] - $visibility enum $type_name { - $($sub_types_ident($sub_types_type) ,)* - } - impl<'lua> ::bevy_mod_scripting_lua::tealr::mlu::mlua::IntoLua<'lua> for $type_name { - fn into_lua(self, lua: &'lua ::bevy_mod_scripting_lua::tealr::mlu::mlua::Lua) -> ::std::result::Result<::bevy_mod_scripting_lua::tealr::mlu::mlua::Value<'lua>, ::bevy_mod_scripting_lua::tealr::mlu::mlua::Error> { - match self { - $($type_name::$sub_types_ident(x) => x.into_lua(lua),)* - } - } - } - impl<'lua> ::bevy_mod_scripting_lua::tealr::mlu::mlua::FromLua<'lua> for $type_name { - fn from_lua(value: ::bevy_mod_scripting_lua::tealr::mlu::mlua::Value<'lua>, lua: &'lua ::bevy_mod_scripting_lua::tealr::mlu::mlua::Lua) -> ::std::result::Result { - $(match $sub_types_ident::from_lua(value.clone(),lua) { - Ok(x) => return Ok($type_name::$sub_types_ident(x)), - Err(::bevy_mod_scripting_lua::tealr::mlu::mlua::Error::FromLuaConversionError{from:_,to:_,message:_}) => {} - Err(x) => return Err(x) - };)* - Err(::bevy_mod_scripting_lua::tealr::mlu::mlua::Error::FromLuaConversionError{ - to: stringify!( $($sub_types_ident)|* ), - from: value.type_name(), - message: None - }) - } - } - impl ::bevy_mod_scripting_lua::tealr::ToTypename for $type_name { - fn to_typename() -> bevy_mod_scripting_lua::tealr::Type { - bevy_mod_scripting_lua::tealr::Type::new_single("any", bevy_mod_scripting_lua::tealr::KindOfType::Builtin) - } - } - }; -} - -#[macro_export] -macro_rules! impl_tealr_generic{ - { - $vis:vis struct $name:ident - } => { - #[derive(Default,Clone,Debug)] - $vis struct $name; - - impl $crate::lua::ValueLuaType for $name {} - - impl ::bevy_mod_scripting_lua::tealr::mlu::TealData for $name { - - } - - 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") - } - - fn type_path() -> &'static str{ - panic!("This should never be called, I am a dummy implementation") - } - } - - - 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_partial_reflect(self: Box) -> Box { - panic!("This should never be called, I am a dummy implementation"); - } - - fn as_partial_reflect(&self) -> &dyn ::bevy::reflect::PartialReflect { - panic!("This should never be called, I am a dummy implementation"); - } - - fn as_partial_reflect_mut(&mut self) -> &mut dyn ::bevy::reflect::PartialReflect { - panic!("This should never be called, I am a dummy implementation"); - } - - 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 try_as_reflect(&self) -> std::option::Option<&(dyn bevy::prelude::Reflect + 'static)> { - panic!("This should never be called, I am a dummy implementation"); - } - - 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 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 { - panic!("This should never be called, I am a dummy implementation"); - } - - fn reflect_mut(&mut self) -> ::bevy::reflect::ReflectMut { - panic!("This should never be called, I am a dummy implementation"); - } - - fn reflect_owned(self: Box) -> ::bevy::reflect::ReflectOwned { - panic!("This should never be called, I am a dummy implementation"); - } - - fn clone_value(&self) -> Box { - panic!("This should never be called, I am a dummy implementation"); - } - } - - - impl ::bevy::reflect::Reflect for $name { - - fn into_any(self: Box) -> Box { - panic!("This should never be called, I am a dummy implementation"); - } - - 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::PartialReflect + 'static)) -> std::option::Option { - panic!("This should never be called, I am a dummy implementation"); - } - - } - - impl ::bevy::reflect::GetTypeRegistration for $name { - fn get_type_registration() -> bevy::reflect::TypeRegistration { - panic!("This should never be called, I am a dummy implementation"); - } - } - - $crate::impl_tealr_type!($name); - $crate::impl_from_lua_with_clone!($name); - } -} - -// /// Implements UserData for type which implements TealData, can handle generics after the type name: -// /// ```rust,ignore -// /// impl_user_data!(MyType<'a,T : Debug>); -// /// ``` -// macro_rules! impl_user_data { -// ($v:ident $(< $( $lt:tt $( : $clt:tt $(+ $dlt:tt $(<'a>)? )* )? ),+ >)? ) => { -// impl $(< $( $lt $( : $clt $(+ $dlt $(<'a>)?)* )? ),+ >)? ::bevy_mod_scripting_lua::tealr::mlu::mlua::UserData for $v $(< $( $lt ),+ >)? { -// fn add_methods<'lua, M: ::bevy_mod_scripting_lua::tealr::mlu::mlua::UserDataMethods<'lua, Self>>(methods: &mut M) { -// let mut x = ::bevy_mod_scripting_lua::tealr::mlu::UserDataWrapper::from_user_data_methods(methods); -// ::add_methods(&mut x); -// } -// fn add_fields<'lua, F: ::bevy_mod_scripting_lua::tealr::mlu::mlua::UserDataFields<'lua, Self>>(fields: &mut F) { -// let mut wrapper = ::bevy_mod_scripting_lua::tealr::mlu::UserDataWrapper::from_user_data_fields(fields); -// ::add_fields(&mut wrapper) -// } -// } - -// } -// } - -// pub(crate) use impl_user_data; diff --git a/crates/bevy_script_api/src/providers/bevy_core.rs b/crates/bevy_script_api/src/providers/bevy_core.rs deleted file mode 100644 index 762e6fb772..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_core.rs +++ /dev/null @@ -1,95 +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(clone), - remote = "bevy::core::prelude::Name", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{}", _self) -} -"#] -)] -struct Name {} -#[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 BevyCoreAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyCoreAPIProvider { - 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( - "BevyCoreAPI", - |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 deleted file mode 100644 index a790dbc9a4..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_ecs.rs +++ /dev/null @@ -1,560 +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_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(clone), - 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; - -"#, - r#" -/// Creates a new entity ID with the specified `index` and a generation of 1. -/// # Note -/// Spawning a specific `entity` value is __rarely the right choice__. Most apps should favor -/// [`Commands::spawn`](crate::system::Commands::spawn). This method should generally -/// only be used for sharing entities across apps, and only when they have a scheme -/// worked out to share an index space (which doesn't happen by default). -/// In general, one should not try to synchronize the ECS by attempting to ensure that -/// `Entity` lines up between instances, but instead insert a secondary identifier as -/// a component. - - #[lua(kind = "Function", output(proxy))] - fn from_raw(index: u32) -> bevy::ecs::entity::Entity; - -"#, - r#" -/// Convert to a form convenient for passing outside of rust. -/// Only useful for identifying entities within the same instance of an application. Do not use -/// for serialization between runs. -/// No particular structure is guaranteed for the returned bits. - - #[lua(kind = "Method")] - fn to_bits(self) -> u64; - -"#, - r#" -/// Reconstruct an `Entity` previously destructured with [`Entity::to_bits`]. -/// Only useful when applied to results from `to_bits` in the same instance of an application. -/// # Panics -/// This method will likely panic if given `u64` values that did not come from [`Entity::to_bits`]. - - #[lua(kind = "Function", output(proxy))] - fn from_bits(bits: u64) -> bevy::ecs::entity::Entity; - -"#, - r#" -/// Return a transiently unique identifier. -/// No two simultaneously-live entities share the same index, but dead entities' indices may collide -/// with both live and dead entities. Useful for compactly representing entities within a -/// specific snapshot of the world, such as when serializing. - - #[lua(kind = "Method")] - fn index(self) -> u32; - -"#, - r#" -/// Returns the generation of this Entity's index. The generation is incremented each time an -/// entity with a given index is despawned. This serves as a "count" of the number of times a -/// given index has been reused (index, generation) pairs uniquely identify a given Entity. - - #[lua(kind = "Method")] - fn generation(self) -> u32; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::entity::Entity; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Entity {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[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[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[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; - -"#, - r#" -/// Returns the index of the current component. - - #[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::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &component::ComponentId) -> 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 ComponentId(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::ecs::component::Tick", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::component::Tick; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &component::Tick) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::cmp::Eq", kind = "Method")] - fn assert_receiver_is_total_eq(&self) -> (); - -"#, - r#" -/// Creates a new [`Tick`] wrapping the given value. - - #[lua(kind = "Function", output(proxy))] - fn new(tick: u32) -> bevy::ecs::component::Tick; - -"#, - r#" -/// Gets the value of this change tick. - - #[lua(kind = "Method")] - fn get(self) -> u32; - -"#, - r#" -/// Sets the value of this change tick. - - #[lua(kind = "MutatingMethod")] - fn set(&mut self, tick: u32) -> (); - -"#, - r#" -/// Returns `true` if this `Tick` occurred since the system's `last_run`. -/// `this_run` is the current tick of the system, used as a reference to help deal with wraparound. - - #[lua(kind = "Method")] - fn is_newer_than( - self, - #[proxy] - last_run: bevy::ecs::component::Tick, - #[proxy] - this_run: bevy::ecs::component::Tick, - ) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Tick {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::ecs::component::ComponentTicks", - functions[r#" -/// Returns `true` if the component or resource was added after the system last ran -/// (or the system is running for the first time). - - #[lua(kind = "Method")] - fn is_added( - &self, - #[proxy] - last_run: bevy::ecs::component::Tick, - #[proxy] - this_run: bevy::ecs::component::Tick, - ) -> bool; - -"#, - r#" -/// Returns `true` if the component or resource was added or mutably dereferenced after the system last ran -/// (or the system is running for the first time). - - #[lua(kind = "Method")] - fn is_changed( - &self, - #[proxy] - last_run: bevy::ecs::component::Tick, - #[proxy] - this_run: bevy::ecs::component::Tick, - ) -> bool; - -"#, - r#" -/// Creates a new instance with the same change tick for `added` and `changed`. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - change_tick: bevy::ecs::component::Tick, - ) -> bevy::ecs::component::ComponentTicks; - -"#, - r#" -/// Manually sets the change tick. -/// This is normally done automatically via the [`DerefMut`](std::ops::DerefMut) implementation -/// on [`Mut`](crate::change_detection::Mut), [`ResMut`](crate::change_detection::ResMut), etc. -/// However, components and resources that make use of interior mutability might require manual updates. -/// # Example -/// ```no_run -/// # use bevy_ecs::{world::World, component::ComponentTicks}; -/// let world: World = unimplemented!(); -/// let component_ticks: ComponentTicks = unimplemented!(); -/// component_ticks.set_changed(world.read_change_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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &identifier::Identifier) -> bool; - -"#, - r#" -/// Returns the value of the low segment of the [`Identifier`]. - - #[lua(kind = "Method")] - fn low(self) -> u32; - -"#, - r#" -/// Returns the masked value of the high segment of the [`Identifier`]. -/// Does not include the flag bits. - - #[lua(kind = "Method")] - fn masked_high(self) -> u32; - -"#, - r#" -/// Convert the [`Identifier`] into a `u64`. - - #[lua(kind = "Method")] - fn to_bits(self) -> u64; - -"#, - r#" -/// Convert a `u64` into an [`Identifier`]. -/// # Panics -/// This method will likely panic if given `u64` values that did not come from [`Identifier::to_bits`]. - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Identifier {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::ecs::entity::EntityHash", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::ecs::entity::EntityHash; - -"#] -)] -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 { - 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( - "Entity", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "ComponentId", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "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", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -pub struct BevyEcsAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyEcsAPIProvider { - 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( - "BevyEcsAPI", - |tw| { - 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::() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaComponentId, - >, - >() - .process_type::() - .process_type::< - 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< - LuaIdentifier, - >, - >() - .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::(); - 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 deleted file mode 100644 index 23708e43fc..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_hierarchy.rs +++ /dev/null @@ -1,161 +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::*; -use super::bevy_core::*; -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::hierarchy::prelude::Children", - functions[r#" -/// Swaps the child at `a_index` with the child at `b_index`. - - #[lua(kind = "MutatingMethod")] - fn swap(&mut self, a_index: usize, b_index: usize) -> (); - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Children(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(), - 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", - 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(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::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::hierarchy::HierarchyEvent; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &events::HierarchyEvent) -> 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 HierarchyEvent {} -#[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 BevyHierarchyAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyHierarchyAPIProvider { - 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( - "BevyHierarchyAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .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::(); - } -} diff --git a/crates/bevy_script_api/src/providers/bevy_input.rs b/crates/bevy_script_api/src/providers/bevy_input.rs deleted file mode 100644 index 852d5a9058..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_input.rs +++ /dev/null @@ -1,1887 +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::*; -use super::bevy_core::*; -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(), - 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))] - fn left_stick(&self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the right stick as a [`Vec2`] - - #[lua(kind = "Method", output(proxy))] - fn right_stick(&self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the directional pad as a [`Vec2`] - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Gamepad {} -#[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) -> (); - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadAxis; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxis) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadAxis {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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; - -"#, - 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::GamepadButton; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadButton {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadSettings", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::GamepadSettings; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -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), - remote = "bevy::input::keyboard::KeyCode", - 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::KeyCode; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &keyboard::KeyCode) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct KeyCode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::mouse::MouseButton", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" - - #[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 MouseButton {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::touch::TouchInput", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::touch::TouchInput; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &touch::TouchInput) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct TouchInput { - #[lua(output(proxy))] - phase: bevy::input::touch::TouchPhase, - #[lua(output(proxy))] - position: bevy::math::Vec2, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, - force: ReflectedValue, - id: u64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct KeyboardFocusLost {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::keyboard::KeyboardInput", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" - - #[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 KeyboardInput { - #[lua(output(proxy))] - key_code: bevy::input::keyboard::KeyCode, - #[lua(output(proxy))] - 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::AccumulatedMouseMotion", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -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::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#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &mouse::MouseButtonInput) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct MouseButtonInput { - #[lua(output(proxy))] - button: bevy::input::mouse::MouseButton, - #[lua(output(proxy))] - state: bevy::input::ButtonState, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::mouse::MouseMotion", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &mouse::MouseMotion) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseMotion; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct MouseMotion { - #[lua(output(proxy))] - delta: bevy::math::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::mouse::MouseWheel", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::mouse::MouseWheel; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &mouse::MouseWheel) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct MouseWheel { - #[lua(output(proxy))] - unit: bevy::input::mouse::MouseScrollUnit, - x: f32, - y: f32, - #[lua(output(proxy))] - window: bevy::ecs::entity::Entity, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::GamepadAxisChangedEvent) -> bool; - -"#, - 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadAxisChangedEvent { - #[lua(output(proxy))] - entity: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - axis: bevy::input::gamepad::GamepadAxis, - value: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadButtonChangedEvent", - functions[r#" -/// Creates a new [`GamepadButtonChangedEvent`] - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - entity: bevy::ecs::entity::Entity, - #[proxy] - button: bevy::input::gamepad::GamepadButton, - #[proxy] - state: bevy::input::ButtonState, - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadButtonChangedEvent { - #[lua(output(proxy))] - entity: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - button: bevy::input::gamepad::GamepadButton, - #[lua(output(proxy))] - state: bevy::input::ButtonState, - value: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadButtonStateChangedEvent", - functions[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; - -"#, - 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::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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadButtonStateChangedEvent { - #[lua(output(proxy))] - entity: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - button: bevy::input::gamepad::GamepadButton, - #[lua(output(proxy))] - state: bevy::input::ButtonState, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadConnection", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" - - #[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))] - fn new( - #[proxy] - gamepad: bevy::ecs::entity::Entity, - #[proxy] - connection: bevy::input::gamepad::GamepadConnection, - ) -> bevy::input::gamepad::GamepadConnectionEvent; - -"#, - r#" -/// Is the gamepad connected? - - #[lua(kind = "Method")] - fn connected(&self) -> bool; - -"#, - r#" -/// Is the gamepad disconnected? - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadConnectionEvent { - #[lua(output(proxy))] - gamepad: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - connection: bevy::input::gamepad::GamepadConnection, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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::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", - composite = "eq", - metamethod = "Eq", - )] - 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GamepadInput {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadRumbleRequest", - functions[r#" - - #[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(kind = "Method", output(proxy))] - fn gamepad(&self) -> bevy::ecs::entity::Entity; - -"#] -)] -struct GamepadRumbleRequest {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RawGamepadAxisChangedEvent { - #[lua(output(proxy))] - gamepad: bevy::ecs::entity::Entity, - #[lua(output(proxy))] - 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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gamepad::RawGamepadButtonChangedEvent) -> bool; - -"#, - 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::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::gamepad::RawGamepadButtonChangedEvent; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RawGamepadButtonChangedEvent { - #[lua(output(proxy))] - 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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RawGamepadEvent {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gestures::PinchGesture", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct PinchGesture(f32); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &gestures::RotationGesture) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RotationGesture(f32); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gestures::DoubleTapGesture", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct DoubleTapGesture {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gestures::PanGesture", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct PanGesture(#[lua(output(proxy))] bevy::math::Vec2); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::ButtonState", - 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: &ButtonState) -> bool; - -"#, - r#" - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct ButtonState {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::ButtonSettings", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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. -/// A button is considered pressed if the `value` passed is greater than or equal to the press threshold. - - #[lua(kind = "Method")] - fn is_pressed(&self, value: f32) -> bool; - -"#, - r#" -/// Returns `true` if the button is released. -/// A button is considered released if the `value` passed is lower than or equal to the release threshold. - - #[lua(kind = "Method")] - fn is_released(&self, value: f32) -> bool; - -"#, - r#" -/// Get the button input threshold above which the button is considered pressed. - - #[lua(kind = "Method")] - fn press_threshold(&self) -> f32; - -"#, - r#" -/// Try to set the button input threshold above which the button is considered pressed. -/// If the value passed is outside the range [release threshold..=1.0], the value will not be changed. -/// Returns the new value of the press threshold. - - #[lua(kind = "MutatingMethod")] - fn set_press_threshold(&mut self, value: f32) -> f32; - -"#, - r#" -/// Get the button input threshold below which the button is considered released. - - #[lua(kind = "Method")] - fn release_threshold(&self) -> f32; - -"#, - r#" -/// Try to set the button input threshold below which the button is considered released. If the -/// value passed is outside the range [0.0..=press threshold], the value will not be changed. -/// Returns the new value of the release threshold. - - #[lua(kind = "MutatingMethod")] - fn set_release_threshold(&mut self, value: f32) -> f32; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct ButtonSettings {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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; - -"#, - r#" -/// Get the value above which inputs will be rounded up to 1.0. - - #[lua(kind = "Method")] - fn livezone_upperbound(&self) -> f32; - -"#, - r#" -/// Try to set the value above which inputs will be rounded up to 1.0. -/// If the value passed is negative or less than `deadzone_upperbound`, -/// the value will not be changed. -/// Returns the new value of `livezone_upperbound`. - - #[lua(kind = "MutatingMethod")] - fn set_livezone_upperbound(&mut self, value: f32) -> f32; - -"#, - r#" -/// Get the value below which positive inputs will be rounded down to 0.0. - - #[lua(kind = "Method")] - fn deadzone_upperbound(&self) -> f32; - -"#, - r#" -/// Try to set the value below which positive inputs will be rounded down to 0.0. -/// If the value passed is negative or greater than `livezone_upperbound`, -/// the value will not be changed. -/// Returns the new value of `deadzone_upperbound`. - - #[lua(kind = "MutatingMethod")] - fn set_deadzone_upperbound(&mut self, value: f32) -> f32; - -"#, - r#" -/// Get the value below which negative inputs will be rounded down to -1.0. - - #[lua(kind = "Method")] - fn livezone_lowerbound(&self) -> f32; - -"#, - r#" -/// Try to set the value below which negative inputs will be rounded down to -1.0. -/// If the value passed is positive or greater than `deadzone_lowerbound`, -/// the value will not be changed. -/// Returns the new value of `livezone_lowerbound`. - - #[lua(kind = "MutatingMethod")] - fn set_livezone_lowerbound(&mut self, value: f32) -> f32; - -"#, - r#" -/// Get the value above which inputs will be rounded up to 0.0. - - #[lua(kind = "Method")] - fn deadzone_lowerbound(&self) -> f32; - -"#, - r#" -/// Try to set the value above which inputs will be rounded up to 0.0. -/// If the value passed is less than -1.0 or less than `livezone_lowerbound`, -/// the value will not be changed. -/// Returns the new value of `deadzone_lowerbound`. - - #[lua(kind = "MutatingMethod")] - fn set_deadzone_lowerbound(&mut self, value: f32) -> f32; - -"#, - r#" -/// Get the minimum value by which input must change before the change is registered. - - #[lua(kind = "Method")] - fn threshold(&self) -> f32; - -"#, - r#" -/// Try to set the minimum value by which input must change before the changes will be applied. -/// If the value passed is not within [0.0..=2.0], the value will not be changed. -/// Returns the new value of threshold. - - #[lua(kind = "MutatingMethod")] - fn set_threshold(&mut self, value: f32) -> f32; - -"#, - r#" -/// Clamps the `raw_value` according to the `AxisSettings`. - - #[lua(kind = "Method")] - fn clamp(&self, new_value: f32) -> f32; - -"#, - r#" -/// Filters the `new_value` based on the `old_value`, according to the [`AxisSettings`]. -/// Returns the clamped `new_value` if the change exceeds the settings threshold, -/// and `None` otherwise. - - #[lua(kind = "Method")] - fn filter( - &self, - new_value: f32, - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct AxisSettings {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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. - - #[lua(kind = "Method")] - fn filter( - &self, - new_value: f32, - old_value: std::option::Option, - ) -> std::option::Option; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct ButtonAxisSettings { - high: f32, - low: f32, - threshold: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::gamepad::GamepadRumbleIntensity", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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. -/// 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; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -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::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::Key) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::Key; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Key {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::keyboard::NativeKeyCode", - functions[r#" - - #[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::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; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct NativeKeyCode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::input::keyboard::NativeKey; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &keyboard::NativeKey) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct NativeKey {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::mouse::MouseScrollUnit", - 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::mouse::MouseScrollUnit; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &mouse::MouseScrollUnit) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct MouseScrollUnit {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::input::touch::TouchPhase", - 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::touch::TouchPhase; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &touch::TouchPhase) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct TouchPhase {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &touch::ForceTouch) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct ForceTouch {} -#[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( - "GamepadAxisChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadAxisChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadButtonChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadButtonChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadButtonStateChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadButtonStateChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadConnectionEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadConnectionEvent, - >::new, - )?; - instances - .add_instance( - "RawGamepadAxisChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaRawGamepadAxisChangedEvent, - >::new, - )?; - instances - .add_instance( - "RawGamepadButtonChangedEvent", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaRawGamepadButtonChangedEvent, - >::new, - )?; - instances - .add_instance( - "GamepadRumbleIntensity", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGamepadRumbleIntensity, - >::new, - )?; - Ok(()) - } -} -pub struct BevyInputAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyInputAPIProvider { - 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( - "BevyInputAPI", - |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::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadAxisChangedEvent, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadButtonChangedEvent, - >, - >() - .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< - LuaGamepadConnectionEvent, - >, - >() - .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::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGamepadRumbleIntensity, - >, - >() - .process_type::() - .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::(); - 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::GamepadButtonChangedEvent, - >(); - 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::< - 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::(); - 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 deleted file mode 100644 index 57cd3657ff..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_math.rs +++ /dev/null @@ -1,5539 +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_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(clone), - remote = "bevy::math::AspectRatio", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::AspectRatio; - -"#, - 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( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &aspect_ratio::AspectRatio) -> 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", - functions[r#" - - #[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#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &compass::CompassOctant) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CompassOctant {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &compass::CompassQuadrant) -> bool; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::CompassQuadrant; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CompassQuadrant {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - 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#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Isometry2d; - -"#, - r#" -/// Create a two-dimensional isometry from a rotation and a translation. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - translation: bevy::math::prelude::Vec2, - #[proxy] - rotation: bevy::math::Rot2, - ) -> bevy::math::Isometry2d; - -"#, - r#" -/// Create a two-dimensional isometry from a rotation. - - #[lua(kind = "Function", output(proxy))] - 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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -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::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))] - fn from_rotation( - #[proxy] - rotation: bevy::math::prelude::Quat, - ) -> bevy::math::Isometry3d; - -"#, - r#" -/// 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 inverse(&self) -> bevy::math::Isometry3d; - -"#, - 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::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::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::prelude::Vec3) -> bevy::math::prelude::Vec3; - -"#, - 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(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#" -/// 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( - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Ray2d { - #[lua(output(proxy))] - origin: bevy::math::prelude::Vec2, - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Ray3d", - functions[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 - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - origin: bevy::math::prelude::Vec3, - #[proxy] - direction: bevy::math::prelude::Dir3, - ) -> bevy::math::Ray3d; - -"#, - 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::Vec3; - -"#, - 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::Vec3, - #[proxy] - plane: bevy::math::primitives::InfinitePlane3d, - ) -> std::option::Option; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::Ray3d; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Ray3d { - #[lua(output(proxy))] - origin: bevy::math::prelude::Vec3, - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Rot2", - functions[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#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - 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; - -"#, - 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. -/// The rotation is only valid if `sin * sin + cos * cos == 1.0`. -/// # Panics -/// Panics if `sin * sin + cos * cos != 1.0` when the `glam_assert` feature is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_sin_cos(sin: f32, cos: f32) -> bevy::math::Rot2; - -"#, - r#" -/// Returns the rotation in radians in the `(-pi, pi]` range. - - #[lua(kind = "Method")] - fn as_radians(self) -> f32; - -"#, - r#" -/// Returns the rotation in degrees in the `(-180, 180]` range. - - #[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. - - #[lua(kind = "Method")] - fn sin_cos(self) -> (f32, f32); - -"#, - r#" -/// Computes the length or norm of the complex number used to represent the rotation. -/// The length is typically expected to be `1.0`. Unexpectedly denormalized rotations -/// can be a result of incorrect construction or floating point error caused by -/// successive operations. - - #[lua(kind = "Method")] - fn length(self) -> f32; - -"#, - r#" -/// Computes the squared length or norm of the complex number used to represent the rotation. -/// This is generally faster than [`Rot2::length()`], as it avoids a square -/// root operation. -/// The length is typically expected to be `1.0`. Unexpectedly denormalized rotations -/// can be a result of incorrect construction or floating point error caused by -/// successive operations. - - #[lua(kind = "Method")] - fn length_squared(self) -> f32; - -"#, - r#" -/// Computes `1.0 / self.length()`. -/// For valid results, `self` must _not_ have a length of zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f32; - -"#, - r#" -/// Returns `self` with a length of `1.0`. -/// Note that [`Rot2`] should typically already be normalized by design. -/// Manual normalization is only needed when successive operations result in -/// accumulated floating point error, or if the rotation was constructed -/// with invalid values. -/// # Panics -/// Panics if `self` has a length of zero, NaN, or infinity when debug assertions are enabled. - - #[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. - - #[lua(kind = "Method")] - fn is_finite(self) -> bool; - -"#, - r#" -/// Returns `true` if the rotation is NaN. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - r#" -/// Returns whether `self` has a length of `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns `true` if the rotation is near [`Rot2::IDENTITY`]. - - #[lua(kind = "Method")] - fn is_near_identity(self) -> bool; - -"#, - r#" -/// Returns the angle in radians needed to make `self` and `other` coincide. - - #[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 -/// of the unit complex number representing the rotation. - - #[lua(kind = "Method", output(proxy))] - fn inverse(self) -> bevy::math::Rot2; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` based on -/// the value `s`, and normalizes the rotation afterwards. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// This is slightly more efficient than [`slerp`](Self::slerp), and produces a similar result -/// when the difference between the two rotations is small. At larger differences, -/// the result resembles a kind of ease-in-out effect. -/// If you would like the angular velocity to remain constant, consider using [`slerp`](Self::slerp) instead. -/// # Details -/// `nlerp` corresponds to computing an angle for a point at position `s` on a line drawn -/// between the endpoints of the arc formed by `self` and `rhs` on a unit circle, -/// and normalizing the result afterwards. -/// Note that if the angles are opposite like 0 and π, the line will pass through the origin, -/// and the resulting angle will always be either `self` or `rhs` depending on `s`. -/// If `s` happens to be `0.5` in this case, a valid rotation cannot be computed, and `self` -/// will be returned as a fallback. -/// # Example -/// ``` -/// # use bevy_math::Rot2; -/// # -/// let rot1 = Rot2::IDENTITY; -/// let rot2 = Rot2::degrees(135.0); -/// let result1 = rot1.nlerp(rot2, 1.0 / 3.0); -/// assert_eq!(result1.as_degrees(), 28.675055); -/// let result2 = rot1.nlerp(rot2, 0.5); -/// assert_eq!(result2.as_degrees(), 67.5); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn nlerp(self, #[proxy] end: bevy::math::Rot2, s: f32) -> bevy::math::Rot2; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `end` -/// based on the value `s`. -/// This corresponds to interpolating between the two angles at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// If you would like the rotation to have a kind of ease-in-out effect, consider -/// using the slightly more efficient [`nlerp`](Self::nlerp) instead. -/// # Example -/// ``` -/// # use bevy_math::Rot2; -/// # -/// let rot1 = Rot2::IDENTITY; -/// let rot2 = Rot2::degrees(135.0); -/// let result1 = rot1.slerp(rot2, 1.0 / 3.0); -/// assert_eq!(result1.as_degrees(), 45.0); -/// let result2 = rot1.slerp(rot2, 0.5); -/// assert_eq!(result2.as_degrees(), 67.5); -/// ``` - - #[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#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Rot2 { - cos: f32, - sin: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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`. - - #[lua(kind = "Function", output(proxy))] - fn new_unchecked( - #[proxy] - 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`] - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `rhs` -/// based on the value `s`. -/// This corresponds to interpolating between the two directions at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// # Example -/// ``` -/// # use bevy_math::Dir2; -/// # use approx::{assert_relative_eq, RelativeEq}; -/// # -/// let dir1 = Dir2::X; -/// let dir2 = Dir2::Y; -/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); -/// assert_relative_eq!(result1, Dir2::from_xy(0.75_f32.sqrt(), 0.5).unwrap()); -/// let result2 = dir1.slerp(dir2, 0.5); -/// assert_relative_eq!(result2, Dir2::from_xy(0.5_f32.sqrt(), 0.5_f32.sqrt()).unwrap()); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn slerp( - self, - #[proxy] - rhs: bevy::math::prelude::Dir2, - s: f32, - ) -> bevy::math::prelude::Dir2; - -"#, - r#" -/// Get the rotation that rotates this direction to `other`. - - #[lua(kind = "Method", output(proxy))] - fn rotation_to(self, #[proxy] other: bevy::math::prelude::Dir2) -> bevy::math::Rot2; - -"#, - r#" -/// Get the rotation that rotates `other` to this direction. - - #[lua(kind = "Method", output(proxy))] - fn rotation_from( - self, - #[proxy] - other: bevy::math::prelude::Dir2, - ) -> bevy::math::Rot2; - -"#, - r#" -/// Get the rotation that rotates the X-axis to this direction. - - #[lua(kind = "Method", output(proxy))] - fn rotation_from_x(self) -> bevy::math::Rot2; - -"#, - r#" -/// Get the rotation that rotates this direction to the X-axis. - - #[lua(kind = "Method", output(proxy))] - fn rotation_to_x(self) -> bevy::math::Rot2; - -"#, - r#" -/// Get the rotation that rotates the Y-axis to this direction. - - #[lua(kind = "Method", output(proxy))] - fn rotation_from_y(self) -> bevy::math::Rot2; - -"#, - r#" -/// Get the rotation that rotates this direction to the Y-axis. - - #[lua(kind = "Method", output(proxy))] - fn rotation_to_y(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`] for an example of when such error accumulation might occur. - - #[lua(kind = "Method", output(proxy))] - fn fast_renormalize(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#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::prelude::Vec2; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Dir2(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::prelude::Dir3", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::prelude::Dir3; - -"#, - 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::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - 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. -/// # Warning -/// `value` must be normalized, i.e its length must be `1.0`. - - #[lua(kind = "Function", output(proxy))] - fn new_unchecked( - #[proxy] - 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`] - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `rhs` -/// based on the value `s`. -/// This corresponds to interpolating between the two directions at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// # Example -/// ``` -/// # use bevy_math::Dir3; -/// # use approx::{assert_relative_eq, RelativeEq}; -/// # -/// let dir1 = Dir3::X; -/// let dir2 = Dir3::Y; -/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); -/// assert_relative_eq!( -/// result1, -/// Dir3::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), -/// epsilon = 0.000001 -/// ); -/// let result2 = dir1.slerp(dir2, 0.5); -/// assert_relative_eq!(result2, Dir3::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn slerp( - self, - #[proxy] - rhs: bevy::math::prelude::Dir3, - s: f32, - ) -> bevy::math::prelude::Dir3; - -"#, - 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(kind = "Method", output(proxy))] - fn fast_renormalize(self) -> bevy::math::prelude::Dir3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Dir3(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::prelude::Dir3A", - functions[r#" -/// Create a [`Dir3A`] from a [`Vec3A`] that is already normalized. -/// # Warning -/// `value` must be normalized, i.e its length must be `1.0`. - - #[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`] - - #[lua(kind = "Method", output(proxy))] - fn as_vec3a(&self) -> bevy::math::Vec3A; - -"#, - r#" -/// Performs a spherical linear interpolation between `self` and `rhs` -/// based on the value `s`. -/// This corresponds to interpolating between the two directions at a constant angular velocity. -/// When `s == 0.0`, the result will be equal to `self`. -/// When `s == 1.0`, the result will be equal to `rhs`. -/// # Example -/// ``` -/// # use bevy_math::Dir3A; -/// # use approx::{assert_relative_eq, RelativeEq}; -/// # -/// let dir1 = Dir3A::X; -/// let dir2 = Dir3A::Y; -/// let result1 = dir1.slerp(dir2, 1.0 / 3.0); -/// assert_relative_eq!( -/// result1, -/// Dir3A::from_xyz(0.75_f32.sqrt(), 0.5, 0.0).unwrap(), -/// epsilon = 0.000001 -/// ); -/// let result2 = dir1.slerp(dir2, 0.5); -/// assert_relative_eq!(result2, Dir3A::from_xyz(0.5_f32.sqrt(), 0.5_f32.sqrt(), 0.0).unwrap()); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn slerp( - self, - #[proxy] - rhs: bevy::math::prelude::Dir3A, - 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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &direction::Dir3A) -> bool; - -"#, - 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Dir3A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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. -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 4, 10, 6); // w=10 h=2 -/// let r = IRect::new(2, 3, 5, -1); // w=3 h=4 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(x0: i32, y0: i32, x1: i32, y1: i32) -> 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. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// // Unit rect from [0,0] to [1,1] -/// let r = IRect::from_corners(IVec2::ZERO, IVec2::ONE); // w=1 h=1 -/// // Same; the points do not need to be ordered -/// let r = IRect::from_corners(IVec2::ONE, IVec2::ZERO); // w=1 h=1 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - p0: bevy::math::prelude::IVec2, - #[proxy] - p1: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Create a new rectangle from its center and size. -/// # 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. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::from_center_size(IVec2::ZERO, IVec2::new(3, 2)); // w=2 h=2 -/// assert_eq!(r.min, IVec2::splat(-1)); -/// assert_eq!(r.max, IVec2::splat(1)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_size( - #[proxy] - origin: bevy::math::prelude::IVec2, - #[proxy] - size: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Create a new rectangle from its center and half-size. -/// # Panics -/// This method panics if any of the components of the half-size is negative. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::from_center_half_size(IVec2::ZERO, IVec2::ONE); // w=2 h=2 -/// assert_eq!(r.min, IVec2::splat(-1)); -/// assert_eq!(r.max, IVec2::splat(1)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_half_size( - #[proxy] - origin: bevy::math::prelude::IVec2, - #[proxy] - half_size: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::from_corners(IVec2::ZERO, IVec2::new(0, 1)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.width(), 5); -/// ``` - - #[lua(kind = "Method")] - fn width(&self) -> i32; - -"#, - r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.height(), 1); -/// ``` - - #[lua(kind = "Method")] - fn height(&self) -> i32; - -"#, - r#" -/// Rectangle size. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.size(), IVec2::new(5, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::IVec2; - -"#, - r#" -/// Rectangle half-size. -/// # 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 -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 4, 3); // w=4 h=3 -/// assert_eq!(r.half_size(), IVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn half_size(&self) -> bevy::math::prelude::IVec2; - -"#, - r#" -/// The center point of the rectangle. -/// # Rounding Behavior -/// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 2); // w=5 h=2 -/// assert_eq!(r.center(), IVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn center(&self) -> bevy::math::prelude::IVec2; - -"#, - r#" -/// Check if a point lies within this rectangle, inclusive of its edges. -/// # Examples -/// ``` -/// # use bevy_math::IRect; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// assert!(r.contains(r.center())); -/// assert!(r.contains(r.min)); -/// assert!(r.contains(r.max)); -/// ``` - - #[lua(kind = "Method")] - fn contains(&self, #[proxy] point: bevy::math::prelude::IVec2) -> bool; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and another rectangle. -/// The union is the smallest rectangle enclosing both rectangles. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 -/// let r = r1.union(r2); -/// assert_eq!(r.min, IVec2::new(0, -1)); -/// assert_eq!(r.max, IVec2::new(5, 3)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union( - &self, - #[proxy] - other: bevy::math::prelude::IRect, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and a point. -/// The union is the smallest rectangle enclosing both the rectangle and the point. If the -/// point is already inside the rectangle, this method returns a copy of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let u = r.union_point(IVec2::new(3, 6)); -/// assert_eq!(u.min, IVec2::ZERO); -/// assert_eq!(u.max, IVec2::new(5, 6)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union_point( - &self, - #[proxy] - other: bevy::math::prelude::IVec2, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. -/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection -/// is empty, this method returns an empty rectangle ([`IRect::is_empty()`] returns `true`), but -/// the actual values of [`IRect::min`] and [`IRect::max`] are implementation-dependent. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r1 = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = IRect::new(1, -1, 3, 3); // w=2 h=4 -/// let r = r1.intersect(r2); -/// assert_eq!(r.min, IVec2::new(1, 0)); -/// assert_eq!(r.max, IVec2::new(3, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn intersect( - &self, - #[proxy] - other: bevy::math::prelude::IRect, - ) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Create a new rectangle by expanding it evenly on all sides. -/// A positive expansion value produces a larger rectangle, -/// while a negative expansion value produces a smaller rectangle. -/// If this would result in zero or negative width or height, [`IRect::EMPTY`] is returned instead. -/// # Examples -/// ``` -/// # use bevy_math::{IRect, IVec2}; -/// let r = IRect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = r.inflate(3); // w=11 h=7 -/// assert_eq!(r2.min, IVec2::splat(-3)); -/// assert_eq!(r2.max, IVec2::new(8, 4)); -/// let r = IRect::new(0, -1, 4, 3); // w=4 h=4 -/// let r2 = r.inflate(-1); // w=2 h=2 -/// assert_eq!(r2.min, IVec2::new(1, 0)); -/// assert_eq!(r2.max, IVec2::new(3, 2)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn inflate(&self, expansion: i32) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Returns self as [`Rect`] (f32) - - #[lua(kind = "Method", output(proxy))] - fn as_rect(&self) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Returns self as [`URect`] (u32) - - #[lua(kind = "Method", output(proxy))] - fn as_urect(&self) -> bevy::math::prelude::URect; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct IRect { - #[lua(output(proxy))] - min: bevy::math::prelude::IVec2, - #[lua(output(proxy))] - max: bevy::math::prelude::IVec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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. -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 4., 10., 6.); // w=10 h=2 -/// let r = Rect::new(2., 3., 5., -1.); // w=3 h=4 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(x0: f32, y0: f32, x1: f32, y1: f32) -> 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. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// // Unit rect from [0,0] to [1,1] -/// let r = Rect::from_corners(Vec2::ZERO, Vec2::ONE); // w=1 h=1 -/// // Same; the points do not need to be ordered -/// let r = Rect::from_corners(Vec2::ONE, Vec2::ZERO); // w=1 h=1 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - p0: bevy::math::prelude::Vec2, - #[proxy] - p1: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Create a new rectangle from its center and size. -/// # Panics -/// This method panics if any of the components of the size is negative. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_center_size(Vec2::ZERO, Vec2::ONE); // w=1 h=1 -/// assert!(r.min.abs_diff_eq(Vec2::splat(-0.5), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::splat(0.5), 1e-5)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_size( - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - size: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Create a new rectangle from its center and half-size. -/// # Panics -/// This method panics if any of the components of the half-size is negative. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_center_half_size(Vec2::ZERO, Vec2::ONE); // w=2 h=2 -/// assert!(r.min.abs_diff_eq(Vec2::splat(-1.), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::splat(1.), 1e-5)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_half_size( - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - half_size: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::from_corners(Vec2::ZERO, Vec2::new(0., 1.)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!((r.width() - 5.).abs() <= 1e-5); -/// ``` - - #[lua(kind = "Method")] - fn width(&self) -> f32; - -"#, - r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!((r.height() - 1.).abs() <= 1e-5); -/// ``` - - #[lua(kind = "Method")] - fn height(&self) -> f32; - -"#, - r#" -/// Rectangle size. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.size().abs_diff_eq(Vec2::new(5., 1.), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Rectangle half-size. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.half_size().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn half_size(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// The center point of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.center().abs_diff_eq(Vec2::new(2.5, 0.5), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn center(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Check if a point lies within this rectangle, inclusive of its edges. -/// # Examples -/// ``` -/// # use bevy_math::Rect; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// assert!(r.contains(r.center())); -/// assert!(r.contains(r.min)); -/// assert!(r.contains(r.max)); -/// ``` - - #[lua(kind = "Method")] - fn contains(&self, #[proxy] point: bevy::math::prelude::Vec2) -> bool; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and another rectangle. -/// The union is the smallest rectangle enclosing both rectangles. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 -/// let r = r1.union(r2); -/// assert!(r.min.abs_diff_eq(Vec2::new(0., -1.), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::new(5., 3.), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union( - &self, - #[proxy] - other: bevy::math::prelude::Rect, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and a point. -/// The union is the smallest rectangle enclosing both the rectangle and the point. If the -/// point is already inside the rectangle, this method returns a copy of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let u = r.union_point(Vec2::new(3., 6.)); -/// assert!(u.min.abs_diff_eq(Vec2::ZERO, 1e-5)); -/// assert!(u.max.abs_diff_eq(Vec2::new(5., 6.), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union_point( - &self, - #[proxy] - other: bevy::math::prelude::Vec2, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. -/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection -/// is empty, this method returns an empty rectangle ([`Rect::is_empty()`] returns `true`), but -/// the actual values of [`Rect::min`] and [`Rect::max`] are implementation-dependent. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r1 = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let r2 = Rect::new(1., -1., 3., 3.); // w=2 h=4 -/// let r = r1.intersect(r2); -/// assert!(r.min.abs_diff_eq(Vec2::new(1., 0.), 1e-5)); -/// assert!(r.max.abs_diff_eq(Vec2::new(3., 1.), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn intersect( - &self, - #[proxy] - other: bevy::math::prelude::Rect, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Create a new rectangle by expanding it evenly on all sides. -/// A positive expansion value produces a larger rectangle, -/// while a negative expansion value produces a smaller rectangle. -/// If this would result in zero or negative width or height, [`Rect::EMPTY`] is returned instead. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(0., 0., 5., 1.); // w=5 h=1 -/// let r2 = r.inflate(3.); // w=11 h=7 -/// assert!(r2.min.abs_diff_eq(Vec2::splat(-3.), 1e-5)); -/// assert!(r2.max.abs_diff_eq(Vec2::new(8., 4.), 1e-5)); -/// let r = Rect::new(0., -1., 6., 7.); // w=6 h=8 -/// let r2 = r.inflate(-2.); // w=11 h=7 -/// assert!(r2.min.abs_diff_eq(Vec2::new(2., 1.), 1e-5)); -/// assert!(r2.max.abs_diff_eq(Vec2::new(4., 5.), 1e-5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn inflate(&self, expansion: f32) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Build a new rectangle from this one with its coordinates expressed -/// relative to `other` in a normalized ([0..1] x [0..1]) coordinate system. -/// # Examples -/// ``` -/// # use bevy_math::{Rect, Vec2}; -/// let r = Rect::new(2., 3., 4., 6.); -/// let s = Rect::new(0., 0., 10., 10.); -/// let n = r.normalize(s); -/// assert_eq!(n.min.x, 0.2); -/// assert_eq!(n.min.y, 0.3); -/// assert_eq!(n.max.x, 0.4); -/// assert_eq!(n.max.y, 0.6); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn normalize( - &self, - #[proxy] - other: bevy::math::prelude::Rect, - ) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Returns self as [`IRect`] (i32) - - #[lua(kind = "Method", output(proxy))] - fn as_irect(&self) -> bevy::math::prelude::IRect; - -"#, - r#" -/// Returns self as [`URect`] (u32) - - #[lua(kind = "Method", output(proxy))] - fn as_urect(&self) -> bevy::math::prelude::URect; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Rect { - #[lua(output(proxy))] - min: bevy::math::prelude::Vec2, - #[lua(output(proxy))] - max: bevy::math::prelude::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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. -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 4, 10, 6); // w=10 h=2 -/// let r = URect::new(2, 4, 5, 0); // w=3 h=4 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(x0: u32, y0: u32, x1: u32, y1: u32) -> bevy::math::prelude::URect; - -"#, - 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. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// // Unit rect from [0,0] to [1,1] -/// let r = URect::from_corners(UVec2::ZERO, UVec2::ONE); // w=1 h=1 -/// // Same; the points do not need to be ordered -/// let r = URect::from_corners(UVec2::ONE, UVec2::ZERO); // w=1 h=1 -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - p0: bevy::math::prelude::UVec2, - #[proxy] - p1: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Create a new rectangle from its center and size. -/// # 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. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::from_center_size(UVec2::ONE, UVec2::splat(2)); // w=2 h=2 -/// assert_eq!(r.min, UVec2::splat(0)); -/// assert_eq!(r.max, UVec2::splat(2)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_size( - #[proxy] - origin: bevy::math::prelude::UVec2, - #[proxy] - size: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Create a new rectangle from its center and half-size. -/// # Panics -/// This method panics if any of the components of the half-size is negative or if `origin - half_size` results in any negatives. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::from_center_half_size(UVec2::ONE, UVec2::ONE); // w=2 h=2 -/// assert_eq!(r.min, UVec2::splat(0)); -/// assert_eq!(r.max, UVec2::splat(2)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_center_half_size( - #[proxy] - origin: bevy::math::prelude::UVec2, - #[proxy] - half_size: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Check if the rectangle is empty. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::from_corners(UVec2::ZERO, UVec2::new(0, 1)); // w=0 h=1 -/// assert!(r.is_empty()); -/// ``` - - #[lua(kind = "Method")] - fn is_empty(&self) -> bool; - -"#, - r#" -/// Rectangle width (max.x - min.x). -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.width(), 5); -/// ``` - - #[lua(kind = "Method")] - fn width(&self) -> u32; - -"#, - r#" -/// Rectangle height (max.y - min.y). -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.height(), 1); -/// ``` - - #[lua(kind = "Method")] - fn height(&self) -> u32; - -"#, - r#" -/// Rectangle size. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert_eq!(r.size(), UVec2::new(5, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::UVec2; - -"#, - r#" -/// Rectangle half-size. -/// # 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 -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 4, 2); // w=4 h=2 -/// assert_eq!(r.half_size(), UVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn half_size(&self) -> bevy::math::prelude::UVec2; - -"#, - r#" -/// The center point of the rectangle. -/// # Rounding Behavior -/// If the (min + max) contains odd numbers they will be rounded down to the nearest whole number when calculating the center. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 4, 2); // w=4 h=2 -/// assert_eq!(r.center(), UVec2::new(2, 1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn center(&self) -> bevy::math::prelude::UVec2; - -"#, - r#" -/// Check if a point lies within this rectangle, inclusive of its edges. -/// # Examples -/// ``` -/// # use bevy_math::URect; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// assert!(r.contains(r.center())); -/// assert!(r.contains(r.min)); -/// assert!(r.contains(r.max)); -/// ``` - - #[lua(kind = "Method")] - fn contains(&self, #[proxy] point: bevy::math::prelude::UVec2) -> bool; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and another rectangle. -/// The union is the smallest rectangle enclosing both rectangles. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r1 = URect::new(0, 0, 5, 1); // w=5 h=1 -/// let r2 = URect::new(1, 0, 3, 8); // w=2 h=4 -/// let r = r1.union(r2); -/// assert_eq!(r.min, UVec2::new(0, 0)); -/// assert_eq!(r.max, UVec2::new(5, 8)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union( - &self, - #[proxy] - other: bevy::math::prelude::URect, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Build a new rectangle formed of the union of this rectangle and a point. -/// The union is the smallest rectangle enclosing both the rectangle and the point. If the -/// point is already inside the rectangle, this method returns a copy of the rectangle. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(0, 0, 5, 1); // w=5 h=1 -/// let u = r.union_point(UVec2::new(3, 6)); -/// assert_eq!(u.min, UVec2::ZERO); -/// assert_eq!(u.max, UVec2::new(5, 6)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn union_point( - &self, - #[proxy] - other: bevy::math::prelude::UVec2, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Build a new rectangle formed of the intersection of this rectangle and another rectangle. -/// The intersection is the largest rectangle enclosed in both rectangles. If the intersection -/// is empty, this method returns an empty rectangle ([`URect::is_empty()`] returns `true`), but -/// the actual values of [`URect::min`] and [`URect::max`] are implementation-dependent. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r1 = URect::new(0, 0, 2, 2); // w=2 h=2 -/// let r2 = URect::new(1, 1, 3, 3); // w=2 h=2 -/// let r = r1.intersect(r2); -/// assert_eq!(r.min, UVec2::new(1, 1)); -/// assert_eq!(r.max, UVec2::new(2, 2)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn intersect( - &self, - #[proxy] - other: bevy::math::prelude::URect, - ) -> bevy::math::prelude::URect; - -"#, - r#" -/// Create a new rectangle by expanding it evenly on all sides. -/// A positive expansion value produces a larger rectangle, -/// while a negative expansion value produces a smaller rectangle. -/// If this would result in zero width or height, [`URect::EMPTY`] is returned instead. -/// # Examples -/// ``` -/// # use bevy_math::{URect, UVec2}; -/// let r = URect::new(4, 4, 6, 6); // w=2 h=2 -/// let r2 = r.inflate(1); // w=4 h=4 -/// assert_eq!(r2.min, UVec2::splat(3)); -/// assert_eq!(r2.max, UVec2::splat(7)); -/// let r = URect::new(4, 4, 8, 8); // w=4 h=4 -/// let r2 = r.inflate(-1); // w=2 h=2 -/// assert_eq!(r2.min, UVec2::splat(5)); -/// assert_eq!(r2.max, UVec2::splat(7)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn inflate(&self, expansion: i32) -> bevy::math::prelude::URect; - -"#, - r#" -/// Returns self as [`Rect`] (f32) - - #[lua(kind = "Method", output(proxy))] - fn as_rect(&self) -> bevy::math::prelude::Rect; - -"#, - r#" -/// Returns self as [`IRect`] (i32) - - #[lua(kind = "Method", output(proxy))] - fn as_irect(&self) -> bevy::math::prelude::IRect; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct URect { - #[lua(output(proxy))] - min: bevy::math::prelude::UVec2, - #[lua(output(proxy))] - max: bevy::math::prelude::UVec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy(derive(), remote = "bevy::math::Affine3", functions[])] -struct Affine3 { - #[lua(output(proxy))] - matrix3: bevy::math::prelude::Mat3, - #[lua(output(proxy))] - translation: bevy::math::prelude::Vec3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn new( - #[proxy] - center: bevy::math::prelude::Vec2, - #[proxy] - half_size: bevy::math::prelude::Vec2, - ) -> bevy::math::bounding::Aabb2d; - -"#, - r#" -/// Computes the smallest [`BoundingCircle`] containing this [`Aabb2d`]. - - #[lua(kind = "Method", output(proxy))] - fn bounding_circle(&self) -> bevy::math::bounding::BoundingCircle; - -"#, - r#" -/// Finds the point on the AABB that is closest to the given `point`. -/// If the point is outside the AABB, the returned point will be on the perimeter of the AABB. -/// Otherwise, it will be inside the AABB 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 Aabb2d { - #[lua(output(proxy))] - min: bevy::math::prelude::Vec2, - #[lua(output(proxy))] - max: bevy::math::prelude::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::bounding::BoundingCircle", - functions[r#" -/// Constructs a bounding circle from its center and radius. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - center: bevy::math::prelude::Vec2, - radius: f32, - ) -> bevy::math::bounding::BoundingCircle; - -"#, - r#" -/// Get the radius of the bounding circle - - #[lua(kind = "Method")] - fn radius(&self) -> f32; - -"#, - r#" -/// Computes the smallest [`Aabb2d`] containing this [`BoundingCircle`]. - - #[lua(kind = "Method", output(proxy))] - fn aabb_2d(&self) -> bevy::math::bounding::Aabb2d; - -"#, - r#" -/// Finds the point on the bounding circle that is closest to the given `point`. -/// If the point is outside the circle, the returned point will be on the perimeter of the circle. -/// Otherwise, it will be inside the circle 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(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingCircle; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BoundingCircle { - #[lua(output(proxy))] - center: bevy::math::prelude::Vec2, - #[lua(output(proxy))] - circle: bevy::math::primitives::Circle, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn new(radius: f32) -> bevy::math::primitives::Circle; - -"#, - r#" -/// Get the diameter of the circle - - #[lua(kind = "Method")] - fn diameter(&self) -> f32; - -"#, - r#" -/// Finds the point on the circle that is closest to the given `point`. -/// If the point is outside the circle, the returned point will be on the perimeter of the circle. -/// Otherwise, it will be inside the circle 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( - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Circle { - radius: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Annulus", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" - - #[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))] - fn new(radius: f32, half_angle: f32) -> bevy::math::primitives::Arc2d; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and an `angle` in radians - - #[lua(kind = "Function", output(proxy))] - fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::Arc2d; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and an `angle` in degrees. - - #[lua(kind = "Function", output(proxy))] - fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::Arc2d; - -"#, - r#" -/// Create a new [`Arc2d`] from a `radius` and a `fraction` of a single turn. -/// For instance, `0.5` turns is a semicircle. - - #[lua(kind = "Function", output(proxy))] - fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::Arc2d; - -"#, - r#" -/// Get the angle of the arc - - #[lua(kind = "Method")] - fn angle(&self) -> f32; - -"#, - r#" -/// Get the length of the arc - - #[lua(kind = "Method")] - fn length(&self) -> f32; - -"#, - r#" -/// Get the right-hand end point of the arc - - #[lua(kind = "Method", output(proxy))] - fn right_endpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the left-hand end point of the arc - - #[lua(kind = "Method", output(proxy))] - fn left_endpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the midpoint of the arc - - #[lua(kind = "Method", output(proxy))] - fn midpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get half the distance between the endpoints (half the length of the chord) - - #[lua(kind = "Method")] - fn half_chord_length(&self) -> f32; - -"#, - r#" -/// Get the distance between the endpoints (the length of the chord) - - #[lua(kind = "Method")] - fn chord_length(&self) -> f32; - -"#, - r#" -/// Get the midpoint of the two endpoints (the midpoint of the chord) - - #[lua(kind = "Method", output(proxy))] - fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the length of the apothem of this arc, that is, -/// the distance from the center of the circle to the midpoint of the chord, in the direction of the midpoint of the arc. -/// Equivalently, the [`radius`](Self::radius) minus the [`sagitta`](Self::sagitta). -/// Note that for a [`major`](Self::is_major) arc, the apothem will be negative. - - #[lua(kind = "Method")] - fn apothem(&self) -> f32; - -"#, - r#" -/// Get the length of the sagitta of this arc, that is, -/// the length of the line between the midpoints of the arc and its chord. -/// Equivalently, the height of the triangle whose base is the chord and whose apex is the midpoint of the arc. -/// The sagitta is also the sum of the [`radius`](Self::radius) and the [`apothem`](Self::apothem). - - #[lua(kind = "Method")] - fn sagitta(&self) -> f32; - -"#, - r#" -/// Produces true if the arc is at most half a circle. -/// **Note:** This is not the negation of [`is_major`](Self::is_major): an exact semicircle is both major and minor. - - #[lua(kind = "Method")] - fn is_minor(&self) -> bool; - -"#, - r#" -/// Produces true if the arc is at least half a circle. -/// **Note:** This is not the negation of [`is_minor`](Self::is_minor): an exact semicircle is both major and minor. - - #[lua(kind = "Method")] - fn is_major(&self) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Arc2d { - radius: f32, - half_angle: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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#" - - #[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 - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule2d; - -"#, - r#" -/// Get the part connecting the semicircular ends of the capsule as a [`Rectangle`] - - #[lua(kind = "Method", output(proxy))] - fn to_inner_rectangle(&self) -> bevy::math::primitives::Rectangle; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Capsule2d { - radius: f32, - half_length: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::CircularSector", - functions[r#" -/// Create a new [`CircularSector`] from a `radius` and an `angle` - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; - -"#, - r#" -/// Create a new [`CircularSector`] from a `radius` and an `angle` in radians. - - #[lua(kind = "Function", output(proxy))] - fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; - -"#, - r#" -/// Create a new [`CircularSector`] from a `radius` and an `angle` in degrees. - - #[lua(kind = "Function", output(proxy))] - fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::CircularSector; - -"#, - r#" -/// Create a new [`CircularSector`] from a `radius` and a number of `turns` of a circle. -/// For instance, `0.5` turns is a semicircle. - - #[lua(kind = "Function", output(proxy))] - fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::CircularSector; - -"#, - r#" -/// Get half the angle of the sector - - #[lua(kind = "Method")] - fn half_angle(&self) -> f32; - -"#, - r#" -/// Get the angle of the sector - - #[lua(kind = "Method")] - fn angle(&self) -> f32; - -"#, - r#" -/// Get the radius of the sector - - #[lua(kind = "Method")] - fn radius(&self) -> f32; - -"#, - r#" -/// Get the length of the arc defining the sector - - #[lua(kind = "Method")] - fn arc_length(&self) -> f32; - -"#, - r#" -/// Get half the length of the chord defined by the sector -/// See [`Arc2d::half_chord_length`] - - #[lua(kind = "Method")] - fn half_chord_length(&self) -> f32; - -"#, - r#" -/// Get the length of the chord defined by the sector -/// See [`Arc2d::chord_length`] - - #[lua(kind = "Method")] - fn chord_length(&self) -> f32; - -"#, - r#" -/// Get the midpoint of the chord defined by the sector -/// See [`Arc2d::chord_midpoint`] - - #[lua(kind = "Method", output(proxy))] - fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the length of the apothem of this sector -/// See [`Arc2d::apothem`] - - #[lua(kind = "Method")] - fn apothem(&self) -> f32; - -"#, - r#" -/// Get the length of the sagitta of this sector -/// See [`Arc2d::sagitta`] - - #[lua(kind = "Method")] - fn sagitta(&self) -> f32; - -"#, - 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -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#" -/// Create a new [`CircularSegment`] from a `radius`, and an `angle` - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; - -"#, - r#" -/// Create a new [`CircularSegment`] from a `radius` and an `angle` in radians. - - #[lua(kind = "Function", output(proxy))] - fn from_radians(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; - -"#, - r#" -/// Create a new [`CircularSegment`] from a `radius` and an `angle` in degrees. - - #[lua(kind = "Function", output(proxy))] - fn from_degrees(radius: f32, angle: f32) -> bevy::math::primitives::CircularSegment; - -"#, - r#" -/// Create a new [`CircularSegment`] from a `radius` and a number of `turns` of a circle. -/// For instance, `0.5` turns is a semicircle. - - #[lua(kind = "Function", output(proxy))] - fn from_turns(radius: f32, fraction: f32) -> bevy::math::primitives::CircularSegment; - -"#, - r#" -/// Get the half-angle of the segment - - #[lua(kind = "Method")] - fn half_angle(&self) -> f32; - -"#, - r#" -/// Get the angle of the segment - - #[lua(kind = "Method")] - fn angle(&self) -> f32; - -"#, - r#" -/// Get the radius of the segment - - #[lua(kind = "Method")] - fn radius(&self) -> f32; - -"#, - r#" -/// Get the length of the arc defining the segment - - #[lua(kind = "Method")] - fn arc_length(&self) -> f32; - -"#, - r#" -/// Get half the length of the segment's base, also known as its chord - - #[lua(kind = "Method")] - fn half_chord_length(&self) -> f32; - -"#, - r#" -/// Get the length of the segment's base, also known as its chord - - #[lua(kind = "Method")] - fn chord_length(&self) -> f32; - -"#, - r#" -/// Get the midpoint of the segment's base, also known as its chord - - #[lua(kind = "Method", output(proxy))] - fn chord_midpoint(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the length of the apothem of this segment, -/// which is the signed distance between the segment and the center of its circle -/// See [`Arc2d::apothem`] - - #[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#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::CircularSegment; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct CircularSegment { - #[lua(output(proxy))] - arc: bevy::math::primitives::Arc2d, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Ellipse", - functions[r#" -/// Create a new `Ellipse` from half of its width and height. -/// This corresponds to the two perpendicular radii defining the ellipse. - - #[lua(kind = "Function", output(proxy))] - fn new(half_width: f32, half_height: f32) -> bevy::math::primitives::Ellipse; - -"#, - r#" -/// Create a new `Ellipse` from a given full size. -/// `size.x` is the diameter along the X axis, and `size.y` is the diameter along the Y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_size( - #[proxy] - size: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Ellipse; - -"#, - r#" -/// Returns the [eccentricity](https://en.wikipedia.org/wiki/Eccentricity_(mathematics)) of the ellipse. -/// It can be thought of as a measure of how "stretched" or elongated the ellipse is. -/// The value should be in the range [0, 1), where 0 represents a circle, and 1 represents a parabola. - - #[lua(kind = "Method")] - fn eccentricity(&self) -> f32; - -"#, - r#" -/// Get the focal length of the ellipse. This corresponds to the distance between one of the foci and the center of the ellipse. -/// The focal length of an ellipse is related to its eccentricity by `eccentricity = focal_length / semi_major` - - #[lua(kind = "Method")] - fn focal_length(&self) -> f32; - -"#, - r#" -/// Returns the length of the semi-major axis. This corresponds to the longest radius of the ellipse. - - #[lua(kind = "Method")] - fn semi_major(&self) -> f32; - -"#, - r#" -/// Returns the length of the semi-minor axis. This corresponds to the shortest radius of the ellipse. - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Ellipse { - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Line2d", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Line2d { - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Plane2d", - functions[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 -/// # 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; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Plane2d; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Plane2d { - #[lua(output(proxy))] - normal: bevy::math::prelude::Dir2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Rectangle", - functions[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))] - fn new(width: f32, height: f32) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Create a new `Rectangle` from a given full size - - #[lua(kind = "Function", output(proxy))] - fn from_size( - #[proxy] - size: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Create a new `Rectangle` from two corner points - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - point1: bevy::math::prelude::Vec2, - #[proxy] - point2: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Create a `Rectangle` from a single length. -/// The resulting `Rectangle` will be the same size in every direction. - - #[lua(kind = "Function", output(proxy))] - fn from_length(length: f32) -> bevy::math::primitives::Rectangle; - -"#, - r#" -/// Get the size of the rectangle - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Finds the point on the rectangle that is closest to the given `point`. -/// If the point is outside the rectangle, the returned point will be on the perimeter of the rectangle. -/// Otherwise, it will be inside the rectangle 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(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::primitives::Rectangle; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Rectangle { - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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: u32) -> bevy::math::primitives::RegularPolygon; - -"#, - r#" -/// Get the radius of the circumcircle on which all vertices -/// of the regular polygon lie - - #[lua(kind = "Method")] - fn circumradius(&self) -> f32; - -"#, - r#" -/// Get the inradius or apothem of the regular polygon. -/// This is the radius of the largest circle that can -/// be drawn within the polygon - - #[lua(kind = "Method")] - fn inradius(&self) -> f32; - -"#, - r#" -/// Get the length of one side of the regular polygon - - #[lua(kind = "Method")] - fn side_length(&self) -> f32; - -"#, - r#" -/// Get the internal angle of the regular polygon in degrees. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the interior of the polygon - - #[lua(kind = "Method")] - fn internal_angle_degrees(&self) -> f32; - -"#, - r#" -/// Get the internal angle of the regular polygon in radians. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the interior of the polygon - - #[lua(kind = "Method")] - fn internal_angle_radians(&self) -> f32; - -"#, - r#" -/// Get the external angle of the regular polygon in degrees. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the exterior of the polygon - - #[lua(kind = "Method")] - fn external_angle_degrees(&self) -> f32; - -"#, - r#" -/// Get the external angle of the regular polygon in radians. -/// This is the angle formed by two adjacent sides with points -/// within the angle being in the exterior of the polygon - - #[lua(kind = "Method")] - fn external_angle_radians(&self) -> f32; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RegularPolygon { - #[lua(output(proxy))] - circumcircle: bevy::math::primitives::Circle, - sides: u32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Rhombus", - functions[r#" -/// Create a new `Rhombus` from a vertical and horizontal diagonal sizes. - - #[lua(kind = "Function", output(proxy))] - fn new( - horizontal_diagonal: f32, - vertical_diagonal: f32, - ) -> bevy::math::primitives::Rhombus; - -"#, - r#" -/// Create a new `Rhombus` from a side length with all inner angles equal. - - #[lua(kind = "Function", output(proxy))] - fn from_side(side: f32) -> bevy::math::primitives::Rhombus; - -"#, - r#" -/// Create a new `Rhombus` from a given inradius with all inner angles equal. - - #[lua(kind = "Function", output(proxy))] - fn from_inradius(inradius: f32) -> bevy::math::primitives::Rhombus; - -"#, - r#" -/// Get the length of each side of the rhombus - - #[lua(kind = "Method")] - fn side(&self) -> f32; - -"#, - r#" -/// Get the radius of the circumcircle on which all vertices -/// of the rhombus lie - - #[lua(kind = "Method")] - fn circumradius(&self) -> f32; - -"#, - r#" -/// Get the radius of the largest circle that can -/// be drawn within the rhombus - - #[lua(kind = "Method")] - fn inradius(&self) -> f32; - -"#, - r#" -/// Finds the point on the rhombus that is closest to the given `point`. -/// If the point is outside the rhombus, the returned point will be on the perimeter of the rhombus. -/// Otherwise, it will be inside the rhombus 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( - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Rhombus { - #[lua(output(proxy))] - half_diagonals: bevy::math::prelude::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn new( - #[proxy] - direction: bevy::math::prelude::Dir2, - length: f32, - ) -> bevy::math::primitives::Segment2d; - -"#, - r#" -/// Get the position of the first point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point1(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the position of the second point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point2(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Segment2d { - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir2, - half_length: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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#" - - #[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))] - fn new( - #[proxy] - a: bevy::math::prelude::Vec2, - #[proxy] - b: bevy::math::prelude::Vec2, - #[proxy] - c: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Triangle2d; - -"#, - r#" -/// Checks if the triangle is degenerate, meaning it has zero area. -/// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. -/// This indicates that the three vertices are collinear or nearly collinear. - - #[lua(kind = "Method")] - fn is_degenerate(&self) -> bool; - -"#, - r#" -/// Checks if the triangle is acute, meaning all angles are less than 90 degrees - - #[lua(kind = "Method")] - fn is_acute(&self) -> bool; - -"#, - r#" -/// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees - - #[lua(kind = "Method")] - fn is_obtuse(&self) -> bool; - -"#, - r#" -/// Reverse the [`WindingOrder`] of the triangle -/// by swapping the first and last vertices. - - #[lua(kind = "MutatingMethod")] - fn reverse(&mut self) -> (); - -"#, - r#" -/// This triangle but reversed. - - #[lua(kind = "Method", output(proxy))] - fn reversed(self) -> bevy::math::primitives::Triangle2d; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Triangle2d { - vertices: ReflectedValue, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::bounding::Aabb3d", - functions[r#" -/// Computes the smallest [`BoundingSphere`] containing this [`Aabb3d`]. - - #[lua(kind = "Method", output(proxy))] - fn bounding_sphere(&self) -> bevy::math::bounding::BoundingSphere; - -"#, - r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::Aabb3d; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Aabb3d { - #[lua(output(proxy))] - min: bevy::math::Vec3A, - #[lua(output(proxy))] - max: bevy::math::Vec3A, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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")] - fn radius(&self) -> f32; - -"#, - r#" -/// Computes the smallest [`Aabb3d`] containing this [`BoundingSphere`]. - - #[lua(kind = "Method", output(proxy))] - fn aabb_3d(&self) -> bevy::math::bounding::Aabb3d; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BoundingSphere { - #[lua(output(proxy))] - center: bevy::math::Vec3A, - #[lua(output(proxy))] - sphere: bevy::math::primitives::Sphere, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Sphere", - functions[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` - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32) -> bevy::math::primitives::Sphere; - -"#, - r#" -/// Get the diameter of the sphere - - #[lua(kind = "Method")] - fn diameter(&self) -> f32; - -"#, - r#" -/// Finds the point on the sphere that is closest to the given `point`. -/// If the point is outside the sphere, the returned point will be on the surface of the sphere. -/// Otherwise, it will be inside the sphere and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Sphere { - radius: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn new( - x_length: f32, - y_length: f32, - z_length: f32, - ) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Create a new `Cuboid` from a given full size - - #[lua(kind = "Function", output(proxy))] - fn from_size( - #[proxy] - size: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Create a new `Cuboid` from two corner points - - #[lua(kind = "Function", output(proxy))] - fn from_corners( - #[proxy] - point1: bevy::math::prelude::Vec3, - #[proxy] - point2: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Create a `Cuboid` from a single length. -/// The resulting `Cuboid` will be the same size in every direction. - - #[lua(kind = "Function", output(proxy))] - fn from_length(length: f32) -> bevy::math::primitives::Cuboid; - -"#, - r#" -/// Get the size of the cuboid - - #[lua(kind = "Method", output(proxy))] - fn size(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -/// Finds the point on the cuboid that is closest to the given `point`. -/// If the point is outside the cuboid, the returned point will be on the surface of the cuboid. -/// Otherwise, it will be inside the cuboid and returned as is. - - #[lua(kind = "Method", output(proxy))] - fn closest_point( - &self, - #[proxy] - 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::Cuboid) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Cuboid { - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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#" -/// Create a new `Cylinder` from a radius and full height - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, height: f32) -> bevy::math::primitives::Cylinder; - -"#, - r#" -/// Get the base of the cylinder as a [`Circle`] - - #[lua(kind = "Method", output(proxy))] - fn base(&self) -> bevy::math::primitives::Circle; - -"#, - r#" -/// Get the surface area of the side of the cylinder, -/// also known as the lateral area - - #[lua(kind = "Method")] - fn lateral_area(&self) -> f32; - -"#, - r#" -/// Get the surface area of one base of the cylinder - - #[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::Cylinder; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Cylinder { - radius: f32, - half_height: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Capsule3d", - functions[r#" -/// Create a new `Capsule3d` from a radius and length - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, length: f32) -> bevy::math::primitives::Capsule3d; - -"#, - r#" -/// Get the part connecting the hemispherical ends -/// of the capsule as a [`Cylinder`] - - #[lua(kind = "Method", output(proxy))] - fn to_cylinder(&self) -> bevy::math::primitives::Cylinder; - -"#, - r#" - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Capsule3d { - radius: f32, - half_length: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Cone", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Cone) -> bool; - -"#, - r#" -/// Create a new [`Cone`] from a radius and height. - - #[lua(kind = "Function", output(proxy))] - fn new(radius: f32, height: f32) -> bevy::math::primitives::Cone; - -"#, - r#" -/// Get the base of the cone as a [`Circle`] - - #[lua(kind = "Method", output(proxy))] - fn base(&self) -> bevy::math::primitives::Circle; - -"#, - r#" -/// Get the slant height of the cone, the length of the line segment -/// connecting a point on the base to the apex - - #[lua(kind = "Method")] - fn slant_height(&self) -> f32; - -"#, - r#" -/// Get the surface area of the side of the cone, -/// also known as the lateral area - - #[lua(kind = "Method")] - fn lateral_area(&self) -> f32; - -"#, - r#" -/// Get the surface area of the base of the cone - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Cone { - radius: f32, - height: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::ConicalFrustum) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct ConicalFrustum { - radius_top: f32, - radius_bottom: f32, - height: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::InfinitePlane3d", - functions[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( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::InfinitePlane3d) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct InfinitePlane3d { - #[lua(output(proxy))] - normal: bevy::math::prelude::Dir3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &primitives::dim3::Line3d) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Line3d { - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn new( - #[proxy] - direction: bevy::math::prelude::Dir3, - length: f32, - ) -> bevy::math::primitives::Segment3d; - -"#, - r#" -/// Get the position of the first point on the line segment - - #[lua(kind = "Method", output(proxy))] - fn point1(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -/// Get the position of the second point on the line segment - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Segment3d { - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir3, - half_length: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Torus", - functions[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 - - #[lua(kind = "Function", output(proxy))] - fn new(inner_radius: f32, outer_radius: f32) -> bevy::math::primitives::Torus; - -"#, - r#" -/// Get the inner radius of the torus. -/// For a ring torus, this corresponds to the radius of the hole, -/// or `major_radius - minor_radius` - - #[lua(kind = "Method")] - fn inner_radius(&self) -> f32; - -"#, - r#" -/// Get the outer radius of the torus. -/// This corresponds to the overall radius of the entire object, -/// or `major_radius + minor_radius` - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Torus { - minor_radius: f32, - major_radius: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Triangle3d", - functions[r#" -/// Create a new [`Triangle3d`] from points `a`, `b`, and `c`. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - a: bevy::math::prelude::Vec3, - #[proxy] - b: bevy::math::prelude::Vec3, - #[proxy] - c: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Triangle3d; - -"#, - r#" -/// Checks if the triangle is degenerate, meaning it has zero area. -/// A triangle is degenerate if the cross product of the vectors `ab` and `ac` has a length less than `10e-7`. -/// This indicates that the three vertices are collinear or nearly collinear. - - #[lua(kind = "Method")] - fn is_degenerate(&self) -> bool; - -"#, - r#" -/// Checks if the triangle is acute, meaning all angles are less than 90 degrees - - #[lua(kind = "Method")] - fn is_acute(&self) -> bool; - -"#, - r#" -/// Checks if the triangle is obtuse, meaning one angle is greater than 90 degrees - - #[lua(kind = "Method")] - fn is_obtuse(&self) -> bool; - -"#, - r#" -/// Reverse the triangle by swapping the first and last vertices. - - #[lua(kind = "MutatingMethod")] - fn reverse(&mut self) -> (); - -"#, - r#" -/// This triangle but reversed. - - #[lua(kind = "Method", output(proxy))] - fn reversed(self) -> bevy::math::primitives::Triangle3d; - -"#, - r#" -/// Get the centroid of the triangle. -/// This function finds the geometric center of the triangle by averaging the vertices: -/// `centroid = (a + b + c) / 3`. - - #[lua(kind = "Method", output(proxy))] - fn centroid(&self) -> bevy::math::prelude::Vec3; - -"#, - r#" -/// Get the circumcenter of the triangle. - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Triangle3d { - vertices: ReflectedValue, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn new( - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - direction: bevy::math::prelude::Dir2, - max: f32, - ) -> bevy::math::bounding::RayCast2d; - -"#, - r#" -/// Construct a [`RayCast2d`] from a [`Ray2d`] and max distance. - - #[lua(kind = "Function", output(proxy))] - fn from_ray( - #[proxy] - ray: bevy::math::Ray2d, - max: f32, - ) -> bevy::math::bounding::RayCast2d; - -"#, - r#" -/// Get the cached multiplicative inverse of the direction of the ray. - - #[lua(kind = "Method", output(proxy))] - fn direction_recip(&self) -> bevy::math::prelude::Vec2; - -"#, - r#" -/// Get the distance of an intersection with an [`Aabb2d`], if any. - - #[lua(kind = "Method")] - fn aabb_intersection_at( - &self, - #[proxy] - aabb: &bounding::bounded2d::Aabb2d, - ) -> std::option::Option; - -"#, - r#" -/// Get the distance of an intersection with a [`BoundingCircle`], if any. - - #[lua(kind = "Method")] - fn circle_intersection_at( - &self, - #[proxy] - circle: &bounding::bounded2d::BoundingCircle, - ) -> std::option::Option; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RayCast2d { - #[lua(output(proxy))] - ray: bevy::math::Ray2d, - max: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::bounding::AabbCast2d", - functions[r#" -/// Construct an [`AabbCast2d`] from an [`Aabb2d`], origin, [`Dir2`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - aabb: bevy::math::bounding::Aabb2d, - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - direction: bevy::math::prelude::Dir2, - max: f32, - ) -> bevy::math::bounding::AabbCast2d; - -"#, - r#" -/// Construct an [`AabbCast2d`] from an [`Aabb2d`], [`Ray2d`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn from_ray( - #[proxy] - aabb: bevy::math::bounding::Aabb2d, - #[proxy] - ray: bevy::math::Ray2d, - max: f32, - ) -> bevy::math::bounding::AabbCast2d; - -"#, - r#" -/// Get the distance at which the [`Aabb2d`]s collide, if at all. - - #[lua(kind = "Method")] - fn aabb_collision_at( - &self, - #[proxy] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct AabbCast2d { - #[lua(output(proxy))] - ray: bevy::math::bounding::RayCast2d, - #[lua(output(proxy))] - aabb: bevy::math::bounding::Aabb2d, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::bounding::BoundingCircleCast", - functions[r#" -/// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], origin, [`Dir2`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - circle: bevy::math::bounding::BoundingCircle, - #[proxy] - origin: bevy::math::prelude::Vec2, - #[proxy] - direction: bevy::math::prelude::Dir2, - max: f32, - ) -> bevy::math::bounding::BoundingCircleCast; - -"#, - r#" -/// Construct a [`BoundingCircleCast`] from a [`BoundingCircle`], [`Ray2d`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn from_ray( - #[proxy] - circle: bevy::math::bounding::BoundingCircle, - #[proxy] - ray: bevy::math::Ray2d, - max: f32, - ) -> bevy::math::bounding::BoundingCircleCast; - -"#, - r#" -/// Get the distance at which the [`BoundingCircle`]s collide, if at all. - - #[lua(kind = "Method")] - fn circle_collision_at( - &self, - #[proxy] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BoundingCircleCast { - #[lua(output(proxy))] - ray: bevy::math::bounding::RayCast2d, - #[lua(output(proxy))] - circle: bevy::math::bounding::BoundingCircle, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn from_ray( - #[proxy] - ray: bevy::math::Ray3d, - max: f32, - ) -> bevy::math::bounding::RayCast3d; - -"#, - r#" -/// Get the cached multiplicative inverse of the direction of the ray. - - #[lua(kind = "Method", output(proxy))] - fn direction_recip(&self) -> bevy::math::Vec3A; - -"#, - r#" -/// Get the distance of an intersection with an [`Aabb3d`], if any. - - #[lua(kind = "Method")] - fn aabb_intersection_at( - &self, - #[proxy] - aabb: &bounding::bounded3d::Aabb3d, - ) -> std::option::Option; - -"#, - r#" -/// Get the distance of an intersection with a [`BoundingSphere`], if any. - - #[lua(kind = "Method")] - fn sphere_intersection_at( - &self, - #[proxy] - sphere: &bounding::bounded3d::BoundingSphere, - ) -> std::option::Option; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct RayCast3d { - #[lua(output(proxy))] - origin: bevy::math::Vec3A, - #[lua(output(proxy))] - direction: bevy::math::prelude::Dir3A, - max: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::bounding::AabbCast3d", - functions[r#" -/// Construct an [`AabbCast3d`] from an [`Aabb3d`], [`Ray3d`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn from_ray( - #[proxy] - aabb: bevy::math::bounding::Aabb3d, - #[proxy] - ray: bevy::math::Ray3d, - max: f32, - ) -> bevy::math::bounding::AabbCast3d; - -"#, - r#" -/// Get the distance at which the [`Aabb3d`]s collide, if at all. - - #[lua(kind = "Method")] - fn aabb_collision_at( - &self, - #[proxy] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct AabbCast3d { - #[lua(output(proxy))] - ray: bevy::math::bounding::RayCast3d, - #[lua(output(proxy))] - aabb: bevy::math::bounding::Aabb3d, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::bounding::BoundingSphereCast", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::bounding::BoundingSphereCast; - -"#, - r#" -/// Construct a [`BoundingSphereCast`] from a [`BoundingSphere`], [`Ray3d`], and max distance. - - #[lua(kind = "Function", output(proxy))] - fn from_ray( - #[proxy] - sphere: bevy::math::bounding::BoundingSphere, - #[proxy] - ray: bevy::math::Ray3d, - max: f32, - ) -> bevy::math::bounding::BoundingSphereCast; - -"#, - r#" -/// Get the distance at which the [`BoundingSphere`]s collide, if at all. - - #[lua(kind = "Method")] - fn sphere_collision_at( - &self, - #[proxy] - sphere: bevy::math::bounding::BoundingSphere, - ) -> std::option::Option; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BoundingSphereCast { - #[lua(output(proxy))] - ray: bevy::math::bounding::RayCast3d, - #[lua(output(proxy))] - sphere: bevy::math::bounding::BoundingSphere, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::curve::interval::Interval", - functions[r#" -/// Get the start of this interval. - - #[lua(kind = "Method")] - fn start(self) -> f32; - -"#, - r#" -/// Get the end of this interval. - - #[lua(kind = "Method")] - fn end(self) -> f32; - -"#, - r#" -/// Get the length of this interval. Note that the result may be infinite (`f32::INFINITY`). - - #[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(kind = "Method")] - fn is_bounded(self) -> bool; - -"#, - r#" -/// Returns `true` if this interval has a finite start. - - #[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::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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Interval {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::FloatOrd", - functions[r#" - - #[lua(as_trait = "std::cmp::PartialOrd", kind = "Method")] - fn lt(&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; - -"#, - r#" - - #[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 ge(&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#" - - #[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::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::FloatOrd; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct FloatOrd(f32); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Plane3d", - functions[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. - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - normal: bevy::math::prelude::Vec3, - #[proxy] - half_size: bevy::math::prelude::Vec2, - ) -> bevy::math::primitives::Plane3d; - -"#, - r#" - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Plane3d { - #[lua(output(proxy))] - normal: bevy::math::prelude::Dir3, - #[lua(output(proxy))] - half_size: bevy::math::prelude::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::primitives::Tetrahedron", - functions[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))] - fn new( - #[proxy] - a: bevy::math::prelude::Vec3, - #[proxy] - b: bevy::math::prelude::Vec3, - #[proxy] - c: bevy::math::prelude::Vec3, - #[proxy] - d: bevy::math::prelude::Vec3, - ) -> bevy::math::primitives::Tetrahedron; - -"#, - r#" -/// Get the signed volume of the tetrahedron. -/// If it's negative, the normal vector of the face defined by -/// the first three points using the right-hand rule points -/// away from the fourth vertex. - - #[lua(kind = "Method")] - fn signed_volume(&self) -> f32; - -"#, - r#" -/// Get the centroid of the tetrahedron. -/// This function finds the geometric center of the tetrahedron -/// by averaging the vertices: `centroid = (a + b + c + d) / 4`. - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -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::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::math::curve::easing::EaseFunction; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &curve::easing::EaseFunction) -> bool; - -"#, - 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 { - 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( - "Isometry2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Isometry3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Ray2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Ray3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Rot2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Dir2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Dir3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Dir3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "IRect", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Rect", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "URect", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Aabb2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BoundingCircle", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaBoundingCircle, - >::new, - )?; - instances - .add_instance( - "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", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Capsule2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "CircularSector", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaCircularSector, - >::new, - )?; - instances - .add_instance( - "CircularSegment", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaCircularSegment, - >::new, - )?; - instances - .add_instance( - "Ellipse", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Plane2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Rectangle", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "RegularPolygon", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaRegularPolygon, - >::new, - )?; - instances - .add_instance( - "Rhombus", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Segment2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Triangle2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Sphere", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Cuboid", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Cylinder", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "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", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Torus", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Triangle3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "RayCast2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AabbCast2d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BoundingCircleCast", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaBoundingCircleCast, - >::new, - )?; - instances - .add_instance( - "RayCast3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "AabbCast3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BoundingSphereCast", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaBoundingSphereCast, - >::new, - )?; - instances - .add_instance( - "Plane3d", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Tetrahedron", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -pub struct BevyMathAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyMathAPIProvider { - 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( - "BevyMathAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .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< - LuaIsometry3d, - >, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaBoundingCircle, - >, - >() - .process_type::() - .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, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCapsule2d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCircularSector, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCircularSegment, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRectangle, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRegularPolygon, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaSegment2d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaTriangle2d, - >, - >() - .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, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCylinder, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaCapsule3d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaSegment3d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaTriangle3d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRayCast2d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAabbCast2d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaBoundingCircleCast, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaRayCast3d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAabbCast3d, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - 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< - LuaTetrahedron, - >, - >() - .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::(); - 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::(); - 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_reflect.rs b/crates/bevy_script_api/src/providers/bevy_reflect.rs deleted file mode 100644 index 45daa85da3..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_reflect.rs +++ /dev/null @@ -1,22578 +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)] -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 = "std::sync::atomic::AtomicBool", - functions[r#" -/// Creates a new `AtomicBool`. -/// # Examples -/// ``` -/// use std::sync::atomic::AtomicBool; -/// let atomic_true = AtomicBool::new(true); -/// let atomic_false = AtomicBool::new(false); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: bool) -> std::sync::atomic::AtomicBool; - -"#, - r#" -#[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::sync::atomic::AtomicI16; -///let atomic_forty_two = AtomicI16::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: i16) -> std::sync::atomic::AtomicI16; - -"#, - r#" -#[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::sync::atomic::AtomicI32; -///let atomic_forty_two = AtomicI32::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: i32) -> std::sync::atomic::AtomicI32; - -"#, - r#" -#[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::sync::atomic::AtomicI64; -///let atomic_forty_two = AtomicI64::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: i64) -> std::sync::atomic::AtomicI64; - -"#, - r#" -#[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::sync::atomic::AtomicI8; -///let atomic_forty_two = AtomicI8::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: i8) -> std::sync::atomic::AtomicI8; - -"#, - r#" -#[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::sync::atomic::AtomicIsize; -///let atomic_forty_two = AtomicIsize::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: isize) -> std::sync::atomic::AtomicIsize; - -"#, - r#" -#[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::sync::atomic::AtomicU16; -///let atomic_forty_two = AtomicU16::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: u16) -> std::sync::atomic::AtomicU16; - -"#, - r#" -#[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::sync::atomic::AtomicU32; -///let atomic_forty_two = AtomicU32::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: u32) -> std::sync::atomic::AtomicU32; - -"#, - r#" -#[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::sync::atomic::AtomicU64; -///let atomic_forty_two = AtomicU64::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: u64) -> std::sync::atomic::AtomicU64; - -"#, - r#" -#[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 -/// ``` -///use std::sync::atomic::AtomicU8; -///let atomic_forty_two = AtomicU8::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: u8) -> std::sync::atomic::AtomicU8; - -"#, - r#" -#[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::sync::atomic::AtomicUsize; -///let atomic_forty_two = AtomicUsize::new(42); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new(v: usize) -> std::sync::atomic::AtomicUsize; - -"#, - r#" -#[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)] -/// use std::time::Duration; -/// assert_eq!(Duration::new(0, 500_000_001).saturating_mul(2), Duration::new(1, 2)); -/// assert_eq!(Duration::new(u64::MAX - 1, 0).saturating_mul(2), Duration::MAX); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn saturating_mul(self, rhs: u32) -> bevy::utils::Duration; - -"#, - r#" -/// Returns the number of seconds contained by this `Duration` as `f64`. -/// The returned value includes the fractional (nanosecond) part of the duration. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.as_secs_f64(), 2.7); -/// ``` - - #[lua(kind = "Method")] - fn as_secs_f64(&self) -> f64; - -"#, - r#" -/// Returns the number of seconds contained by this `Duration` as `f32`. -/// The returned value includes the fractional (nanosecond) part of the duration. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.as_secs_f32(), 2.7); -/// ``` - - #[lua(kind = "Method")] - fn as_secs_f32(&self) -> f32; - -"#, - r#" -/// Creates a new `Duration` from the specified number of seconds represented -/// as `f64`. -/// # Panics -/// This constructor will panic if `secs` is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let res = Duration::from_secs_f64(0.0); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f64(1e-20); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f64(4.2e-7); -/// assert_eq!(res, Duration::new(0, 420)); -/// let res = Duration::from_secs_f64(2.7); -/// assert_eq!(res, Duration::new(2, 700_000_000)); -/// let res = Duration::from_secs_f64(3e10); -/// assert_eq!(res, Duration::new(30_000_000_000, 0)); -/// // subnormal float -/// let res = Duration::from_secs_f64(f64::from_bits(1)); -/// assert_eq!(res, Duration::new(0, 0)); -/// // conversion uses rounding -/// let res = Duration::from_secs_f64(0.999e-9); -/// assert_eq!(res, Duration::new(0, 1)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_secs_f64(secs: f64) -> bevy::utils::Duration; - -"#, - r#" -/// Creates a new `Duration` from the specified number of seconds represented -/// as `f32`. -/// # Panics -/// This constructor will panic if `secs` is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let res = Duration::from_secs_f32(0.0); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f32(1e-20); -/// assert_eq!(res, Duration::new(0, 0)); -/// let res = Duration::from_secs_f32(4.2e-7); -/// assert_eq!(res, Duration::new(0, 420)); -/// let res = Duration::from_secs_f32(2.7); -/// assert_eq!(res, Duration::new(2, 700_000_048)); -/// let res = Duration::from_secs_f32(3e10); -/// assert_eq!(res, Duration::new(30_000_001_024, 0)); -/// // subnormal float -/// let res = Duration::from_secs_f32(f32::from_bits(1)); -/// assert_eq!(res, Duration::new(0, 0)); -/// // conversion uses rounding -/// let res = Duration::from_secs_f32(0.999e-9); -/// assert_eq!(res, Duration::new(0, 1)); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_secs_f32(secs: f32) -> bevy::utils::Duration; - -"#, - r#" -/// Multiplies `Duration` by `f64`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000)); -/// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn mul_f64(self, rhs: f64) -> bevy::utils::Duration; - -"#, - r#" -/// Multiplies `Duration` by `f32`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// 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(847_800, 0)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn mul_f32(self, rhs: f32) -> bevy::utils::Duration; - -"#, - r#" -/// Divides `Duration` by `f64`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611)); -/// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_599)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn div_f64(self, rhs: f64) -> bevy::utils::Duration; - -"#, - r#" -/// Divides `Duration` by `f32`. -/// # Panics -/// This method will panic if result is negative, overflows `Duration` or not finite. -/// # Examples -/// ``` -/// use std::time::Duration; -/// let dur = Duration::new(2, 700_000_000); -/// // note that due to rounding errors result is slightly -/// // different from 0.859_872_611 -/// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_580)); -/// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_599)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn div_f32(self, rhs: f32) -> bevy::utils::Duration; - -"#, - 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(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(kind = "Method")] - fn div_duration_f32(self, #[proxy] rhs: bevy::utils::Duration) -> f32; - -"#, - 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; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: u32) -> bevy::utils::Duration; - -"#, - 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) -> (); - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &bevy_utils::Instant) -> bool; - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::utils::Instant; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; - -"#, - 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 - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] other: bevy::utils::Instant) -> bevy::utils::Duration; - -"#, - r#" -/// Returns an instant corresponding to "now". -/// # Examples -/// ``` -/// use std::time::Instant; -/// let now = Instant::now(); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn now() -> bevy::utils::Instant; - -"#, - 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 `earlier` was later than `self`. Currently this -/// method saturates. Future versions may reintroduce the panic in some circumstances. -/// See [Monotonicity]. -/// [Monotonicity]: Instant#monotonicity -/// # Examples -/// ```no_run -/// use std::time::{Duration, Instant}; -/// use std::thread::sleep; -/// let now = Instant::now(); -/// sleep(Duration::new(1, 0)); -/// let new_now = Instant::now(); -/// println!("{:?}", new_now.duration_since(now)); -/// println!("{:?}", now.duration_since(new_now)); // 0ns -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn duration_since( - &self, - #[proxy] - earlier: bevy::utils::Instant, - ) -> bevy::utils::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. -/// # Examples -/// ```no_run -/// use std::time::{Duration, Instant}; -/// use std::thread::sleep; -/// let now = Instant::now(); -/// sleep(Duration::new(1, 0)); -/// let new_now = Instant::now(); -/// println!("{:?}", new_now.saturating_duration_since(now)); -/// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn saturating_duration_since( - &self, - #[proxy] - earlier: bevy::utils::Instant, - ) -> bevy::utils::Duration; - -"#, - r#" -/// Returns the amount of time elapsed since this instant. -/// # Panics -/// Previous Rust versions panicked when the current time was earlier than self. Currently this -/// method returns a Duration of zero in that case. Future versions may reintroduce the panic. -/// See [Monotonicity]. -/// [Monotonicity]: Instant#monotonicity -/// # Examples -/// ```no_run -/// use std::thread::sleep; -/// use std::time::{Duration, Instant}; -/// let instant = Instant::now(); -/// let three_secs = Duration::from_secs(3); -/// sleep(three_secs); -/// assert!(instant.elapsed() >= three_secs); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn elapsed(&self) -> bevy::utils::Duration; - -"#, - r#" -/// # 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. - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] other: bevy::utils::Duration) -> bevy::utils::Instant; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Instant(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "std::path::PathBuf", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &std::path::PathBuf) -> bool; - -"#, - r#" -/// Allocates an empty `PathBuf`. -/// # Examples -/// ``` -/// use std::path::PathBuf; -/// let path = PathBuf::new(); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new() -> std::path::PathBuf; - -"#, - r#" -/// Creates a new `PathBuf` with a given capacity used to create the -/// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`]. -/// # Examples -/// ``` -/// use std::path::PathBuf; -/// let mut path = PathBuf::with_capacity(10); -/// let capacity = path.capacity(); -/// // This push is done without reallocating -/// path.push(r"C:\"); -/// assert_eq!(capacity, path.capacity()); -/// ``` -/// [`with_capacity`]: OsString::with_capacity - - #[lua(kind = "Function", output(proxy))] - fn with_capacity(capacity: usize) -> std::path::PathBuf; - -"#, - r#" -/// Truncates `self` to [`self.parent`]. -/// Returns `false` and does nothing if [`self.parent`] is [`None`]. -/// Otherwise, returns `true`. -/// [`self.parent`]: Path::parent -/// # Examples -/// ``` -/// use std::path::{Path, PathBuf}; -/// let mut p = PathBuf::from("/spirited/away.rs"); -/// p.pop(); -/// assert_eq!(Path::new("/spirited"), p); -/// p.pop(); -/// assert_eq!(Path::new("/"), p); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn pop(&mut self) -> bool; - -"#, - r#" -/// Invokes [`capacity`] on the underlying instance of [`OsString`]. -/// [`capacity`]: OsString::capacity - - #[lua(kind = "Method")] - fn capacity(&self) -> usize; - -"#, - r#" -/// Invokes [`clear`] on the underlying instance of [`OsString`]. -/// [`clear`]: OsString::clear - - #[lua(kind = "MutatingMethod")] - fn clear(&mut self) -> (); - -"#, - r#" -/// Invokes [`reserve`] on the underlying instance of [`OsString`]. -/// [`reserve`]: OsString::reserve - - #[lua(kind = "MutatingMethod")] - fn reserve(&mut self, additional: usize) -> (); - -"#, - r#" -/// Invokes [`reserve_exact`] on the underlying instance of [`OsString`]. -/// [`reserve_exact`]: OsString::reserve_exact - - #[lua(kind = "MutatingMethod")] - fn reserve_exact(&mut self, additional: usize) -> (); - -"#, - r#" -/// Invokes [`shrink_to_fit`] on the underlying instance of [`OsString`]. -/// [`shrink_to_fit`]: OsString::shrink_to_fit - - #[lua(kind = "MutatingMethod")] - fn shrink_to_fit(&mut self) -> (); - -"#, - r#" -/// Invokes [`shrink_to`] on the underlying instance of [`OsString`]. -/// [`shrink_to`]: OsString::shrink_to - - #[lua(kind = "MutatingMethod")] - fn shrink_to(&mut self, min_capacity: usize) -> (); - -"#, - 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", - )] - fn clone_from(&mut self, #[proxy] source: &std::path::PathBuf) -> (); - -"#, - 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> std::ops::RangeFull; - -"#, - 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#" -#[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#" -/// 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#" -/// 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 = "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::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 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::Vec3) -> bevy::math::Vec3; - -"#, - 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#" -/// 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. -/// This should generally not be called manually unless you know what you are doing. -/// Use one of the other constructors instead such as `identity` or `from_axis_angle`. -/// `from_xyzw` is mostly used by unit tests and `serde` deserialization. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_xyzw(x: f32, y: f32, z: f32, w: f32) -> bevy::math::Quat; - -"#, - r#" -/// Creates a rotation quaternion from an array. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 4]) -> bevy::math::Quat; - -"#, - r#" -/// Creates a new rotation quaternion from a 4D vector. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_vec4(#[proxy] v: bevy::math::Vec4) -> bevy::math::Quat; - -"#, - r#" -/// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). -/// The axis must be a unit vector. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Quat; - -"#, - r#" -/// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. -/// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_scaled_axis(#[proxy] v: bevy::math::Vec3) -> bevy::math::Quat; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the x axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Quat; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Quat; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the z axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Quat; - -"#, - r#" -/// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - euler: bevy::math::EulerRot, - a: f32, - b: f32, - c: f32, - ) -> bevy::math::Quat; - -"#, - 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; - -"#, - 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 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; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the -/// plane spanned by the two vectors. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_arc( - #[proxy] - from: bevy::math::Vec3, - #[proxy] - to: bevy::math::Vec3, - ) -> bevy::math::Quat; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means -/// that the resulting quaternion will rotate `from` so that it is colinear with `to`. -/// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 -/// degrees. -/// The inputs must be unit vectors. -/// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_arc_colinear( - #[proxy] - from: bevy::math::Vec3, - #[proxy] - to: bevy::math::Vec3, - ) -> bevy::math::Quat; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is -/// around the z axis. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc_2d(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_arc_2d( - #[proxy] - from: bevy::math::Vec2, - #[proxy] - to: bevy::math::Vec2, - ) -> bevy::math::Quat; - -"#, - r#" -/// Returns the rotation axis scaled by the rotation in radians. - - #[lua(kind = "Method", output(proxy))] - fn to_scaled_axis(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the rotation angles for the given euler rotation sequence. - - #[lua(kind = "Method")] - fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f32, f32, f32); - -"#, - r#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 4]; - -"#, - r#" -/// Returns the vector part of the quaternion. - - #[lua(kind = "Method", output(proxy))] - fn xyz(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the quaternion conjugate of `self`. For a unit quaternion the -/// conjugate is also the inverse. - - #[lua(kind = "Method", output(proxy))] - fn conjugate(self) -> bevy::math::Quat; - -"#, - r#" -/// Returns the inverse of a normalized quaternion. -/// Typically quaternion inverse returns the conjugate of a normalized quaternion. -/// Because `self` is assumed to already be unit length this method *does not* normalize -/// before returning the conjugate. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(self) -> bevy::math::Quat; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. The dot product is -/// equal to the cosine of the angle between two quaternion rotations. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Quat) -> f32; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is generally faster than `length()` as it avoids a square -/// root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f32; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero. -/// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Quat; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NAN`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - r#" -/// Returns whether `self` of length `1.0` or not. -/// Uses a precision threshold of `1e-6`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" - - #[lua(kind = "Method")] - fn is_near_identity(self) -> bool; - -"#, - r#" -/// Returns the angle (in radians) for the minimal rotation -/// for transforming this quaternion into another. -/// Both quaternions must be normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - - #[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` -/// is less than or equal to `max_abs_diff`. -/// This can be used to compare if two quaternions 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::Quat, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. -/// # Panics -/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] end: bevy::math::Quat, s: f32) -> bevy::math::Quat; - -"#, - r#" -/// 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::Quat, s: f32) -> bevy::math::Quat; - -"#, - 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::Vec3) -> 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(kind = "Method", output(proxy))] - fn mul_quat(self, #[proxy] rhs: bevy::math::Quat) -> bevy::math::Quat; - -"#, - 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. - - #[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#" -/// 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#" -#[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::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32, z: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec3; - -"#, - 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::Vec3, - #[proxy] - if_false: bevy::math::Vec3, - ) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 3]) -> bevy::math::Vec3; - -"#, - r#" -/// `[x, y, z]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::Vec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec3) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::Vec3, - #[proxy] - max: bevy::math::Vec3, - ) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec3; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec3) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec3) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec3; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec3, s: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec3, d: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - 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 vectors 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::Vec3, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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; - -"#, - 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. - - #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::Vec3, - #[proxy] - b: bevy::math::Vec3, - ) -> bevy::math::Vec3; - -"#, - 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::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")] - fn angle_between(self, #[proxy] rhs: bevy::math::Vec3) -> 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::Vec3; - -"#, - 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::Vec3; - -"#, - 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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> 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#" - - #[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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(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: 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::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::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::Vec3) -> 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#" - - #[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) -} -"#, - 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 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::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", - output(proxy), - composite = "add", - metamethod = "Add", - )] - 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. - - #[lua(kind = "Function", output(proxy))] - fn new(x: i32, y: i32) -> bevy::math::IVec2; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: i32) -> bevy::math::IVec2; - -"#, - 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::BVec2, - #[proxy] - if_true: bevy::math::IVec2, - #[proxy] - if_false: bevy::math::IVec2, - ) -> bevy::math::IVec2; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i32; 2]) -> bevy::math::IVec2; - -"#, - r#" -/// `[x, y]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [i32; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: i32) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i32) -> bevy::math::IVec2; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i32) -> bevy::math::IVec2; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::IVec2) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::IVec2, - #[proxy] - max: bevy::math::IVec2, - ) -> bevy::math::IVec2; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> i32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> i32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> i32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> i32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> i32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::IVec2) -> i32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector that is equal to `self` rotated by 90 degrees. - - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::IVec2; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::IVec2) -> i32; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; - -"#, - 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 `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#" -/// Casts all elements of `self` to `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - 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::IVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::IVec2; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec2, - ) -> bevy::math::IVec2; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec2, - ) -> 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(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::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::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: i32) -> 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::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: i32) -> 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> 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: bevy::math::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#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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::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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(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: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(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#" -/// 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; - -"#, - 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::IVec3, - #[proxy] - if_false: bevy::math::IVec3, - ) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i32; 3]) -> bevy::math::IVec3; - -"#, - r#" -/// `[x, y, z]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [i32; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: i32) -> bevy::math::IVec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::IVec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i32) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i32) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i32) -> bevy::math::IVec3; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::IVec3) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::IVec3, - #[proxy] - max: bevy::math::IVec3, - ) -> bevy::math::IVec3; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> i32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> i32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> i32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> i32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> i32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::IVec3) -> i32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; - -"#, - 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 `f64`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec3(&self) -> bevy::math::DVec3; - -"#, - 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#" -/// 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - 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::IVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::IVec3; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec3, - ) -> bevy::math::IVec3; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub_unsigned( - self, - #[proxy] - 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")] -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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::IVec4) -> 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> 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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" - - #[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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - r#" - - #[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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i32) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: i32) -> bevy::math::IVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(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#" - - #[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#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [i32; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`IVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::IVec3; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i32) -> bevy::math::IVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i32) -> bevy::math::IVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i32) -> bevy::math::IVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: i32) -> bevy::math::IVec4; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::IVec4) -> i32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::IVec4, - #[proxy] - max: bevy::math::IVec4, - ) -> bevy::math::IVec4; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> i32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> i32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> i32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> i32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> i32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::IVec4) -> i32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::IVec4) -> bevy::math::IVec4; - -"#, - 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 `f64`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; - -"#, - 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#" -/// 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - 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::IVec4) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::IVec4; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec4, - ) -> bevy::math::IVec4; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::UVec4, - ) -> 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 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::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: bevy::math::I64Vec2) -> 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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec2) -> 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::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#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i64) -> 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#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: i64, y: i64) -> bevy::math::I64Vec2; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: i64) -> bevy::math::I64Vec2; - -"#, - 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::BVec2, - #[proxy] - if_true: bevy::math::I64Vec2, - #[proxy] - if_false: bevy::math::I64Vec2, - ) -> bevy::math::I64Vec2; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i64; 2]) -> bevy::math::I64Vec2; - -"#, - r#" -/// `[x, y]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [i64; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: i64) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i64) -> bevy::math::I64Vec2; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i64) -> bevy::math::I64Vec2; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::I64Vec2, - #[proxy] - max: bevy::math::I64Vec2, - ) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> i64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> i64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> i64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> i64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> i64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i64::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector that is equal to `self` rotated by 90 degrees. - - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::I64Vec2; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::I64Vec2) -> i64; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; - -"#, - 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 `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - 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::I64Vec2) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec2, - ) -> bevy::math::I64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::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#" - - #[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::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, rhs: i64) -> bevy::math::I64Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::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#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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 = "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", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: i64) -> 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::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#" - - #[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::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#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i64) -> 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::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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: i64, y: i64, z: i64) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: i64) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3, - #[proxy] - if_false: bevy::math::I64Vec3, - ) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i64; 3]) -> bevy::math::I64Vec3; - -"#, - r#" -/// `[x, y, z]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [i64; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: i64) -> bevy::math::I64Vec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::I64Vec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i64) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i64) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i64) -> bevy::math::I64Vec3; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::I64Vec3) -> i64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::I64Vec3, - #[proxy] - max: bevy::math::I64Vec3, - ) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> i64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> i64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> i64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> i64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> i64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec3) -> i64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i64::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; - -"#, - 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 `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 `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec3(&self) -> bevy::math::U64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - 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::I64Vec3) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> bevy::math::I64Vec3; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec3, - ) -> 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, #[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, rhs: i64) -> bevy::math::I64Vec4; - -"#, - 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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(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::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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: i64) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: i64) -> 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::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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, rhs: i64) -> 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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(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#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: i64, y: i64, z: i64, w: i64) -> bevy::math::I64Vec4; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: i64) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4, - #[proxy] - if_false: bevy::math::I64Vec4, - ) -> bevy::math::I64Vec4; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [i64; 4]) -> bevy::math::I64Vec4; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [i64; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`I64Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::I64Vec3; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: i64) -> bevy::math::I64Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: i64) -> bevy::math::I64Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: i64) -> bevy::math::I64Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: i64) -> bevy::math::I64Vec4; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::I64Vec4) -> i64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" -/// Component-wise clamping of values, similar to [`i64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::I64Vec4, - #[proxy] - max: bevy::math::I64Vec4, - ) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> i64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> i64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> i64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> i64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `0` if the number is zero -/// - `1` if the number is positive -/// - `-1` if the number is negative - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> i64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::I64Vec4) -> i64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// # Panics -/// This function will panic if any `rhs` element is 0 or the division results in overflow. -/// [Euclidean division]: i64::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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 `f64`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; - -"#, - 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 `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec4(&self) -> bevy::math::U64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - 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::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a vector containing the wrapping addition of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_add_unsigned(rhs.x), self.y.wrapping_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a vector containing the wrapping subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.wrapping_sub_unsigned(rhs.x), self.y.wrapping_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; - -"#, - r#" -/// In other words this computes `[self.x.saturating_add_unsigned(rhs.x), self.y.saturating_add_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; - -"#, - r#" -/// Returns a vector containing the saturating subtraction of `self` and unsigned vector `rhs`. -/// In other words this computes `[self.x.saturating_sub_unsigned(rhs.x), self.y.saturating_sub_unsigned(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_sub_unsigned( - self, - #[proxy] - rhs: bevy::math::U64Vec4, - ) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::I64Vec4) -> bevy::math::I64Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - 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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> 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#" - - #[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::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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec2) -> bool; - -"#, - 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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: &glam::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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::UVec2) -> bevy::math::UVec2; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: u32, y: u32) -> bevy::math::UVec2; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: u32) -> bevy::math::UVec2; - -"#, - 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::BVec2, - #[proxy] - if_true: bevy::math::UVec2, - #[proxy] - if_false: bevy::math::UVec2, - ) -> bevy::math::UVec2; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u32; 2]) -> bevy::math::UVec2; - -"#, - r#" -/// `[x, y]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [u32; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: u32) -> bevy::math::UVec3; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u32) -> bevy::math::UVec2; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u32) -> bevy::math::UVec2; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::UVec2) -> u32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::UVec2, - #[proxy] - max: bevy::math::UVec2, - ) -> bevy::math::UVec2; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> u32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> u32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> u32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> u32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> u32; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; - -"#, - 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 `i64`. - - #[lua(kind = "Method", output(proxy))] - fn as_i64vec2(&self) -> bevy::math::I64Vec2; - -"#, - r#" -/// Casts all elements of `self` to `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; - -"#, - 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::UVec2) -> bevy::math::UVec2; - -"#, - 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::UVec2) -> bevy::math::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), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn wrapping_mul(self, #[proxy] rhs: bevy::math::UVec2) -> bevy::math::UVec2; - -"#, - 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::UVec2) -> bevy::math::UVec2; - -"#, - 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::UVec2) -> bevy::math::UVec2; - -"#, - 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::UVec2) -> bevy::math::UVec2; - -"#, - 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::UVec2) -> bevy::math::UVec2; - -"#, - 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::UVec2) -> bevy::math::UVec2; - -"#, - 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::IVec2) -> bevy::math::UVec2; - -"#, - 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::IVec2) -> 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::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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#" - - #[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")] -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: u32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct UVec2 { - x: u32, - y: u32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::UVec3", - functions[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 = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::UVec3) -> 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; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - 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#" - - #[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::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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(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::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: bevy::math::UVec3) -> 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]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: u32) -> bevy::math::UVec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::UVec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u32) -> bevy::math::UVec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u32) -> bevy::math::UVec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u32) -> bevy::math::UVec3; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::UVec3) -> u32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::UVec3; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::UVec3, - #[proxy] - max: bevy::math::UVec3, - ) -> bevy::math::UVec3; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> u32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> u32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> u32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> u32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::UVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> u32; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; - -"#, - 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 `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 `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#" -/// 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::UVec3) -> bevy::math::UVec3; - -"#, - 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::UVec3) -> bevy::math::UVec3; - -"#, - 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::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::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, 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(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: u32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct UVec3 { - x: u32, - y: u32, - z: u32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::UVec4", - functions[r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: &glam::UVec4) -> bevy::math::UVec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u32) -> 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#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: u32, y: u32, z: u32, w: u32) -> bevy::math::UVec4; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: u32) -> bevy::math::UVec4; - -"#, - 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::UVec4, - #[proxy] - if_false: bevy::math::UVec4, - ) -> bevy::math::UVec4; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u32; 4]) -> bevy::math::UVec4; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [u32; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`UVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::UVec3; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u32) -> bevy::math::UVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u32) -> bevy::math::UVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u32) -> bevy::math::UVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: u32) -> bevy::math::UVec4; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::UVec4) -> u32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::UVec4; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::UVec4, - #[proxy] - max: bevy::math::UVec4, - ) -> bevy::math::UVec4; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> u32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> u32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> u32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> u32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::UVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> u32; - -"#, - 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 `f64`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; - -"#, - 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 `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#" -/// 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::UVec4) -> bevy::math::UVec4; - -"#, - 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::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 = "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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - 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#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::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::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: &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: 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#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: u32) -> 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::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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::UVec4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: u32) -> 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(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: u32) -> Result<(),_> { - self.val_mut(|s| Ok(s[*idx] = val))? -} -"#] -)] -struct UVec4 { - x: u32, - y: u32, - z: u32, - w: u32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::U64Vec2", - functions[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 = "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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: u64, y: u64) -> bevy::math::U64Vec2; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: u64) -> bevy::math::U64Vec2; - -"#, - 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::BVec2, - #[proxy] - if_true: bevy::math::U64Vec2, - #[proxy] - if_false: bevy::math::U64Vec2, - ) -> bevy::math::U64Vec2; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u64; 2]) -> bevy::math::U64Vec2; - -"#, - r#" -/// `[x, y]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [u64; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: u64) -> bevy::math::U64Vec3; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u64) -> bevy::math::U64Vec2; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u64) -> bevy::math::U64Vec2; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::U64Vec2) -> u64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::U64Vec2; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::U64Vec2, - #[proxy] - max: bevy::math::U64Vec2, - ) -> bevy::math::U64Vec2; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> u64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> u64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> u64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> u64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> u64; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; - -"#, - 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(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))] - fn new(x: u64, y: u64, z: u64) -> bevy::math::U64Vec3; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: u64) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3, - #[proxy] - if_false: bevy::math::U64Vec3, - ) -> bevy::math::U64Vec3; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [u64; 3]) -> bevy::math::U64Vec3; - -"#, - r#" -/// `[x, y, z]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [u64; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: u64) -> bevy::math::U64Vec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::U64Vec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u64) -> bevy::math::U64Vec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u64) -> bevy::math::U64Vec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u64) -> bevy::math::U64Vec3; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::U64Vec3) -> u64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::U64Vec3, - #[proxy] - max: bevy::math::U64Vec3, - ) -> bevy::math::U64Vec3; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> u64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> u64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> u64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> u64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::BVec3; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> u64; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; - -"#, - 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 `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#" -/// 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::I64Vec3, - ) -> bevy::math::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), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn saturating_add_signed( - self, - #[proxy] - rhs: bevy::math::I64Vec3, - ) -> bevy::math::U64Vec3; - -"#, - 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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(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#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(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#" - - #[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; - -"#, - r#" - - #[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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - 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#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - 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, #[proxy] rhs: bevy::math::U64Vec3) -> bevy::math::U64Vec3; - -"#, - 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::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, rhs: u64) -> 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::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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> 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( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - 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 = "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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] other: &glam::U64Vec4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: u64) -> 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::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#" -/// 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; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: u64) -> bevy::math::U64Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: u64) -> bevy::math::U64Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: u64) -> bevy::math::U64Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: u64) -> bevy::math::U64Vec4; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::U64Vec4) -> u64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::U64Vec4; - -"#, - r#" -/// Component-wise clamping of values, similar to [`u64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::U64Vec4, - #[proxy] - max: bevy::math::U64Vec4, - ) -> bevy::math::U64Vec4; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> u64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> u64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> u64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> u64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::U64Vec4) -> bevy::math::BVec4; - -"#, - r#" -/// Computes the squared length of `self`. - - #[lua(kind = "Method")] - fn length_squared(self) -> u64; - -"#, - 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 `f64`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; - -"#, - 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#" -/// 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::U64Vec4) -> bevy::math::U64Vec4; - -"#, - 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::I64Vec4, - ) -> bevy::math::U64Vec4; - -"#, - 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::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#" - - #[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#" - - #[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::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, 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#" -#[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: &glam::Vec2) -> bevy::math::Vec2; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - 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, #[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::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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#" - - #[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 = "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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(self, rhs: f32) -> 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#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec2; - -"#, - 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::BVec2, - #[proxy] - if_true: bevy::math::Vec2, - #[proxy] - if_false: bevy::math::Vec2, - ) -> bevy::math::Vec2; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 2]) -> bevy::math::Vec2; - -"#, - r#" -/// `[x, y]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: f32) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec2) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::Vec2, - #[proxy] - max: bevy::math::Vec2, - ) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec2; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec2) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec2) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec2; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec2, s: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec2, d: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - 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 vectors 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::Vec2, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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; - -"#, - 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. - - #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::Vec2, - #[proxy] - 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 -/// conjunction with the [`rotate()`][Self::rotate()] method, e.g. -/// `Vec2::from_angle(PI).rotate(Vec2::Y)` will create the vector `[-1, 0]` -/// and rotate [`Vec2::Y`] around it returning `-Vec2::Y`. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the angle (in radians) of this vector in the range `[-π, +π]`. -/// The input does not need to be a unit vector however it must be non-zero. - - #[lua(kind = "Method")] - fn to_angle(self) -> f32; - -"#, - r#" - - #[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. - - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::Vec2; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::Vec2) -> f32; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[lua(kind = "Method", output(proxy))] - fn rotate(self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - 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::Vec2, - max_angle: f32, - ) -> bevy::math::Vec2; - -"#, - 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#" -/// Casts all elements of `self` to `u64`. - - #[lua(kind = "Method", output(proxy))] - fn as_u64vec2(&self) -> bevy::math::U64Vec2; - -"#, - 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::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> 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::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::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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(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: 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(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 Vec2 { - x: f32, - y: f32, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Vec3A", - functions[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::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::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::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::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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: &glam::Vec3A) -> bevy::math::Vec3A; - -"#, - 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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Vec3A) -> bool; - -"#, - 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::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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, - #[proxy] - if_true: bevy::math::Vec3A, - #[proxy] - if_false: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 3]) -> bevy::math::Vec3A; - -"#, - r#" -/// `[x, y, z]` - - #[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. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::Vec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec3A; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec3A; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f32) -> bevy::math::Vec3A; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::Vec3A, - #[proxy] - max: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::BVec3A; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec3A; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec3A) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec3A; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec3A, s: f32) -> bevy::math::Vec3A; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec3A, d: f32) -> bevy::math::Vec3A; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - 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 vectors 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::Vec3A, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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; - -"#, - 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. - - #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::Vec3A, - #[proxy] - b: bevy::math::Vec3A, - ) -> bevy::math::Vec3A; - -"#, - 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::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::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")] -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::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", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, #[proxy] rhs: &glam::Vec4) -> bevy::math::Vec4; - -"#, - 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> 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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, rhs: f32) -> bevy::math::Vec4; - -"#, - 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#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Vec4) -> bool; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, rhs: f32) -> bevy::math::Vec4; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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#" - - #[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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::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::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a new vector. - - #[lua(kind = "Function", output(proxy))] - fn new(x: f32, y: f32, z: f32, w: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a vector with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: f32) -> bevy::math::Vec4; - -"#, - 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::BVec4A, - #[proxy] - if_true: bevy::math::Vec4, - #[proxy] - if_false: bevy::math::Vec4, - ) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f32; 4]) -> bevy::math::Vec4; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f32; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`Vec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. -/// To truncate to [`Vec3A`] use [`Vec3A::from()`]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::Vec3; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::Vec4) -> f32; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f32::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::Vec4, - #[proxy] - max: bevy::math::Vec4, - ) -> bevy::math::Vec4; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f32; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f32; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f32; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f32; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec4A; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f32; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f32; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f32; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::Vec4) -> f32; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::Vec4) -> f32; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f32::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::Vec4; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::Vec4, s: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::Vec4, d: f32) -> bevy::math::Vec4; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - 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 vectors 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::Vec4, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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; - -"#, - 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. - - #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::Vec4, - #[proxy] - 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`. - - #[lua(kind = "Method", output(proxy))] - fn as_dvec4(&self) -> bevy::math::DVec4; - -"#, - 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::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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - 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: &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 Vec4(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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#" -/// Creates a new vector mask. - - #[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(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec2; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[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(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 1. - - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 1. - - #[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 = "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) -} -"#] -)] -struct BVec2 { - x: bool, - y: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::BVec3", - functions[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( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BVec3 { - x: bool, - y: bool, - z: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::BVec4", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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. - - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool, w: bool) -> bevy::math::BVec4; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec4; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 4]) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a bitmask with the lowest 4 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 3. - - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 3. - - #[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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BVec4 { - x: bool, - y: bool, - z: bool, - w: bool, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DVec2", - functions[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::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::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, #[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#" - - #[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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - 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 = "std::ops::Rem", - kind = "MetaFunction", - output(proxy), - composite = "rem", - metamethod = "Mod", - )] - fn rem(self, #[proxy] rhs: bevy::math::DVec2) -> 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#" -/// 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; - -"#, - 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::BVec2, - #[proxy] - if_true: bevy::math::DVec2, - #[proxy] - if_false: bevy::math::DVec2, - ) -> bevy::math::DVec2; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 2]) -> bevy::math::DVec2; - -"#, - r#" -/// `[x, y]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 2]; - -"#, - r#" -/// Creates a 3D vector from `self` and the given `z` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, z: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Creates a 2D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DVec2) -> f64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::DVec2, - #[proxy] - max: bevy::math::DVec2, - ) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::BVec2; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a bitmask with the lowest 2 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec2; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f64; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::DVec2) -> f64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::DVec2) -> f64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f64::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::DVec2, - ) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::DVec2, - ) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::DVec2; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::DVec2, s: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::DVec2, d: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - 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 vectors 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::DVec2, max_abs_diff: f64) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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; - -"#, - 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. - - #[lua(kind = "Method", output(proxy))] - 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#" -/// Creates a 2D vector containing `[angle.cos(), angle.sin()]`. This can be used in -/// conjunction with the [`rotate()`][Self::rotate()] method, e.g. -/// `DVec2::from_angle(PI).rotate(DVec2::Y)` will create the vector `[-1, 0]` -/// and rotate [`DVec2::Y`] around it returning `-DVec2::Y`. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the angle (in radians) of this vector in the range `[-π, +π]`. -/// The input does not need to be a unit vector however it must be non-zero. - - #[lua(kind = "Method")] - fn to_angle(self) -> f64; - -"#, - r#" - - #[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. - - #[lua(kind = "Method", output(proxy))] - fn perp(self) -> bevy::math::DVec2; - -"#, - r#" -/// The perpendicular dot product of `self` and `rhs`. -/// Also known as the wedge product, 2D cross product, and determinant. - - #[lua(kind = "Method")] - fn perp_dot(self, #[proxy] rhs: bevy::math::DVec2) -> f64; - -"#, - r#" -/// Returns `rhs` rotated by the angle of `self`. If `self` is normalized, -/// then this just rotation. This is what you usually want. Otherwise, -/// it will be like a rotation with a multiplication by `self`'s length. - - #[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`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec2(&self) -> bevy::math::Vec2; - -"#, - 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#" -/// Casts all elements of `self` to `u64`. - - #[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#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(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: &glam::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#" - - #[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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: &glam::DVec2) -> bevy::math::DVec2; - -"#, - 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 DVec2 { - x: f64, - y: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DVec3", - functions[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, rhs: f64) -> 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::DVec3; - -"#, - 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::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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(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, rhs: f64) -> 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( - 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 = "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::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(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; - -"#, - 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#" -/// `[x, y, z]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 3]; - -"#, - r#" -/// Creates a 4D vector from `self` and the given `w` value. - - #[lua(kind = "Method", output(proxy))] - fn extend(self, w: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Creates a 2D vector from the `x` and `y` elements of `self`, discarding `z`. -/// Truncation may also be performed by using [`self.xy()`][crate::swizzles::Vec3Swizzles::xy()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::DVec2; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Creates a 3D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DVec3) -> f64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Computes the cross product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn cross(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::DVec3, - #[proxy] - max: bevy::math::DVec3, - ) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::BVec3; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a bitmask with the lowest 3 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec3; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f64; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::DVec3) -> f64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::DVec3) -> f64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f64::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::DVec3, - ) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::DVec3, - ) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::DVec3; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::DVec3, s: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::DVec3, d: f64) -> bevy::math::DVec3; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - 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 vectors 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::DVec3, max_abs_diff: f64) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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; - -"#, - 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. - - #[lua(kind = "Method", output(proxy))] - fn mul_add( - self, - #[proxy] - a: bevy::math::DVec3, - #[proxy] - b: bevy::math::DVec3, - ) -> bevy::math::DVec3; - -"#, - 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::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")] - fn angle_between(self, #[proxy] rhs: bevy::math::DVec3) -> f64; - -"#, - 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::DVec3; - -"#, - 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::DVec3; - -"#, - r#" -/// Casts all elements of `self` to `f32`. - - #[lua(kind = "Method", output(proxy))] - fn as_vec3(&self) -> bevy::math::Vec3; - -"#, - 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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(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::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( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - 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))] - 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; - -"#, - 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::DVec4, - #[proxy] - if_false: bevy::math::DVec4, - ) -> bevy::math::DVec4; - -"#, - r#" -/// Creates a new vector from an array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 4]) -> bevy::math::DVec4; - -"#, - r#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 4]; - -"#, - r#" -/// Creates a 3D vector from the `x`, `y` and `z` elements of `self`, discarding `w`. -/// Truncation to [`DVec3`] may also be performed by using [`self.xyz()`][crate::swizzles::Vec4Swizzles::xyz()]. - - #[lua(kind = "Method", output(proxy))] - fn truncate(self) -> bevy::math::DVec3; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `x`. - - #[lua(kind = "Method", output(proxy))] - fn with_x(self, x: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `y`. - - #[lua(kind = "Method", output(proxy))] - fn with_y(self, y: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `z`. - - #[lua(kind = "Method", output(proxy))] - fn with_z(self, z: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Creates a 4D vector from `self` with the given value of `w`. - - #[lua(kind = "Method", output(proxy))] - fn with_w(self, w: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DVec4) -> f64; - -"#, - r#" -/// Returns a vector where every component is the dot product of `self` and `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn dot_into_vec(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the minimum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.min(rhs.x), self.y.min(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn min(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the maximum values for each element of `self` and `rhs`. -/// In other words this computes `[self.x.max(rhs.x), self.y.max(rhs.y), ..]`. - - #[lua(kind = "Method", output(proxy))] - fn max(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Component-wise clamping of values, similar to [`f64::clamp`]. -/// Each element in `min` must be less-or-equal to the corresponding element in `max`. -/// # Panics -/// Will panic if `min` is greater than `max` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn clamp( - self, - #[proxy] - min: bevy::math::DVec4, - #[proxy] - max: bevy::math::DVec4, - ) -> bevy::math::DVec4; - -"#, - r#" -/// Returns the horizontal minimum of `self`. -/// In other words this computes `min(x, y, ..)`. - - #[lua(kind = "Method")] - fn min_element(self) -> f64; - -"#, - r#" -/// Returns the horizontal maximum of `self`. -/// In other words this computes `max(x, y, ..)`. - - #[lua(kind = "Method")] - fn max_element(self) -> f64; - -"#, - r#" -/// Returns the sum of all elements of `self`. -/// In other words, this computes `self.x + self.y + ..`. - - #[lua(kind = "Method")] - fn element_sum(self) -> f64; - -"#, - r#" -/// Returns the product of all elements of `self`. -/// In other words, this computes `self.x * self.y * ..`. - - #[lua(kind = "Method")] - fn element_product(self) -> f64; - -"#, - r#" -/// Returns a vector mask containing the result of a `==` comparison for each element of -/// `self` and `rhs`. -/// In other words, this computes `[self.x == rhs.x, self.y == rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpeq(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `!=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x != rhs.x, self.y != rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpne(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x >= rhs.x, self.y >= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpge(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `>` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x > rhs.x, self.y > rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmpgt(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<=` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x <= rhs.x, self.y <= rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmple(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector mask containing the result of a `<` comparison for each element of -/// `self` and `rhs`. -/// In other words this computes `[self.x < rhs.x, self.y < rhs.y, ..]` for all -/// elements. - - #[lua(kind = "Method", output(proxy))] - fn cmplt(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::BVec4; - -"#, - r#" -/// Returns a vector containing the absolute value of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn abs(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector with elements representing the sign of `self`. -/// - `1.0` if the number is positive, `+0.0` or `INFINITY` -/// - `-1.0` if the number is negative, `-0.0` or `NEG_INFINITY` -/// - `NAN` if the number is `NAN` - - #[lua(kind = "Method", output(proxy))] - fn signum(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector with signs of `rhs` and the magnitudes of `self`. - - #[lua(kind = "Method", output(proxy))] - fn copysign(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a bitmask with the lowest 4 bits set to the sign bits from the elements of `self`. -/// A negative element results in a `1` bit and a positive element in a `0` bit. Element `x` goes -/// into the first lowest bit, element `y` into the second, etc. - - #[lua(kind = "Method")] - fn is_negative_bitmask(self) -> u32; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. If any element is either -/// `NaN`, positive or negative infinity, this will return `false`. - - #[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`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - 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(), ...]`. - - #[lua(kind = "Method", output(proxy))] - fn is_nan_mask(self) -> bevy::math::BVec4; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is faster than `length()` as it avoids a square root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f64; - -"#, - r#" -/// Computes the Euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance(self, #[proxy] rhs: bevy::math::DVec4) -> f64; - -"#, - r#" -/// Compute the squared euclidean distance between two points in space. - - #[lua(kind = "Method")] - fn distance_squared(self, #[proxy] rhs: bevy::math::DVec4) -> f64; - -"#, - r#" -/// Returns the element-wise quotient of [Euclidean division] of `self` by `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn div_euclid(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns the element-wise remainder of [Euclidean division] of `self` by `rhs`. -/// [Euclidean division]: f64::rem_euclid - - #[lua(kind = "Method", output(proxy))] - fn rem_euclid(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// 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 the resulting normalized vector is not finite when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns a -/// fallback value. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be the fallback value. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or(self, #[proxy] fallback: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns `self` normalized to length 1.0 if possible, else returns zero. -/// In particular, if the input is zero (or very close to zero), or non-finite, -/// the result of this operation will be zero. -/// See also [`Self::try_normalize()`]. - - #[lua(kind = "Method", output(proxy))] - fn normalize_or_zero(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns whether `self` is length `1.0` or not. -/// Uses a precision threshold of approximately `1e-4`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be of non-zero length. -/// # Panics -/// Will panic if `rhs` has a length of zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Returns the vector projection of `self` onto `rhs`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn project_onto_normalized( - self, - #[proxy] - rhs: bevy::math::DVec4, - ) -> bevy::math::DVec4; - -"#, - r#" -/// Returns the vector rejection of `self` from `rhs`. -/// The vector rejection is the vector perpendicular to the projection of `self` onto -/// `rhs`, in rhs words the result of `self - self.project_onto(rhs)`. -/// `rhs` must be normalized. -/// # Panics -/// Will panic if `rhs` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn reject_from_normalized( - self, - #[proxy] - rhs: bevy::math::DVec4, - ) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the nearest integer to a number for each element of `self`. -/// Round half-way cases away from 0.0. - - #[lua(kind = "Method", output(proxy))] - fn round(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the largest integer less than or equal to a number for each -/// element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn floor(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the smallest integer greater than or equal to a number for -/// each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn ceil(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the integer part each element of `self`. This means numbers are -/// always truncated towards zero. - - #[lua(kind = "Method", output(proxy))] - fn trunc(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.trunc()`. -/// Note that this differs from the GLSL implementation of `fract` which returns -/// `self - self.floor()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the fractional part of the vector as `self - self.floor()`. -/// Note that this differs from the Rust implementation of `fract` which returns -/// `self - self.trunc()`. -/// Note that this is fast but not precise for large numbers. - - #[lua(kind = "Method", output(proxy))] - fn fract_gl(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing `e^self` (the exponential function) for each element of -/// `self`. - - #[lua(kind = "Method", output(proxy))] - fn exp(self) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing each element of `self` raised to the power of `n`. - - #[lua(kind = "Method", output(proxy))] - fn powf(self, n: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Returns a vector containing the reciprocal `1.0/n` of each element of `self`. - - #[lua(kind = "Method", output(proxy))] - fn recip(self) -> bevy::math::DVec4; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. When `s` is outside of range `[0, 1]`, the result is linearly -/// extrapolated. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] rhs: bevy::math::DVec4, s: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Moves towards `rhs` based on the value `d`. -/// When `d` is `0.0`, the result will be equal to `self`. When `d` is equal to -/// `self.distance(rhs)`, the result will be equal to `rhs`. Will not go past `rhs`. - - #[lua(kind = "Method", output(proxy))] - fn move_towards(&self, #[proxy] rhs: bevy::math::DVec4, d: f64) -> bevy::math::DVec4; - -"#, - r#" -/// Calculates the midpoint between `self` and `rhs`. -/// The midpoint is the average of, or halfway point between, two vectors. -/// `a.midpoint(b)` should yield the same result as `a.lerp(b, 0.5)` -/// while being slightly cheaper to compute. - - #[lua(kind = "Method", output(proxy))] - fn midpoint(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - 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 vectors 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::DVec4, max_abs_diff: f64) -> bool; - -"#, - r#" -/// Returns a vector with a length no less than `min` and no more than `max`. -/// # Panics -/// 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`. -/// # 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`. -/// # 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. - - #[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, 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#" - - #[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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DVec4) -> 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#" - - #[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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> bevy::math::DVec4; - -"#, - 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 DVec4 { - x: f64, - y: f64, - z: f64, - w: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Mat2", - functions[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( - 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#" -/// 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). - - #[lua(kind = "Function", output(proxy))] - fn from_scale_angle( - #[proxy] - scale: bevy::math::Vec2, - angle: f32, - ) -> bevy::math::Mat2; - -"#, - r#" -/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Mat2; - -"#, - r#" -/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - - #[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. - - #[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`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec2; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec2; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat2; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat2; - -"#, - r#" -/// Transforms a 2D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Multiplies two 2x2 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; - -"#, - r#" -/// Adds two 2x2 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; - -"#, - r#" -/// Subtracts two 2x2 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat2(&self, #[proxy] rhs: &glam::Mat2) -> bevy::math::Mat2; - -"#, - r#" -/// Multiplies a 2x2 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat2; - -"#, - r#" -/// Divides a 2x2 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat2; - -"#, - 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/). - - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat2, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat2; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_dmat2(&self) -> bevy::math::DMat2; - -"#, - 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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> 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::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::Mat2) -> bool; - -"#, - 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::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec2::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct Mat2(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::Mat3", - functions[r#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - 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#" - - #[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::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 = "add", - metamethod = "Add", - )] - fn add(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))] - fn from_cols( - #[proxy] - x_axis: bevy::math::Vec3, - #[proxy] - y_axis: bevy::math::Vec3, - #[proxy] - z_axis: bevy::math::Vec3, - ) -> bevy::math::Mat3; - -"#, - r#" -/// Creates a `[f32; 9]` 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; 9]; - -"#, - r#" -/// Creates a `[[f32; 3]; 3]` 3D 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; 3]; 3]; - -"#, - r#" -/// Creates a 3x3 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::Vec3) -> bevy::math::Mat3; - -"#, - r#" -/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - - #[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. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat3; - -"#, - r#" -/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in -/// radians). -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat3; - -"#, - r#" -/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in -/// radians). - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - order: bevy::math::EulerRot, - a: f32, - b: f32, - 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. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Mat3; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Mat3; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Mat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Mat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D rotation `angle` (in -/// radians). -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Mat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in -/// radians) and `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::Vec2, - angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Mat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Mat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2x2 matrix. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] m: bevy::math::Mat2) -> bevy::math::Mat3; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec3; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec3; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat3; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat3; - -"#, - r#" -/// Transforms the given 2D vector as a point. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Rotates the given 2D vector. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Transforms a 3D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Transforms a [`Vec3A`]. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Multiplies two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; - -"#, - r#" -/// Adds two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; - -"#, - r#" -/// Subtracts two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat3(&self, #[proxy] rhs: &glam::Mat3) -> bevy::math::Mat3; - -"#, - r#" -/// Multiplies a 3x3 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat3; - -"#, - r#" -/// Divides a 3x3 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat3; - -"#, - 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/). - - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat3, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat3; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_dmat3(&self) -> 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::Affine2) -> 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#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&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::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::Mat3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec3::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct Mat3 { - #[lua(output(proxy))] - x_axis: bevy::math::Vec3, - #[lua(output(proxy))] - y_axis: bevy::math::Vec3, - #[lua(output(proxy))] - z_axis: bevy::math::Vec3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn from_cols( - #[proxy] - x_axis: bevy::math::Vec3A, - #[proxy] - y_axis: bevy::math::Vec3A, - #[proxy] - z_axis: bevy::math::Vec3A, - ) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a `[f32; 9]` 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; 9]; - -"#, - r#" -/// Creates a `[[f32; 3]; 3]` 3D 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; 3]; 3]; - -"#, - r#" -/// Creates a 3x3 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::Vec3) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - - #[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. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in -/// radians). -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in -/// radians). - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - order: bevy::math::EulerRot, - a: f32, - b: f32, - 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. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D rotation `angle` (in -/// radians). -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in -/// radians) and `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::Vec2, - angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Mat3A; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2x2 matrix. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] m: bevy::math::Mat2) -> bevy::math::Mat3A; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat3A; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat3A; - -"#, - r#" -/// Transforms the given 2D vector as a point. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Rotates the given 2D vector. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Transforms a 3D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Transforms a [`Vec3A`]. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Multiplies two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; - -"#, - r#" -/// Adds two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; - -"#, - r#" -/// Subtracts two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat3(&self, #[proxy] rhs: &glam::Mat3A) -> bevy::math::Mat3A; - -"#, - r#" -/// Multiplies a 3x3 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat3A; - -"#, - r#" -/// Divides a 3x3 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::Mat3A; - -"#, - 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/). - - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat3A, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat3A; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_dmat3(&self) -> bevy::math::DMat3; - -"#, - r#" - - #[lua( - as_trait = "std::ops::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> 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#" - - #[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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec3A::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct Mat3A { - #[lua(output(proxy))] - x_axis: bevy::math::Vec3A, - #[lua(output(proxy))] - y_axis: bevy::math::Vec3A, - #[lua(output(proxy))] - z_axis: bevy::math::Vec3A, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f32) -> 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::Mat4) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a 4x4 matrix from four column vectors. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::Vec4, - #[proxy] - y_axis: bevy::math::Vec4, - #[proxy] - z_axis: bevy::math::Vec4, - #[proxy] - w_axis: bevy::math::Vec4, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a `[f32; 16]` 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; 16]; - -"#, - r#" -/// Creates a `[[f32; 4]; 4]` 4D 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; 4]; 4]; - -"#, - r#" -/// Creates a 4x4 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::Vec4) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `scale`, `rotation` and -/// `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_translation( - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given `rotation` quaternion. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3x3 linear transformation -/// matrix. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3x3 linear transformation -/// matrix. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec3) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle(#[proxy] axis: bevy::math::Vec3, angle: f32) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a affine transformation matrix containing a rotation from the given euler -/// rotation sequence and angles (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - order: bevy::math::EulerRot, - a: f32, - b: f32, - 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 -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the y axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the z axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Mat4; - -"#, - r#" -/// Creates an affine transformation matrix containing the given 3D non-uniform `scale`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec3) -> bevy::math::Mat4; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::Vec4; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::Vec4; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::Mat4; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f32; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Mat4; - -"#, - r#" -/// 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 - - #[lua(kind = "Function", output(proxy))] - fn perspective_rh_gl( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - z_far: f32, - ) -> bevy::math::Mat4; - -"#, - 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. - - #[lua(kind = "Function", output(proxy))] - fn perspective_lh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - z_far: f32, - ) -> bevy::math::Mat4; - -"#, - 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. - - #[lua(kind = "Function", output(proxy))] - fn perspective_rh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - z_far: f32, - ) -> bevy::math::Mat4; - -"#, - 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` or `z_far` are less than or equal to zero when `glam_assert` is -/// enabled. - - #[lua(kind = "Function", output(proxy))] - fn perspective_infinite_lh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> bevy::math::Mat4; - -"#, - r#" -/// 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. - - #[lua(kind = "Function", output(proxy))] - fn perspective_infinite_reverse_lh( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> bevy::math::Mat4; - -"#, - r#" -/// 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( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> bevy::math::Mat4; - -"#, - r#" -/// 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( - fov_y_radians: f32, - aspect_ratio: f32, - z_near: f32, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Creates a right-handed orthographic projection matrix with `[-1,1]` depth -/// 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( - left: f32, - right: f32, - bottom: f32, - top: f32, - near: f32, - far: f32, - ) -> bevy::math::Mat4; - -"#, - 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( - left: f32, - right: f32, - bottom: f32, - top: f32, - near: f32, - far: f32, - ) -> bevy::math::Mat4; - -"#, - 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( - left: f32, - right: f32, - bottom: f32, - top: f32, - near: f32, - far: f32, - ) -> bevy::math::Mat4; - -"#, - r#" -/// Transforms the given 3D vector as a point, applying perspective correction. -/// This is the equivalent of multiplying the 3D vector 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_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Transforms the given 3D vector as a point. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `1.0`. -/// This method assumes that `self` contains a valid affine transform. It does not perform -/// a perspective divide, if `self` contains a perspective transform, or if you are unsure, -/// the [`Self::project_point3()`] method should be used instead. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Transforms the give 3D vector as a direction. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `0.0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[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. -/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `1.0`. - - #[lua(kind = "Method", output(proxy))] - fn transform_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Transforms the give [`Vec3A`] as 3D vector. -/// This is the equivalent of multiplying the [`Vec3A`] as a 4D vector where `w` is `0.0`. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Transforms a 4D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec4(&self, #[proxy] rhs: bevy::math::Vec4) -> bevy::math::Vec4; - -"#, - r#" -/// Multiplies two 4x4 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; - -"#, - r#" -/// Adds two 4x4 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; - -"#, - r#" -/// Subtracts two 4x4 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat4(&self, #[proxy] rhs: &glam::Mat4) -> bevy::math::Mat4; - -"#, - r#" -/// Multiplies a 4x4 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f32) -> bevy::math::Mat4; - -"#, - r#" -/// Divides a 4x4 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f32) -> bevy::math::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/). - - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::Mat4, max_abs_diff: f32) -> bool; - -"#, - r#" -/// Takes the absolute value of each element in `self` - - #[lua(kind = "Method", output(proxy))] - fn abs(&self) -> bevy::math::Mat4; - -"#, - r#" - - #[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#" - - #[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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::Mat4; - -"#, - 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::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::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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaVec4::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct Mat4 { - #[lua(output(proxy))] - x_axis: bevy::math::Vec4, - #[lua(output(proxy))] - y_axis: bevy::math::Vec4, - #[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#" -/// Creates a 2x2 matrix from two column vectors. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::DVec2, - #[proxy] - y_axis: bevy::math::DVec2, - ) -> bevy::math::DMat2; - -"#, - r#" -/// Creates a `[f64; 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) -> [f64; 4]; - -"#, - r#" -/// Creates a `[[f64; 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) -> [[f64; 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::DVec2) -> bevy::math::DMat2; - -"#, - r#" -/// 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( - #[proxy] - scale: bevy::math::DVec2, - angle: f64, - ) -> bevy::math::DMat2; - -"#, - r#" -/// Creates a 2x2 matrix containing a rotation of `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DMat2; - -"#, - r#" -/// Creates a 2x2 matrix from a 3x3 matrix, discarding the 2nd row and column. - - #[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`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::DVec2; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 1. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::DVec2; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::DMat2; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f64; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DMat2; - -"#, - r#" -/// Transforms a 2D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Multiplies two 2x2 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; - -"#, - r#" -/// Adds two 2x2 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; - -"#, - r#" -/// Subtracts two 2x2 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat2(&self, #[proxy] rhs: &glam::DMat2) -> bevy::math::DMat2; - -"#, - r#" -/// Multiplies a 2x2 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat2; - -"#, - r#" -/// Divides a 2x2 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f64) -> bevy::math::DMat2; - -"#, - 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/). - - #[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( - 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::Div", - kind = "MetaFunction", - output(proxy), - composite = "div", - metamethod = "Div", - )] - fn div(self, rhs: f64) -> 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#" - - #[lua( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - 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#" - - #[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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaDVec2::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct DMat2 { - #[lua(output(proxy))] - x_axis: bevy::math::DVec2, - #[lua(output(proxy))] - y_axis: bevy::math::DVec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::DMat3", - functions[r#" - - #[lua( - as_trait = "std::ops::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - fn add(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( - as_trait = "std::ops::Sub", - kind = "MetaFunction", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - fn sub(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; - -"#, - r#" - - #[lua( - 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 = "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, #[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#" - - #[lua( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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::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#" -/// Creates a 3x3 matrix from three column vectors. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::DVec3, - #[proxy] - y_axis: bevy::math::DVec3, - #[proxy] - z_axis: bevy::math::DVec3, - ) -> bevy::math::DMat3; - -"#, - r#" -/// Creates a `[f64; 9]` 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) -> [f64; 9]; - -"#, - r#" -/// Creates a `[[f64; 3]; 3]` 3D 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) -> [[f64; 3]; 3]; - -"#, - r#" -/// Creates a 3x3 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::DVec3) -> bevy::math::DMat3; - -"#, - r#" -/// Creates a 3x3 matrix from a 4x4 matrix, discarding the 4th row and column. - - #[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. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DMat3; - -"#, - r#" -/// Creates a 3D rotation matrix from a normalized rotation `axis` and `angle` (in -/// radians). -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, - angle: f64, - ) -> bevy::math::DMat3; - -"#, - r#" -/// Creates a 3D rotation matrix from the given euler rotation sequence and the angles (in -/// radians). - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - order: bevy::math::EulerRot, - a: f64, - b: f64, - 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. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DMat3; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DMat3; - -"#, - r#" -/// Creates a 3D rotation matrix from `angle` (in radians) around the z axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DMat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec2) -> bevy::math::DMat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D rotation `angle` (in -/// radians). -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DMat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2D `scale`, rotation `angle` (in -/// radians) and `translation`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::DVec2, - angle: f64, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DMat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given non-uniform 2D `scale`. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec2) -> bevy::math::DMat3; - -"#, - r#" -/// Creates an affine transformation matrix from the given 2x2 matrix. -/// The resulting matrix can be used to transform 2D points and vectors. See -/// [`Self::transform_point2()`] and [`Self::transform_vector2()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] m: bevy::math::DMat2) -> bevy::math::DMat3; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 2. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::DVec3; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::DMat3; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f64; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DMat3; - -"#, - r#" -/// Transforms the given 2D vector as a point. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `1`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Rotates the given 2D vector. -/// This is the equivalent of multiplying `rhs` as a 3D vector where `z` is `0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 2nd row of `self` is not `(0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Transforms a 3D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Multiplies two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; - -"#, - r#" -/// Adds two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; - -"#, - r#" -/// Subtracts two 3x3 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat3(&self, #[proxy] rhs: &glam::DMat3) -> bevy::math::DMat3; - -"#, - r#" -/// Multiplies a 3x3 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat3; - -"#, - r#" -/// Divides a 3x3 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f64) -> bevy::math::DMat3; - -"#, - 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/). - - #[lua(kind = "Method")] - fn abs_diff_eq(&self, #[proxy] rhs: bevy::math::DMat3, 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::DMat3; - -"#, - r#" - - #[lua(kind = "Method", output(proxy))] - fn as_mat3(&self) -> bevy::math::Mat3; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaDVec3::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct DMat3 { - #[lua(output(proxy))] - x_axis: bevy::math::DVec3, - #[lua(output(proxy))] - y_axis: bevy::math::DVec3, - #[lua(output(proxy))] - z_axis: bevy::math::DVec3, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - output(proxy), - composite = "sub", - metamethod = "Sub", - )] - 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. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::DVec4, - #[proxy] - y_axis: bevy::math::DVec4, - #[proxy] - z_axis: bevy::math::DVec4, - #[proxy] - w_axis: bevy::math::DVec4, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a `[f64; 16]` 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) -> [f64; 16]; - -"#, - r#" -/// Creates a `[[f64; 4]; 4]` 4D 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) -> [[f64; 4]; 4]; - -"#, - r#" -/// Creates a 4x4 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::DVec4) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `scale`, `rotation` and -/// `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::DVec3, - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_translation( - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given `rotation` quaternion. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `rotation` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3x3 linear transformation -/// matrix. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix from the given 3D `translation`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec3) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, - angle: f64, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a affine transformation matrix containing a rotation from the given euler -/// rotation sequence and angles (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - order: bevy::math::EulerRot, - a: f64, - b: f64, - 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 -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the y axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix containing a 3D rotation around the z axis of -/// `angle` (in radians). -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DMat4; - -"#, - r#" -/// Creates an affine transformation matrix containing the given 3D non-uniform `scale`. -/// The resulting matrix can be used to transform 3D points and vectors. See -/// [`Self::transform_point3()`] and [`Self::transform_vector3()`]. -/// # Panics -/// Will panic if all elements of `scale` are zero when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec3) -> bevy::math::DMat4; - -"#, - r#" -/// Returns the matrix column for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua(kind = "Method", output(proxy))] - fn col(&self, index: usize) -> bevy::math::DVec4; - -"#, - r#" -/// Returns the matrix row for the given `index`. -/// # Panics -/// Panics if `index` is greater than 3. - - #[lua(kind = "Method", output(proxy))] - fn row(&self, index: usize) -> bevy::math::DVec4; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - r#" -/// Returns the transpose of `self`. - - #[lua(kind = "Method", output(proxy))] - fn transpose(&self) -> bevy::math::DMat4; - -"#, - r#" -/// Returns the determinant of `self`. - - #[lua(kind = "Method")] - fn determinant(&self) -> f64; - -"#, - r#" -/// Returns the inverse of `self`. -/// If the matrix is not invertible the returned matrix will be invalid. -/// # Panics -/// Will panic if the determinant of `self` is zero when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(&self) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a left-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a right-handed view matrix using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DMat4; - -"#, - r#" -/// 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 - - #[lua(kind = "Function", output(proxy))] - fn perspective_rh_gl( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - z_far: f64, - ) -> bevy::math::DMat4; - -"#, - 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. - - #[lua(kind = "Function", output(proxy))] - fn perspective_lh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - z_far: f64, - ) -> bevy::math::DMat4; - -"#, - 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. - - #[lua(kind = "Function", output(proxy))] - fn perspective_rh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - z_far: f64, - ) -> bevy::math::DMat4; - -"#, - 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` or `z_far` are less than or equal to zero when `glam_assert` is -/// enabled. - - #[lua(kind = "Function", output(proxy))] - fn perspective_infinite_lh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> bevy::math::DMat4; - -"#, - r#" -/// 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. - - #[lua(kind = "Function", output(proxy))] - fn perspective_infinite_reverse_lh( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> bevy::math::DMat4; - -"#, - r#" -/// 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( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> bevy::math::DMat4; - -"#, - r#" -/// 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( - fov_y_radians: f64, - aspect_ratio: f64, - z_near: f64, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Creates a right-handed orthographic projection matrix with `[-1,1]` depth -/// 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( - left: f64, - right: f64, - bottom: f64, - top: f64, - near: f64, - far: f64, - ) -> bevy::math::DMat4; - -"#, - 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( - left: f64, - right: f64, - bottom: f64, - top: f64, - near: f64, - far: f64, - ) -> bevy::math::DMat4; - -"#, - 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( - left: f64, - right: f64, - bottom: f64, - top: f64, - near: f64, - far: f64, - ) -> bevy::math::DMat4; - -"#, - r#" -/// Transforms the given 3D vector as a point, applying perspective correction. -/// This is the equivalent of multiplying the 3D vector 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_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Transforms the given 3D vector as a point. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `1.0`. -/// This method assumes that `self` contains a valid affine transform. It does not perform -/// a perspective divide, if `self` contains a perspective transform, or if you are unsure, -/// the [`Self::project_point3()`] method should be used instead. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Transforms the give 3D vector as a direction. -/// This is the equivalent of multiplying the 3D vector as a 4D vector where `w` is -/// `0.0`. -/// This method assumes that `self` contains a valid affine transform. -/// # Panics -/// Will panic if the 3rd row of `self` is not `(0, 0, 0, 1)` when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Transforms a 4D vector. - - #[lua(kind = "Method", output(proxy))] - fn mul_vec4(&self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -/// Multiplies two 4x4 matrices. - - #[lua(kind = "Method", output(proxy))] - fn mul_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; - -"#, - r#" -/// Adds two 4x4 matrices. - - #[lua(kind = "Method", output(proxy))] - fn add_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; - -"#, - r#" -/// Subtracts two 4x4 matrices. - - #[lua(kind = "Method", output(proxy))] - fn sub_mat4(&self, #[proxy] rhs: &glam::DMat4) -> bevy::math::DMat4; - -"#, - r#" -/// Multiplies a 4x4 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn mul_scalar(&self, rhs: f64) -> bevy::math::DMat4; - -"#, - r#" -/// Divides a 4x4 matrix by a scalar. - - #[lua(kind = "Method", output(proxy))] - fn div_scalar(&self, rhs: f64) -> bevy::math::DMat4; - -"#, - 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/). - - #[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 = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> bevy::math::DMat4; - -"#, - 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::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", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DVec4) -> bevy::math::DVec4; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#, - r#" -#[lua(kind = "MetaMethod", raw, metamethod="Index")] -fn index(&self, ctx : &Lua, idx: crate::lua::util::LuaIndex) -> Result { - Ok(LuaDVec4::new_ref( - self.reflect_ref(ctx.get_world()?).sub_ref(bevy_script_api::ReflectionPathElement::SubReflection{ - label:"col", - get: std::sync::Arc::new(|ref_| Err(bevy_script_api::error::ReflectionError::InsufficientProvenance{ - path: "".to_owned(), - msg: "Cannot get column of matrix with immutable reference".to_owned() - })), - get_mut: std::sync::Arc::new(move |ref_| { - if ref_.is::(){ - Ok(ref_.downcast_mut::() - .unwrap() - .col_mut(*idx)) - } else { - Err(bevy_script_api::error::ReflectionError::CannotDowncast{from: ref_.get_represented_type_info().unwrap().type_path().into(), to:"Mat3".into()}) - } - }) - }) - ) - ) -} -"#] -)] -struct DMat4 { - #[lua(output(proxy))] - x_axis: bevy::math::DVec4, - #[lua(output(proxy))] - y_axis: bevy::math::DVec4, - #[lua(output(proxy))] - z_axis: bevy::math::DVec4, - #[lua(output(proxy))] - w_axis: bevy::math::DVec4, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - 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))] - fn from_cols( - #[proxy] - x_axis: bevy::math::Vec2, - #[proxy] - y_axis: bevy::math::Vec2, - #[proxy] - z_axis: bevy::math::Vec2, - ) -> bevy::math::Affine2; - -"#, - r#" -/// Creates a `[f32; 6]` array storing data in column major order. - - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f32; 6]; - -"#, - r#" -/// Creates a `[[f32; 2]; 3]` 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]; 3]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec2) -> bevy::math::Affine2; - -"#, - r#" -/// Creates an affine transform from the given rotation `angle`. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f32) -> bevy::math::Affine2; - -"#, - r#" -/// Creates an affine transformation from the given 2D `translation`. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec2) -> bevy::math::Affine2; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) - - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] matrix2: bevy::math::Mat2) -> bevy::math::Affine2; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a -/// translation vector. -/// Equivalent to -/// `Affine2::from_translation(translation) * Affine2::from_mat2(mat2)` - - #[lua(kind = "Function", output(proxy))] - fn from_mat2_translation( - #[proxy] - matrix2: bevy::math::Mat2, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Affine2; - -"#, - r#" -/// Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `Affine2::from_translation(translation) * -/// Affine2::from_angle(angle) * Affine2::from_scale(scale)` - - #[lua(kind = "Function", output(proxy))] - fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::Vec2, - angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Affine2; - -"#, - r#" -/// Creates an affine transform from the given 2D rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `Affine2::from_translation(translation) * Affine2::from_angle(angle)` - - #[lua(kind = "Function", output(proxy))] - fn from_angle_translation( - angle: f32, - #[proxy] - translation: bevy::math::Vec2, - ) -> bevy::math::Affine2; - -"#, - r#" -/// The given `Mat3` must be an affine transform, - - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::Mat3) -> bevy::math::Affine2; - -"#, - r#" -/// The given [`Mat3A`] must be an affine transform, - - #[lua(kind = "Function", output(proxy))] - fn from_mat3a(#[proxy] m: bevy::math::Mat3A) -> bevy::math::Affine2; - -"#, - r#" -/// Transforms the given 2D point, applying shear, scale, rotation and translation. - - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Transforms the given 2D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point2()`] instead. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::Vec2) -> bevy::math::Vec2; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - 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 3x4 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::Affine2, max_abs_diff: f32) -> 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::Affine2; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Affine2 { - #[lua(output(proxy))] - matrix2: bevy::math::Mat2, - #[lua(output(proxy))] - translation: bevy::math::Vec2, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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", - output(proxy), - 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; - -"#, - r#" -/// Creates an affine transform from three column vectors. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::Vec3A, - #[proxy] - y_axis: bevy::math::Vec3A, - #[proxy] - z_axis: bevy::math::Vec3A, - #[proxy] - w_axis: bevy::math::Vec3A, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates a `[f32; 12]` array storing data in column major order. - - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f32; 12]; - -"#, - r#" -/// Creates a `[[f32; 3]; 4]` 3D 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; 3]; 4]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::Vec3) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform from the given `rotation` quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::Quat) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle( - #[proxy] - axis: bevy::math::Vec3, - angle: f32, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the x axis of -/// `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f32) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the y axis of -/// `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f32) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the z axis of -/// `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f32) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transformation from the given 3D `translation`. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::Vec3) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and -/// rotation) - - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] mat3: bevy::math::Mat3) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) -/// and a translation vector. -/// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_mat3(mat3)` - - #[lua(kind = "Function", output(proxy))] - fn from_mat3_translation( - #[proxy] - mat3: bevy::math::Mat3, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform from the given 3D `scale`, `rotation` and -/// `translation`. -/// Equivalent to `Affine3A::from_translation(translation) * -/// Affine3A::from_quat(rotation) * Affine3A::from_scale(scale)` - - #[lua(kind = "Function", output(proxy))] - fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates an affine transform from the given 3D `rotation` and `translation`. -/// Equivalent to `Affine3A::from_translation(translation) * Affine3A::from_quat(rotation)` - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_translation( - #[proxy] - rotation: bevy::math::Quat, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// The given `Mat4` must be an affine transform, -/// i.e. contain no perspective transform. - - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::Mat4) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - dir: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_lh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_rh( - #[proxy] - eye: bevy::math::Vec3, - #[proxy] - center: bevy::math::Vec3, - #[proxy] - up: bevy::math::Vec3, - ) -> bevy::math::Affine3A; - -"#, - r#" -/// Transforms the given 3D points, applying shear, scale, rotation and translation. - - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Transforms the given 3D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point3()`] instead. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::Vec3) -> bevy::math::Vec3; - -"#, - r#" -/// Transforms the given [`Vec3A`], applying shear, scale, rotation and translation. - - #[lua(kind = "Method", output(proxy))] - fn transform_point3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Transforms the given [`Vec3A`], applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point3a()`] instead. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector3a(&self, #[proxy] rhs: bevy::math::Vec3A) -> bevy::math::Vec3A; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - 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 3x4 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::Affine3A, max_abs_diff: f32) -> 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::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#" -#[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", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(self, #[proxy] rhs: bevy::math::DMat3) -> bevy::math::DMat3; - -"#, - r#" -/// Creates an affine transform from three column vectors. - - #[lua(kind = "Function", output(proxy))] - fn from_cols( - #[proxy] - x_axis: bevy::math::DVec2, - #[proxy] - y_axis: bevy::math::DVec2, - #[proxy] - z_axis: bevy::math::DVec2, - ) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates a `[f64; 6]` array storing data in column major order. - - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f64; 6]; - -"#, - r#" -/// Creates a `[[f64; 2]; 3]` 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) -> [[f64; 2]; 3]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec2) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates an affine transform from the given rotation `angle`. - - #[lua(kind = "Function", output(proxy))] - fn from_angle(angle: f64) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates an affine transformation from the given 2D `translation`. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec2) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) - - #[lua(kind = "Function", output(proxy))] - fn from_mat2(#[proxy] matrix2: bevy::math::DMat2) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates an affine transform from a 2x2 matrix (expressing scale, shear and rotation) and a -/// translation vector. -/// Equivalent to -/// `DAffine2::from_translation(translation) * DAffine2::from_mat2(mat2)` - - #[lua(kind = "Function", output(proxy))] - fn from_mat2_translation( - #[proxy] - matrix2: bevy::math::DMat2, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates an affine transform from the given 2D `scale`, rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `DAffine2::from_translation(translation) * -/// DAffine2::from_angle(angle) * DAffine2::from_scale(scale)` - - #[lua(kind = "Function", output(proxy))] - fn from_scale_angle_translation( - #[proxy] - scale: bevy::math::DVec2, - angle: f64, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DAffine2; - -"#, - r#" -/// Creates an affine transform from the given 2D rotation `angle` (in radians) and -/// `translation`. -/// Equivalent to `DAffine2::from_translation(translation) * DAffine2::from_angle(angle)` - - #[lua(kind = "Function", output(proxy))] - fn from_angle_translation( - angle: f64, - #[proxy] - translation: bevy::math::DVec2, - ) -> bevy::math::DAffine2; - -"#, - r#" -/// The given `DMat3` must be an affine transform, - - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] m: bevy::math::DMat3) -> bevy::math::DAffine2; - -"#, - r#" -/// Transforms the given 2D point, applying shear, scale, rotation and translation. - - #[lua(kind = "Method", output(proxy))] - fn transform_point2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Transforms the given 2D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point2()`] instead. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector2(&self, #[proxy] rhs: bevy::math::DVec2) -> bevy::math::DVec2; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - 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 3x4 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::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#" - - #[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(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::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))] - fn from_cols( - #[proxy] - x_axis: bevy::math::DVec3, - #[proxy] - y_axis: bevy::math::DVec3, - #[proxy] - z_axis: bevy::math::DVec3, - #[proxy] - w_axis: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates a `[f64; 12]` array storing data in column major order. - - #[lua(kind = "Method")] - fn to_cols_array(&self) -> [f64; 12]; - -"#, - r#" -/// Creates a `[[f64; 3]; 4]` 3D 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) -> [[f64; 3]; 4]; - -"#, - r#" -/// Creates an affine transform that changes scale. -/// Note that if any scale is zero the transform will be non-invertible. - - #[lua(kind = "Function", output(proxy))] - fn from_scale(#[proxy] scale: bevy::math::DVec3) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform from the given `rotation` quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_quat(#[proxy] rotation: bevy::math::DQuat) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around a normalized -/// rotation `axis` of `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, - angle: f64, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the x axis of -/// `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the y axis of -/// `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform containing a 3D rotation around the z axis of -/// `angle` (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transformation from the given 3D `translation`. - - #[lua(kind = "Function", output(proxy))] - fn from_translation(#[proxy] translation: bevy::math::DVec3) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and -/// rotation) - - #[lua(kind = "Function", output(proxy))] - fn from_mat3(#[proxy] mat3: bevy::math::DMat3) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform from a 3x3 matrix (expressing scale, shear and rotation) -/// and a translation vector. -/// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_mat3(mat3)` - - #[lua(kind = "Function", output(proxy))] - fn from_mat3_translation( - #[proxy] - mat3: bevy::math::DMat3, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform from the given 3D `scale`, `rotation` and -/// `translation`. -/// Equivalent to `DAffine3::from_translation(translation) * -/// DAffine3::from_quat(rotation) * DAffine3::from_scale(scale)` - - #[lua(kind = "Function", output(proxy))] - fn from_scale_rotation_translation( - #[proxy] - scale: bevy::math::DVec3, - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates an affine transform from the given 3D `rotation` and `translation`. -/// Equivalent to `DAffine3::from_translation(translation) * DAffine3::from_quat(rotation)` - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_translation( - #[proxy] - rotation: bevy::math::DQuat, - #[proxy] - translation: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// The given `DMat4` must be an affine transform, -/// i.e. contain no perspective transform. - - #[lua(kind = "Function", output(proxy))] - fn from_mat4(#[proxy] m: bevy::math::DMat4) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a facing -/// direction. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. - - #[lua(kind = "Function", output(proxy))] - fn look_to_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - dir: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates a left-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=forward`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_lh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Creates a right-handed view transform using a camera position, an up direction, and a focal -/// point. -/// For a view coordinate system with `+X=right`, `+Y=up` and `+Z=back`. -/// # Panics -/// Will panic if `up` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn look_at_rh( - #[proxy] - eye: bevy::math::DVec3, - #[proxy] - center: bevy::math::DVec3, - #[proxy] - up: bevy::math::DVec3, - ) -> bevy::math::DAffine3; - -"#, - r#" -/// Transforms the given 3D points, applying shear, scale, rotation and translation. - - #[lua(kind = "Method", output(proxy))] - fn transform_point3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Transforms the given 3D vector, applying shear, scale and rotation (but NOT -/// translation). -/// To also apply translation, use [`Self::transform_point3()`] instead. - - #[lua(kind = "Method", output(proxy))] - fn transform_vector3(&self, #[proxy] rhs: bevy::math::DVec3) -> bevy::math::DVec3; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return -/// `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NaN`. - - #[lua(kind = "Method")] - fn is_nan(&self) -> bool; - -"#, - 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 3x4 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::DAffine3, 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::DAffine3; - -"#, - 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::Add", - kind = "MetaFunction", - output(proxy), - composite = "add", - metamethod = "Add", - )] - 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. - - #[lua( - as_trait = "std::ops::Mul", - kind = "MetaFunction", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - fn mul(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#" -/// Creates a new rotation quaternion. -/// This should generally not be called manually unless you know what you are doing. -/// Use one of the other constructors instead such as `identity` or `from_axis_angle`. -/// `from_xyzw` is mostly used by unit tests and `serde` deserialization. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_xyzw(x: f64, y: f64, z: f64, w: f64) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a rotation quaternion from an array. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [f64; 4]) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a new rotation quaternion from a 4D vector. -/// # Preconditions -/// This function does not check if the input is normalized, it is up to the user to -/// provide normalized input or to normalized the resulting quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_vec4(#[proxy] v: bevy::math::DVec4) -> bevy::math::DQuat; - -"#, - r#" -/// Create a quaternion for a normalized rotation `axis` and `angle` (in radians). -/// The axis must be a unit vector. -/// # Panics -/// Will panic if `axis` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_axis_angle( - #[proxy] - axis: bevy::math::DVec3, - angle: f64, - ) -> bevy::math::DQuat; - -"#, - r#" -/// Create a quaternion that rotates `v.length()` radians around `v.normalize()`. -/// `from_scaled_axis(Vec3::ZERO)` results in the identity quaternion. - - #[lua(kind = "Function", output(proxy))] - fn from_scaled_axis(#[proxy] v: bevy::math::DVec3) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the x axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_x(angle: f64) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the y axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_y(angle: f64) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a quaternion from the `angle` (in radians) around the z axis. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_z(angle: f64) -> bevy::math::DQuat; - -"#, - r#" -/// Creates a quaternion from the given Euler rotation sequence and the angles (in radians). - - #[lua(kind = "Function", output(proxy))] - fn from_euler( - #[proxy] - euler: bevy::math::EulerRot, - a: f64, - b: f64, - c: f64, - ) -> bevy::math::DQuat; - -"#, - 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 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; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The rotation is in the -/// plane spanned by the two vectors. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_arc( - #[proxy] - from: bevy::math::DVec3, - #[proxy] - to: bevy::math::DVec3, - ) -> bevy::math::DQuat; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to either `to` or `-to`. This means -/// that the resulting quaternion will rotate `from` so that it is colinear with `to`. -/// The rotation is in the plane spanned by the two vectors. Will rotate at most 90 -/// degrees. -/// The inputs must be unit vectors. -/// `to.dot(from_rotation_arc_colinear(from, to) * from).abs() ≈ 1`. -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_arc_colinear( - #[proxy] - from: bevy::math::DVec3, - #[proxy] - to: bevy::math::DVec3, - ) -> bevy::math::DQuat; - -"#, - r#" -/// Gets the minimal rotation for transforming `from` to `to`. The resulting rotation is -/// around the z axis. Will rotate at most 180 degrees. -/// The inputs must be unit vectors. -/// `from_rotation_arc_2d(from, to) * from ≈ to`. -/// For near-singular cases (from≈to and from≈-to) the current implementation -/// is only accurate to about 0.001 (for `f32`). -/// # Panics -/// Will panic if `from` or `to` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation_arc_2d( - #[proxy] - from: bevy::math::DVec2, - #[proxy] - to: bevy::math::DVec2, - ) -> bevy::math::DQuat; - -"#, - r#" -/// Returns the rotation axis scaled by the rotation in radians. - - #[lua(kind = "Method", output(proxy))] - fn to_scaled_axis(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the rotation angles for the given euler rotation sequence. - - #[lua(kind = "Method")] - fn to_euler(self, #[proxy] order: bevy::math::EulerRot) -> (f64, f64, f64); - -"#, - r#" -/// `[x, y, z, w]` - - #[lua(kind = "Method")] - fn to_array(&self) -> [f64; 4]; - -"#, - r#" -/// Returns the vector part of the quaternion. - - #[lua(kind = "Method", output(proxy))] - fn xyz(self) -> bevy::math::DVec3; - -"#, - r#" -/// Returns the quaternion conjugate of `self`. For a unit quaternion the -/// conjugate is also the inverse. - - #[lua(kind = "Method", output(proxy))] - fn conjugate(self) -> bevy::math::DQuat; - -"#, - r#" -/// Returns the inverse of a normalized quaternion. -/// Typically quaternion inverse returns the conjugate of a normalized quaternion. -/// Because `self` is assumed to already be unit length this method *does not* normalize -/// before returning the conjugate. -/// # Panics -/// Will panic if `self` is not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn inverse(self) -> bevy::math::DQuat; - -"#, - r#" -/// Computes the dot product of `self` and `rhs`. The dot product is -/// equal to the cosine of the angle between two quaternion rotations. - - #[lua(kind = "Method")] - fn dot(self, #[proxy] rhs: bevy::math::DQuat) -> f64; - -"#, - r#" -/// Computes the length of `self`. - - #[lua(kind = "Method")] - fn length(self) -> f64; - -"#, - r#" -/// Computes the squared length of `self`. -/// This is generally faster than `length()` as it avoids a square -/// root operation. - - #[lua(kind = "Method")] - fn length_squared(self) -> f64; - -"#, - r#" -/// Computes `1.0 / length()`. -/// For valid results, `self` must _not_ be of length zero. - - #[lua(kind = "Method")] - fn length_recip(self) -> f64; - -"#, - r#" -/// Returns `self` normalized to length 1.0. -/// For valid results, `self` must _not_ be of length zero. -/// Panics -/// Will panic if `self` is zero length when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn normalize(self) -> bevy::math::DQuat; - -"#, - r#" -/// Returns `true` if, and only if, all elements are finite. -/// If any element is either `NaN`, positive or negative infinity, this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(self) -> bool; - -"#, - r#" -/// Returns `true` if any elements are `NAN`. - - #[lua(kind = "Method")] - fn is_nan(self) -> bool; - -"#, - r#" -/// Returns whether `self` of length `1.0` or not. -/// Uses a precision threshold of `1e-6`. - - #[lua(kind = "Method")] - fn is_normalized(self) -> bool; - -"#, - r#" - - #[lua(kind = "Method")] - fn is_near_identity(self) -> bool; - -"#, - r#" -/// Returns the angle (in radians) for the minimal rotation -/// for transforming this quaternion into another. -/// Both quaternions must be normalized. -/// # Panics -/// Will panic if `self` or `rhs` are not normalized when `glam_assert` is enabled. - - #[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` -/// is less than or equal to `max_abs_diff`. -/// This can be used to compare if two quaternions 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::DQuat, max_abs_diff: f64) -> bool; - -"#, - r#" -/// Performs a linear interpolation between `self` and `rhs` 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 `rhs`. -/// # Panics -/// Will panic if `self` or `end` are not normalized when `glam_assert` is enabled. - - #[lua(kind = "Method", output(proxy))] - fn lerp(self, #[proxy] end: bevy::math::DQuat, s: f64) -> bevy::math::DQuat; - -"#, - r#" -/// 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. -/// 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( - as_trait = "std::ops::Neg", - kind = "MetaFunction", - output(proxy), - composite = "neg", - metamethod = "Unm", - )] - fn neg(self) -> 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#" -/// 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#" -/// 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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct DQuat { - x: f64, - y: f64, - z: f64, - w: f64, -} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::EulerRot", - functions[r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::EulerRot; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct EulerRot {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::math::BVec3A", - functions[r#" -/// Creates a new vector mask. - - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool) -> bevy::math::BVec3A; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec3A; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 3]) -> bevy::math::BVec3A; - -"#, - 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 = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec3A; - -"#, - r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - fn eq(&self, #[proxy] rhs: &glam::BVec3A) -> bool; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BVec3A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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#" -/// Creates a new vector mask. - - #[lua(kind = "Function", output(proxy))] - fn new(x: bool, y: bool, z: bool, w: bool) -> bevy::math::BVec4A; - -"#, - r#" -/// Creates a vector mask with all elements set to `v`. - - #[lua(kind = "Function", output(proxy))] - fn splat(v: bool) -> bevy::math::BVec4A; - -"#, - r#" -/// Creates a new vector mask from a bool array. - - #[lua(kind = "Function", output(proxy))] - fn from_array(a: [bool; 4]) -> bevy::math::BVec4A; - -"#, - r#" -/// Returns a bitmask with the lowest 4 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 3. - - #[lua(kind = "Method")] - fn test(&self, index: usize) -> bool; - -"#, - r#" -/// Sets the element at `index`. -/// Panics if `index` is greater than 3. - - #[lua(kind = "MutatingMethod")] - fn set(&mut self, index: usize, value: bool) -> (); - -"#, - r#" - - #[lua( - as_trait = "bevy::reflect::erased_serde::__private::serde::__private::Clone", - kind = "Method", - output(proxy), - )] - fn clone(&self) -> bevy::math::BVec4A; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct BVec4A(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "smol_str::SmolStr", - functions[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 = "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(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#" -/// 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#" -/// 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(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. -/// 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()); -/// ``` - - #[lua(kind = "Method")] - fn into_bytes(self) -> [u8; 16]; - -"#, - 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]; - -"#, - r#" -/// Tests if the UUID is nil (all zeros). - - #[lua(kind = "Method")] - fn is_nil(&self) -> bool; - -"#, - r#" -/// 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 -/// ``` -/// # 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]; - -"#, - 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(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Uuid(); -#[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( - "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", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Instant", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "PathBuf", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Quat", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Vec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "IVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "IVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "IVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "I64Vec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "I64Vec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "I64Vec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "UVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "UVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "UVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "U64Vec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "U64Vec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "U64Vec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Vec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Vec3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Vec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DVec2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DVec3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DVec4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Mat2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Mat3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Mat3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Mat4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DMat2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DMat3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DMat4", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Affine2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Affine3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DAffine2", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DAffine3", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "DQuat", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BVec3A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "BVec4A", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Uuid", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -pub struct BevyReflectAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyReflectAPIProvider { - 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( - "BevyReflectAPI", - |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< - LuaDuration, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .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, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaAffine3A, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaDAffine2, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaDAffine3, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - }, - ), - ) - } - 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::(); - 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::(); - 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 deleted file mode 100644 index 715be7fd92..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_time.rs +++ /dev/null @@ -1,736 +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(clone), - remote = "bevy::time::prelude::Fixed", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Fixed; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Fixed {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::time::prelude::Real", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Real; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Real {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::time::prelude::Timer", - functions[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; - -"#, - r#" -/// Creates a new timer with a given duration. -/// See also [`Timer::from_seconds`](Timer::from_seconds). - - #[lua(kind = "Function", output(proxy))] - fn new( - #[proxy] - duration: bevy::utils::Duration, - #[proxy] - mode: bevy::time::prelude::TimerMode, - ) -> bevy::time::prelude::Timer; - -"#, - r#" -/// Creates a new timer with a given duration in seconds. -/// # Example -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn from_seconds( - duration: f32, - #[proxy] - mode: bevy::time::prelude::TimerMode, - ) -> bevy::time::prelude::Timer; - -"#, - r#" -/// Returns `true` if the timer has reached its duration. -/// For repeating timers, this method behaves identically to [`Timer::just_finished`]. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer_once = Timer::from_seconds(1.0, TimerMode::Once); -/// timer_once.tick(Duration::from_secs_f32(1.5)); -/// assert!(timer_once.finished()); -/// timer_once.tick(Duration::from_secs_f32(0.5)); -/// assert!(timer_once.finished()); -/// let mut timer_repeating = Timer::from_seconds(1.0, TimerMode::Repeating); -/// timer_repeating.tick(Duration::from_secs_f32(1.1)); -/// assert!(timer_repeating.finished()); -/// timer_repeating.tick(Duration::from_secs_f32(0.8)); -/// assert!(!timer_repeating.finished()); -/// timer_repeating.tick(Duration::from_secs_f32(0.6)); -/// assert!(timer_repeating.finished()); -/// ``` - - #[lua(kind = "Method")] - fn finished(&self) -> bool; - -"#, - r#" -/// Returns `true` only on the tick the timer reached its duration. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(1.5)); -/// assert!(timer.just_finished()); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert!(!timer.just_finished()); -/// ``` - - #[lua(kind = "Method")] - fn just_finished(&self) -> bool; - -"#, - r#" -/// Returns the time elapsed on the timer. Guaranteed to be between 0.0 and `duration`. -/// Will only equal `duration` when the timer is finished and non repeating. -/// See also [`Stopwatch::elapsed`](Stopwatch::elapsed). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.elapsed(), Duration::from_secs_f32(0.5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn elapsed(&self) -> bevy::utils::Duration; - -"#, - r#" -/// Returns the time elapsed on the timer as an `f32`. -/// See also [`Timer::elapsed`](Timer::elapsed). - - #[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. -/// See also [`Stopwatch::set`](Stopwatch::set). -/// # -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.set_elapsed(Duration::from_secs(2)); -/// assert_eq!(timer.elapsed(), Duration::from_secs(2)); -/// // the timer is not finished even if the elapsed time is greater than the duration. -/// assert!(!timer.finished()); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_elapsed(&mut self, #[proxy] time: bevy::utils::Duration) -> (); - -"#, - r#" -/// Returns the duration of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let timer = Timer::new(Duration::from_secs(1), TimerMode::Once); -/// assert_eq!(timer.duration(), Duration::from_secs(1)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn duration(&self) -> bevy::utils::Duration; - -"#, - r#" -/// Sets the duration of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.5, TimerMode::Once); -/// timer.set_duration(Duration::from_secs(1)); -/// assert_eq!(timer.duration(), Duration::from_secs(1)); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_duration(&mut self, #[proxy] duration: bevy::utils::Duration) -> (); - -"#, - r#" -/// Returns the mode of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); -/// assert_eq!(timer.mode(), TimerMode::Repeating); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn mode(&self) -> bevy::time::prelude::TimerMode; - -"#, - r#" -/// Sets the mode of the timer. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); -/// timer.set_mode(TimerMode::Once); -/// assert_eq!(timer.mode(), TimerMode::Once); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_mode(&mut self, #[proxy] mode: bevy::time::prelude::TimerMode) -> (); - -"#, - r#" -/// Pauses the Timer. Disables the ticking of the timer. -/// See also [`Stopwatch::pause`](Stopwatch::pause). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.pause(); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.elapsed_secs(), 0.0); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn pause(&mut self) -> (); - -"#, - r#" -/// Unpauses the Timer. Resumes the ticking of the timer. -/// See also [`Stopwatch::unpause()`](Stopwatch::unpause). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.pause(); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// timer.unpause(); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.elapsed_secs(), 0.5); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn unpause(&mut self) -> (); - -"#, - r#" -/// Returns `true` if the timer is paused. -/// See also [`Stopwatch::is_paused`](Stopwatch::is_paused). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// assert!(!timer.paused()); -/// timer.pause(); -/// assert!(timer.paused()); -/// timer.unpause(); -/// assert!(!timer.paused()); -/// ``` - - #[lua(kind = "Method")] - fn paused(&self) -> bool; - -"#, - r#" -/// Resets the timer. The reset doesn't affect the `paused` state of the timer. -/// See also [`Stopwatch::reset`](Stopwatch::reset). -/// Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(1.5)); -/// timer.reset(); -/// assert!(!timer.finished()); -/// assert!(!timer.just_finished()); -/// assert_eq!(timer.elapsed_secs(), 0.0); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn reset(&mut self) -> (); - -"#, - r#" -/// Returns the fraction of the timer elapsed time (goes from 0.0 to 1.0). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.fraction(), 0.25); -/// ``` - - #[lua(kind = "Method")] - fn fraction(&self) -> f32; - -"#, - r#" -/// Returns the fraction of the timer remaining time (goes from 1.0 to 0.0). -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.fraction_remaining(), 0.75); -/// ``` - - #[lua(kind = "Method")] - fn fraction_remaining(&self) -> f32; - -"#, - r#" -/// Returns the remaining time in seconds -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::cmp::Ordering; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// let result = timer.remaining_secs().total_cmp(&1.5); -/// assert_eq!(Ordering::Equal, result); -/// ``` - - #[lua(kind = "Method")] - fn remaining_secs(&self) -> f32; - -"#, - r#" -/// Returns the remaining time using Duration -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(2.0, TimerMode::Once); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.remaining(), Duration::from_secs_f32(1.5)); -/// ``` - - #[lua(kind = "Method", output(proxy))] - fn remaining(&self) -> bevy::utils::Duration; - -"#, - r#" -/// Returns the number of times a repeating timer -/// finished during the last [`tick`](Timer::tick) call. -/// For non repeating-timers, this method will only ever -/// return 0 or 1. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut timer = Timer::from_seconds(1.0, TimerMode::Repeating); -/// timer.tick(Duration::from_secs_f32(6.0)); -/// assert_eq!(timer.times_finished_this_tick(), 6); -/// timer.tick(Duration::from_secs_f32(2.0)); -/// assert_eq!(timer.times_finished_this_tick(), 2); -/// timer.tick(Duration::from_secs_f32(0.5)); -/// assert_eq!(timer.times_finished_this_tick(), 0); -/// ``` - - #[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#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Timer {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::time::prelude::TimerMode", - functions[r#" - - #[lua( - as_trait = "std::cmp::PartialEq", - kind = "MetaFunction", - composite = "eq", - metamethod = "Eq", - )] - 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#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::TimerMode; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct TimerMode {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::time::prelude::Virtual", - functions[r#" - - #[lua(as_trait = "std::clone::Clone", kind = "Method", output(proxy))] - fn clone(&self) -> bevy::time::prelude::Virtual; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Virtual {} -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - 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#" -/// Create a new unpaused `Stopwatch` with no elapsed time. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let stopwatch = Stopwatch::new(); -/// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// assert_eq!(stopwatch.is_paused(), false); -/// ``` - - #[lua(kind = "Function", output(proxy))] - fn new() -> bevy::time::Stopwatch; - -"#, - r#" -/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) -/// of the stopwatch. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.tick(Duration::from_secs(1)); -/// assert_eq!(stopwatch.elapsed(), Duration::from_secs(1)); -/// ``` -/// # See Also -/// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` value is desirable instead. -/// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. - - #[lua(kind = "Method", output(proxy))] - fn elapsed(&self) -> bevy::utils::Duration; - -"#, - r#" -/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) -/// of the stopwatch, in seconds. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.tick(Duration::from_secs(1)); -/// assert_eq!(stopwatch.elapsed_secs(), 1.0); -/// ``` -/// # See Also -/// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. -/// [`elapsed_secs_f64`](Stopwatch::elapsed_secs_f64) - if an `f64` is desirable instead. - - #[lua(kind = "Method")] - fn elapsed_secs(&self) -> f32; - -"#, - r#" -/// Returns the elapsed time since the last [`reset`](Stopwatch::reset) -/// of the stopwatch, in seconds, as f64. -/// # See Also -/// [`elapsed`](Stopwatch::elapsed) - if a `Duration` is desirable instead. -/// [`elapsed_secs`](Stopwatch::elapsed_secs) - if an `f32` is desirable instead. - - #[lua(kind = "Method")] - fn elapsed_secs_f64(&self) -> f64; - -"#, - r#" -/// Sets the elapsed time of the stopwatch. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.set_elapsed(Duration::from_secs_f32(1.0)); -/// assert_eq!(stopwatch.elapsed_secs(), 1.0); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn set_elapsed(&mut self, #[proxy] time: bevy::utils::Duration) -> (); - -"#, - r#" -/// Pauses the stopwatch. Any call to [`tick`](Stopwatch::tick) while -/// paused will not have any effect on the elapsed time. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.pause(); -/// stopwatch.tick(Duration::from_secs_f32(1.5)); -/// assert!(stopwatch.is_paused()); -/// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn pause(&mut self) -> (); - -"#, - r#" -/// Unpauses the stopwatch. Resume the effect of ticking on elapsed time. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.pause(); -/// stopwatch.tick(Duration::from_secs_f32(1.0)); -/// stopwatch.unpause(); -/// stopwatch.tick(Duration::from_secs_f32(1.0)); -/// assert!(!stopwatch.is_paused()); -/// assert_eq!(stopwatch.elapsed_secs(), 1.0); -/// ``` - - #[lua(kind = "MutatingMethod")] - fn unpause(&mut self) -> (); - -"#, - r#" -/// Returns `true` if the stopwatch is paused. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// let mut stopwatch = Stopwatch::new(); -/// assert!(!stopwatch.is_paused()); -/// stopwatch.pause(); -/// assert!(stopwatch.is_paused()); -/// stopwatch.unpause(); -/// assert!(!stopwatch.is_paused()); -/// ``` - - #[lua(kind = "Method")] - fn is_paused(&self) -> bool; - -"#, - r#" -/// Resets the stopwatch. The reset doesn't affect the paused state of the stopwatch. -/// # Examples -/// ``` -/// # use bevy_time::*; -/// use std::time::Duration; -/// let mut stopwatch = Stopwatch::new(); -/// stopwatch.tick(Duration::from_secs_f32(1.5)); -/// stopwatch.reset(); -/// assert_eq!(stopwatch.elapsed_secs(), 0.0); -/// ``` - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Stopwatch {} -#[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( - "Timer", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - instances - .add_instance( - "Stopwatch", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -pub struct BevyTimeAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyTimeAPIProvider { - 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( - "BevyTimeAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy, - >() - .process_type::() - .process_type::() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaStopwatch, - >, - >() - }, - ), - ) - } - 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::(); - } -} diff --git a/crates/bevy_script_api/src/providers/bevy_transform.rs b/crates/bevy_script_api/src/providers/bevy_transform.rs deleted file mode 100644 index 57bcb23f0c..0000000000 --- a/crates/bevy_script_api/src/providers/bevy_transform.rs +++ /dev/null @@ -1,819 +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::*; -use super::bevy_core::*; -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, -}; -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::transform::components::GlobalTransform", - functions[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] - 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#" - - #[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::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#" - - #[lua(kind = "Function", output(proxy))] - fn from_xyz(x: f32, y: f32, z: f32) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua(kind = "Function", output(proxy))] - fn from_translation( - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua(kind = "Function", output(proxy))] - fn from_rotation( - #[proxy] - rotation: bevy::math::Quat, - ) -> bevy::transform::components::GlobalTransform; - -"#, - r#" - - #[lua(kind = "Function", output(proxy))] - fn from_scale( - #[proxy] - 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`]. - - #[lua(kind = "Method", output(proxy))] - fn compute_matrix(&self) -> bevy::math::Mat4; - -"#, - r#" -/// Returns the 3d affine transformation matrix as an [`Affine3A`]. - - #[lua(kind = "Method", output(proxy))] - fn affine(&self) -> bevy::math::Affine3A; - -"#, - r#" -/// Returns the transformation as a [`Transform`]. -/// The transform is expected to be non-degenerate and without shearing, or the output -/// will be invalid. - - #[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 -/// with the `parent` [`GlobalTransform`]. -/// This is useful if you want to "reparent" an [`Entity`](bevy_ecs::entity::Entity). -/// Say you have an entity `e1` that you want to turn into a child of `e2`, -/// but you want `e1` to keep the same global transform, even after re-parenting. You would use: -/// ``` -/// # use bevy_transform::prelude::{GlobalTransform, Transform}; -/// # use bevy_ecs::prelude::{Entity, Query, Component, Commands}; -/// # use bevy_hierarchy::{prelude::Parent, BuildChildren}; -/// #[derive(Component)] -/// struct ToReparent { -/// new_parent: Entity, -/// } -/// fn reparent_system( -/// mut commands: Commands, -/// mut targets: Query<(&mut Transform, Entity, &GlobalTransform, &ToReparent)>, -/// transforms: Query<&GlobalTransform>, -/// ) { -/// for (mut transform, entity, initial, to_reparent) in targets.iter_mut() { -/// if let Ok(parent_transform) = transforms.get(to_reparent.new_parent) { -/// *transform = initial.reparented_to(parent_transform); -/// commands.entity(entity) -/// .remove::() -/// .set_parent(to_reparent.new_parent); -/// } -/// } -/// } -/// ``` -/// The transform is expected to be non-degenerate and without shearing, or the output -/// will be invalid. - - #[lua(kind = "Method", output(proxy))] - fn reparented_to( - &self, - #[proxy] - parent: &components::global_transform::GlobalTransform, - ) -> bevy::transform::components::Transform; - -"#, - r#" -///Return the local right vector (X). - - #[lua(kind = "Method", output(proxy))] - fn right(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local left vector (-X). - - #[lua(kind = "Method", output(proxy))] - fn left(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local up vector (Y). - - #[lua(kind = "Method", output(proxy))] - fn up(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local down vector (-Y). - - #[lua(kind = "Method", output(proxy))] - fn down(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local back vector (Z). - - #[lua(kind = "Method", output(proxy))] - fn back(&self) -> bevy::math::Dir3; - -"#, - r#" -///Return the local forward vector (-Z). - - #[lua(kind = "Method", output(proxy))] - fn forward(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Get the translation as a [`Vec3`]. - - #[lua(kind = "Method", output(proxy))] - fn translation(&self) -> bevy::math::Vec3; - -"#, - r#" -/// Get the translation as a [`Vec3A`]. - - #[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`. - - #[lua(kind = "Method")] - fn radius_vec3a(&self, #[proxy] extents: bevy::math::Vec3A) -> f32; - -"#, - r#" -/// 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; - -"#, - r#" -/// Multiplies `self` with `transform` component by component, returning the -/// resulting [`GlobalTransform`] - - #[lua(kind = "Method", output(proxy))] - fn mul_transform( - &self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::GlobalTransform; - -"#, - r#" -#[lua(kind="MetaMethod", metamethod="ToString")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct GlobalTransform(); -#[derive(bevy_mod_scripting_lua_derive::LuaProxy)] -#[proxy( - derive(clone), - remote = "bevy::transform::components::Transform", - functions[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. - - #[lua(kind = "Function", output(proxy))] - fn from_xyz(x: f32, y: f32, z: f32) -> bevy::transform::components::Transform; - -"#, - r#" -/// Extracts the translation, rotation, and scale from `matrix`. It must be a 3d affine -/// transformation matrix. - - #[lua(kind = "Function", output(proxy))] - fn from_matrix( - #[proxy] - world_from_local: bevy::math::Mat4, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Creates a new [`Transform`], with `translation`. Rotation will be 0 and scale 1 on -/// all axes. - - #[lua(kind = "Function", output(proxy))] - fn from_translation( - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Creates a new [`Transform`], with `rotation`. Translation will be 0 and scale 1 on -/// all axes. - - #[lua(kind = "Function", output(proxy))] - fn from_rotation( - #[proxy] - rotation: bevy::math::Quat, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Creates a new [`Transform`], with `scale`. Translation will be 0 and rotation 0 on -/// all axes. - - #[lua(kind = "Function", output(proxy))] - fn from_scale( - #[proxy] - 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. - - #[lua(kind = "Method", output(proxy))] - fn with_translation( - self, - #[proxy] - translation: bevy::math::Vec3, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Returns this [`Transform`] with a new rotation. - - #[lua(kind = "Method", output(proxy))] - fn with_rotation( - self, - #[proxy] - rotation: bevy::math::Quat, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Returns this [`Transform`] with a new scale. - - #[lua(kind = "Method", output(proxy))] - fn with_scale( - self, - #[proxy] - scale: bevy::math::Vec3, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Returns the 3d affine transformation matrix from this transforms translation, -/// rotation, and scale. - - #[lua(kind = "Method", output(proxy))] - fn compute_matrix(&self) -> bevy::math::Mat4; - -"#, - r#" -/// Returns the 3d affine transformation matrix from this transforms translation, -/// rotation, and scale. - - #[lua(kind = "Method", output(proxy))] - fn compute_affine(&self) -> bevy::math::Affine3A; - -"#, - r#" -/// Get the unit vector in the local `X` direction. - - #[lua(kind = "Method", output(proxy))] - fn local_x(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`-local_x()`][Transform::local_x()] - - #[lua(kind = "Method", output(proxy))] - fn left(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`local_x()`][Transform::local_x()] - - #[lua(kind = "Method", output(proxy))] - fn right(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Get the unit vector in the local `Y` direction. - - #[lua(kind = "Method", output(proxy))] - fn local_y(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`local_y()`][Transform::local_y] - - #[lua(kind = "Method", output(proxy))] - fn up(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`-local_y()`][Transform::local_y] - - #[lua(kind = "Method", output(proxy))] - fn down(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Get the unit vector in the local `Z` direction. - - #[lua(kind = "Method", output(proxy))] - fn local_z(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`-local_z()`][Transform::local_z] - - #[lua(kind = "Method", output(proxy))] - fn forward(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Equivalent to [`local_z()`][Transform::local_z] - - #[lua(kind = "Method", output(proxy))] - fn back(&self) -> bevy::math::Dir3; - -"#, - r#" -/// Rotates this [`Transform`] by the given rotation. -/// If this [`Transform`] has a parent, the `rotation` is relative to the rotation of the parent. -/// # Examples -/// - [`3d_rotation`] -/// [`3d_rotation`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/3d_rotation.rs - - #[lua(kind = "MutatingMethod")] - fn rotate(&mut self, #[proxy] rotation: bevy::math::Quat) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the given `axis` by `angle` (in radians). -/// If this [`Transform`] has a parent, the `axis` is relative to the rotation of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_axis(&mut self, #[proxy] axis: bevy::math::Dir3, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the `X` axis by `angle` (in radians). -/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_x(&mut self, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the `Y` axis by `angle` (in radians). -/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_y(&mut self, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around the `Z` axis by `angle` (in radians). -/// If this [`Transform`] has a parent, the axis is relative to the rotation of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_z(&mut self, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] by the given `rotation`. -/// The `rotation` is relative to this [`Transform`]'s current rotation. - - #[lua(kind = "MutatingMethod")] - fn rotate_local(&mut self, #[proxy] rotation: bevy::math::Quat) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `axis` by `angle` (in radians). - - #[lua(kind = "MutatingMethod")] - fn rotate_local_axis(&mut self, #[proxy] axis: bevy::math::Dir3, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `X` axis by `angle` (in radians). - - #[lua(kind = "MutatingMethod")] - fn rotate_local_x(&mut self, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `Y` axis by `angle` (in radians). - - #[lua(kind = "MutatingMethod")] - fn rotate_local_y(&mut self, angle: f32) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around its local `Z` axis by `angle` (in radians). - - #[lua(kind = "MutatingMethod")] - fn rotate_local_z(&mut self, angle: f32) -> (); - -"#, - r#" -/// Translates this [`Transform`] around a `point` in space. -/// If this [`Transform`] has a parent, the `point` is relative to the [`Transform`] of the parent. - - #[lua(kind = "MutatingMethod")] - fn translate_around( - &mut self, - #[proxy] - point: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - ) -> (); - -"#, - r#" -/// Rotates this [`Transform`] around a `point` in space. -/// If this [`Transform`] has a parent, the `point` is relative to the [`Transform`] of the parent. - - #[lua(kind = "MutatingMethod")] - fn rotate_around( - &mut self, - #[proxy] - point: bevy::math::Vec3, - #[proxy] - rotation: bevy::math::Quat, - ) -> (); - -"#, - r#" -/// Multiplies `self` with `transform` component by component, returning the -/// resulting [`Transform`] - - #[lua(kind = "Method", output(proxy))] - fn mul_transform( - &self, - #[proxy] - transform: bevy::transform::components::Transform, - ) -> bevy::transform::components::Transform; - -"#, - r#" -/// Transforms the given `point`, applying scale, rotation and translation. -/// 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; - -"#, - r#" -/// Returns `true` if, and only if, translation, rotation and scale all are -/// finite. If any of them contains a `NaN`, positive or negative infinity, -/// this will return `false`. - - #[lua(kind = "Method")] - fn is_finite(&self) -> bool; - -"#, - r#" -/// Get the [isometry] defined by this transform's rotation and translation, ignoring scale. -/// [isometry]: Isometry3d - - #[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::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", - output(proxy), - composite = "mul", - metamethod = "Mul", - )] - 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#" - - #[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")] -fn index(&self) -> String { - format!("{:?}", _self) -} -"#] -)] -struct Transform { - #[lua(output(proxy))] - translation: bevy::math::Vec3, - #[lua(output(proxy))] - rotation: bevy::math::Quat, - #[lua(output(proxy))] - scale: bevy::math::Vec3, -} -#[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( - "GlobalTransform", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::< - LuaGlobalTransform, - >::new, - )?; - instances - .add_instance( - "Transform", - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy::::new, - )?; - Ok(()) - } -} -pub struct BevyTransformAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for BevyTransformAPIProvider { - 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( - "BevyTransformAPI", - |tw| { - tw.document_global_instance::() - .expect("Something went wrong documenting globals") - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaGlobalTransform, - >, - >() - .process_type::() - .process_type::< - bevy_mod_scripting_lua::tealr::mlu::UserDataProxy< - LuaTransform, - >, - >() - }, - ), - ) - } - 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::(); - } -} diff --git a/crates/bevy_script_api/src/providers/mod.rs b/crates/bevy_script_api/src/providers/mod.rs deleted file mode 100644 index 1c5636d277..0000000000 --- a/crates/bevy_script_api/src/providers/mod.rs +++ /dev/null @@ -1,80 +0,0 @@ -// @generated by cargo bevy-api-gen collect, modify the templates not this file -#![allow(clippy::all)] -#![allow(unused, deprecated, dead_code)] -#![cfg_attr(rustfmt, rustfmt_skip)] -pub mod bevy_ecs; -pub mod bevy_transform; -pub mod bevy_math; -pub mod bevy_input; -pub mod bevy_core; -pub mod bevy_time; -pub mod bevy_hierarchy; -pub mod bevy_reflect; -extern crate self as bevy_script_api; -use bevy_mod_scripting_core::docs::DocFragment; -pub struct LuaBevyAPIProvider; -impl bevy_mod_scripting_core::hosts::APIProvider for LuaBevyAPIProvider { - 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> { - bevy_ecs::BevyEcsAPIProvider.attach_api(ctx)?; - bevy_transform::BevyTransformAPIProvider.attach_api(ctx)?; - bevy_math::BevyMathAPIProvider.attach_api(ctx)?; - bevy_input::BevyInputAPIProvider.attach_api(ctx)?; - bevy_core::BevyCoreAPIProvider.attach_api(ctx)?; - bevy_time::BevyTimeAPIProvider.attach_api(ctx)?; - bevy_hierarchy::BevyHierarchyAPIProvider.attach_api(ctx)?; - bevy_reflect::BevyReflectAPIProvider.attach_api(ctx)?; - Ok(()) - } - fn get_doc_fragment(&self) -> Option { - [ - bevy_ecs::BevyEcsAPIProvider.get_doc_fragment(), - bevy_transform::BevyTransformAPIProvider.get_doc_fragment(), - bevy_math::BevyMathAPIProvider.get_doc_fragment(), - bevy_input::BevyInputAPIProvider.get_doc_fragment(), - bevy_core::BevyCoreAPIProvider.get_doc_fragment(), - bevy_time::BevyTimeAPIProvider.get_doc_fragment(), - bevy_hierarchy::BevyHierarchyAPIProvider.get_doc_fragment(), - bevy_reflect::BevyReflectAPIProvider.get_doc_fragment(), - ] - .into_iter() - .filter_map(|a: Option<_>| a) - .fold( - None, - |a, b| match a { - Some(a) => Some(a.merge(b)), - None => Some(b), - }, - ) - } - 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) { - bevy_ecs::BevyEcsAPIProvider.register_with_app(app); - bevy_transform::BevyTransformAPIProvider.register_with_app(app); - bevy_math::BevyMathAPIProvider.register_with_app(app); - bevy_input::BevyInputAPIProvider.register_with_app(app); - bevy_core::BevyCoreAPIProvider.register_with_app(app); - bevy_time::BevyTimeAPIProvider.register_with_app(app); - bevy_hierarchy::BevyHierarchyAPIProvider.register_with_app(app); - bevy_reflect::BevyReflectAPIProvider.register_with_app(app); - } -} diff --git a/crates/bevy_script_api/src/rhai/bevy/mod.rs b/crates/bevy_script_api/src/rhai/bevy/mod.rs deleted file mode 100644 index 3f4ea2a8dd..0000000000 --- a/crates/bevy_script_api/src/rhai/bevy/mod.rs +++ /dev/null @@ -1,359 +0,0 @@ -use bevy::prelude::Entity; -use bevy_mod_scripting_core::{prelude::*, world::WorldPointer}; - -#[allow(deprecated)] -use bevy_mod_scripting_rhai::{ - prelude::*, - rhai::{self, CustomType, INT}, -}; -use rhai::plugin::*; - -use crate::{ - common::bevy::{ScriptQueryBuilder, ScriptTypeRegistration, ScriptWorld}, - ReflectedValue, -}; - -use super::{RegisterForeignRhaiType, ToDynamic}; - -#[allow(deprecated)] -impl CustomType for ScriptTypeRegistration { - fn build(mut builder: rhai::TypeBuilder) { - builder - .with_name("TypeRegistration") - .with_fn("short_name", |self_: &mut Self| { - ImmutableString::from(self_.short_name()) - }) - .with_fn("type_name", |self_: &mut Self| self_.type_name()) - .with_fn("to_string", |self_: &mut Self| self_.to_string()) - .with_fn("to_debug", |self_: &mut Self| format!("{:?}", self_)); - } -} - -impl CustomType for ScriptQueryBuilder { - fn build(mut builder: rhai::TypeBuilder) { - builder - .with_name("QueryBuilder") - // `with` is a reserved keyword, so we add _components on the end - .with_fn("with_components", |self_: &mut Self, with: Vec| { - self_.with( - with.into_iter() - .map(Dynamic::cast::) - .collect(), - ); - - Dynamic::from(self_.clone()) - }) - .with_fn( - "without_components", - |self_: &mut Self, without: Vec| { - self_.without( - without - .into_iter() - .map(Dynamic::cast::) - .collect(), - ); - - Dynamic::from(self_.clone()) - }, - ); - } -} - -impl IntoIterator for ScriptQueryBuilder { - type Item = rhai::Map; - type IntoIter = std::vec::IntoIter; - - fn into_iter(mut self) -> Self::IntoIter { - self.build() - .expect("Query failed!") - .into_iter() - .map(|result| { - let mut map = rhai::Map::new(); - map.insert("Entity".into(), Dynamic::from(result.0)); - - for component in result.1.into_iter() { - let name = component - .get(|value| value.get_represented_type_info()?.type_path_table().ident()) - .unwrap() - .unwrap(); - - map.insert( - name.into(), - component.to_dynamic().unwrap_or_else(|_| { - panic!("Converting component {} to dynamic failed!", &name) - }), - ); - } - - map - }) - .collect::>() - .into_iter() - } -} - -#[allow(deprecated)] -impl CustomType for ScriptWorld { - fn build(mut builder: rhai::TypeBuilder) { - builder - .with_name("World") - .with_fn("get_type_by_name", |self_: ScriptWorld, type_name: &str| { - self_ - .get_type_by_name(type_name) - .map(Dynamic::from) - .unwrap_or_default() - }) - .with_fn( - "add_default_component", - |self_: ScriptWorld, entity: Entity, type_registration: ScriptTypeRegistration| { - self_ - .add_default_component(entity, type_registration) - .map_err(|e| { - Box::new(EvalAltResult::ErrorRuntime( - Dynamic::from(e.to_string()), - Position::NONE, - )) - }) - .and_then(|ok| ok.to_dynamic()) - }, - ) - .with_fn( - "get_component", - |self_: ScriptWorld, entity: Entity, comp_type: ScriptTypeRegistration| { - let component = self_.get_component(entity, comp_type).map_err(|e| { - Box::new(EvalAltResult::ErrorRuntime( - e.to_string().into(), - Position::NONE, - )) - })?; - if let Some(c) = component { - c.to_dynamic() - } else { - Ok(Default::default()) - } - }, - ) - .with_fn( - "has_component", - |self_: ScriptWorld, entity: Entity, comp_type: ScriptTypeRegistration| { - self_.has_component(entity, comp_type).map_err(|e| { - Box::new(EvalAltResult::ErrorRuntime( - e.to_string().into(), - Position::NONE, - )) - }) - }, - ) - .with_fn( - "remove_component", - |mut self_: ScriptWorld, entity: Entity, comp_type: ScriptTypeRegistration| { - self_.remove_component(entity, comp_type).map_err(|e| { - Box::new(EvalAltResult::ErrorRuntime( - e.to_string().into(), - Position::NONE, - )) - }) - }, - ) - .with_fn( - "get_resource", - |self_: ScriptWorld, res_type: ScriptTypeRegistration| { - let resource = self_.get_resource(res_type).map_err(|err| { - Box::new(EvalAltResult::ErrorRuntime( - err.to_string().into(), - Position::NONE, - )) - })?; - - if let Some(c) = resource { - c.to_dynamic() - } else { - Ok(Default::default()) - } - }, - ) - .with_fn( - "has_resource", - |self_: &mut ScriptWorld, res_type: ScriptTypeRegistration| { - self_.has_resource(res_type).map_err(|e| { - Box::new(EvalAltResult::ErrorRuntime( - e.to_string().into(), - Position::NONE, - )) - }) - }, - ) - .with_fn( - "remove_resource", - |self_: &mut ScriptWorld, res_type: ScriptTypeRegistration| { - self_.remove_resource(res_type).map_err(|e| { - Box::new(EvalAltResult::ErrorRuntime( - e.to_string().into(), - Position::NONE, - )) - }) - }, - ) - .with_fn("get_parent", |self_: ScriptWorld, entity: Entity| { - if let Some(parent) = self_.get_parent(entity) { - Dynamic::from(parent) - } else { - Dynamic::UNIT - } - }) - .with_fn("get_children", |self_: ScriptWorld, parent: Entity| { - self_ - .get_children(parent) - .into_iter() - .map(Dynamic::from) - .collect::>() - }) - .with_fn( - "push_child", - |self_: &mut ScriptWorld, parent: Entity, child: Entity| { - self_.push_child(parent, child) - }, - ) - .with_fn( - "remove_children", - |self_: &mut ScriptWorld, parent: Entity, children: Vec| { - self_.remove_children( - parent, - &children - .into_iter() - .map(Dynamic::cast::) - .collect::>(), - ) - }, - ) - .with_fn( - "remove_child", - |self_: &mut ScriptWorld, parent: Entity, child: Entity| { - self_.remove_children(parent, &[child]) - }, - ) - .with_fn( - "insert_children", - |self_: &mut ScriptWorld, parent: Entity, index: INT, children: Vec| { - self_.insert_children( - parent, - index.try_into().expect("number too large"), - &children - .into_iter() - .map(Dynamic::cast::) - .collect::>(), - ) - }, - ) - .with_fn( - "insert_child", - |self_: &mut ScriptWorld, parent: Entity, index: INT, child: Entity| { - self_.insert_children( - parent, - index.try_into().expect("number too large"), - &[child], - ) - }, - ) - .with_fn( - "despawn_children_recursive", - |self_: &mut ScriptWorld, entity: Entity| self_.despawn_children_recursive(entity), - ) - .with_fn( - "despawn_recursive", - |self_: &mut ScriptWorld, entity: Entity| self_.despawn_recursive(entity), - ) - .with_fn("spawn", |self_: &mut ScriptWorld| { - let mut w = self_.write(); - w.spawn(()).id() - }) - .with_fn("despawn", |self_: &mut ScriptWorld, entity: Entity| { - let mut w = self_.write(); - - w.despawn(entity) - }) - .with_fn("to_string", |self_: &mut ScriptWorld| self_.to_string()) - .with_fn("to_debug", |self_: &mut ScriptWorld| format!("{:?}", self_)) - .with_fn( - "query", - |self_: &mut ScriptWorld, component: ScriptTypeRegistration| { - ScriptQueryBuilder::new(self_.clone()) - .components(vec![component]) - .clone() - }, - ) - .with_fn( - "query", - |self_: &mut ScriptWorld, components: Vec| { - ScriptQueryBuilder::new(self_.clone()) - .components( - components - .into_iter() - .map(Dynamic::cast::) - .collect::>(), - ) - .clone() - }, - ); - } -} - -pub struct RhaiBevyAPIProvider; - -impl APIProvider for RhaiBevyAPIProvider { - type APITarget = Engine; - type ScriptContext = RhaiContext; - type DocTarget = RhaiDocFragment; - - fn attach_api(&mut self, engine: &mut Self::APITarget) -> Result<(), ScriptError> { - engine.build_type::(); - engine.build_type::(); - engine.build_type::(); - engine.build_type::(); - engine.register_iterator::>(); - engine.register_iterator::(); - Ok(()) - } - - fn setup_script_runtime( - &mut self, - world_ptr: WorldPointer, - _script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - ctx.scope.set_value("world", ScriptWorld::new(world_ptr)); - Ok(()) - } - - fn setup_script( - &mut self, - script_data: &ScriptData, - ctx: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - ctx.scope.set_value("entity", script_data.entity); - Ok(()) - } - - fn get_doc_fragment(&self) -> Option { - None - } - - fn register_with_app(&self, app: &mut bevy::prelude::App) { - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - app.register_foreign_rhai_type::(); - } -} diff --git a/crates/bevy_script_api/src/rhai/mod.rs b/crates/bevy_script_api/src/rhai/mod.rs deleted file mode 100644 index 26d408841a..0000000000 --- a/crates/bevy_script_api/src/rhai/mod.rs +++ /dev/null @@ -1,194 +0,0 @@ -use ::std::borrow::Cow; - -use ::bevy::{ - prelude::{App, AppTypeRegistry}, - reflect::{FromType, GetTypeRegistration, Reflect}, -}; -#[allow(deprecated)] -use bevy_mod_scripting_rhai::rhai::{CustomType, Dynamic, EvalAltResult, INT}; - -use crate::{ReflectReference, ReflectedValue, ValueIndex}; - -pub mod bevy; -pub mod std; - -/// A trait allowing the registration of the [`RhaiProxyable`] trait with the type registry for foreign types -/// -/// If you have access to the type you should prefer to use `#[reflect(RhaiProxyable)]` instead. -/// This is exactly equivalent. -pub trait RegisterForeignRhaiType { - fn register_foreign_rhai_type( - &mut self, - ) -> &mut Self; -} - -impl RegisterForeignRhaiType for App { - fn register_foreign_rhai_type( - &mut self, - ) -> &mut Self { - { - let registry = self.world_mut().resource_mut::(); - let mut registry = registry.write(); - - let rhai_data = >::from_type(); - - if let Some(registration) = registry.get_mut(TypeId::of::()) { - registration.insert(rhai_data) - } else { - let mut registration = T::get_type_registration(); - registration.insert(rhai_data); - registry.add_registration(registration); - } - } - - self - } -} - -pub trait RhaiProxyable { - fn ref_to_rhai(self_: ReflectReference) -> Result>; - fn apply_rhai(self_: &mut ReflectReference, new_val: Dynamic) - -> Result<(), Box>; -} - -pub trait FromRhaiProxy: Sized { - fn from_rhai_proxy(self_: Dynamic) -> Result>; -} - -pub trait ToRhaiProxy { - fn to_rhai_proxy(self) -> Result>; -} - -#[derive(Clone)] -pub struct ReflectRhaiProxyable { - ref_to_rhai: fn(ref_: ReflectReference) -> Result>, - apply_rhai: fn(ref_: &mut ReflectReference, new_val: Dynamic) -> Result<(), Box>, -} - -impl ReflectRhaiProxyable { - pub fn ref_to_rhai(&self, ref_: ReflectReference) -> Result> { - (self.ref_to_rhai)(ref_) - } - - pub fn apply_rhai( - &self, - ref_: &mut ReflectReference, - new_val: Dynamic, - ) -> Result<(), Box> { - (self.apply_rhai)(ref_, new_val) - } -} - -impl FromType for ReflectRhaiProxyable { - fn from_type() -> Self { - Self { - ref_to_rhai: T::ref_to_rhai, - apply_rhai: T::apply_rhai, - } - } -} - -pub trait ToDynamic { - fn to_dynamic(self) -> Result>; -} - -impl ToDynamic for ReflectedValue { - fn to_dynamic(self) -> Result> { - Ok(Dynamic::from(self)) - } -} - -impl ToDynamic for ReflectReference { - fn to_dynamic(self) -> Result> { - // clone since it's cheap and we don't want to clone self later - let world = self.world_ptr.clone(); - let world = world.read(); - - let type_data = world.resource::(); - let g = type_data.read(); - - let type_id = self.get(|s| s.type_id())?; - - if let Some(v) = g.get_type_data::(type_id) { - v.ref_to_rhai(self) - } else { - ReflectedValue { ref_: self }.to_dynamic() - } - } -} - -pub trait ApplyRhai { - fn apply_rhai(&mut self, value: Dynamic) -> Result<(), Box>; -} - -impl ApplyRhai for ReflectReference { - fn apply_rhai(&mut self, value: Dynamic) -> Result<(), Box> { - let world_ptr = self.world_ptr.clone(); - - // remove typedata from the world to be able to manipulate world - let proxyable = { - let world = world_ptr.read(); - let type_registry = world.resource::().read(); - type_registry - .get_type_data::(self.get(|s| s.type_id())?) - .cloned() - }; - - if let Some(ud) = proxyable { - return ud.apply_rhai(self, value); - } else if value.is::() { - let b = value.cast::(); - self.apply(&b.into())?; - return Ok(()); - } - - Err(Box::new(EvalAltResult::ErrorRuntime(self.get(|s| - format!("Attempted to assign `{}` = {value:?}. Did you forget to call `app.register_foreign_rhai_type::<{}>`?", - self.path, - s.get_represented_type_info().unwrap().type_path() - ))?.into(),Position::NONE) - )) - } -} - -impl ValueIndex for ReflectReference { - type Output = Result>; - - fn index(&self, index: Dynamic) -> Self::Output { - if index.is::() { - return Ok(self.index(index.as_int().unwrap() as usize)); - } else if index.is::() { - return Ok(self.index(Cow::Owned(index.into_string().unwrap()))); - }; - - Err(Box::new(EvalAltResult::ErrorMismatchDataType( - index.type_name().to_owned(), - "integer or string".to_owned(), - Position::NONE, - ))) - } -} - -use bevy_mod_scripting_rhai::rhai::plugin::*; - -#[allow(deprecated)] -impl CustomType for ReflectedValue { - fn build(mut builder: bevy_mod_scripting_rhai::rhai::TypeBuilder) { - builder - .with_indexer_get_result(|obj: &mut ReflectedValue, index: Dynamic| { - obj.ref_.index(index)?.to_dynamic() - }) - .with_indexer_set_result(|obj: &mut ReflectedValue, index: Dynamic, value: Dynamic| { - obj.ref_.index(index)?.apply_rhai(value) - }) - .with_fn("to_debug", |self_: &mut ReflectedValue| { - format!("{:?}", self_) - }) - .with_fn("to_string", |self_: &mut ReflectedValue| { - self_ - .ref_ - .get(|s| format!("{:?}", &s)) - .map_err::, _>(|e| e.into()) - }); - } -} diff --git a/crates/bevy_script_api/src/rhai/std.rs b/crates/bevy_script_api/src/rhai/std.rs deleted file mode 100644 index 88e8dc5db5..0000000000 --- a/crates/bevy_script_api/src/rhai/std.rs +++ /dev/null @@ -1,454 +0,0 @@ -use std::{ - any::type_name, - fmt::{Debug, Display}, - iter::Map, -}; - -use bevy::reflect::{FromReflect, GetTypeRegistration, Reflect, TypePath}; -#[allow(deprecated)] -use bevy_mod_scripting_rhai::rhai::{CustomType, Dynamic, Engine, EvalAltResult, Position}; - -use crate::{ - common::std::ScriptVec, error::ReflectionError, ReflectReference, ReflectionPathElement, - ValueIndex, -}; - -use super::{ApplyRhai, FromRhaiProxy, RhaiProxyable, ToDynamic, ToRhaiProxy}; - -impl RhaiProxyable for T { - fn ref_to_rhai(self_: crate::ReflectReference) -> Result> { - self_.get_typed(|self_: &T| Ok(Dynamic::from(self_.clone())))? - } - - fn apply_rhai( - self_: &mut crate::ReflectReference, - new_val: Dynamic, - ) -> Result<(), Box> { - let other = if new_val.is::() { - new_val.cast::() - } else { - return Err(Box::new(EvalAltResult::ErrorMismatchDataType( - stringify!(T).to_owned(), - new_val.type_name().to_string(), - Position::NONE, - ))); - }; - - self_.set_val(other)?; - Ok(()) - } -} - -/// A marker trait signifying this type is to receive an automatic proxy implementation via `Dynamic::from`. -/// This means the proxy for this type is the type itself, and is created by cloning the original reference. -pub trait RhaiCopy {} - -/// Implements RhaiProxyabel for a numeric type via another proxy type by coercing the type -macro_rules! impl_rhai_proxy { - // i.e. impl_rhai_proxy!(String as Into) - ($type:ty as Into) => { - impl_rhai_proxy!($type,$type,self: {self.into()}, s: {s.into()}); - }; - // i.e. impl_rhai_proxy!(u32 as i64) - ($type:ty as $proxy_type:ty) => { - impl_rhai_proxy!($type, $proxy_type,self:{(self as $proxy_type).into()}, s:{(*s as $proxy_type).into()}); - }; - // i.e. impl_rhai_proxy!(ident, u32, i64, (*ident as i64).into()) expression is used in ref_to_rhai - ($type:ty, $proxy_type:ty,$self:ident: {$($proxy_expr:tt)*}, $self_to_rhai:ident : {$($proxy_expr_to_rhai:tt)*} ) => { - impl RhaiProxyable for $type { - fn ref_to_rhai( - self_: crate::ReflectReference, - ) -> Result> { - self_.get_typed(|$self_to_rhai: &$type| Ok($($proxy_expr_to_rhai)*))? - } - - fn apply_rhai( - self_: &mut crate::ReflectReference, - new_val: Dynamic, - ) -> Result<(), Box> { - self_.set_val(Self::from_rhai_proxy(new_val)?)?; - Ok(()) - } - } - - impl FromRhaiProxy for $type { - #[inline(always)] - fn from_rhai_proxy(self_: Dynamic) -> Result> { - if self_.is::<$proxy_type>(){ - Ok(self_.cast::<$proxy_type>() as $type) - } else { - Err(Box::new(EvalAltResult::ErrorMismatchDataType( - stringify!($type).to_owned(), - self_.type_name().to_owned(), - Position::NONE, - ))) - } - - } - } - - impl ToRhaiProxy for $type { - #[inline(always)] - fn to_rhai_proxy($self) -> Result> { - Ok($($proxy_expr)*) - } - } - }; -} -use bevy_mod_scripting_rhai::rhai::{FLOAT, INT}; - -impl_rhai_proxy!(i8 as INT); -impl_rhai_proxy!(i16 as INT); -impl_rhai_proxy!(i32 as INT); -impl_rhai_proxy!(i64 as INT); -impl_rhai_proxy!(i128 as INT); -impl_rhai_proxy!(isize as INT); -impl_rhai_proxy!(u8 as INT); -impl_rhai_proxy!(u16 as INT); -impl_rhai_proxy!(u32 as INT); -impl_rhai_proxy!(u64 as INT); -impl_rhai_proxy!(u128 as INT); -impl_rhai_proxy!(usize as INT); -impl_rhai_proxy!(f32 as FLOAT); -impl_rhai_proxy!(f64 as FLOAT); -impl_rhai_proxy!(bool as bool); -impl_rhai_proxy!(String as Into); - -impl< - T: RhaiProxyable - + Reflect - + FromReflect - + TypePath - + Clone - + FromRhaiProxy - + bevy::reflect::Typed - + GetTypeRegistration, - > RhaiProxyable for Option -{ - fn ref_to_rhai(self_: crate::ReflectReference) -> Result> { - self_.get_typed(|s: &Option| match s { - Some(_) => T::ref_to_rhai(self_.sub_ref(ReflectionPathElement::SubReflection { - label: "as_ref", - get: std::sync::Arc::new(|ref_| { - ref_.downcast_ref::>() - .ok_or_else(|| ReflectionError::CannotDowncast { - from: ref_.get_represented_type_info().unwrap().type_path().into(), - to: stringify!(Option).into(), - })? - .as_ref() - .map(|t| t as &dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - }), - get_mut: std::sync::Arc::new(|ref_| { - ref_.downcast_mut::>() - // TODO: there is some weird borrow checker fuckery going on here - // i tried having from: ref_.get_represented_type_info().unwrap().type_path().into() instead of "Reflect" - // and lying this out in an if let expression, but nothing will satisfy the borrow checker here, so leaving this for now - .ok_or_else(|| ReflectionError::CannotDowncast { - from: "Reflect".into(), - to: stringify!(Option).into(), - })? - .as_mut() - .map(|t| t as &mut dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - }), - })), - None => Ok(Dynamic::UNIT), - })? - } - - fn apply_rhai( - self_: &mut crate::ReflectReference, - new_val: Dynamic, - ) -> Result<(), Box> { - if new_val.is::<()>() { - self_.get_mut_typed(|s: &mut Option| { - *s = None; - Ok(()) - })? - } else { - // we need to do this in two passes, first - // ensure that the target type is the 'some' variant to allow a sub reference - - let is_none = self_.get_typed(|s: &Option| s.is_none())?; - - if is_none { - return self_.get_mut_typed(|s: &mut Option| { - *s = Some(T::from_rhai_proxy(new_val)?); - Ok::<_, Box>(()) - })?; - } - - T::apply_rhai( - &mut self_.sub_ref(ReflectionPathElement::SubReflection { - label: "", - get: std::sync::Arc::new(|ref_| { - ref_.downcast_ref::>() - .ok_or_else(|| ReflectionError::CannotDowncast { - from: ref_.get_represented_type_info().unwrap().type_path().into(), - to: stringify!(Option).into(), - })? - .as_ref() - .map(|t| t as &dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - }), - get_mut: std::sync::Arc::new(|ref_| { - if ref_.is::>() { - ref_.downcast_mut::>() - .unwrap() - .as_mut() - .map(|t| t as &mut dyn Reflect) - .ok_or_else(|| { - ReflectionError::Other( - "Stale reference to Option. Cannot sub reflect.".to_owned(), - ) - }) - } else { - Err(ReflectionError::CannotDowncast { - from: ref_.get_represented_type_info().unwrap().type_path().into(), - to: stringify!(Option).into(), - }) - } - }), - }), - new_val, - ) - } - } -} - -impl FromRhaiProxy for Option { - fn from_rhai_proxy(self_: Dynamic) -> Result> { - if self_.is::<()>() { - Ok(None) - } else { - T::from_rhai_proxy(self_).map(Option::Some) - } - } -} - -impl ToRhaiProxy for Option { - fn to_rhai_proxy(self) -> Result> { - match self { - Some(v) => v.to_rhai_proxy(), - None => Ok(Dynamic::UNIT), - } - } -} - -/// 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 - + bevy::reflect::Typed -{ -} -impl< - T: FromReflect - + GetTypeRegistration - + TypePath - + RhaiProxyable - + FromRhaiProxy - + Clone - + bevy::reflect::Typed, - > RhaiVecElem for T -{ -} - -/// A ScriptVec wrapper which implements a custom iterator ontop of ScriptVec's -pub struct RhaiVec(pub ScriptVec); - -impl Clone for RhaiVec { - fn clone(&self) -> Self { - Self(self.0.clone()) - } -} - -impl Debug for RhaiVec { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self.0) - } -} - -impl Display for RhaiVec { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0) - } -} - -impl RhaiVec { - pub fn new_ref(self_: crate::ReflectReference) -> Self { - Self(ScriptVec::::new_ref(self_)) - } -} - -impl std::ops::Deref for RhaiVec { - type Target = ScriptVec; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl std::ops::DerefMut for RhaiVec { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -impl IntoIterator for RhaiVec { - type Item = Result>; - - type IntoIter = - Map< as IntoIterator>::IntoIter, fn(ReflectReference) -> Self::Item>; - - fn into_iter(self) -> Self::IntoIter { - self.0.into_iter().map(|v| v.to_dynamic()) - } -} - -impl RhaiProxyable for Vec { - fn ref_to_rhai(self_: crate::ReflectReference) -> Result> { - Ok(Dynamic::from(RhaiVec::::new_ref(self_))) - } - - fn apply_rhai( - self_: &mut crate::ReflectReference, - new_val: Dynamic, - ) -> Result<(), Box> { - if new_val.is::>() { - let last_target_idx = self_.get_typed(|s: &Vec| s.len())? - 1; - // there is also another case to consider, Vec has a lua representation available as well (table) - // if we receive one of those, we should also apply it - for (idx, entry) in new_val.cast::>().into_iter().enumerate() { - if idx > last_target_idx { - // here we don't need to do anything special just use LuaProxyable impl - T::apply_rhai(&mut self_.index(idx), entry)?; - } else { - // here we don't have anything to apply this to - // use FromLua impl - self_.get_mut_typed(|s: &mut Vec| { - s[idx] = T::from_rhai_proxy(entry)?; - Ok::<_, Box>(()) - })??; - } - } - Ok(()) - } else if new_val.is::>() { - let vec = new_val.cast::>(); - self_.apply(&vec.ref_)?; - Ok(()) - } else { - Err(Box::new(EvalAltResult::ErrorMismatchDataType( - "Array or Vec".to_owned(), - new_val.type_name().to_owned(), - Position::NONE, - ))) - } - } -} - -impl FromRhaiProxy for Vec { - fn from_rhai_proxy(self_: Dynamic) -> Result> { - if self_.is::>() { - let vec = self_.cast::>(); - vec.ref_.get_typed(|s: &Vec| Ok(s.clone()))? - } else if self_.is::>() { - self_ - .cast::>() - .into_iter() - .map(|v| T::from_rhai_proxy(v)) - .collect::, _>>() - } else { - Err(Box::new(EvalAltResult::ErrorMismatchDataType( - "Array or Vec".to_owned(), - self_.type_name().to_owned(), - Position::NONE, - ))) - } - } -} - -impl ToRhaiProxy for Vec { - fn to_rhai_proxy(self) -> Result> { - self.into_iter() - .map(|v| T::to_rhai_proxy(v)) - .collect::, _>>() - .map(Dynamic::from) - } -} - -#[allow(deprecated)] -impl CustomType for RhaiVec { - fn build(mut builder: bevy_mod_scripting_rhai::rhai::TypeBuilder) { - builder - .with_name(type_name::>()) - .with_fn("to_debug", |vec: &mut RhaiVec| format!("{:?}", vec)) - .with_fn("to_string", |vec: &mut RhaiVec| { - vec.ref_ - .get(|s| format!("{:?}", &s)) - .map_err::, _>(|e| e.into()) - }) - .with_result_fn("is_empty", |vec: &mut RhaiVec| { - vec.is_empty().map_err(Into::into) - }) - .with_result_fn("len", |vec: &mut RhaiVec| { - vec.len().map(|v| v as INT).map_err(Into::into) - }) - .with_result_fn("push", |vec: &mut RhaiVec, val: Dynamic| { - vec.push(T::from_rhai_proxy(val)?).map_err(Into::into) - }) - .with_result_fn("pop", |vec: &mut RhaiVec| vec.pop().map_err(Into::into)) - .with_result_fn("clear", |vec: &mut RhaiVec| { - vec.clear().map_err(Into::into) - }) - .with_result_fn("insert", |vec: &mut RhaiVec, idx: INT, val: Dynamic| { - vec.insert(idx as usize, T::from_rhai_proxy(val)?) - .map_err(Into::into) - }) - .with_result_fn("remove", |vec: &mut RhaiVec, idx: INT| { - vec.remove(idx as usize).map_err(Into::into) - }) - .with_result_fn("index$get$", |vec: &mut RhaiVec, idx: INT| { - vec.index(idx as usize).to_dynamic() - }) - .with_result_fn( - "index$set$", - |vec: &mut RhaiVec, idx: INT, value: Dynamic| { - vec.index(idx as usize).apply_rhai(value) - }, - ); - } -} - -/// A trait for making monomorphization of Vec implementations for any T easier. -/// -/// Rhai does not support the idea of generic types, instead every function is a standalone thing, and hence -/// generics must be monomorphized manually (registered for every type you want to use them with). -pub trait RegisterVecType { - fn register_vec_functions(&mut self) -> &mut Self; -} - -impl RegisterVecType for Engine { - fn register_vec_functions(&mut self) -> &mut Self { - self.build_type::>(); - self.register_iterator_result::, _>(); - self - } -} diff --git a/crates/bevy_script_api/src/script_ref.rs b/crates/bevy_script_api/src/script_ref.rs deleted file mode 100644 index bb9e61ba78..0000000000 --- a/crates/bevy_script_api/src/script_ref.rs +++ /dev/null @@ -1,185 +0,0 @@ -use bevy::prelude::*; -use parking_lot::RwLock; -use std::fmt::Debug; -use std::{borrow::Cow, sync::Weak}; - -use bevy_mod_scripting_core::world::WorldPointer; - -use crate::{ - error::ReflectionError, - sub_reflect::{ReflectBase, ReflectionPath, ReflectionPathElement}, -}; - -/// A reference to a rust type available from some script language. -/// References can be either to rust or script managed values (created either on the bevy or script side). -/// but also to any subfield of those values (All pointed to values must support `reflect`). -/// Each reference holds a reflection path from the root. -/// -/// Automatically converts to the most convenient lua representation. -/// See [`ReflectReference::to_lua`] -#[derive(Clone, Debug)] -pub struct ReflectReference { - /// The reflection path from the root - pub(crate) path: ReflectionPath, - pub(crate) world_ptr: WorldPointer, -} - -/// Safety: copying just copies the path of reflection, any closures inside, and the world pointer. -/// that itself is safe to copy. -unsafe impl Send for ReflectReference {} -/// Safety: all accesses to value are protected by locking the world pointer. -unsafe impl Sync for ReflectReference {} - -impl ReflectReference { - /// Safely creates a new base component reference - pub fn new_component_ref( - comp: ReflectComponent, - entity: Entity, - world_ptr: WorldPointer, - ) -> Self { - Self { - path: ReflectionPath::new(ReflectBase::Component { comp, entity }), - world_ptr, - } - } - - pub fn new_resource_ref(res: ReflectResource, world_ptr: WorldPointer) -> Self { - Self { - path: ReflectionPath::new(ReflectBase::Resource { res }), - world_ptr, - } - } - - /// Creates a reference to a script owned value - pub fn new_script_ref(ptr: Weak>, world_ptr: WorldPointer) -> Self { - Self { - path: ReflectionPath::new(ReflectBase::ScriptOwned { val: ptr }), - world_ptr, - } - } - - /// Creates a new script reference which points to a sub component of the original data, - /// This also updates the pointer - pub(crate) fn sub_ref(&self, elem: ReflectionPathElement) -> ReflectReference { - let path = self.path.new_sub(elem); - - Self { - path, - ..self.clone() - } - } - - /// Retrieves the underlying `dyn Reflect` reference and applies function which can retrieve a value. - /// Panics if the reference is invalid or world is already borrowed mutably. - #[inline(always)] - pub fn get(&self, f: F) -> Result - where - F: FnOnce(&dyn Reflect) -> O, - { - self.path.get(self.world_ptr.clone(), f) - } - - pub fn get_typed(&self, f: F) -> Result - where - F: FnOnce(&T) -> O, - T: Reflect, - { - self.path.get(self.world_ptr.clone(), |reflect| { - (f)(reflect.downcast_ref::().unwrap_or_else(|| { - panic!( - "Expected `{}` found `{}`", - ::std::any::type_name::(), - reflect.get_represented_type_info().unwrap().type_path() - ) - })) - }) - } - - /// Retrieves the underlying `dyn Reflect` reference and applies function which can retrieve a value. - /// If this is a component it is marked as changed. - /// Panics if the reference is invalid or if the world/value is already borrowed or if r is not a mutable pointer. - #[inline(always)] - pub fn get_mut(&mut self, f: F) -> Result - where - F: FnOnce(&mut dyn Reflect) -> O, - { - self.path.get_mut(self.world_ptr.clone(), f) - } - - pub fn get_mut_typed(&mut self, f: F) -> Result - where - F: FnOnce(&mut T) -> O, - T: Reflect, - { - self.path.get_mut(self.world_ptr.clone(), |reflect| { - (f)(reflect.downcast_mut().unwrap()) - }) - } - - /// applies another [`ReflectReference`] to self by carefuly acquiring locks and cloning if necessary. - /// - /// This is semantically equivalent to the [`Reflect::apply`] method. - /// If you know the type of this value use [`Self::apply_luaref_typed`] since it avoids double cloning and allocating - pub fn apply(&mut self, other: &ReflectReference) -> Result<(), ReflectionError> { - // sadly apply already performs a clone for value types, so this incurs - // a double clone in some cases TODO: is there another way ? - // can we avoid the box ? - let cloned = other.get(|s| s.clone_value())?; - - self.get_mut(|s| s.apply(&*cloned)) - } - - /// Unlike apply this method expects the other type to be identical. Does not allocate so is likely to be faster than apply, uses direct assignment. - /// If you have a concrete value use [`Self::set_val`](TypedReflectReference) unstead - pub fn set(&mut self, other: &Self) -> Result<(), ReflectionError> - where - T: Reflect + Clone, - { - let other: T = other.get_typed(|s: &T| s.clone())?; - self.get_mut_typed(|s| *s = other) - } - - /// Version of [`Self::set`](TypedReflectReference) which directly accepts a `T` value - pub fn set_val(&mut self, other: T) -> Result<(), ReflectionError> - where - T: Reflect, - { - self.get_mut_typed(|s| *s = other) - } -} - -/// A version of index for returning values instead of references -pub trait ValueIndex { - type Output; - - fn index(&self, index: Idx) -> Self::Output; -} - -impl ValueIndex for ReflectReference { - type Output = Self; - - fn index(&self, index: usize) -> Self::Output { - self.sub_ref(ReflectionPathElement::IndexAccess(index)) - } -} - -impl ValueIndex> for ReflectReference { - type Output = Self; - - fn index(&self, index: Cow<'static, str>) -> Self::Output { - self.sub_ref(ReflectionPathElement::FieldAccess(index)) - } -} - -/// A value representing a type which has no special UserData implementation, -/// It exposes the much less convenient reflect interface of the underlying type. -#[derive(Clone, Debug)] -pub struct ReflectedValue { - pub(crate) ref_: ReflectReference, -} - -impl From for ReflectReference { - fn from(ref_: ReflectedValue) -> Self { - ref_.ref_ - } -} diff --git a/crates/bevy_script_api/src/sub_reflect.rs b/crates/bevy_script_api/src/sub_reflect.rs deleted file mode 100644 index fcd5f55dd6..0000000000 --- a/crates/bevy_script_api/src/sub_reflect.rs +++ /dev/null @@ -1,390 +0,0 @@ -use bevy::reflect::PartialReflect; -use parking_lot::RwLock; -use std::fmt; -use std::fmt::{Debug, Display}; -use std::sync::Arc; -use std::{borrow::Cow, sync::Weak}; - -use bevy::{ - prelude::{Entity, ReflectComponent, ReflectResource}, - reflect::{Reflect, ReflectMut, ReflectRef}, -}; - -use crate::error::ReflectionError; -use bevy_mod_scripting_core::world::WorldPointer; - -/// The base of a reflect path, i.e. the top-level object or source. -/// Reflections paths are always relative to some reflect base. -/// -/// If the reflection base and reflection path are both valid we can use them to traverse reflect types -#[derive(Clone)] -pub(crate) enum ReflectBase { - /// A bevy component reference - Component { - comp: ReflectComponent, - entity: Entity, - }, - /// A bevy resource reference - Resource { res: ReflectResource }, - - /// A script owned reflect type (for example a vector constructed in lua) - ScriptOwned { val: Weak> }, -} - -/// Safety: we can safely send this value across thread boundaries -/// the pointer variant is always accessed with the -unsafe impl Send for ReflectBase {} -/// Safety: todo!() -unsafe impl Sync for ReflectBase {} - -impl fmt::Debug for ReflectBase { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Component { entity, .. } => { - f.debug_struct("Component").field("entity", entity).finish() - } - Self::ScriptOwned { .. } => write!(f, "ScriptOwned"), - Self::Resource { .. } => f.debug_struct("Resource").finish(), - } - } -} - -impl fmt::Display for ReflectBase { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - ReflectBase::Component { entity, .. } => { - f.write_str("(Component on ")?; - f.write_str(&entity.index().to_string())?; - f.write_str(")") - } - ReflectBase::Resource { .. } => f.write_str("(Resource)"), - ReflectBase::ScriptOwned { .. } => f.write_str("(ScriptOwned)"), - } - } -} - -pub type Get = dyn Fn(&dyn Reflect) -> Result<&dyn Reflect, ReflectionError>; -pub type GetMut = dyn Fn(&mut dyn Reflect) -> Result<&mut dyn Reflect, ReflectionError>; - -/// Stores a part of the path of reflection + sub reflection from a root reflect reference. -/// Sub reflection allows us to access values unreachable by standard reflection. -#[derive(Clone)] -pub enum ReflectionPathElement { - SubReflection { - label: &'static str, - get: Arc, - get_mut: Arc, - }, - /// Access to a struct field - FieldAccess(Cow<'static, str>), - /// Access to a TupleStruct, Tuple, List or Array element - IndexAccess(usize), // TODO: Map access -} - -impl Debug for ReflectionPathElement { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::SubReflection { label, .. } => f - .debug_struct("SubReflection") - .field("label", label) - .finish(), - Self::FieldAccess(arg0) => f.debug_tuple("FieldAccess").field(arg0).finish(), - Self::IndexAccess(arg0) => f.debug_tuple("IndexAccess").field(arg0).finish(), - } - } -} - -impl Display for ReflectionPathElement { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - ReflectionPathElement::SubReflection { label, .. } => { - f.write_str(".")?; - f.write_str(label)?; - f.write_str("()") - } - ReflectionPathElement::FieldAccess(s) => { - f.write_str(".")?; - f.write_str(s) - } - ReflectionPathElement::IndexAccess(i) => { - f.write_str("[")?; - f.write_str(&i.to_string())?; - f.write_str("]") - } - } - } -} - -impl ReflectionPathElement { - pub(crate) fn sub_ref<'a>( - &self, - base: &'a dyn Reflect, - ) -> Result<&'a dyn Reflect, ReflectionError> { - match self { - ReflectionPathElement::SubReflection { get, .. } => get(base), - ReflectionPathElement::FieldAccess(field) => match base.reflect_ref() { - 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) - .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(), - }), - }, - } - } - - pub(crate) fn sub_ref_mut<'a>( - &self, - base: &'a mut dyn Reflect, - ) -> Result<&'a mut dyn Reflect, ReflectionError> { - match self { - ReflectionPathElement::SubReflection { get_mut, .. } => get_mut(base), - ReflectionPathElement::FieldAccess(field) => match base.reflect_mut() { - 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) - .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(), - }), - }, - } - } -} - -#[derive(Clone, Debug)] -pub(crate) struct ReflectionPath { - base: ReflectBase, - // most of these will be very short, people don't make many nested hashmaps vecs etc. - accesses: Vec, -} - -impl Display for ReflectionPath { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_str(&self.base.to_string())?; - for access in &self.accesses { - f.write_str(&access.to_string())? - } - Ok(()) - } -} - -impl ReflectionPath { - pub fn new(base: ReflectBase) -> Self { - Self { - base, - accesses: Vec::default(), - } - } - - /// Creates a new composite sub reflect - pub fn new_sub(&self, elem: ReflectionPathElement) -> Self { - let mut accesses = self.accesses.clone(); - - accesses.push(elem); - - Self { - accesses, - ..self.clone() - } - } - - /// Walks the path with the given reference as the base - fn walk_path<'a>(&self, ref_: &'a dyn Reflect) -> Result<&'a dyn Reflect, ReflectionError> { - let first = self.accesses.first().map(|s| s.sub_ref(ref_)); - - if let Some(first) = first { - if self.accesses.len() > 1 { - self.accesses[1..] - .iter() - .try_fold(first?, |a, access| access.sub_ref(a)) - } else { - first - } - } else { - Ok(ref_) - } - } - - /// Walks the path with the given mutable reference as the base. - fn walk_path_mut<'a>( - &self, - ref_: &'a mut dyn Reflect, - ) -> Result<&'a mut dyn Reflect, ReflectionError> { - if let Some(first) = self.accesses.first() { - if self.accesses.len() > 1 { - self.accesses[1..] - .iter() - .try_fold(first.sub_ref_mut(ref_)?, |a, access| access.sub_ref_mut(a)) - } else { - first.sub_ref_mut(ref_) - } - } else { - Ok(ref_) - } - } - - pub fn get(&self, world_ptr: WorldPointer, f: F) -> Result - where - F: FnOnce(&dyn Reflect) -> O, - { - match &self.base { - ReflectBase::Component { comp, entity } => { - let g = world_ptr.read(); - - let entity_ref = - g.get_entity(*entity) - .map_err(|e| ReflectionError::InvalidBaseReference { - base: self.base.to_string(), - reason: format!("This entity could not be retrieved. {e}"), - })?; - - let ref_ = self.walk_path(comp.reflect(entity_ref).ok_or_else(|| { - ReflectionError::InvalidBaseReference { - base: self.base.to_string(), - reason: "Given component does not exist on this entity".to_owned(), - } - })?)?; - Ok(f(ref_)) - } - ReflectBase::Resource { res } => { - let g = world_ptr.read(); - - let ref_ = self.walk_path(res.reflect(&g).ok_or_else(|| { - ReflectionError::InvalidBaseReference { - base: self.base.to_string(), - reason: "Given resource does not exist in this world".to_owned(), - } - })?)?; - Ok(f(ref_)) - } - ReflectBase::ScriptOwned { val } => { - let g = val - .upgrade() - .expect("Trying to access cached value from previous frame"); - - let g = g.try_read().expect("Rust safety violation: attempted to borrow value {self:?} while it was already mutably borrowed"); - Ok(f(self.walk_path(&*g)?)) - } - } - } - - pub fn get_mut(&mut self, world_ptr: WorldPointer, f: F) -> Result - where - F: FnOnce(&mut dyn Reflect) -> O, - { - match &self.base { - ReflectBase::Component { comp, entity } => { - let mut g = world_ptr.write(); - - let mut e = g.entity_mut(*entity); - let ref_ = self.walk_path_mut( - comp.reflect_mut(&mut e) - .ok_or_else(|| ReflectionError::InvalidBaseReference { - base: self.base.to_string(), - reason: "Given component does not exist on this entity".to_owned(), - })? - .into_inner(), - )?; - Ok(f(ref_)) - } - ReflectBase::Resource { res } => { - let mut g = world_ptr.write(); - - let ref_ = self.walk_path_mut( - res.reflect_mut(&mut g) - .ok_or_else(|| ReflectionError::InvalidBaseReference { - base: self.base.to_string(), - reason: "Given resource does not exist in this world".to_owned(), - })? - .into_inner(), - )?; - Ok(f(ref_)) - } - ReflectBase::ScriptOwned { val } => { - let g = val - .upgrade() - .expect("Trying to access cached value from previous frame"); - let mut g = g.try_write().expect("Rust safety violation: attempted to borrow value {self:?} while it was already mutably borrowed"); - Ok(f(self.walk_path_mut(&mut *g)?)) - } - } - } -} diff --git a/crates/bevy_script_api/src/wrappers.rs b/crates/bevy_script_api/src/wrappers.rs deleted file mode 100644 index d2110b275f..0000000000 --- a/crates/bevy_script_api/src/wrappers.rs +++ /dev/null @@ -1,107 +0,0 @@ -#[macro_export] -macro_rules! ref_only_wrapper_methods { - ($type_:path, $wrapper_name: ident) => { - /// Creates a script reference pointing to the wrapped value. - /// - /// Depending on this value it may be a lua owned or reflect relative reference - pub fn reflect_ref( - &self, - world_ptr: bevy_mod_scripting_core::world::WorldPointer, - ) -> $crate::script_ref::ReflectReference { - match self { - Self::Owned(val) => $crate::script_ref::ReflectReference::new_script_ref( - ::std::sync::Arc::downgrade(val), - world_ptr, - ), - Self::Ref(ref_) => ref_.clone(), - } - } - - pub fn new(b: $type_) -> Self { - Self::Owned(::std::sync::Arc::new($crate::parking_lot::RwLock::new(b))) - } - - pub fn new_ref(b: $crate::script_ref::ReflectReference) -> Self { - Self::Ref(b) - } - - /// Perform an operation on the base type and optionally retrieve something by value - /// may require a read lock on the world in case this is a reference - pub fn val(&self, accessor: F) -> Result - where - F: FnOnce(&$type_) -> G, - { - match self { - Self::Owned(v) => Ok(accessor(&v.read())), - Self::Ref(v) => v.get(|s| accessor(s.downcast_ref::<$type_>().unwrap())), - } - } - - pub fn val_mut(&mut self, accessor: F) -> Result - where - F: FnOnce(&mut $type_) -> G, - { - match self { - Self::Owned(v) => Ok(accessor(&mut *v.write())), - Self::Ref(v) => v.get_mut(|s| accessor(s.downcast_mut::<$type_>().unwrap())), - } - } - - /// Applies Self to another ReflectReference. - /// may require a write lock on the world - pub fn apply_self_to_base( - &self, - other: &mut $crate::script_ref::ReflectReference, - ) -> Result<(), $crate::error::ReflectionError> { - match self { - Self::Owned(v) => { - other.get_mut(|other| other.apply(&mut *v.write()))?; - Ok(()) - } - Self::Ref(v) => { - // if we are a ReflectReference, we have to be careful with borrows - // to avoid deadlock - // we take advantage of the fact we know the expected type - other.apply(v) - } - } - } - }; -} - -#[macro_export] -macro_rules! define_wrapper { - ($type_:path, $wrapper_name:ident) => { - #[allow(clippy::large_enum_variant)] - #[doc=concat!("A script wrapper for the type `",stringify!($type_),"`")] - #[derive(Clone)] - pub enum $wrapper_name { - Owned(::std::sync::Arc<$crate::parking_lot::RwLock<$type_>>), - Ref($crate::script_ref::ReflectReference), - } - }; -} - -#[macro_export] -macro_rules! make_script_wrapper { - ($type_:path as $wrapper_name:ident with Clone) => { - $crate::define_wrapper!($type_, $wrapper_name); - impl $wrapper_name { - $crate::ref_only_wrapper_methods!($type_, $wrapper_name); - - /// retrieves the underlying value by cloning it - pub fn inner(&self) -> Result<$type_, $crate::error::ReflectionError> - where - $type_: Clone, - { - self.val(|s| s.clone()) - } - } - }; - ($type_:path as $wrapper_name:ident) => { - $crate::define_wrapper!($type_, $wrapper_name); - impl $wrapper_name { - $crate::ref_only_wrapper_methods!($type_, $wrapper_name); - } - }; -} diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index ca166968b5..0406bdb59b 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -43,7 +43,6 @@ path = "src/lib.rs" bevy = { workspace = true, default-features = false } bevy_mod_scripting_core = { workspace = true, features = ["mlua_impls"] } bevy_mod_scripting_functions = { workspace = true, features = [] } -bevy_mod_scripting_derive = { path = "../../bevy_mod_scripting_derive" } mlua = { workspace = true, features = ["vendored", "send", "macros"] } parking_lot = "0.12.1" serde_json = "1.0.81" diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 8c86ad713c..8cfcf2d58d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -9,15 +9,11 @@ use bevy_mod_scripting_core::{ bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, error::ScriptError, }; -use bevy_mod_scripting_derive::LuaProxy; use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; use mlua::{MetaMethod, UserData, UserDataFields, UserDataMethods, Value, Variadic}; use super::script_value::LuaScriptValue; -// use super::proxy::LuaReflectRefProxy; -// use super::query::LuaQueryBuilder; - #[derive(Clone, Debug, mlua::FromLua)] pub struct LuaWorld(pub WorldCallbackAccess); @@ -27,396 +23,7 @@ impl LuaWorld { } } -impl UserData for LuaWorld { - fn add_methods>(methods: &mut T) { - // methods.add_meta_function( - // MetaMethod::Index, - // |lua, (world, key): (LuaWorld, String)| { - // // func.with_call(args, world, f) - // // Ok(()) - // let func = lua.create_function(move |lua, args: Variadic| { - // let world = world.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error( - // "Stale world access", - // )) - // })?; - - // let registry = - // world.with_resource(|registry: &AppFunctionRegistry| registry.clone()); - // let registry = registry.read(); - // let func = registry - // .get_namespaced_function::(key.clone()) - // .ok_or_else(|| { - // mlua::Error::external(FunctionError::FunctionNotFound { - // function_name: key.clone().into(), - // type_: Some("World".into()), - // }) - // })?; - // let info = func.info(); - // println!("Calling function {:?} with args: {:?}", info.name(), args); - - // Ok(()) - // })?; - - // Ok(func) - // }, - // ); - - // methods.add_method("_list_accesses", |_, this, ()| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let accesses = world - // .list_accesses() - // .into_iter() - // .map(|v| format!("Access to: {v:?}")) - // .collect::>(); - // Ok(accesses) - // }); - - // methods.add_method("spawn", |_, this, ()| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let entity: LuaReflectValProxy = world - // .proxy_call((), |()| world.spawn()) - // .map_err(mlua::Error::external)?; - // Ok(entity) - // }); - - // methods.add_method("get_type_by_name", |_, this, type_name: String| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Option> = world - // .proxy_call(type_name, |type_name| world.get_type_by_name(type_name)) - // .map_err(mlua::Error::external)?; - - // Ok(out) - // }); - - // methods.add_method( - // "add_default_component", - // |_, - // this, - // args: ( - // LuaReflectValProxy, - // LuaValProxy, - // )| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(args, |(entity, registration)| { - // world.add_default_component(entity, registration) - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "get_component", - // |_, - // this, - // args: ( - // LuaReflectValProxy, - // LuaValProxy, - // )| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result>, ErrorProxy> = - // world - // .proxy_call(args, |(entity, component_id)| { - // match component_id.component_id() { - // Some(component_id) => world.get_component(entity, component_id), - // None => Ok(None), - // } - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::< - // _, - // Option>, - // >::new(out)) - // }, - // ); - - // methods.add_method( - // "has_component", - // |_, - // this, - // args: ( - // LuaReflectValProxy, - // LuaValProxy, - // )| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result> = world - // .proxy_call(args, |(entity, registration)| { - // match registration.component_id() { - // Some(component_id) => world.has_component(entity, component_id), - // None => Ok(false), - // } - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, bool>::new(out)) - // }, - // ); - - // methods.add_method( - // "remove_component", - // |_, - // this, - // args: ( - // LuaReflectValProxy, - // LuaValProxy, - // )| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(args, |(entity, registration)| { - // world.remove_component(entity, registration) - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "get_resource", - // |_, this, registration: LuaValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result>, ErrorProxy> = - // world - // .proxy_call(registration, |registration| { - // match registration.resource_id { - // Some(resource_id) => world.get_resource(resource_id), - // None => Ok(None), - // } - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, LuaReflectRefProxy>::new(out)) - // }, - // ); - - // methods.add_method( - // "remove_resource", - // |_, this, registration: LuaValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(registration, |registration| { - // world.remove_resource(registration) - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "has_resource", - // |_, this, registration: LuaValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: bool = world - // .proxy_call(registration, |registration| { - // match registration.resource_id { - // Some(resource_id) => world.has_resource(resource_id), - // None => false, - // } - // }) - // .map_err(mlua::Error::external)?; - - // Ok(out) - // }, - // ); - - // methods.add_method( - // "has_entity", - // |_, this, entity: LuaReflectValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: bool = world - // .proxy_call(entity, |entity| world.has_entity(entity)) - // .map_err(mlua::Error::external)?; - - // Ok(out) - // }, - // ); - - // methods.add_method( - // "get_children", - // |_, this, entity: LuaReflectValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result>, ErrorProxy> = world - // .proxy_call(entity, |entity| world.get_children(entity)) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Vec>>::new( - // out, - // )) - // }, - // ); - - // methods.add_method( - // "get_parent", - // |_, this, entity: LuaReflectValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result>, ErrorProxy> = - // world - // .proxy_call(entity, |entity| world.get_parent(entity)) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Option>>::new( - // out, - // )) - // }, - // ); - - // methods.add_method( - // "push_children", - // |_, this, args: (LuaReflectValProxy, Vec>)| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(args, |(parent, children)| { - // world.push_children(parent, &children) - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "remove_children", - // |_, this, args: (LuaReflectValProxy, Vec>)| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(args, |(parent, children)| { - // world.remove_children(parent, &children) - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "insert_children", - // |_, - // this, - // args: ( - // LuaReflectValProxy, - // usize, - // Vec>, - // )| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(args, |(parent, index, children)| { - // world.insert_children(parent, index - 1, &children) - // }) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "despawn_recursive", - // |_, this, entity: LuaReflectValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(entity, |entity| world.despawn_recursive(entity)) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method("despawn", |_, this, entity: LuaReflectValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(entity, |entity| world.despawn(entity)) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }); - - // methods.add_method( - // "despawn_descendants", - // |_, this, entity: LuaReflectValProxy| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let out: Result<(), ErrorProxy> = world - // .proxy_call(entity, |entity| world.despawn_descendants(entity)) - // .map_err(mlua::Error::external)?; - - // Ok(TypenameProxy::<_, Nil>::new(out)) - // }, - // ); - - // methods.add_method( - // "query", - // |_, this, mut components: Variadic>| { - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // let mut builder = LuaQueryBuilder::default(); - // let deque = components.0; - // builder.components( - // deque - // .into_iter() - // .map(|mut c| c.unproxy()) - // .collect::>() - // .map_err(tealr::mlu::mlua::Error::external)?, - // ); - // Ok(builder) - // }, - // ); - - // methods.add_method("exit", |lua, this, ()| { - // // TODO: somehow end control flow on lua side - // let world = this.0.read().ok_or_else(|| { - // mlua::Error::external(ScriptError::new_reflection_error("Stale world access")) - // })?; - // world.exit(); - // Ok(()) - // }); - } -} - -// impl LuaProxied for WorldCallbackAccess { -// type Proxy = LuaWorld; -// } +impl UserData for LuaWorld {} impl From<&LuaWorld> for WorldCallbackAccess { fn from(value: &LuaWorld) -> Self { diff --git a/crates/languages/bevy_mod_scripting_lua_derive/CHANGELOG.md b/crates/languages/bevy_mod_scripting_lua_derive/CHANGELOG.md deleted file mode 100644 index cb36e25904..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/CHANGELOG.md +++ /dev/null @@ -1,16 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_lua_derive-v0.6.0...bevy_mod_scripting_lua_derive-v0.7.0) - 2024-11-03 - -### Other - -- Migrate to bevy 0.14 ([#127](https://github.com/makspll/bevy_mod_scripting/pull/127)) -- Fix cross-platform CI.yml ([#111](https://github.com/makspll/bevy_mod_scripting/pull/111)) -- update metadata diff --git a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml deleted file mode 100644 index 68b9016e77..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "bevy_mod_scripting_lua_derive" -version = "0.9.0-alpha.1" -authors = ["Maksymilian Mozolewski "] -edition = "2021" -license = "MIT OR Apache-2.0" -description = "Necessary functionality for Lua support with bevy_mod_scripting" -repository = "https://github.com/makspll/bevy_mod_scripting" -homepage = "https://github.com/makspll/bevy_mod_scripting" -keywords = ["bevy", "gamedev", "scripting", "rhai"] -categories = ["game-development"] -readme = "readme.md" - -[package.metadata.release] -pre-release-replacements = [ - { file = "Cargo.toml", search = '^version\s*=\s*.*$', replace = "version = \"{{version}}\"", exactly = 1 }, - { file = "Cargo.toml", search = '^(?Pbevy_mod_scripting_common\s*=.*)version\s*=\s*".*"(?P.*)$', replace = "${h}version = \"{{version}}\"${t}", exactly = 1 }, -] - -[lib] -name = "bevy_mod_scripting_lua_derive" -path = "src/lib.rs" -proc-macro = true - -[dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.9.0-alpha.1" } -paste = "1.0.7" -darling = "0.20" -syn = { version = "2.0.38", features = ["full", "fold", "extra-traits"] } -quote = "1.0.8" -proc-macro2 = "1.0" -convert_case = "0.5.0" -rustdoc-types = "0.11.0" -serde = { version = "1.0", features = ["derive"] } -serde_derive = "1.0.137" -indexmap = { version = "1.9.1", features = ["serde"] } -strum = { version = "0.24.1", features = ["derive"] } -vec1 = "1.10.1" diff --git a/crates/languages/bevy_mod_scripting_lua_derive/readme.md b/crates/languages/bevy_mod_scripting_lua_derive/readme.md deleted file mode 100644 index e058ed4f00..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# bevy_mod_scripting_lua_derive - -This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua_derive/src/arg.rs b/crates/languages/bevy_mod_scripting_lua_derive/src/arg.rs deleted file mode 100644 index ece327f326..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/src/arg.rs +++ /dev/null @@ -1,119 +0,0 @@ -#![allow(clippy::manual_unwrap_or_default)] // from darling - -use std::collections::HashMap; - -use bevy_mod_scripting_common::input::{SimpleType, VisitSimpleType}; -use darling::FromAttributes; -use proc_macro2::{Ident, Span}; -use quote::{quote, quote_spanned}; -use syn::{parse_quote, token::Mut}; - -use crate::visitor::{LuaSimpleTypeArgumentUnwrapper, LuaTypeConstructorVisitor}; - -#[derive(Debug, FromAttributes)] -#[darling(attributes(proxy))] -pub struct ArgAttributes { - #[darling(default)] - pub map: HashMap, -} - -/// Struct for holding argument/output information in functions passed via `functions[..]` meta -#[derive(Debug)] -pub struct Arg { - // pub attrs: ArgAttributes, - pub mutability: Option, - /// the type of the argument, only suported patterns are allowed - pub name: Ident, - /// variant specific data enumeration - pub type_: SimpleType, - /// if an argument is raw, it's passed without any unwrapping to the handler function - /// if an argument isn't annotated with the `proxy` flag it is technically raw, but this is different for receiver and output arguments - pub is_raw: bool, - pub span: Span, -} - -impl Arg { - pub fn new( - // attrs: ArgAttributes, - name: Ident, - mutability: Option, - type_: SimpleType, - is_raw: bool, - ) -> Self { - Self { - // attrs, - mutability, - span: name.span(), - name, - type_, - is_raw, - } - } - - /// Unpacks non-reference proxy parameters (using the `inner` method) yielding expressions which correspond to the proxied type with conversion errors being - /// handled by the try `?` operator. - pub fn unpack_parameter(&self) -> syn::Result> { - let name = &self.name; - if self.is_raw { - // raw parameters DO NOT get unpacked, they get passed directly to the handling method as is - Ok(None) - } else { - // if a proxy parameter is to be passed by value we use inner (which requires Clone to be supported) - Ok(Some( - LuaSimpleTypeArgumentUnwrapper::new(name.clone(), name.span()) - .visit(&self.type_)?, - )) - } - } - - fn arg_signature_generic( - &self, - expecting_receiver: bool, - expecting_ctxt: bool, - ) -> (proc_macro2::TokenStream, proc_macro2::TokenStream) { - assert!(!(expecting_receiver && expecting_ctxt)); - - let _mut = &self.mutability; - let name = &self.name; - let type_ = if expecting_ctxt { - parse_quote!(&bevy_mod_scripting_lua::prelude::Lua) - } else { - LuaTypeConstructorVisitor::new(true, self.type_.contains_proxy_type()) - .visit(&self.type_) - }; - let forced_ref = expecting_receiver.then(|| { - Some(quote_spanned!(self.span=> - & #_mut - )) - }); - - let name_part = quote_spanned!(self.span=> - #_mut #name - ); - let type_part = quote_spanned!(self.span=> - #forced_ref #type_ - ); - (name_part, type_part) - } - - /// Generates the arg signature in an mlua `UserDataFields` or `UserDataMethods` closure for a receiver type argument. - /// generates using an additional outer reference. - pub fn arg_signature_receiver(&self) -> proc_macro2::TokenStream { - let (name, type_) = self.arg_signature_generic(true, false); - quote!(#name : #type_) - } - - /// Generates the arg signature in an mlua `UserDataFields` or `UserDataMethods` closure for a Lua context type argument. - /// generates using an additional outer reference. - pub fn arg_signature_context(&self) -> proc_macro2::TokenStream { - let (name, type_) = self.arg_signature_generic(false, true); - quote!(#name : #type_) - } - - /// Generates the arg signature in an mlua `UserDataFields` or `UserDataMethods` closure for a non-receiver non-context argument. - /// generates the type to match the argument received. - /// The output is split into the name and type parts - pub fn arg_signature(&self) -> (proc_macro2::TokenStream, proc_macro2::TokenStream) { - self.arg_signature_generic(false, false) - } -} diff --git a/crates/languages/bevy_mod_scripting_lua_derive/src/function.rs b/crates/languages/bevy_mod_scripting_lua_derive/src/function.rs deleted file mode 100644 index 29241a912e..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/src/function.rs +++ /dev/null @@ -1,602 +0,0 @@ -#![allow(clippy::manual_unwrap_or_default)] // from darling - -use bevy_mod_scripting_common::input::{ - DuoPath, IdentifierRenamingVisitor, Reference, SimpleType, VisitSimpleType, -}; -use darling::{util::Flag, FromAttributes, FromMeta}; -use proc_macro2::{Ident, Span}; -use quote::{format_ident, quote, quote_spanned, ToTokens}; -use strum::{Display, EnumIter, EnumString}; -use syn::{ - punctuated::Punctuated, spanned::Spanned, visit_mut::VisitMut, Block, LitInt, LitStr, Meta, - Path, Token, -}; -use vec1::Vec1; - -use crate::{ - arg::Arg, - signature::Signature, - visitor::{LuaSimpleTypeWrapper, LuaTypeConstructorVisitor}, - PROXY_OUT_ALIAS, RAW_OUT_ALIAS, SELF_ALIAS, -}; - -#[derive(Default, FromMeta, Display, EnumString, EnumIter, PartialEq, Eq, Clone, Copy, Debug)] -#[darling(rename_all = "PascalCase")] -pub enum FunctionKind { - Function, - MetaFunction, - #[default] - Method, - MetaMethod, - MutableFunction, - MutableMetaFunction, - MutatingMethod, - MutatingMetaMethod, - FieldGetterMethod, - FieldSetterMethod, -} - -impl FunctionKind { - pub fn expects_receiver(self) -> bool { - self == FunctionKind::Method - || self == FunctionKind::MetaMethod - || self == FunctionKind::MutatingMethod - || self == FunctionKind::MutatingMetaMethod - || self == FunctionKind::FieldGetterMethod - || self == FunctionKind::FieldSetterMethod - } - - pub fn is_field(self) -> bool { - self == FunctionKind::FieldGetterMethod || self == FunctionKind::FieldSetterMethod - } - - pub fn is_field_getter(self) -> bool { - self == FunctionKind::FieldGetterMethod - } - - /// Returns true if the mlua closure signature accepts a tuple for general 'Arguments' to the function - /// I.e. arguments freely passed to the function by the caller. - pub fn expects_arguments_tuple(self) -> bool { - self != FunctionKind::FieldGetterMethod - } - - pub fn get_tealr_function(self) -> &'static str { - match self { - FunctionKind::Function => "add_function", - FunctionKind::MetaFunction => "add_meta_function", - FunctionKind::Method => "add_method", - FunctionKind::MetaMethod => "add_meta_method", - FunctionKind::MutableFunction => "add_function_mut", - FunctionKind::MutableMetaFunction => "add_meta_function_mut", - FunctionKind::MutatingMethod => "add_method_mut", - FunctionKind::MutatingMetaMethod => "add_meta_method_mut", - FunctionKind::FieldGetterMethod => "add_field_method_get", - FunctionKind::FieldSetterMethod => "add_field_method_set", - } - } - - pub fn is_meta(self) -> bool { - self == FunctionKind::MetaMethod - || self == FunctionKind::MetaFunction - || self == FunctionKind::MutatingMetaMethod - || self == FunctionKind::MutableMetaFunction - } -} - -/// The attributes which can be applied to lua functions using the -/// `lua(..)` meta attribute -#[derive(Debug, FromAttributes)] -#[darling(attributes(lua))] -pub struct FunctionAttributes { - /// Marks the function to be treated as raw meaning a lot of the wrapping and unwrapping is skipped, - /// a 'Lua' ctxt argument is then expected - pub raw: Flag, - - /// Marks the function as a composite with the given ID, at least one another function with the same composite - /// ID must exist resulting in a combined function being generated. The actual function to dispatch to will be decided based on - /// the types of arguments. If the signature is invalid (i.e. doesn't allow us to dispatch) an error will be thrown - #[darling(default)] - pub composite: Option, - - /// If passed provides the name of the metamethod to use for metamethod based functions - /// the name of the function is used to decide what rust function to call in this case - #[darling(default)] - pub metamethod: Option, - - /// The kind of function to generate on the proxy - #[darling(default)] - pub kind: FunctionKind, - - /// Marks this to be ignored, only used for fields as functions are opt-in - pub skip: Flag, - - /// Meta to pass down to the output proxy or in case of fields - /// used as the argument meta for type being get/set - pub output: Option, - - /// If passed will generate statement before calling the method - /// on the type - pub as_trait: Option, - - #[darling(multiple)] - pub doc: Vec, -} - -/// A function which combines the signatures of multiple functions, -/// and dispatches to the one which matches the signature if any -/// Useful for binary operators which can accept many types on both sides -#[derive(Debug)] -pub struct CompositeFunction { - pub functions: Vec1, -} - -/// A struct corresponding to each function in the functions[...] meta list. -/// -#[derive(Debug)] -pub struct Function { - pub name: Ident, - pub attrs: FunctionAttributes, - pub sig: Signature, - pub default: Option, - pub span: Span, - pub is_unsafe: bool, -} - -impl Function { - pub fn new( - name: Ident, - attrs: FunctionAttributes, - default: Option, - sig: Signature, - span: Span, - is_unsafe: bool, - ) -> darling::Result { - Ok(Self { - name, - attrs, - sig, - default, - span, - is_unsafe, - }) - } - - /// Tries to retrieve the receiver argument from functions. - /// If not expected returns None and Some otherwise. - /// If the function is of the wrong kind or does not have the correct signature an error is thrown - pub fn self_arg(&self) -> syn::Result> { - if self.attrs.kind.expects_receiver() { - self.get_self_arg().map(Option::Some) - } else { - Ok(None) - } - } - - /// Returns an error if self arg is not there and returns it otherwise - pub fn get_self_arg(&self) -> syn::Result<&Arg> { - self.sig.inputs.first().ok_or_else(|| { - syn::Error::new( - self.sig.span, - "Expected receiver as first argument in the signature".to_string(), - ) - }) - } - - /// Tries to retrieve the context argument from raw functions. - /// If the function is not raw or doesn't have a correct signature an error is thrown - pub fn ctxt_arg(&self) -> syn::Result> { - if self.attrs.raw.is_present() { - self.get_ctxt_arg().map(Option::Some) - } else { - Ok(None) - } - } - - /// Returns an error if no context argument is found in the correct place or returns it otherwise - pub fn get_ctxt_arg(&self) -> syn::Result<&Arg> { - let ctxt_idx = if self.attrs.kind.expects_receiver() { - 1 - } else { - 0 - }; - self.sig.inputs.get(ctxt_idx).ok_or_else(|| { - syn::Error::new( - self.sig.span, - format!( - "Expected ctxt argument in the signature as argument number: `{}`", - ctxt_idx + 1 - ), - ) - }) - } - - /// Retrieves the rest of the arguments (after the receiver and context args) - /// If they are expected, otherwise returns None. - /// If arguments are expected but none are present Some(vec![]) is returned - /// If input vec is shorter than expected, i.e. if the receiver should be there but isn't returns an Err - pub fn other_arguments(&self) -> syn::Result>> { - if self.attrs.kind.expects_arguments_tuple() { - self.get_other_arguments().map(Option::Some) - } else { - Ok(None) - } - } - - pub fn get_other_arguments(&self) -> syn::Result> { - let other_args_idx = - self.attrs.kind.expects_receiver() as usize + self.attrs.raw.is_present() as usize; - - if self.sig.inputs.len() < other_args_idx { - return Err(syn::Error::new( - self.sig.span, - format!("Signature too short, expected {other_args_idx} arguments before this one"), - )); - } - - Ok(self.sig.inputs.iter().skip(other_args_idx)) - } - - /// Converts the function's arguments into closure arguments for use in the closures given to mlua calls - /// - /// # Example - /// ```rust,ignore - /// // the function: - /// fn foo(self, my_str : String){} - /// // would convert to - /// // | _, my_proxy: MyLua, (my_str): (String) | - /// // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- these bits - /// ``` - pub fn generate_mlua_args(&self) -> syn::Result { - let self_arg = self.self_arg()?.map(Arg::arg_signature_receiver); - - let ctxt_arg = self - .ctxt_arg()? - .map(Arg::arg_signature_context) - .unwrap_or_else(|| quote!(_)); - - let other_args = self.other_arguments()?.map(|args| { - let (other_arg_names, other_arg_types) = - args.map(Arg::arg_signature).unzip::<_, _, Vec<_>, Vec<_>>(); - - quote_spanned!(self.sig.span=> - (#(mut #other_arg_names),*) : (#(#other_arg_types),*) - ) - }); - - Ok(vec![Some(ctxt_arg), self_arg, other_args] - .into_iter() - .filter(Option::is_some) - .collect::, Token![,]>>() - .to_token_stream()) - } - - /// Takes all the argument identifiers passed into the function, generates assignments which shadow the original - /// identifiers but modifies the parameter types if required by unpacking proxies. This is done via `.inner` calls on proxy wrappers - /// - /// For example for the type `MyType` - /// `fn my_fn(self, #[proxy] other_ref: &Self, #[proxy] other: Self)` - /// - /// will generate the following statements: - /// ```rust,ignore - /// let _self : MyType = self.inner(); - /// let other_ref : LuaMyType = other; // note this one is kept as a wrapper, and dealt in another process - /// let other : MyType = other_ref.inner(); - /// ``` - fn generate_mlua_body_unwrapped_parameter_assignments( - &self, - ) -> syn::Result { - Ok(self - .sig - .inputs - .iter() - .map(Arg::unpack_parameter) - .collect::>>()? - .iter() - .zip(self.sig.inputs.iter()) - .filter_map(|(unpacked_param, arg)| { - unpacked_param.as_ref().map(|unpacked_param| { - let name = &arg.name; - quote_spanned! {name.span()=>let mut #name = #unpacked_param;} - }) - }) - .collect::()) - } - - /// Similar to generate_mlua_body_output but for functions, makes some more assumptions and directly generates wrapped/unwrapped output depending on what's necessary - /// Does not require another wrapping step and can be directly put in a result as the final output of an mlua closure - fn generate_mlua_body_output_field( - &self, - raw_output_ident: &Ident, - ) -> syn::Result { - let field_type = if self.attrs.kind.is_field_getter() { - &self.sig.output - } else { - self.get_other_arguments()?.next() - .ok_or_else(|| syn::Error::new(self.sig.span, format!("Setter lua method with no arguments, expected at least one argument in function: `{}`", self.name)))? - }; - // we need to figure out which type of field access this is going to be - let self_name = &self.get_self_arg()?.name; - let ctxt_name = &self.get_ctxt_arg()?.name; - let world_ptr = quote!( - - ::get_world(#ctxt_name)? - ); - - let field_name = { - let str_name = self.name.to_string(); - - if str_name.starts_with('_') && str_name[1..].parse::().is_ok() { - syn::Lit::Int(LitInt::new(&str_name[1..], self.name.span())).to_token_stream() - } else { - self.name.clone().to_token_stream() - } - }; - let field_name_str = syn::Lit::Str(LitStr::new(&self.name.to_string(), self.name.span())); - let proxy_output_type = - LuaTypeConstructorVisitor::new(true, false).visit(&field_type.type_); - - Ok(match &field_type.type_ { - // proxy, need to index into it then wrap the result - // getter - t if t.contains_proxy_type() && self.attrs.kind.is_field_getter() => quote!( - let #raw_output_ident = #proxy_output_type::new_ref(bevy_script_api::script_ref::ValueIndex::index(& #self_name.reflect_ref(#world_ptr), std::borrow::Cow::Borrowed(#field_name_str))); - ), - // setter - t if t.contains_proxy_type() => { - let first_arg_name = &self - .get_other_arguments()? - .next() - .ok_or_else(|| { - syn::Error::new( - self.sig.span, - "Field setter requires a single argument which is missing", - ) - })? - .name; - quote!( - let #raw_output_ident = #first_arg_name.apply_self_to_base(&mut bevy_script_api::script_ref::ValueIndex::index(& #self_name.reflect_ref(#world_ptr), std::borrow::Cow::Borrowed(#field_name_str)))?; - ) - } - - // plain reflection, index into the ReflectReference with the field path - // getter - SimpleType::Type(syn::Type::Path(path)) - if path.path.is_ident("ReflectedValue") && self.attrs.kind.is_field_getter() => - { - quote!( - let #raw_output_ident = bevy_script_api::script_ref::ValueIndex::index(& #self_name.reflect_ref(#world_ptr), std::borrow::Cow::Borrowed(#field_name_str)); - ) - } - // setter - SimpleType::Type(syn::Type::Path(path)) if path.path.is_ident("ReflectedValue") => { - let first_arg_name = &self - .get_other_arguments()? - .next() - .ok_or_else(|| { - syn::Error::new( - self.sig.span, - "Field setter requires a single argument which is missing", - ) - })? - .name; - quote!( - let #raw_output_ident = bevy_script_api::script_ref::ValueIndex::index(& #self_name.reflect_ref(#world_ptr), std::borrow::Cow::Borrowed(#field_name_str)).apply(&#first_arg_name.ref_)?; - ) - } - - // primitive use clone on the value and return it without a wrapper - // getter - _ if self.attrs.kind.is_field_getter() => quote!( - let #raw_output_ident = #self_name.val(|#self_name| #self_name.#field_name.clone())?; - ), - // setter - _ => { - let first_arg_name = &self - .get_other_arguments()? - .next() - .ok_or_else(|| { - syn::Error::new( - self.sig.span, - "Field setter requires a single argument which is missing", - ) - })? - .name; - quote!( - let #raw_output_ident = #self_name.val_mut(|#self_name| #self_name.#field_name = #first_arg_name)?; - ) - } - }) - } - - /// Generates the statement which calls the proxied function with the same argument names as in the function declaration - /// and stores the output in a variable with the given identifier. Static methods, are called against the given `proxied_name` - /// - /// For example for the type `MyType` with proxied ident `__proxied_out` - /// `fn my_fn(self, #[proxy] other_ref: &Self, #[proxy] other: Self) -> Self` - /// - /// will generate the following statement: - /// ```rust,ignore - /// let __proxied_out : MyType = self.my_fn(other_ref, other); - /// ``` - fn generate_mlua_body_raw_output( - &self, - raw_output_ident: &Ident, - proxied_type_path: &Path, - ) -> syn::Result { - // generate function call on proxied type (operating over unwrapped parameters) - // output will be stored in raw_output_ident with the proxied_type_path - - // the type before we wrap it in a proxy - let raw_output_type = - LuaTypeConstructorVisitor::new(false, false).visit(&self.sig.output.type_); - - match &self.default { - Some(body) => { - let stmts = body.stmts.iter().cloned().map(|mut s| { - IdentifierRenamingVisitor { - target: "self", - replacement: SELF_ALIAS, - } - .visit_stmt_mut(&mut s); - s - }); - - Ok(quote_spanned! {body.span()=> - let #raw_output_ident : #raw_output_type = - (||{ - #(#stmts)* - })(); - }) - } - None => { - let function_name = &self.name; - let param_names = self - .sig - .inputs - .iter() - .map(|arg| &arg.name) - .collect::>(); - - // override this span, as otherwise spans propagate weird - let mut proxied_name = proxied_type_path.clone(); - - proxied_name - .segments - .iter_mut() - .for_each(|v| v.ident.set_span(self.sig.span)); - - let method_path = if let Some(trait_path) = &self.attrs.as_trait { - quote_spanned!(self.sig.span=> - #trait_path::#function_name - ) - } else { - quote_spanned!(self.sig.span=> - #proxied_name::#function_name - ) - }; - - Ok(quote_spanned! {self.sig.span=> - let #raw_output_ident : #raw_output_type = - #method_path(#(#param_names),*); - }) - } - } - } - - /// Generates a wrapping statement, which if the type present in the `proxied_output_ident` variable needs to be wrapped into a proxy constructor, will do so and assign - /// the output to the given `proxy_output_ident`. - /// - /// For example for the type: `MyType` with `__proxy_out output` identifier - /// the function: `fn my_fn(self, #[proxy] other_ref: &Self, #[proxy] other: Self) -> Self` - /// will generate the following statement: - /// ```rust,ignore - /// let __proxy_out : LuaMyType = LuaMyType::new(__proxied_out); - /// ``` - fn generate_mlua_body_proxy_output( - &self, - proxied_output_ident: &Ident, - proxy_output_ident: &Ident, - ) -> syn::Result { - if self.sig.output.is_raw { - return Ok(quote_spanned! {self.sig.span=> - let #proxy_output_ident = #proxied_output_ident; - }); - } - - // generate `new` calls as required to build proxy stored in out_ident - let constructor_wrapped_expression = - LuaSimpleTypeWrapper::new(proxied_output_ident.clone(), proxied_output_ident.span()) - .visit(&self.sig.output.type_)?; - - // the type of the wrapped type (if wrapped) - let proxy_output_type = - LuaTypeConstructorVisitor::new(true, false).visit(&self.sig.output.type_); - - // the statement assigning the proxy output to proxy_output_ident - Ok(quote_spanned! {self.sig.span=> - let #proxy_output_ident : #proxy_output_type = #constructor_wrapped_expression; - }) - } - - pub fn generate_mlua_body( - &self, - proxied_type_path: &Path, - ) -> syn::Result { - let unpacked_parameter_declarations = - self.generate_mlua_body_unwrapped_parameter_assignments()?; - - let raw_output_ident = format_ident!("{RAW_OUT_ALIAS}", span = self.sig.span); - let proxy_output_ident = format_ident!("{PROXY_OUT_ALIAS}", span = self.sig.span); - - let raw_output_stmt = if self.attrs.kind.is_field() { - self.generate_mlua_body_output_field(&raw_output_ident)? - } else { - self.generate_mlua_body_raw_output(&raw_output_ident, proxied_type_path)? - }; - - // for fields the output is expected to be raw anyway so this will just performa no-op - let proxy_output_stmt = - self.generate_mlua_body_proxy_output(&raw_output_ident, &proxy_output_ident)?; - - // determine if we need to wrap the output in an Ok() statement - let last_stm = match &self.sig.output.type_ { - SimpleType::DuoPath(DuoPath { ident, .. }) if *ident == "Result" => { - quote_spanned! {self.sig.span=>#proxy_output_ident} - } - _ => quote_spanned! {self.sig.span=>Ok(#proxy_output_ident)}, - }; - - let conversion_body_stms = quote!( - #raw_output_stmt - #proxy_output_stmt - #last_stm - ); - - // for every argument which is a reference, we need a separate sort of call, - // we cannot use `v.inner()` since this operates over values, we must use `val_mut` or `val` to get a reference to the wrapped - // structure for the duration of the call - let conversion_body_surrounded_with_dereferening_stms = - self.sig - .inputs - .iter() - .fold(conversion_body_stms, |acc, arg_meta| { - // only proxy types which are directly inside a reference are supported as references - if !matches!(arg_meta.type_, SimpleType::Reference(Reference{ ref inner, .. }) - if matches!(inner.as_ref(), SimpleType::ProxyType(_))) - { - return acc; - } - // raw arguments are passed directly to the handler function - if arg_meta.is_raw { - return acc; - } - - let method_call = if arg_meta.type_.has_outer_mut_ref() { - format_ident!("val_mut", span = arg_meta.span) - } else { - format_ident!("val", span = arg_meta.span) - }; - - let arg_name = &arg_meta.name; - - quote_spanned! {self.sig.span=>{ - #arg_name.#method_call(|mut #arg_name| {#acc})? - }} - }); - let out = quote!( - #unpacked_parameter_declarations - #conversion_body_surrounded_with_dereferening_stms - ); - - if self.is_unsafe { - Ok(quote_spanned! {self.sig.span=> - unsafe { - #out - } - }) - } else { - Ok(out) - } - } -} diff --git a/crates/languages/bevy_mod_scripting_lua_derive/src/lib.rs b/crates/languages/bevy_mod_scripting_lua_derive/src/lib.rs deleted file mode 100644 index 1b919e156a..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/src/lib.rs +++ /dev/null @@ -1,543 +0,0 @@ -use std::collections::HashMap; - -use arg::Arg; -use bevy_mod_scripting_common::{input::*, utils::doc_attribute_to_string_lit}; -use syn::{parse_macro_input, DeriveInput, Variant}; -use syn::{ - parse_quote, spanned::Spanned, AttrStyle, Attribute, Field, Meta, Path, Token, TraitItemFn, -}; - -use crate::function::*; -use crate::signature::*; -use darling::{FromAttributes, FromDeriveInput}; -use function::FunctionAttributes; -use proc_macro::TokenStream; -use proc_macro2::*; -use quote::*; -use vec1::{vec1, Vec1}; -pub(crate) mod arg; -pub(crate) mod function; -pub(crate) mod signature; -pub(crate) mod visitor; - -const SELF_ALIAS: &str = "_self"; -const RAW_OUT_ALIAS: &str = "__proxied_out"; -const PROXY_OUT_ALIAS: &str = "__proxy_out"; -const PROXY_PREFIX: &str = "Lua"; -const VALID_META_METHODS: [&str; 27] = [ - "Add", "Sub", "Mul", "Div", "Mod", "Pow", "Unm", "IDiv", "BAnd", "BOr", "BXor", "BNot", "Shl", - "Shr", "Concat", "Len", "Eq", "Lt", "Le", "Index", "NewIndex", "Call", "ToString", "Pairs", - "IPairs", "Iter", "Close", -]; - -/// Takes in field with all the required meta and converts it into a -/// TraitItemFn representation -fn convert_field_to_lua_accessor( - idx: usize, - field: &Field, - is_setter: bool, -) -> darling::Result { - let field_name = field - .ident - .clone() - .unwrap_or_else(|| format_ident!("_{}", idx)); - let field_type = &field.ty; - let attrs = &field.attrs; - let mut setter_args: Option = None; - if let Some(attr) = attrs.iter().find(|attr| attr.meta.path().is_ident("lua")) { - attr.parse_nested_meta(|nested| { - if nested.path.is_ident("output") { - nested.parse_nested_meta(|nested| { - setter_args = Some(nested.input.parse()?); - Ok(()) - })? - } - Ok(()) - })?; - } - let setter_arg_attrs = setter_args.map(|tokens| Attribute { - pound_token: Token![#](field.span()), - style: AttrStyle::Outer, - bracket_token: Default::default(), - meta: syn::Meta::List(syn::MetaList { - path: Ident::new("proxy", field.span()).into(), - delimiter: syn::MacroDelimiter::Paren(Default::default()), - tokens, - }), - }); - let trait_item_method: TraitItemFn = if is_setter { - parse_quote! { - #[lua(kind="FieldSetterMethod", raw)] - #(#attrs)* - fn #field_name (&mut self, lua: &Lua, #setter_arg_attrs other: #field_type); - } - } else { - parse_quote! { - #[lua(kind="FieldGetterMethod", raw)] - #(#attrs)* - fn #field_name (&self, lua: &Lua) -> #field_type; - } - }; - - Ok(trait_item_method) -} - -/// Removes functions from the list and matches them up based on composite ID's into a unified struct -fn extract_composite_functions(functions: &mut Vec) -> Vec { - let indices = functions - .iter() - .enumerate() - .filter_map(|(idx, elem)| { - if elem.attrs.composite.is_some() { - Some(idx) - } else { - None - } - }) - .rev() // reverse order to avoid double shifting things around - .collect::>(); - - let mut composites: HashMap> = HashMap::with_capacity(indices.len()); - for i in indices { - let f = functions.remove(i); - let name = &f.attrs.composite.as_ref().unwrap(); - if composites.contains_key(name.as_str()) { - composites.get_mut(name.as_str()).unwrap().push(f); - } else { - composites.entry((*name).to_owned()).or_insert(vec1![f]); - } - } - - composites - .into_values() - .map(|functions| CompositeFunction { functions }) - .collect() -} - -fn build_function( - proxied_type_path: &Path, - function_def: TraitItemFn, -) -> darling::Result> { - let attrs = FunctionAttributes::from_attributes(&function_def.attrs)?; - // if skipping return no-op - if attrs.skip.is_present() { - return Ok(None); - }; - - let span = function_def.span(); - - let function_name = function_def.sig.ident.clone(); - let output_attrs = attrs - .output - .clone() - .map(|meta| { - let meta = meta.require_list()?.parse_args::()?; - Ok::<_, syn::Error>(vec![Attribute { - pound_token: Token![#](meta.span()), - style: AttrStyle::Outer, - bracket_token: Default::default(), - meta, - }]) - }) - .transpose()? - .unwrap_or_default(); - - let is_unsafe = function_def.sig.unsafety.is_some(); - - let signature = Signature::new( - proxied_type_path.clone(), - function_def.sig, - attrs.raw.is_present(), - output_attrs, - )?; - Function::new( - function_name.clone(), - attrs, - function_def.default, - signature, - span, - is_unsafe, - ) - .map(Option::Some) -} - -/// generates either the string function name or the MetaMethod type path depending if it's a valid meta method -fn generate_mlua_function_name(function: &Function) -> syn::Result { - let function_name = &function.name; - let tealr = quote!(bevy_mod_scripting_lua::tealr::mlu::mlua); - if function.attrs.kind.is_meta() { - let metamethod = function.attrs.metamethod.as_ref().ok_or_else(|| { - syn::Error::new( - function.span, - "Missing `metamethod` lua proxy attribute, required for meta functions.", - ) - })?; - // check is valid meta method if not use custom name - if VALID_META_METHODS.contains(&metamethod.to_string().as_str()) { - Ok(quote!(#tealr::MetaMethod::#metamethod)) - } else { - let std_string = metamethod.to_string(); - Ok(quote!(#tealr::MetaMethod::Custom(#std_string.to_string()))) - } - } else { - Ok(function_name.to_string().to_token_stream()) - } -} - -/// Given a function with correct meta and the name of the proxied type will generate mlua statement -/// which will register the given function within an appropriate mlua container `UserDataMethods` or `UserDataFields` -/// i.e.: -/// ```rust,ignore -/// /// docs -/// fields.#tealr_function(#signature, #closure) -/// // or -/// -/// /// docs -/// methods.#tealr_function(#signature, #closure) -/// ``` -/// depending on if the function is a field accessor or a method/function -fn generate_mlua_registration_code( - container_ident: Ident, - proxied_type_path: &Path, - function: Function, -) -> darling::Result { - let method_documentation_calls = function - .attrs - .doc - .iter() - .map(|tkns| quote_spanned!(function.span=>#container_ident.document_type(#tkns))); - - let tealr_function = format_ident!( - "{}", - function.attrs.kind.get_tealr_function(), - span = function.span - ); - let signature = generate_mlua_function_name(&function)?; - - let args = function.generate_mlua_args()?; - let body = function.generate_mlua_body(proxied_type_path)?; - - Ok(quote_spanned! {body.span()=> - #(#method_documentation_calls);* - #container_ident.#tealr_function(#signature,|#args| { - #body - }); - }) -} - -/// Same as generate_mlua_registration_code but for composite functions -fn generate_mlua_registration_code_composite( - container_ident: Ident, - proxied_type_path: &Path, - functions: CompositeFunction, -) -> darling::Result { - let tealr = quote!(bevy_mod_scripting_lua::tealr::mlu); - let mut method_documentation_calls = Vec::default(); - let first = functions.functions.first(); - // take the first functions for function signature from the composite - let tealr_function = format_ident!( - "{}", - first.attrs.kind.get_tealr_function(), - span = first.span - ); - let signature = generate_mlua_function_name(first)?; - let (main_arg_names, main_arg_types) = first - .get_other_arguments()? - .map(|a| (a.name.clone(), quote!(#tealr::mlua::Value))) - .unzip::<_, _, Vec<_>, Vec<_>>(); - - let dispatchers = - functions - .functions - .iter() - .map(|function| { - // this is much easier, receivers need special treatment on mlua side - // function args are treated equally, we just need a union for lhs and rhs then to convert those args and - // pass dispatch them to the appropriate function - if function.attrs.kind.expects_receiver() || function.attrs.raw.is_present() { - return Err(syn::Error::new( - function.span, - "Composite functions with receivers are not supported, use a function instead", - )); - } - - method_documentation_calls.extend(function.attrs.doc.iter().map( - |tkns| quote_spanned!(function.span=>#container_ident.document_type(#tkns);), - )); - - let (arg_names, arg_types) = function - .sig - .inputs - .iter() - .map(Arg::arg_signature) - .unzip::<_, _, Vec<_>, Vec<_>>(); - let body = function.generate_mlua_body(proxied_type_path)?; - Ok(quote_spanned!(function.span=> - match (#(<#arg_types as #tealr::mlua::FromLua>::from_lua(#main_arg_names.clone(), ctxt)),*) { - (#(Ok(#arg_names)),*) => { - let out = { - #body - }; - return out.and_then(|out| #tealr::mlua::IntoLua::into_lua(out, ctxt)) - }, - _ => (), - }; - )) - }) - .collect::>>()?; - - // let (variant_idents, variant_types) = unique_types.iter().unzip(); - // let composite_id = Ident::new(&functions.id, first.span); - let composite = quote_spanned! {first.span=> - // bevy_script_api::impl_tealr_any_union!(#composite_id = #(#variant_idents: #variant_types),*) - #(#method_documentation_calls)* - #container_ident.#tealr_function(#signature,|ctxt, (#(#main_arg_names),*) : (#(#main_arg_types),*)| { - #(#dispatchers)* - Err(#tealr::mlua::Error::RuntimeError( - format!("Function `{}` has no overloaded version accepting argument types: `{}`", - #signature, - vec![#(#main_arg_names.type_name()),*].join(", ") - ) - ) - ) - }); - }; - Ok(composite) -} - -#[proc_macro_derive(LuaProxy, attributes(lua, proxy))] -pub fn impl_lua_proxy(input: TokenStream) -> TokenStream { - let derive_input = parse_macro_input!(input as DeriveInput); - - let meta: ProxyInput = match ProxyInput::from_derive_input(&derive_input) { - Ok(v) => v, - Err(e) => return darling::Error::write_errors(e).into(), - }; - if meta.proxy_name.is_some() { - // throw error - return syn::Error::new( - derive_input.span(), - "The `name` attribute is not supported for lua proxies", - ) - .to_compile_error() - .into(); - } - - let proxied_type_path: syn::Path = meta.remote.unwrap_or(meta.ident.clone().into()); - let proxied_type_str = proxied_type_path.segments.last().unwrap().ident.to_string(); - let proxy_type_ident = format_ident!("{PROXY_PREFIX}{}", &meta.ident); - let tealr = quote!(bevy_mod_scripting_lua::tealr::mlu); - - // optional clone extensions - let opt_with_clone = meta - .derive - .clone - .is_present() - .then_some(quote_spanned! {derive_input.span()=>with Clone}) - .unwrap_or_default(); - - let opt_from_lua_proxy = meta.derive.clone.is_present().then_some( - quote_spanned!{derive_input.span()=> - impl bevy_script_api::lua::FromLuaProxy<'_> for #proxied_type_path { - fn from_lua_proxy<'lua>(lua_value: #tealr::mlua::Value<'lua>, _: &'lua #tealr::mlua::Lua) -> #tealr::mlua::Result { - if let #tealr::mlua::Value::UserData(ud) = lua_value{ - let wrapper = ud.borrow::<#proxy_type_ident>()?; - Ok(std::ops::Deref::deref(&wrapper).inner()?) - } else { - Err(#tealr::mlua::Error::FromLuaConversionError{ - from: "Value", - to: #proxied_type_str, - message: None - }) - } - } - } - } - ).unwrap_or_default(); - - // generate type level tealr documentation calls - let type_level_document_calls = meta - .attrs - .iter() - .filter(|&a| a.meta.path().is_ident("doc")) - .map(doc_attribute_to_string_lit) - .map(|tkns| quote_spanned!(derive_input.span()=>methods.document_type(#tkns);)); - - // generate method equivalents for each field, i.e. unify fields and methods as both can be represented as functions - let field_methods: Vec = match meta.data { - darling::ast::Data::::Struct(fields) => { - let mut out: Vec<_> = Default::default(); - let mut errors = darling::Error::accumulator(); - - out.extend( - fields - .iter() - .enumerate() - .filter_map(|(idx, field)| { - errors.handle_in(|| convert_field_to_lua_accessor(idx, field, false)) - }) - .collect::>(), - ); - - out.extend( - fields - .iter() - .enumerate() - .filter_map(|(idx, field)| { - errors.handle_in(|| convert_field_to_lua_accessor(idx, field, true)) - }) - .collect::>(), - ); - - // short circuit if found any errors - if let Err(e) = errors.finish() { - return e.write_errors().into(); - } - - out - } - _ => panic!("Enums or Unions are not supported"), - }; - - let mut errors = darling::Error::accumulator(); - - // generate both tealr documentation and instantiations of functions and field getters/setters - let mut methods = meta - .functions - .0 - .into_iter() - .filter_map(|v| { - errors - .handle_in(|| build_function(&proxied_type_path, v)) - .flatten() - }) - .collect::>(); - - let composites = extract_composite_functions(&mut methods) - .into_iter() - .flat_map(|function| { - errors.handle_in(|| { - generate_mlua_registration_code_composite( - format_ident!("methods", span = function.functions.first().span), - &proxied_type_path, - function, - ) - }) - }) - .collect::>(); - - // for methods, allow composite functions with combined signatures and runtime dispatch based on type - - let fields = field_methods - .into_iter() - .flat_map(|v| { - errors - .handle_in(|| build_function(&proxied_type_path, v)) - .flatten() - }) - .collect::>(); - - let methods = methods - .into_iter() - .map(|function| { - errors.handle_in(|| { - generate_mlua_registration_code( - format_ident!("methods", span = function.span), - &proxied_type_path, - function, - ) - }) - }) - .collect::>(); - - let fields = fields - .into_iter() - .map(|function| { - errors.handle_in(|| { - generate_mlua_registration_code( - format_ident!("fields", span = function.span), - &proxied_type_path, - function, - ) - }) - }) - .collect::>(); - - // stop if any errors so far - if let Err(e) = errors.finish() { - return e.write_errors().into(); - } - - quote_spanned! {derive_input.span()=> - - bevy_script_api::make_script_wrapper!(#proxied_type_path as #proxy_type_ident #opt_with_clone); - bevy_script_api::impl_from_lua_with_clone!(#proxy_type_ident); - bevy_script_api::impl_tealr_type!(#proxy_type_ident); - - #opt_from_lua_proxy - - #[automatically_derived] - #[allow(unused_parens, unused_braces, unused_mut, unused_variables)] - #[allow(clippy::all)] - impl #tealr::TealData for #proxy_type_ident { - fn add_methods<'lua, T: #tealr::TealDataMethods<'lua, Self>>(methods: &mut T) { - #(#type_level_document_calls)* - #(#methods)* - #(#composites)* - } - - fn add_fields<'lua, T: #tealr::TealDataFields<'lua, Self>>(fields: &mut T) { - #(#fields)* - } - } - - #[allow(clippy::all, unused_variables)] - impl bevy_script_api::lua::LuaProxyable for #proxied_type_path { - fn ref_to_lua<'lua>(self_ : bevy_script_api::script_ref::ReflectReference, lua: &'lua #tealr::mlua::Lua) -> #tealr::mlua::Result<#tealr::mlua::Value<'lua>> { - <#proxy_type_ident as #tealr::mlua::IntoLua>::into_lua(#proxy_type_ident::new_ref(self_),lua) - } - - fn apply_lua<'lua>(self_ : &mut bevy_script_api::script_ref::ReflectReference, lua: &'lua #tealr::mlua::Lua, new_val: #tealr::mlua::Value<'lua>) -> #tealr::mlua::Result<()> { - if let #tealr::mlua::Value::UserData(v) = new_val { - let other = v.borrow::<#proxy_type_ident>()?; - let other = &other; - - other.apply_self_to_base(self_)?; - Ok(()) - } else { - Err(#tealr::mlua::Error::RuntimeError( - "Error in assigning to custom user data".to_owned(), - )) - } - } - } - - #[allow(clippy::all, unused_variables)] - impl bevy_script_api::lua::IntoLuaProxy<'_> for #proxied_type_path { - fn to_lua_proxy<'lua>(self, lua: &'lua #tealr::mlua::Lua) -> #tealr::mlua::Result<#tealr::mlua::Value<'lua>>{ - <#proxy_type_ident as #tealr::mlua::IntoLua>::into_lua(#proxy_type_ident::new(self),lua) - } - } - - } - .into() -} - -#[cfg(test)] -mod test { - - use crate::function::FunctionAttributes; - use darling::FromAttributes; - use syn::TraitItemFn; - - #[test] - fn test_parse_function_attributes_parses() { - let function = " - #[lua(output(proxy))] - fn asd(#[proxy] arg: String, #[proxy(Type=\"LuaType\")] arg2: (String, Type)) -> String; - "; - let trait_fn: TraitItemFn = syn::parse_str(function).unwrap(); - - FunctionAttributes::from_attributes(&trait_fn.attrs).unwrap(); - } -} diff --git a/crates/languages/bevy_mod_scripting_lua_derive/src/signature.rs b/crates/languages/bevy_mod_scripting_lua_derive/src/signature.rs deleted file mode 100644 index 05d48fb5a4..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/src/signature.rs +++ /dev/null @@ -1,143 +0,0 @@ -use std::collections::HashMap; - -use bevy_mod_scripting_common::input::SimpleType; -use darling::FromAttributes; -use proc_macro2::{Ident, Span}; -use syn::{ - spanned::Spanned, token::Mut, Attribute, FnArg, Pat, PatIdent, PatType, Path, ReturnType, Type, - TypeTuple, -}; - -use crate::{ - arg::{Arg, ArgAttributes}, - PROXY_PREFIX, RAW_OUT_ALIAS, SELF_ALIAS, -}; - -/// Describes the functional signature of a function from the `functions[..]` list -#[derive(Debug)] -pub struct Signature { - pub inputs: Vec, - pub output: Arg, - pub span: Span, -} - -impl Signature { - /// Creates a new signature struct - /// if in_raw_function will set is_raw on all arguments and outputs to true - /// if is_field_setter, output_attrs will be applied to the third argument of the function if it exists (the first non self or ctxt arg) - pub fn new( - proxied_type_path: Path, - sig: syn::Signature, - in_raw_function: bool, - output_attrs: Vec, - ) -> darling::Result { - // convert output to FnArg - let output_arg_name = Ident::new(RAW_OUT_ALIAS, sig.output.span()); - let span = sig.span(); - // if no return type specified use `()` - let output_type = match sig.output { - ReturnType::Default => Type::Tuple(TypeTuple { - paren_token: Default::default(), - elems: Default::default(), - }), - ReturnType::Type(_, ty) => *ty, - }; - - let inputs = sig - .inputs - .into_iter() - .map(|arg| Self::convert_fn_arg(arg, &proxied_type_path, in_raw_function)) - .collect::>>()?; - - // convert to Arg structs - let output = Self::convert_type( - output_type, - &proxied_type_path, - in_raw_function, - output_attrs, - output_arg_name, - None, - )?; - - Ok(Self { - inputs, - output, - span, - }) - } - - /// Convert a function argument into custom Arg struct by converting the type to SimpleType and parsing attributes - fn convert_fn_arg( - arg: FnArg, - proxied_type_path: &Path, - in_raw_function: bool, - ) -> darling::Result { - let type_map = HashMap::from_iter([( - proxied_type_path.segments.last().unwrap().clone().ident, - None, - )]); - - Ok(match arg { - FnArg::Receiver(ref receiver) => { - let type_ = - SimpleType::new_from_fn_arg(PROXY_PREFIX, &arg, proxied_type_path, &type_map)?; - // let attrs = ArgAttributes::from_attributes(&receiver.attrs)?; - Arg::new( - // attrs, - Ident::new(SELF_ALIAS, receiver.span()), - receiver.mutability, - type_, - in_raw_function, - ) - } - FnArg::Typed(PatType { attrs, pat, ty, .. }) => { - let (mutability, arg_name) = match pat.as_ref() { - Pat::Ident(PatIdent { - mutability, ident, .. - }) => (mutability, ident), - _ => return Err(darling::Error::custom("Unsupported parameter pattern")), - }; - - Self::convert_type( - *ty, - proxied_type_path, - in_raw_function, - attrs, - arg_name.clone(), - *mutability, - )? - } - }) - } - - /// Convert a type corresponding to an argument into an Arg struct by converting it to a Simple type and parsing the given attributes - fn convert_type( - ty: Type, - proxied_type_path: &Path, - in_raw_function: bool, - attrs: Vec, - arg_name: Ident, - mutability: Option, - ) -> darling::Result { - let mut type_map = HashMap::from_iter([( - proxied_type_path.segments.last().unwrap().clone().ident, - None, - )]); - let is_proxy = attrs.iter().any(|a| a.path().is_ident("proxy")); - let attrs = ArgAttributes::from_attributes(&attrs)?; - let type_ = if is_proxy && attrs.map.is_empty() { - SimpleType::new_from_contextual_type_proxy_all(PROXY_PREFIX, &ty, proxied_type_path)? - } else { - type_map.extend(attrs.map.iter().map(|(a, b)| (a.clone(), Some(b.clone())))); - SimpleType::new_from_contextual_type(PROXY_PREFIX, &ty, proxied_type_path, &type_map)? - }; - - Ok(Arg::new( - // attrs, - arg_name, - mutability, - type_, - in_raw_function, - )) - } -} diff --git a/crates/languages/bevy_mod_scripting_lua_derive/src/visitor.rs b/crates/languages/bevy_mod_scripting_lua_derive/src/visitor.rs deleted file mode 100644 index 2dc8ec2b62..0000000000 --- a/crates/languages/bevy_mod_scripting_lua_derive/src/visitor.rs +++ /dev/null @@ -1,386 +0,0 @@ -/// This module contains both `SimpleType` and `syn::Type` visitors to help us with the code generation. -use bevy_mod_scripting_common::input::*; -use proc_macro2::Span; -use quote::*; -use syn::*; - -/// Generates an unwrapping expression which can be used to assign the unwrapped proxy to a variable. -/// the argument `#[proxy] arg: MyType` will generate the following expression: -/// ```rust,ignore -/// arg.inner()?; -/// ``` -pub(crate) struct LuaSimpleTypeArgumentUnwrapper { - arg_name: Ident, - span: Span, -} - -impl LuaSimpleTypeArgumentUnwrapper { - pub fn new(arg_name: Ident, span: Span) -> Self { - Self { arg_name, span } - } -} - -impl VisitSimpleType> for LuaSimpleTypeArgumentUnwrapper { - fn visit_unit(&mut self, _: bool) -> syn::Result { - Ok(quote_spanned!(self.span=> ())) - } - - fn visit_proxy_type( - &mut self, - _: &ProxyType, - is_child_of_reference: bool, - ) -> syn::Result { - let arg_name: &Ident = &self.arg_name; - - if is_child_of_reference { - Ok(quote_spanned!(self.span=> #arg_name)) - } else { - Ok(quote_spanned!(self.span=> #arg_name.inner()?)) - } - } - - fn visit_type(&mut self, _type: &Type, _: bool) -> syn::Result { - let arg_name: &Ident = &self.arg_name; - Ok(quote_spanned!(self.span=> #arg_name)) - } - - fn visit_unit_path( - &mut self, - unit_path: &UnitPath, - _: bool, - ) -> syn::Result { - match unit_path.std_type_ident { - Some(StdTypeIdent::Option) => { - let inner = self.visit_simple_type(&unit_path.inner, false)?; - let arg_name = &self.arg_name; - Ok(quote_spanned!(self.span=> - #arg_name.map(|#arg_name| Ok::<_,bevy_mod_scripting_lua::tealr::mlu::mlua::Error>(#inner)).transpose()? - )) - } - Some(StdTypeIdent::Vec) => { - let inner = self.visit_simple_type(&unit_path.inner, false)?; - let arg_name = &self.arg_name; - Ok(quote_spanned!(self.span=> - #arg_name.into_iter().map(|#arg_name| Ok(#inner)).collect::,bevy_mod_scripting_lua::tealr::mlu::mlua::Error>>()? - )) - } - Some(unsupported_std_type) => Err(syn::Error::new_spanned( - &unit_path.ident, - format!("`{}` is not yet supported", unsupported_std_type), - )), - _ => Err(syn::Error::new_spanned( - &unit_path.ident, - "Unsupported type", - )), - } - } -} - -/// `maps` a simple type recursively, expanding the type into a series of map/iter/etc calls where the leaf types are operating over -/// unwrapped proxied types (the inner types) and the output expression produces a wrapped proxy type. -/// -/// requires arg_name to be a valid identifier refering to the name of the variable containing a value with the SimpleType being mapped. -/// The returned token stream will be an expression. -pub(crate) struct LuaSimpleTypeWrapper { - arg_name: Ident, - span: Span, -} - -impl LuaSimpleTypeWrapper { - pub fn new(arg_name: Ident, span: Span) -> Self { - Self { arg_name, span } - } -} - -impl VisitSimpleType> for LuaSimpleTypeWrapper { - fn visit_unit_path( - &mut self, - unit_path: &UnitPath, - _: bool, - ) -> syn::Result { - match unit_path.std_type_ident { - Some(StdTypeIdent::Option) => { - let inner = self.visit_simple_type(&unit_path.inner, false)?; - let arg_name = &self.arg_name; - Ok(quote_spanned!(self.span=> - #arg_name.map(|mut #arg_name| #inner) - )) - } - Some(StdTypeIdent::Vec) => { - let inner = self.visit_simple_type(&unit_path.inner, false)?; - let arg_name = &self.arg_name; - - Ok(quote_spanned!(self.span=> - #arg_name.into_iter().map(|mut #arg_name| #inner).collect::>() - )) - } - Some(unsupported_std_type) => Err(syn::Error::new_spanned( - &unit_path.ident, - format!("`{}` is not yet supported", unsupported_std_type), - )), - _ => Err(syn::Error::new_spanned( - &unit_path.ident, - "Unsupported type", - )), - } - } - - fn visit_duo_path( - &mut self, - duo_path: &DuoPath, - _: bool, - ) -> syn::Result { - let tealr = quote!(bevy_mod_scripting_lua::tealr); - - match duo_path.std_type_ident { - Some(StdTypeIdent::Result) => { - let left = self.visit_simple_type(&duo_path.left, false)?; - let right = self.visit_simple_type(&duo_path.right, false)?; - let arg_name = &self.arg_name; - Ok(quote_spanned!(self.span=> - #arg_name.map(|mut #arg_name| #left).map_err(|#arg_name| #tealr::mlu::mlua::Error::external(#right)) - )) - } - Some(unsupported_std_type) => Err(syn::Error::new_spanned( - &duo_path.ident, - format!("`{}` is not yet supported", unsupported_std_type), - )), - _ => Err(syn::Error::new_spanned(&duo_path.ident, "Unsupported type")), - } - } - - fn visit_unit(&mut self, _: bool) -> syn::Result { - Ok(quote_spanned!(self.span=> - () - )) - } - - fn visit_proxy_type( - &mut self, - proxy_type: &ProxyType, - _: bool, - ) -> syn::Result { - let proxy_ident = &proxy_type.proxy_ident; - let arg_name = &self.arg_name; - Ok(quote_spanned! {self.span=> - #proxy_ident::new(#arg_name) - }) - } - - fn visit_type(&mut self, _type: &Type, _: bool) -> syn::Result { - Ok(self.arg_name.to_token_stream()) - } -} - -/// Wrapper around the `TypeConstructorVisitor` which generates a syn::Type from a `SimpleType`. -/// This is used to handle special cases such as when encountering an outer `Result` where E needs to specifically be converted to an `mlua::Error` on the proxy side -pub(crate) struct LuaTypeConstructorVisitor { - pub general_visitor: TypeConstructorVisitor, -} - -impl LuaTypeConstructorVisitor { - pub fn new(generate_proxy_type: bool, strip_outer_ref: bool) -> Self { - Self { - general_visitor: TypeConstructorVisitor::new(generate_proxy_type, strip_outer_ref), - } - } -} - -impl VisitSimpleType for LuaTypeConstructorVisitor { - fn visit_unit(&mut self, is_child_of_reference: bool) -> Type { - self.general_visitor.visit_unit(is_child_of_reference) - } - - fn visit_proxy_type(&mut self, proxy_type: &ProxyType, is_child_of_reference: bool) -> Type { - self.general_visitor - .visit_proxy_type(proxy_type, is_child_of_reference) - } - - fn visit_type(&mut self, _type: &Type, is_child_of_reference: bool) -> Type { - self.general_visitor - .visit_type(_type, is_child_of_reference) - } - - fn visit_unit_path(&mut self, unit_path: &UnitPath, is_child_of_reference: bool) -> Type { - self.general_visitor - .visit_unit_path(unit_path, is_child_of_reference) - } - - fn visit_duo_path(&mut self, duo_path: &DuoPath, is_child_of_reference: bool) -> Type { - // this will only trigger for top level types, the deeper nesting is handled by the general visitor - // outer Result needs to be converted to Result when converting to a proxy_type - let tealr = quote!(bevy_mod_scripting_lua::tealr); - - if duo_path - .std_type_ident - .is_some_and(|i| i == StdTypeIdent::Result) - && self.general_visitor.generate_proxy_type - { - let ident = &duo_path.ident; - let lt_token = duo_path.lt_token; - let gt_token = duo_path.gt_token; - let left = self.visit_simple_type(&duo_path.left, false); - parse_quote!(#ident #lt_token #left, #tealr::mlu::mlua::Error #gt_token) - } else { - self.general_visitor - .visit_duo_path(duo_path, is_child_of_reference) - } - } - - fn visit_reference( - &mut self, - reference: &bevy_mod_scripting_common::input::Reference, - is_child_of_reference: bool, - ) -> Type { - self.general_visitor - .visit_reference(reference, is_child_of_reference) - } -} - -#[cfg(test)] -mod test { - use std::collections::HashMap; - - use crate::visitor::LuaSimpleTypeArgumentUnwrapper; - - use super::LuaSimpleTypeWrapper; - use bevy_mod_scripting_common::input::{SimpleType, VisitSimpleType}; - use proc_macro2::Span; - use quote::*; - use syn::parse_quote; - - #[test] - pub fn test_lua_argument_wrapper_simple_proxy() { - let expected = quote_spanned!(Span::call_site()=> - LuaMyType::new(arg) - ); - - let mut visitor = LuaSimpleTypeWrapper::new(format_ident!("arg"), Span::call_site()); - - let output = visitor - .visit( - &SimpleType::new_from_fully_specified_type( - "Lua", - &parse_quote!(MyType), - &HashMap::from_iter([(format_ident!("MyType"), None)]), - ) - .unwrap(), - ) - .unwrap(); - - assert_eq!(output.to_string(), expected.to_string()) - } - - #[test] - pub fn test_lua_argument_wrapper_non_proxy() { - let expected = quote_spanned!(Span::call_site()=> - arg - ); - - let mut visitor = LuaSimpleTypeWrapper::new(format_ident!("arg"), Span::call_site()); - - let output = visitor - .visit( - &SimpleType::new_from_fully_specified_type( - "Lua", - &parse_quote!(MyType), - &HashMap::from_iter([]), - ) - .unwrap(), - ) - .unwrap(); - - assert_eq!(output.to_string(), expected.to_string()) - } - - #[test] - pub fn test_lua_argument_wrapper_vec() { - let expected = quote_spanned!(Span::call_site()=> - arg.into_iter().map(|mut arg| LuaMyType::new(arg)).collect::>() - ); - - let mut visitor = LuaSimpleTypeWrapper::new(format_ident!("arg"), Span::call_site()); - - let output = visitor - .visit( - &SimpleType::new_from_fully_specified_type( - "Lua", - &parse_quote!(Vec), - &HashMap::from_iter([(format_ident!("MyType"), None)]), - ) - .unwrap(), - ) - .unwrap(); - - assert_eq!(output.to_string(), expected.to_string()) - } - - #[test] - pub fn test_lua_argument_unwrapper_simple_proxy() { - let expected = quote_spanned!(Span::call_site()=> - arg.inner()? - ); - - let mut visitor = - LuaSimpleTypeArgumentUnwrapper::new(format_ident!("arg"), Span::call_site()); - - let output = visitor - .visit( - &SimpleType::new_from_fully_specified_type( - "Lua", - &parse_quote!(MyType), - &HashMap::from_iter([(format_ident!("MyType"), None)]), - ) - .unwrap(), - ) - .unwrap(); - - assert_eq!(output.to_string(), expected.to_string()) - } - - #[test] - pub fn test_lua_argument_unwrapper_non_proxy() { - let expected = quote_spanned!(Span::call_site()=> - arg - ); - - let mut visitor = - LuaSimpleTypeArgumentUnwrapper::new(format_ident!("arg"), Span::call_site()); - - let output = visitor - .visit( - &SimpleType::new_from_fully_specified_type( - "Lua", - &parse_quote!(MyType), - &HashMap::from_iter([]), - ) - .unwrap(), - ) - .unwrap(); - - assert_eq!(output.to_string(), expected.to_string()) - } - - #[test] - pub fn test_lua_argument_unwrapper_vec() { - let expected = quote_spanned!(Span::call_site()=> - arg.into_iter().map(|arg| Ok(arg.inner()?)).collect::, bevy_mod_scripting_lua::tealr::mlu::mlua::Error>>()? - ); - - let mut visitor = - LuaSimpleTypeArgumentUnwrapper::new(format_ident!("arg"), Span::call_site()); - - let output = visitor - .visit( - &SimpleType::new_from_fully_specified_type( - "Lua", - &parse_quote!(Vec), - &HashMap::from_iter([(format_ident!("MyType"), None)]), - ) - .unwrap(), - ) - .unwrap(); - - assert_eq!(output.to_string(), expected.to_string()) - } -} diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/CHANGELOG.md b/crates/languages/bevy_mod_scripting_rhai_derive/CHANGELOG.md deleted file mode 100644 index 7efd6cc723..0000000000 --- a/crates/languages/bevy_mod_scripting_rhai_derive/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -## [0.7.0](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_rhai_derive-v0.6.0...bevy_mod_scripting_rhai_derive-v0.7.0) - 2024-11-03 - -### Other - -- update metadata diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml deleted file mode 100644 index 9977701fe6..0000000000 --- a/crates/languages/bevy_mod_scripting_rhai_derive/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "bevy_mod_scripting_rhai_derive" -version = "0.9.0-alpha.1" -authors = ["Maksymilian Mozolewski "] -edition = "2021" -license = "MIT OR Apache-2.0" -description = "Necessary functionality for Rhai support with bevy_mod_scripting" -repository = "https://github.com/makspll/bevy_mod_scripting" -homepage = "https://github.com/makspll/bevy_mod_scripting" -keywords = ["bevy", "gamedev", "scripting", "rhai"] -categories = ["game-development"] -readme = "readme.md" - -[lib] -name = "bevy_mod_scripting_rhai_derive" -path = "src/lib.rs" -proc-macro = true - -[dependencies] -bevy_mod_scripting_common = { path = "../../bevy_mod_scripting_common", version = "0.9.0-alpha.1" } -paste = "1.0.7" -syn = { version = "1.0.57", features = ["full", "fold", "extra-traits"] } -quote = "1.0.8" -proc-macro2 = "1.0" -convert_case = "0.5.0" -rustdoc-types = "0.11.0" -serde = { version = "1.0", features = ["derive"] } -serde_derive = "1.0.137" -indexmap = { version = "1.9.1", features = ["serde"] } diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/readme.md b/crates/languages/bevy_mod_scripting_rhai_derive/readme.md deleted file mode 100644 index e058ed4f00..0000000000 --- a/crates/languages/bevy_mod_scripting_rhai_derive/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# bevy_mod_scripting_lua_derive - -This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_rhai_derive/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai_derive/src/lib.rs deleted file mode 100644 index 4feb6fce4a..0000000000 --- a/crates/languages/bevy_mod_scripting_rhai_derive/src/lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -use proc_macro::TokenStream; - -#[proc_macro] -pub fn impl_lua_newtype(tokens: TokenStream) -> TokenStream { - // let newtype = parse_macro_input!(tokens as Newtype); - - // implementor - // .generate(newtype) - // .map_err(|e| e.to_compile_error()) - // .unwrap_or_else(core::convert::identity) - // .into() - tokens -} diff --git a/crates/macro_tests/Cargo.toml b/crates/macro_tests/Cargo.toml index b8598211bd..eb14de05ef 100644 --- a/crates/macro_tests/Cargo.toml +++ b/crates/macro_tests/Cargo.toml @@ -17,6 +17,5 @@ debug = false trybuild = "1.0" bevy = { version = "0.15.0", default-features = false } bevy_mod_scripting = { path = "../../", features = ["lua", "lua54"] } -bevy_script_api = { path = "../bevy_script_api" } bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua" } bevy_mod_scripting_core = { path = "../bevy_mod_scripting_core" } diff --git a/release-plz.toml b/release-plz.toml index 3a2241677c..6761f9b089 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -27,10 +27,7 @@ changelog_include = [ "bevy_mod_scripting_core", "bevy_mod_scripting_rhai", "bevy_mod_scripting_rune", - "bevy_script_api", "bevy_event_priority", - "bevy_mod_scripting_lua_derive", - "bevy_mod_scripting_rhai_derive", ] [[package]] @@ -54,18 +51,6 @@ version_group = "main" name = "bevy_mod_scripting_rune" version_group = "main" -[[package]] -name = "bevy_script_api" -version_group = "main" - [[package]] name = "bevy_event_priority" -version_group = "main" - -[[package]] -name = "bevy_mod_scripting_lua_derive" -version_group = "main" - -[[package]] -name = "bevy_mod_scripting_rhai_derive" -version_group = "main" +version_group = "main" \ No newline at end of file From fe90eaf1964f9edf9c16c23bfaf8600f89c770f4 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 29 Dec 2024 12:07:15 +0000 Subject: [PATCH 124/217] actually release access after function calls --- .../src/bindings/access_map.rs | 18 +++--- .../src/bindings/function/script_function.rs | 33 ++++++----- .../src/bindings/world.rs | 16 ++++++ crates/bevy_mod_scripting_core/src/error.rs | 16 ++++++ .../data/access/aliasing_global_access.lua | 11 ++++ .../tests/data/access/aliasing_write.lua | 11 ++++ .../tests/data/access/multiple_read_refs.lua | 3 + .../bevy_mod_scripting_lua/tests/lua_tests.rs | 56 ++++++++++++++++--- 8 files changed, 132 insertions(+), 32 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_global_access.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_write.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/access/multiple_read_refs.lua diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs index 0ee28511f2..8682e2ffbb 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -279,16 +279,14 @@ impl AccessMap { .collect() } - pub fn count_thread_acceesses(&self) -> usize { - self.individual_accesses - .iter() - .filter(|e| { - e.value() - .read_by - .iter() - .any(|o| o.id == std::thread::current().id()) - }) - .count() + pub fn count_accesses(&self) -> usize { + self.individual_accesses.len() + } + + pub fn release_all_accesses(&self) { + self.individual_accesses.clear(); + self.global_lock + .store(false, std::sync::atomic::Ordering::Relaxed); } pub fn access_location( diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 6acec8477c..2161c5e766 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -144,20 +144,25 @@ macro_rules! impl_script_function { let res: Result = (|| { $( let $callback = world.clone(); )? let world = world.try_read()?; - // TODO: snapshot the accesses and release them after - #[allow(unused_mut,unused_variables)] - let mut current_arg = 0; - $( - current_arg += 1; - let $param = <$param>::from_script($param, world.clone()) - .map_err(|e| InteropError::function_arg_conversion_error(current_arg.to_string(), e))?; - )* - let out = self( $( $callback, )? $( $param.into(), )* ); - $( - let $out = out?; - let out = $out; - )? - out.into_script(world.clone()).map_err(|e| InteropError::function_arg_conversion_error("return value".to_owned(), e)) + world.begin_access_scope()?; + let ret = { + #[allow(unused_mut,unused_variables)] + let mut current_arg = 0; + $( + current_arg += 1; + let $param = <$param>::from_script($param, world.clone()) + .map_err(|e| InteropError::function_arg_conversion_error(current_arg.to_string(), e))?; + )* + let out = self( $( $callback, )? $( $param.into(), )* ); + $( + let $out = out?; + let out = $out; + )? + out.into_script(world.clone()).map_err(|e| InteropError::function_arg_conversion_error("return value".to_owned(), e)) + }; + // Safety: we're not holding any references to the world, the arguments which might have aliased have been dropped + unsafe { world.end_access_scope()? }; + ret })(); let script_value: ScriptValue = res.into(); script_value diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 98a2f0692f..2999585b5b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -289,6 +289,22 @@ impl<'w> WorldAccessGuard<'w> { })) } + /// Begins a new access scope. Currently this simply throws an erorr if there are any accesses held. Should only be used in a single-threaded context + pub(crate) fn begin_access_scope(&self) -> Result<(), InteropError> { + if self.0.accesses.count_accesses() != 0 { + return Err(InteropError::invalid_access_count(self.0.accesses.count_accesses(), 0, "When beginning access scope, presumably for a function call, some accesses are still held".to_owned())); + } + + Ok(()) + } + + /// Ends the access scope, releasing all accesses. Should only be used in a single-threaded context + pub(crate) unsafe fn end_access_scope(&self) -> Result<(), InteropError> { + self.0.accesses.release_all_accesses(); + + Ok(()) + } + /// Purely debugging utility to list all accesses currently held. pub fn list_accesses(&self) -> Vec<(ReflectAccessId, AccessCount)> { self.0.accesses.list_accesses() diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index b59d8d3cac..21decd639b 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -392,6 +392,14 @@ impl InteropError { })) } + pub fn invalid_access_count(count: usize, expected: usize, context: String) -> Self { + Self(Arc::new(InteropErrorInner::InvalidAccessCount { + count, + expected, + context, + })) + } + pub fn inner(&self) -> &InteropErrorInner { &self.0 } @@ -429,6 +437,11 @@ pub enum InteropErrorInner { base: ReflectBaseType, location: Option>, }, + InvalidAccessCount { + count: usize, + expected: usize, + context: String, + }, ImpossibleConversion { into: TypeId, }, @@ -645,6 +658,9 @@ impl DisplayWithWorld for InteropErrorInner { InteropErrorInner::LengthMismatch { expected, got } => { format!("Array/List Length mismatch, expected: {}, got: {}", expected, got) }, + InteropErrorInner::InvalidAccessCount { count, expected, context } => { + format!("Invalid access count, expected: {}, got: {}. {}", expected, count, context) + }, } } } diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_global_access.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_global_access.lua new file mode 100644 index 0000000000..8cd7334081 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_global_access.lua @@ -0,0 +1,11 @@ +local entity = Entity.from_raw(9999); +_claim_global_access(); + +if pcall(function() + entity:eq(entity) +end) +then + error("Aliasing access did not panick") +else + -- all good +end diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_write.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_write.lua new file mode 100644 index 0000000000..85de5ee344 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/access/aliasing_write.lua @@ -0,0 +1,11 @@ +local entity = Entity.from_raw(9999); +_claim_write_access(entity); + +if pcall(function() + entity:eq(entity) +end) +then + error("Aliasing access did not panick") +else + -- all good +end diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/access/multiple_read_refs.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/access/multiple_read_refs.lua new file mode 100644 index 0000000000..fed59bb9ea --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/access/multiple_read_refs.lua @@ -0,0 +1,3 @@ +local entity = Entity.from_raw(9999); +-- does not throw +entity:eq(entity); \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 2c174fd527..b8eff99d8b 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -7,8 +7,8 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - pretty_print::DisplayWithWorld, ReflectAllocator, ReflectReference, ScriptTypeRegistration, - WorldAccessGuard, WorldCallbackAccess, + access_map::ReflectAccessId, pretty_print::DisplayWithWorld, ReflectAllocator, + ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }, context::ContextLoadingSettings, error::ScriptError, @@ -97,6 +97,16 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul let assert_throws = lua .create_function(|lua, (f, regex): (LuaFunction, String)| { let world = lua.get_world(); + + // let result = match std::panic::catch_unwind(|| ) { + // Ok(e) => e, + // Err(panic) => { + // return Err(mlua::Error::RuntimeError(format!( + // "Function panicked: {:?}", + // panic + // ))) + // } + // }; let result = f.call::<()>(()); let err = match result { Ok(_) => { @@ -120,6 +130,34 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul }) .unwrap(); + let set_write_access = lua + .create_function(|lua, val: LuaReflectReference| { + let world = lua.get_world(); + let inner: ReflectReference = val.into(); + + world.claim_write_access(ReflectAccessId::for_reference(inner.base.base_id).unwrap()); + Ok(()) + }) + .unwrap(); + + let set_read_access = lua + .create_function(|lua, val: LuaReflectReference| { + let world = lua.get_world(); + let inner: ReflectReference = val.into(); + + world.claim_read_access(ReflectAccessId::for_reference(inner.base.base_id).unwrap()); + Ok(()) + }) + .unwrap(); + + let claim_whole_world_access = lua + .create_function(|lua, ()| { + let world = lua.get_world(); + world.claim_global_access(); + Ok(()) + }) + .unwrap(); + let globals = lua.globals(); globals .set( @@ -131,6 +169,14 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul globals.set("assert_throws", assert_throws).unwrap(); globals.set("_get_mock_type", _get_mock_type).unwrap(); + + globals + .set("_claim_write_access", set_write_access) + .unwrap(); + globals.set("_claim_read_access", set_read_access).unwrap(); + globals + .set("_claim_global_access", claim_whole_world_access) + .unwrap(); Ok(()) } @@ -184,12 +230,6 @@ impl Test { Failed::from(msg) })?; - // WorldCallbackAccess::with_callback_access(app.world_mut(), |world| { - // lua.globals().set("world", LuaWorld(world.clone())).unwrap(); - - // let code = lua.load(self.code).set_name(self.path.to_string_lossy()); - // code.exec().map_err(|e| e.to_string()) - // })?; Ok(()) } From c7fba037372470e2a50d2727062d090133c285d0 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 29 Dec 2024 23:42:00 +0000 Subject: [PATCH 125/217] remove need for world jerry-rig, use static reference --- assets/scripts/bevy_api.lua | 16 +- assets/scripts/coroutines.lua | 2 +- assets/scripts/dynamic_queries.lua | 14 +- assets/scripts/game_of_life.lua | 12 +- .../src/bindings/access_map.rs | 1 - .../src/bindings/function/mod.rs | 24 +- .../src/bindings/function/script_function.rs | 48 +- .../src/bindings/pretty_print.rs | 2 - .../src/bindings/proxy.rs | 1120 ----------------- .../src/bindings/reference.rs | 33 +- .../src/bindings/script_value/mod.rs | 3 - .../bevy_mod_scripting_functions/src/core.rs | 70 +- .../src/bindings/reference.rs | 23 +- .../src/bindings/script_value.rs | 14 +- .../bevy_mod_scripting_lua/src/lib.rs | 5 +- ...t_no_default_or_from_world_data_errors.lua | 6 +- ...efault_and_component_data_adds_default.lua | 10 +- ..._with_default_no_component_data_errors.lua | 6 +- ..._world_and_component_data_adds_default.lua | 10 +- ...th_from_world_no_component_data_errors.lua | 6 +- .../api_available_on_callback.lua | 2 +- .../api_available_on_script_load.lua | 2 +- .../tests/data/despawn/despawns_only_root.lua | 12 +- .../data/despawn/invalid_entity_errors.lua | 2 +- .../despawns_only_child.lua | 12 +- .../invalid_entity_errors.lua | 2 +- .../despawns_recursively.lua | 12 +- .../invalid_entity_errors.lua | 2 +- .../has_children_returns_them.lua | 8 +- .../get_children/invalid_entity_errors.lua | 2 +- .../no_children_returns_empty_table.lua | 4 +- .../component_no_component_data.lua | 4 +- .../component_with_component_data.lua | 4 +- ...y_entity_component_with_component_data.lua | 6 +- .../data/get_parent/has_parent_returns_it.lua | 8 +- .../data/get_parent/invalid_entity_errors.lua | 2 +- .../data/get_parent/no_parent_returns_nil.lua | 4 +- .../missing_resource_returns_nil.lua | 2 +- .../no_resource_data_returns_resource.lua | 4 +- .../with_resource_data_returns_resource.lua | 4 +- .../missing_type_returns_nothing.lua | 2 +- .../registered_type_returns_correct_type.lua | 2 +- .../empty_entity_mock_component_is_false.lua | 4 +- .../data/has_component/no_component_data.lua | 4 +- .../has_component/with_component_data.lua | 4 +- .../existing_no_resource_data.lua | 4 +- .../existing_with_resource_data.lua | 4 +- ...issing_resource_mock_resource_is_false.lua | 2 +- .../adding_empty_list_does_nothing.lua | 6 +- .../adds_children_at_correct_index.lua | 12 +- .../adds_children_to_existing_enttity.lua | 11 +- .../insert_children/invalid_entity_errors.lua | 6 +- .../adding_empty_list_does_nothing.lua | 6 +- .../adds_children_to_existing_enttity.lua | 10 +- .../push_children/invalid_entity_errors.lua | 6 +- .../query/empty_query_returns_nothing.lua | 4 +- .../query_returns_all_entities_matching.lua | 20 +- .../empty_entity_does_nothing.lua | 8 +- .../no_component_data_errors.lua | 4 +- .../with_component_data_removes_component.lua | 6 +- ...source_with_resource_data_does_nothing.lua | 6 +- .../no_resource_data_errors.lua | 2 +- .../with_resource_data_removes_resource.lua | 6 +- 63 files changed, 259 insertions(+), 1403 deletions(-) delete mode 100644 crates/bevy_mod_scripting_core/src/bindings/proxy.rs diff --git a/assets/scripts/bevy_api.lua b/assets/scripts/bevy_api.lua index 08dec460d2..7cb343b34a 100644 --- a/assets/scripts/bevy_api.lua +++ b/assets/scripts/bevy_api.lua @@ -9,20 +9,20 @@ end function on_event() -- send exit event, to finish after one call - world:exit() + world.exit() print(entity) print(script) print(world) - -- print(world:hello(entity, entity)) - -- print(world:test_vec({entity, entity})[1]) + -- print(world.hello(entity, entity)) + -- print(world.test_vec({entity, entity})[1]) - local my_component_type = world:get_type_by_name("MyComponent") + local my_component_type = world.get_type_by_name("MyComponent") print("MyComponent type: ", my_component_type:short_name()) - local comp = world:get_component(entity, my_component_type) + local comp = world.get_component(entity, my_component_type) print("Before script: ", comp:print_value()) print("\noption") @@ -142,7 +142,7 @@ function on_event() -- print("F") - -- world:exit() + -- world.exit() -- do return end -- print("============") @@ -150,10 +150,10 @@ function on_event() -- comp.mat3[1][1] = 42 -- -- now let's retrieve these again to see if we actually changed their values permanently - -- comp = world:get_component(entity,my_component_type) + -- comp = world.get_component(entity,my_component_type) -- print("After script:") -- print(comp) - -- world:exit() + -- world.exit() end \ No newline at end of file diff --git a/assets/scripts/coroutines.lua b/assets/scripts/coroutines.lua index 941e25cab9..728dd03daf 100644 --- a/assets/scripts/coroutines.lua +++ b/assets/scripts/coroutines.lua @@ -17,7 +17,7 @@ function on_update() coroutine.resume(my_routine) else print("Couroutine has finished, no longer running") - world:exit() + world.exit() end end end diff --git a/assets/scripts/dynamic_queries.lua b/assets/scripts/dynamic_queries.lua index 92b217d110..a12c8e4a5e 100644 --- a/assets/scripts/dynamic_queries.lua +++ b/assets/scripts/dynamic_queries.lua @@ -1,23 +1,23 @@ -local component_a = world:get_type_by_name("ComponentA") -local component_b = world:get_type_by_name("ComponentB") -local component_c = world:get_type_by_name("ComponentC") +local component_a = world.get_type_by_name("ComponentA") +local component_b = world.get_type_by_name("ComponentB") +local component_c = world.get_type_by_name("ComponentC") print("Querying for entities with component_a and without component_c") -for entity, c in world:query(component_a):without(component_c):iter() do +for entity, c in world.query(component_a):without(component_c):iter() do print("Entity with index: " .. entity:index() .. " component: " .. tostring(c)) end print("Querying for entities with component_b and without component_a") -for entity, c in world:query(component_b):without(component_a):iter() do +for entity, c in world.query(component_b):without(component_a):iter() do print("Entity with index: " .. entity:index() .. " component: " .. tostring(c)) end print("Querying for all components at once") -for entity, c1,c2,c3 in world:query(component_a, component_b, component_c):iter() do +for entity, c1,c2,c3 in world.query(component_a, component_b, component_c):iter() do print("Entity with index: " .. entity:index()) print("\tComponentA: " .. tostring(c1)) print("\tComponentB: " .. tostring(c2)) print("\tComponentC: " .. tostring(c3)) end -world:exit() \ No newline at end of file +world.exit() \ No newline at end of file diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index 408e00de0d..56bbf6d91e 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -1,8 +1,8 @@ math.randomseed(os.time()) function init() - local LifeState = world:get_type_by_name("LifeState") - local life_state = world:get_component(entity,LifeState) + local LifeState = world.get_type_by_name("LifeState") + local life_state = world.get_component(entity,LifeState) local cells = life_state.cells -- set some cells alive @@ -13,15 +13,15 @@ function init() end function on_update() - local LifeState = world:get_type_by_name("LifeState") - local Settings = world:get_type_by_name("Settings") + local LifeState = world.get_type_by_name("LifeState") + local Settings = world.get_type_by_name("Settings") - local life_state = world:get_component(entity,LifeState) + local life_state = world.get_component(entity,LifeState) -- note currently this is a copy of the cells, as of now the macro does not automatically support Vec proxies by reference local cells = life_state.cells -- note that here we do not make use of LuaProxyable and just go off pure reflection - local settings = world:get_resource(Settings) + local settings = world.get_resource(Settings) local dimensions = settings.physical_grid_dimensions diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs index 8682e2ffbb..ff4e077e19 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -148,7 +148,6 @@ impl ReflectAccessId { ReflectBase::Resource(id) => Some(Self::for_component_id(id)), ReflectBase::Component(_, id) => Some(Self::for_component_id(id)), ReflectBase::Owned(id) => Some(Self::for_allocation(id)), - ReflectBase::World => None, } } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index dc86c98535..b196ff6185 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -13,6 +13,7 @@ use bevy::reflect::{ }, PartialReflect, }; +use script_function::CallerContext; use crate::{ error::{FlattenError, InteropError, InteropErrorInner, ScriptError, ScriptResult}, @@ -32,6 +33,7 @@ pub trait CallScriptFunction { &self, args: I, world: WorldGuard, + context: CallerContext, ) -> Result; } @@ -40,26 +42,22 @@ impl CallScriptFunction for DynamicFunction<'_> { &self, args: I, world: WorldGuard, + context: CallerContext, ) -> Result { - let mut args = args.into_iter().peekable(); - - let add_world = - self.first_arg_is_world() && args.peek().map_or(true, |a| a != &ScriptValue::World); + let args = args.into_iter(); + let add_context = self.has_caller_context_arg(); let mut args_list = ArgList::new(); - if add_world { + if add_context { + args_list = args_list.push_arg(ArgValue::Owned(Box::new(context))); args_list = args_list.push_arg(ArgValue::Owned(Box::new( WorldCallbackAccess::from_guard(world.clone()), ))); } for arg in args { - let arg_val = ArgValue::Owned(match arg { - ScriptValue::World => Box::new(WorldCallbackAccess::from_guard(world.clone())), - _ => Box::new(arg), - }); - + let arg_val = ArgValue::Owned(Box::new(arg)); args_list = args_list.push_arg(arg_val); } @@ -81,13 +79,13 @@ impl CallScriptFunction for DynamicFunction<'_> { } pub trait DynamicFunctionExt { - fn first_arg_is_world(&self) -> bool; + fn has_caller_context_arg(&self) -> bool; } impl DynamicFunctionExt for DynamicFunction<'_> { - fn first_arg_is_world(&self) -> bool { + fn has_caller_context_arg(&self) -> bool { self.info().args().first().map_or(false, |arg| { - arg.type_id() == std::any::TypeId::of::() + arg.type_id() == std::any::TypeId::of::() }) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 2161c5e766..f8514cec70 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -8,7 +8,7 @@ use crate::{ prelude::{ScriptValue, WorldCallbackAccess}, }; use bevy::{ - prelude::{AppFunctionRegistry, IntoFunction, World}, + prelude::{AppFunctionRegistry, IntoFunction, Reflect, World}, reflect::{ func::{DynamicFunction, FunctionInfo}, FromReflect, GetTypeRegistration, PartialReflect, TypeRegistration, TypeRegistry, Typed, @@ -85,7 +85,7 @@ macro_rules! register_tuple_dependencies { } no_type_dependencies!(ReflectReference, InteropError); -self_type_dependency_only!(WorldCallbackAccess); +self_type_dependency_only!(WorldCallbackAccess, CallerContext); recursive_type_dependencies!( (Val where T: GetTypeRegistration), @@ -103,12 +103,24 @@ pub trait GetFunctionTypeDependencies { fn register_type_dependencies(registry: &mut TypeRegistry); } -/// The Script Function equivalent for dynamic functions +/// The caller context when calling a script function. +/// Functions can choose to react to caller preferences such as converting 1-indexed numbers to 0-indexed numbers +#[derive(Clone, Copy, Debug, Reflect)] +pub struct CallerContext { + pub convert_to_0_indexed: bool, +} + +/// The Script Function equivalent for dynamic functions. Currently unused /// TODO: have a separate function registry to avoid the need for boxing script args every time pub struct DynamicScriptFunction { pub info: FunctionInfo, - pub func: - Arc) -> Result>, + pub func: Arc< + dyn Fn( + CallerContext, + WorldCallbackAccess, + Vec, + ) -> Result, + >, } macro_rules! impl_script_function { @@ -117,14 +129,20 @@ macro_rules! impl_script_function { // fn(T1...Tn) -> O impl_script_function!(@ $( $param ),* : -> O => O ); // fn(WorldCallbackAccess, T1...Tn) -> O - impl_script_function!(@ $( $param ),* : (callback: WorldCallbackAccess) -> O => O); + impl_script_function!(@ $( $param ),* : ,(callback: WorldCallbackAccess) -> O => O); + // fn(CallerContext, WorldCallbackAccess, T1...Tn) -> O + impl_script_function!(@ $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => O); + // fn(T1...Tn) -> Result impl_script_function!(@ $( $param ),* : -> O => Result where s); // fn(WorldCallbackAccess, T1...Tn) -> Result - impl_script_function!(@ $( $param ),* : (callback: WorldCallbackAccess) -> O => Result where s); + impl_script_function!(@ $( $param ),* : ,(callback: WorldCallbackAccess) -> O => Result where s); + // fn(CallerContext, WorldCallbackAccess, T1...Tn) -> Result + impl_script_function!(@ $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => Result where s); + }; - (@ $( $param:ident ),* : $(($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { + (@ $( $param:ident ),* : $(($context:ident: $contextty:ty))? $(,($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { #[allow(non_snake_case)] impl< 'env, @@ -132,16 +150,18 @@ macro_rules! impl_script_function { O, F > ScriptFunction<'env, - fn( $( $callbackty, )? $($param ),* ) -> $res + fn( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res > for F where O: IntoScript, - F: Fn( $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, + F: Fn( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, $( $param::This<'env>: Into<$param>),* { + #[allow(unused_variables)] fn into_dynamic_function(self) -> DynamicFunction<'static> { - (move |world: WorldCallbackAccess, $( $param: ScriptValue ),* | { + (move |caller_context: CallerContext, world: WorldCallbackAccess, $( $param: ScriptValue ),* | { let res: Result = (|| { + $( let $context = caller_context; )? $( let $callback = world.clone(); )? let world = world.try_read()?; world.begin_access_scope()?; @@ -153,7 +173,7 @@ macro_rules! impl_script_function { let $param = <$param>::from_script($param, world.clone()) .map_err(|e| InteropError::function_arg_conversion_error(current_arg.to_string(), e))?; )* - let out = self( $( $callback, )? $( $param.into(), )* ); + let out = self( $( $context,)? $( $callback, )? $( $param.into(), )* ); $( let $out = out?; let out = $out; @@ -188,8 +208,8 @@ macro_rules! impl_script_function_type_dependencies{ }; } -bevy::utils::all_tuples!(impl_script_function, 0, 14, T); -bevy::utils::all_tuples!(impl_script_function_type_dependencies, 0, 14, T); +bevy::utils::all_tuples!(impl_script_function, 0, 13, T); +bevy::utils::all_tuples!(impl_script_function_type_dependencies, 0, 13, T); /// Utility for quickly checking your type can be used as an argument in a script function /// diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 29a7240cbd..37ca550d4d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -77,7 +77,6 @@ impl ReflectReferencePrinter { ReflectBase::Component(e, _) => format!("Component on entity {}", e), ReflectBase::Resource(_) => "Resource".to_owned(), ReflectBase::Owned(_) => "Allocation".to_owned(), - ReflectBase::World => "World".to_owned(), }; out.push_str(&format!("{}({})", base_kind, type_path)); @@ -403,7 +402,6 @@ impl DisplayWithWorld for ScriptValue { ScriptValue::Integer(i) => i.to_string(), ScriptValue::Float(f) => f.to_string(), ScriptValue::String(cow) => cow.to_string(), - ScriptValue::World => "World".to_owned(), ScriptValue::Error(script_error) => script_error.to_string(), ScriptValue::List(vec) => { let mut string = String::new(); diff --git a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs b/crates/bevy_mod_scripting_core/src/bindings/proxy.rs deleted file mode 100644 index d65bb53385..0000000000 --- a/crates/bevy_mod_scripting_core/src/bindings/proxy.rs +++ /dev/null @@ -1,1120 +0,0 @@ -//! Set of traits used to define how types are turned into and from proxies in Lua. -//! Proxies can either be logical "copies" or owned "direct representations" of the instance, or references to one via the [`bevy_mod_scripting_core::bindings::ReflectReference`] construct. -use std::{ - cell::UnsafeCell, - marker::PhantomData, - num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize}, - sync::Arc, -}; - -use bevy::reflect::{FromReflect, Reflect, TypeRegistry}; -use smallvec::SmallVec; - -use crate::{ - bindings::ReflectAllocation, - error::ScriptResult, - prelude::{ReflectAllocator, ScriptError}, -}; - -use super::{world::WorldAccessGuard, ReflectReference, DEFAULT_INTERVAL, DEFAULT_TIMEOUT}; - -/// Inverse to [`Unproxy`], packages up a type into a proxy type. -pub trait Proxy: Sized { - type Input<'a>; - - /// Proxies a type without access to the allocator, types which require access to the allocator will throw an error here - fn proxy<'a>(input: Self::Input<'a>) -> ScriptResult { - Err(ScriptError::new_reflection_error(format!( - "Cannot unproxy type: `{}` without allocator access. Use proxy_with_allocator instead.", - std::any::type_name::(), - ))) - } - - /// Proxies a type with access to the allocator - fn proxy_with_allocator<'a>( - input: Self::Input<'a>, - _allocator: &mut ReflectAllocator, - ) -> ScriptResult { - Self::proxy(input) - } -} - -/// A mechanism for converting proxy types into their represented types. -/// Note this can be implemented by 'meta-proxy' types which themselves aren't proxies, but wrap other proxies and provide a specific unproxying mechanism. -/// `RefProxy` and `RefMutProxy` are such 'meta-proxy' types. -/// -/// the [`Unproxy::Output`] type parameter is the type that this `proxy` will be converted to after unwrapping. -/// -pub trait Unproxy { - type Output<'o> - where - Self: 'o; - - fn collect_accesses<'w>(&self, _guard: &WorldAccessGuard<'w>) -> ScriptResult<()> { - Ok(()) - } - - fn release_accesses<'w>(&self, _guard: &WorldAccessGuard<'w>) -> ScriptResult<()> { - Ok(()) - } - - fn accesses_len(&self) -> usize { - 0 - } - - /// Unproxies a proxy type into the represented type without world access - /// This will fail on proxies which require world access to unproxy (for example those whose proxies are glorified [`ReflectReference`]'s ) - fn unproxy<'o>(&'o mut self) -> ScriptResult> { - Err(ScriptError::new_reflection_error(format!( - "Cannot unproxy type: `{}` without world access. Use unproxy_with_world instead", - std::any::type_name::(), - ))) - } - - /// Unproxies a proxy type into the represented type with world access - /// # Safety - /// - The caller must not use the accesses in the accesses list after the unproxy call at all, as implementors assume they have unique access to the accesses. - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - _guard: &WorldAccessGuard<'w>, - _type_registry: &TypeRegistry, - _allocator: &ReflectAllocator, - ) -> ScriptResult> { - self.unproxy() - } -} - -/// A wrapper type which when unproxied will return a `T` value. -/// Requires the type to be constructible from a reference to the proxy type. -#[derive(Debug, PartialEq, Eq)] -pub struct ValProxy(pub P, PhantomData); - -impl ValProxy { - pub fn new(v: P) -> Self { - Self(v, PhantomData) - } -} - -/// A wrapper type which when unproxied will return a `T` value. -/// Assumes that the proxy type contains a [`ReflectReference`] via [`AsRef`] -#[derive(PartialEq, Eq, Debug)] -pub struct ReflectValProxy(pub P, PhantomData); - -impl ReflectValProxy { - pub fn new(v: P) -> Self { - Self(v, PhantomData) - } -} - -/// A proxy type which when unproxied will return a reference to a `T` value. -/// Assumes that the proxy type contains a [`ReflectReference`] via [`AsRef`] -pub struct ReflectRefProxy(pub P, PhantomData); - -impl ReflectRefProxy { - pub fn new(v: P) -> Self { - Self(v, PhantomData) - } -} - -/// A proxy type which when unproxied will return a mutable reference to a `T` value. -/// Assumes that the proxy type contains a [`ReflectReference`] via [`AsRef`] -#[derive(Debug)] -pub struct ReflectRefMutProxy(pub P, PhantomData); - -impl ReflectRefMutProxy { - pub fn new(v: P) -> Self { - Self(v, PhantomData) - } -} - -impl Unproxy for ValProxy -where - T: for<'l> From<&'l P>, -{ - type Output<'o> - = T - where - Self: 'o; - - fn unproxy<'o>(&'o mut self) -> ScriptResult> { - Ok(T::from(&self.0)) - } -} - -impl Proxy for ValProxy -where - T: Into

, -{ - type Input<'a> = T; - - fn proxy<'a>(input: Self::Input<'a>) -> ScriptResult { - Ok(ValProxy::new(input.into())) - } -} - -impl Proxy for ReflectValProxy -where - T: Reflect, - P: From, -{ - type Input<'a> = T; - - fn proxy_with_allocator<'a>( - input: Self::Input<'a>, - allocator: &mut ReflectAllocator, - ) -> ScriptResult { - Ok(Self::new( - ReflectReference::new_allocated(input, allocator).into(), - )) - } -} - -impl Unproxy for ReflectValProxy -where - P: AsRef, - T: FromReflect, -{ - type Output<'o> - = T - where - Self: 'o; - - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - _accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &'o ReflectAllocator, - ) -> ScriptResult> { - bevy::log::debug!( - "Unproxying ReflectValProxy for type: `{}`", - std::any::type_name::() - ); - let reflect_ref: &ReflectReference = self.0.as_ref(); - let access = reflect_ref.base.base_id.get_reflect_access_id(); - let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); - let out = (|| { - let out = reflect_ref.reflect( - guard.as_unsafe_world_cell(), - &access, - type_registry, - Some(allocator), - )?; - T::from_reflect(out).ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "FromReflect failed for `{}`.", - std::any::type_name::() - )) - }) - })(); - guard.release_access(access); - out - } -} - -impl Proxy for ReflectRefProxy -where - T: FromReflect, - P: From, -{ - type Input<'a> = &'a T; - - fn proxy_with_allocator<'a>( - input: Self::Input<'a>, - allocator: &mut ReflectAllocator, - ) -> ScriptResult { - let inner = T::from_reflect(input).ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "FromReflect failed for `{}`.", - std::any::type_name::() - )) - })?; - Ok(Self::new( - ReflectReference::new_allocated(inner, allocator).into(), - )) - } -} - -impl Unproxy for ReflectRefProxy -where - P: AsRef, - T: Reflect, -{ - type Output<'o> - = &'o T - where - Self: 'o; - - fn collect_accesses<'w>( - &self, - guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, - ) -> ScriptResult<()> { - bevy::log::debug!( - "Unproxying ReflectRefProxy for type: `{}`", - std::any::type_name::() - ); - let reflect_ref: &ReflectReference = self.0.as_ref(); - let access = reflect_ref.base.base_id.get_reflect_access_id(); - let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); - accesses.push(access); - Ok(()) - } - - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &ReflectAllocator, - ) -> ScriptResult> { - let reflect_ref: &ReflectReference = self.0.as_ref(); - let access = accesses.last().ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "No required access collected when unproxying type: `{}`.", - std::any::type_name::() - )) - })?; - - let out = reflect_ref.reflect( - guard.as_unsafe_world_cell(), - access, - type_registry, - Some(allocator), - )?; - let out = out.try_downcast_ref().ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Could not downcast value from reflect reference to type: `{}`.", - std::any::type_name::() - )) - })?; - Ok(out) - } - - fn accesses_len(&self) -> usize { - 1 - } -} - -impl Unproxy for ReflectRefMutProxy -where - P: AsRef, - T: Reflect, -{ - type Output<'o> - = &'o mut T - where - Self: 'o; - - fn collect_accesses<'w>( - &self, - guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, - ) -> ScriptResult<()> { - let reflect_ref: &ReflectReference = self.0.as_ref(); - let access = reflect_ref.base.base_id.get_reflect_access_id(); - let access = guard.get_access_timeout(access, DEFAULT_TIMEOUT, DEFAULT_INTERVAL); - accesses.push(access); - Ok(()) - } - - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &ReflectAllocator, - ) -> ScriptResult> { - let reflect_ref: &ReflectReference = self.0.as_ref(); - accesses - .last() - .ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "No required access collected when unproxying type: `{}`.", - std::any::type_name::() - )) - }) - .and_then(|access| { - reflect_ref.expect_write_access( - access, - type_registry, - Some(allocator), - guard.as_unsafe_world_cell(), - ) - })?; - - // Safety: - // - we verified and we have the right access - // - the caller promises not to alias it from the root access - let out = unsafe { - reflect_ref.reflect_mut_unsafe( - guard.as_unsafe_world_cell(), - type_registry, - Some(allocator), - )? - }; - let out = out.try_downcast_mut().ok_or_else(|| { - ScriptError::new_reflection_error(format!( - "Could not downcast value from reflect reference to type: `{}`.", - std::any::type_name::() - )) - })?; - Ok(out) - } - - fn accesses_len(&self) -> usize { - 1 - } -} - -macro_rules! impl_unproxy_via_vec { - ($type:ty, $out_type:ty, ($($generics:tt)*)) => { - impl<'c, $($generics)*> Unproxy for $type { - type Output<'o> = $out_type where Self: 'o; - - fn collect_accesses<'w>( - &self, - guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccessUnit<'w>; 1]>, - ) -> ScriptResult<()> { - for item in self { - item.collect_accesses(guard, accesses)?; - } - Ok(()) - } - - fn accesses_len(&self) -> usize { - self.iter().map(|item| item.accesses_len()).sum() - } - - fn unproxy(&mut self) -> ScriptResult> { - let mut out = Vec::with_capacity(self.len()); - for item in self { - let unproxied = item.unproxy()?; - out.push(unproxied); - } - Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) - } - - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &ReflectAllocator, - ) -> ScriptResult> { - let mut out = Vec::with_capacity(self.len()); - let mut offset = 0; - for item in self.iter_mut() { - let width = item.accesses_len(); - let unproxied = item.unproxy_with_world( - guard, - &accesses[offset..offset + width], - type_registry, - allocator, - )?; - out.push(unproxied); - offset += width; - } - Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) - } - } - }; -} - -macro_rules! impl_proxy_via_vec { - ($type:ty, $item_type:ty, $in_type:ty, ($($generics:tt)*)) => { - impl<$($generics)*> Proxy for $type { - type Input<'i> = $in_type; - - fn proxy(input: Self::Input<'_>) -> ScriptResult { - let mut out = Vec::with_capacity(input.len()); - for item in input { - out.push(<$item_type as Proxy>::proxy(item)?); - } - Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) - } - - fn proxy_with_allocator( - input: Self::Input<'_>, - _allocator: &mut ReflectAllocator, - ) -> ScriptResult { - let mut out = Vec::with_capacity(input.len()); - for item in input { - out.push(<$item_type as Proxy>::proxy_with_allocator(item, _allocator)?); - } - Ok(out.try_into().map_err(|_| "something went wrong").unwrap()) - } - } - }; -} - -impl_unproxy_via_vec!(Vec, Vec>, (T: Unproxy)); -impl_proxy_via_vec!(Vec, T, Vec>, (T: Proxy)); -impl_unproxy_via_vec!([T; C], [T::Output<'o>; C], (T: Unproxy, const C: usize)); -impl_proxy_via_vec!([T; C],T,[T::Input<'i>; C], (T: Proxy, const C: usize)); -impl_unproxy_via_vec!(SmallVec<[T; C]>, SmallVec<[T::Output<'o>; C]>, (T: Unproxy, const C: usize)); -impl_proxy_via_vec!(SmallVec<[T; C]>, T, SmallVec<[T::Input<'i>; C]>, (T: Proxy, const C: usize)); - -// impl_proxy_unproxy_via_vec!(T, SmallVec, SmallVec<[T; C]>); -// impl<'c, T: 'c> Unproxy for &'c T { -// type Output<'o> = &'c T where Self: 'o; - -// fn unproxy(&mut self) -> ScriptResult> { -// Ok(self) -// } -// } - -// impl<'s, T> Proxy for &'s T { -// type Input<'b> = &'s T; - -// fn proxy(input: Self::Input<'_>) -> ScriptResult { -// Ok(input) -// } - -// fn proxy_with_allocator( -// input: Self::Input<'_>, -// _allocator: &mut ReflectAllocator, -// ) -> ScriptResult { -// Ok(input) -// } -// } - -// impl Unproxy for &mut T { -// type Output<'o> = &'o mut T where Self: 'o; - -// fn unproxy(&mut self) -> ScriptResult> { -// Ok(self) -// } -// } - -// impl<'s, T> Proxy for &'s mut T { -// type Input<'a> = &'s mut T; - -// fn proxy(input: Self::Input<'_>) -> ScriptResult { -// Ok(input) -// } - -// fn proxy_with_allocator( -// input: Self::Input<'_>, -// _allocator: &mut ReflectAllocator, -// ) -> ScriptResult { -// Ok(input) -// } -// } - -impl Unproxy for Option { - type Output<'o> - = Option> - where - Self: 'o; - - fn unproxy(&mut self) -> ScriptResult> { - if let Some(s) = self { - let inner = s.unproxy()?; - Ok(Some(inner)) - } else { - Ok(None) - } - } - - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &ReflectAllocator, - ) -> ScriptResult> { - if let Some(s) = self { - let inner = s.unproxy_with_world(guard, accesses, type_registry, allocator)?; - Ok(Some(inner)) - } else { - Ok(None) - } - } - - fn collect_accesses<'w>( - &self, - guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccess<'w>; 1]>, - ) -> ScriptResult<()> { - self.as_ref() - .map(|s| s.collect_accesses(guard, accesses)) - .unwrap_or_else(|| Ok(())) - } - - fn accesses_len(&self) -> usize { - self.as_ref().map_or(0, |s| s.accesses_len()) - } -} - -impl Proxy for Option { - type Input<'a> = Option>; - - fn proxy(input: Self::Input<'_>) -> ScriptResult { - input.map(T::proxy).transpose() - } - - fn proxy_with_allocator( - input: Self::Input<'_>, - _allocator: &mut ReflectAllocator, - ) -> ScriptResult { - input - .map(|i| T::proxy_with_allocator(i, _allocator)) - .transpose() - } -} - -impl Proxy for Result { - type Input<'a> = Result, E::Input<'a>>; - - fn proxy(input: Self::Input<'_>) -> ScriptResult { - match input { - Ok(i) => Ok(Ok(T::proxy(i)?)), - Err(e) => Ok(Err(E::proxy(e)?)), - } - } - - fn proxy_with_allocator( - input: Self::Input<'_>, - _allocator: &mut ReflectAllocator, - ) -> ScriptResult { - match input { - Ok(i) => Ok(Ok(T::proxy_with_allocator(i, _allocator)?)), - Err(e) => Ok(Err(E::proxy_with_allocator(e, _allocator)?)), - } - } -} - -impl Unproxy for Result { - type Output<'o> - = Result, E::Output<'o>> - where - Self: 'o; - - fn unproxy(&mut self) -> ScriptResult> { - match self { - Ok(s) => Ok(Ok(s.unproxy()?)), - Err(e) => Ok(Err(e.unproxy()?)), - } - } - - unsafe fn unproxy_with_world<'w, 'o>( - &'o mut self, - guard: &WorldAccessGuard<'w>, - accesses: &'o [WorldAccessUnit<'w>], - type_registry: &TypeRegistry, - allocator: &ReflectAllocator, - ) -> ScriptResult> { - match self { - Ok(s) => Ok(Ok(s.unproxy_with_world( - guard, - accesses, - type_registry, - allocator, - )?)), - Err(e) => Ok(Err(e.unproxy()?)), - } - } - - fn collect_accesses<'w>( - &self, - guard: &WorldAccessGuard<'w>, - accesses: &mut SmallVec<[WorldAccess<'w>; 1]>, - ) -> ScriptResult<()> { - match self { - Ok(s) => s.collect_accesses(guard, accesses), - Err(_) => Ok(()), - } - } - - fn accesses_len(&self) -> usize { - match self { - Ok(s) => s.accesses_len(), - Err(_) => 0, - } - } -} - -macro_rules! impl_unproxy_by_move { - ($($ty:ty),*) => { - $( - impl Unproxy for $ty { - type Output<'o> = $ty; - - fn unproxy( - &mut self - ) -> ScriptResult> { - Ok(*self) - } - } - - impl Unproxy for &$ty { - type Output<'o> = &'o $ty where Self : 'o; - - fn unproxy( - &mut self - ) -> ScriptResult> { - Ok(self) - } - } - - impl Unproxy for &mut $ty { - type Output<'o> = &'o mut $ty where Self : 'o; - - fn unproxy( - &mut self - ) -> ScriptResult> { - Ok(self) - } - } - )* - }; -} - -macro_rules! impl_proxy_by_move { - ($($ty:ident),*) => { - $( - impl Proxy for $ty { - type Input<'a> = Self; - - fn proxy(input: Self::Input<'_>) -> ScriptResult { - Ok(input) - } - } - - impl <'l>Proxy for &'l $ty { - type Input<'a> = Self; - - fn proxy(input: Self::Input<'_>) -> ScriptResult { - Ok(input) - } - } - - impl <'l>Proxy for &'l mut $ty { - type Input<'a> = Self; - - fn proxy(input: Self::Input<'_>) -> ScriptResult { - Ok(input) - } - } - )* - } -} - -impl_proxy_by_move!( - usize, - u8, - u16, - u32, - u64, - u128, - isize, - i8, - i16, - i32, - i64, - i128, - f32, - f64, - bool, - NonZeroUsize, - NonZeroU8, - NonZeroU16, - NonZeroU32, - NonZeroU64, - NonZeroU128 -); - -impl_unproxy_by_move!( - usize, - u8, - u16, - u32, - u64, - u128, - isize, - i8, - i16, - i32, - i64, - i128, - f32, - f64, - bool, - NonZeroUsize, - NonZeroU8, - NonZeroU16, - NonZeroU32, - NonZeroU64, - NonZeroU128 -); - -macro_rules! impl_unproxy_by_clone { - ($($ty:ty),*) => { - $(impl Unproxy for $ty { - type Output<'o> = $ty; - - fn unproxy(&mut self) -> ScriptResult> { - Ok(self.clone()) - } - })* - }; -} - -impl_unproxy_by_clone!(String); -impl_proxy_by_move!(String); - -macro_rules! impl_tuple_unproxy_proxy { - ($(($ty:ident, $idx:tt)),*) => { - impl <$($ty : Proxy,)*> Proxy for ($($ty,)*) - { - type Input<'a> = ($($ty::Input<'a>,)*); - - #[allow(clippy::unused_unit)] - fn proxy(_input: Self::Input<'_>) -> ScriptResult { - Ok(($($ty::proxy(_input.$idx)?,)*)) - } - - fn proxy_with_allocator(_input: Self::Input<'_>, _allocator: &mut ReflectAllocator) -> ScriptResult { - Ok(($($ty::proxy_with_allocator(_input.$idx, _allocator)?,)*)) - } - } - - impl<$($ty: Unproxy),*> Unproxy for ($($ty,)*) { - type Output<'o> = ($($ty::Output<'o>,)*) where Self: 'o; - - fn collect_accesses<'w>( - &self, - _guard: &WorldAccessGuard<'w>, - _accesses: &mut SmallVec<[WorldAccessWrite<'w>; 1]>, - ) -> ScriptResult<()> { - $(self.$idx.collect_accesses(_guard, _accesses)?;)* - Ok(()) - } - - fn accesses_len(&self) -> usize { - let mut _len = 0; - $(_len += self.$idx.accesses_len();)* - _len - } - - fn unproxy(&mut self) -> ScriptResult> { - Ok(($( - self.$idx.unproxy()? - ,)*)) - } - - #[allow(unused_assignments)] - unsafe fn unproxy_with_world<'w,'o>( - &'o mut self, - _guard: &WorldAccessGuard<'w>, - _accesses: &'o [WorldAccessUnit<'w>], - _type_registry: &TypeRegistry, - _allocator: &ReflectAllocator, - ) -> ScriptResult> { - let mut _offset = 0; - - Ok(($( - { - let width = self.$idx.accesses_len(); - let elem = self.$idx.unproxy_with_world(_guard, &_accesses[_offset.._offset+width], _type_registry, _allocator)?; - - _offset += width; - elem - } - ,)*)) - - } - } - }; -} - -impl_tuple_unproxy_proxy!(); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13), (O, 14)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13), (O, 14), (P, 15)); -#[rustfmt::skip] -impl_tuple_unproxy_proxy!((A, 0), (B, 1), (C, 2), (D, 3), (E, 4), (F, 5), (G, 6), (H, 7), (I, 8), (J, 9), (K, 10), (L, 11), (M, 12), (N, 13), (O, 14), (P, 15), (Q, 16)); - -#[cfg(test)] -mod test { - - use bevy::ecs::{component::Component, world::World}; - - use crate::bindings::{ReflectBase, ReflectBaseType}; - - use super::*; - - #[derive(Reflect, Component, PartialEq, Eq, Debug, Clone)] - struct Test(pub &'static str); - - #[derive(Debug, Clone, PartialEq, Eq)] - struct ValTestProxy(Test); - - impl From for ValTestProxy { - fn from(value: Test) -> Self { - Self(value) - } - } - - impl<'a> From<&'a ValTestProxy> for Test { - fn from(value: &'a ValTestProxy) -> Self { - value.0.clone() - } - } - - #[derive(Debug, Clone, PartialEq, Eq)] - struct TestProxy(ReflectReference); - - impl From for TestProxy { - fn from(value: ReflectReference) -> Self { - TestProxy(value) - } - } - - impl AsRef for TestProxy { - fn as_ref(&self) -> &ReflectReference { - &self.0 - } - } - - macro_rules! assert_proxy_invertible { - ($original:expr, $($proxy_ty:tt)*) => { - let mut world = World::new(); - let mut accesses = SmallVec::new(); - let world = WorldAccessGuard::new(&mut world); - let type_registry = TypeRegistry::default(); - let mut allocator = ReflectAllocator::default(); - - // test with world version - let mut proxy = <$($proxy_ty)* as Proxy>::proxy_with_allocator($original, &mut allocator).unwrap(); - proxy.collect_accesses(&world, &mut accesses).unwrap(); - - let unproxied = unsafe { - proxy - .unproxy_with_world(&world, &mut accesses, &type_registry, &allocator) - .unwrap() - }; - assert_eq!( - unproxied, $original, - "Proxy and unproxy does not yield original type, expected {:?}, got {:?}", - $original, unproxied - ); - - let mut proxy = <$($proxy_ty)* as Proxy>::proxy($original).unwrap(); - - let unproxied_without_world = proxy.unproxy().unwrap(); - assert_eq!( - unproxied_without_world, $original, - "Proxy and unproxy does not yield original type, expected {:?}, got {:?}", - $original, unproxied_without_world - ); - - }; - } - - #[test] - pub fn test_non_reflect_val_proxy() { - assert_proxy_invertible!(Test("test"), ValProxy::); - } - - #[test] - pub fn test_complex_types_proxy_is_inverse_of_unproxy() { - assert_proxy_invertible!([32; 4], [usize; 4]); - assert_proxy_invertible!( - core::array::from_fn::<_, 4, _>(|_| vec![Test("test")]), - [Vec::>; 4] - ); - assert_proxy_invertible!(Vec::::default(), Vec::); - assert_proxy_invertible!(Some(Test("test")), Option::>); - assert_proxy_invertible!(None::, Option::>); - assert_proxy_invertible!( - Some(Some(Test("test"))), - Option::>> - ); - assert_proxy_invertible!( - vec![Some(Test("test")), None, Some(Test("test"))], - Vec::>> - ); - assert_proxy_invertible!(vec![&1, &2, &3], Vec::<&usize>); - // assert_proxy_invertible!(vec![&(1, 2)], Vec::<&(usize, usize)>); - assert_proxy_invertible!(vec![vec![1, 2], vec![1, 2, 3]], Vec::>); - assert_proxy_invertible!( - vec![vec![(1, 2), (3, 4)], vec![(1, 2), (3, 4)]], - Vec::> - ); - assert_proxy_invertible!(Some(1), Option::); - assert_proxy_invertible!(Some(Some(1)), Option::>); - assert_proxy_invertible!(None::, Option::); - assert_proxy_invertible!(None::>, Option::>); - assert_proxy_invertible!(vec![Some(1), None, Some(2)], Vec::>); - assert_proxy_invertible!( - vec![Some(vec![1, 2, 3]), None, Some(vec![1, 4])], - Vec::>> - ); - } - - #[test] - pub fn test_val_proxy() { - let mut allocator = ReflectAllocator::default(); - let (alloc_id, _) = allocator.allocate(Test("test")); - - let mut proxy = ReflectValProxy::::new(TestProxy(ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Owned(alloc_id), - }, - reflect_path: vec![], - })); - let mut world = World::new(); - let mut accesses = SmallVec::new(); - let world = WorldAccessGuard::new(&mut world); - let type_registry = TypeRegistry::default(); - - proxy.collect_accesses(&world, &mut accesses).unwrap(); - let unproxied = unsafe { - proxy - .unproxy_with_world(&world, &accesses, &type_registry, &allocator) - .unwrap() - }; - assert_eq!(unproxied.0, "test"); - } - - #[test] - pub fn test_proxy_ref() { - let mut allocator = ReflectAllocator::default(); - let (alloc_id, _) = allocator.allocate(Test("test")); - - let mut proxy = ReflectRefProxy::::new(TestProxy(ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Owned(alloc_id), - }, - reflect_path: vec![], - })); - let mut world = World::new(); - let mut accesses = SmallVec::new(); - let world = WorldAccessGuard::new(&mut world); - let type_registry = TypeRegistry::default(); - - proxy.collect_accesses(&world, &mut accesses).unwrap(); - let unproxied = unsafe { - proxy - .unproxy_with_world(&world, &accesses, &type_registry, &allocator) - .unwrap() - }; - assert_eq!(unproxied.0, "test"); - } - - #[test] - pub fn test_proxy_ref_mut() { - let mut allocator = ReflectAllocator::default(); - let (alloc_id, _) = allocator.allocate(Test("test")); - - let mut proxy = ReflectRefMutProxy::::new(TestProxy(ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Owned(alloc_id), - }, - reflect_path: vec![], - })); - let mut world = World::new(); - let mut accesses = SmallVec::new(); - let world = WorldAccessGuard::new(&mut world); - let type_registry = TypeRegistry::default(); - - proxy.collect_accesses(&world, &mut accesses).unwrap(); - let unproxied = unsafe { - proxy - .unproxy_with_world(&world, &accesses, &type_registry, &allocator) - .unwrap() - }; - assert_eq!(unproxied.0, "test"); - } - - #[test] - pub fn test_vec_proxy_ref_mut() { - let mut allocator = ReflectAllocator::default(); - let (alloc_id, _) = allocator.allocate(Test("test")); - - let mut proxy = vec![Some(ReflectRefMutProxy::::new(TestProxy( - ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Owned(alloc_id), - }, - reflect_path: vec![], - }, - )))]; - let mut world = World::new(); - let mut accesses = SmallVec::new(); - let world = WorldAccessGuard::new(&mut world); - let type_registry = TypeRegistry::default(); - - proxy.collect_accesses(&world, &mut accesses).unwrap(); - let unproxied = unsafe { - proxy - .unproxy_with_world(&world, &accesses, &type_registry, &allocator) - .unwrap() - }; - assert_eq!(unproxied[0].as_ref().unwrap().0, "test"); - } - - #[test] - pub fn test_invalid_access() { - let mut allocator = ReflectAllocator::default(); - - let (allocation_id, _) = allocator.allocate(Test("test")); - - let reflect_ref = ReflectReference { - base: ReflectBaseType { - type_id: std::any::TypeId::of::(), - base_id: ReflectBase::Owned(allocation_id), - }, - reflect_path: vec![], - }; - - // mutable access to the same allocation - let proxy = vec![ - ReflectRefMutProxy::::new(TestProxy(reflect_ref.clone())), - ReflectRefMutProxy::::new(TestProxy(reflect_ref)), - ]; - - let mut world = World::new(); - let mut accesses = SmallVec::new(); - let world = WorldAccessGuard::new(&mut world); - - let result = proxy.collect_accesses(&world, &mut accesses); - assert!(matches!(result, Err(..))); - } -} diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index ab9720fca4..986c776206 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -49,8 +49,8 @@ impl Default for ReflectReference { fn default() -> Self { Self { base: ReflectBaseType { - type_id: TypeId::of::(), - base_id: ReflectBase::World, + type_id: None::.or_fake_id(), + base_id: ReflectBase::Owned(ReflectAllocationId::new(0)), }, reflect_path: ParsedPath(vec![]), } @@ -89,16 +89,6 @@ impl ReflectReference { }) } - pub fn new_world() -> Self { - Self { - base: ReflectBaseType { - type_id: TypeId::of::(), - base_id: ReflectBase::World, - }, - reflect_path: ParsedPath(Vec::default()), - } - } - pub fn new_allocated( value: T, allocator: &mut ReflectAllocator, @@ -170,10 +160,6 @@ impl ReflectReference { /// Indexes into the reflect path inside this reference. /// You can use [`Self::reflect`] and [`Self::reflect_mut`] to get the actual value. pub fn index_path>(&mut self, index: T) { - debug_assert!( - !matches!(self.base.base_id, ReflectBase::World), - "Trying to index into a world reference. This will always fail" - ); self.reflect_path.0.extend(index.into().0); } @@ -199,10 +185,6 @@ impl ReflectReference { &self, world: WorldGuard, ) -> Result, InteropError> { - if matches!(self.base.base_id, ReflectBase::World) { - return Ok(Box::new(WorldCallbackAccess::from_guard(world))); - } - if let ReflectBase::Owned(id) = &self.base.base_id { if self.reflect_path.is_empty() && id.strong_count() == 0 { let allocator = world.allocator(); @@ -241,11 +223,6 @@ impl ReflectReference { world: WorldGuard, f: F, ) -> Result { - debug_assert!( - !matches!(self.base.base_id, ReflectBase::World), - "Trying to access a world reference directly. This will always fail" - ); - let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()) .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; with_access_read!( @@ -266,11 +243,6 @@ impl ReflectReference { world: WorldGuard, f: F, ) -> Result { - debug_assert!( - !matches!(self.base.base_id, ReflectBase::World), - "Trying to access a world reference directly. This will always fail" - ); - let access_id = ReflectAccessId::for_reference(self.base.base_id.clone()) .ok_or_else(|| InteropError::unregistered_base(self.base.clone()))?; with_access_write!( @@ -448,7 +420,6 @@ pub enum ReflectBase { Component(Entity, ComponentId), Resource(ComponentId), Owned(ReflectAllocationId), - World, } impl ReflectBase { diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs index b23b067fe3..fccacd9fd3 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -38,8 +38,6 @@ pub enum ScriptValue { Reference(ReflectReference), /// Represents any error, will be thrown when returned to a script Error(InteropError), - /// A placeholder for a [`crate::bindings::WorldCallbackAccess`] value. - World, } impl ScriptValue { @@ -53,7 +51,6 @@ impl ScriptValue { ScriptValue::List(_) => "List".to_owned(), ScriptValue::Reference(_) => "Reference".to_owned(), ScriptValue::Error(_) => "Error".to_owned(), - ScriptValue::World => "World".to_owned(), } } } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 3cf2828485..989489836e 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -14,7 +14,7 @@ use bindings::{ from::{Mut, Ref, Val}, from_ref::FromScriptRef, into_ref::IntoScriptRef, - script_function::{GetFunctionTypeDependencies, ScriptFunction}, + script_function::{CallerContext, GetFunctionTypeDependencies, ScriptFunction}, }, pretty_print::DisplayWithWorld, script_value::ScriptValue, @@ -122,7 +122,16 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat ) .overwrite_script_function( "insert_children", - |w: WorldCallbackAccess, e: Val, index: usize, c: Vec>| { + |caller_context: CallerContext, + w: WorldCallbackAccess, + e: Val, + index: usize, + c: Vec>| { + let index = if caller_context.convert_to_0_indexed { + index - 1 + } else { + index + }; w.insert_children(*e, index, &c.into_iter().map(|v| *v).collect::>()) }, ) @@ -179,18 +188,14 @@ pub fn register_reflect_reference_functions( ) .overwrite_script_function( "get", - |world: WorldCallbackAccess, mut self_: ReflectReference, key: ScriptValue| { - let path: ParsedPath = key.try_into()?; - self_.index_path(path); - let world = world.try_read().expect("Stale world"); - ReflectReference::into_script_ref(self_, world) - }, - ) - .overwrite_script_function( - "get_1_indexed", - |world: WorldCallbackAccess, mut self_: ReflectReference, key: ScriptValue| { + |caller_context: CallerContext, + world: WorldCallbackAccess, + mut self_: ReflectReference, + key: ScriptValue| { let mut path: ParsedPath = key.try_into()?; - path.convert_to_0_indexed(); + if caller_context.convert_to_0_indexed { + path.convert_to_0_indexed(); + } self_.index_path(path); let world = world.try_read().expect("Stale world"); ReflectReference::into_script_ref(self_, world) @@ -198,14 +203,17 @@ pub fn register_reflect_reference_functions( ) .overwrite_script_function( "set", - |world: WorldCallbackAccess, + |caller_context: CallerContext, + world: WorldCallbackAccess, self_: ScriptValue, key: ScriptValue, value: ScriptValue| { if let ScriptValue::Reference(mut self_) = self_ { let world = world.try_read().expect("stale world"); - let path: ParsedPath = key.try_into().unwrap(); - + let mut path: ParsedPath = key.try_into().unwrap(); + if caller_context.convert_to_0_indexed { + path.convert_to_0_indexed(); + } self_.index_path(path); let r: ScriptValue = self_ .with_reflect_mut(world.clone(), |r| { @@ -226,36 +234,6 @@ pub fn register_reflect_reference_functions( } ScriptValue::Unit }, - ) - .overwrite_script_function( - "set_1_indexed", - |world: WorldCallbackAccess, - mut self_: ReflectReference, - key: ScriptValue, - value: ScriptValue| { - let world = world.try_read().expect("stale world"); - let mut path: ParsedPath = key.try_into()?; - path.convert_to_0_indexed(); - self_.index_path(path); - - let r: ScriptValue = self_ - .with_reflect_mut(world.clone(), |r| { - let target_type_id = r - .get_represented_type_info() - .map(|i| i.type_id()) - .or_fake_id(); - let other = >::from_script_ref( - target_type_id, - value, - world.clone(), - )?; - - r.try_apply(other.as_partial_reflect()).unwrap(); - Ok::<_, InteropError>(()) - }) - .into(); - Ok(r) - }, ); Ok(()) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 51b9ba37e1..614a190431 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -16,7 +16,7 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - function::CallScriptFunction, + function::{script_function::CallerContext, CallScriptFunction}, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, script_value::ScriptValue, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, @@ -59,6 +59,12 @@ impl From for LuaReflectReference { } } +fn lua_caller_context() -> CallerContext { + CallerContext { + convert_to_0_indexed: true, + } +} + /// Looks up a function in the registry on the given type id fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option> { let function = lookup_dynamic_function(lua, key, type_id); @@ -66,7 +72,11 @@ fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option| { let world = lua.get_world(); - let out = function.call_script_function(args.into_iter().map(Into::into), world)?; + let out = function.call_script_function( + args.into_iter().map(Into::into), + world, + lua_caller_context(), + )?; Ok(LuaScriptValue::from(out)) }) @@ -116,14 +126,14 @@ impl UserData for LuaReflectReference { }; // lookup get function - let index_func = - lookup_dynamic_function_typed::(lua, "get_1_indexed") - .expect("No 'get' function registered for a ReflectReference")?; + let index_func = lookup_dynamic_function_typed::(lua, "get") + .expect("No 'get' function registered for a ReflectReference")?; // call the function with the key let out = index_func.call_script_function( vec![ScriptValue::Reference(self_), key], world.clone(), + lua_caller_context(), )?; LuaScriptValue::from(out).into_lua(lua) }, @@ -136,11 +146,12 @@ impl UserData for LuaReflectReference { let key: ScriptValue = key.into(); let value: ScriptValue = value.into(); - lookup_dynamic_function_typed::(lua, "set_1_indexed") + lookup_dynamic_function_typed::(lua, "set") .expect("No 'set' function registered for a ReflectReference")? .call_script_function( vec![ScriptValue::Reference(self_), key, value], lua.get_world(), + lua_caller_context(), )?; Ok(()) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 0f07c0e968..4b1acaa237 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -48,12 +48,14 @@ impl FromLua for LuaScriptValue { // Value::Function(function) => todo!(), // Value::Thread(thread) => todo!(), Value::UserData(ud) => { - let ud = ud.borrow::()?; - if ud.0.base.base_id == ReflectBase::World { - ScriptValue::World - } else { - ScriptValue::Reference(ud.clone().into()) - } + let ud = ud.borrow::().map_err(|e| { + mlua::Error::FromLuaConversionError { + from: "UserData", + to: "LuaReflectReference".to_owned(), + message: Some(e.to_string()), + } + })?; + ScriptValue::Reference(ud.clone().into()) } // Value::Error(error) => todo!(), _ => { diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index c0e2b1e5b2..7b52a3ad34 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -206,7 +206,10 @@ pub fn with_world Result<(), ScriptError>>( WorldCallbackAccess::with_callback_access(world, |guard| { context .globals() - .set("world", LuaReflectReference(ReflectReference::new_world())) + .set( + "world", + LuaStaticReflectReference(std::any::TypeId::of::()), + ) .map_err(ScriptError::from_mlua_error)?; context.set_app_data(guard.clone()); f(context) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua index f5d3299b4a..54b8408a3f 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_no_default_or_from_world_data_errors.lua @@ -1,7 +1,7 @@ -local entity = world:spawn() -local type = world:get_type_by_name('TestComponent') +local entity = world.spawn() +local type = world.get_type_by_name('TestComponent') assert_throws(function() - world:add_default_component(entity, type) + world.add_default_component(entity, type) end, "Missing type data ReflectDefault or ReflectFromWorld for type: .*TestComponent.*") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua index cb7026bdff..8895f0b9fd 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_and_component_data_adds_default.lua @@ -1,9 +1,9 @@ -local entity = world:spawn() -local _type = world:get_type_by_name('CompWithDefaultAndComponentData') -world:add_default_component(entity, _type) +local entity = world.spawn() +local _type = world.get_type_by_name('CompWithDefaultAndComponentData') +world.add_default_component(entity, _type) -local added = world:has_component(entity, _type) +local added = world.has_component(entity, _type) assert(added ~= nil, 'Component not added') -local component = world:get_component(entity, _type) +local component = world.get_component(entity, _type) assert(component._1 == "Default", 'Component did not have default value, got: ' .. component._1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua index 3c00d91e8f..f632492662 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_default_no_component_data_errors.lua @@ -1,6 +1,6 @@ -local entity = world:spawn() -local _type = world:get_type_by_name('CompWithDefault') +local entity = world.spawn() +local _type = world.get_type_by_name('CompWithDefault') assert_throws(function() - world:add_default_component(entity, _type) + world.add_default_component(entity, _type) end, "Missing type data ReflectComponent for type: .*CompWithDefault.*") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua index 797e8ce998..c4725e7235 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_and_component_data_adds_default.lua @@ -1,9 +1,9 @@ -local entity = world:spawn() -local _type = world:get_type_by_name('CompWithFromWorldAndComponentData') -world:add_default_component(entity, _type) +local entity = world.spawn() +local _type = world.get_type_by_name('CompWithFromWorldAndComponentData') +world.add_default_component(entity, _type) -local added = world:has_component(entity, _type) +local added = world.has_component(entity, _type) assert(added ~= nil, 'Component not added') -local component = world:get_component(entity, _type) +local component = world.get_component(entity, _type) assert(component._1 == "Default", 'Component did not have default value, got: ' .. component._1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua index 2a1744b0ee..9f6652ad7d 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add_default_component/component_with_from_world_no_component_data_errors.lua @@ -1,6 +1,6 @@ -local entity = world:spawn() -local _type = world:get_type_by_name('CompWithFromWorld') +local entity = world.spawn() +local _type = world.get_type_by_name('CompWithFromWorld') assert_throws(function() - world:add_default_component(entity, _type) + world.add_default_component(entity, _type) end, 'Missing type data ReflectComponent for type: .*CompWithFromWorld.*') \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua index 0048f7f653..63de923947 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_callback.lua @@ -1,5 +1,5 @@ function on_test() assert(world ~= nil, "World was not found") - assert(world:get_type_by_name("TestComponent") ~= nil, "Could not find TestComponent type") + assert(world.get_type_by_name("TestComponent") ~= nil, "Could not find TestComponent type") Entity.from_raw(1) end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua index 50c2e90ed8..5831854a3b 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/api_availability/api_available_on_script_load.lua @@ -1,3 +1,3 @@ assert(world ~= nil, "World was not found") -assert(world:get_type_by_name("TestComponent") ~= nil, "Could not find TestComponent type") +assert(world.get_type_by_name("TestComponent") ~= nil, "Could not find TestComponent type") Entity.from_raw(1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua index 2cc5a6f0b7..fdb875657a 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/despawns_only_root.lua @@ -1,7 +1,7 @@ -local entity = world:spawn() -local child = world:spawn() -world:push_children(entity, {child}) -world:despawn(entity) +local entity = world.spawn() +local child = world.spawn() +world.push_children(entity, {child}) +world.despawn(entity) -assert(world:has_entity(entity) == false, "Parent should be despawned") -assert(world:has_entity(child) == true, "Child should not be despawned") +assert(world.has_entity(entity) == false, "Parent should be despawned") +assert(world.has_entity(child) == true, "Child should not be despawned") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua index b399f4f8db..207bd32291 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn/invalid_entity_errors.lua @@ -1,3 +1,3 @@ assert_throws(function() - world:despawn_recursive(Entity.from_raw(9999)) + world.despawn_recursive(Entity.from_raw(9999)) end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua index 1b0f617540..8161ac8733 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/despawns_only_child.lua @@ -1,7 +1,7 @@ -local entity = world:spawn() -local child = world:spawn() -world:push_children(entity, {child}) -world:despawn_descendants(entity) +local entity = world.spawn() +local child = world.spawn() +world.push_children(entity, {child}) +world.despawn_descendants(entity) -assert(world:has_entity(entity) == true, "Parent should not be despawned") -assert(world:has_entity(child) == false, "Child should be despawned") +assert(world.has_entity(entity) == true, "Parent should not be despawned") +assert(world.has_entity(child) == false, "Child should be despawned") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua index b399f4f8db..207bd32291 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_descendants/invalid_entity_errors.lua @@ -1,3 +1,3 @@ assert_throws(function() - world:despawn_recursive(Entity.from_raw(9999)) + world.despawn_recursive(Entity.from_raw(9999)) end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua index 554fe5dc9b..c5b98e0cca 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/despawns_recursively.lua @@ -1,7 +1,7 @@ -local entity = world:spawn() -local child = world:spawn() -world:push_children(entity, {child}) -world:despawn_recursive(entity) +local entity = world.spawn() +local child = world.spawn() +world.push_children(entity, {child}) +world.despawn_recursive(entity) -assert(world:has_entity(entity) == false, "Parent should be despawned") -assert(world:has_entity(child) == false, "Child should be despawned") +assert(world.has_entity(entity) == false, "Parent should be despawned") +assert(world.has_entity(child) == false, "Child should be despawned") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua index b399f4f8db..207bd32291 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/despawn_recursive/invalid_entity_errors.lua @@ -1,3 +1,3 @@ assert_throws(function() - world:despawn_recursive(Entity.from_raw(9999)) + world.despawn_recursive(Entity.from_raw(9999)) end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua index 16745e86d0..2d4eba9ab1 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/has_children_returns_them.lua @@ -1,9 +1,9 @@ -local entity = world:spawn() -local child = world:spawn() +local entity = world.spawn() +local child = world.spawn() -world:push_children(entity, {child}) +world.push_children(entity, {child}) -local children = world:get_children(entity) +local children = world.get_children(entity) assert(#children == 1, "Expected 1 child") assert(children[1]:index() == child:index(), "Child is the wrong entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua index c5ca9cdaf3..089c94837d 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/invalid_entity_errors.lua @@ -1,4 +1,4 @@ assert_throws(function() - world:get_children(Entity.from_raw(9999)) + world.get_children(Entity.from_raw(9999)) end, "Missing or invalid entity") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua index 49992aecf3..312bd79f80 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_children/no_children_returns_empty_table.lua @@ -1,4 +1,4 @@ -local entity = world:spawn() -local children = world:get_children(entity) +local entity = world.spawn() +local children = world.get_children(entity) assert(#children == 0) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua index c9f8550d9d..683e536205 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_no_component_data.lua @@ -1,6 +1,6 @@ -local component = world:get_type_by_name("CompWithDefault") +local component = world.get_type_by_name("CompWithDefault") local entity = _get_entity_with_test_component("CompWithDefault") -local retrieved = world:get_component(entity, component) +local retrieved = world.get_component(entity, component) assert(retrieved ~= nil, "Component was not found") assert(retrieved._1 == "Initial Value", "Component data was not retrieved correctly, retrieved._1 was: " .. retrieved._1) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua index 264f4badca..886a6e6c39 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/component_with_component_data.lua @@ -1,6 +1,6 @@ -local component = world:get_type_by_name("TestComponent") +local component = world.get_type_by_name("TestComponent") local entity = _get_entity_with_test_component("TestComponent") -local retrieved = world:get_component(entity, component) +local retrieved = world.get_component(entity, component) assert(retrieved ~= nil, "Component was not found") assert(retrieved.strings[1] == "Initial", "Component data was not retrieved correctly, retrieved.strings[1] was: " .. retrieved.strings[1]) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua index 79d541883b..31b26ab1a1 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_component/empty_entity_component_with_component_data.lua @@ -1,5 +1,5 @@ -local component = world:get_type_by_name("TestComponent") -local entity = world:spawn() -local retrieved = world:get_component(entity, component) +local component = world.get_type_by_name("TestComponent") +local entity = world.spawn() +local retrieved = world.get_component(entity, component) assert(retrieved == nil, "Component found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua index 2945131ca2..312596c3d9 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/has_parent_returns_it.lua @@ -1,9 +1,9 @@ -local entity = world:spawn() -local child = world:spawn() +local entity = world.spawn() +local child = world.spawn() -world:push_children(entity, {child}) +world.push_children(entity, {child}) -local parent = world:get_parent(child) +local parent = world.get_parent(child) assert(parent ~= nil, "Expected a parent") assert(parent:index() == entity:index(), "Parent is the wrong entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua index 04125b72bb..85ce2530df 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/invalid_entity_errors.lua @@ -1,4 +1,4 @@ assert_throws(function() - world:get_parent(Entity.from_raw(9999)) + world.get_parent(Entity.from_raw(9999)) end, "Missing or invalid entity") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua index 723c709a56..a7810c4d9f 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_parent/no_parent_returns_nil.lua @@ -1,4 +1,4 @@ -local entity = world:spawn() -local parent = world:get_parent(entity) +local entity = world.spawn() +local parent = world.get_parent(entity) assert(parent == nil, "Expected no parents") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua index a2fd345a6f..055d05d8f7 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/missing_resource_returns_nil.lua @@ -1,2 +1,2 @@ local type = _get_mock_type() -assert(world:get_resource(type) == nil, "Resource should not exist") \ No newline at end of file +assert(world.get_resource(type) == nil, "Resource should not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua index 8bd6133492..fd7e2ff7cc 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/no_resource_data_returns_resource.lua @@ -1,5 +1,5 @@ -local resource = world:get_type_by_name("ResourceWithDefault") +local resource = world.get_type_by_name("ResourceWithDefault") -local retrieved = world:get_resource(resource) +local retrieved = world.get_resource(resource) assert(retrieved ~= nil, "Resource should exist") assert(retrieved._1 == "Initial Value", "Resource should have default value but got: " .. retrieved._1) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua index 2d21bf08a6..6eb1e7101f 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_resource/with_resource_data_returns_resource.lua @@ -1,5 +1,5 @@ -local resource = world:get_type_by_name("TestResource") +local resource = world.get_type_by_name("TestResource") -local retrieved = world:get_resource(resource) +local retrieved = world.get_resource(resource) assert(retrieved ~= nil, "Resource should exist") assert(retrieved.bytes[2] == 1, "Resource should have default value but got resource with #retrieved.bytes[1]: " .. tostring(retrieved.bytes[2])) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/missing_type_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/missing_type_returns_nothing.lua index bbd1c6f119..3799fefe9c 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/missing_type_returns_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/missing_type_returns_nothing.lua @@ -1 +1 @@ -assert(world:get_type_by_name('UnregisteredType') == nil, 'Unregistered type was found') +assert(world.get_type_by_name('UnregisteredType') == nil, 'Unregistered type was found') diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua index 76fb82c0f0..8b12faa6e6 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/get_type_by_name/registered_type_returns_correct_type.lua @@ -1,4 +1,4 @@ -local type = world:get_type_by_name('TestComponent') +local type = world.get_type_by_name('TestComponent') local expected = { type_name = 'test_utils::test_data::TestComponent', diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua index 7c86b381a6..1de4c06d18 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/empty_entity_mock_component_is_false.lua @@ -1,4 +1,4 @@ -local entity = world:spawn() +local entity = world.spawn() local type = _get_mock_type() -assert(world:has_component(entity, type) == false, "Entity should not have component") \ No newline at end of file +assert(world.has_component(entity, type) == false, "Entity should not have component") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua index fc1129e5cc..edbeae9fa9 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/no_component_data.lua @@ -1,3 +1,3 @@ local entity = _get_entity_with_test_component("CompWithDefault") -local component = world:get_type_by_name("CompWithDefault") -assert(world:has_component(entity, component) == true, "Component was not found") \ No newline at end of file +local component = world.get_type_by_name("CompWithDefault") +assert(world.has_component(entity, component) == true, "Component was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua index a15920ea94..059137873d 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_component/with_component_data.lua @@ -1,3 +1,3 @@ local entity = _get_entity_with_test_component("TestComponent") -local component = world:get_type_by_name("TestComponent") -assert(world:has_component(entity, component) == true, "Component was not found") \ No newline at end of file +local component = world.get_type_by_name("TestComponent") +assert(world.has_component(entity, component) == true, "Component was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua index f0d5e1fbf2..62f41a2ec6 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_no_resource_data.lua @@ -1,2 +1,2 @@ -local component = world:get_type_by_name("ResourceWithDefault") -assert(world:has_resource(component) == true, "Resource was not found") \ No newline at end of file +local component = world.get_type_by_name("ResourceWithDefault") +assert(world.has_resource(component) == true, "Resource was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua index 6976b8d800..aa1f6580ae 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/existing_with_resource_data.lua @@ -1,2 +1,2 @@ -local component = world:get_type_by_name("TestResource") -assert(world:has_resource(component) == true, "Resource was not found") \ No newline at end of file +local component = world.get_type_by_name("TestResource") +assert(world.has_resource(component) == true, "Resource was not found") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua index 7f720c2f05..1917bb89e1 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/has_resource/missing_resource_mock_resource_is_false.lua @@ -1,2 +1,2 @@ local type = _get_mock_type() -assert(world:has_resource(type) == false, "Resource should not exist") \ No newline at end of file +assert(world.has_resource(type) == false, "Resource should not exist") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua index 014d3bb892..f6f0afac41 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adding_empty_list_does_nothing.lua @@ -1,5 +1,5 @@ -local entity = world:spawn() +local entity = world.spawn() -world:insert_children(entity,1 , {}) +world.insert_children(entity,1 , {}) -assert(#world:get_children(entity) == 0) \ No newline at end of file +assert(#world.get_children(entity) == 0) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua index 6f7f133beb..e4cb914aec 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_at_correct_index.lua @@ -1,8 +1,8 @@ -local entity = world:spawn() -local child = world:spawn() -local child2 = world:spawn() +local entity = world.spawn() +local child = world.spawn() +local child2 = world.spawn() -world:insert_children(entity, 1, {child}) -world:insert_children(entity, 1, {child2}) +world.insert_children(entity, 1, {child}) +world.insert_children(entity, 1, {child2}) -assert(world:get_children(entity)[1]:index() == child2:index()) \ No newline at end of file +assert(world.get_children(entity)[1]:index() == child2:index()) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua index b9360485fc..c90339fed3 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/adds_children_to_existing_enttity.lua @@ -1,7 +1,6 @@ -local entity = world:spawn() -local child = world:spawn() -local child2 = world:spawn() +local entity = world.spawn() +local child = world.spawn() +local child2 = world.spawn() +world.insert_children(entity, 1, {child, child2}) -world:insert_children(entity, 1, {child, child2}) - -assert(#world:get_children(entity) == 2) \ No newline at end of file +assert(#world.get_children(entity) == 2) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua index f82a9bb170..2c5d51a2f4 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert_children/invalid_entity_errors.lua @@ -1,10 +1,10 @@ local fake_entity = Entity.from_raw(9999) assert_throws(function() - world:insert_children(fake_entity, 1, {fake_entity}) + world.insert_children(fake_entity, 1, {fake_entity}) end, "Missing or invalid entity") -local entity = world:spawn() +local entity = world.spawn() assert_throws(function() - world:insert_children(entity, 1, {fake_entity}) + world.insert_children(entity, 1, {fake_entity}) end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua index 350383361a..b6a58402ae 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adding_empty_list_does_nothing.lua @@ -1,5 +1,5 @@ -local entity = world:spawn() +local entity = world.spawn() -world:push_children(entity, {}) +world.push_children(entity, {}) -assert(#world:get_children(entity) == 0) \ No newline at end of file +assert(#world.get_children(entity) == 0) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua index 1f082f1a1d..e2c323cfbf 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/adds_children_to_existing_enttity.lua @@ -1,7 +1,7 @@ -local entity = world:spawn() -local child = world:spawn() -local child2 = world:spawn() +local entity = world.spawn() +local child = world.spawn() +local child2 = world.spawn() -world:push_children(entity, {child, child2}) +world.push_children(entity, {child, child2}) -assert(#world:get_children(entity) == 2) \ No newline at end of file +assert(#world.get_children(entity) == 2) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua index 166e487ec2..cad01a84b4 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push_children/invalid_entity_errors.lua @@ -1,10 +1,10 @@ local fake_entity = Entity.from_raw(9999) assert_throws(function() - world:push_children(fake_entity, {fake_entity}) + world.push_children(fake_entity, {fake_entity}) end, "Missing or invalid entity") -local entity = world:spawn() +local entity = world.spawn() assert_throws(function() - world:push_children(entity, {fake_entity}) + world.push_children(entity, {fake_entity}) end, "Missing or invalid entity") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua index 54a81b2366..e49c5e147c 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua @@ -1,5 +1,5 @@ -local component_a = world:get_type_by_name("TestComponent") +local component_a = world.get_type_by_name("TestComponent") -for i,result in pairs(world:query({component_a}):with(component_a):without(component_a):build()) do +for i,result in pairs(world.query({component_a}):with(component_a):without(component_a):build()) do assert(false, "This should not be reached") end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua index 78fd2a119f..1ce43b8b0c 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua @@ -1,19 +1,19 @@ -local entity_a = world:spawn() -local entity_b = world:spawn() -local entity_c = world:spawn() +local entity_a = world.spawn() +local entity_b = world.spawn() +local entity_c = world.spawn() local entity_d = _get_entity_with_test_component("CompWithFromWorldAndComponentData") -local component_with = world:get_type_by_name("CompWithFromWorldAndComponentData") -local component_without = world:get_type_by_name("CompWithDefaultAndComponentData") +local component_with = world.get_type_by_name("CompWithFromWorldAndComponentData") +local component_without = world.get_type_by_name("CompWithDefaultAndComponentData") -world:add_default_component(entity_a, component_with) -world:add_default_component(entity_b, component_with) -world:add_default_component(entity_c, component_with) +world.add_default_component(entity_a, component_with) +world.add_default_component(entity_b, component_with) +world.add_default_component(entity_c, component_with) -world:add_default_component(entity_b, component_without) +world.add_default_component(entity_b, component_without) local found_entities = {} -for i,result in pairs(world:query({component_with}):with(component_with):without(component_without):build()) do +for i,result in pairs(world.query({component_with}):with(component_with):without(component_without):build()) do table.insert(found_entities, result:entity()) end diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua index fd535a7f46..1f0ca7a46b 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/empty_entity_does_nothing.lua @@ -1,5 +1,5 @@ -local entity = world:spawn() -local type = world:get_type_by_name('TestComponent') +local entity = world.spawn() +local type = world.get_type_by_name('TestComponent') -world:remove_component(entity, type) -world:remove_component(entity, type) \ No newline at end of file +world.remove_component(entity, type) +world.remove_component(entity, type) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua index 721418acb3..5a2cdb58d0 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/no_component_data_errors.lua @@ -1,7 +1,7 @@ local entity = _get_entity_with_test_component("CompWithDefault") -local component = world:get_type_by_name("CompWithDefault") +local component = world.get_type_by_name("CompWithDefault") assert_throws(function () - world:remove_component(entity, component) + world.remove_component(entity, component) end, "Missing type data ReflectComponent for type: .*CompWithDefault.*") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua index 294430d420..43d6dfd7e2 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_component/with_component_data_removes_component.lua @@ -1,5 +1,5 @@ local entity = _get_entity_with_test_component("TestComponent") -local component = world:get_type_by_name("TestComponent") -world:remove_component(entity, component) -assert(world:has_component(entity, component) == false, "Component was not removed") +local component = world.get_type_by_name("TestComponent") +world.remove_component(entity, component) +assert(world.has_component(entity, component) == false, "Component was not removed") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua index ae802adacb..93fe8237a3 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/missing_resource_with_resource_data_does_nothing.lua @@ -1,4 +1,4 @@ -local type = world:get_type_by_name("TestResource") +local type = world.get_type_by_name("TestResource") -world:remove_resource(type) -world:remove_resource(type) \ No newline at end of file +world.remove_resource(type) +world.remove_resource(type) \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua index 3e868e7f68..1a273e8e67 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua @@ -2,5 +2,5 @@ local type = _get_mock_type() assert_throws(function () - world:remove_resource(type) + world.remove_resource(type) end, "Missing type data ReflectResource for type: Unregistered TypeId.*") diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua index 86a21cb4ce..1141a8fc0a 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/with_resource_data_removes_resource.lua @@ -1,4 +1,4 @@ -local type = world:get_type_by_name("TestResource") -world:remove_resource(type) -assert(world:has_resource(type) == false, "Resource was not removed") +local type = world.get_type_by_name("TestResource") +world.remove_resource(type) +assert(world.has_resource(type) == false, "Resource was not removed") From c211f8754d0f130168972614b99be433cbdd35bb Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 30 Dec 2024 00:46:21 +0000 Subject: [PATCH 126/217] compilation error --- .../bevy_mod_scripting_lua/src/bindings/script_value.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 4b1acaa237..534c213956 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -78,9 +78,6 @@ impl IntoLua for LuaScriptValue { ScriptValue::Integer(i) => Value::Integer(i), ScriptValue::Float(f) => Value::Number(f), ScriptValue::String(s) => Value::String(lua.create_string(s.as_ref())?), - ScriptValue::World => { - LuaReflectReference::from(ReflectReference::new_world()).into_lua(lua)? - } ScriptValue::Reference(r) => LuaReflectReference::from(r).into_lua(lua)?, ScriptValue::Error(script_error) => return Err(mlua::Error::external(script_error)), ScriptValue::List(vec) => { From 68ba2563683d43b73c7bc2b56fdaf43786acb125 Mon Sep 17 00:00:00 2001 From: makspll Date: Mon, 30 Dec 2024 02:56:59 +0000 Subject: [PATCH 127/217] implement the rest of reflect reference functions --- .../src/bindings/function/mod.rs | 7 +- crates/bevy_mod_scripting_core/src/error.rs | 2 +- .../src/reflection_extensions.rs | 40 ++++++ .../bevy_mod_scripting_functions/src/core.rs | 95 +++++++++++++- .../src/bindings/reference.rs | 121 +++--------------- .../bevy_mod_scripting_lua/src/lib.rs | 2 +- .../tests/data/clear/vec.lua | 6 + .../tests/data/insert/vec.lua | 6 + .../tests/data/len/vec.lua | 4 + .../tests/data/pop/vec.lua | 6 + .../tests/data/push/vec.lua | 6 + .../tests/data/remove/vec.lua | 6 + crates/test_utils/src/test_data.rs | 2 + 13 files changed, 191 insertions(+), 112 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/clear/vec.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/insert/vec.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/len/vec.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/pop/vec.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/push/vec.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/remove/vec.lua diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index b196ff6185..519485d6aa 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -46,7 +46,7 @@ impl CallScriptFunction for DynamicFunction<'_> { ) -> Result { let args = args.into_iter(); - let add_context = self.has_caller_context_arg(); + let add_context = self.is_script_function(); let mut args_list = ArgList::new(); if add_context { @@ -79,13 +79,14 @@ impl CallScriptFunction for DynamicFunction<'_> { } pub trait DynamicFunctionExt { - fn has_caller_context_arg(&self) -> bool; + fn is_script_function(&self) -> bool; } impl DynamicFunctionExt for DynamicFunction<'_> { - fn has_caller_context_arg(&self) -> bool { + fn is_script_function(&self) -> bool { self.info().args().first().map_or(false, |arg| { arg.type_id() == std::any::TypeId::of::() + || arg.type_id() == std::any::TypeId::of::() }) } } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 21decd639b..a4a9e4eecc 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -649,7 +649,7 @@ impl DisplayWithWorld for InteropErrorInner { ) }, InteropErrorInner::FunctionCallError { inner } => { - inner.to_string() + format!("Error in function call: {}", inner) }, InteropErrorInner::BetterConversionExists{ context } => { format!("Unfinished conversion in context of: {}. A better conversion exists but caller didn't handle the case.", context) diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 49cb1975f3..368fcaa265 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -3,6 +3,7 @@ use std::{ borrow::Cow, cmp::max, ffi::{CStr, CString, OsStr, OsString}, + ops::Sub, path::{Path, PathBuf}, str::FromStr, }; @@ -22,6 +23,13 @@ use crate::{ }; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { + fn try_remove_boxed( + &mut self, + key: Box, + ) -> Result>, InteropError>; + + fn convert_to_0_indexed_key(&mut self); + fn from_reflect_or_clone( reflect: &dyn PartialReflect, world: WorldGuard, @@ -276,6 +284,19 @@ impl PartialReflectExt for T { } } + fn convert_to_0_indexed_key(&mut self) { + if let Some(type_id) = self.get_represented_type_info().map(|ti| ti.type_id()) { + if type_id == TypeId::of::() { + let self_ = self + .as_partial_reflect_mut() + .try_downcast_mut::() + .expect("invariant"); + + *self_ = self_.saturating_sub(1); + } + } + } + fn try_clear(&mut self) -> Result<(), InteropError> { match self.reflect_mut() { bevy::reflect::ReflectMut::List(l) => { @@ -315,6 +336,25 @@ impl PartialReflectExt for T { } } + fn try_remove_boxed( + &mut self, + key: Box, + ) -> Result>, InteropError> { + match self.reflect_mut() { + bevy::reflect::ReflectMut::List(l) => Ok(Some(l.remove(key.as_usize()?))), + bevy::reflect::ReflectMut::Map(m) => Ok(m.remove(key.as_partial_reflect())), + bevy::reflect::ReflectMut::Set(s) => { + let removed = s.remove(key.as_partial_reflect()); + Ok(removed.then_some(key)) + } + _ => Err(InteropError::unsupported_operation( + self.get_represented_type_info().map(|ti| ti.type_id()), + Some(key), + "remove".to_owned(), + )), + } + } + fn element_type_id(&self) -> Option { let elem: TypeId = match self.get_represented_type_info()? { bevy::reflect::TypeInfo::List(list_info) => list_info.item_ty().id(), diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 989489836e..f730ca7345 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -22,7 +22,7 @@ use bindings::{ ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }; use error::InteropError; -use reflection_extensions::TypeIdExtensions; +use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; use crate::{bevy_bindings::LuaBevyScriptingPlugin, namespaced_register::NamespaceBuilder}; @@ -55,7 +55,7 @@ pub fn register_bevy_bindings(app: &mut App) { } pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { - NamespaceBuilder::::new(reg) + NamespaceBuilder::::new(reg) .overwrite_script_function("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) .overwrite_script_function( "get_type_by_name", @@ -234,7 +234,96 @@ pub fn register_reflect_reference_functions( } ScriptValue::Unit }, - ); + ) + .overwrite_script_function( + "push", + |w: WorldCallbackAccess, s: ReflectReference, v: ScriptValue| { + let world = w.try_read().expect("stale world"); + let target_type_id = s.element_type_id(world.clone())?.ok_or_else(|| { + InteropError::unsupported_operation( + s.tail_type_id(world.clone()).unwrap_or_default(), + Some(Box::new(v.clone())), + "Could not get element type id. Are you trying to insert elements into a type that's not a list?".to_owned(), + ) + })?; + let other = >::from_script_ref(target_type_id, v, world.clone())?; + s.with_reflect_mut(world, |s| s.try_push_boxed(other))? + }, + ) + .overwrite_script_function("pop", |w: WorldCallbackAccess, s: ReflectReference| { + let world = w.try_read().expect("stale world"); + let o = s.with_reflect_mut(world.clone(), |s| s.try_pop_boxed())??; + let reference = { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + ReflectReference::new_allocated_boxed(o, &mut allocator) + }; + + ReflectReference::into_script_ref(reference, world) + }) + .overwrite_script_function("insert", |caller_context: CallerContext, w: WorldCallbackAccess, s: ReflectReference, k: ScriptValue, v: ScriptValue| { + let world = w.try_read().expect("stale world"); + let key_type_id = s.key_type_id(world.clone())?.ok_or_else(|| { + InteropError::unsupported_operation( + s.tail_type_id(world.clone()).unwrap_or_default(), + Some(Box::new(k.clone())), + "Could not get key type id. Are you trying to insert elements into a type that's not a map?".to_owned(), + ) + })?; + + let mut key = >::from_script_ref(key_type_id, k, world.clone())?; + + if caller_context.convert_to_0_indexed { + key.convert_to_0_indexed_key(); + } + + let value_type_id = s.element_type_id(world.clone())?.ok_or_else(|| { + InteropError::unsupported_operation( + s.tail_type_id(world.clone()).unwrap_or_default(), + Some(Box::new(v.clone())), + "Could not get element type id. Are you trying to insert elements into a type that's not a map?".to_owned(), + ) + })?; + + let value = >::from_script_ref(value_type_id, v, world.clone())?; + + s.with_reflect_mut(world, |s| s.try_insert_boxed(key, value))? + }) + .overwrite_script_function("clear", |w: WorldCallbackAccess, s: ReflectReference| { + let world = w.try_read().expect("stale world"); + s.with_reflect_mut(world, |s| s.try_clear())? + }) + .overwrite_script_function("len", |w: WorldCallbackAccess, s: ReflectReference| { + let world = w.try_read().expect("stale world"); + s.len(world) + }) + .overwrite_script_function("remove", |caller_context: CallerContext, w: WorldCallbackAccess, s: ReflectReference, k: ScriptValue| { + let world = w.try_read().expect("stale world"); + let key_type_id = s.key_type_id(world.clone())?.ok_or_else(|| { + InteropError::unsupported_operation( + s.tail_type_id(world.clone()).unwrap_or_default(), + Some(Box::new(k.clone())), + "Could not get key type id. Are you trying to remove elements from a type that's not a map?".to_owned(), + ) + })?; + + let mut key = >::from_script_ref(key_type_id, k, world.clone())?; + + if caller_context.convert_to_0_indexed { + key.convert_to_0_indexed_key(); + } + + let removed = s.with_reflect_mut(world.clone(), |s| s.try_remove_boxed(key))??; + + removed.map(|some| { + let reference = { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + ReflectReference::new_allocated_boxed(some, &mut allocator) + }; + ReflectReference::into_script_ref(reference, world) + }).transpose() + }); Ok(()) } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 614a190431..11f5aca24f 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -83,6 +83,14 @@ fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option( + lua: &Lua, + key: &str, +) -> Option> { + let type_id = TypeId::of::(); + lookup_function(lua, key, type_id) +} + fn lookup_dynamic_function<'lua>( lua: &'lua Lua, key: &str, @@ -101,11 +109,9 @@ fn lookup_dynamic_function<'lua>( fn lookup_dynamic_function_typed<'lua, T: 'static + ?Sized>( lua: &'lua Lua, key: &str, -) -> Option, mlua::Error>> { +) -> Option> { let type_id = TypeId::of::(); - let function = lookup_dynamic_function(lua, key, type_id); - - function.map(Ok) + lookup_dynamic_function(lua, key, type_id) } impl UserData for LuaReflectReference { @@ -123,11 +129,15 @@ impl UserData for LuaReflectReference { if let Some(func) = lookup_function(lua, key, type_id) { return func?.into_lua(lua); } + // try look up the function under the reflect reference namespace as well + if let Some(func) = lookup_function_typed::(lua, key) { + return func?.into_lua(lua); + } }; - // lookup get function + // lookup get index function let index_func = lookup_dynamic_function_typed::(lua, "get") - .expect("No 'get' function registered for a ReflectReference")?; + .expect("No 'get' function registered for a ReflectReference"); // call the function with the key let out = index_func.call_script_function( @@ -147,7 +157,7 @@ impl UserData for LuaReflectReference { let value: ScriptValue = value.into(); lookup_dynamic_function_typed::(lua, "set") - .expect("No 'set' function registered for a ReflectReference")? + .expect("No 'set' function registered for a ReflectReference") .call_script_function( vec![ScriptValue::Reference(self_), key, value], lua.get_world(), @@ -158,103 +168,6 @@ impl UserData for LuaReflectReference { }, ); - // m.add_meta_function( - // MetaMethod::Index, - // |l, (mut self_, key): (LuaReflectReference, Value)| { - // bevy::log::debug!( - // "ReflectReference::Index with key: {:?} and value: {:?}", - // key, - // self_ - // ); - // // catchall, parse the path - // let mut elem = Self::parse_value_index(key)?; - // Self::to_host_index(&mut elem); - // self_.0.index_path(elem); - // bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); - // self_.to_lua_proxy(l) - // }, - // ); - // m.add_meta_function( - // MetaMethod::NewIndex, - // |l, (mut self_, key, value): (LuaReflectReference, Value, Value)| { - // bevy::log::debug!( - // "ReflectReference::NewIndex with key: {:?} and value: {:?}", - // key, - // value - // ); - - // let mut elem = Self::parse_value_index(key)?; - // Self::to_host_index(&mut elem); - // self_.0.index_path(elem); - // bevy::log::debug!("Target reflect reference after indexing key: {:?}", self_.0); - // self_.set_with_lua_proxy(l, value) - // }, - // ); - - // m.add_function_mut( - // "insert", - // |l, (self_, key, value): (LuaReflectReference, Value, Value)| { - // let world = l.get_world(); - // bevy::log::debug!( - // "ReflectReference::insert with key: {:?} and value: {:?}", - // key, - // value - // ); - // let key = self_ - // .clone() - // .concrete_from_value(key, l, TypeIdSource::Key)?; - // bevy::log::debug!("Key: {:?}", key); - // let value = self_ - // .clone() - // .concrete_from_value(value, l, TypeIdSource::Element)?; - // bevy::log::debug!("Value: {:?}", value); - // self_ - // .0 - // .with_reflect_mut(&world, |r| r.try_insert_boxed(key, value))??; - // Ok(()) - // }, - // ); - - // m.add_function_mut("push", |l, (self_, value): (LuaReflectReference, Value)| { - // let world = l.get_world(); - // bevy::log::debug!("ReflectReference::push with value: {:?}", value); - // let value = self_ - // .clone() - // .concrete_from_value(value, l, TypeIdSource::Element)?; - // self_ - // .0 - // .with_reflect_mut(&world, |r| r.try_push_boxed(value))??; - // Ok(()) - // }); - - // m.add_function_mut("pop", |l, self_: LuaReflectReference| { - // let world = l.get_world(); - // bevy::log::debug!("ReflectReference::pop"); - // let ref_ = self_.0.with_reflect_mut(&world, |r| { - // let last_elem = r.try_pop_boxed()?; - // let allocator = world.allocator(); - // let mut allocator = allocator.write(); - // let reflect_ref = LuaReflectReference(ReflectReference::new_allocated_boxed( - // last_elem, - // &mut allocator, - // )); - // Ok::<_, ScriptError>(reflect_ref) - // })??; - - // Ok(ref_) - // }); - - // m.add_function("clear", |l, self_: LuaReflectReference| { - // let world = l.get_world(); - // bevy::log::debug!("ReflectReference::clear"); - // self_.0.with_reflect_mut(&world, |r| r.try_clear())??; - // Ok(()) - // }); - - // m.add_meta_function(MetaMethod::Len, |l, self_: LuaReflectReference| { - // self_.len(l) - // }); - // #[cfg(any( // feature = "lua54", // feature = "lua53", diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 7b52a3ad34..7a09c55544 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -208,7 +208,7 @@ pub fn with_world Result<(), ScriptError>>( .globals() .set( "world", - LuaStaticReflectReference(std::any::TypeId::of::()), + LuaStaticReflectReference(std::any::TypeId::of::()), ) .map_err(ScriptError::from_mlua_error)?; context.set_app_data(guard.clone()); diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/clear/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/clear/vec.lua new file mode 100644 index 0000000000..7604eb1565 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/clear/vec.lua @@ -0,0 +1,6 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +res.vec_usize:clear() + +assert(res.vec_usize:len() == 0, "Clear did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/insert/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/insert/vec.lua new file mode 100644 index 0000000000..abd159b9dc --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/insert/vec.lua @@ -0,0 +1,6 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +res.vec_usize:insert(2, 42) + +assert(res.vec_usize[2] == 42, "insert did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/len/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/len/vec.lua new file mode 100644 index 0000000000..f1b17a8fb0 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/len/vec.lua @@ -0,0 +1,4 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +assert(res.vec_usize:len() == 5, "Length is not 5") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/pop/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/pop/vec.lua new file mode 100644 index 0000000000..4a4c2249f8 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/pop/vec.lua @@ -0,0 +1,6 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +local popped = res.vec_usize:pop() + +assert(popped == 5, "Pop did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/push/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/push/vec.lua new file mode 100644 index 0000000000..5795045f70 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/push/vec.lua @@ -0,0 +1,6 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +res.vec_usize:push(42) + +assert(res.vec_usize[6] == 42, "Push did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove/vec.lua new file mode 100644 index 0000000000..9974b0013c --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove/vec.lua @@ -0,0 +1,6 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +local removed = res.vec_usize:remove(5) + +assert(removed == 5, "Remove did not work") diff --git a/crates/test_utils/src/test_data.rs b/crates/test_utils/src/test_data.rs index 2d100369d8..c052f09504 100644 --- a/crates/test_utils/src/test_data.rs +++ b/crates/test_utils/src/test_data.rs @@ -123,6 +123,7 @@ pub struct TestResourceWithVariousFields { pub int: i32, pub float: f32, pub bool: bool, + pub vec_usize: Vec, } impl TestResourceWithVariousFields { @@ -133,6 +134,7 @@ impl TestResourceWithVariousFields { int: 42, float: 69.0, bool: true, + vec_usize: vec![1, 2, 3, 4, 5], } } } From 9b292476c422743c2a92667e3b96f89aca3969cd Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 01:18:50 +0000 Subject: [PATCH 128/217] add script function registry and update registrations --- crates/bevy_api_gen/templates/footer.tera | 2 +- .../src/bindings/function/script_function.rs | 273 +++++++++++------- crates/bevy_mod_scripting_core/src/lib.rs | 5 +- .../bevy_mod_scripting_functions/src/core.rs | 97 +++---- .../src/namespaced_register.rs | 85 ++---- 5 files changed, 226 insertions(+), 236 deletions(-) diff --git a/crates/bevy_api_gen/templates/footer.tera b/crates/bevy_api_gen/templates/footer.tera index 405349fadf..5f32e86a59 100644 --- a/crates/bevy_api_gen/templates/footer.tera +++ b/crates/bevy_api_gen/templates/footer.tera @@ -14,7 +14,7 @@ impl ::bevy::app::Plugin for {{ "ScriptingPlugin" | prefix_cratename | convert_c {% for item in items %} NamespaceBuilder::<::{{ item.import_path }}>::new(world) {%- for function in item.functions -%} - .overwrite_script_function("{{ function.ident }}", | + .register("{{ function.ident }}", | {%- for arg in function.args -%} {%- if arg.proxy_ty is matching("Mut.*")-%} mut {% endif -%} diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index f8514cec70..01d95e0655 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -8,14 +8,18 @@ use crate::{ prelude::{ScriptValue, WorldCallbackAccess}, }; use bevy::{ - prelude::{AppFunctionRegistry, IntoFunction, Reflect, World}, + prelude::{AppFunctionRegistry, IntoFunction, Reflect, Resource, World}, reflect::{ - func::{DynamicFunction, FunctionInfo}, - FromReflect, GetTypeRegistration, PartialReflect, TypeRegistration, TypeRegistry, Typed, + func::{args::GetOwnership, DynamicFunction, FunctionError, FunctionInfo, TypedFunction}, + FromReflect, GetTypeRegistration, PartialReflect, TypePath, TypeRegistration, TypeRegistry, + Typed, }, }; +use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; +use std::borrow::Cow; use std::collections::HashMap; use std::hash::Hash; +use std::ops::{Deref, DerefMut}; use std::sync::Arc; #[diagnostic::on_unimplemented( @@ -23,7 +27,7 @@ use std::sync::Arc; note = "If you're trying to return a non-primitive type, you might need to use Val Ref or Mut wrappers" )] pub trait ScriptFunction<'env, Marker> { - fn into_dynamic_function(self) -> DynamicFunction<'static>; + fn into_dynamic_script_function(self) -> DynamicScriptFunction; } /// Functionally identical to [`GetTypeRegistration`] but without the 'static bound @@ -111,18 +115,127 @@ pub struct CallerContext { } /// The Script Function equivalent for dynamic functions. Currently unused -/// TODO: have a separate function registry to avoid the need for boxing script args every time +#[derive(Clone)] pub struct DynamicScriptFunction { - pub info: FunctionInfo, + // TODO: info about the function, this is hard right now because of non 'static lifetimes in wrappers, we can't use TypePath etc pub func: Arc< - dyn Fn( - CallerContext, - WorldCallbackAccess, - Vec, - ) -> Result, + dyn Fn(CallerContext, WorldCallbackAccess, Vec) -> ScriptValue + + Send + + Sync + + 'static, >, } +impl std::fmt::Debug for DynamicScriptFunction { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("DynamicScriptFunction").finish() + } +} + +/// Equivalent to [`AppFunctionRegistry`] but stores functions with a more convenient signature for scripting to avoid boxing every argument. +#[derive(Clone, Debug, Default, Resource)] +pub struct AppScriptFunctionRegistry(ScriptFunctionRegistryArc); + +impl Deref for AppScriptFunctionRegistry { + type Target = ScriptFunctionRegistryArc; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for AppScriptFunctionRegistry { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +#[derive(Clone, Debug, Default)] +pub struct ScriptFunctionRegistryArc(pub Arc>); + +impl ScriptFunctionRegistryArc { + pub fn read(&self) -> RwLockReadGuard { + self.0.read() + } + + pub fn write(&mut self) -> RwLockWriteGuard { + self.0.write() + } +} + +#[derive(Debug, Default)] +pub struct ScriptFunctionRegistry { + functions: HashMap, DynamicScriptFunction>, +} + +impl ScriptFunctionRegistry { + /// Register a script function with the given name. If the name already exists, + /// the new function will be registered as an overload of the function. + pub fn register(&mut self, name: impl Into>, func: F) + where + F: ScriptFunction<'static, M>, + { + self.register_overload(name, func); + } + + pub fn register_overload(&mut self, name: impl Into>, func: F) + where + F: ScriptFunction<'static, M>, + { + // always start with non-suffixed registration + let name = name.into().clone(); + + if !self.contains(&name) { + let func = func.into_dynamic_script_function(); + self.functions.insert(name, func); + return; + } + + for i in 1..16 { + let overload = format!("{name}-{i}"); + if !self.contains(&overload) { + self.register(overload, func); + return; + } + } + + panic!( + "Could not register overload for function {name}. Maximum number of overloads reached" + ); + } + + pub fn contains(&self, name: impl AsRef) -> bool { + self.functions.contains_key(name.as_ref()) + } + + pub fn get_first(&self, name: impl AsRef) -> Option<&DynamicScriptFunction> { + self.functions.get(name.as_ref()) + } + + pub fn iter_overloads( + &self, + name: impl Into>, + ) -> impl Iterator { + let name = name.into(); + (0..16) + .map(move |i| { + if i == 0 { + self.functions.get(&name) + } else { + let name: Cow<'static, str> = format!("{}-{i}", name).into(); + self.functions.get(&name) + } + }) + .take_while(|o| o.is_some()) + .map(|o| o.unwrap()) + } +} + +macro_rules! count { + () => (0usize); + ( $x:tt $($xs:tt)* ) => (1usize + count!($($xs)*)); +} + macro_rules! impl_script_function { ($( $param:ident ),* ) => { @@ -153,24 +266,31 @@ macro_rules! impl_script_function { fn( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res > for F where - O: IntoScript, + O: IntoScript + TypePath + GetOwnership, F: Fn( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, - $( $param::This<'env>: Into<$param>),* + $( $param::This<'env>: Into<$param>,)* { - #[allow(unused_variables)] - fn into_dynamic_function(self) -> DynamicFunction<'static> { - (move |caller_context: CallerContext, world: WorldCallbackAccess, $( $param: ScriptValue ),* | { + #[allow(unused_mut,unused_variables)] + fn into_dynamic_script_function(self) -> DynamicScriptFunction { + let func = (move |caller_context: CallerContext, world: WorldCallbackAccess, args: Vec | { let res: Result = (|| { + let expected_arg_count = count!($($param),*); + if args.len() != expected_arg_count { + return Err(InteropError::function_call_error(FunctionError::ArgCountMismatch{ + expected: expected_arg_count, + received: args.len() + })); + } $( let $context = caller_context; )? $( let $callback = world.clone(); )? let world = world.try_read()?; world.begin_access_scope()?; let ret = { - #[allow(unused_mut,unused_variables)] let mut current_arg = 0; + let mut arg_iter = args.into_iter(); $( current_arg += 1; - let $param = <$param>::from_script($param, world.clone()) + let $param = <$param>::from_script(arg_iter.next().expect("invariant"), world.clone()) .map_err(|e| InteropError::function_arg_conversion_error(current_arg.to_string(), e))?; )* let out = self( $( $context,)? $( $callback, )? $( $param.into(), )* ); @@ -186,7 +306,9 @@ macro_rules! impl_script_function { })(); let script_value: ScriptValue = res.into(); script_value - }).into_function() + }); + + DynamicScriptFunction { func: Arc::new(func) } } } }; @@ -264,9 +386,9 @@ macro_rules! assert_is_script_function { #[cfg(test)] mod test { - use crate::prelude::AppReflectAllocator; - use super::*; + use crate::bindings::function::script_function::ScriptFunction; + use crate::prelude::AppReflectAllocator; use bevy::reflect::func::{ArgList, ArgValue, Return}; use test_utils::test_data::*; @@ -274,100 +396,37 @@ mod test { setup_world(|w, _| w.insert_resource(AppReflectAllocator::default())) } - macro_rules! call_script_function_with { - ($world:ident, $fun:expr, ($($args: expr),*)) => { - { - let f = $fun; - let f = f.into_dynamic_function(); - - let o = WorldCallbackAccess::with_callback_access(&mut $world, |world| { - let mut arg_list = ArgList::new(); - arg_list = arg_list.push_arg(ArgValue::Owned(Box::new(world.clone()))); - $( - arg_list = arg_list.push_arg($args); - )* - f.call(arg_list) - }).expect("Failed to call function"); - - match o { - Return::Owned(v) => v.try_take().expect("Failed to convert to target type"), - _ => panic!("Expected owned value") - } - } - }; - } - - #[test] - fn primitive_function_should_work() { - let mut world = test_setup_world(); - - let out: ScriptValue = call_script_function_with!( - world, - |a: usize, b: usize| a + b, - ( - ArgValue::Owned(Box::new(ScriptValue::Integer(1))), - ArgValue::Owned(Box::new(ScriptValue::Integer(1))) - ) + fn assert_function_info_eq(a: &FunctionInfo, b: &FunctionInfo) { + assert_eq!(a.name(), b.name(), "Function names do not match"); + assert_eq!( + a.args().len(), + b.args().len(), + "Function arg count does not match" ); - assert_eq!(out, ScriptValue::Integer(2)); + for (a, b) in a.args().iter().zip(b.args().iter()) { + assert_eq!(a.type_id(), b.type_id(), "Function arg types do not match"); + assert_eq!(a.name(), b.name(), "Function arg names do not match"); + } } #[test] - fn primitive_result_function_should_work() { - let mut world = test_setup_world(); - - let out: ScriptValue = call_script_function_with!( - world, - |a: usize, b: usize| Ok(a + b), - ( - ArgValue::Owned(Box::new(ScriptValue::Integer(1))), - ArgValue::Owned(Box::new(ScriptValue::Integer(1))) - ) - ); - assert_eq!(out, ScriptValue::Integer(2)); - - let out: ScriptValue = call_script_function_with!( - world, - || Err::(InteropError::missing_world()), - () - ); - assert!(matches!(out, ScriptValue::Error(_))); + fn test_register_script_function() { + let mut registry = ScriptFunctionRegistry::default(); + let fn_ = |a: usize, b: usize| a + b; + registry.register("test", fn_); + registry.get_first("test").expect("Failed to get function"); } #[test] - fn primitive_function_with_world_should_work() { - let mut world = test_setup_world(); - - let out: ScriptValue = call_script_function_with!( - world, - |_w: WorldCallbackAccess, a: usize, b: usize| a + b, - ( - ArgValue::Owned(Box::new(ScriptValue::Integer(1))), - ArgValue::Owned(Box::new(ScriptValue::Integer(1))) - ) - ); - assert_eq!(out, ScriptValue::Integer(2)); - } + fn test_overloaded_script_function() { + let mut registry = ScriptFunctionRegistry::default(); + let fn_ = |a: usize, b: usize| a + b; + registry.register("test", fn_); + let fn_2 = |a: usize, b: i32| a + (b as usize); + registry.register("test", fn_2); - #[test] - fn primitive_result_function_with_world_should_work() { - let mut world = test_setup_world(); - - let out: ScriptValue = call_script_function_with!( - world, - |_w: WorldCallbackAccess, a: usize, b: usize| Ok(a + b), - ( - ArgValue::Owned(Box::new(ScriptValue::Integer(1))), - ArgValue::Owned(Box::new(ScriptValue::Integer(1))) - ) - ); - assert_eq!(out, ScriptValue::Integer(2)); + registry.get_first("test").expect("Failed to get function"); - let out: ScriptValue = call_script_function_with!( - world, - || Err::(InteropError::missing_world()), - () - ); - assert!(matches!(out, ScriptValue::Error(_))); + assert_eq!(registry.iter_overloads("test").collect::>().len(), 2); } } diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index b207afa444..b5c2347b84 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -4,8 +4,8 @@ use crate::event::ScriptErrorEvent; use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; use bindings::{ - script_value::ScriptValue, AppReflectAllocator, ReflectAllocator, ScriptTypeRegistration, - WorldCallbackAccess, + function::script_function::AppScriptFunctionRegistry, script_value::ScriptValue, + AppReflectAllocator, ReflectAllocator, ScriptTypeRegistration, WorldCallbackAccess, }; use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, @@ -79,6 +79,7 @@ impl Plugin for ScriptingPlugin { preprocessor: None, }) .insert_resource(self.runtime_settings.as_ref().cloned().unwrap_or_default()) + .init_resource::() .insert_non_send_resource::>(RuntimeContainer { runtime: (self.runtime_builder)(), }) diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index f730ca7345..38cbfd427c 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -26,29 +26,6 @@ use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; use crate::{bevy_bindings::LuaBevyScriptingPlugin, namespaced_register::NamespaceBuilder}; -pub trait RegisterScriptFunction { - fn overwrite_script_function(&mut self, name: N, f: F) -> &mut Self - where - N: Into>, - F: ScriptFunction<'static, M> + GetFunctionTypeDependencies; -} - -impl RegisterScriptFunction for NamespaceBuilder<'_, S> { - fn overwrite_script_function(&mut self, name: N, f: F) -> &mut Self - where - N: Into>, - F: ScriptFunction<'static, M> + GetFunctionTypeDependencies, - { - { - let registry = self.world.get_resource_or_init::(); - let mut registry = registry.write(); - F::register_type_dependencies(&mut registry); - } - let dynamic_function = f.into_dynamic_function(); - self.overwrite(name, dynamic_function); - self - } -} pub fn register_bevy_bindings(app: &mut App) { app.add_plugins(LuaBevyScriptingPlugin); @@ -56,15 +33,15 @@ pub fn register_bevy_bindings(app: &mut App) { pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - .overwrite_script_function("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) - .overwrite_script_function( + .register("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) + .register( "get_type_by_name", |world: WorldCallbackAccess, type_name: String| { let val = world.get_type_by_name(type_name)?; Ok(val.map(Val)) }, ) - .overwrite_script_function( + .register( "get_component", |world: WorldCallbackAccess, entity: Val, @@ -75,7 +52,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat .transpose() }, ) - .overwrite_script_function( + .register( "has_component", |s: WorldCallbackAccess, entity: Val, @@ -86,13 +63,13 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat } }, ) - .overwrite_script_function( + .register( "remove_component", |s: WorldCallbackAccess, e: Val, r: Val| { s.remove_component(*e, r.clone()) }, ) - .overwrite_script_function( + .register( "get_resource", |world: WorldCallbackAccess, registration: Val| { match registration.resource_id() { @@ -101,7 +78,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat } }, ) - .overwrite_script_function( + .register( "has_resource", |s: WorldCallbackAccess, registration: Val| match registration .resource_id() @@ -110,17 +87,17 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat None => Ok(false), }, ) - .overwrite_script_function( + .register( "remove_resource", |s: WorldCallbackAccess, r: Val| s.remove_resource(r.clone()), ) - .overwrite_script_function( + .register( "add_default_component", |w: WorldCallbackAccess, e: Val, r: Val| { w.add_default_component(*e, r.clone()) }, ) - .overwrite_script_function( + .register( "insert_children", |caller_context: CallerContext, w: WorldCallbackAccess, @@ -135,35 +112,35 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat w.insert_children(*e, index, &c.into_iter().map(|v| *v).collect::>()) }, ) - .overwrite_script_function( + .register( "push_children", |w: WorldCallbackAccess, e: Val, c: Vec>| { w.push_children(*e, &c.into_iter().map(|v| *v).collect::>()) }, ) - .overwrite_script_function("get_children", |w: WorldCallbackAccess, e: Val| { + .register("get_children", |w: WorldCallbackAccess, e: Val| { let children = w.get_children(*e)?; Ok(children.into_iter().map(Val).collect::>()) }) - .overwrite_script_function("get_parent", |w: WorldCallbackAccess, e: Val| { + .register("get_parent", |w: WorldCallbackAccess, e: Val| { let parent = w.get_parent(*e)?; Ok(parent.map(Val)) }) - .overwrite_script_function("despawn", |s: WorldCallbackAccess, e: Val| { + .register("despawn", |s: WorldCallbackAccess, e: Val| { s.despawn(*e) }) - .overwrite_script_function( + .register( "despawn_descendants", |s: WorldCallbackAccess, e: Val| s.despawn_descendants(*e), ) - .overwrite_script_function( + .register( "despawn_recursive", |s: WorldCallbackAccess, e: Val| s.despawn_recursive(*e), ) - .overwrite_script_function("has_entity", |s: WorldCallbackAccess, e: Val| { + .register("has_entity", |s: WorldCallbackAccess, e: Val| { s.has_entity(*e) }) - .overwrite_script_function( + .register( "query", |s: WorldCallbackAccess, components: Vec>| { let mut query_builder = ScriptQueryBuilder::default(); @@ -171,7 +148,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat Ok(Val(query_builder)) }, ) - .overwrite_script_function("exit", |s: WorldCallbackAccess| s.exit()); + .register("exit", |s: WorldCallbackAccess| s.exit()); Ok(()) } @@ -179,14 +156,14 @@ pub fn register_reflect_reference_functions( reg: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(reg) - .overwrite_script_function( + .register( "display_ref", |w: WorldCallbackAccess, s: ReflectReference| { let world = w.try_read().expect("Stale world"); s.display_with_world(world) }, ) - .overwrite_script_function( + .register( "get", |caller_context: CallerContext, world: WorldCallbackAccess, @@ -201,7 +178,7 @@ pub fn register_reflect_reference_functions( ReflectReference::into_script_ref(self_, world) }, ) - .overwrite_script_function( + .register( "set", |caller_context: CallerContext, world: WorldCallbackAccess, @@ -235,7 +212,7 @@ pub fn register_reflect_reference_functions( ScriptValue::Unit }, ) - .overwrite_script_function( + .register( "push", |w: WorldCallbackAccess, s: ReflectReference, v: ScriptValue| { let world = w.try_read().expect("stale world"); @@ -250,7 +227,7 @@ pub fn register_reflect_reference_functions( s.with_reflect_mut(world, |s| s.try_push_boxed(other))? }, ) - .overwrite_script_function("pop", |w: WorldCallbackAccess, s: ReflectReference| { + .register("pop", |w: WorldCallbackAccess, s: ReflectReference| { let world = w.try_read().expect("stale world"); let o = s.with_reflect_mut(world.clone(), |s| s.try_pop_boxed())??; let reference = { @@ -261,7 +238,7 @@ pub fn register_reflect_reference_functions( ReflectReference::into_script_ref(reference, world) }) - .overwrite_script_function("insert", |caller_context: CallerContext, w: WorldCallbackAccess, s: ReflectReference, k: ScriptValue, v: ScriptValue| { + .register("insert", |caller_context: CallerContext, w: WorldCallbackAccess, s: ReflectReference, k: ScriptValue, v: ScriptValue| { let world = w.try_read().expect("stale world"); let key_type_id = s.key_type_id(world.clone())?.ok_or_else(|| { InteropError::unsupported_operation( @@ -289,15 +266,15 @@ pub fn register_reflect_reference_functions( s.with_reflect_mut(world, |s| s.try_insert_boxed(key, value))? }) - .overwrite_script_function("clear", |w: WorldCallbackAccess, s: ReflectReference| { + .register("clear", |w: WorldCallbackAccess, s: ReflectReference| { let world = w.try_read().expect("stale world"); s.with_reflect_mut(world, |s| s.try_clear())? }) - .overwrite_script_function("len", |w: WorldCallbackAccess, s: ReflectReference| { + .register("len", |w: WorldCallbackAccess, s: ReflectReference| { let world = w.try_read().expect("stale world"); s.len(world) }) - .overwrite_script_function("remove", |caller_context: CallerContext, w: WorldCallbackAccess, s: ReflectReference, k: ScriptValue| { + .register("remove", |caller_context: CallerContext, w: WorldCallbackAccess, s: ReflectReference, k: ScriptValue| { let world = w.try_read().expect("stale world"); let key_type_id = s.key_type_id(world.clone())?.ok_or_else(|| { InteropError::unsupported_operation( @@ -332,14 +309,14 @@ pub fn register_script_type_registration_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) - .overwrite_script_function("type_name", |s: Ref| s.type_name()) - .overwrite_script_function("short_name", |s: Ref| { + .register("type_name", |s: Ref| s.type_name()) + .register("short_name", |s: Ref| { s.short_name() }) - .overwrite_script_function("is_resource", |s: Ref| { + .register("is_resource", |s: Ref| { s.resource_id().is_some() }) - .overwrite_script_function("is_component", |s: Ref| { + .register("is_component", |s: Ref| { s.component_id().is_some() }); Ok(()) @@ -349,7 +326,7 @@ pub fn register_script_query_builder_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) - .overwrite_script_function( + .register( "with", |s: Val, with: Val| { let mut builder = s.into_inner(); @@ -357,7 +334,7 @@ pub fn register_script_query_builder_functions( Val(builder) }, ) - .overwrite_script_function( + .register( "without", |s: Val, without: Val| { let mut builder = s.into_inner(); @@ -365,7 +342,7 @@ pub fn register_script_query_builder_functions( Val(builder) }, ) - .overwrite_script_function( + .register( "build", |world: WorldCallbackAccess, s: Val| { let builder = s.into_inner(); @@ -381,8 +358,8 @@ pub fn register_script_query_result_functions( world: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(world) - .overwrite_script_function("entity", |s: Ref| Val::new(s.entity)) - .overwrite_script_function("components", |s: Ref| { + .register("entity", |s: Ref| Val::new(s.entity)) + .register("components", |s: Ref| { let components = s.components.to_vec(); Val::new(components) }); diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 024bfc4d09..1912ee70c8 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -4,27 +4,16 @@ use bevy::{ prelude::{AppFunctionRegistry, IntoFunction, World}, reflect::func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, }; +use bevy_mod_scripting_core::bindings::function::script_function::{ + AppScriptFunctionRegistry, DynamicScriptFunction, ScriptFunction, ScriptFunctionRegistry, +}; pub trait RegisterNamespacedFunction { - fn register_namespaced_function( - &mut self, - name: N, - function: F, - ) -> Result<(), FunctionRegistrationError> - where - N: Into>, - S: IntoNamespace, - F: IntoFunction<'static, M> + 'static; - - fn overwrite_namespaced_function( - &mut self, - name: N, - function: F, - ) -> Option> + fn register_namespaced_function(&mut self, name: N, function: F) where N: Into>, S: IntoNamespace, - F: IntoFunction<'static, M> + 'static; + F: ScriptFunction<'static, M>; } pub trait GetNamespacedFunction { @@ -32,7 +21,7 @@ pub trait GetNamespacedFunction { &self, name: N, namespace: Namespace, - ) -> Option<&DynamicFunction<'static>> + ) -> Option<&DynamicScriptFunction> where N: Into>; @@ -75,51 +64,31 @@ impl Namespace { } } -impl RegisterNamespacedFunction for FunctionRegistry { - fn register_namespaced_function( - &mut self, - name: N, - function: F, - ) -> Result<(), FunctionRegistrationError> +impl RegisterNamespacedFunction for ScriptFunctionRegistry { + fn register_namespaced_function(&mut self, name: N, function: F) where N: Into>, S: IntoNamespace, - F: IntoFunction<'static, M> + 'static, + F: ScriptFunction<'static, M>, { let cow: Cow<'static, str> = name.into(); let function_name = S::into_namespace().function_name(cow); - self.register_with_name(function_name, function)?; - Ok(()) - } - - fn overwrite_namespaced_function( - &mut self, - name: N, - function: F, - ) -> Option> - where - N: Into>, - S: IntoNamespace, - F: IntoFunction<'static, M> + 'static, - { - let cow: Cow<'static, str> = name.into(); - let function_name = S::into_namespace().function_name(cow); - self.overwrite_registration_with_name(function_name, function) + self.register(function_name, function); } } -impl GetNamespacedFunction for FunctionRegistry { +impl GetNamespacedFunction for ScriptFunctionRegistry { fn get_namespaced_function( &self, name: N, namespace: Namespace, - ) -> Option<&DynamicFunction<'static>> + ) -> Option<&DynamicScriptFunction> where N: Into>, { let cow: Cow<'static, str> = name.into(); let function_name = namespace.function_name(cow); - self.get(&function_name) + self.get_first(&function_name) } fn has_namespaced_function(&self, name: N, namespace: Namespace) -> bool @@ -145,33 +114,17 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { } } - pub fn register( - &mut self, - name: N, - function: F, - ) -> Result<&mut Self, FunctionRegistrationError> + pub fn register(&mut self, name: N, function: F) -> &mut Self where N: Into>, - F: IntoFunction<'static, M> + 'static, + F: ScriptFunction<'static, M>, { { - let registry = self.world.get_resource_or_init::(); - let mut registry = registry.write(); - registry.register_namespaced_function::(name, function)?; - } - Ok(self) - } - - pub fn overwrite(&mut self, name: N, function: F) -> &mut Self - where - N: Into>, - F: IntoFunction<'static, M> + 'static, - { - { - let registry = self.world.get_resource_or_init::(); - + let mut registry = self + .world + .get_resource_or_init::(); let mut registry = registry.write(); - registry.overwrite_namespaced_function::(name, function); + registry.register_namespaced_function::(name, function); } self } From 1899ffaedd5ef6b8a864968a4ee5e4299e3e5d73 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 01:31:59 +0000 Subject: [PATCH 129/217] chore(codegen): update bevy bindings (#181) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .../src/bevy_bindings/bevy_core.rs | 4 +- .../src/bevy_bindings/bevy_ecs.rs | 64 +- .../src/bevy_bindings/bevy_hierarchy.rs | 12 +- .../src/bevy_bindings/bevy_input.rs | 238 +- .../src/bevy_bindings/bevy_math.rs | 634 +-- .../src/bevy_bindings/bevy_reflect.rs | 4218 ++++++++--------- .../src/bevy_bindings/bevy_time.rs | 68 +- .../src/bevy_bindings/bevy_transform.rs | 42 +- 8 files changed, 2640 insertions(+), 2640 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs index 60ab838fba..e66a541e86 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_core.rs @@ -14,7 +14,7 @@ impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::core::prelude::Name>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -27,7 +27,7 @@ impl ::bevy::app::Plugin for BevyCoreScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs index 773eeb17ee..6dfeb8d0a1 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_ecs.rs @@ -13,7 +13,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::ecs::entity::Entity>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -23,7 +23,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -36,7 +36,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_raw", |index: u32| { let output: Val = bevy::ecs::entity::Entity::from_raw( @@ -46,7 +46,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_bits", |_self: Val| { let output: u64 = bevy::ecs::entity::Entity::to_bits( @@ -56,7 +56,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_bits", |bits: u64| { let output: Val = bevy::ecs::entity::Entity::from_bits( @@ -66,7 +66,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "index", |_self: Val| { let output: u32 = bevy::ecs::entity::Entity::index( @@ -76,7 +76,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "generation", |_self: Val| { let output: u32 = bevy::ecs::entity::Entity::generation( @@ -91,7 +91,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { NamespaceBuilder::<::bevy::ecs::world::OnRemove>::new(world); NamespaceBuilder::<::bevy::ecs::world::OnReplace>::new(world); NamespaceBuilder::<::bevy::ecs::component::ComponentId>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -104,7 +104,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -114,7 +114,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -124,7 +124,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |index: usize| { let output: Val = bevy::ecs::component::ComponentId::new( @@ -134,7 +134,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "index", |_self: Val| { let output: usize = bevy::ecs::component::ComponentId::index( @@ -145,7 +145,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { }, ); NamespaceBuilder::<::bevy::ecs::component::Tick>::new(world) - .overwrite_script_function( + .register( "new", |tick: u32| { let output: Val = bevy::ecs::component::Tick::new( @@ -155,7 +155,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "get", |_self: Val| { let output: u32 = bevy::ecs::component::Tick::get(_self.into_inner()) @@ -163,7 +163,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set", |mut _self: Mut, tick: u32| { let output: () = bevy::ecs::component::Tick::set(&mut _self, tick) @@ -171,7 +171,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_newer_than", | _self: Val, @@ -187,7 +187,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -200,7 +200,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -210,7 +210,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -221,7 +221,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { }, ); NamespaceBuilder::<::bevy::ecs::component::ComponentTicks>::new(world) - .overwrite_script_function( + .register( "is_added", | _self: Ref, @@ -237,7 +237,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_changed", | _self: Ref, @@ -253,7 +253,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |change_tick: Val| { let output: Val = bevy::ecs::component::ComponentTicks::new( @@ -263,7 +263,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_changed", | mut _self: Mut, @@ -277,7 +277,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -288,7 +288,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { }, ); NamespaceBuilder::<::bevy::ecs::identifier::Identifier>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -298,7 +298,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "low", |_self: Val| { let output: u32 = bevy::ecs::identifier::Identifier::low( @@ -308,7 +308,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "masked_high", |_self: Val| { let output: u32 = bevy::ecs::identifier::Identifier::masked_high( @@ -318,7 +318,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_bits", |_self: Val| { let output: u64 = bevy::ecs::identifier::Identifier::to_bits( @@ -328,7 +328,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_bits", |value: u64| { let output: Val = bevy::ecs::identifier::Identifier::from_bits( @@ -338,7 +338,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -352,7 +352,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { }, ); NamespaceBuilder::<::bevy::ecs::entity::EntityHash>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -365,7 +365,7 @@ impl ::bevy::app::Plugin for BevyEcsScriptingPlugin { NamespaceBuilder::< ::bevy::ecs::removal_detection::RemovedComponentEntity, >::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val< diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs index c8a29c3d00..efb3bc53a7 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_hierarchy.rs @@ -15,7 +15,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::hierarchy::prelude::Children>::new(world) - .overwrite_script_function( + .register( "swap", | mut _self: Mut, @@ -32,7 +32,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { }, ); NamespaceBuilder::<::bevy::hierarchy::prelude::Parent>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -42,7 +42,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -56,7 +56,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { }, ); NamespaceBuilder::<::bevy::hierarchy::HierarchyEvent>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -69,7 +69,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -79,7 +79,7 @@ impl ::bevy::app::Plugin for BevyHierarchyScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs index 82c5c879ba..85c1f1ba6b 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_input.rs @@ -16,7 +16,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::input::gamepad::Gamepad>::new(world) - .overwrite_script_function( + .register( "vendor_id", |_self: Ref| { let output: std::option::Option = bevy::input::gamepad::Gamepad::vendor_id( @@ -26,7 +26,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "product_id", |_self: Ref| { let output: std::option::Option = bevy::input::gamepad::Gamepad::product_id( @@ -36,7 +36,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "pressed", | _self: Ref, @@ -50,7 +50,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "just_pressed", | _self: Ref, @@ -64,7 +64,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "just_released", | _self: Ref, @@ -79,7 +79,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadAxis>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -89,7 +89,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -102,7 +102,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -113,7 +113,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadButton>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -126,7 +126,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -136,7 +136,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -147,7 +147,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadSettings>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -158,7 +158,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::keyboard::KeyCode>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -168,7 +168,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -181,7 +181,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -192,7 +192,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::MouseButton>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -202,7 +202,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -212,7 +212,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -226,7 +226,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::touch::TouchInput>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -236,7 +236,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -250,7 +250,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::keyboard::KeyboardFocusLost>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -260,7 +260,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -270,7 +270,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -284,7 +284,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::keyboard::KeyboardInput>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -294,7 +294,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -307,7 +307,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -318,7 +318,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseMotion>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -328,7 +328,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -342,7 +342,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::AccumulatedMouseScroll>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -352,7 +352,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -366,7 +366,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::MouseButtonInput>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -376,7 +376,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -386,7 +386,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -400,7 +400,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::MouseMotion>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -413,7 +413,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -424,7 +424,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::MouseWheel>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -437,7 +437,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -448,7 +448,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadAxisChangedEvent>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -458,7 +458,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -472,7 +472,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadButtonChangedEvent>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -482,7 +482,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -498,7 +498,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { NamespaceBuilder::< ::bevy::input::gamepad::GamepadButtonStateChangedEvent, >::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -511,7 +511,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -521,7 +521,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val< @@ -534,7 +534,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadConnection>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -547,7 +547,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -558,7 +558,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadConnectionEvent>::new(world) - .overwrite_script_function( + .register( "connected", |_self: Ref| { let output: bool = bevy::input::gamepad::GamepadConnectionEvent::connected( @@ -568,7 +568,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "disconnected", |_self: Ref| { let output: bool = bevy::input::gamepad::GamepadConnectionEvent::disconnected( @@ -578,7 +578,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -591,7 +591,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -602,7 +602,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadEvent>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -612,7 +612,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -626,7 +626,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadInput>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -636,7 +636,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -649,7 +649,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -660,7 +660,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleRequest>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -673,7 +673,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { NamespaceBuilder::< ::bevy::input::gamepad::RawGamepadAxisChangedEvent, >::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -686,7 +686,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -699,7 +699,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { NamespaceBuilder::< ::bevy::input::gamepad::RawGamepadButtonChangedEvent, >::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val< @@ -711,7 +711,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -725,7 +725,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::RawGamepadEvent>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -738,7 +738,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -749,7 +749,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gestures::PinchGesture>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -762,7 +762,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -773,7 +773,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gestures::RotationGesture>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -783,7 +783,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -797,7 +797,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gestures::DoubleTapGesture>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -810,7 +810,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -821,7 +821,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gestures::PanGesture>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -831,7 +831,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -845,7 +845,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::ButtonState>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -855,7 +855,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -865,7 +865,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -878,7 +878,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_pressed", |_self: Ref| { let output: bool = bevy::input::ButtonState::is_pressed(&_self) @@ -887,7 +887,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::ButtonSettings>::new(world) - .overwrite_script_function( + .register( "is_pressed", |_self: Ref, value: f32| { let output: bool = bevy::input::gamepad::ButtonSettings::is_pressed( @@ -898,7 +898,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_released", |_self: Ref, value: f32| { let output: bool = bevy::input::gamepad::ButtonSettings::is_released( @@ -909,7 +909,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "press_threshold", |_self: Ref| { let output: f32 = bevy::input::gamepad::ButtonSettings::press_threshold( @@ -919,7 +919,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_press_threshold", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::ButtonSettings::set_press_threshold( @@ -930,7 +930,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "release_threshold", |_self: Ref| { let output: f32 = bevy::input::gamepad::ButtonSettings::release_threshold( @@ -940,7 +940,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_release_threshold", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::ButtonSettings::set_release_threshold( @@ -951,7 +951,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -961,7 +961,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -975,7 +975,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::AxisSettings>::new(world) - .overwrite_script_function( + .register( "livezone_upperbound", |_self: Ref| { let output: f32 = bevy::input::gamepad::AxisSettings::livezone_upperbound( @@ -985,7 +985,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_livezone_upperbound", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_upperbound( @@ -996,7 +996,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "deadzone_upperbound", |_self: Ref| { let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_upperbound( @@ -1006,7 +1006,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_deadzone_upperbound", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_upperbound( @@ -1017,7 +1017,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "livezone_lowerbound", |_self: Ref| { let output: f32 = bevy::input::gamepad::AxisSettings::livezone_lowerbound( @@ -1027,7 +1027,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_livezone_lowerbound", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::AxisSettings::set_livezone_lowerbound( @@ -1038,7 +1038,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "deadzone_lowerbound", |_self: Ref| { let output: f32 = bevy::input::gamepad::AxisSettings::deadzone_lowerbound( @@ -1048,7 +1048,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_deadzone_lowerbound", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::AxisSettings::set_deadzone_lowerbound( @@ -1059,7 +1059,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "threshold", |_self: Ref| { let output: f32 = bevy::input::gamepad::AxisSettings::threshold( @@ -1069,7 +1069,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_threshold", |mut _self: Mut, value: f32| { let output: f32 = bevy::input::gamepad::AxisSettings::set_threshold( @@ -1080,7 +1080,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", |_self: Ref, new_value: f32| { let output: f32 = bevy::input::gamepad::AxisSettings::clamp( @@ -1091,7 +1091,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "filter", | _self: Ref, @@ -1107,7 +1107,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1117,7 +1117,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1131,7 +1131,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::ButtonAxisSettings>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1141,7 +1141,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "filter", | _self: Ref, @@ -1158,7 +1158,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::gamepad::GamepadRumbleIntensity>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1168,7 +1168,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1181,7 +1181,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "weak_motor", |intensity: f32| { let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::weak_motor( @@ -1191,7 +1191,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "strong_motor", |intensity: f32| { let output: Val = bevy::input::gamepad::GamepadRumbleIntensity::strong_motor( @@ -1202,7 +1202,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::keyboard::Key>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -1212,7 +1212,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1222,7 +1222,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1236,7 +1236,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::keyboard::NativeKeyCode>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1246,7 +1246,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -1256,7 +1256,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1270,7 +1270,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::keyboard::NativeKey>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1283,7 +1283,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -1293,7 +1293,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1304,7 +1304,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::mouse::MouseScrollUnit>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -1314,7 +1314,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1324,7 +1324,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1338,7 +1338,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::touch::TouchPhase>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1348,7 +1348,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -1358,7 +1358,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1372,7 +1372,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { }, ); NamespaceBuilder::<::bevy::input::touch::ForceTouch>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1385,7 +1385,7 @@ impl ::bevy::app::Plugin for BevyInputScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs index 680453e866..2d1c322ff1 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_math.rs @@ -13,7 +13,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::math::AspectRatio>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -23,7 +23,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -36,14 +36,14 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ratio", |_self: Ref| { let output: f32 = bevy::math::AspectRatio::ratio(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::AspectRatio::inverse( @@ -53,7 +53,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_landscape", |_self: Ref| { let output: bool = bevy::math::AspectRatio::is_landscape(&_self) @@ -61,7 +61,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_portrait", |_self: Ref| { let output: bool = bevy::math::AspectRatio::is_portrait(&_self) @@ -69,7 +69,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_square", |_self: Ref| { let output: bool = bevy::math::AspectRatio::is_square(&_self).into(); @@ -77,7 +77,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::CompassOctant>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -87,7 +87,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -100,7 +100,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -111,7 +111,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::CompassQuadrant>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -124,7 +124,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -134,7 +134,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -145,7 +145,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::Isometry2d>::new(world) - .overwrite_script_function( + .register( "from_rotation", |rotation: Val| { let output: Val = bevy::math::Isometry2d::from_rotation( @@ -155,7 +155,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xy", |x: f32, y: f32| { let output: Val = bevy::math::Isometry2d::from_xy( @@ -166,7 +166,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Isometry2d::inverse( @@ -176,7 +176,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse_mul", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Isometry2d::inverse_mul( @@ -187,7 +187,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -197,7 +197,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", | _self: Val, @@ -210,7 +210,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , other: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "mul", | _self: Val, @@ -244,7 +244,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xyz", |x: f32, y: f32, z: f32| { let output: Val = bevy::math::Isometry3d::from_xyz( @@ -256,7 +256,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Isometry3d::inverse( @@ -266,7 +266,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse_mul", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Isometry3d::inverse_mul( @@ -277,7 +277,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -287,7 +287,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , other: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: Val = ::clone( @@ -329,7 +329,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::Ray3d>::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: Val = ::clone( @@ -350,7 +350,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::Rot2>::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , @@ -373,7 +373,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = = bevy::math::Rot2::radians( @@ -393,7 +393,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "degrees", |degrees: f32| { let output: Val = bevy::math::Rot2::degrees( @@ -403,7 +403,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "turn_fraction", |fraction: f32| { let output: Val = bevy::math::Rot2::turn_fraction( @@ -413,7 +413,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_sin_cos", |sin: f32, cos: f32| { let output: Val = bevy::math::Rot2::from_sin_cos( @@ -424,7 +424,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_radians", |_self: Val| { let output: f32 = bevy::math::Rot2::as_radians(_self.into_inner()) @@ -432,7 +432,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_degrees", |_self: Val| { let output: f32 = bevy::math::Rot2::as_degrees(_self.into_inner()) @@ -440,7 +440,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_turn_fraction", |_self: Val| { let output: f32 = bevy::math::Rot2::as_turn_fraction( @@ -450,7 +450,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sin_cos", |_self: Val| { let output: (f32, f32) = bevy::math::Rot2::sin_cos( @@ -460,7 +460,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::Rot2::length(_self.into_inner()) @@ -468,7 +468,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f32 = bevy::math::Rot2::length_squared( @@ -478,7 +478,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f32 = bevy::math::Rot2::length_recip(_self.into_inner()) @@ -486,7 +486,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::Rot2::normalize( @@ -496,7 +496,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fast_renormalize", |_self: Val| { let output: Val = bevy::math::Rot2::fast_renormalize( @@ -506,7 +506,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::Rot2::is_finite(_self.into_inner()) @@ -514,7 +514,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::Rot2::is_nan(_self.into_inner()) @@ -522,7 +522,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::Rot2::is_normalized( @@ -532,7 +532,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_near_identity", |_self: Val| { let output: bool = bevy::math::Rot2::is_near_identity( @@ -542,7 +542,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, other: Val| { let output: f32 = bevy::math::Rot2::angle_between( @@ -553,7 +553,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_to", |_self: Val, other: Val| { let output: f32 = bevy::math::Rot2::angle_to( @@ -564,7 +564,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Val| { let output: Val = bevy::math::Rot2::inverse( @@ -574,7 +574,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "nlerp", |_self: Val, end: Val, s: f32| { let output: Val = bevy::math::Rot2::nlerp( @@ -586,7 +586,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slerp", |_self: Val, end: Val, s: f32| { let output: Val = bevy::math::Rot2::slerp( @@ -598,7 +598,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -609,7 +609,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::Dir2>::new(world) - .overwrite_script_function( + .register( "neg", |_self: Val| { let output: Val = ::neg( @@ -619,7 +619,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -629,7 +629,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -642,7 +642,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xy_unchecked", |x: f32, y: f32| { let output: Val = bevy::math::prelude::Dir2::from_xy_unchecked( @@ -653,7 +653,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slerp", | _self: Val, @@ -669,7 +669,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotation_to", | _self: Val, @@ -683,7 +683,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotation_from", | _self: Val, @@ -697,7 +697,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotation_from_x", |_self: Val| { let output: Val = bevy::math::prelude::Dir2::rotation_from_x( @@ -707,7 +707,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotation_to_x", |_self: Val| { let output: Val = bevy::math::prelude::Dir2::rotation_to_x( @@ -717,7 +717,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotation_from_y", |_self: Val| { let output: Val = bevy::math::prelude::Dir2::rotation_from_y( @@ -727,7 +727,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotation_to_y", |_self: Val| { let output: Val = bevy::math::prelude::Dir2::rotation_to_y( @@ -737,7 +737,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fast_renormalize", |_self: Val| { let output: Val = bevy::math::prelude::Dir2::fast_renormalize( @@ -748,7 +748,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::Dir3>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -758,7 +758,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "neg", |_self: Val| { let output: Val = ::neg( @@ -768,7 +768,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -781,7 +781,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { let output: Val = bevy::math::prelude::Dir3::from_xyz_unchecked( @@ -793,7 +793,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slerp", | _self: Val, @@ -809,7 +809,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fast_renormalize", |_self: Val| { let output: Val = bevy::math::prelude::Dir3::fast_renormalize( @@ -820,7 +820,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::Dir3A>::new(world) - .overwrite_script_function( + .register( "neg", |_self: Val| { let output: Val = ::neg( @@ -830,7 +830,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xyz_unchecked", |x: f32, y: f32, z: f32| { let output: Val = bevy::math::prelude::Dir3A::from_xyz_unchecked( @@ -842,7 +842,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slerp", | _self: Val, @@ -858,7 +858,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fast_renormalize", |_self: Val| { let output: Val = bevy::math::prelude::Dir3A::fast_renormalize( @@ -868,7 +868,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -878,7 +878,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -892,7 +892,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::IRect>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -905,7 +905,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -915,7 +915,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x0: i32, y0: i32, x1: i32, y1: i32| { let output: Val = bevy::math::prelude::IRect::new( @@ -928,7 +928,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_empty", |_self: Ref| { let output: bool = bevy::math::prelude::IRect::is_empty(&_self) @@ -936,21 +936,21 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "width", |_self: Ref| { let output: i32 = bevy::math::prelude::IRect::width(&_self).into(); output }, ) - .overwrite_script_function( + .register( "height", |_self: Ref| { let output: i32 = bevy::math::prelude::IRect::height(&_self).into(); output }, ) - .overwrite_script_function( + .register( "union", | _self: Ref, @@ -964,7 +964,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "intersect", | _self: Ref, @@ -978,7 +978,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inflate", |_self: Ref, expansion: i32| { let output: Val = bevy::math::prelude::IRect::inflate( @@ -989,7 +989,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_rect", |_self: Ref| { let output: Val = bevy::math::prelude::IRect::as_rect( @@ -999,7 +999,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_urect", |_self: Ref| { let output: Val = bevy::math::prelude::IRect::as_urect( @@ -1009,7 +1009,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1020,7 +1020,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::Rect>::new(world) - .overwrite_script_function( + .register( "new", |x0: f32, y0: f32, x1: f32, y1: f32| { let output: Val = bevy::math::prelude::Rect::new( @@ -1033,7 +1033,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_empty", |_self: Ref| { let output: bool = bevy::math::prelude::Rect::is_empty(&_self) @@ -1041,21 +1041,21 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "width", |_self: Ref| { let output: f32 = bevy::math::prelude::Rect::width(&_self).into(); output }, ) - .overwrite_script_function( + .register( "height", |_self: Ref| { let output: f32 = bevy::math::prelude::Rect::height(&_self).into(); output }, ) - .overwrite_script_function( + .register( "union", | _self: Ref, @@ -1069,7 +1069,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "intersect", | _self: Ref, @@ -1083,7 +1083,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inflate", |_self: Ref, expansion: f32| { let output: Val = bevy::math::prelude::Rect::inflate( @@ -1094,7 +1094,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", | _self: Ref, @@ -1108,7 +1108,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_irect", |_self: Ref| { let output: Val = bevy::math::prelude::Rect::as_irect( @@ -1118,7 +1118,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_urect", |_self: Ref| { let output: Val = bevy::math::prelude::Rect::as_urect( @@ -1128,7 +1128,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1138,7 +1138,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1152,7 +1152,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::prelude::URect>::new(world) - .overwrite_script_function( + .register( "new", |x0: u32, y0: u32, x1: u32, y1: u32| { let output: Val = bevy::math::prelude::URect::new( @@ -1165,7 +1165,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_empty", |_self: Ref| { let output: bool = bevy::math::prelude::URect::is_empty(&_self) @@ -1173,21 +1173,21 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "width", |_self: Ref| { let output: u32 = bevy::math::prelude::URect::width(&_self).into(); output }, ) - .overwrite_script_function( + .register( "height", |_self: Ref| { let output: u32 = bevy::math::prelude::URect::height(&_self).into(); output }, ) - .overwrite_script_function( + .register( "union", | _self: Ref, @@ -1201,7 +1201,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "intersect", | _self: Ref, @@ -1215,7 +1215,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inflate", |_self: Ref, expansion: i32| { let output: Val = bevy::math::prelude::URect::inflate( @@ -1226,7 +1226,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_rect", |_self: Ref| { let output: Val = bevy::math::prelude::URect::as_rect( @@ -1236,7 +1236,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_irect", |_self: Ref| { let output: Val = bevy::math::prelude::URect::as_irect( @@ -1246,7 +1246,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -1256,7 +1256,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1269,7 +1269,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1281,7 +1281,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { ); NamespaceBuilder::<::bevy::math::Affine3>::new(world); NamespaceBuilder::<::bevy::math::bounding::Aabb2d>::new(world) - .overwrite_script_function( + .register( "bounding_circle", |_self: Ref| { let output: Val = bevy::math::bounding::Aabb2d::bounding_circle( @@ -1291,7 +1291,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1302,7 +1302,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingCircle>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1312,7 +1312,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "radius", |_self: Ref| { let output: f32 = bevy::math::bounding::BoundingCircle::radius( @@ -1322,7 +1322,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "aabb_2d", |_self: Ref| { let output: Val = bevy::math::bounding::BoundingCircle::aabb_2d( @@ -1333,7 +1333,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Circle>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1343,7 +1343,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1356,7 +1356,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |radius: f32| { let output: Val = bevy::math::primitives::Circle::new( @@ -1366,7 +1366,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "diameter", |_self: Ref| { let output: f32 = bevy::math::primitives::Circle::diameter(&_self) @@ -1375,7 +1375,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Annulus>::new(world) - .overwrite_script_function( + .register( "new", |inner_radius: f32, outer_radius: f32| { let output: Val = bevy::math::primitives::Annulus::new( @@ -1386,7 +1386,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "diameter", |_self: Ref| { let output: f32 = bevy::math::primitives::Annulus::diameter(&_self) @@ -1394,7 +1394,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "thickness", |_self: Ref| { let output: f32 = bevy::math::primitives::Annulus::thickness(&_self) @@ -1402,7 +1402,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1412,7 +1412,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1426,7 +1426,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Arc2d>::new(world) - .overwrite_script_function( + .register( "new", |radius: f32, half_angle: f32| { let output: Val = bevy::math::primitives::Arc2d::new( @@ -1437,7 +1437,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_radians", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::Arc2d::from_radians( @@ -1448,7 +1448,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_degrees", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::Arc2d::from_degrees( @@ -1459,7 +1459,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_turns", |radius: f32, fraction: f32| { let output: Val = bevy::math::primitives::Arc2d::from_turns( @@ -1470,7 +1470,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle", |_self: Ref| { let output: f32 = bevy::math::primitives::Arc2d::angle(&_self) @@ -1478,7 +1478,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Ref| { let output: f32 = bevy::math::primitives::Arc2d::length(&_self) @@ -1486,7 +1486,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "half_chord_length", |_self: Ref| { let output: f32 = bevy::math::primitives::Arc2d::half_chord_length( @@ -1496,7 +1496,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "chord_length", |_self: Ref| { let output: f32 = bevy::math::primitives::Arc2d::chord_length(&_self) @@ -1504,7 +1504,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "apothem", |_self: Ref| { let output: f32 = bevy::math::primitives::Arc2d::apothem(&_self) @@ -1512,7 +1512,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sagitta", |_self: Ref| { let output: f32 = bevy::math::primitives::Arc2d::sagitta(&_self) @@ -1520,7 +1520,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_minor", |_self: Ref| { let output: bool = bevy::math::primitives::Arc2d::is_minor(&_self) @@ -1528,7 +1528,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_major", |_self: Ref| { let output: bool = bevy::math::primitives::Arc2d::is_major(&_self) @@ -1536,7 +1536,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1549,7 +1549,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1560,7 +1560,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Capsule2d>::new(world) - .overwrite_script_function( + .register( "new", |radius: f32, length: f32| { let output: Val = bevy::math::primitives::Capsule2d::new( @@ -1571,7 +1571,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_inner_rectangle", |_self: Ref| { let output: Val = bevy::math::primitives::Capsule2d::to_inner_rectangle( @@ -1581,7 +1581,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1594,7 +1594,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1605,7 +1605,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::CircularSector>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1615,7 +1615,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1628,7 +1628,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::CircularSector::new( @@ -1639,7 +1639,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_radians", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::CircularSector::from_radians( @@ -1650,7 +1650,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_degrees", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::CircularSector::from_degrees( @@ -1661,7 +1661,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_turns", |radius: f32, fraction: f32| { let output: Val = bevy::math::primitives::CircularSector::from_turns( @@ -1672,7 +1672,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "half_angle", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::half_angle( @@ -1682,7 +1682,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::angle( @@ -1692,7 +1692,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "radius", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::radius( @@ -1702,7 +1702,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "arc_length", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::arc_length( @@ -1712,7 +1712,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "half_chord_length", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::half_chord_length( @@ -1722,7 +1722,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "chord_length", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::chord_length( @@ -1732,7 +1732,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "apothem", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::apothem( @@ -1742,7 +1742,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sagitta", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSector::sagitta( @@ -1753,7 +1753,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::CircularSegment>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1763,7 +1763,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::CircularSegment::new( @@ -1774,7 +1774,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_radians", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::CircularSegment::from_radians( @@ -1785,7 +1785,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_degrees", |radius: f32, angle: f32| { let output: Val = bevy::math::primitives::CircularSegment::from_degrees( @@ -1796,7 +1796,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_turns", |radius: f32, fraction: f32| { let output: Val = bevy::math::primitives::CircularSegment::from_turns( @@ -1807,7 +1807,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "half_angle", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::half_angle( @@ -1817,7 +1817,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::angle( @@ -1827,7 +1827,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "radius", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::radius( @@ -1837,7 +1837,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "arc_length", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::arc_length( @@ -1847,7 +1847,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "half_chord_length", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::half_chord_length( @@ -1857,7 +1857,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "chord_length", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::chord_length( @@ -1867,7 +1867,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "apothem", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::apothem( @@ -1877,7 +1877,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sagitta", |_self: Ref| { let output: f32 = bevy::math::primitives::CircularSegment::sagitta( @@ -1887,7 +1887,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1901,7 +1901,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Ellipse>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1911,7 +1911,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1924,7 +1924,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |half_width: f32, half_height: f32| { let output: Val = bevy::math::primitives::Ellipse::new( @@ -1935,7 +1935,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eccentricity", |_self: Ref| { let output: f32 = bevy::math::primitives::Ellipse::eccentricity( @@ -1945,7 +1945,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "focal_length", |_self: Ref| { let output: f32 = bevy::math::primitives::Ellipse::focal_length( @@ -1955,7 +1955,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "semi_major", |_self: Ref| { let output: f32 = bevy::math::primitives::Ellipse::semi_major(&_self) @@ -1963,7 +1963,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "semi_minor", |_self: Ref| { let output: f32 = bevy::math::primitives::Ellipse::semi_minor(&_self) @@ -1972,7 +1972,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Line2d>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -1985,7 +1985,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -1996,7 +1996,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Plane2d>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2009,7 +2009,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2020,7 +2020,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Rectangle>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2033,7 +2033,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |width: f32, height: f32| { let output: Val = bevy::math::primitives::Rectangle::new( @@ -2044,7 +2044,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_length", |length: f32| { let output: Val = bevy::math::primitives::Rectangle::from_length( @@ -2054,7 +2054,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2065,7 +2065,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::RegularPolygon>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2078,7 +2078,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |circumradius: f32, sides: u32| { let output: Val = bevy::math::primitives::RegularPolygon::new( @@ -2089,7 +2089,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "circumradius", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::circumradius( @@ -2099,7 +2099,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inradius", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::inradius( @@ -2109,7 +2109,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "side_length", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::side_length( @@ -2119,7 +2119,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "internal_angle_degrees", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_degrees( @@ -2129,7 +2129,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "internal_angle_radians", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::internal_angle_radians( @@ -2139,7 +2139,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "external_angle_degrees", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_degrees( @@ -2149,7 +2149,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "external_angle_radians", |_self: Ref| { let output: f32 = bevy::math::primitives::RegularPolygon::external_angle_radians( @@ -2159,7 +2159,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2170,7 +2170,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Rhombus>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2183,7 +2183,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2193,7 +2193,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |horizontal_diagonal: f32, vertical_diagonal: f32| { let output: Val = bevy::math::primitives::Rhombus::new( @@ -2204,7 +2204,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_side", |side: f32| { let output: Val = bevy::math::primitives::Rhombus::from_side( @@ -2214,7 +2214,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_inradius", |inradius: f32| { let output: Val = bevy::math::primitives::Rhombus::from_inradius( @@ -2224,7 +2224,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "side", |_self: Ref| { let output: f32 = bevy::math::primitives::Rhombus::side(&_self) @@ -2232,7 +2232,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "circumradius", |_self: Ref| { let output: f32 = bevy::math::primitives::Rhombus::circumradius( @@ -2242,7 +2242,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inradius", |_self: Ref| { let output: f32 = bevy::math::primitives::Rhombus::inradius(&_self) @@ -2251,7 +2251,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Segment2d>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2264,7 +2264,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2274,7 +2274,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |direction: Val, length: f32| { let output: Val = bevy::math::primitives::Segment2d::new( @@ -2286,7 +2286,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Triangle2d>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2299,7 +2299,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2309,7 +2309,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_degenerate", |_self: Ref| { let output: bool = bevy::math::primitives::Triangle2d::is_degenerate( @@ -2319,7 +2319,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_acute", |_self: Ref| { let output: bool = bevy::math::primitives::Triangle2d::is_acute( @@ -2329,7 +2329,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_obtuse", |_self: Ref| { let output: bool = bevy::math::primitives::Triangle2d::is_obtuse( @@ -2339,7 +2339,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reverse", |mut _self: Mut| { let output: () = bevy::math::primitives::Triangle2d::reverse( @@ -2349,7 +2349,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reversed", |_self: Val| { let output: Val = bevy::math::primitives::Triangle2d::reversed( @@ -2360,7 +2360,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::Aabb3d>::new(world) - .overwrite_script_function( + .register( "bounding_sphere", |_self: Ref| { let output: Val = bevy::math::bounding::Aabb3d::bounding_sphere( @@ -2370,7 +2370,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2381,7 +2381,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingSphere>::new(world) - .overwrite_script_function( + .register( "radius", |_self: Ref| { let output: f32 = bevy::math::bounding::BoundingSphere::radius( @@ -2391,7 +2391,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "aabb_3d", |_self: Ref| { let output: Val = bevy::math::bounding::BoundingSphere::aabb_3d( @@ -2401,7 +2401,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2412,7 +2412,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Sphere>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2425,7 +2425,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |radius: f32| { let output: Val = bevy::math::primitives::Sphere::new( @@ -2435,7 +2435,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "diameter", |_self: Ref| { let output: f32 = bevy::math::primitives::Sphere::diameter(&_self) @@ -2443,7 +2443,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2454,7 +2454,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Cuboid>::new(world) - .overwrite_script_function( + .register( "new", |x_length: f32, y_length: f32, z_length: f32| { let output: Val = bevy::math::primitives::Cuboid::new( @@ -2466,7 +2466,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_length", |length: f32| { let output: Val = bevy::math::primitives::Cuboid::from_length( @@ -2476,7 +2476,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2489,7 +2489,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2500,7 +2500,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Cylinder>::new(world) - .overwrite_script_function( + .register( "new", |radius: f32, height: f32| { let output: Val = bevy::math::primitives::Cylinder::new( @@ -2511,7 +2511,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "base", |_self: Ref| { let output: Val = bevy::math::primitives::Cylinder::base( @@ -2521,7 +2521,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lateral_area", |_self: Ref| { let output: f32 = bevy::math::primitives::Cylinder::lateral_area( @@ -2531,7 +2531,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "base_area", |_self: Ref| { let output: f32 = bevy::math::primitives::Cylinder::base_area(&_self) @@ -2539,7 +2539,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2549,7 +2549,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2563,7 +2563,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Capsule3d>::new(world) - .overwrite_script_function( + .register( "new", |radius: f32, length: f32| { let output: Val = bevy::math::primitives::Capsule3d::new( @@ -2574,7 +2574,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cylinder", |_self: Ref| { let output: Val = bevy::math::primitives::Capsule3d::to_cylinder( @@ -2584,7 +2584,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2597,7 +2597,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2608,7 +2608,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Cone>::new(world) - .overwrite_script_function( + .register( "new", |radius: f32, height: f32| { let output: Val = bevy::math::primitives::Cone::new( @@ -2619,7 +2619,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "base", |_self: Ref| { let output: Val = bevy::math::primitives::Cone::base( @@ -2629,7 +2629,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slant_height", |_self: Ref| { let output: f32 = bevy::math::primitives::Cone::slant_height(&_self) @@ -2637,7 +2637,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lateral_area", |_self: Ref| { let output: f32 = bevy::math::primitives::Cone::lateral_area(&_self) @@ -2645,7 +2645,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "base_area", |_self: Ref| { let output: f32 = bevy::math::primitives::Cone::base_area(&_self) @@ -2653,7 +2653,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2663,7 +2663,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2677,7 +2677,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::ConicalFrustum>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2687,7 +2687,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2701,7 +2701,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::InfinitePlane3d>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2711,7 +2711,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2725,7 +2725,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Line3d>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2738,7 +2738,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2749,7 +2749,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Segment3d>::new(world) - .overwrite_script_function( + .register( "new", |direction: Val, length: f32| { let output: Val = bevy::math::primitives::Segment3d::new( @@ -2760,7 +2760,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2773,7 +2773,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2784,7 +2784,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Torus>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2794,7 +2794,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |inner_radius: f32, outer_radius: f32| { let output: Val = bevy::math::primitives::Torus::new( @@ -2805,7 +2805,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inner_radius", |_self: Ref| { let output: f32 = bevy::math::primitives::Torus::inner_radius(&_self) @@ -2813,7 +2813,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "outer_radius", |_self: Ref| { let output: f32 = bevy::math::primitives::Torus::outer_radius(&_self) @@ -2821,7 +2821,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2835,7 +2835,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Triangle3d>::new(world) - .overwrite_script_function( + .register( "is_degenerate", |_self: Ref| { let output: bool = bevy::math::primitives::Triangle3d::is_degenerate( @@ -2845,7 +2845,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_acute", |_self: Ref| { let output: bool = bevy::math::primitives::Triangle3d::is_acute( @@ -2855,7 +2855,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_obtuse", |_self: Ref| { let output: bool = bevy::math::primitives::Triangle3d::is_obtuse( @@ -2865,7 +2865,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reverse", |mut _self: Mut| { let output: () = bevy::math::primitives::Triangle3d::reverse( @@ -2875,7 +2875,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reversed", |_self: Val| { let output: Val = bevy::math::primitives::Triangle3d::reversed( @@ -2885,7 +2885,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -2898,7 +2898,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2909,7 +2909,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::RayCast2d>::new(world) - .overwrite_script_function( + .register( "from_ray", |ray: Val, max: f32| { let output: Val = bevy::math::bounding::RayCast2d::from_ray( @@ -2920,7 +2920,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "aabb_intersection_at", | _self: Ref, @@ -2934,7 +2934,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "circle_intersection_at", | _self: Ref, @@ -2948,7 +2948,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2959,7 +2959,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::AabbCast2d>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2969,7 +2969,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_ray", | aabb: Val, @@ -2985,7 +2985,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "aabb_collision_at", | _self: Ref, @@ -3000,7 +3000,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingCircleCast>::new(world) - .overwrite_script_function( + .register( "from_ray", | circle: Val, @@ -3016,7 +3016,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "circle_collision_at", | _self: Ref, @@ -3030,7 +3030,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3041,7 +3041,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::RayCast3d>::new(world) - .overwrite_script_function( + .register( "from_ray", |ray: Val, max: f32| { let output: Val = bevy::math::bounding::RayCast3d::from_ray( @@ -3052,7 +3052,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "aabb_intersection_at", | _self: Ref, @@ -3066,7 +3066,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sphere_intersection_at", | _self: Ref, @@ -3080,7 +3080,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3091,7 +3091,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::AabbCast3d>::new(world) - .overwrite_script_function( + .register( "from_ray", | aabb: Val, @@ -3107,7 +3107,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "aabb_collision_at", | _self: Ref, @@ -3121,7 +3121,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3132,7 +3132,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::bounding::BoundingSphereCast>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3142,7 +3142,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_ray", | sphere: Val, @@ -3158,7 +3158,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sphere_collision_at", | _self: Ref, @@ -3173,7 +3173,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::curve::interval::Interval>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3183,7 +3183,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "start", |_self: Val| { let output: f32 = bevy::math::curve::interval::Interval::start( @@ -3193,7 +3193,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "end", |_self: Val| { let output: f32 = bevy::math::curve::interval::Interval::end( @@ -3203,7 +3203,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::curve::interval::Interval::length( @@ -3213,7 +3213,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_bounded", |_self: Val| { let output: bool = bevy::math::curve::interval::Interval::is_bounded( @@ -3223,7 +3223,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "has_finite_start", |_self: Val| { let output: bool = bevy::math::curve::interval::Interval::has_finite_start( @@ -3233,7 +3233,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "has_finite_end", |_self: Val| { let output: bool = bevy::math::curve::interval::Interval::has_finite_end( @@ -3243,7 +3243,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "contains", |_self: Val, item: f32| { let output: bool = bevy::math::curve::interval::Interval::contains( @@ -3254,7 +3254,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "contains_interval", | _self: Val, @@ -3268,7 +3268,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", |_self: Val, value: f32| { let output: f32 = bevy::math::curve::interval::Interval::clamp( @@ -3279,7 +3279,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -3293,7 +3293,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::FloatOrd>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3303,7 +3303,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lt", |_self: Ref, other: Ref| { let output: bool = , other: Ref| { let output: bool = , other: Ref| { let output: bool = , other: Ref| { let output: bool = | { let output: Val = ::neg( @@ -3353,7 +3353,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3374,7 +3374,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -3388,7 +3388,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::primitives::Tetrahedron>::new(world) - .overwrite_script_function( + .register( "signed_volume", |_self: Ref| { let output: f32 = bevy::math::primitives::Tetrahedron::signed_volume( @@ -3398,7 +3398,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -3411,7 +3411,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3422,7 +3422,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::curve::easing::EaseFunction>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -3432,7 +3432,7 @@ impl ::bevy::app::Plugin for BevyMathScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs index 840e61ba15..2104e1c9a1 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_reflect.rs @@ -12,7 +12,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::std::sync::atomic::AtomicBool>::new(world) - .overwrite_script_function( + .register( "new", |v: bool| { let output: Val = std::sync::atomic::AtomicBool::new( @@ -22,7 +22,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: bool = std::sync::atomic::AtomicBool::into_inner( @@ -33,7 +33,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicI16>::new(world) - .overwrite_script_function( + .register( "new", |v: i16| { let output: Val = std::sync::atomic::AtomicI16::new( @@ -43,7 +43,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: i16 = std::sync::atomic::AtomicI16::into_inner( @@ -54,7 +54,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicI32>::new(world) - .overwrite_script_function( + .register( "new", |v: i32| { let output: Val = std::sync::atomic::AtomicI32::new( @@ -64,7 +64,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: i32 = std::sync::atomic::AtomicI32::into_inner( @@ -75,7 +75,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicI64>::new(world) - .overwrite_script_function( + .register( "new", |v: i64| { let output: Val = std::sync::atomic::AtomicI64::new( @@ -85,7 +85,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: i64 = std::sync::atomic::AtomicI64::into_inner( @@ -96,7 +96,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicI8>::new(world) - .overwrite_script_function( + .register( "new", |v: i8| { let output: Val = std::sync::atomic::AtomicI8::new( @@ -106,7 +106,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: i8 = std::sync::atomic::AtomicI8::into_inner( @@ -117,7 +117,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicIsize>::new(world) - .overwrite_script_function( + .register( "new", |v: isize| { let output: Val = std::sync::atomic::AtomicIsize::new( @@ -127,7 +127,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: isize = std::sync::atomic::AtomicIsize::into_inner( @@ -138,7 +138,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicU16>::new(world) - .overwrite_script_function( + .register( "new", |v: u16| { let output: Val = std::sync::atomic::AtomicU16::new( @@ -148,7 +148,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: u16 = std::sync::atomic::AtomicU16::into_inner( @@ -159,7 +159,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicU32>::new(world) - .overwrite_script_function( + .register( "new", |v: u32| { let output: Val = std::sync::atomic::AtomicU32::new( @@ -169,7 +169,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: u32 = std::sync::atomic::AtomicU32::into_inner( @@ -180,7 +180,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicU64>::new(world) - .overwrite_script_function( + .register( "new", |v: u64| { let output: Val = std::sync::atomic::AtomicU64::new( @@ -190,7 +190,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: u64 = std::sync::atomic::AtomicU64::into_inner( @@ -201,7 +201,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicU8>::new(world) - .overwrite_script_function( + .register( "new", |v: u8| { let output: Val = std::sync::atomic::AtomicU8::new( @@ -211,7 +211,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: u8 = std::sync::atomic::AtomicU8::into_inner( @@ -222,7 +222,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::std::sync::atomic::AtomicUsize>::new(world) - .overwrite_script_function( + .register( "new", |v: usize| { let output: Val = std::sync::atomic::AtomicUsize::new( @@ -232,7 +232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "into_inner", |_self: Val| { let output: usize = std::sync::atomic::AtomicUsize::into_inner( @@ -243,7 +243,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::utils::Duration>::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: u32| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -263,7 +263,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -273,7 +273,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = , rhs: u32| { let output: Val = = bevy::utils::Duration::new( @@ -324,7 +324,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_secs", |secs: u64| { let output: Val = bevy::utils::Duration::from_secs( @@ -334,7 +334,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_millis", |millis: u64| { let output: Val = bevy::utils::Duration::from_millis( @@ -344,7 +344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_micros", |micros: u64| { let output: Val = bevy::utils::Duration::from_micros( @@ -354,7 +354,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_nanos", |nanos: u64| { let output: Val = bevy::utils::Duration::from_nanos( @@ -364,21 +364,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_zero", |_self: Ref| { let output: bool = bevy::utils::Duration::is_zero(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_secs", |_self: Ref| { let output: u64 = bevy::utils::Duration::as_secs(&_self).into(); output }, ) - .overwrite_script_function( + .register( "subsec_millis", |_self: Ref| { let output: u32 = bevy::utils::Duration::subsec_millis(&_self) @@ -386,7 +386,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "subsec_micros", |_self: Ref| { let output: u32 = bevy::utils::Duration::subsec_micros(&_self) @@ -394,35 +394,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "subsec_nanos", |_self: Ref| { let output: u32 = bevy::utils::Duration::subsec_nanos(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_millis", |_self: Ref| { let output: u128 = bevy::utils::Duration::as_millis(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_micros", |_self: Ref| { let output: u128 = bevy::utils::Duration::as_micros(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_nanos", |_self: Ref| { let output: u128 = bevy::utils::Duration::as_nanos(&_self).into(); output }, ) - .overwrite_script_function( + .register( "abs_diff", |_self: Val, other: Val| { let output: Val = bevy::utils::Duration::abs_diff( @@ -433,7 +433,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::utils::Duration::saturating_add( @@ -444,7 +444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::utils::Duration::saturating_sub( @@ -455,7 +455,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: u32| { let output: Val = bevy::utils::Duration::saturating_mul( @@ -466,21 +466,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_secs_f64", |_self: Ref| { let output: f64 = bevy::utils::Duration::as_secs_f64(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_secs_f32", |_self: Ref| { let output: f32 = bevy::utils::Duration::as_secs_f32(&_self).into(); output }, ) - .overwrite_script_function( + .register( "from_secs_f64", |secs: f64| { let output: Val = bevy::utils::Duration::from_secs_f64( @@ -490,7 +490,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_secs_f32", |secs: f32| { let output: Val = bevy::utils::Duration::from_secs_f32( @@ -500,7 +500,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_f64", |_self: Val, rhs: f64| { let output: Val = bevy::utils::Duration::mul_f64( @@ -511,7 +511,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_f32", |_self: Val, rhs: f32| { let output: Val = bevy::utils::Duration::mul_f32( @@ -522,7 +522,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_f64", |_self: Val, rhs: f64| { let output: Val = bevy::utils::Duration::div_f64( @@ -533,7 +533,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_f32", |_self: Val, rhs: f32| { let output: Val = bevy::utils::Duration::div_f32( @@ -544,7 +544,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_duration_f64", |_self: Val, rhs: Val| { let output: f64 = bevy::utils::Duration::div_duration_f64( @@ -555,7 +555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_duration_f32", |_self: Val, rhs: Val| { let output: f32 = bevy::utils::Duration::div_duration_f32( @@ -567,7 +567,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::utils::Instant>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -577,7 +577,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , other: Val| { let output: Val = , other: Val| { let output: Val = = bevy::utils::Instant::now() @@ -615,7 +615,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "duration_since", |_self: Ref, earlier: Val| { let output: Val = bevy::utils::Instant::duration_since( @@ -626,7 +626,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_duration_since", |_self: Ref, earlier: Val| { let output: Val = bevy::utils::Instant::saturating_duration_since( @@ -637,7 +637,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "elapsed", |_self: Ref| { let output: Val = bevy::utils::Instant::elapsed( @@ -647,7 +647,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -657,7 +657,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, other: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -678,7 +678,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -688,7 +688,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = | { let output: Val = ::clone( @@ -739,7 +739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::neg( @@ -779,7 +779,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: f32| { let output: Val = = bevy::math::Quat::from_xyzw( @@ -812,7 +812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f32; 4]| { let output: Val = bevy::math::Quat::from_array(a) @@ -820,7 +820,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_vec4", |v: Val| { let output: Val = bevy::math::Quat::from_vec4( @@ -830,7 +830,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f32| { let output: Val = bevy::math::Quat::from_axis_angle( @@ -841,7 +841,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scaled_axis", |v: Val| { let output: Val = bevy::math::Quat::from_scaled_axis( @@ -851,7 +851,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f32| { let output: Val = bevy::math::Quat::from_rotation_x( @@ -861,7 +861,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f32| { let output: Val = bevy::math::Quat::from_rotation_y( @@ -871,7 +871,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f32| { let output: Val = bevy::math::Quat::from_rotation_z( @@ -881,7 +881,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |euler: Val, a: f32, b: f32, c: f32| { let output: Val = bevy::math::Quat::from_euler( @@ -894,7 +894,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |mat: Ref| { let output: Val = bevy::math::Quat::from_mat3(&mat) @@ -902,7 +902,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3a", |mat: Ref| { let output: Val = bevy::math::Quat::from_mat3a( @@ -912,7 +912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |mat: Ref| { let output: Val = bevy::math::Quat::from_mat4(&mat) @@ -920,7 +920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_arc", |from: Val, to: Val| { let output: Val = bevy::math::Quat::from_rotation_arc( @@ -931,7 +931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_arc_colinear", |from: Val, to: Val| { let output: Val = bevy::math::Quat::from_rotation_arc_colinear( @@ -942,7 +942,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_arc_2d", |from: Val, to: Val| { let output: Val = bevy::math::Quat::from_rotation_arc_2d( @@ -953,7 +953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_scaled_axis", |_self: Val| { let output: Val = bevy::math::Quat::to_scaled_axis( @@ -963,7 +963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Val, order: Val| { let output: (f32, f32, f32) = bevy::math::Quat::to_euler( @@ -974,14 +974,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f32; 4] = bevy::math::Quat::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "xyz", |_self: Val| { let output: Val = bevy::math::Quat::xyz( @@ -991,7 +991,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "conjugate", |_self: Val| { let output: Val = bevy::math::Quat::conjugate( @@ -1001,7 +1001,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Val| { let output: Val = bevy::math::Quat::inverse( @@ -1011,7 +1011,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Quat::dot( @@ -1022,7 +1022,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::Quat::length(_self.into_inner()) @@ -1030,7 +1030,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f32 = bevy::math::Quat::length_squared( @@ -1040,7 +1040,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f32 = bevy::math::Quat::length_recip(_self.into_inner()) @@ -1048,7 +1048,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::Quat::normalize( @@ -1058,7 +1058,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::Quat::is_finite(_self.into_inner()) @@ -1066,7 +1066,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::Quat::is_nan(_self.into_inner()) @@ -1074,7 +1074,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::Quat::is_normalized( @@ -1084,7 +1084,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_near_identity", |_self: Val| { let output: bool = bevy::math::Quat::is_near_identity( @@ -1094,7 +1094,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Quat::angle_between( @@ -1105,7 +1105,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_towards", | _self: Ref, @@ -1121,7 +1121,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -1137,7 +1137,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, end: Val, s: f32| { let output: Val = bevy::math::Quat::lerp( @@ -1149,7 +1149,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slerp", |_self: Val, end: Val, s: f32| { let output: Val = bevy::math::Quat::slerp( @@ -1161,7 +1161,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3", |_self: Val, rhs: Val| { let output: Val = bevy::math::Quat::mul_vec3( @@ -1172,7 +1172,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_quat", |_self: Val, rhs: Val| { let output: Val = bevy::math::Quat::mul_quat( @@ -1183,7 +1183,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_affine3", |a: Ref| { let output: Val = bevy::math::Quat::from_affine3( @@ -1193,7 +1193,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3a", |_self: Val, rhs: Val| { let output: Val = bevy::math::Quat::mul_vec3a( @@ -1204,7 +1204,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dquat", |_self: Val| { let output: Val = bevy::math::Quat::as_dquat( @@ -1215,7 +1215,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::Vec3>::new(world) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -1295,7 +1295,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: f32| { let output: Val = = bevy::math::Vec3::new(x, y, z) @@ -1313,7 +1313,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f32| { let output: Val = bevy::math::Vec3::splat(v) @@ -1321,7 +1321,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -1337,7 +1337,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f32; 3]| { let output: Val = bevy::math::Vec3::from_array(a) @@ -1345,14 +1345,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f32; 3] = bevy::math::Vec3::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: f32| { let output: Val = bevy::math::Vec3::extend( @@ -1363,7 +1363,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::Vec3::truncate( @@ -1373,7 +1373,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f32| { let output: Val = bevy::math::Vec3::with_x( @@ -1384,7 +1384,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f32| { let output: Val = bevy::math::Vec3::with_y( @@ -1395,7 +1395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: f32| { let output: Val = bevy::math::Vec3::with_z( @@ -1406,7 +1406,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3::dot( @@ -1417,7 +1417,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::dot_into_vec( @@ -1428,7 +1428,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cross( @@ -1439,7 +1439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::min( @@ -1450,7 +1450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::max( @@ -1461,7 +1461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -1477,7 +1477,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f32 = bevy::math::Vec3::min_element(_self.into_inner()) @@ -1485,7 +1485,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f32 = bevy::math::Vec3::max_element(_self.into_inner()) @@ -1493,7 +1493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f32 = bevy::math::Vec3::element_sum(_self.into_inner()) @@ -1501,7 +1501,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f32 = bevy::math::Vec3::element_product( @@ -1511,7 +1511,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cmpeq( @@ -1522,7 +1522,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cmpne( @@ -1533,7 +1533,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cmpge( @@ -1544,7 +1544,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cmpgt( @@ -1555,7 +1555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cmple( @@ -1566,7 +1566,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::cmplt( @@ -1577,7 +1577,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::Vec3::abs( @@ -1587,7 +1587,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::Vec3::signum( @@ -1597,7 +1597,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::copysign( @@ -1608,7 +1608,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::Vec3::is_negative_bitmask( @@ -1618,7 +1618,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::Vec3::is_finite(_self.into_inner()) @@ -1626,7 +1626,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::Vec3::is_finite_mask( @@ -1636,7 +1636,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::Vec3::is_nan(_self.into_inner()) @@ -1644,7 +1644,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::Vec3::is_nan_mask( @@ -1654,7 +1654,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::Vec3::length(_self.into_inner()) @@ -1662,7 +1662,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f32 = bevy::math::Vec3::length_squared( @@ -1672,7 +1672,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f32 = bevy::math::Vec3::length_recip(_self.into_inner()) @@ -1680,7 +1680,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3::distance( @@ -1691,7 +1691,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3::distance_squared( @@ -1702,7 +1702,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::div_euclid( @@ -1713,7 +1713,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::rem_euclid( @@ -1724,7 +1724,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::Vec3::normalize( @@ -1734,7 +1734,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::Vec3::normalize_or( @@ -1745,7 +1745,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::Vec3::normalize_or_zero( @@ -1755,7 +1755,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::Vec3::is_normalized( @@ -1765,7 +1765,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::project_onto( @@ -1776,7 +1776,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::reject_from( @@ -1787,7 +1787,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::project_onto_normalized( @@ -1798,7 +1798,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::reject_from_normalized( @@ -1809,7 +1809,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::Vec3::round( @@ -1819,7 +1819,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::Vec3::floor( @@ -1829,7 +1829,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::Vec3::ceil( @@ -1839,7 +1839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::Vec3::trunc( @@ -1849,7 +1849,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::Vec3::fract( @@ -1859,7 +1859,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::Vec3::fract_gl( @@ -1869,7 +1869,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::Vec3::exp( @@ -1879,7 +1879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f32| { let output: Val = bevy::math::Vec3::powf( @@ -1890,7 +1890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::Vec3::recip( @@ -1900,7 +1900,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = bevy::math::Vec3::lerp( @@ -1912,7 +1912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = bevy::math::Vec3::move_towards( @@ -1924,7 +1924,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3::midpoint( @@ -1935,7 +1935,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -1951,7 +1951,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = bevy::math::Vec3::clamp_length( @@ -1963,7 +1963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f32| { let output: Val = bevy::math::Vec3::clamp_length_max( @@ -1974,7 +1974,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f32| { let output: Val = bevy::math::Vec3::clamp_length_min( @@ -1985,7 +1985,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -2001,7 +2001,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::Vec3::reflect( @@ -2012,7 +2012,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", |_self: Val, normal: Val, eta: f32| { let output: Val = bevy::math::Vec3::refract( @@ -2024,7 +2024,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3::angle_between( @@ -2035,7 +2035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any_orthogonal_vector", |_self: Ref| { let output: Val = bevy::math::Vec3::any_orthogonal_vector( @@ -2045,7 +2045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any_orthonormal_vector", |_self: Ref| { let output: Val = bevy::math::Vec3::any_orthonormal_vector( @@ -2055,7 +2055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec3", |_self: Ref| { let output: Val = bevy::math::Vec3::as_dvec3( @@ -2065,7 +2065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec3", |_self: Ref| { let output: Val = bevy::math::Vec3::as_ivec3( @@ -2075,7 +2075,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec3", |_self: Ref| { let output: Val = bevy::math::Vec3::as_uvec3( @@ -2085,7 +2085,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec3", |_self: Ref| { let output: Val = bevy::math::Vec3::as_i64vec3( @@ -2095,7 +2095,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec3", |_self: Ref| { let output: Val = bevy::math::Vec3::as_u64vec3( @@ -2105,7 +2105,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -2115,7 +2115,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: i32| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = = bevy::math::IVec2::new(x, y) @@ -2234,7 +2234,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: i32| { let output: Val = bevy::math::IVec2::splat(v) @@ -2242,7 +2242,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -2258,7 +2258,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [i32; 2]| { let output: Val = bevy::math::IVec2::from_array(a) @@ -2266,14 +2266,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [i32; 2] = bevy::math::IVec2::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, z: i32| { let output: Val = bevy::math::IVec2::extend( @@ -2284,7 +2284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: i32| { let output: Val = bevy::math::IVec2::with_x( @@ -2295,7 +2295,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: i32| { let output: Val = bevy::math::IVec2::with_y( @@ -2306,7 +2306,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec2::dot( @@ -2317,7 +2317,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::dot_into_vec( @@ -2328,7 +2328,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::min( @@ -2339,7 +2339,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::max( @@ -2350,7 +2350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -2366,7 +2366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: i32 = bevy::math::IVec2::min_element(_self.into_inner()) @@ -2374,7 +2374,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: i32 = bevy::math::IVec2::max_element(_self.into_inner()) @@ -2382,7 +2382,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: i32 = bevy::math::IVec2::element_sum(_self.into_inner()) @@ -2390,7 +2390,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: i32 = bevy::math::IVec2::element_product( @@ -2400,7 +2400,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::cmpeq( @@ -2411,7 +2411,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::cmpne( @@ -2422,7 +2422,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::cmpge( @@ -2433,7 +2433,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::cmpgt( @@ -2444,7 +2444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::cmple( @@ -2455,7 +2455,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::cmplt( @@ -2466,7 +2466,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::IVec2::abs( @@ -2476,7 +2476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::IVec2::signum( @@ -2486,7 +2486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::IVec2::is_negative_bitmask( @@ -2496,7 +2496,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: i32 = bevy::math::IVec2::length_squared( @@ -2506,7 +2506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec2::distance_squared( @@ -2517,7 +2517,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::div_euclid( @@ -2528,7 +2528,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::rem_euclid( @@ -2539,7 +2539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp", |_self: Val| { let output: Val = bevy::math::IVec2::perp( @@ -2549,7 +2549,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp_dot", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec2::perp_dot( @@ -2560,7 +2560,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::rotate( @@ -2571,7 +2571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec2", |_self: Ref| { let output: Val = bevy::math::IVec2::as_vec2( @@ -2581,7 +2581,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec2", |_self: Ref| { let output: Val = bevy::math::IVec2::as_dvec2( @@ -2591,7 +2591,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec2", |_self: Ref| { let output: Val = bevy::math::IVec2::as_uvec2( @@ -2601,7 +2601,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec2", |_self: Ref| { let output: Val = bevy::math::IVec2::as_i64vec2( @@ -2611,7 +2611,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec2", |_self: Ref| { let output: Val = bevy::math::IVec2::as_u64vec2( @@ -2621,7 +2621,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::wrapping_add( @@ -2632,7 +2632,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::wrapping_sub( @@ -2643,7 +2643,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::wrapping_mul( @@ -2654,7 +2654,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::wrapping_div( @@ -2665,7 +2665,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::saturating_add( @@ -2676,7 +2676,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::saturating_sub( @@ -2687,7 +2687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::saturating_mul( @@ -2698,7 +2698,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::saturating_div( @@ -2709,7 +2709,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::wrapping_add_unsigned( @@ -2720,7 +2720,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::wrapping_sub_unsigned( @@ -2731,7 +2731,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::saturating_add_unsigned( @@ -2742,7 +2742,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec2::saturating_sub_unsigned( @@ -2753,7 +2753,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -2793,7 +2793,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: Ref| { let output: Val = , rhs: i32| { let output: Val = , rhs: i32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: i32| { let output: Val = , rhs: i32| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -2903,7 +2903,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -2914,7 +2914,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::IVec3>::new(world) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Ref| { let output: Val = , rhs: i32| { let output: Val = , rhs: i32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = = bevy::math::IVec3::new(x, y, z) @@ -2972,7 +2972,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: i32| { let output: Val = bevy::math::IVec3::splat(v) @@ -2980,7 +2980,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -2996,7 +2996,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [i32; 3]| { let output: Val = bevy::math::IVec3::from_array(a) @@ -3004,14 +3004,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [i32; 3] = bevy::math::IVec3::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: i32| { let output: Val = bevy::math::IVec3::extend( @@ -3022,7 +3022,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::IVec3::truncate( @@ -3032,7 +3032,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: i32| { let output: Val = bevy::math::IVec3::with_x( @@ -3043,7 +3043,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: i32| { let output: Val = bevy::math::IVec3::with_y( @@ -3054,7 +3054,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: i32| { let output: Val = bevy::math::IVec3::with_z( @@ -3065,7 +3065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec3::dot( @@ -3076,7 +3076,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::dot_into_vec( @@ -3087,7 +3087,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cross( @@ -3098,7 +3098,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::min( @@ -3109,7 +3109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::max( @@ -3120,7 +3120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -3136,7 +3136,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: i32 = bevy::math::IVec3::min_element(_self.into_inner()) @@ -3144,7 +3144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: i32 = bevy::math::IVec3::max_element(_self.into_inner()) @@ -3152,7 +3152,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: i32 = bevy::math::IVec3::element_sum(_self.into_inner()) @@ -3160,7 +3160,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: i32 = bevy::math::IVec3::element_product( @@ -3170,7 +3170,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cmpeq( @@ -3181,7 +3181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cmpne( @@ -3192,7 +3192,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cmpge( @@ -3203,7 +3203,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cmpgt( @@ -3214,7 +3214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cmple( @@ -3225,7 +3225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::cmplt( @@ -3236,7 +3236,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::IVec3::abs( @@ -3246,7 +3246,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::IVec3::signum( @@ -3256,7 +3256,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::IVec3::is_negative_bitmask( @@ -3266,7 +3266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: i32 = bevy::math::IVec3::length_squared( @@ -3276,7 +3276,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec3::distance_squared( @@ -3287,7 +3287,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::div_euclid( @@ -3298,7 +3298,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::rem_euclid( @@ -3309,7 +3309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3", |_self: Ref| { let output: Val = bevy::math::IVec3::as_vec3( @@ -3319,7 +3319,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3a", |_self: Ref| { let output: Val = bevy::math::IVec3::as_vec3a( @@ -3329,7 +3329,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec3", |_self: Ref| { let output: Val = bevy::math::IVec3::as_dvec3( @@ -3339,7 +3339,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec3", |_self: Ref| { let output: Val = bevy::math::IVec3::as_uvec3( @@ -3349,7 +3349,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec3", |_self: Ref| { let output: Val = bevy::math::IVec3::as_i64vec3( @@ -3359,7 +3359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec3", |_self: Ref| { let output: Val = bevy::math::IVec3::as_u64vec3( @@ -3369,7 +3369,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::wrapping_add( @@ -3380,7 +3380,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::wrapping_sub( @@ -3391,7 +3391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::wrapping_mul( @@ -3402,7 +3402,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::wrapping_div( @@ -3413,7 +3413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::saturating_add( @@ -3424,7 +3424,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::saturating_sub( @@ -3435,7 +3435,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::saturating_mul( @@ -3446,7 +3446,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::saturating_div( @@ -3457,7 +3457,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::wrapping_add_unsigned( @@ -3468,7 +3468,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::wrapping_sub_unsigned( @@ -3479,7 +3479,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::saturating_add_unsigned( @@ -3490,7 +3490,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec3::saturating_sub_unsigned( @@ -3501,7 +3501,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: i32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: i32| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -3571,7 +3571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , rhs: i32| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -3611,7 +3611,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Ref| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -3631,7 +3631,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Ref| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: i32| { let output: Val = | { let output: Val = ::neg( @@ -3662,7 +3662,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: i32, y: i32, z: i32, w: i32| { let output: Val = bevy::math::IVec4::new( @@ -3675,7 +3675,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: i32| { let output: Val = bevy::math::IVec4::splat(v) @@ -3683,7 +3683,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -3699,7 +3699,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [i32; 4]| { let output: Val = bevy::math::IVec4::from_array(a) @@ -3707,14 +3707,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [i32; 4] = bevy::math::IVec4::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::IVec4::truncate( @@ -3724,7 +3724,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: i32| { let output: Val = bevy::math::IVec4::with_x( @@ -3735,7 +3735,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: i32| { let output: Val = bevy::math::IVec4::with_y( @@ -3746,7 +3746,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: i32| { let output: Val = bevy::math::IVec4::with_z( @@ -3757,7 +3757,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_w", |_self: Val, w: i32| { let output: Val = bevy::math::IVec4::with_w( @@ -3768,7 +3768,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec4::dot( @@ -3779,7 +3779,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::dot_into_vec( @@ -3790,7 +3790,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::min( @@ -3801,7 +3801,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::max( @@ -3812,7 +3812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -3828,7 +3828,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: i32 = bevy::math::IVec4::min_element(_self.into_inner()) @@ -3836,7 +3836,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: i32 = bevy::math::IVec4::max_element(_self.into_inner()) @@ -3844,7 +3844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: i32 = bevy::math::IVec4::element_sum(_self.into_inner()) @@ -3852,7 +3852,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: i32 = bevy::math::IVec4::element_product( @@ -3862,7 +3862,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::cmpeq( @@ -3873,7 +3873,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::cmpne( @@ -3884,7 +3884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::cmpge( @@ -3895,7 +3895,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::cmpgt( @@ -3906,7 +3906,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::cmple( @@ -3917,7 +3917,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::cmplt( @@ -3928,7 +3928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::IVec4::abs( @@ -3938,7 +3938,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::IVec4::signum( @@ -3948,7 +3948,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::IVec4::is_negative_bitmask( @@ -3958,7 +3958,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: i32 = bevy::math::IVec4::length_squared( @@ -3968,7 +3968,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: i32 = bevy::math::IVec4::distance_squared( @@ -3979,7 +3979,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::div_euclid( @@ -3990,7 +3990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::rem_euclid( @@ -4001,7 +4001,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec4", |_self: Ref| { let output: Val = bevy::math::IVec4::as_vec4( @@ -4011,7 +4011,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec4", |_self: Ref| { let output: Val = bevy::math::IVec4::as_dvec4( @@ -4021,7 +4021,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec4", |_self: Ref| { let output: Val = bevy::math::IVec4::as_uvec4( @@ -4031,7 +4031,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec4", |_self: Ref| { let output: Val = bevy::math::IVec4::as_i64vec4( @@ -4041,7 +4041,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec4", |_self: Ref| { let output: Val = bevy::math::IVec4::as_u64vec4( @@ -4051,7 +4051,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::wrapping_add( @@ -4062,7 +4062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::wrapping_sub( @@ -4073,7 +4073,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::wrapping_mul( @@ -4084,7 +4084,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::wrapping_div( @@ -4095,7 +4095,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::saturating_add( @@ -4106,7 +4106,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::saturating_sub( @@ -4117,7 +4117,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::saturating_mul( @@ -4128,7 +4128,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::saturating_div( @@ -4139,7 +4139,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::wrapping_add_unsigned( @@ -4150,7 +4150,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::wrapping_sub_unsigned( @@ -4161,7 +4161,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::saturating_add_unsigned( @@ -4172,7 +4172,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::IVec4::saturating_sub_unsigned( @@ -4183,7 +4183,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: i32| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -4203,7 +4203,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = , rhs: i32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: i32| { let output: Val = | { let output: Val = ::clone( @@ -4273,7 +4273,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: Ref| { let output: Val = , other: Ref| { let output: bool = , rhs: Ref| { let output: Val = , rhs: i32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: i64| { let output: Val = , rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -4444,7 +4444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Ref| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -4464,7 +4464,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = = bevy::math::I64Vec2::new(x, y) @@ -4482,7 +4482,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: i64| { let output: Val = bevy::math::I64Vec2::splat(v) @@ -4490,7 +4490,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -4506,7 +4506,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [i64; 2]| { let output: Val = bevy::math::I64Vec2::from_array( @@ -4516,14 +4516,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [i64; 2] = bevy::math::I64Vec2::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, z: i64| { let output: Val = bevy::math::I64Vec2::extend( @@ -4534,7 +4534,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: i64| { let output: Val = bevy::math::I64Vec2::with_x( @@ -4545,7 +4545,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: i64| { let output: Val = bevy::math::I64Vec2::with_y( @@ -4556,7 +4556,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec2::dot( @@ -4567,7 +4567,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::dot_into_vec( @@ -4578,7 +4578,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::min( @@ -4589,7 +4589,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::max( @@ -4600,7 +4600,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -4616,7 +4616,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: i64 = bevy::math::I64Vec2::min_element( @@ -4626,7 +4626,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: i64 = bevy::math::I64Vec2::max_element( @@ -4636,7 +4636,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: i64 = bevy::math::I64Vec2::element_sum( @@ -4646,7 +4646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: i64 = bevy::math::I64Vec2::element_product( @@ -4656,7 +4656,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::cmpeq( @@ -4667,7 +4667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::cmpne( @@ -4678,7 +4678,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::cmpge( @@ -4689,7 +4689,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::cmpgt( @@ -4700,7 +4700,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::cmple( @@ -4711,7 +4711,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::cmplt( @@ -4722,7 +4722,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::I64Vec2::abs( @@ -4732,7 +4732,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::I64Vec2::signum( @@ -4742,7 +4742,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::I64Vec2::is_negative_bitmask( @@ -4752,7 +4752,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: i64 = bevy::math::I64Vec2::length_squared( @@ -4762,7 +4762,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec2::distance_squared( @@ -4773,7 +4773,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::div_euclid( @@ -4784,7 +4784,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::rem_euclid( @@ -4795,7 +4795,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp", |_self: Val| { let output: Val = bevy::math::I64Vec2::perp( @@ -4805,7 +4805,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp_dot", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec2::perp_dot( @@ -4816,7 +4816,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::rotate( @@ -4827,7 +4827,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec2", |_self: Ref| { let output: Val = bevy::math::I64Vec2::as_vec2( @@ -4837,7 +4837,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec2", |_self: Ref| { let output: Val = bevy::math::I64Vec2::as_dvec2( @@ -4847,7 +4847,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec2", |_self: Ref| { let output: Val = bevy::math::I64Vec2::as_ivec2( @@ -4857,7 +4857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec2", |_self: Ref| { let output: Val = bevy::math::I64Vec2::as_uvec2( @@ -4867,7 +4867,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec2", |_self: Ref| { let output: Val = bevy::math::I64Vec2::as_u64vec2( @@ -4877,7 +4877,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::wrapping_add( @@ -4888,7 +4888,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::wrapping_sub( @@ -4899,7 +4899,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::wrapping_mul( @@ -4910,7 +4910,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::wrapping_div( @@ -4921,7 +4921,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::saturating_add( @@ -4932,7 +4932,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::saturating_sub( @@ -4943,7 +4943,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::saturating_mul( @@ -4954,7 +4954,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::saturating_div( @@ -4965,7 +4965,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::wrapping_add_unsigned( @@ -4976,7 +4976,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::wrapping_sub_unsigned( @@ -4987,7 +4987,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::saturating_add_unsigned( @@ -4998,7 +4998,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec2::saturating_sub_unsigned( @@ -5009,7 +5009,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = , rhs: i64| { let output: Val = , rhs: i64| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -5080,7 +5080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::I64Vec3>::new(world) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::clone( @@ -5130,7 +5130,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Val| { let output: Val = = bevy::math::I64Vec3::new( @@ -5152,7 +5152,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: i64| { let output: Val = bevy::math::I64Vec3::splat(v) @@ -5160,7 +5160,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -5176,7 +5176,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [i64; 3]| { let output: Val = bevy::math::I64Vec3::from_array( @@ -5186,14 +5186,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [i64; 3] = bevy::math::I64Vec3::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: i64| { let output: Val = bevy::math::I64Vec3::extend( @@ -5204,7 +5204,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::I64Vec3::truncate( @@ -5214,7 +5214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: i64| { let output: Val = bevy::math::I64Vec3::with_x( @@ -5225,7 +5225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: i64| { let output: Val = bevy::math::I64Vec3::with_y( @@ -5236,7 +5236,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: i64| { let output: Val = bevy::math::I64Vec3::with_z( @@ -5247,7 +5247,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec3::dot( @@ -5258,7 +5258,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::dot_into_vec( @@ -5269,7 +5269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cross( @@ -5280,7 +5280,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::min( @@ -5291,7 +5291,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::max( @@ -5302,7 +5302,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -5318,7 +5318,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: i64 = bevy::math::I64Vec3::min_element( @@ -5328,7 +5328,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: i64 = bevy::math::I64Vec3::max_element( @@ -5338,7 +5338,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: i64 = bevy::math::I64Vec3::element_sum( @@ -5348,7 +5348,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: i64 = bevy::math::I64Vec3::element_product( @@ -5358,7 +5358,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cmpeq( @@ -5369,7 +5369,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cmpne( @@ -5380,7 +5380,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cmpge( @@ -5391,7 +5391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cmpgt( @@ -5402,7 +5402,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cmple( @@ -5413,7 +5413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::cmplt( @@ -5424,7 +5424,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::I64Vec3::abs( @@ -5434,7 +5434,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::I64Vec3::signum( @@ -5444,7 +5444,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::I64Vec3::is_negative_bitmask( @@ -5454,7 +5454,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: i64 = bevy::math::I64Vec3::length_squared( @@ -5464,7 +5464,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec3::distance_squared( @@ -5475,7 +5475,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::div_euclid( @@ -5486,7 +5486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::rem_euclid( @@ -5497,7 +5497,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3", |_self: Ref| { let output: Val = bevy::math::I64Vec3::as_vec3( @@ -5507,7 +5507,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3a", |_self: Ref| { let output: Val = bevy::math::I64Vec3::as_vec3a( @@ -5517,7 +5517,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec3", |_self: Ref| { let output: Val = bevy::math::I64Vec3::as_dvec3( @@ -5527,7 +5527,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec3", |_self: Ref| { let output: Val = bevy::math::I64Vec3::as_ivec3( @@ -5537,7 +5537,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec3", |_self: Ref| { let output: Val = bevy::math::I64Vec3::as_uvec3( @@ -5547,7 +5547,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec3", |_self: Ref| { let output: Val = bevy::math::I64Vec3::as_u64vec3( @@ -5557,7 +5557,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::wrapping_add( @@ -5568,7 +5568,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::wrapping_sub( @@ -5579,7 +5579,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::wrapping_mul( @@ -5590,7 +5590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::wrapping_div( @@ -5601,7 +5601,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::saturating_add( @@ -5612,7 +5612,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::saturating_sub( @@ -5623,7 +5623,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::saturating_mul( @@ -5634,7 +5634,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::saturating_div( @@ -5645,7 +5645,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::wrapping_add_unsigned( @@ -5656,7 +5656,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::wrapping_sub_unsigned( @@ -5667,7 +5667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::saturating_add_unsigned( @@ -5678,7 +5678,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec3::saturating_sub_unsigned( @@ -5689,7 +5689,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = , rhs: i64| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -5719,7 +5719,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = , rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -5759,7 +5759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: i64| { let output: Val = , other: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , rhs: Ref| { let output: Val = , rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: i64| { let output: Val = | { let output: Val = ::clone( @@ -5890,7 +5890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: i64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: i64| { let output: Val = , rhs: i64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -5990,7 +5990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: i64, y: i64, z: i64, w: i64| { let output: Val = bevy::math::I64Vec4::new( @@ -6003,7 +6003,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: i64| { let output: Val = bevy::math::I64Vec4::splat(v) @@ -6011,7 +6011,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -6027,7 +6027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [i64; 4]| { let output: Val = bevy::math::I64Vec4::from_array( @@ -6037,14 +6037,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [i64; 4] = bevy::math::I64Vec4::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::I64Vec4::truncate( @@ -6054,7 +6054,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: i64| { let output: Val = bevy::math::I64Vec4::with_x( @@ -6065,7 +6065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: i64| { let output: Val = bevy::math::I64Vec4::with_y( @@ -6076,7 +6076,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: i64| { let output: Val = bevy::math::I64Vec4::with_z( @@ -6087,7 +6087,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_w", |_self: Val, w: i64| { let output: Val = bevy::math::I64Vec4::with_w( @@ -6098,7 +6098,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec4::dot( @@ -6109,7 +6109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::dot_into_vec( @@ -6120,7 +6120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::min( @@ -6131,7 +6131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::max( @@ -6142,7 +6142,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -6158,7 +6158,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: i64 = bevy::math::I64Vec4::min_element( @@ -6168,7 +6168,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: i64 = bevy::math::I64Vec4::max_element( @@ -6178,7 +6178,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: i64 = bevy::math::I64Vec4::element_sum( @@ -6188,7 +6188,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: i64 = bevy::math::I64Vec4::element_product( @@ -6198,7 +6198,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::cmpeq( @@ -6209,7 +6209,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::cmpne( @@ -6220,7 +6220,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::cmpge( @@ -6231,7 +6231,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::cmpgt( @@ -6242,7 +6242,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::cmple( @@ -6253,7 +6253,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::cmplt( @@ -6264,7 +6264,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::I64Vec4::abs( @@ -6274,7 +6274,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::I64Vec4::signum( @@ -6284,7 +6284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::I64Vec4::is_negative_bitmask( @@ -6294,7 +6294,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: i64 = bevy::math::I64Vec4::length_squared( @@ -6304,7 +6304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: i64 = bevy::math::I64Vec4::distance_squared( @@ -6315,7 +6315,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::div_euclid( @@ -6326,7 +6326,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::rem_euclid( @@ -6337,7 +6337,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec4", |_self: Ref| { let output: Val = bevy::math::I64Vec4::as_vec4( @@ -6347,7 +6347,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec4", |_self: Ref| { let output: Val = bevy::math::I64Vec4::as_dvec4( @@ -6357,7 +6357,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec4", |_self: Ref| { let output: Val = bevy::math::I64Vec4::as_ivec4( @@ -6367,7 +6367,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec4", |_self: Ref| { let output: Val = bevy::math::I64Vec4::as_uvec4( @@ -6377,7 +6377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec4", |_self: Ref| { let output: Val = bevy::math::I64Vec4::as_u64vec4( @@ -6387,7 +6387,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::wrapping_add( @@ -6398,7 +6398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::wrapping_sub( @@ -6409,7 +6409,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::wrapping_mul( @@ -6420,7 +6420,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::wrapping_div( @@ -6431,7 +6431,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::saturating_add( @@ -6442,7 +6442,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::saturating_sub( @@ -6453,7 +6453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::saturating_mul( @@ -6464,7 +6464,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::saturating_div( @@ -6475,7 +6475,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::wrapping_add_unsigned( @@ -6486,7 +6486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::wrapping_sub_unsigned( @@ -6497,7 +6497,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::saturating_add_unsigned( @@ -6508,7 +6508,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub_unsigned", |_self: Val, rhs: Val| { let output: Val = bevy::math::I64Vec4::saturating_sub_unsigned( @@ -6519,7 +6519,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = | { let output: Val = ::neg( @@ -6540,7 +6540,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::UVec2>::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , rhs: Ref| { let output: Val = , rhs: u32| { let output: Val = | { let output: Val = ::clone( @@ -6580,7 +6580,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u32| { let output: Val = , rhs: u32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u32| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -6700,7 +6700,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: u32| { let output: Val = , rhs: Val| { let output: Val = = bevy::math::UVec2::new(x, y) @@ -6728,7 +6728,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: u32| { let output: Val = bevy::math::UVec2::splat(v) @@ -6736,7 +6736,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -6752,7 +6752,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [u32; 2]| { let output: Val = bevy::math::UVec2::from_array(a) @@ -6760,14 +6760,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [u32; 2] = bevy::math::UVec2::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, z: u32| { let output: Val = bevy::math::UVec2::extend( @@ -6778,7 +6778,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: u32| { let output: Val = bevy::math::UVec2::with_x( @@ -6789,7 +6789,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: u32| { let output: Val = bevy::math::UVec2::with_y( @@ -6800,7 +6800,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: u32 = bevy::math::UVec2::dot( @@ -6811,7 +6811,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::dot_into_vec( @@ -6822,7 +6822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::min( @@ -6833,7 +6833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::max( @@ -6844,7 +6844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -6860,7 +6860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: u32 = bevy::math::UVec2::min_element(_self.into_inner()) @@ -6868,7 +6868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: u32 = bevy::math::UVec2::max_element(_self.into_inner()) @@ -6876,7 +6876,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: u32 = bevy::math::UVec2::element_sum(_self.into_inner()) @@ -6884,7 +6884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: u32 = bevy::math::UVec2::element_product( @@ -6894,7 +6894,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::cmpeq( @@ -6905,7 +6905,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::cmpne( @@ -6916,7 +6916,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::cmpge( @@ -6927,7 +6927,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::cmpgt( @@ -6938,7 +6938,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::cmple( @@ -6949,7 +6949,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::cmplt( @@ -6960,7 +6960,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: u32 = bevy::math::UVec2::length_squared( @@ -6970,7 +6970,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec2", |_self: Ref| { let output: Val = bevy::math::UVec2::as_vec2( @@ -6980,7 +6980,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec2", |_self: Ref| { let output: Val = bevy::math::UVec2::as_dvec2( @@ -6990,7 +6990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec2", |_self: Ref| { let output: Val = bevy::math::UVec2::as_ivec2( @@ -7000,7 +7000,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec2", |_self: Ref| { let output: Val = bevy::math::UVec2::as_i64vec2( @@ -7010,7 +7010,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec2", |_self: Ref| { let output: Val = bevy::math::UVec2::as_u64vec2( @@ -7020,7 +7020,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::wrapping_add( @@ -7031,7 +7031,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::wrapping_sub( @@ -7042,7 +7042,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::wrapping_mul( @@ -7053,7 +7053,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::wrapping_div( @@ -7064,7 +7064,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::saturating_add( @@ -7075,7 +7075,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::saturating_sub( @@ -7086,7 +7086,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::saturating_mul( @@ -7097,7 +7097,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::saturating_div( @@ -7108,7 +7108,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::wrapping_add_signed( @@ -7119,7 +7119,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec2::saturating_add_signed( @@ -7131,7 +7131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::UVec3>::new(world) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -7151,7 +7151,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -7181,7 +7181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u32| { let output: Val = = bevy::math::UVec3::new(x, y, z) @@ -7219,7 +7219,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: u32| { let output: Val = bevy::math::UVec3::splat(v) @@ -7227,7 +7227,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -7243,7 +7243,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [u32; 3]| { let output: Val = bevy::math::UVec3::from_array(a) @@ -7251,14 +7251,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [u32; 3] = bevy::math::UVec3::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: u32| { let output: Val = bevy::math::UVec3::extend( @@ -7269,7 +7269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::UVec3::truncate( @@ -7279,7 +7279,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: u32| { let output: Val = bevy::math::UVec3::with_x( @@ -7290,7 +7290,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: u32| { let output: Val = bevy::math::UVec3::with_y( @@ -7301,7 +7301,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: u32| { let output: Val = bevy::math::UVec3::with_z( @@ -7312,7 +7312,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: u32 = bevy::math::UVec3::dot( @@ -7323,7 +7323,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::dot_into_vec( @@ -7334,7 +7334,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cross( @@ -7345,7 +7345,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::min( @@ -7356,7 +7356,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::max( @@ -7367,7 +7367,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -7383,7 +7383,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: u32 = bevy::math::UVec3::min_element(_self.into_inner()) @@ -7391,7 +7391,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: u32 = bevy::math::UVec3::max_element(_self.into_inner()) @@ -7399,7 +7399,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: u32 = bevy::math::UVec3::element_sum(_self.into_inner()) @@ -7407,7 +7407,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: u32 = bevy::math::UVec3::element_product( @@ -7417,7 +7417,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cmpeq( @@ -7428,7 +7428,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cmpne( @@ -7439,7 +7439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cmpge( @@ -7450,7 +7450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cmpgt( @@ -7461,7 +7461,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cmple( @@ -7472,7 +7472,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::cmplt( @@ -7483,7 +7483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: u32 = bevy::math::UVec3::length_squared( @@ -7493,7 +7493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3", |_self: Ref| { let output: Val = bevy::math::UVec3::as_vec3( @@ -7503,7 +7503,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3a", |_self: Ref| { let output: Val = bevy::math::UVec3::as_vec3a( @@ -7513,7 +7513,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec3", |_self: Ref| { let output: Val = bevy::math::UVec3::as_dvec3( @@ -7523,7 +7523,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec3", |_self: Ref| { let output: Val = bevy::math::UVec3::as_ivec3( @@ -7533,7 +7533,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec3", |_self: Ref| { let output: Val = bevy::math::UVec3::as_i64vec3( @@ -7543,7 +7543,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec3", |_self: Ref| { let output: Val = bevy::math::UVec3::as_u64vec3( @@ -7553,7 +7553,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::wrapping_add( @@ -7564,7 +7564,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::wrapping_sub( @@ -7575,7 +7575,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::wrapping_mul( @@ -7586,7 +7586,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::wrapping_div( @@ -7597,7 +7597,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::saturating_add( @@ -7608,7 +7608,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::saturating_sub( @@ -7619,7 +7619,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::saturating_mul( @@ -7630,7 +7630,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::saturating_div( @@ -7641,7 +7641,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::wrapping_add_signed( @@ -7652,7 +7652,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec3::saturating_add_signed( @@ -7663,7 +7663,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: u32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , other: Ref| { let output: bool = , rhs: Val| { let output: Val = , rhs: u32| { let output: Val = , rhs: u32| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u32| { let output: Val = , rhs: Ref| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: u32| { let output: Val = | { let output: Val = ::clone( @@ -7804,7 +7804,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = = bevy::math::UVec4::new( @@ -7857,7 +7857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: u32| { let output: Val = bevy::math::UVec4::splat(v) @@ -7865,7 +7865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -7881,7 +7881,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [u32; 4]| { let output: Val = bevy::math::UVec4::from_array(a) @@ -7889,14 +7889,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [u32; 4] = bevy::math::UVec4::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::UVec4::truncate( @@ -7906,7 +7906,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: u32| { let output: Val = bevy::math::UVec4::with_x( @@ -7917,7 +7917,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: u32| { let output: Val = bevy::math::UVec4::with_y( @@ -7928,7 +7928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: u32| { let output: Val = bevy::math::UVec4::with_z( @@ -7939,7 +7939,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_w", |_self: Val, w: u32| { let output: Val = bevy::math::UVec4::with_w( @@ -7950,7 +7950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: u32 = bevy::math::UVec4::dot( @@ -7961,7 +7961,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::dot_into_vec( @@ -7972,7 +7972,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::min( @@ -7983,7 +7983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::max( @@ -7994,7 +7994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -8010,7 +8010,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: u32 = bevy::math::UVec4::min_element(_self.into_inner()) @@ -8018,7 +8018,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: u32 = bevy::math::UVec4::max_element(_self.into_inner()) @@ -8026,7 +8026,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: u32 = bevy::math::UVec4::element_sum(_self.into_inner()) @@ -8034,7 +8034,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: u32 = bevy::math::UVec4::element_product( @@ -8044,7 +8044,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::cmpeq( @@ -8055,7 +8055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::cmpne( @@ -8066,7 +8066,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::cmpge( @@ -8077,7 +8077,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::cmpgt( @@ -8088,7 +8088,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::cmple( @@ -8099,7 +8099,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::cmplt( @@ -8110,7 +8110,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: u32 = bevy::math::UVec4::length_squared( @@ -8120,7 +8120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec4", |_self: Ref| { let output: Val = bevy::math::UVec4::as_vec4( @@ -8130,7 +8130,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec4", |_self: Ref| { let output: Val = bevy::math::UVec4::as_dvec4( @@ -8140,7 +8140,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec4", |_self: Ref| { let output: Val = bevy::math::UVec4::as_ivec4( @@ -8150,7 +8150,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec4", |_self: Ref| { let output: Val = bevy::math::UVec4::as_i64vec4( @@ -8160,7 +8160,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec4", |_self: Ref| { let output: Val = bevy::math::UVec4::as_u64vec4( @@ -8170,7 +8170,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::wrapping_add( @@ -8181,7 +8181,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::wrapping_sub( @@ -8192,7 +8192,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::wrapping_mul( @@ -8203,7 +8203,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::wrapping_div( @@ -8214,7 +8214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::saturating_add( @@ -8225,7 +8225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::saturating_sub( @@ -8236,7 +8236,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::saturating_mul( @@ -8247,7 +8247,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::saturating_div( @@ -8258,7 +8258,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::wrapping_add_signed( @@ -8269,7 +8269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::UVec4::saturating_add_signed( @@ -8280,7 +8280,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , rhs: u32| { let output: Val = , rhs: Val| { let output: Val = , rhs: u32| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -8350,7 +8350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: u32| { let output: Val = , rhs: Val| { let output: Val = , rhs: u32| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: u64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u64| { let output: Val = | { let output: Val = ::clone( @@ -8451,7 +8451,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: u64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u64| { let output: Val = , rhs: Ref| { let output: Val = = bevy::math::U64Vec2::new(x, y) @@ -8499,7 +8499,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: u64| { let output: Val = bevy::math::U64Vec2::splat(v) @@ -8507,7 +8507,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -8523,7 +8523,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [u64; 2]| { let output: Val = bevy::math::U64Vec2::from_array( @@ -8533,14 +8533,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [u64; 2] = bevy::math::U64Vec2::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, z: u64| { let output: Val = bevy::math::U64Vec2::extend( @@ -8551,7 +8551,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: u64| { let output: Val = bevy::math::U64Vec2::with_x( @@ -8562,7 +8562,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: u64| { let output: Val = bevy::math::U64Vec2::with_y( @@ -8573,7 +8573,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: u64 = bevy::math::U64Vec2::dot( @@ -8584,7 +8584,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::dot_into_vec( @@ -8595,7 +8595,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::min( @@ -8606,7 +8606,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::max( @@ -8617,7 +8617,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -8633,7 +8633,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: u64 = bevy::math::U64Vec2::min_element( @@ -8643,7 +8643,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: u64 = bevy::math::U64Vec2::max_element( @@ -8653,7 +8653,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: u64 = bevy::math::U64Vec2::element_sum( @@ -8663,7 +8663,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: u64 = bevy::math::U64Vec2::element_product( @@ -8673,7 +8673,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::cmpeq( @@ -8684,7 +8684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::cmpne( @@ -8695,7 +8695,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::cmpge( @@ -8706,7 +8706,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::cmpgt( @@ -8717,7 +8717,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::cmple( @@ -8728,7 +8728,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::cmplt( @@ -8739,7 +8739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: u64 = bevy::math::U64Vec2::length_squared( @@ -8749,7 +8749,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec2", |_self: Ref| { let output: Val = bevy::math::U64Vec2::as_vec2( @@ -8759,7 +8759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec2", |_self: Ref| { let output: Val = bevy::math::U64Vec2::as_dvec2( @@ -8769,7 +8769,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec2", |_self: Ref| { let output: Val = bevy::math::U64Vec2::as_ivec2( @@ -8779,7 +8779,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec2", |_self: Ref| { let output: Val = bevy::math::U64Vec2::as_uvec2( @@ -8789,7 +8789,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec2", |_self: Ref| { let output: Val = bevy::math::U64Vec2::as_i64vec2( @@ -8799,7 +8799,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::wrapping_add( @@ -8810,7 +8810,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::wrapping_sub( @@ -8821,7 +8821,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::wrapping_mul( @@ -8832,7 +8832,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::wrapping_div( @@ -8843,7 +8843,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::saturating_add( @@ -8854,7 +8854,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::saturating_sub( @@ -8865,7 +8865,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::saturating_mul( @@ -8876,7 +8876,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::saturating_div( @@ -8887,7 +8887,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::wrapping_add_signed( @@ -8898,7 +8898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec2::saturating_add_signed( @@ -8909,7 +8909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = , rhs: u64| { let output: Val = , rhs: Val| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -8969,7 +8969,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: u64| { let output: Val = , rhs: u64| { let output: Val = = bevy::math::U64Vec3::new( @@ -9012,7 +9012,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: u64| { let output: Val = bevy::math::U64Vec3::splat(v) @@ -9020,7 +9020,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -9036,7 +9036,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [u64; 3]| { let output: Val = bevy::math::U64Vec3::from_array( @@ -9046,14 +9046,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [u64; 3] = bevy::math::U64Vec3::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: u64| { let output: Val = bevy::math::U64Vec3::extend( @@ -9064,7 +9064,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::U64Vec3::truncate( @@ -9074,7 +9074,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: u64| { let output: Val = bevy::math::U64Vec3::with_x( @@ -9085,7 +9085,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: u64| { let output: Val = bevy::math::U64Vec3::with_y( @@ -9096,7 +9096,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: u64| { let output: Val = bevy::math::U64Vec3::with_z( @@ -9107,7 +9107,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: u64 = bevy::math::U64Vec3::dot( @@ -9118,7 +9118,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::dot_into_vec( @@ -9129,7 +9129,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cross( @@ -9140,7 +9140,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::min( @@ -9151,7 +9151,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::max( @@ -9162,7 +9162,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -9178,7 +9178,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: u64 = bevy::math::U64Vec3::min_element( @@ -9188,7 +9188,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: u64 = bevy::math::U64Vec3::max_element( @@ -9198,7 +9198,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: u64 = bevy::math::U64Vec3::element_sum( @@ -9208,7 +9208,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: u64 = bevy::math::U64Vec3::element_product( @@ -9218,7 +9218,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cmpeq( @@ -9229,7 +9229,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cmpne( @@ -9240,7 +9240,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cmpge( @@ -9251,7 +9251,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cmpgt( @@ -9262,7 +9262,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cmple( @@ -9273,7 +9273,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::cmplt( @@ -9284,7 +9284,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: u64 = bevy::math::U64Vec3::length_squared( @@ -9294,7 +9294,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3", |_self: Ref| { let output: Val = bevy::math::U64Vec3::as_vec3( @@ -9304,7 +9304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3a", |_self: Ref| { let output: Val = bevy::math::U64Vec3::as_vec3a( @@ -9314,7 +9314,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec3", |_self: Ref| { let output: Val = bevy::math::U64Vec3::as_dvec3( @@ -9324,7 +9324,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec3", |_self: Ref| { let output: Val = bevy::math::U64Vec3::as_ivec3( @@ -9334,7 +9334,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec3", |_self: Ref| { let output: Val = bevy::math::U64Vec3::as_uvec3( @@ -9344,7 +9344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec3", |_self: Ref| { let output: Val = bevy::math::U64Vec3::as_i64vec3( @@ -9354,7 +9354,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::wrapping_add( @@ -9365,7 +9365,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::wrapping_sub( @@ -9376,7 +9376,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::wrapping_mul( @@ -9387,7 +9387,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::wrapping_div( @@ -9398,7 +9398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::saturating_add( @@ -9409,7 +9409,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::saturating_sub( @@ -9420,7 +9420,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::saturating_mul( @@ -9431,7 +9431,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::saturating_div( @@ -9442,7 +9442,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::wrapping_add_signed( @@ -9453,7 +9453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec3::saturating_add_signed( @@ -9464,7 +9464,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u64| { let output: Val = | { let output: () = ::assert_receiver_is_total_eq( @@ -9514,7 +9514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: u64| { let output: Val = | { let output: Val = ::clone( @@ -9554,7 +9554,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: u64| { let output: Val = , other: Ref| { let output: bool = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -9635,7 +9635,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: u64| { let output: Val = , rhs: u64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -9775,7 +9775,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: u64, y: u64, z: u64, w: u64| { let output: Val = bevy::math::U64Vec4::new( @@ -9788,7 +9788,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: u64| { let output: Val = bevy::math::U64Vec4::splat(v) @@ -9796,7 +9796,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -9812,7 +9812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [u64; 4]| { let output: Val = bevy::math::U64Vec4::from_array( @@ -9822,14 +9822,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [u64; 4] = bevy::math::U64Vec4::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::U64Vec4::truncate( @@ -9839,7 +9839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: u64| { let output: Val = bevy::math::U64Vec4::with_x( @@ -9850,7 +9850,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: u64| { let output: Val = bevy::math::U64Vec4::with_y( @@ -9861,7 +9861,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: u64| { let output: Val = bevy::math::U64Vec4::with_z( @@ -9872,7 +9872,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_w", |_self: Val, w: u64| { let output: Val = bevy::math::U64Vec4::with_w( @@ -9883,7 +9883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: u64 = bevy::math::U64Vec4::dot( @@ -9894,7 +9894,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::dot_into_vec( @@ -9905,7 +9905,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::min( @@ -9916,7 +9916,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::max( @@ -9927,7 +9927,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -9943,7 +9943,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: u64 = bevy::math::U64Vec4::min_element( @@ -9953,7 +9953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: u64 = bevy::math::U64Vec4::max_element( @@ -9963,7 +9963,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: u64 = bevy::math::U64Vec4::element_sum( @@ -9973,7 +9973,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: u64 = bevy::math::U64Vec4::element_product( @@ -9983,7 +9983,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::cmpeq( @@ -9994,7 +9994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::cmpne( @@ -10005,7 +10005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::cmpge( @@ -10016,7 +10016,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::cmpgt( @@ -10027,7 +10027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::cmple( @@ -10038,7 +10038,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::cmplt( @@ -10049,7 +10049,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: u64 = bevy::math::U64Vec4::length_squared( @@ -10059,7 +10059,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec4", |_self: Ref| { let output: Val = bevy::math::U64Vec4::as_vec4( @@ -10069,7 +10069,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec4", |_self: Ref| { let output: Val = bevy::math::U64Vec4::as_dvec4( @@ -10079,7 +10079,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec4", |_self: Ref| { let output: Val = bevy::math::U64Vec4::as_ivec4( @@ -10089,7 +10089,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec4", |_self: Ref| { let output: Val = bevy::math::U64Vec4::as_uvec4( @@ -10099,7 +10099,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec4", |_self: Ref| { let output: Val = bevy::math::U64Vec4::as_i64vec4( @@ -10109,7 +10109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::wrapping_add( @@ -10120,7 +10120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::wrapping_sub( @@ -10131,7 +10131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::wrapping_mul( @@ -10142,7 +10142,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::wrapping_div( @@ -10153,7 +10153,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::saturating_add( @@ -10164,7 +10164,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_sub", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::saturating_sub( @@ -10175,7 +10175,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_mul", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::saturating_mul( @@ -10186,7 +10186,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_div", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::saturating_div( @@ -10197,7 +10197,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "wrapping_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::wrapping_add_signed( @@ -10208,7 +10208,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "saturating_add_signed", |_self: Val, rhs: Val| { let output: Val = bevy::math::U64Vec4::saturating_add_signed( @@ -10219,7 +10219,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: u64| { let output: Val = , other: Ref| { let output: bool = , rhs: u64| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , other: Ref| { let output: bool = | { let output: Val = ::neg( @@ -10310,7 +10310,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f32| { let output: Val = | { let output: Val = ::clone( @@ -10330,7 +10330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: f32, y: f32| { let output: Val = bevy::math::Vec2::new(x, y) @@ -10338,7 +10338,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f32| { let output: Val = bevy::math::Vec2::splat(v) @@ -10346,7 +10346,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -10362,7 +10362,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f32; 2]| { let output: Val = bevy::math::Vec2::from_array(a) @@ -10370,14 +10370,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f32; 2] = bevy::math::Vec2::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, z: f32| { let output: Val = bevy::math::Vec2::extend( @@ -10388,7 +10388,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f32| { let output: Val = bevy::math::Vec2::with_x( @@ -10399,7 +10399,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f32| { let output: Val = bevy::math::Vec2::with_y( @@ -10410,7 +10410,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec2::dot( @@ -10421,7 +10421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::dot_into_vec( @@ -10432,7 +10432,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::min( @@ -10443,7 +10443,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::max( @@ -10454,7 +10454,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -10470,7 +10470,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f32 = bevy::math::Vec2::min_element(_self.into_inner()) @@ -10478,7 +10478,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f32 = bevy::math::Vec2::max_element(_self.into_inner()) @@ -10486,7 +10486,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f32 = bevy::math::Vec2::element_sum(_self.into_inner()) @@ -10494,7 +10494,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f32 = bevy::math::Vec2::element_product( @@ -10504,7 +10504,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::cmpeq( @@ -10515,7 +10515,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::cmpne( @@ -10526,7 +10526,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::cmpge( @@ -10537,7 +10537,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::cmpgt( @@ -10548,7 +10548,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::cmple( @@ -10559,7 +10559,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::cmplt( @@ -10570,7 +10570,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::Vec2::abs( @@ -10580,7 +10580,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::Vec2::signum( @@ -10590,7 +10590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::copysign( @@ -10601,7 +10601,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::Vec2::is_negative_bitmask( @@ -10611,7 +10611,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::Vec2::is_finite(_self.into_inner()) @@ -10619,7 +10619,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::Vec2::is_finite_mask( @@ -10629,7 +10629,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::Vec2::is_nan(_self.into_inner()) @@ -10637,7 +10637,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::Vec2::is_nan_mask( @@ -10647,7 +10647,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::Vec2::length(_self.into_inner()) @@ -10655,7 +10655,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f32 = bevy::math::Vec2::length_squared( @@ -10665,7 +10665,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f32 = bevy::math::Vec2::length_recip(_self.into_inner()) @@ -10673,7 +10673,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec2::distance( @@ -10684,7 +10684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec2::distance_squared( @@ -10695,7 +10695,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::div_euclid( @@ -10706,7 +10706,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::rem_euclid( @@ -10717,7 +10717,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::Vec2::normalize( @@ -10727,7 +10727,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::Vec2::normalize_or( @@ -10738,7 +10738,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::Vec2::normalize_or_zero( @@ -10748,7 +10748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::Vec2::is_normalized( @@ -10758,7 +10758,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::project_onto( @@ -10769,7 +10769,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::reject_from( @@ -10780,7 +10780,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::project_onto_normalized( @@ -10791,7 +10791,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::reject_from_normalized( @@ -10802,7 +10802,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::Vec2::round( @@ -10812,7 +10812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::Vec2::floor( @@ -10822,7 +10822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::Vec2::ceil( @@ -10832,7 +10832,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::Vec2::trunc( @@ -10842,7 +10842,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::Vec2::fract( @@ -10852,7 +10852,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::Vec2::fract_gl( @@ -10862,7 +10862,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::Vec2::exp( @@ -10872,7 +10872,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f32| { let output: Val = bevy::math::Vec2::powf( @@ -10883,7 +10883,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::Vec2::recip( @@ -10893,7 +10893,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = bevy::math::Vec2::lerp( @@ -10905,7 +10905,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = bevy::math::Vec2::move_towards( @@ -10917,7 +10917,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::midpoint( @@ -10928,7 +10928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -10944,7 +10944,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = bevy::math::Vec2::clamp_length( @@ -10956,7 +10956,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f32| { let output: Val = bevy::math::Vec2::clamp_length_max( @@ -10967,7 +10967,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f32| { let output: Val = bevy::math::Vec2::clamp_length_min( @@ -10978,7 +10978,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -10994,7 +10994,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::Vec2::reflect( @@ -11005,7 +11005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", |_self: Val, normal: Val, eta: f32| { let output: Val = bevy::math::Vec2::refract( @@ -11017,7 +11017,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f32| { let output: Val = bevy::math::Vec2::from_angle( @@ -11027,7 +11027,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_angle", |_self: Val| { let output: f32 = bevy::math::Vec2::to_angle(_self.into_inner()) @@ -11035,7 +11035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec2::angle_between( @@ -11046,7 +11046,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_to", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec2::angle_to( @@ -11057,7 +11057,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp", |_self: Val| { let output: Val = bevy::math::Vec2::perp( @@ -11067,7 +11067,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp_dot", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec2::perp_dot( @@ -11078,7 +11078,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec2::rotate( @@ -11089,7 +11089,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_towards", | _self: Ref, @@ -11105,7 +11105,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec2", |_self: Ref| { let output: Val = bevy::math::Vec2::as_dvec2( @@ -11115,7 +11115,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec2", |_self: Ref| { let output: Val = bevy::math::Vec2::as_ivec2( @@ -11125,7 +11125,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec2", |_self: Ref| { let output: Val = bevy::math::Vec2::as_uvec2( @@ -11135,7 +11135,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec2", |_self: Ref| { let output: Val = bevy::math::Vec2::as_i64vec2( @@ -11145,7 +11145,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec2", |_self: Ref| { let output: Val = bevy::math::Vec2::as_u64vec2( @@ -11155,7 +11155,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: Ref| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = , rhs: f32| { let output: Val = | { let output: Val = ::clone( @@ -11296,7 +11296,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::neg( @@ -11336,7 +11336,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: f32, y: f32, z: f32| { let output: Val = bevy::math::Vec3A::new(x, y, z) @@ -11344,7 +11344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f32| { let output: Val = bevy::math::Vec3A::splat(v) @@ -11352,7 +11352,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -11368,7 +11368,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f32; 3]| { let output: Val = bevy::math::Vec3A::from_array(a) @@ -11376,14 +11376,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f32; 3] = bevy::math::Vec3A::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "from_vec4", |v: Val| { let output: Val = bevy::math::Vec3A::from_vec4( @@ -11393,7 +11393,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: f32| { let output: Val = bevy::math::Vec3A::extend( @@ -11404,7 +11404,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::Vec3A::truncate( @@ -11414,7 +11414,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f32| { let output: Val = bevy::math::Vec3A::with_x( @@ -11425,7 +11425,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f32| { let output: Val = bevy::math::Vec3A::with_y( @@ -11436,7 +11436,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: f32| { let output: Val = bevy::math::Vec3A::with_z( @@ -11447,7 +11447,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3A::dot( @@ -11458,7 +11458,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::dot_into_vec( @@ -11469,7 +11469,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cross( @@ -11480,7 +11480,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::min( @@ -11491,7 +11491,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::max( @@ -11502,7 +11502,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -11518,7 +11518,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f32 = bevy::math::Vec3A::min_element(_self.into_inner()) @@ -11526,7 +11526,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f32 = bevy::math::Vec3A::max_element(_self.into_inner()) @@ -11534,7 +11534,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f32 = bevy::math::Vec3A::element_sum(_self.into_inner()) @@ -11542,7 +11542,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f32 = bevy::math::Vec3A::element_product( @@ -11552,7 +11552,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cmpeq( @@ -11563,7 +11563,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cmpne( @@ -11574,7 +11574,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cmpge( @@ -11585,7 +11585,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cmpgt( @@ -11596,7 +11596,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cmple( @@ -11607,7 +11607,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::cmplt( @@ -11618,7 +11618,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::Vec3A::abs( @@ -11628,7 +11628,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::Vec3A::signum( @@ -11638,7 +11638,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::copysign( @@ -11649,7 +11649,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::Vec3A::is_negative_bitmask( @@ -11659,7 +11659,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::Vec3A::is_finite(_self.into_inner()) @@ -11667,7 +11667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::Vec3A::is_finite_mask( @@ -11677,7 +11677,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::Vec3A::is_nan(_self.into_inner()) @@ -11685,7 +11685,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::Vec3A::is_nan_mask( @@ -11695,7 +11695,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::Vec3A::length(_self.into_inner()) @@ -11703,7 +11703,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f32 = bevy::math::Vec3A::length_squared( @@ -11713,7 +11713,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f32 = bevy::math::Vec3A::length_recip(_self.into_inner()) @@ -11721,7 +11721,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3A::distance( @@ -11732,7 +11732,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3A::distance_squared( @@ -11743,7 +11743,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::div_euclid( @@ -11754,7 +11754,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::rem_euclid( @@ -11765,7 +11765,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::Vec3A::normalize( @@ -11775,7 +11775,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::Vec3A::normalize_or( @@ -11786,7 +11786,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::Vec3A::normalize_or_zero( @@ -11796,7 +11796,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::Vec3A::is_normalized( @@ -11806,7 +11806,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::project_onto( @@ -11817,7 +11817,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::reject_from( @@ -11828,7 +11828,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::project_onto_normalized( @@ -11839,7 +11839,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::reject_from_normalized( @@ -11850,7 +11850,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::Vec3A::round( @@ -11860,7 +11860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::Vec3A::floor( @@ -11870,7 +11870,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::Vec3A::ceil( @@ -11880,7 +11880,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::Vec3A::trunc( @@ -11890,7 +11890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::Vec3A::fract( @@ -11900,7 +11900,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::Vec3A::fract_gl( @@ -11910,7 +11910,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::Vec3A::exp( @@ -11920,7 +11920,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f32| { let output: Val = bevy::math::Vec3A::powf( @@ -11931,7 +11931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::Vec3A::recip( @@ -11941,7 +11941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = bevy::math::Vec3A::lerp( @@ -11953,7 +11953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = bevy::math::Vec3A::move_towards( @@ -11965,7 +11965,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec3A::midpoint( @@ -11976,7 +11976,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -11992,7 +11992,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = bevy::math::Vec3A::clamp_length( @@ -12004,7 +12004,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f32| { let output: Val = bevy::math::Vec3A::clamp_length_max( @@ -12015,7 +12015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f32| { let output: Val = bevy::math::Vec3A::clamp_length_min( @@ -12026,7 +12026,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -12042,7 +12042,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::Vec3A::reflect( @@ -12053,7 +12053,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", | _self: Val, @@ -12069,7 +12069,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec3A::angle_between( @@ -12080,7 +12080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any_orthogonal_vector", |_self: Ref| { let output: Val = bevy::math::Vec3A::any_orthogonal_vector( @@ -12090,7 +12090,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any_orthonormal_vector", |_self: Ref| { let output: Val = bevy::math::Vec3A::any_orthonormal_vector( @@ -12100,7 +12100,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec3", |_self: Ref| { let output: Val = bevy::math::Vec3A::as_dvec3( @@ -12110,7 +12110,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec3", |_self: Ref| { let output: Val = bevy::math::Vec3A::as_ivec3( @@ -12120,7 +12120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec3", |_self: Ref| { let output: Val = bevy::math::Vec3A::as_uvec3( @@ -12130,7 +12130,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec3", |_self: Ref| { let output: Val = bevy::math::Vec3A::as_i64vec3( @@ -12140,7 +12140,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec3", |_self: Ref| { let output: Val = bevy::math::Vec3A::as_u64vec3( @@ -12150,7 +12150,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Ref| { let output: Val = , rhs: f32| { let output: Val = , rhs: Ref| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: bool = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -12311,7 +12311,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: f32| { let output: Val = , rhs: f32| { let output: Val = = bevy::math::Vec4::new(x, y, z, w) @@ -12359,7 +12359,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f32| { let output: Val = bevy::math::Vec4::splat(v) @@ -12367,7 +12367,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -12383,7 +12383,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f32; 4]| { let output: Val = bevy::math::Vec4::from_array(a) @@ -12391,14 +12391,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f32; 4] = bevy::math::Vec4::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::Vec4::truncate( @@ -12408,7 +12408,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f32| { let output: Val = bevy::math::Vec4::with_x( @@ -12419,7 +12419,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f32| { let output: Val = bevy::math::Vec4::with_y( @@ -12430,7 +12430,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: f32| { let output: Val = bevy::math::Vec4::with_z( @@ -12441,7 +12441,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_w", |_self: Val, w: f32| { let output: Val = bevy::math::Vec4::with_w( @@ -12452,7 +12452,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec4::dot( @@ -12463,7 +12463,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::dot_into_vec( @@ -12474,7 +12474,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::min( @@ -12485,7 +12485,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::max( @@ -12496,7 +12496,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -12512,7 +12512,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f32 = bevy::math::Vec4::min_element(_self.into_inner()) @@ -12520,7 +12520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f32 = bevy::math::Vec4::max_element(_self.into_inner()) @@ -12528,7 +12528,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f32 = bevy::math::Vec4::element_sum(_self.into_inner()) @@ -12536,7 +12536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f32 = bevy::math::Vec4::element_product( @@ -12546,7 +12546,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::cmpeq( @@ -12557,7 +12557,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::cmpne( @@ -12568,7 +12568,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::cmpge( @@ -12579,7 +12579,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::cmpgt( @@ -12590,7 +12590,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::cmple( @@ -12601,7 +12601,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::cmplt( @@ -12612,7 +12612,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::Vec4::abs( @@ -12622,7 +12622,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::Vec4::signum( @@ -12632,7 +12632,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::copysign( @@ -12643,7 +12643,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::Vec4::is_negative_bitmask( @@ -12653,7 +12653,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::Vec4::is_finite(_self.into_inner()) @@ -12661,7 +12661,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::Vec4::is_finite_mask( @@ -12671,7 +12671,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::Vec4::is_nan(_self.into_inner()) @@ -12679,7 +12679,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::Vec4::is_nan_mask( @@ -12689,7 +12689,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f32 = bevy::math::Vec4::length(_self.into_inner()) @@ -12697,7 +12697,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f32 = bevy::math::Vec4::length_squared( @@ -12707,7 +12707,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f32 = bevy::math::Vec4::length_recip(_self.into_inner()) @@ -12715,7 +12715,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec4::distance( @@ -12726,7 +12726,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f32 = bevy::math::Vec4::distance_squared( @@ -12737,7 +12737,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::div_euclid( @@ -12748,7 +12748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::rem_euclid( @@ -12759,7 +12759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::Vec4::normalize( @@ -12769,7 +12769,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::Vec4::normalize_or( @@ -12780,7 +12780,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::Vec4::normalize_or_zero( @@ -12790,7 +12790,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::Vec4::is_normalized( @@ -12800,7 +12800,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::project_onto( @@ -12811,7 +12811,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::reject_from( @@ -12822,7 +12822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::project_onto_normalized( @@ -12833,7 +12833,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::reject_from_normalized( @@ -12844,7 +12844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::Vec4::round( @@ -12854,7 +12854,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::Vec4::floor( @@ -12864,7 +12864,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::Vec4::ceil( @@ -12874,7 +12874,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::Vec4::trunc( @@ -12884,7 +12884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::Vec4::fract( @@ -12894,7 +12894,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::Vec4::fract_gl( @@ -12904,7 +12904,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::Vec4::exp( @@ -12914,7 +12914,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f32| { let output: Val = bevy::math::Vec4::powf( @@ -12925,7 +12925,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::Vec4::recip( @@ -12935,7 +12935,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f32| { let output: Val = bevy::math::Vec4::lerp( @@ -12947,7 +12947,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f32| { let output: Val = bevy::math::Vec4::move_towards( @@ -12959,7 +12959,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::Vec4::midpoint( @@ -12970,7 +12970,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -12986,7 +12986,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f32, max: f32| { let output: Val = bevy::math::Vec4::clamp_length( @@ -12998,7 +12998,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f32| { let output: Val = bevy::math::Vec4::clamp_length_max( @@ -13009,7 +13009,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f32| { let output: Val = bevy::math::Vec4::clamp_length_min( @@ -13020,7 +13020,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -13036,7 +13036,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::Vec4::reflect( @@ -13047,7 +13047,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", |_self: Val, normal: Val, eta: f32| { let output: Val = bevy::math::Vec4::refract( @@ -13059,7 +13059,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dvec4", |_self: Ref| { let output: Val = bevy::math::Vec4::as_dvec4( @@ -13069,7 +13069,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec4", |_self: Ref| { let output: Val = bevy::math::Vec4::as_ivec4( @@ -13079,7 +13079,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec4", |_self: Ref| { let output: Val = bevy::math::Vec4::as_uvec4( @@ -13089,7 +13089,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec4", |_self: Ref| { let output: Val = bevy::math::Vec4::as_i64vec4( @@ -13099,7 +13099,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec4", |_self: Ref| { let output: Val = bevy::math::Vec4::as_u64vec4( @@ -13109,7 +13109,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = | { let output: Val = ::clone( @@ -13159,7 +13159,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -13200,7 +13200,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = = bevy::math::BVec2::new(x, y) @@ -13218,7 +13218,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: bool| { let output: Val = bevy::math::BVec2::splat(v) @@ -13226,7 +13226,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [bool; 2]| { let output: Val = bevy::math::BVec2::from_array(a) @@ -13234,7 +13234,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "bitmask", |_self: Val| { let output: u32 = bevy::math::BVec2::bitmask(_self.into_inner()) @@ -13242,28 +13242,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any", |_self: Val| { let output: bool = bevy::math::BVec2::any(_self.into_inner()).into(); output }, ) - .overwrite_script_function( + .register( "all", |_self: Val| { let output: bool = bevy::math::BVec2::all(_self.into_inner()).into(); output }, ) - .overwrite_script_function( + .register( "test", |_self: Ref, index: usize| { let output: bool = bevy::math::BVec2::test(&_self, index).into(); output }, ) - .overwrite_script_function( + .register( "set", |mut _self: Mut, index: usize, value: bool| { let output: () = bevy::math::BVec2::set(&mut _self, index, value) @@ -13271,7 +13271,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -13282,7 +13282,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::BVec3>::new(world) - .overwrite_script_function( + .register( "new", |x: bool, y: bool, z: bool| { let output: Val = bevy::math::BVec3::new(x, y, z) @@ -13290,7 +13290,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: bool| { let output: Val = bevy::math::BVec3::splat(v) @@ -13298,7 +13298,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [bool; 3]| { let output: Val = bevy::math::BVec3::from_array(a) @@ -13306,7 +13306,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "bitmask", |_self: Val| { let output: u32 = bevy::math::BVec3::bitmask(_self.into_inner()) @@ -13314,28 +13314,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any", |_self: Val| { let output: bool = bevy::math::BVec3::any(_self.into_inner()).into(); output }, ) - .overwrite_script_function( + .register( "all", |_self: Val| { let output: bool = bevy::math::BVec3::all(_self.into_inner()).into(); output }, ) - .overwrite_script_function( + .register( "test", |_self: Ref, index: usize| { let output: bool = bevy::math::BVec3::test(&_self, index).into(); output }, ) - .overwrite_script_function( + .register( "set", |mut _self: Mut, index: usize, value: bool| { let output: () = bevy::math::BVec3::set(&mut _self, index, value) @@ -13343,7 +13343,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: Val = ::clone( @@ -13363,7 +13363,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -13374,7 +13374,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::BVec4>::new(world) - .overwrite_script_function( + .register( "new", |x: bool, y: bool, z: bool, w: bool| { let output: Val = bevy::math::BVec4::new( @@ -13387,7 +13387,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: bool| { let output: Val = bevy::math::BVec4::splat(v) @@ -13395,7 +13395,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [bool; 4]| { let output: Val = bevy::math::BVec4::from_array(a) @@ -13403,7 +13403,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "bitmask", |_self: Val| { let output: u32 = bevy::math::BVec4::bitmask(_self.into_inner()) @@ -13411,28 +13411,28 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any", |_self: Val| { let output: bool = bevy::math::BVec4::any(_self.into_inner()).into(); output }, ) - .overwrite_script_function( + .register( "all", |_self: Val| { let output: bool = bevy::math::BVec4::all(_self.into_inner()).into(); output }, ) - .overwrite_script_function( + .register( "test", |_self: Ref, index: usize| { let output: bool = bevy::math::BVec4::test(&_self, index).into(); output }, ) - .overwrite_script_function( + .register( "set", |mut _self: Mut, index: usize, value: bool| { let output: () = bevy::math::BVec4::set(&mut _self, index, value) @@ -13440,7 +13440,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -13450,7 +13450,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: () = ::assert_receiver_is_total_eq( @@ -13471,7 +13471,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::DVec2>::new(world) - .overwrite_script_function( + .register( "neg", |_self: Val| { let output: Val = ::neg( @@ -13481,7 +13481,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: f64| { let output: Val = , rhs: f64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = = bevy::math::DVec2::new(x, y) @@ -13549,7 +13549,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f64| { let output: Val = bevy::math::DVec2::splat(v) @@ -13557,7 +13557,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -13573,7 +13573,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f64; 2]| { let output: Val = bevy::math::DVec2::from_array(a) @@ -13581,14 +13581,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f64; 2] = bevy::math::DVec2::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, z: f64| { let output: Val = bevy::math::DVec2::extend( @@ -13599,7 +13599,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f64| { let output: Val = bevy::math::DVec2::with_x( @@ -13610,7 +13610,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f64| { let output: Val = bevy::math::DVec2::with_y( @@ -13621,7 +13621,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec2::dot( @@ -13632,7 +13632,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::dot_into_vec( @@ -13643,7 +13643,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::min( @@ -13654,7 +13654,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::max( @@ -13665,7 +13665,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -13681,7 +13681,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f64 = bevy::math::DVec2::min_element(_self.into_inner()) @@ -13689,7 +13689,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f64 = bevy::math::DVec2::max_element(_self.into_inner()) @@ -13697,7 +13697,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f64 = bevy::math::DVec2::element_sum(_self.into_inner()) @@ -13705,7 +13705,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f64 = bevy::math::DVec2::element_product( @@ -13715,7 +13715,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::cmpeq( @@ -13726,7 +13726,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::cmpne( @@ -13737,7 +13737,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::cmpge( @@ -13748,7 +13748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::cmpgt( @@ -13759,7 +13759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::cmple( @@ -13770,7 +13770,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::cmplt( @@ -13781,7 +13781,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::DVec2::abs( @@ -13791,7 +13791,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::DVec2::signum( @@ -13801,7 +13801,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::copysign( @@ -13812,7 +13812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::DVec2::is_negative_bitmask( @@ -13822,7 +13822,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::DVec2::is_finite(_self.into_inner()) @@ -13830,7 +13830,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::DVec2::is_finite_mask( @@ -13840,7 +13840,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::DVec2::is_nan(_self.into_inner()) @@ -13848,7 +13848,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::DVec2::is_nan_mask( @@ -13858,7 +13858,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f64 = bevy::math::DVec2::length(_self.into_inner()) @@ -13866,7 +13866,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f64 = bevy::math::DVec2::length_squared( @@ -13876,7 +13876,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f64 = bevy::math::DVec2::length_recip(_self.into_inner()) @@ -13884,7 +13884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec2::distance( @@ -13895,7 +13895,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec2::distance_squared( @@ -13906,7 +13906,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::div_euclid( @@ -13917,7 +13917,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::rem_euclid( @@ -13928,7 +13928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::DVec2::normalize( @@ -13938,7 +13938,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::DVec2::normalize_or( @@ -13949,7 +13949,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::DVec2::normalize_or_zero( @@ -13959,7 +13959,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::DVec2::is_normalized( @@ -13969,7 +13969,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::project_onto( @@ -13980,7 +13980,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::reject_from( @@ -13991,7 +13991,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::project_onto_normalized( @@ -14002,7 +14002,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::reject_from_normalized( @@ -14013,7 +14013,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::DVec2::round( @@ -14023,7 +14023,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::DVec2::floor( @@ -14033,7 +14033,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::DVec2::ceil( @@ -14043,7 +14043,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::DVec2::trunc( @@ -14053,7 +14053,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::DVec2::fract( @@ -14063,7 +14063,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::DVec2::fract_gl( @@ -14073,7 +14073,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::DVec2::exp( @@ -14083,7 +14083,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f64| { let output: Val = bevy::math::DVec2::powf( @@ -14094,7 +14094,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::DVec2::recip( @@ -14104,7 +14104,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f64| { let output: Val = bevy::math::DVec2::lerp( @@ -14116,7 +14116,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f64| { let output: Val = bevy::math::DVec2::move_towards( @@ -14128,7 +14128,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::midpoint( @@ -14139,7 +14139,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -14155,7 +14155,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f64, max: f64| { let output: Val = bevy::math::DVec2::clamp_length( @@ -14167,7 +14167,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f64| { let output: Val = bevy::math::DVec2::clamp_length_max( @@ -14178,7 +14178,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f64| { let output: Val = bevy::math::DVec2::clamp_length_min( @@ -14189,7 +14189,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -14205,7 +14205,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::DVec2::reflect( @@ -14216,7 +14216,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", | _self: Val, @@ -14232,7 +14232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f64| { let output: Val = bevy::math::DVec2::from_angle( @@ -14242,7 +14242,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_angle", |_self: Val| { let output: f64 = bevy::math::DVec2::to_angle(_self.into_inner()) @@ -14250,7 +14250,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec2::angle_between( @@ -14261,7 +14261,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_to", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec2::angle_to( @@ -14272,7 +14272,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp", |_self: Val| { let output: Val = bevy::math::DVec2::perp( @@ -14282,7 +14282,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perp_dot", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec2::perp_dot( @@ -14293,7 +14293,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec2::rotate( @@ -14304,7 +14304,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_towards", | _self: Ref, @@ -14320,7 +14320,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec2", |_self: Ref| { let output: Val = bevy::math::DVec2::as_vec2( @@ -14330,7 +14330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec2", |_self: Ref| { let output: Val = bevy::math::DVec2::as_ivec2( @@ -14340,7 +14340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec2", |_self: Ref| { let output: Val = bevy::math::DVec2::as_uvec2( @@ -14350,7 +14350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec2", |_self: Ref| { let output: Val = bevy::math::DVec2::as_i64vec2( @@ -14360,7 +14360,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec2", |_self: Ref| { let output: Val = bevy::math::DVec2::as_u64vec2( @@ -14370,7 +14370,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = , rhs: Val| { let output: Val = , rhs: f64| { let output: Val = | { let output: Val = ::clone( @@ -14430,7 +14430,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem", |_self: Val, rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: f64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Ref| { let output: Val = | { let output: Val = ::neg( @@ -14501,7 +14501,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = = bevy::math::DVec3::new(x, y, z) @@ -14539,7 +14539,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f64| { let output: Val = bevy::math::DVec3::splat(v) @@ -14547,7 +14547,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -14563,7 +14563,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f64; 3]| { let output: Val = bevy::math::DVec3::from_array(a) @@ -14571,14 +14571,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f64; 3] = bevy::math::DVec3::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "extend", |_self: Val, w: f64| { let output: Val = bevy::math::DVec3::extend( @@ -14589,7 +14589,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::DVec3::truncate( @@ -14599,7 +14599,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f64| { let output: Val = bevy::math::DVec3::with_x( @@ -14610,7 +14610,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f64| { let output: Val = bevy::math::DVec3::with_y( @@ -14621,7 +14621,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: f64| { let output: Val = bevy::math::DVec3::with_z( @@ -14632,7 +14632,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec3::dot( @@ -14643,7 +14643,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::dot_into_vec( @@ -14654,7 +14654,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cross", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cross( @@ -14665,7 +14665,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::min( @@ -14676,7 +14676,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::max( @@ -14687,7 +14687,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -14703,7 +14703,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f64 = bevy::math::DVec3::min_element(_self.into_inner()) @@ -14711,7 +14711,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f64 = bevy::math::DVec3::max_element(_self.into_inner()) @@ -14719,7 +14719,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f64 = bevy::math::DVec3::element_sum(_self.into_inner()) @@ -14727,7 +14727,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f64 = bevy::math::DVec3::element_product( @@ -14737,7 +14737,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cmpeq( @@ -14748,7 +14748,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cmpne( @@ -14759,7 +14759,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cmpge( @@ -14770,7 +14770,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cmpgt( @@ -14781,7 +14781,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cmple( @@ -14792,7 +14792,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::cmplt( @@ -14803,7 +14803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::DVec3::abs( @@ -14813,7 +14813,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::DVec3::signum( @@ -14823,7 +14823,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::copysign( @@ -14834,7 +14834,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::DVec3::is_negative_bitmask( @@ -14844,7 +14844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::DVec3::is_finite(_self.into_inner()) @@ -14852,7 +14852,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::DVec3::is_finite_mask( @@ -14862,7 +14862,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::DVec3::is_nan(_self.into_inner()) @@ -14870,7 +14870,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::DVec3::is_nan_mask( @@ -14880,7 +14880,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f64 = bevy::math::DVec3::length(_self.into_inner()) @@ -14888,7 +14888,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f64 = bevy::math::DVec3::length_squared( @@ -14898,7 +14898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f64 = bevy::math::DVec3::length_recip(_self.into_inner()) @@ -14906,7 +14906,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec3::distance( @@ -14917,7 +14917,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec3::distance_squared( @@ -14928,7 +14928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::div_euclid( @@ -14939,7 +14939,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::rem_euclid( @@ -14950,7 +14950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::DVec3::normalize( @@ -14960,7 +14960,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::DVec3::normalize_or( @@ -14971,7 +14971,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::DVec3::normalize_or_zero( @@ -14981,7 +14981,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::DVec3::is_normalized( @@ -14991,7 +14991,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::project_onto( @@ -15002,7 +15002,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::reject_from( @@ -15013,7 +15013,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::project_onto_normalized( @@ -15024,7 +15024,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::reject_from_normalized( @@ -15035,7 +15035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::DVec3::round( @@ -15045,7 +15045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::DVec3::floor( @@ -15055,7 +15055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::DVec3::ceil( @@ -15065,7 +15065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::DVec3::trunc( @@ -15075,7 +15075,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::DVec3::fract( @@ -15085,7 +15085,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::DVec3::fract_gl( @@ -15095,7 +15095,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::DVec3::exp( @@ -15105,7 +15105,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f64| { let output: Val = bevy::math::DVec3::powf( @@ -15116,7 +15116,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::DVec3::recip( @@ -15126,7 +15126,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f64| { let output: Val = bevy::math::DVec3::lerp( @@ -15138,7 +15138,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f64| { let output: Val = bevy::math::DVec3::move_towards( @@ -15150,7 +15150,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec3::midpoint( @@ -15161,7 +15161,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -15177,7 +15177,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f64, max: f64| { let output: Val = bevy::math::DVec3::clamp_length( @@ -15189,7 +15189,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f64| { let output: Val = bevy::math::DVec3::clamp_length_max( @@ -15200,7 +15200,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f64| { let output: Val = bevy::math::DVec3::clamp_length_min( @@ -15211,7 +15211,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -15227,7 +15227,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::DVec3::reflect( @@ -15238,7 +15238,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", | _self: Val, @@ -15254,7 +15254,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec3::angle_between( @@ -15265,7 +15265,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any_orthogonal_vector", |_self: Ref| { let output: Val = bevy::math::DVec3::any_orthogonal_vector( @@ -15275,7 +15275,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any_orthonormal_vector", |_self: Ref| { let output: Val = bevy::math::DVec3::any_orthonormal_vector( @@ -15285,7 +15285,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3", |_self: Ref| { let output: Val = bevy::math::DVec3::as_vec3( @@ -15295,7 +15295,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec3a", |_self: Ref| { let output: Val = bevy::math::DVec3::as_vec3a( @@ -15305,7 +15305,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec3", |_self: Ref| { let output: Val = bevy::math::DVec3::as_ivec3( @@ -15315,7 +15315,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec3", |_self: Ref| { let output: Val = bevy::math::DVec3::as_uvec3( @@ -15325,7 +15325,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec3", |_self: Ref| { let output: Val = bevy::math::DVec3::as_i64vec3( @@ -15335,7 +15335,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec3", |_self: Ref| { let output: Val = bevy::math::DVec3::as_u64vec3( @@ -15345,7 +15345,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: f64| { let output: Val = , rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , other: Ref| { let output: bool = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: f64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Ref| { let output: Val = , rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -15476,7 +15476,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::DVec4>::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: f64| { let output: Val = , rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: f64| { let output: Val = , rhs: f64| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -15596,7 +15596,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::neg( @@ -15646,7 +15646,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: f64, y: f64, z: f64, w: f64| { let output: Val = bevy::math::DVec4::new( @@ -15659,7 +15659,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: f64| { let output: Val = bevy::math::DVec4::splat(v) @@ -15667,7 +15667,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "select", | mask: Val, @@ -15683,7 +15683,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f64; 4]| { let output: Val = bevy::math::DVec4::from_array(a) @@ -15691,14 +15691,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f64; 4] = bevy::math::DVec4::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "truncate", |_self: Val| { let output: Val = bevy::math::DVec4::truncate( @@ -15708,7 +15708,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_x", |_self: Val, x: f64| { let output: Val = bevy::math::DVec4::with_x( @@ -15719,7 +15719,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_y", |_self: Val, y: f64| { let output: Val = bevy::math::DVec4::with_y( @@ -15730,7 +15730,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_z", |_self: Val, z: f64| { let output: Val = bevy::math::DVec4::with_z( @@ -15741,7 +15741,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "with_w", |_self: Val, w: f64| { let output: Val = bevy::math::DVec4::with_w( @@ -15752,7 +15752,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec4::dot( @@ -15763,7 +15763,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot_into_vec", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::dot_into_vec( @@ -15774,7 +15774,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::min( @@ -15785,7 +15785,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::max( @@ -15796,7 +15796,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp", | _self: Val, @@ -15812,7 +15812,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "min_element", |_self: Val| { let output: f64 = bevy::math::DVec4::min_element(_self.into_inner()) @@ -15820,7 +15820,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "max_element", |_self: Val| { let output: f64 = bevy::math::DVec4::max_element(_self.into_inner()) @@ -15828,7 +15828,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_sum", |_self: Val| { let output: f64 = bevy::math::DVec4::element_sum(_self.into_inner()) @@ -15836,7 +15836,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "element_product", |_self: Val| { let output: f64 = bevy::math::DVec4::element_product( @@ -15846,7 +15846,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpeq", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::cmpeq( @@ -15857,7 +15857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpne", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::cmpne( @@ -15868,7 +15868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpge", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::cmpge( @@ -15879,7 +15879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmpgt", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::cmpgt( @@ -15890,7 +15890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmple", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::cmple( @@ -15901,7 +15901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "cmplt", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::cmplt( @@ -15912,7 +15912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Val| { let output: Val = bevy::math::DVec4::abs( @@ -15922,7 +15922,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "signum", |_self: Val| { let output: Val = bevy::math::DVec4::signum( @@ -15932,7 +15932,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "copysign", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::copysign( @@ -15943,7 +15943,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_negative_bitmask", |_self: Val| { let output: u32 = bevy::math::DVec4::is_negative_bitmask( @@ -15953,7 +15953,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::DVec4::is_finite(_self.into_inner()) @@ -15961,7 +15961,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite_mask", |_self: Val| { let output: Val = bevy::math::DVec4::is_finite_mask( @@ -15971,7 +15971,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::DVec4::is_nan(_self.into_inner()) @@ -15979,7 +15979,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan_mask", |_self: Val| { let output: Val = bevy::math::DVec4::is_nan_mask( @@ -15989,7 +15989,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f64 = bevy::math::DVec4::length(_self.into_inner()) @@ -15997,7 +15997,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f64 = bevy::math::DVec4::length_squared( @@ -16007,7 +16007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f64 = bevy::math::DVec4::length_recip(_self.into_inner()) @@ -16015,7 +16015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec4::distance( @@ -16026,7 +16026,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "distance_squared", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DVec4::distance_squared( @@ -16037,7 +16037,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::div_euclid( @@ -16048,7 +16048,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rem_euclid", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::rem_euclid( @@ -16059,7 +16059,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::DVec4::normalize( @@ -16069,7 +16069,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or", |_self: Val, fallback: Val| { let output: Val = bevy::math::DVec4::normalize_or( @@ -16080,7 +16080,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize_or_zero", |_self: Val| { let output: Val = bevy::math::DVec4::normalize_or_zero( @@ -16090,7 +16090,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::DVec4::is_normalized( @@ -16100,7 +16100,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::project_onto( @@ -16111,7 +16111,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::reject_from( @@ -16122,7 +16122,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_onto_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::project_onto_normalized( @@ -16133,7 +16133,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reject_from_normalized", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::reject_from_normalized( @@ -16144,7 +16144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "round", |_self: Val| { let output: Val = bevy::math::DVec4::round( @@ -16154,7 +16154,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "floor", |_self: Val| { let output: Val = bevy::math::DVec4::floor( @@ -16164,7 +16164,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "ceil", |_self: Val| { let output: Val = bevy::math::DVec4::ceil( @@ -16174,7 +16174,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "trunc", |_self: Val| { let output: Val = bevy::math::DVec4::trunc( @@ -16184,7 +16184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract", |_self: Val| { let output: Val = bevy::math::DVec4::fract( @@ -16194,7 +16194,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fract_gl", |_self: Val| { let output: Val = bevy::math::DVec4::fract_gl( @@ -16204,7 +16204,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "exp", |_self: Val| { let output: Val = bevy::math::DVec4::exp( @@ -16214,7 +16214,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "powf", |_self: Val, n: f64| { let output: Val = bevy::math::DVec4::powf( @@ -16225,7 +16225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "recip", |_self: Val| { let output: Val = bevy::math::DVec4::recip( @@ -16235,7 +16235,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, rhs: Val, s: f64| { let output: Val = bevy::math::DVec4::lerp( @@ -16247,7 +16247,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "move_towards", |_self: Ref, rhs: Val, d: f64| { let output: Val = bevy::math::DVec4::move_towards( @@ -16259,7 +16259,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "midpoint", |_self: Val, rhs: Val| { let output: Val = bevy::math::DVec4::midpoint( @@ -16270,7 +16270,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -16286,7 +16286,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length", |_self: Val, min: f64, max: f64| { let output: Val = bevy::math::DVec4::clamp_length( @@ -16298,7 +16298,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_max", |_self: Val, max: f64| { let output: Val = bevy::math::DVec4::clamp_length_max( @@ -16309,7 +16309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clamp_length_min", |_self: Val, min: f64| { let output: Val = bevy::math::DVec4::clamp_length_min( @@ -16320,7 +16320,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_add", | _self: Val, @@ -16336,7 +16336,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reflect", |_self: Val, normal: Val| { let output: Val = bevy::math::DVec4::reflect( @@ -16347,7 +16347,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "refract", | _self: Val, @@ -16363,7 +16363,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_vec4", |_self: Ref| { let output: Val = bevy::math::DVec4::as_vec4( @@ -16373,7 +16373,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_ivec4", |_self: Ref| { let output: Val = bevy::math::DVec4::as_ivec4( @@ -16383,7 +16383,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_uvec4", |_self: Ref| { let output: Val = bevy::math::DVec4::as_uvec4( @@ -16393,7 +16393,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_i64vec4", |_self: Ref| { let output: Val = bevy::math::DVec4::as_i64vec4( @@ -16403,7 +16403,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_u64vec4", |_self: Ref| { let output: Val = bevy::math::DVec4::as_u64vec4( @@ -16413,7 +16413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: f64| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , y_axis: Val| { let output: Val = bevy::math::Mat2::from_cols( @@ -16465,7 +16465,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f32; 4] = bevy::math::Mat2::to_cols_array(&_self) @@ -16473,7 +16473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f32; 2]; 2] = bevy::math::Mat2::to_cols_array_2d( @@ -16483,7 +16483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::Mat2::from_diagonal( @@ -16493,7 +16493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle", |scale: Val, angle: f32| { let output: Val = bevy::math::Mat2::from_scale_angle( @@ -16504,7 +16504,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f32| { let output: Val = bevy::math::Mat2::from_angle( @@ -16514,7 +16514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |m: Val| { let output: Val = bevy::math::Mat2::from_mat3( @@ -16524,7 +16524,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3_minor", |m: Val, i: usize, j: usize| { let output: Val = bevy::math::Mat2::from_mat3_minor( @@ -16536,7 +16536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3a", |m: Val| { let output: Val = bevy::math::Mat2::from_mat3a( @@ -16546,7 +16546,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3a_minor", |m: Val, i: usize, j: usize| { let output: Val = bevy::math::Mat2::from_mat3a_minor( @@ -16558,7 +16558,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat2::col( @@ -16569,7 +16569,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat2::row( @@ -16580,21 +16580,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::Mat2::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::Mat2::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::Mat2::transpose( @@ -16604,14 +16604,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f32 = bevy::math::Mat2::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Mat2::inverse(&_self) @@ -16619,7 +16619,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat2::mul_vec2( @@ -16630,7 +16630,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat2", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat2::mul_mat2( @@ -16641,7 +16641,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat2", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat2::add_mat2( @@ -16652,7 +16652,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat2", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat2::sub_mat2( @@ -16663,7 +16663,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat2::mul_scalar( @@ -16674,7 +16674,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat2::div_scalar( @@ -16685,7 +16685,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -16701,7 +16701,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::Mat2::abs(&_self) @@ -16709,7 +16709,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dmat2", |_self: Ref| { let output: Val = bevy::math::Mat2::as_dmat2( @@ -16719,7 +16719,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = , rhs: Val| { let output: Val = | { let output: Val = ::neg( @@ -16749,7 +16749,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: f32| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -16780,7 +16780,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::Mat3>::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , @@ -16826,7 +16826,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f32; 9] = bevy::math::Mat3::to_cols_array(&_self) @@ -16834,7 +16834,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f32; 3]; 3] = bevy::math::Mat3::to_cols_array_2d( @@ -16844,7 +16844,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::Mat3::from_diagonal( @@ -16854,7 +16854,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |m: Val| { let output: Val = bevy::math::Mat3::from_mat4( @@ -16864,7 +16864,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4_minor", |m: Val, i: usize, j: usize| { let output: Val = bevy::math::Mat3::from_mat4_minor( @@ -16876,7 +16876,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::Mat3::from_quat( @@ -16886,7 +16886,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f32| { let output: Val = bevy::math::Mat3::from_axis_angle( @@ -16897,7 +16897,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |order: Val, a: f32, b: f32, c: f32| { let output: Val = bevy::math::Mat3::from_euler( @@ -16910,7 +16910,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Ref, order: Val| { let output: (f32, f32, f32) = bevy::math::Mat3::to_euler( @@ -16921,7 +16921,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f32| { let output: Val = bevy::math::Mat3::from_rotation_x( @@ -16931,7 +16931,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f32| { let output: Val = bevy::math::Mat3::from_rotation_y( @@ -16941,7 +16941,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f32| { let output: Val = bevy::math::Mat3::from_rotation_z( @@ -16951,7 +16951,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::Mat3::from_translation( @@ -16961,7 +16961,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f32| { let output: Val = bevy::math::Mat3::from_angle( @@ -16971,7 +16971,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle_translation", | scale: Val, @@ -16987,7 +16987,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::Mat3::from_scale( @@ -16997,7 +16997,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2", |m: Val| { let output: Val = bevy::math::Mat3::from_mat2( @@ -17007,7 +17007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat3::col( @@ -17018,7 +17018,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat3::row( @@ -17029,21 +17029,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::Mat3::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::Mat3::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::Mat3::transpose( @@ -17053,14 +17053,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f32 = bevy::math::Mat3::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Mat3::inverse(&_self) @@ -17068,7 +17068,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3::transform_point2( @@ -17079,7 +17079,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3::transform_vector2( @@ -17090,7 +17090,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3::mul_vec3( @@ -17101,7 +17101,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3::mul_vec3a( @@ -17112,7 +17112,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat3::mul_mat3( @@ -17123,7 +17123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat3::add_mat3( @@ -17134,7 +17134,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat3::sub_mat3( @@ -17145,7 +17145,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat3::mul_scalar( @@ -17156,7 +17156,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat3::div_scalar( @@ -17167,7 +17167,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -17183,7 +17183,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::Mat3::abs(&_self) @@ -17191,7 +17191,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dmat3", |_self: Ref| { let output: Val = bevy::math::Mat3::as_dmat3( @@ -17201,7 +17201,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = | { let output: Val = ::neg( @@ -17221,7 +17221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -17241,7 +17241,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = , rhs: f32| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f32| { let output: Val = , rhs: Ref| { let output: bool = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -17332,7 +17332,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_cols", | x_axis: Val, @@ -17348,7 +17348,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f32; 9] = bevy::math::Mat3A::to_cols_array(&_self) @@ -17356,7 +17356,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f32; 3]; 3] = bevy::math::Mat3A::to_cols_array_2d( @@ -17366,7 +17366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::Mat3A::from_diagonal( @@ -17376,7 +17376,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |m: Val| { let output: Val = bevy::math::Mat3A::from_mat4( @@ -17386,7 +17386,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4_minor", |m: Val, i: usize, j: usize| { let output: Val = bevy::math::Mat3A::from_mat4_minor( @@ -17398,7 +17398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::Mat3A::from_quat( @@ -17408,7 +17408,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f32| { let output: Val = bevy::math::Mat3A::from_axis_angle( @@ -17419,7 +17419,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |order: Val, a: f32, b: f32, c: f32| { let output: Val = bevy::math::Mat3A::from_euler( @@ -17432,7 +17432,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Ref, order: Val| { let output: (f32, f32, f32) = bevy::math::Mat3A::to_euler( @@ -17443,7 +17443,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f32| { let output: Val = bevy::math::Mat3A::from_rotation_x( @@ -17453,7 +17453,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f32| { let output: Val = bevy::math::Mat3A::from_rotation_y( @@ -17463,7 +17463,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f32| { let output: Val = bevy::math::Mat3A::from_rotation_z( @@ -17473,7 +17473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::Mat3A::from_translation( @@ -17483,7 +17483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f32| { let output: Val = bevy::math::Mat3A::from_angle( @@ -17493,7 +17493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle_translation", | scale: Val, @@ -17509,7 +17509,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::Mat3A::from_scale( @@ -17519,7 +17519,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2", |m: Val| { let output: Val = bevy::math::Mat3A::from_mat2( @@ -17529,7 +17529,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat3A::col( @@ -17540,7 +17540,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat3A::row( @@ -17551,21 +17551,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::Mat3A::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::Mat3A::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::Mat3A::transpose( @@ -17575,14 +17575,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f32 = bevy::math::Mat3A::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Mat3A::inverse( @@ -17592,7 +17592,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3A::transform_point2( @@ -17603,7 +17603,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3A::transform_vector2( @@ -17614,7 +17614,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3A::mul_vec3( @@ -17625,7 +17625,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat3A::mul_vec3a( @@ -17636,7 +17636,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat3A::mul_mat3( @@ -17647,7 +17647,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat3A::add_mat3( @@ -17658,7 +17658,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat3A::sub_mat3( @@ -17669,7 +17669,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat3A::mul_scalar( @@ -17680,7 +17680,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat3A::div_scalar( @@ -17691,7 +17691,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -17707,7 +17707,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::Mat3A::abs(&_self) @@ -17715,7 +17715,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dmat3", |_self: Ref| { let output: Val = bevy::math::Mat3A::as_dmat3( @@ -17725,7 +17725,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: f32| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::neg( @@ -17765,7 +17765,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: f32| { let output: Val = | { let output: Val = ::neg( @@ -17846,7 +17846,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -17866,7 +17866,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_cols", | x_axis: Val, @@ -17884,7 +17884,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f32; 16] = bevy::math::Mat4::to_cols_array(&_self) @@ -17892,7 +17892,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f32; 4]; 4] = bevy::math::Mat4::to_cols_array_2d( @@ -17902,7 +17902,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::Mat4::from_diagonal( @@ -17912,7 +17912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_rotation_translation", | scale: Val, @@ -17928,7 +17928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = bevy::math::Mat4::from_rotation_translation( @@ -17939,7 +17939,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::Mat4::from_quat( @@ -17949,7 +17949,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |m: Val| { let output: Val = bevy::math::Mat4::from_mat3( @@ -17959,7 +17959,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3a", |m: Val| { let output: Val = bevy::math::Mat4::from_mat3a( @@ -17969,7 +17969,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::Mat4::from_translation( @@ -17979,7 +17979,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f32| { let output: Val = bevy::math::Mat4::from_axis_angle( @@ -17990,7 +17990,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |order: Val, a: f32, b: f32, c: f32| { let output: Val = bevy::math::Mat4::from_euler( @@ -18003,7 +18003,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Ref, order: Val| { let output: (f32, f32, f32) = bevy::math::Mat4::to_euler( @@ -18014,7 +18014,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f32| { let output: Val = bevy::math::Mat4::from_rotation_x( @@ -18024,7 +18024,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f32| { let output: Val = bevy::math::Mat4::from_rotation_y( @@ -18034,7 +18034,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f32| { let output: Val = bevy::math::Mat4::from_rotation_z( @@ -18044,7 +18044,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::Mat4::from_scale( @@ -18054,7 +18054,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat4::col( @@ -18065,7 +18065,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::Mat4::row( @@ -18076,21 +18076,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::Mat4::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::Mat4::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::Mat4::transpose( @@ -18100,14 +18100,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f32 = bevy::math::Mat4::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Mat4::inverse(&_self) @@ -18115,7 +18115,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_lh", | eye: Val, @@ -18131,7 +18131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_rh", | eye: Val, @@ -18147,7 +18147,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_lh", | eye: Val, @@ -18163,7 +18163,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_rh", | eye: Val, @@ -18179,7 +18179,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_rh_gl", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { let output: Val = bevy::math::Mat4::perspective_rh_gl( @@ -18192,7 +18192,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { let output: Val = bevy::math::Mat4::perspective_lh( @@ -18205,7 +18205,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32, z_far: f32| { let output: Val = bevy::math::Mat4::perspective_rh( @@ -18218,7 +18218,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = bevy::math::Mat4::perspective_infinite_lh( @@ -18230,7 +18230,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_reverse_lh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = bevy::math::Mat4::perspective_infinite_reverse_lh( @@ -18242,7 +18242,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = bevy::math::Mat4::perspective_infinite_rh( @@ -18254,7 +18254,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_reverse_rh", |fov_y_radians: f32, aspect_ratio: f32, z_near: f32| { let output: Val = bevy::math::Mat4::perspective_infinite_reverse_rh( @@ -18266,7 +18266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "orthographic_rh_gl", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { let output: Val = bevy::math::Mat4::orthographic_rh_gl( @@ -18281,7 +18281,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "orthographic_lh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { let output: Val = bevy::math::Mat4::orthographic_lh( @@ -18296,7 +18296,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "orthographic_rh", |left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32| { let output: Val = bevy::math::Mat4::orthographic_rh( @@ -18311,7 +18311,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_point3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::project_point3( @@ -18322,7 +18322,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::transform_point3( @@ -18333,7 +18333,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::transform_vector3( @@ -18344,7 +18344,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_point3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::project_point3a( @@ -18355,7 +18355,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::transform_point3a( @@ -18366,7 +18366,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::transform_vector3a( @@ -18377,7 +18377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec4", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Mat4::mul_vec4( @@ -18388,7 +18388,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat4", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat4::mul_mat4( @@ -18399,7 +18399,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat4", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat4::add_mat4( @@ -18410,7 +18410,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat4", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::Mat4::sub_mat4( @@ -18421,7 +18421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat4::mul_scalar( @@ -18432,7 +18432,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f32| { let output: Val = bevy::math::Mat4::div_scalar( @@ -18443,7 +18443,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -18459,7 +18459,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::Mat4::abs(&_self) @@ -18467,7 +18467,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_dmat4", |_self: Ref| { let output: Val = bevy::math::Mat4::as_dmat4( @@ -18477,7 +18477,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = , rhs: f32| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -18508,7 +18508,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: f64| { let output: Val = , rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = , y_axis: Val| { let output: Val = bevy::math::DMat2::from_cols( @@ -18589,7 +18589,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f64; 4] = bevy::math::DMat2::to_cols_array(&_self) @@ -18597,7 +18597,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f64; 2]; 2] = bevy::math::DMat2::to_cols_array_2d( @@ -18607,7 +18607,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::DMat2::from_diagonal( @@ -18617,7 +18617,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle", |scale: Val, angle: f64| { let output: Val = bevy::math::DMat2::from_scale_angle( @@ -18628,7 +18628,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f64| { let output: Val = bevy::math::DMat2::from_angle( @@ -18638,7 +18638,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |m: Val| { let output: Val = bevy::math::DMat2::from_mat3( @@ -18648,7 +18648,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3_minor", |m: Val, i: usize, j: usize| { let output: Val = bevy::math::DMat2::from_mat3_minor( @@ -18660,7 +18660,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::DMat2::col( @@ -18671,7 +18671,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::DMat2::row( @@ -18682,21 +18682,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::DMat2::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::DMat2::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::DMat2::transpose( @@ -18706,14 +18706,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f64 = bevy::math::DMat2::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::DMat2::inverse( @@ -18723,7 +18723,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat2::mul_vec2( @@ -18734,7 +18734,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat2", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat2::mul_mat2( @@ -18745,7 +18745,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat2", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat2::add_mat2( @@ -18756,7 +18756,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat2", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat2::sub_mat2( @@ -18767,7 +18767,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f64| { let output: Val = bevy::math::DMat2::mul_scalar( @@ -18778,7 +18778,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f64| { let output: Val = bevy::math::DMat2::div_scalar( @@ -18789,7 +18789,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -18805,7 +18805,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::DMat2::abs(&_self) @@ -18813,7 +18813,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_mat2", |_self: Ref| { let output: Val = bevy::math::DMat2::as_mat2( @@ -18823,7 +18823,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "neg", |_self: Val| { let output: Val = ::neg( @@ -18834,7 +18834,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::DMat3>::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: f64| { let output: Val = | { let output: Val = ::clone( @@ -18854,7 +18854,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , @@ -18900,7 +18900,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f64; 9] = bevy::math::DMat3::to_cols_array(&_self) @@ -18908,7 +18908,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f64; 3]; 3] = bevy::math::DMat3::to_cols_array_2d( @@ -18918,7 +18918,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::DMat3::from_diagonal( @@ -18928,7 +18928,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |m: Val| { let output: Val = bevy::math::DMat3::from_mat4( @@ -18938,7 +18938,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4_minor", |m: Val, i: usize, j: usize| { let output: Val = bevy::math::DMat3::from_mat4_minor( @@ -18950,7 +18950,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::DMat3::from_quat( @@ -18960,7 +18960,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f64| { let output: Val = bevy::math::DMat3::from_axis_angle( @@ -18971,7 +18971,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |order: Val, a: f64, b: f64, c: f64| { let output: Val = bevy::math::DMat3::from_euler( @@ -18984,7 +18984,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Ref, order: Val| { let output: (f64, f64, f64) = bevy::math::DMat3::to_euler( @@ -18995,7 +18995,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f64| { let output: Val = bevy::math::DMat3::from_rotation_x( @@ -19005,7 +19005,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f64| { let output: Val = bevy::math::DMat3::from_rotation_y( @@ -19015,7 +19015,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f64| { let output: Val = bevy::math::DMat3::from_rotation_z( @@ -19025,7 +19025,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::DMat3::from_translation( @@ -19035,7 +19035,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f64| { let output: Val = bevy::math::DMat3::from_angle( @@ -19045,7 +19045,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle_translation", | scale: Val, @@ -19061,7 +19061,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::DMat3::from_scale( @@ -19071,7 +19071,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2", |m: Val| { let output: Val = bevy::math::DMat3::from_mat2( @@ -19081,7 +19081,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::DMat3::col( @@ -19092,7 +19092,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::DMat3::row( @@ -19103,21 +19103,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::DMat3::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::DMat3::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::DMat3::transpose( @@ -19127,14 +19127,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f64 = bevy::math::DMat3::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::DMat3::inverse( @@ -19144,7 +19144,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat3::transform_point2( @@ -19155,7 +19155,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat3::transform_vector2( @@ -19166,7 +19166,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat3::mul_vec3( @@ -19177,7 +19177,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat3::mul_mat3( @@ -19188,7 +19188,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat3::add_mat3( @@ -19199,7 +19199,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat3", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat3::sub_mat3( @@ -19210,7 +19210,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f64| { let output: Val = bevy::math::DMat3::mul_scalar( @@ -19221,7 +19221,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f64| { let output: Val = bevy::math::DMat3::div_scalar( @@ -19232,7 +19232,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -19248,7 +19248,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::DMat3::abs(&_self) @@ -19256,7 +19256,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_mat3", |_self: Ref| { let output: Val = bevy::math::DMat3::as_mat3( @@ -19266,7 +19266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = | { let output: Val = ::neg( @@ -19317,7 +19317,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::DMat4>::new(world) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -19357,7 +19357,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = , rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , @@ -19405,7 +19405,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f64; 16] = bevy::math::DMat4::to_cols_array(&_self) @@ -19413,7 +19413,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f64; 4]; 4] = bevy::math::DMat4::to_cols_array_2d( @@ -19423,7 +19423,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_diagonal", |diagonal: Val| { let output: Val = bevy::math::DMat4::from_diagonal( @@ -19433,7 +19433,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_rotation_translation", | scale: Val, @@ -19449,7 +19449,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = bevy::math::DMat4::from_rotation_translation( @@ -19460,7 +19460,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::DMat4::from_quat( @@ -19470,7 +19470,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |m: Val| { let output: Val = bevy::math::DMat4::from_mat3( @@ -19480,7 +19480,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::DMat4::from_translation( @@ -19490,7 +19490,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f64| { let output: Val = bevy::math::DMat4::from_axis_angle( @@ -19501,7 +19501,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |order: Val, a: f64, b: f64, c: f64| { let output: Val = bevy::math::DMat4::from_euler( @@ -19514,7 +19514,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Ref, order: Val| { let output: (f64, f64, f64) = bevy::math::DMat4::to_euler( @@ -19525,7 +19525,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f64| { let output: Val = bevy::math::DMat4::from_rotation_x( @@ -19535,7 +19535,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f64| { let output: Val = bevy::math::DMat4::from_rotation_y( @@ -19545,7 +19545,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f64| { let output: Val = bevy::math::DMat4::from_rotation_z( @@ -19555,7 +19555,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::DMat4::from_scale( @@ -19565,7 +19565,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "col", |_self: Ref, index: usize| { let output: Val = bevy::math::DMat4::col( @@ -19576,7 +19576,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "row", |_self: Ref, index: usize| { let output: Val = bevy::math::DMat4::row( @@ -19587,21 +19587,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::DMat4::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::DMat4::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "transpose", |_self: Ref| { let output: Val = bevy::math::DMat4::transpose( @@ -19611,14 +19611,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "determinant", |_self: Ref| { let output: f64 = bevy::math::DMat4::determinant(&_self).into(); output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::DMat4::inverse( @@ -19628,7 +19628,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_lh", | eye: Val, @@ -19644,7 +19644,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_rh", | eye: Val, @@ -19660,7 +19660,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_lh", | eye: Val, @@ -19676,7 +19676,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_rh", | eye: Val, @@ -19692,7 +19692,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_rh_gl", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { let output: Val = bevy::math::DMat4::perspective_rh_gl( @@ -19705,7 +19705,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { let output: Val = bevy::math::DMat4::perspective_lh( @@ -19718,7 +19718,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64, z_far: f64| { let output: Val = bevy::math::DMat4::perspective_rh( @@ -19731,7 +19731,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = bevy::math::DMat4::perspective_infinite_lh( @@ -19743,7 +19743,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_reverse_lh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = bevy::math::DMat4::perspective_infinite_reverse_lh( @@ -19755,7 +19755,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = bevy::math::DMat4::perspective_infinite_rh( @@ -19767,7 +19767,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "perspective_infinite_reverse_rh", |fov_y_radians: f64, aspect_ratio: f64, z_near: f64| { let output: Val = bevy::math::DMat4::perspective_infinite_reverse_rh( @@ -19779,7 +19779,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "orthographic_rh_gl", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { let output: Val = bevy::math::DMat4::orthographic_rh_gl( @@ -19794,7 +19794,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "orthographic_lh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { let output: Val = bevy::math::DMat4::orthographic_lh( @@ -19809,7 +19809,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "orthographic_rh", |left: f64, right: f64, bottom: f64, top: f64, near: f64, far: f64| { let output: Val = bevy::math::DMat4::orthographic_rh( @@ -19824,7 +19824,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "project_point3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat4::project_point3( @@ -19835,7 +19835,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat4::transform_point3( @@ -19846,7 +19846,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat4::transform_vector3( @@ -19857,7 +19857,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec4", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DMat4::mul_vec4( @@ -19868,7 +19868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_mat4", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat4::mul_mat4( @@ -19879,7 +19879,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add_mat4", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat4::add_mat4( @@ -19890,7 +19890,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub_mat4", |_self: Ref, rhs: Ref| { let output: Val = bevy::math::DMat4::sub_mat4( @@ -19901,7 +19901,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_scalar", |_self: Ref, rhs: f64| { let output: Val = bevy::math::DMat4::mul_scalar( @@ -19912,7 +19912,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div_scalar", |_self: Ref, rhs: f64| { let output: Val = bevy::math::DMat4::div_scalar( @@ -19923,7 +19923,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -19939,7 +19939,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs", |_self: Ref| { let output: Val = bevy::math::DMat4::abs(&_self) @@ -19947,7 +19947,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_mat4", |_self: Ref| { let output: Val = bevy::math::DMat4::as_mat4( @@ -19957,7 +19957,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f64| { let output: Val = | { let output: Val = ::neg( @@ -19977,7 +19977,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "add", |_self: Val, rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "from_cols", | x_axis: Val, @@ -20004,7 +20004,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f32; 6] = bevy::math::Affine2::to_cols_array(&_self) @@ -20012,7 +20012,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f32; 2]; 3] = bevy::math::Affine2::to_cols_array_2d( @@ -20022,7 +20022,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::Affine2::from_scale( @@ -20032,7 +20032,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f32| { let output: Val = bevy::math::Affine2::from_angle( @@ -20042,7 +20042,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::Affine2::from_translation( @@ -20052,7 +20052,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2", |matrix2: Val| { let output: Val = bevy::math::Affine2::from_mat2( @@ -20062,7 +20062,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2_translation", |matrix2: Val, translation: Val| { let output: Val = bevy::math::Affine2::from_mat2_translation( @@ -20073,7 +20073,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle_translation", | scale: Val, @@ -20089,7 +20089,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle_translation", |angle: f32, translation: Val| { let output: Val = bevy::math::Affine2::from_angle_translation( @@ -20100,7 +20100,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |m: Val| { let output: Val = bevy::math::Affine2::from_mat3( @@ -20110,7 +20110,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3a", |m: Val| { let output: Val = bevy::math::Affine2::from_mat3a( @@ -20120,7 +20120,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Affine2::transform_point2( @@ -20131,7 +20131,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Affine2::transform_vector2( @@ -20142,21 +20142,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::Affine2::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::Affine2::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -20172,7 +20172,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Affine2::inverse( @@ -20182,7 +20182,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = | { let output: Val = ::clone( @@ -20233,7 +20233,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::Affine3A>::new(world) - .overwrite_script_function( + .register( "from_cols", | x_axis: Val, @@ -20251,7 +20251,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f32; 12] = bevy::math::Affine3A::to_cols_array(&_self) @@ -20259,7 +20259,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f32; 3]; 4] = bevy::math::Affine3A::to_cols_array_2d( @@ -20269,7 +20269,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::Affine3A::from_scale( @@ -20279,7 +20279,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::Affine3A::from_quat( @@ -20289,7 +20289,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f32| { let output: Val = bevy::math::Affine3A::from_axis_angle( @@ -20300,7 +20300,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f32| { let output: Val = bevy::math::Affine3A::from_rotation_x( @@ -20310,7 +20310,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f32| { let output: Val = bevy::math::Affine3A::from_rotation_y( @@ -20320,7 +20320,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f32| { let output: Val = bevy::math::Affine3A::from_rotation_z( @@ -20330,7 +20330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::Affine3A::from_translation( @@ -20340,7 +20340,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |mat3: Val| { let output: Val = bevy::math::Affine3A::from_mat3( @@ -20350,7 +20350,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3_translation", |mat3: Val, translation: Val| { let output: Val = bevy::math::Affine3A::from_mat3_translation( @@ -20361,7 +20361,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_rotation_translation", | scale: Val, @@ -20377,7 +20377,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = bevy::math::Affine3A::from_rotation_translation( @@ -20388,7 +20388,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |m: Val| { let output: Val = bevy::math::Affine3A::from_mat4( @@ -20398,7 +20398,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_lh", | eye: Val, @@ -20414,7 +20414,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_rh", | eye: Val, @@ -20430,7 +20430,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_lh", | eye: Val, @@ -20446,7 +20446,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_rh", | eye: Val, @@ -20462,7 +20462,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Affine3A::transform_point3( @@ -20473,7 +20473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Affine3A::transform_vector3( @@ -20484,7 +20484,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Affine3A::transform_point3a( @@ -20495,7 +20495,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector3a", |_self: Ref, rhs: Val| { let output: Val = bevy::math::Affine3A::transform_vector3a( @@ -20506,21 +20506,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::Affine3A::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::Affine3A::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -20536,7 +20536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::Affine3A::inverse( @@ -20546,7 +20546,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = , rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -20587,7 +20587,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::DAffine2>::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = | { let output: Val = ::clone( @@ -20617,7 +20617,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_cols", | x_axis: Val, @@ -20633,7 +20633,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f64; 6] = bevy::math::DAffine2::to_cols_array(&_self) @@ -20641,7 +20641,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f64; 2]; 3] = bevy::math::DAffine2::to_cols_array_2d( @@ -20651,7 +20651,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::DAffine2::from_scale( @@ -20661,7 +20661,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle", |angle: f64| { let output: Val = bevy::math::DAffine2::from_angle( @@ -20671,7 +20671,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::DAffine2::from_translation( @@ -20681,7 +20681,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2", |matrix2: Val| { let output: Val = bevy::math::DAffine2::from_mat2( @@ -20691,7 +20691,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat2_translation", |matrix2: Val, translation: Val| { let output: Val = bevy::math::DAffine2::from_mat2_translation( @@ -20702,7 +20702,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_angle_translation", | scale: Val, @@ -20718,7 +20718,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_angle_translation", |angle: f64, translation: Val| { let output: Val = bevy::math::DAffine2::from_angle_translation( @@ -20729,7 +20729,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |m: Val| { let output: Val = bevy::math::DAffine2::from_mat3( @@ -20739,7 +20739,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DAffine2::transform_point2( @@ -20750,7 +20750,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector2", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DAffine2::transform_vector2( @@ -20761,21 +20761,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::DAffine2::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::DAffine2::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -20791,7 +20791,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::DAffine2::inverse( @@ -20801,7 +20801,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = | { let output: Val = ::clone( @@ -20832,7 +20832,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = , @@ -20860,7 +20860,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array", |_self: Ref| { let output: [f64; 12] = bevy::math::DAffine3::to_cols_array(&_self) @@ -20868,7 +20868,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_cols_array_2d", |_self: Ref| { let output: [[f64; 3]; 4] = bevy::math::DAffine3::to_cols_array_2d( @@ -20878,7 +20878,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale", |scale: Val| { let output: Val = bevy::math::DAffine3::from_scale( @@ -20888,7 +20888,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_quat", |rotation: Val| { let output: Val = bevy::math::DAffine3::from_quat( @@ -20898,7 +20898,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f64| { let output: Val = bevy::math::DAffine3::from_axis_angle( @@ -20909,7 +20909,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f64| { let output: Val = bevy::math::DAffine3::from_rotation_x( @@ -20919,7 +20919,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f64| { let output: Val = bevy::math::DAffine3::from_rotation_y( @@ -20929,7 +20929,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f64| { let output: Val = bevy::math::DAffine3::from_rotation_z( @@ -20939,7 +20939,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_translation", |translation: Val| { let output: Val = bevy::math::DAffine3::from_translation( @@ -20949,7 +20949,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |mat3: Val| { let output: Val = bevy::math::DAffine3::from_mat3( @@ -20959,7 +20959,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3_translation", |mat3: Val, translation: Val| { let output: Val = bevy::math::DAffine3::from_mat3_translation( @@ -20970,7 +20970,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scale_rotation_translation", | scale: Val, @@ -20986,7 +20986,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_translation", |rotation: Val, translation: Val| { let output: Val = bevy::math::DAffine3::from_rotation_translation( @@ -20997,7 +20997,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |m: Val| { let output: Val = bevy::math::DAffine3::from_mat4( @@ -21007,7 +21007,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_lh", | eye: Val, @@ -21023,7 +21023,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_to_rh", | eye: Val, @@ -21039,7 +21039,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_lh", | eye: Val, @@ -21055,7 +21055,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "look_at_rh", | eye: Val, @@ -21071,7 +21071,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_point3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DAffine3::transform_point3( @@ -21082,7 +21082,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "transform_vector3", |_self: Ref, rhs: Val| { let output: Val = bevy::math::DAffine3::transform_vector3( @@ -21093,21 +21093,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::math::DAffine3::is_finite(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Ref| { let output: bool = bevy::math::DAffine3::is_nan(&_self).into(); output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Ref, @@ -21123,7 +21123,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Ref| { let output: Val = bevy::math::DAffine3::inverse( @@ -21133,7 +21133,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "mul", |_self: Val, rhs: f64| { let output: Val = , rhs: Val| { let output: Val = , rhs: Ref| { let output: bool = | { let output: Val = ::neg( @@ -21184,7 +21184,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -21194,7 +21194,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "div", |_self: Val, rhs: f64| { let output: Val = = bevy::math::DQuat::from_xyzw( @@ -21217,7 +21217,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [f64; 4]| { let output: Val = bevy::math::DQuat::from_array(a) @@ -21225,7 +21225,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_vec4", |v: Val| { let output: Val = bevy::math::DQuat::from_vec4( @@ -21235,7 +21235,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_axis_angle", |axis: Val, angle: f64| { let output: Val = bevy::math::DQuat::from_axis_angle( @@ -21246,7 +21246,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_scaled_axis", |v: Val| { let output: Val = bevy::math::DQuat::from_scaled_axis( @@ -21256,7 +21256,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_x", |angle: f64| { let output: Val = bevy::math::DQuat::from_rotation_x( @@ -21266,7 +21266,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_y", |angle: f64| { let output: Val = bevy::math::DQuat::from_rotation_y( @@ -21276,7 +21276,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_z", |angle: f64| { let output: Val = bevy::math::DQuat::from_rotation_z( @@ -21286,7 +21286,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_euler", |euler: Val, a: f64, b: f64, c: f64| { let output: Val = bevy::math::DQuat::from_euler( @@ -21299,7 +21299,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat3", |mat: Ref| { let output: Val = bevy::math::DQuat::from_mat3( @@ -21309,7 +21309,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_mat4", |mat: Ref| { let output: Val = bevy::math::DQuat::from_mat4( @@ -21319,7 +21319,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_arc", |from: Val, to: Val| { let output: Val = bevy::math::DQuat::from_rotation_arc( @@ -21330,7 +21330,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_arc_colinear", |from: Val, to: Val| { let output: Val = bevy::math::DQuat::from_rotation_arc_colinear( @@ -21341,7 +21341,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_rotation_arc_2d", |from: Val, to: Val| { let output: Val = bevy::math::DQuat::from_rotation_arc_2d( @@ -21352,7 +21352,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_scaled_axis", |_self: Val| { let output: Val = bevy::math::DQuat::to_scaled_axis( @@ -21362,7 +21362,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_euler", |_self: Val, order: Val| { let output: (f64, f64, f64) = bevy::math::DQuat::to_euler( @@ -21373,14 +21373,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_array", |_self: Ref| { let output: [f64; 4] = bevy::math::DQuat::to_array(&_self).into(); output }, ) - .overwrite_script_function( + .register( "xyz", |_self: Val| { let output: Val = bevy::math::DQuat::xyz( @@ -21390,7 +21390,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "conjugate", |_self: Val| { let output: Val = bevy::math::DQuat::conjugate( @@ -21400,7 +21400,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "inverse", |_self: Val| { let output: Val = bevy::math::DQuat::inverse( @@ -21410,7 +21410,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "dot", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DQuat::dot( @@ -21421,7 +21421,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length", |_self: Val| { let output: f64 = bevy::math::DQuat::length(_self.into_inner()) @@ -21429,7 +21429,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_squared", |_self: Val| { let output: f64 = bevy::math::DQuat::length_squared( @@ -21439,7 +21439,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "length_recip", |_self: Val| { let output: f64 = bevy::math::DQuat::length_recip(_self.into_inner()) @@ -21447,7 +21447,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "normalize", |_self: Val| { let output: Val = bevy::math::DQuat::normalize( @@ -21457,7 +21457,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Val| { let output: bool = bevy::math::DQuat::is_finite(_self.into_inner()) @@ -21465,7 +21465,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_nan", |_self: Val| { let output: bool = bevy::math::DQuat::is_nan(_self.into_inner()) @@ -21473,7 +21473,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_normalized", |_self: Val| { let output: bool = bevy::math::DQuat::is_normalized( @@ -21483,7 +21483,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_near_identity", |_self: Val| { let output: bool = bevy::math::DQuat::is_near_identity( @@ -21493,7 +21493,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "angle_between", |_self: Val, rhs: Val| { let output: f64 = bevy::math::DQuat::angle_between( @@ -21504,7 +21504,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_towards", | _self: Ref, @@ -21520,7 +21520,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "abs_diff_eq", | _self: Val, @@ -21536,7 +21536,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "lerp", |_self: Val, end: Val, s: f64| { let output: Val = bevy::math::DQuat::lerp( @@ -21548,7 +21548,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "slerp", |_self: Val, end: Val, s: f64| { let output: Val = bevy::math::DQuat::slerp( @@ -21560,7 +21560,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_vec3", |_self: Val, rhs: Val| { let output: Val = bevy::math::DQuat::mul_vec3( @@ -21571,7 +21571,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_quat", |_self: Val, rhs: Val| { let output: Val = bevy::math::DQuat::mul_quat( @@ -21582,7 +21582,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_affine3", |a: Ref| { let output: Val = bevy::math::DQuat::from_affine3( @@ -21592,7 +21592,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "as_quat", |_self: Val| { let output: Val = bevy::math::DQuat::as_quat( @@ -21602,7 +21602,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "sub", |_self: Val, rhs: Val| { let output: Val = , rhs: Val| { let output: Val = , rhs: Val| { let output: Val = ::new(world) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: () = ::assert_receiver_is_total_eq( @@ -21653,7 +21653,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -21664,7 +21664,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::bevy::math::BVec3A>::new(world) - .overwrite_script_function( + .register( "new", |x: bool, y: bool, z: bool| { let output: Val = bevy::math::BVec3A::new( @@ -21676,7 +21676,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: bool| { let output: Val = bevy::math::BVec3A::splat(v) @@ -21684,7 +21684,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [bool; 3]| { let output: Val = bevy::math::BVec3A::from_array( @@ -21694,7 +21694,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "bitmask", |_self: Val| { let output: u32 = bevy::math::BVec3A::bitmask(_self.into_inner()) @@ -21702,7 +21702,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any", |_self: Val| { let output: bool = bevy::math::BVec3A::any(_self.into_inner()) @@ -21710,7 +21710,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "all", |_self: Val| { let output: bool = bevy::math::BVec3A::all(_self.into_inner()) @@ -21718,14 +21718,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "test", |_self: Ref, index: usize| { let output: bool = bevy::math::BVec3A::test(&_self, index).into(); output }, ) - .overwrite_script_function( + .register( "set", |mut _self: Mut, index: usize, value: bool| { let output: () = bevy::math::BVec3A::set(&mut _self, index, value) @@ -21733,7 +21733,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -21743,7 +21743,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -21764,7 +21764,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", |x: bool, y: bool, z: bool, w: bool| { let output: Val = bevy::math::BVec4A::new( @@ -21777,7 +21777,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "splat", |v: bool| { let output: Val = bevy::math::BVec4A::splat(v) @@ -21785,7 +21785,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_array", |a: [bool; 4]| { let output: Val = bevy::math::BVec4A::from_array( @@ -21795,7 +21795,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "bitmask", |_self: Val| { let output: u32 = bevy::math::BVec4A::bitmask(_self.into_inner()) @@ -21803,7 +21803,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "any", |_self: Val| { let output: bool = bevy::math::BVec4A::any(_self.into_inner()) @@ -21811,7 +21811,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "all", |_self: Val| { let output: bool = bevy::math::BVec4A::all(_self.into_inner()) @@ -21819,14 +21819,14 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "test", |_self: Ref, index: usize| { let output: bool = bevy::math::BVec4A::test(&_self, index).into(); output }, ) - .overwrite_script_function( + .register( "set", |mut _self: Mut, index: usize, value: bool| { let output: () = bevy::math::BVec4A::set(&mut _self, index, value) @@ -21834,7 +21834,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, rhs: Ref| { let output: bool = ::new(world) - .overwrite_script_function( + .register( "to_string", |_self: Ref| { let output: std::string::String = smol_str::SmolStr::to_string( @@ -21855,21 +21855,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "len", |_self: Ref| { let output: usize = smol_str::SmolStr::len(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_empty", |_self: Ref| { let output: bool = smol_str::SmolStr::is_empty(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_heap_allocated", |_self: Ref| { let output: bool = smol_str::SmolStr::is_heap_allocated(&_self) @@ -21877,7 +21877,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: Val = ::clone( @@ -21898,35 +21898,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { }, ); NamespaceBuilder::<::uuid::Uuid>::new(world) - .overwrite_script_function( + .register( "nil", || { let output: Val = uuid::Uuid::nil().into(); output }, ) - .overwrite_script_function( + .register( "max", || { let output: Val = uuid::Uuid::max().into(); output }, ) - .overwrite_script_function( + .register( "from_u128", |v: u128| { let output: Val = uuid::Uuid::from_u128(v).into(); output }, ) - .overwrite_script_function( + .register( "from_u128_le", |v: u128| { let output: Val = uuid::Uuid::from_u128_le(v).into(); output }, ) - .overwrite_script_function( + .register( "from_u64_pair", |high_bits: u64, low_bits: u64| { let output: Val = uuid::Uuid::from_u64_pair( @@ -21937,21 +21937,21 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_bytes", |bytes: [u8; 16]| { let output: Val = uuid::Uuid::from_bytes(bytes).into(); output }, ) - .overwrite_script_function( + .register( "from_bytes_le", |b: [u8; 16]| { let output: Val = uuid::Uuid::from_bytes_le(b).into(); output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -21961,35 +21961,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "get_version_num", |_self: Ref| { let output: usize = uuid::Uuid::get_version_num(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_u128", |_self: Ref| { let output: u128 = uuid::Uuid::as_u128(&_self).into(); output }, ) - .overwrite_script_function( + .register( "to_u128_le", |_self: Ref| { let output: u128 = uuid::Uuid::to_u128_le(&_self).into(); output }, ) - .overwrite_script_function( + .register( "as_u64_pair", |_self: Ref| { let output: (u64, u64) = uuid::Uuid::as_u64_pair(&_self).into(); output }, ) - .overwrite_script_function( + .register( "into_bytes", |_self: Val| { let output: [u8; 16] = uuid::Uuid::into_bytes(_self.into_inner()) @@ -21997,35 +21997,35 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "to_bytes_le", |_self: Ref| { let output: [u8; 16] = uuid::Uuid::to_bytes_le(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_nil", |_self: Ref| { let output: bool = uuid::Uuid::is_nil(&_self).into(); output }, ) - .overwrite_script_function( + .register( "is_max", |_self: Ref| { let output: bool = uuid::Uuid::is_max(&_self).into(); output }, ) - .overwrite_script_function( + .register( "encode_buffer", || { let output: [u8; 45] = uuid::Uuid::encode_buffer().into(); output }, ) - .overwrite_script_function( + .register( "get_node_id", |_self: Ref| { let output: bevy::reflect::erased_serde::__private::serde::__private::Option< @@ -22034,7 +22034,7 @@ impl ::bevy::app::Plugin for BevyReflectScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = = uuid::Uuid::new_v4().into(); output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs index ecbed790e0..b3234e16ec 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_time.rs @@ -14,7 +14,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::time::prelude::Fixed>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -25,7 +25,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { }, ); NamespaceBuilder::<::bevy::time::prelude::Real>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -36,7 +36,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { }, ); NamespaceBuilder::<::bevy::time::prelude::Timer>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -46,7 +46,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_seconds", |duration: f32, mode: Val| { let output: Val = bevy::time::prelude::Timer::from_seconds( @@ -57,7 +57,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "finished", |_self: Ref| { let output: bool = bevy::time::prelude::Timer::finished(&_self) @@ -65,7 +65,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "just_finished", |_self: Ref| { let output: bool = bevy::time::prelude::Timer::just_finished(&_self) @@ -73,7 +73,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "elapsed_secs", |_self: Ref| { let output: f32 = bevy::time::prelude::Timer::elapsed_secs(&_self) @@ -81,7 +81,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "elapsed_secs_f64", |_self: Ref| { let output: f64 = bevy::time::prelude::Timer::elapsed_secs_f64( @@ -91,7 +91,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mode", |_self: Ref| { let output: Val = bevy::time::prelude::Timer::mode( @@ -101,7 +101,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "set_mode", | mut _self: Mut, @@ -115,7 +115,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "pause", |mut _self: Mut| { let output: () = bevy::time::prelude::Timer::pause(&mut _self) @@ -123,7 +123,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "unpause", |mut _self: Mut| { let output: () = bevy::time::prelude::Timer::unpause(&mut _self) @@ -131,14 +131,14 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "paused", |_self: Ref| { let output: bool = bevy::time::prelude::Timer::paused(&_self).into(); output }, ) - .overwrite_script_function( + .register( "reset", |mut _self: Mut| { let output: () = bevy::time::prelude::Timer::reset(&mut _self) @@ -146,7 +146,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fraction", |_self: Ref| { let output: f32 = bevy::time::prelude::Timer::fraction(&_self) @@ -154,7 +154,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "fraction_remaining", |_self: Ref| { let output: f32 = bevy::time::prelude::Timer::fraction_remaining( @@ -164,7 +164,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "remaining_secs", |_self: Ref| { let output: f32 = bevy::time::prelude::Timer::remaining_secs(&_self) @@ -172,7 +172,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "times_finished_this_tick", |_self: Ref| { let output: u32 = bevy::time::prelude::Timer::times_finished_this_tick( @@ -182,7 +182,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -192,7 +192,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -206,7 +206,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { }, ); NamespaceBuilder::<::bevy::time::prelude::TimerMode>::new(world) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -219,7 +219,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -229,7 +229,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -240,7 +240,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { }, ); NamespaceBuilder::<::bevy::time::prelude::Virtual>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -251,7 +251,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { }, ); NamespaceBuilder::<::bevy::time::Stopwatch>::new(world) - .overwrite_script_function( + .register( "assert_receiver_is_total_eq", |_self: Ref| { let output: () = ::assert_receiver_is_total_eq( @@ -261,7 +261,7 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "new", || { let output: Val = bevy::time::Stopwatch::new() @@ -269,14 +269,14 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "elapsed_secs", |_self: Ref| { let output: f32 = bevy::time::Stopwatch::elapsed_secs(&_self).into(); output }, ) - .overwrite_script_function( + .register( "elapsed_secs_f64", |_self: Ref| { let output: f64 = bevy::time::Stopwatch::elapsed_secs_f64(&_self) @@ -284,35 +284,35 @@ impl ::bevy::app::Plugin for BevyTimeScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "pause", |mut _self: Mut| { let output: () = bevy::time::Stopwatch::pause(&mut _self).into(); output }, ) - .overwrite_script_function( + .register( "unpause", |mut _self: Mut| { let output: () = bevy::time::Stopwatch::unpause(&mut _self).into(); output }, ) - .overwrite_script_function( + .register( "is_paused", |_self: Ref| { let output: bool = bevy::time::Stopwatch::is_paused(&_self).into(); output }, ) - .overwrite_script_function( + .register( "reset", |mut _self: Mut| { let output: () = bevy::time::Stopwatch::reset(&mut _self).into(); output }, ) - .overwrite_script_function( + .register( "eq", |_self: Ref, other: Ref| { let output: bool = | { let output: Val = ::clone( diff --git a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs index 5f675b030d..5fc7357eeb 100644 --- a/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs +++ b/crates/bevy_mod_scripting_functions/src/bevy_bindings/bevy_transform.rs @@ -17,7 +17,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { fn build(&self, app: &mut ::bevy::prelude::App) { let mut world = app.world_mut(); NamespaceBuilder::<::bevy::transform::components::GlobalTransform>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -27,7 +27,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -40,7 +40,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xyz", |x: f32, y: f32, z: f32| { let output: Val = bevy::transform::components::GlobalTransform::from_xyz( @@ -52,7 +52,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "compute_transform", |_self: Ref| { let output: Val = bevy::transform::components::GlobalTransform::compute_transform( @@ -62,7 +62,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "reparented_to", | _self: Ref, @@ -76,7 +76,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_transform", | _self: Ref, @@ -90,7 +90,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", | _self: Val, @@ -103,7 +103,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", | _self: Val, @@ -117,7 +117,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { }, ); NamespaceBuilder::<::bevy::transform::components::Transform>::new(world) - .overwrite_script_function( + .register( "clone", |_self: Ref| { let output: Val = ::clone( @@ -127,7 +127,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "eq", | _self: Ref, @@ -140,7 +140,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", | _self: Val, @@ -153,7 +153,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "from_xyz", |x: f32, y: f32, z: f32| { let output: Val = bevy::transform::components::Transform::from_xyz( @@ -165,7 +165,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_x", |mut _self: Mut, angle: f32| { let output: () = bevy::transform::components::Transform::rotate_x( @@ -176,7 +176,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_y", |mut _self: Mut, angle: f32| { let output: () = bevy::transform::components::Transform::rotate_y( @@ -187,7 +187,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_z", |mut _self: Mut, angle: f32| { let output: () = bevy::transform::components::Transform::rotate_z( @@ -198,7 +198,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_local_x", |mut _self: Mut, angle: f32| { let output: () = bevy::transform::components::Transform::rotate_local_x( @@ -209,7 +209,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_local_y", |mut _self: Mut, angle: f32| { let output: () = bevy::transform::components::Transform::rotate_local_y( @@ -220,7 +220,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "rotate_local_z", |mut _self: Mut, angle: f32| { let output: () = bevy::transform::components::Transform::rotate_local_z( @@ -231,7 +231,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul_transform", | _self: Ref, @@ -245,7 +245,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "is_finite", |_self: Ref| { let output: bool = bevy::transform::components::Transform::is_finite( @@ -255,7 +255,7 @@ impl ::bevy::app::Plugin for BevyTransformScriptingPlugin { output }, ) - .overwrite_script_function( + .register( "mul", | _self: Val, From 4f20f1258dd8c460bb4a5b615ba43b3e0a1c8cad Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 02:08:09 +0000 Subject: [PATCH 130/217] fix conversion --- .../src/bindings/function/mod.rs | 54 ++++--------------- .../src/bindings/function/script_function.rs | 21 ++++++-- crates/bevy_mod_scripting_core/src/error.rs | 7 +-- .../src/bindings/reference.rs | 19 ++++--- 4 files changed, 38 insertions(+), 63 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index 519485d6aa..ba57d279d6 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -13,7 +13,7 @@ use bevy::reflect::{ }, PartialReflect, }; -use script_function::CallerContext; +use script_function::{CallerContext, DynamicScriptFunction}; use crate::{ error::{FlattenError, InteropError, InteropErrorInner, ScriptError, ScriptResult}, @@ -37,56 +37,20 @@ pub trait CallScriptFunction { ) -> Result; } -impl CallScriptFunction for DynamicFunction<'_> { +impl CallScriptFunction for DynamicScriptFunction { fn call_script_function>( &self, args: I, world: WorldGuard, context: CallerContext, ) -> Result { - let args = args.into_iter(); - - let add_context = self.is_script_function(); - let mut args_list = ArgList::new(); - - if add_context { - args_list = args_list.push_arg(ArgValue::Owned(Box::new(context))); - args_list = args_list.push_arg(ArgValue::Owned(Box::new( - WorldCallbackAccess::from_guard(world.clone()), - ))); - } - - for arg in args { - let arg_val = ArgValue::Owned(Box::new(arg)); - args_list = args_list.push_arg(arg_val); + let args = args.into_iter().collect::>(); + let world_callback_access = WorldCallbackAccess::from_guard(world.clone()); + // should we be inlining call errors into the return value? + let return_val = self.call(context, world_callback_access, args); + match return_val { + ScriptValue::Error(e) => Err(InteropError::function_interop_error(self.name(), e)), + v => Ok(v), } - - let return_val = self - .call(args_list) - .map_err(InteropError::function_call_error)?; - - match return_val.try_into_or_boxed::() { - Ok(ScriptValue::Error(e)) => Err(InteropError::function_interop_error(self.info(), e)), - Ok(v) => Ok(v), - Err(b) => { - let allocator = world.allocator(); - let mut allocator = allocator.write(); - - Ok(ReflectReference::new_allocated_boxed(b, &mut allocator).into()) - } - } - } -} - -pub trait DynamicFunctionExt { - fn is_script_function(&self) -> bool; -} - -impl DynamicFunctionExt for DynamicFunction<'_> { - fn is_script_function(&self) -> bool { - self.info().args().first().map_or(false, |arg| { - arg.type_id() == std::any::TypeId::of::() - || arg.type_id() == std::any::TypeId::of::() - }) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 01d95e0655..48403734a4 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -117,14 +117,29 @@ pub struct CallerContext { /// The Script Function equivalent for dynamic functions. Currently unused #[derive(Clone)] pub struct DynamicScriptFunction { + name: Cow<'static, str>, // TODO: info about the function, this is hard right now because of non 'static lifetimes in wrappers, we can't use TypePath etc - pub func: Arc< + func: Arc< dyn Fn(CallerContext, WorldCallbackAccess, Vec) -> ScriptValue + Send + Sync + 'static, >, } +impl DynamicScriptFunction { + pub fn call( + &self, + context: CallerContext, + world: WorldCallbackAccess, + args: Vec, + ) -> ScriptValue { + (self.func)(context, world, args) + } + + pub fn name(&self) -> &Cow<'static, str> { + &self.name + } +} impl std::fmt::Debug for DynamicScriptFunction { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -274,7 +289,7 @@ macro_rules! impl_script_function { fn into_dynamic_script_function(self) -> DynamicScriptFunction { let func = (move |caller_context: CallerContext, world: WorldCallbackAccess, args: Vec | { let res: Result = (|| { - let expected_arg_count = count!($($param),*); + let expected_arg_count = count!($($param )*); if args.len() != expected_arg_count { return Err(InteropError::function_call_error(FunctionError::ArgCountMismatch{ expected: expected_arg_count, @@ -308,7 +323,7 @@ macro_rules! impl_script_function { script_value }); - DynamicScriptFunction { func: Arc::new(func) } + DynamicScriptFunction { func: Arc::new(func), name: core::any::type_name::().into() } } } }; diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index a4a9e4eecc..c550eecceb 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -351,12 +351,9 @@ impl InteropError { } /// Thrown when an error happens in a function call. The inner error provides details on the error. - pub fn function_interop_error(function_info: &FunctionInfo, error: InteropError) -> Self { + pub fn function_interop_error(function_name: &str, error: InteropError) -> Self { Self(Arc::new(InteropErrorInner::FunctionInteropError { - function_name: function_info - .name() - .map(|s| s.to_string()) - .unwrap_or("".to_owned()), + function_name: function_name.to_string(), error, })) } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 11f5aca24f..a4c73e6c94 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -16,7 +16,10 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - function::{script_function::CallerContext, CallScriptFunction}, + function::{ + script_function::{AppScriptFunctionRegistry, CallerContext, DynamicScriptFunction}, + CallScriptFunction, + }, pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, script_value::ScriptValue, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, @@ -91,14 +94,10 @@ fn lookup_function_typed( lookup_function(lua, key, type_id) } -fn lookup_dynamic_function<'lua>( - lua: &'lua Lua, - key: &str, - type_id: TypeId, -) -> Option> { +fn lookup_dynamic_function(lua: &Lua, key: &str, type_id: TypeId) -> Option { let function_registry = lua .get_world() - .with_resource(|registry: &AppFunctionRegistry| registry.clone()); + .with_resource(|registry: &AppScriptFunctionRegistry| registry.clone()); let registry = function_registry.read(); registry @@ -106,10 +105,10 @@ fn lookup_dynamic_function<'lua>( .cloned() } -fn lookup_dynamic_function_typed<'lua, T: 'static + ?Sized>( - lua: &'lua Lua, +fn lookup_dynamic_function_typed( + lua: &Lua, key: &str, -) -> Option> { +) -> Option { let type_id = TypeId::of::(); lookup_dynamic_function(lua, key, type_id) } From 0f46de622f415b4b8d717607c5ec573c21beb0ae Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 02:56:53 +0000 Subject: [PATCH 131/217] make overloading work for subtraction --- .../src/bindings/function/script_function.rs | 9 +++- .../src/namespaced_register.rs | 44 +++++++++++++---- .../src/bindings/reference.rs | 48 +++++++++++++++++++ .../tests/data/sub/vec3.lua | 13 +++++ 4 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/sub/vec3.lua diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 48403734a4..f8bd7ed2f1 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -139,6 +139,13 @@ impl DynamicScriptFunction { pub fn name(&self) -> &Cow<'static, str> { &self.name } + + pub fn with_name>>(self, name: N) -> Self { + Self { + name: name.into(), + func: self.func, + } + } } impl std::fmt::Debug for DynamicScriptFunction { @@ -201,7 +208,7 @@ impl ScriptFunctionRegistry { let name = name.into().clone(); if !self.contains(&name) { - let func = func.into_dynamic_script_function(); + let func = func.into_dynamic_script_function().with_name(name.clone()); self.functions.insert(name, func); return; } diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 1912ee70c8..708bfd9d15 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -1,11 +1,12 @@ use std::{any::TypeId, borrow::Cow, marker::PhantomData}; use bevy::{ - prelude::{AppFunctionRegistry, IntoFunction, World}, + prelude::{AppFunctionRegistry, AppTypeRegistry, IntoFunction, World}, reflect::func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, }; use bevy_mod_scripting_core::bindings::function::script_function::{ - AppScriptFunctionRegistry, DynamicScriptFunction, ScriptFunction, ScriptFunctionRegistry, + AppScriptFunctionRegistry, DynamicScriptFunction, GetFunctionTypeDependencies, ScriptFunction, + ScriptFunctionRegistry, }; pub trait RegisterNamespacedFunction { @@ -17,6 +18,13 @@ pub trait RegisterNamespacedFunction { } pub trait GetNamespacedFunction { + fn iter_overloads_namespaced( + &self, + name: N, + namespace: Namespace, + ) -> impl Iterator + where + N: Into>; fn get_namespaced_function( &self, name: N, @@ -78,6 +86,19 @@ impl RegisterNamespacedFunction for ScriptFunctionRegistry { } impl GetNamespacedFunction for ScriptFunctionRegistry { + fn iter_overloads_namespaced( + &self, + name: N, + namespace: Namespace, + ) -> impl Iterator + where + N: Into>, + { + let cow: Cow<'static, str> = name.into(); + let function_name = namespace.function_name(cow); + self.iter_overloads(function_name) + } + fn get_namespaced_function( &self, name: N, @@ -117,14 +138,21 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { pub fn register(&mut self, name: N, function: F) -> &mut Self where N: Into>, - F: ScriptFunction<'static, M>, + F: ScriptFunction<'static, M> + GetFunctionTypeDependencies, { { - let mut registry = self - .world - .get_resource_or_init::(); - let mut registry = registry.write(); - registry.register_namespaced_function::(name, function); + { + let mut registry = self + .world + .get_resource_or_init::(); + let mut registry = registry.write(); + registry.register_namespaced_function::(name, function); + } + { + let mut type_registry = self.world.get_resource_or_init::(); + let mut type_registry = type_registry.write(); + F::register_type_dependencies(&mut type_registry); + } } self } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index a4c73e6c94..02b2d44819 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -113,6 +113,23 @@ fn lookup_dynamic_function_typed( lookup_dynamic_function(lua, key, type_id) } +fn iter_dynamic_function_overloads( + lua: &Lua, + key: &str, + type_id: TypeId, +) -> impl Iterator { + let registry = lua + .get_world() + .with_resource(|registry: &AppScriptFunctionRegistry| registry.clone()); + let registry = registry.read(); + + registry + .iter_overloads_namespaced(key.to_string(), Namespace::OnType(type_id)) + .cloned() + .collect::>() + .into_iter() +} + impl UserData for LuaReflectReference { fn add_methods>(m: &mut T) { m.add_meta_function( @@ -167,6 +184,37 @@ impl UserData for LuaReflectReference { }, ); + m.add_meta_function( + MetaMethod::Sub, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + + let overloads = iter_dynamic_function_overloads(lua, "sub", target_type_id); + let mut last_error = None; + let call_args = vec![ScriptValue::Reference(self_), other]; + for overload in overloads { + match overload.call_script_function( + call_args.clone(), + world.clone(), + lua_caller_context(), + ) { + Ok(out) => return LuaScriptValue::from(out).into_lua(lua), + Err(e) => last_error = Some(e), + } + } + + Err(last_error + .unwrap_or_else(|| { + InteropError::missing_function(target_type_id, "sub".to_string()).into() + }) + .into()) + }, + ); + // #[cfg(any( // feature = "lua54", // feature = "lua53", diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/sub/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/sub/vec3.lua new file mode 100644 index 0000000000..9c73298742 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/sub/vec3.lua @@ -0,0 +1,13 @@ + + +local a = Vec3.new(1.0, 2.0, 3.0) +local b = Vec3.new(4.0, 5.0, 6.0) + + +assert((a - 1).x == 0.0, "Subtraction did not work") +assert((a - 1).y == 1.0, "Subtraction did not work") +assert((a - 1).z == 2.0, "Subtraction did not work") + +assert((a - b).x == -3.0, "Subtraction did not work") +assert((a - b).y == -3.0, "Subtraction did not work") +assert((a - b).z == -3.0, "Subtraction did not work") \ No newline at end of file From 6540642d78daca0f670b94660fb9d8535694d7a9 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 03:24:00 +0000 Subject: [PATCH 132/217] fill in all the other operators in lua --- .../src/bindings/reference.rs | 132 +++++++++++++++--- .../tests/data/add/vec3.lua | 11 ++ .../tests/data/div/vec3.lua | 10 ++ .../tests/data/eq/vec3.lua | 7 + .../tests/data/mod/vec3.lua | 10 ++ .../tests/data/mul/vec3.lua | 10 ++ .../tests/data/unm/vec3.lua | 5 + 7 files changed, 166 insertions(+), 19 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/add/vec3.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/div/vec3.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/eq/vec3.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/mod/vec3.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/mul/vec3.lua create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/unm/vec3.lua diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 02b2d44819..8aebaa24f0 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -23,7 +23,7 @@ use bevy_mod_scripting_core::{ pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, script_value::ScriptValue, ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, - WorldCallbackAccess, + WorldCallbackAccess, WorldGuard, }, error::{InteropError, ScriptError, ScriptResult}, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, @@ -130,6 +130,27 @@ fn iter_dynamic_function_overloads( .into_iter() } +fn try_call_overloads( + lua: &Lua, + key: &str, + type_id: TypeId, + args: Vec, + world: WorldGuard, +) -> Result { + let overloads = iter_dynamic_function_overloads(lua, key, type_id); + let mut last_error = None; + for overload in overloads { + match overload.call_script_function(args.clone(), world.clone(), lua_caller_context()) { + Ok(out) => return Ok(out.into()), + Err(e) => last_error = Some(e), + } + } + + Err(last_error + .unwrap_or_else(|| InteropError::missing_function(type_id, key.to_string()).into()) + .into()) +} + impl UserData for LuaReflectReference { fn add_methods>(m: &mut T) { m.add_meta_function( @@ -190,28 +211,101 @@ impl UserData for LuaReflectReference { let world = lua.get_world(); let self_: ReflectReference = self_.into(); let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "sub", target_type_id, args, world)?) + }, + ); + m.add_meta_function( + MetaMethod::Add, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "add", target_type_id, args, world)?) + }, + ); - let overloads = iter_dynamic_function_overloads(lua, "sub", target_type_id); - let mut last_error = None; - let call_args = vec![ScriptValue::Reference(self_), other]; - for overload in overloads { - match overload.call_script_function( - call_args.clone(), - world.clone(), - lua_caller_context(), - ) { - Ok(out) => return LuaScriptValue::from(out).into_lua(lua), - Err(e) => last_error = Some(e), - } - } + m.add_meta_function( + MetaMethod::Mul, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "mul", target_type_id, args, world)?) + }, + ); + + m.add_meta_function( + MetaMethod::Div, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "div", target_type_id, args, world)?) + }, + ); - Err(last_error - .unwrap_or_else(|| { - InteropError::missing_function(target_type_id, "sub".to_string()).into() - }) - .into()) + m.add_meta_function( + MetaMethod::Mod, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "rem", target_type_id, args, world)?) + }, + ); + + m.add_meta_function(MetaMethod::Unm, |lua, self_: LuaReflectReference| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_)]; + Ok(try_call_overloads(lua, "neg", target_type_id, args, world)?) + }); + + m.add_meta_function( + MetaMethod::Pow, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "pow", target_type_id, args, world)?) + }, + ); + + m.add_meta_function( + MetaMethod::Eq, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "eq", target_type_id, args, world)?) + }, + ); + + m.add_meta_function( + MetaMethod::Lt, + |lua, (self_, other): (LuaReflectReference, LuaScriptValue)| { + let world = lua.get_world(); + let self_: ReflectReference = self_.into(); + let other: ScriptValue = other.into(); + let target_type_id = self_.tail_type_id(world.clone())?.or_fake_id(); + let args = vec![ScriptValue::Reference(self_), other]; + Ok(try_call_overloads(lua, "lt", target_type_id, args, world)?) }, ); diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/add/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/add/vec3.lua new file mode 100644 index 0000000000..7374655b85 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/add/vec3.lua @@ -0,0 +1,11 @@ +local a = Vec3.new(1.0, 2.0, 3.0) +local b = Vec3.new(4.0, 5.0, 6.0) + +assert((a + 1).x == 2.0, "Addition did not work") +assert((a + 1).y == 3.0, "Addition did not work") +assert((a + 1).z == 4.0, "Addition did not work") + +assert((a + b).x == 5.0, "Addition did not work") +assert((a + b).y == 7.0, "Addition did not work") +assert((a + b).z == 9.0, "Addition did not work") + diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/div/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/div/vec3.lua new file mode 100644 index 0000000000..2e08c9ac7e --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/div/vec3.lua @@ -0,0 +1,10 @@ +local a = Vec3.new(2.0, 4.0, 6.0) +local b = Vec3.new(1.0, 2.0, 3.0) + +assert((a / 2).x == 1.0, "Division did not work") +assert((a / 2).y == 2.0, "Division did not work") +assert((a / 2).z == 3.0, "Division did not work") + +assert((a / b).x == 2.0, "Division did not work") +assert((a / b).y == 2.0, "Division did not work") +assert((a / b).z == 2.0, "Division did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/eq/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/eq/vec3.lua new file mode 100644 index 0000000000..ffd43bf81c --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/eq/vec3.lua @@ -0,0 +1,7 @@ +local a = Vec3.new(2.0, -4.0, 6.0) +local b = Vec3.new(4.0, 5.0, 6.0) + + +assert((a == b) == false, "Equality did not work") +assert((a ~= b) == true, "Inequality did not work") +assert((a == a) == true, "Equality did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/mod/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/mod/vec3.lua new file mode 100644 index 0000000000..69dc8d9668 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/mod/vec3.lua @@ -0,0 +1,10 @@ +local a = Vec3.new(2.0, 5.0, 6.0) +local b = Vec3.new(1.0, 2.0, 3.0) + +assert((a % 2).x == 0.0, "Modulus did not work") +assert((a % 2).y == 1.0, "Modulus did not work") +assert((a % 2).z == 0.0, "Modulus did not work") + +assert((a % b).x == 0.0, "Modulus did not work") +assert((a % b).y == 1.0, "Modulus did not work") +assert((a % b).z == 0.0, "Modulus did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/mul/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/mul/vec3.lua new file mode 100644 index 0000000000..f5b64fe128 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/mul/vec3.lua @@ -0,0 +1,10 @@ +local a = Vec3.new(1.0, 2.0, 3.0) +local b = Vec3.new(4.0, 5.0, 6.0) + +assert((a * 2).x == 2.0, "Multiplication did not work") +assert((a * 2).y == 4.0, "Multiplication did not work") +assert((a * 2).z == 6.0, "Multiplication did not work") + +assert((a * b).x == 4.0, "Multiplication did not work") +assert((a * b).y == 10.0, "Multiplication did not work") +assert((a * b).z == 18.0, "Multiplication did not work") \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/unm/vec3.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/unm/vec3.lua new file mode 100644 index 0000000000..668d8fa602 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/unm/vec3.lua @@ -0,0 +1,5 @@ +local a = Vec3.new(2.0, -4.0, 6.0) + +assert(-a.x == -2.0, "Negation did not work") +assert(-a.y == 4.0, "Negation did not work") +assert(-a.z == -6.0, "Negation did not work") \ No newline at end of file From 5848e6f1c472ceaf2674076d74c73b274b647de0 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 17:25:53 +0000 Subject: [PATCH 133/217] implement iterators, and add function passing --- .../src/bindings/function/into.rs | 14 +- .../src/bindings/function/mod.rs | 24 ++- .../src/bindings/function/script_function.rs | 164 +++++++++++++++--- .../src/bindings/pretty_print.rs | 1 + .../src/bindings/script_value/mod.rs | 15 +- .../bevy_mod_scripting_functions/src/core.rs | 29 +++- .../src/bindings/reference.rs | 29 ++-- .../src/bindings/script_value.rs | 28 ++- .../tests/data/iter/vec.lua | 13 ++ 9 files changed, 267 insertions(+), 50 deletions(-) create mode 100644 crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index 704e748c0e..ef96128ac5 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -13,7 +13,10 @@ use crate::{ self_type_dependency_only, }; -use super::from::Val; +use super::{ + from::Val, + script_function::{DynamicScriptFunction, DynamicScriptFunctionMut}, +}; pub trait IntoScript { fn into_script(self, world: WorldGuard) -> Result; @@ -32,9 +35,16 @@ impl IntoScript for () { Ok(ScriptValue::Unit) } } - self_type_dependency_only!(()); +impl IntoScript for DynamicScriptFunctionMut { + fn into_script(self, _world: WorldGuard) -> Result { + Ok(ScriptValue::Function(self)) + } +} + +self_type_dependency_only!(DynamicScriptFunctionMut, DynamicScriptFunction); + impl IntoScript for bool { fn into_script(self, _world: WorldGuard) -> Result { Ok(ScriptValue::Bool(self)) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index ba57d279d6..dab27e7d8d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -13,7 +13,7 @@ use bevy::reflect::{ }, PartialReflect, }; -use script_function::{CallerContext, DynamicScriptFunction}; +use script_function::{CallerContext, DynamicScriptFunction, DynamicScriptFunctionMut}; use crate::{ error::{FlattenError, InteropError, InteropErrorInner, ScriptError, ScriptResult}, @@ -30,7 +30,7 @@ use super::{ /// The claim and release functions must be used to scope the access to the world such that function output . pub trait CallScriptFunction { fn call_script_function>( - &self, + &mut self, args: I, world: WorldGuard, context: CallerContext, @@ -39,7 +39,25 @@ pub trait CallScriptFunction { impl CallScriptFunction for DynamicScriptFunction { fn call_script_function>( - &self, + &mut self, + args: I, + world: WorldGuard, + context: CallerContext, + ) -> Result { + let args = args.into_iter().collect::>(); + let world_callback_access = WorldCallbackAccess::from_guard(world.clone()); + // should we be inlining call errors into the return value? + let return_val = self.call(context, world_callback_access, args); + match return_val { + ScriptValue::Error(e) => Err(InteropError::function_interop_error(self.name(), e)), + v => Ok(v), + } + } +} + +impl CallScriptFunction for DynamicScriptFunctionMut { + fn call_script_function>( + &mut self, args: I, world: WorldGuard, context: CallerContext, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index f8bd7ed2f1..1077c0a18f 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -30,6 +30,14 @@ pub trait ScriptFunction<'env, Marker> { fn into_dynamic_script_function(self) -> DynamicScriptFunction; } +#[diagnostic::on_unimplemented( + message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. Registering functions also requires they implement GetInnerTypeDependencies", + note = "If you're trying to return a non-primitive type, you might need to use Val Ref or Mut wrappers" +)] +pub trait ScriptFunctionMut<'env, Marker> { + fn into_dynamic_script_function_mut(self) -> DynamicScriptFunctionMut; +} + /// Functionally identical to [`GetTypeRegistration`] but without the 'static bound pub trait GetInnerTypeDependencies { fn register_type_dependencies(registry: &mut TypeRegistry); @@ -39,8 +47,8 @@ pub trait GetInnerTypeDependencies { macro_rules! no_type_dependencies { ($($path:path),*) => { $( - impl GetInnerTypeDependencies for $path { - fn register_type_dependencies(_registry: &mut TypeRegistry) {} + impl $crate::bindings::function::script_function::GetInnerTypeDependencies for $path { + fn register_type_dependencies(_registry: &mut bevy::reflect::TypeRegistry) {} } )* }; @@ -115,7 +123,8 @@ pub struct CallerContext { } /// The Script Function equivalent for dynamic functions. Currently unused -#[derive(Clone)] +#[derive(Clone, Reflect)] +#[reflect(opaque)] pub struct DynamicScriptFunction { name: Cow<'static, str>, // TODO: info about the function, this is hard right now because of non 'static lifetimes in wrappers, we can't use TypePath etc @@ -126,6 +135,34 @@ pub struct DynamicScriptFunction { + 'static, >, } + +impl PartialEq for DynamicScriptFunction { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + } +} + +#[derive(Clone, Reflect)] +#[reflect(opaque)] +pub struct DynamicScriptFunctionMut { + name: Cow<'static, str>, + func: Arc< + RwLock< + // I'd rather consume an option or something instead of having the RWLock but I just wanna get this release out + dyn FnMut(CallerContext, WorldCallbackAccess, Vec) -> ScriptValue + + Send + + Sync + + 'static, + >, + >, +} + +impl PartialEq for DynamicScriptFunctionMut { + fn eq(&self, other: &Self) -> bool { + self.name == other.name + } +} + impl DynamicScriptFunction { pub fn call( &self, @@ -148,9 +185,72 @@ impl DynamicScriptFunction { } } +impl DynamicScriptFunctionMut { + pub fn call( + &mut self, + context: CallerContext, + world: WorldCallbackAccess, + args: Vec, + ) -> ScriptValue { + let mut write = self.func.write(); + write(context, world, args) + } + + pub fn name(&self) -> &Cow<'static, str> { + &self.name + } + + pub fn with_name>>(self, name: N) -> Self { + Self { + name: name.into(), + func: self.func, + } + } +} + impl std::fmt::Debug for DynamicScriptFunction { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("DynamicScriptFunction").finish() + f.debug_struct("DynamicScriptFunction") + .field("name", self.name()) + .finish() + } +} + +impl std::fmt::Debug for DynamicScriptFunctionMut { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("DynamicScriptFunctionMut") + .field("name", self.name()) + .finish() + } +} + +impl From for DynamicScriptFunction +where + F: Fn(CallerContext, WorldCallbackAccess, Vec) -> ScriptValue + + Send + + Sync + + 'static, +{ + fn from(fn_: F) -> Self { + DynamicScriptFunction { + name: std::any::type_name::().into(), + func: Arc::new(fn_), + } + } +} + +impl From for DynamicScriptFunctionMut +where + F: FnMut(CallerContext, WorldCallbackAccess, Vec) -> ScriptValue + + Send + + Sync + + 'static, +{ + fn from(fn_: F) -> Self { + DynamicScriptFunctionMut { + name: std::any::type_name::().into(), + func: Arc::new(RwLock::new(fn_)), + } } } @@ -261,39 +361,59 @@ macro_rules! count { macro_rules! impl_script_function { ($( $param:ident ),* ) => { - // fn(T1...Tn) -> O - impl_script_function!(@ $( $param ),* : -> O => O ); - // fn(WorldCallbackAccess, T1...Tn) -> O - impl_script_function!(@ $( $param ),* : ,(callback: WorldCallbackAccess) -> O => O); - // fn(CallerContext, WorldCallbackAccess, T1...Tn) -> O - impl_script_function!(@ $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => O); - - // fn(T1...Tn) -> Result - impl_script_function!(@ $( $param ),* : -> O => Result where s); - // fn(WorldCallbackAccess, T1...Tn) -> Result - impl_script_function!(@ $( $param ),* : ,(callback: WorldCallbackAccess) -> O => Result where s); - // fn(CallerContext, WorldCallbackAccess, T1...Tn) -> Result - impl_script_function!(@ $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => Result where s); + // all of this is pretty heavy on the compile time. + // ideally we'd do less, but for now this will suffice + + // Fn(T1...Tn) -> O + impl_script_function!(@ ScriptFunction Fn DynamicScriptFunction into_dynamic_script_function $( $param ),* : -> O => O ); + // FnMut(T1...Tn) -> O + impl_script_function!(@ ScriptFunctionMut FnMut DynamicScriptFunctionMut into_dynamic_script_function_mut $( $param ),* : -> O => O ); + + // Fn(WorldCallbackAccess, T1...Tn) -> O + impl_script_function!(@ ScriptFunction Fn DynamicScriptFunction into_dynamic_script_function $( $param ),* : ,(callback: WorldCallbackAccess) -> O => O); + // FnMut(WorldCallbackAccess, T1...Tn) -> O + impl_script_function!(@ ScriptFunctionMut FnMut DynamicScriptFunctionMut into_dynamic_script_function_mut $( $param ),* : ,(callback: WorldCallbackAccess) -> O => O); + + // Fn(CallerContext, WorldCallbackAccess, T1...Tn) -> O + impl_script_function!(@ ScriptFunction Fn DynamicScriptFunction into_dynamic_script_function $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => O); + // FnMut(CallerContext, WorldCallbackAccess, T1...Tn) -> O + impl_script_function!(@ ScriptFunctionMut FnMut DynamicScriptFunctionMut into_dynamic_script_function_mut $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => O); + + // Fn(T1...Tn) -> Result + impl_script_function!(@ ScriptFunction Fn DynamicScriptFunction into_dynamic_script_function $( $param ),* : -> O => Result where s); + // FnMut(T1...Tn) -> Result + impl_script_function!(@ ScriptFunctionMut FnMut DynamicScriptFunctionMut into_dynamic_script_function_mut $( $param ),* : -> O => Result where s); + + // Fn(WorldCallbackAccess, T1...Tn) -> Result + impl_script_function!(@ ScriptFunction Fn DynamicScriptFunction into_dynamic_script_function $( $param ),* : ,(callback: WorldCallbackAccess) -> O => Result where s); + // FnMut(WorldCallbackAccess, T1...Tn) -> Result + impl_script_function!(@ ScriptFunctionMut FnMut DynamicScriptFunctionMut into_dynamic_script_function_mut $( $param ),* : ,(callback: WorldCallbackAccess) -> O => Result where s); + + // Fn(CallerContext, WorldCallbackAccess, T1...Tn) -> Result + impl_script_function!(@ ScriptFunction Fn DynamicScriptFunction into_dynamic_script_function $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => Result where s); + // FnMut(CallerContext, WorldCallbackAccess, T1...Tn) -> Result + impl_script_function!(@ ScriptFunctionMut FnMut DynamicScriptFunctionMut into_dynamic_script_function_mut $( $param ),* : (context: CallerContext),(callback: WorldCallbackAccess) -> O => Result where s); + }; - (@ $( $param:ident ),* : $(($context:ident: $contextty:ty))? $(,($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { + (@ $trait_type:ident $fn_type:ident $dynamic_type:ident $trait_fn_name:ident $( $param:ident ),* : $(($context:ident: $contextty:ty))? $(,($callback:ident: $callbackty:ty))? -> O => $res:ty $(where $out:ident)?) => { #[allow(non_snake_case)] impl< 'env, $( $param: FromScript, )* O, F - > ScriptFunction<'env, + > $trait_type<'env, fn( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res > for F where O: IntoScript + TypePath + GetOwnership, - F: Fn( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, + F: $fn_type( $($contextty,)? $( $callbackty, )? $($param ),* ) -> $res + Send + Sync + 'static, $( $param::This<'env>: Into<$param>,)* { #[allow(unused_mut,unused_variables)] - fn into_dynamic_script_function(self) -> DynamicScriptFunction { + fn $trait_fn_name(mut self) -> $dynamic_type { let func = (move |caller_context: CallerContext, world: WorldCallbackAccess, args: Vec | { let res: Result = (|| { let expected_arg_count = count!($($param )*); @@ -330,7 +450,7 @@ macro_rules! impl_script_function { script_value }); - DynamicScriptFunction { func: Arc::new(func), name: core::any::type_name::().into() } + func.into() } } }; diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 37ca550d4d..3d38d6e947 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -397,6 +397,7 @@ impl DisplayWithWorld for ScriptValue { fn display_value_with_world(&self, world: WorldGuard) -> String { match self { ScriptValue::Reference(r) => r.display_value_with_world(world), + ScriptValue::Function(f) => format!("Function({})", f.name()), ScriptValue::Unit => "()".to_owned(), ScriptValue::Bool(b) => b.to_string(), ScriptValue::Integer(i) => i.to_string(), diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs index fccacd9fd3..6503dadaa2 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -15,7 +15,11 @@ use crate::{ reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, }; -use super::{pretty_print::DisplayWithWorld, ReflectReference, WorldGuard}; +use super::{ + function::script_function::{DynamicScriptFunction, DynamicScriptFunctionMut}, + pretty_print::DisplayWithWorld, + ReflectReference, WorldGuard, +}; /// An abstraction of values that can be passed to and from scripts. /// This allows us to re-use logic between scripting languages. @@ -36,6 +40,8 @@ pub enum ScriptValue { List(Vec), /// Represents a reference to a value. Reference(ReflectReference), + /// A dynamic script function + Function(DynamicScriptFunctionMut), /// Represents any error, will be thrown when returned to a script Error(InteropError), } @@ -50,6 +56,7 @@ impl ScriptValue { ScriptValue::String(_) => "String".to_owned(), ScriptValue::List(_) => "List".to_owned(), ScriptValue::Reference(_) => "Reference".to_owned(), + ScriptValue::Function(_) => "Function".to_owned(), ScriptValue::Error(_) => "Error".to_owned(), } } @@ -109,12 +116,6 @@ impl From for ScriptValue { } } -// impl From for ScriptValue { -// fn from(value: ScriptError) -> Self { -// ScriptValue::Error(value) -// } -// } - impl From for ScriptValue { fn from(value: InteropError) -> Self { ScriptValue::Error(value) diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 38cbfd427c..a09f40c58c 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -14,14 +14,14 @@ use bindings::{ from::{Mut, Ref, Val}, from_ref::FromScriptRef, into_ref::IntoScriptRef, - script_function::{CallerContext, GetFunctionTypeDependencies, ScriptFunction}, + script_function::{CallerContext, GetFunctionTypeDependencies, ScriptFunction, ScriptFunctionMut}, }, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, }; -use error::InteropError; +use error::{InteropError, InteropErrorInner}; use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; use crate::{bevy_bindings::LuaBevyScriptingPlugin, namespaced_register::NamespaceBuilder}; @@ -300,6 +300,31 @@ pub fn register_reflect_reference_functions( }; ReflectReference::into_script_ref(reference, world) }).transpose() + }) + .register("iter", |w: WorldCallbackAccess, s: ReflectReference| { + let mut infinite_iter = s.into_iter_infinite(); + let world = w.try_read().expect("stale world"); + let iter_function = move |w: WorldCallbackAccess| { + let (next_ref, idx) = infinite_iter.next_ref(); + let allocator = world.allocator(); + let mut allocator = allocator.write(); + let reference = ReflectReference::new_allocated(next_ref, &mut allocator); + let converted = ReflectReference::into_script_ref(reference, world.clone()); + // we stop once the reflection path is invalid + match converted { + Ok(v) => Ok(v), + Err(e) => { + match e.inner() { + InteropErrorInner::ReflectionPathError { .. } => { + Ok(ScriptValue::Unit) + }, + _ => Err(e), + } + }, + } + }; + + iter_function.into_dynamic_script_function_mut() }); Ok(()) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 8aebaa24f0..c131576b87 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -37,7 +37,7 @@ use super::{ script_value::LuaScriptValue, world::GetWorld, }; -use crate::bindings::world::LuaWorld; +use crate::bindings::{script_value::lua_caller_context, world::LuaWorld}; /// Lua UserData wrapper for [`bevy_mod_scripting_core::bindings::ReflectReference`]. /// Acts as a lua reflection interface. Any value which is registered in the type registry can be interacted with using this type. @@ -62,18 +62,12 @@ impl From for LuaReflectReference { } } -fn lua_caller_context() -> CallerContext { - CallerContext { - convert_to_0_indexed: true, - } -} - /// Looks up a function in the registry on the given type id fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option> { let function = lookup_dynamic_function(lua, key, type_id); - function.map(|function| { - lua.create_function(move |lua, args: Variadic| { + function.map(|mut function| { + lua.create_function_mut(move |lua, args: Variadic| { let world = lua.get_world(); let out = function.call_script_function( args.into_iter().map(Into::into), @@ -139,7 +133,7 @@ fn try_call_overloads( ) -> Result { let overloads = iter_dynamic_function_overloads(lua, key, type_id); let mut last_error = None; - for overload in overloads { + for mut overload in overloads { match overload.call_script_function(args.clone(), world.clone(), lua_caller_context()) { Ok(out) => return Ok(out.into()), Err(e) => last_error = Some(e), @@ -173,7 +167,7 @@ impl UserData for LuaReflectReference { }; // lookup get index function - let index_func = lookup_dynamic_function_typed::(lua, "get") + let mut index_func = lookup_dynamic_function_typed::(lua, "get") .expect("No 'get' function registered for a ReflectReference"); // call the function with the key @@ -309,6 +303,19 @@ impl UserData for LuaReflectReference { }, ); + #[cfg(any( + feature = "lua54", + feature = "lua53", + feature = "lua52", + feature = "luajit52", + ))] + m.add_meta_function(MetaMethod::Pairs, |l, s: LuaReflectReference| { + let iter_func = lookup_function_typed::(l, "iter") + .expect("No iter function registered"); + + Ok(iter_func) + }); + // #[cfg(any( // feature = "lua54", // feature = "lua53", diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 534c213956..7fce312b40 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -1,9 +1,13 @@ use std::ops::{Deref, DerefMut}; -use bevy_mod_scripting_core::bindings::{script_value::ScriptValue, ReflectBase, ReflectReference}; -use mlua::{FromLua, IntoLua, IntoLuaMulti, MultiValue, Value}; +use bevy_mod_scripting_core::bindings::{ + function::{script_function::CallerContext, CallScriptFunction}, + script_value::ScriptValue, + ReflectBase, ReflectReference, +}; +use mlua::{FromLua, IntoLua, IntoLuaMulti, MultiValue, Value, Variadic}; -use super::reference::LuaReflectReference; +use super::{reference::LuaReflectReference, world::GetWorld}; #[derive(Debug, Clone)] pub struct LuaScriptValue(ScriptValue); @@ -70,6 +74,12 @@ impl FromLua for LuaScriptValue { } } +pub fn lua_caller_context() -> CallerContext { + CallerContext { + convert_to_0_indexed: true, + } +} + impl IntoLua for LuaScriptValue { fn into_lua(self, lua: &mlua::Lua) -> mlua::Result { Ok(match self.0 { @@ -80,6 +90,18 @@ impl IntoLua for LuaScriptValue { ScriptValue::String(s) => Value::String(lua.create_string(s.as_ref())?), ScriptValue::Reference(r) => LuaReflectReference::from(r).into_lua(lua)?, ScriptValue::Error(script_error) => return Err(mlua::Error::external(script_error)), + ScriptValue::Function(mut function) => lua + .create_function_mut(move |lua, args: Variadic| { + let world = lua.get_world(); + let out = function.call_script_function( + args.into_iter().map(Into::into), + world, + lua_caller_context(), + )?; + + Ok(LuaScriptValue::from(out)) + })? + .into_lua(lua)?, ScriptValue::List(vec) => { let table = lua.create_table_from( vec.into_iter() diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua new file mode 100644 index 0000000000..1a766b3bb1 --- /dev/null +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua @@ -0,0 +1,13 @@ +local res_type = world.get_type_by_name("TestResourceWithVariousFields") +local res = world.get_resource(res_type) + +iterated_vals = {} +for i,v in pairs(res.vec_usize) + interated_vals[i] = v +end + +assert(iterated_vals[1] == 1) +assert(iterated_vals[2] == 2) +assert(iterated_vals[3] == 3) +assert(iterated_vals[4] == 4) +assert(iterated_vals[5] == 5) From 4b7622e30d72169cd0697943b11679c226d96bfd Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 17:45:11 +0000 Subject: [PATCH 134/217] allow passing more arguments than needed --- .../src/bindings/function/script_function.rs | 2 +- crates/bevy_mod_scripting_functions/src/core.rs | 2 +- .../bevy_mod_scripting_lua/src/bindings/reference.rs | 9 +++++++-- .../bevy_mod_scripting_lua/tests/data/iter/vec.lua | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 1077c0a18f..3f31828023 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -417,7 +417,7 @@ macro_rules! impl_script_function { let func = (move |caller_context: CallerContext, world: WorldCallbackAccess, args: Vec | { let res: Result = (|| { let expected_arg_count = count!($($param )*); - if args.len() != expected_arg_count { + if args.len() < expected_arg_count { return Err(InteropError::function_call_error(FunctionError::ArgCountMismatch{ expected: expected_arg_count, received: args.len() diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index a09f40c58c..67786cde24 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -304,7 +304,7 @@ pub fn register_reflect_reference_functions( .register("iter", |w: WorldCallbackAccess, s: ReflectReference| { let mut infinite_iter = s.into_iter_infinite(); let world = w.try_read().expect("stale world"); - let iter_function = move |w: WorldCallbackAccess| { + let iter_function = move || { let (next_ref, idx) = infinite_iter.next_ref(); let allocator = world.allocator(); let mut allocator = allocator.write(); diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index c131576b87..c7d184ee01 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -310,10 +310,15 @@ impl UserData for LuaReflectReference { feature = "luajit52", ))] m.add_meta_function(MetaMethod::Pairs, |l, s: LuaReflectReference| { - let iter_func = lookup_function_typed::(l, "iter") + let mut iter_func = lookup_dynamic_function_typed::(l, "iter") .expect("No iter function registered"); + let world = l.get_world(); - Ok(iter_func) + Ok(LuaScriptValue::from(iter_func.call_script_function( + vec![ScriptValue::Reference(s.into())], + world, + lua_caller_context(), + )?)) }); // #[cfg(any( diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua index 1a766b3bb1..c3f1bd72c7 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua @@ -2,7 +2,7 @@ local res_type = world.get_type_by_name("TestResourceWithVariousFields") local res = world.get_resource(res_type) iterated_vals = {} -for i,v in pairs(res.vec_usize) +for i,v in pairs(res.vec_usize) do interated_vals[i] = v end From 9b269c46dea383d90eef3e8496c7ff2c46455ddf Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 18:27:08 +0000 Subject: [PATCH 135/217] just lookup length for iteration for now --- .../bevy_mod_scripting_functions/src/core.rs | 31 +++++++++---------- .../tests/data/iter/vec.lua | 6 +++- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 67786cde24..7b8edc6bf7 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -302,29 +302,28 @@ pub fn register_reflect_reference_functions( }).transpose() }) .register("iter", |w: WorldCallbackAccess, s: ReflectReference| { - let mut infinite_iter = s.into_iter_infinite(); let world = w.try_read().expect("stale world"); + let mut len = s.len(world.clone())?.unwrap_or_default(); + let mut infinite_iter = s.into_iter_infinite(); let iter_function = move || { + if len == 0 { + return Ok(ScriptValue::Unit); + } + let (next_ref, idx) = infinite_iter.next_ref(); - let allocator = world.allocator(); - let mut allocator = allocator.write(); - let reference = ReflectReference::new_allocated(next_ref, &mut allocator); + let reference = { + let allocator = world.allocator(); + let mut allocator = allocator.write(); + ReflectReference::new_allocated(next_ref, &mut allocator) + }; let converted = ReflectReference::into_script_ref(reference, world.clone()); + // println!("idx: {idx:?}, converted: {converted:?}"); + len -= 1; // we stop once the reflection path is invalid - match converted { - Ok(v) => Ok(v), - Err(e) => { - match e.inner() { - InteropErrorInner::ReflectionPathError { .. } => { - Ok(ScriptValue::Unit) - }, - _ => Err(e), - } - }, - } + converted }; - iter_function.into_dynamic_script_function_mut() + Ok(iter_function.into_dynamic_script_function_mut()) }); Ok(()) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua index c3f1bd72c7..0d14d88fb6 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua @@ -3,9 +3,13 @@ local res = world.get_resource(res_type) iterated_vals = {} for i,v in pairs(res.vec_usize) do - interated_vals[i] = v + iterated_vals[i] = v end +print("Iterated vals:") +for i,v in pairs(iterated_vals) do + print(i, v) +end assert(iterated_vals[1] == 1) assert(iterated_vals[2] == 2) assert(iterated_vals[3] == 3) From 258ba8f30fcd8d25ae748c24c0e08020f093dffb Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 18:43:51 +0000 Subject: [PATCH 136/217] make iteration work --- .../bevy_mod_scripting_functions/src/core.rs | 8 ++------ .../tests/data/iter/vec.lua | 20 +++++++++---------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 7b8edc6bf7..23643c0b7e 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -311,12 +311,8 @@ pub fn register_reflect_reference_functions( } let (next_ref, idx) = infinite_iter.next_ref(); - let reference = { - let allocator = world.allocator(); - let mut allocator = allocator.write(); - ReflectReference::new_allocated(next_ref, &mut allocator) - }; - let converted = ReflectReference::into_script_ref(reference, world.clone()); + + let converted = ReflectReference::into_script_ref(next_ref, world.clone()); // println!("idx: {idx:?}, converted: {converted:?}"); len -= 1; // we stop once the reflection path is invalid diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua index 0d14d88fb6..f14683f1e1 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua @@ -2,16 +2,14 @@ local res_type = world.get_type_by_name("TestResourceWithVariousFields") local res = world.get_resource(res_type) iterated_vals = {} -for i,v in pairs(res.vec_usize) do - iterated_vals[i] = v +for v in pairs(res.vec_usize) do + iterated_vals[#iterated_vals + 1] = v end +print(iterated_vals[1]) +assert(#iterated_vals == 5, "Length is not 5") -print("Iterated vals:") -for i,v in pairs(iterated_vals) do - print(i, v) -end -assert(iterated_vals[1] == 1) -assert(iterated_vals[2] == 2) -assert(iterated_vals[3] == 3) -assert(iterated_vals[4] == 4) -assert(iterated_vals[5] == 5) +assert(iterated_vals[1] == 1, "First value is not 1") +assert(iterated_vals[2] == 2, "Second value is not 2") +assert(iterated_vals[3] == 3, "Third value is not 3") +assert(iterated_vals[4] == 4, "Fourth value is not 4") +assert(iterated_vals[5] == 5, "Fifth value is not 5") \ No newline at end of file From dce02e89915c8343315493325ed930261b3d1d80 Mon Sep 17 00:00:00 2001 From: Maksymilian Mozolewski Date: Tue, 31 Dec 2024 18:47:22 +0000 Subject: [PATCH 137/217] feat: Complete Crate Re-write (#160) clean up test --- .../languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua index f14683f1e1..e1da679d5a 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/iter/vec.lua @@ -5,11 +5,9 @@ iterated_vals = {} for v in pairs(res.vec_usize) do iterated_vals[#iterated_vals + 1] = v end -print(iterated_vals[1]) assert(#iterated_vals == 5, "Length is not 5") - assert(iterated_vals[1] == 1, "First value is not 1") assert(iterated_vals[2] == 2, "Second value is not 2") assert(iterated_vals[3] == 3, "Third value is not 3") assert(iterated_vals[4] == 4, "Fourth value is not 4") -assert(iterated_vals[5] == 5, "Fifth value is not 5") \ No newline at end of file +assert(iterated_vals[5] == 5, "Fifth value is not 5") From 341f0f152d46efcc814908a73358f732b92db0eb Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 18:50:08 +0000 Subject: [PATCH 138/217] update relesae plz config --- release-plz.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/release-plz.toml b/release-plz.toml index 6761f9b089..665976f1af 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -51,6 +51,10 @@ version_group = "main" name = "bevy_mod_scripting_rune" version_group = "main" +[[package]] +name = "bevy_mod_scripting_functions" +version_group = "main" + [[package]] name = "bevy_event_priority" version_group = "main" \ No newline at end of file From 514fef5b38605f9b447098e7e1a366586b4102e5 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 18:53:19 +0000 Subject: [PATCH 139/217] change release plz config --- release-plz.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/release-plz.toml b/release-plz.toml index 665976f1af..09408ca4ab 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -27,6 +27,7 @@ changelog_include = [ "bevy_mod_scripting_core", "bevy_mod_scripting_rhai", "bevy_mod_scripting_rune", + "bevy_mod_scripting_functions, "bevy_event_priority", ] From 31d720fadc296f9d0984db0d9eb70dd13ccefca3 Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 18:54:07 +0000 Subject: [PATCH 140/217] fix typo --- release-plz.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release-plz.toml b/release-plz.toml index 09408ca4ab..5a3d533ec7 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -27,7 +27,7 @@ changelog_include = [ "bevy_mod_scripting_core", "bevy_mod_scripting_rhai", "bevy_mod_scripting_rune", - "bevy_mod_scripting_functions, + "bevy_mod_scripting_functions", "bevy_event_priority", ] From d6e329fe604716400c8707e223ec863c5d1c5abe Mon Sep 17 00:00:00 2001 From: makspll Date: Tue, 31 Dec 2024 18:56:42 +0000 Subject: [PATCH 141/217] fix readme --- crates/bevy_mod_scripting_functions/readme.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 crates/bevy_mod_scripting_functions/readme.md diff --git a/crates/bevy_mod_scripting_functions/readme.md b/crates/bevy_mod_scripting_functions/readme.md new file mode 100644 index 0000000000..e28c0107c6 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/readme.md @@ -0,0 +1,3 @@ +# bevy_mod_scripting_lua_functions + +This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file From c599bff9e218cb8fe5d57d6b989b9881bbdfab55 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 14:44:40 +0000 Subject: [PATCH 142/217] remove macro tests, start publishing book, update readme --- .github/workflows/macro_tests.yml | 33 -- .github/workflows/mdbook.yml | 4 +- crates/macro_tests/Cargo.toml | 21 -- .../fail/references/non-proxy-reference.rs | 21 -- .../references/non-proxy-reference.stderr | 18 -- .../references/output-with-proxy-reference.rs | 15 - .../output-with-proxy-reference.stderr | 63 ---- .../fail/simple/invalid-argument-count.rs | 17 - .../fail/simple/invalid-argument-count.stderr | 12 - .../fail/simple/invalid-argument-type.rs | 17 - .../fail/simple/invalid-argument-type.stderr | 15 - .../fail/simple/invalid-function-type.rs | 15 - .../fail/simple/invalid-function-type.stderr | 7 - .../simple/invalid-output-type-custom-body.rs | 14 - .../invalid-output-type-custom-body.stderr | 10 - .../tests/fail/simple/invalid-output-type.rs | 17 - .../fail/simple/invalid-output-type.stderr | 10 - .../fail/simple/method-without-receiver.rs | 22 -- .../simple/method-without-receiver.stderr | 7 - crates/macro_tests/tests/macro_tests.rs | 11 - .../success/containers/option-argument.rs | 16 - .../tests/success/containers/option-output.rs | 36 --- .../tests/success/containers/vec-argument.rs | 21 -- .../tests/success/containers/vec-output.rs | 29 -- .../proxy-non-receiver-reference.rs | 22 -- .../tests/success/simple/function.rs | 33 -- .../tests/success/simple/metafunction.rs | 25 -- .../simple/metamethod-owned-receiver.rs | 25 -- .../tests/success/simple/metamethod.rs | 24 -- .../success/simple/method-owned-receiver.rs | 35 --- .../tests/success/simple/method.rs | 34 -- .../tests/success/simple/mutable-function.rs | 37 --- .../success/simple/mutable-metafunction.rs | 24 -- .../mutating-metamethod-owned-receiver.rs | 26 -- .../success/simple/mutating-metamethod.rs | 25 -- .../simple/mutating-method-owned-receiver.rs | 35 --- .../tests/success/simple/mutating-method.rs | 30 -- readme.md | 293 ++---------------- 38 files changed, 27 insertions(+), 1092 deletions(-) delete mode 100644 .github/workflows/macro_tests.yml delete mode 100644 crates/macro_tests/Cargo.toml delete mode 100644 crates/macro_tests/tests/fail/references/non-proxy-reference.rs delete mode 100644 crates/macro_tests/tests/fail/references/non-proxy-reference.stderr delete mode 100644 crates/macro_tests/tests/fail/references/output-with-proxy-reference.rs delete mode 100644 crates/macro_tests/tests/fail/references/output-with-proxy-reference.stderr delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-argument-count.rs delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-argument-count.stderr delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-argument-type.rs delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-argument-type.stderr delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-function-type.rs delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-function-type.stderr delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.rs delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.stderr delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-output-type.rs delete mode 100644 crates/macro_tests/tests/fail/simple/invalid-output-type.stderr delete mode 100644 crates/macro_tests/tests/fail/simple/method-without-receiver.rs delete mode 100644 crates/macro_tests/tests/fail/simple/method-without-receiver.stderr delete mode 100644 crates/macro_tests/tests/macro_tests.rs delete mode 100644 crates/macro_tests/tests/success/containers/option-argument.rs delete mode 100644 crates/macro_tests/tests/success/containers/option-output.rs delete mode 100644 crates/macro_tests/tests/success/containers/vec-argument.rs delete mode 100644 crates/macro_tests/tests/success/containers/vec-output.rs delete mode 100644 crates/macro_tests/tests/success/references/proxy-non-receiver-reference.rs delete mode 100644 crates/macro_tests/tests/success/simple/function.rs delete mode 100644 crates/macro_tests/tests/success/simple/metafunction.rs delete mode 100644 crates/macro_tests/tests/success/simple/metamethod-owned-receiver.rs delete mode 100644 crates/macro_tests/tests/success/simple/metamethod.rs delete mode 100644 crates/macro_tests/tests/success/simple/method-owned-receiver.rs delete mode 100644 crates/macro_tests/tests/success/simple/method.rs delete mode 100644 crates/macro_tests/tests/success/simple/mutable-function.rs delete mode 100644 crates/macro_tests/tests/success/simple/mutable-metafunction.rs delete mode 100644 crates/macro_tests/tests/success/simple/mutating-metamethod-owned-receiver.rs delete mode 100644 crates/macro_tests/tests/success/simple/mutating-metamethod.rs delete mode 100644 crates/macro_tests/tests/success/simple/mutating-method-owned-receiver.rs delete mode 100644 crates/macro_tests/tests/success/simple/mutating-method.rs diff --git a/.github/workflows/macro_tests.yml b/.github/workflows/macro_tests.yml deleted file mode 100644 index a4e17c547a..0000000000 --- a/.github/workflows/macro_tests.yml +++ /dev/null @@ -1,33 +0,0 @@ -on: - pull_request: - paths: - - "crates/macro_tests/**" - push: - branches: - - main - paths: - - "crates/macro_tests/**" - - -name: Run macro tests - -jobs: - tests: - name: Macro Tests - runs-on: ubuntu-latest - steps: - - name: Clear space - run: sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY" - - uses: actions/checkout@v3 - - name: Install alsa and udev - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - - run: cd crates/macro_tests && cargo test --profile=ephemeral-build diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml index 80984049ee..3cf89b1ea6 100644 --- a/.github/workflows/mdbook.yml +++ b/.github/workflows/mdbook.yml @@ -13,6 +13,8 @@ jobs: build: name: Build Book - mdbook runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout repository @@ -31,7 +33,7 @@ jobs: run: cd docs && mdbook build - name: Deploy to GitHub Pages - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/crates/macro_tests/Cargo.toml b/crates/macro_tests/Cargo.toml deleted file mode 100644 index eb14de05ef..0000000000 --- a/crates/macro_tests/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "macro_tests" -version = "0.1.0" -edition = "2021" -private = true - -[profile.ephemeral-build] -inherits = "dev" -opt-level = 2 -codegen-units = 8 -incremental = false -debug = false - -[dependencies] - -[dev-dependencies] -trybuild = "1.0" -bevy = { version = "0.15.0", default-features = false } -bevy_mod_scripting = { path = "../../", features = ["lua", "lua54"] } -bevy_mod_scripting_lua = { path = "../languages/bevy_mod_scripting_lua" } -bevy_mod_scripting_core = { path = "../bevy_mod_scripting_core" } diff --git a/crates/macro_tests/tests/fail/references/non-proxy-reference.rs b/crates/macro_tests/tests/fail/references/non-proxy-reference.rs deleted file mode 100644 index 1989c51e1a..0000000000 --- a/crates/macro_tests/tests/fail/references/non-proxy-reference.rs +++ /dev/null @@ -1,21 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_some_string(some_str: &str) -> String; - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} -impl MyStruct { - pub fn fn_returning_some_string(some_str: &str) -> String { - some_str.to_owned() - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/references/non-proxy-reference.stderr b/crates/macro_tests/tests/fail/references/non-proxy-reference.stderr deleted file mode 100644 index ecb3063beb..0000000000 --- a/crates/macro_tests/tests/fail/references/non-proxy-reference.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0277]: the trait bound `&str: FromLuaMulti<'lua>` is not satisfied - --> tests/fail/references/non-proxy-reference.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ the trait `FromLua<'_>` is not implemented for `&str`, which is required by `&str: FromLuaMulti<'lua>` - | - = help: the trait `FromLua<'_>` is implemented for `std::string::String` - = help: for that trait implementation, expected `std::string::String`, found `&str` - = note: required for `&str` to implement `FromLuaMulti<'lua>` -note: required by a bound in `bevy_mod_scripting_lua::tealr::mlu::TealDataMethods::add_function` - --> $CARGO/tealr-0.9.1/src/mlu/teal_data_methods.rs - | - | fn add_function(&mut self, name: &S, function: F) - | ------------ required by a bound in this associated function -... - | A: FromLuaMulti<'lua> + TealMultiValue, - | ^^^^^^^^^^^^^^^^^^ required by this bound in `TealDataMethods::add_function` - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/references/output-with-proxy-reference.rs b/crates/macro_tests/tests/fail/references/output-with-proxy-reference.rs deleted file mode 100644 index 8cb4cd7f88..0000000000 --- a/crates/macro_tests/tests/fail/references/output-with-proxy-reference.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_some_string(ref_: &Self ) -> &Self { - ref_ - } - "#, -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/references/output-with-proxy-reference.stderr b/crates/macro_tests/tests/fail/references/output-with-proxy-reference.stderr deleted file mode 100644 index 7095c444f0..0000000000 --- a/crates/macro_tests/tests/fail/references/output-with-proxy-reference.stderr +++ /dev/null @@ -1,63 +0,0 @@ -error[E0308]: mismatched types - --> tests/fail/references/output-with-proxy-reference.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ - | | - | expected `MyStruct`, found `&MyStruct` - | arguments to this function are incorrect - | -note: associated function defined here - --> tests/fail/references/output-with-proxy-reference.rs:5:1 - | -5 | #[proxy(functions[ - | ^ - = note: this error originates in the derive macro `LuaProxy` which comes from the expansion of the macro `bevy_script_api::make_script_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0308]: mismatched types - --> tests/fail/references/output-with-proxy-reference.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ - | | - | expected `&LuaMyStruct`, found `LuaMyStruct` - | expected due to this - | - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `&LuaMyStruct: TealMultiValue` is not satisfied - --> tests/fail/references/output-with-proxy-reference.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ the trait `ToTypename` is not implemented for `&LuaMyStruct`, which is required by `&LuaMyStruct: TealMultiValue` - | - = help: the trait `ToTypename` is implemented for `LuaMyStruct` - = note: required for `&LuaMyStruct` to implement `TealMultiValue` -note: required by a bound in `bevy_mod_scripting_lua::tealr::mlu::TealDataMethods::add_function` - --> $CARGO/tealr-0.9.1/src/mlu/teal_data_methods.rs - | - | fn add_function(&mut self, name: &S, function: F) - | ------------ required by a bound in this associated function -... - | R: ToLuaMulti<'lua> + TealMultiValue, - | ^^^^^^^^^^^^^^ required by this bound in `TealDataMethods::add_function` - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) - -error[E0277]: the trait bound `&LuaMyStruct: IntoLuaMulti<'lua>` is not satisfied - --> tests/fail/references/output-with-proxy-reference.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ the trait `LuaUserData` is not implemented for `&LuaMyStruct`, which is required by `&LuaMyStruct: IntoLuaMulti<'lua>` - | - = help: the trait `LuaUserData` is implemented for `LuaMyStruct` - = note: required for `&LuaMyStruct` to implement `IntoLua<'_>` - = note: required for `&LuaMyStruct` to implement `IntoLuaMulti<'lua>` -note: required by a bound in `bevy_mod_scripting_lua::tealr::mlu::TealDataMethods::add_function` - --> $CARGO/tealr-0.9.1/src/mlu/teal_data_methods.rs - | - | fn add_function(&mut self, name: &S, function: F) - | ------------ required by a bound in this associated function -... - | R: ToLuaMulti<'lua> + TealMultiValue, - | ^^^^^^^^^^^^^^^^ required by this bound in `TealDataMethods::add_function` - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/simple/invalid-argument-count.rs b/crates/macro_tests/tests/fail/simple/invalid-argument-count.rs deleted file mode 100644 index 0f3e67c9f4..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-argument-count.rs +++ /dev/null @@ -1,17 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Method")] - fn my_fn(&self); - "#, -])] -pub struct MyStruct; - -impl MyStruct { - pub fn my_fn(&self, _: usize) {} -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/simple/invalid-argument-count.stderr b/crates/macro_tests/tests/fail/simple/invalid-argument-count.stderr deleted file mode 100644 index edce984c7f..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-argument-count.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0061]: this function takes 2 arguments but 1 argument was supplied - --> tests/fail/simple/invalid-argument-count.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ argument #2 of type `usize` is missing - | -note: method defined here - --> tests/fail/simple/invalid-argument-count.rs:14:12 - | -14 | pub fn my_fn(&self, _: usize) {} - | ^^^^^ ----- -------- - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/simple/invalid-argument-type.rs b/crates/macro_tests/tests/fail/simple/invalid-argument-type.rs deleted file mode 100644 index a8987f9e83..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-argument-type.rs +++ /dev/null @@ -1,17 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Method")] - fn my_fn(&self, arg: String); - "#, -])] -pub struct MyStruct; - -impl MyStruct { - pub fn my_fn(&self, _: usize) {} -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/simple/invalid-argument-type.stderr b/crates/macro_tests/tests/fail/simple/invalid-argument-type.stderr deleted file mode 100644 index 0da85ca5ad..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-argument-type.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0308]: mismatched types - --> tests/fail/simple/invalid-argument-type.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ - | | - | expected `usize`, found `String` - | arguments to this function are incorrect - | -note: method defined here - --> tests/fail/simple/invalid-argument-type.rs:14:12 - | -14 | pub fn my_fn(&self, _: usize) {} - | ^^^^^ -------- - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/simple/invalid-function-type.rs b/crates/macro_tests/tests/fail/simple/invalid-function-type.rs deleted file mode 100644 index 17b854f5a9..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-function-type.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="AMASJDIASDKAW")] - fn fn_taking_nothing() { - - } - "#, -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/simple/invalid-function-type.stderr b/crates/macro_tests/tests/fail/simple/invalid-function-type.stderr deleted file mode 100644 index ac2fceeceb..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-function-type.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: Unknown literal value `AMASJDIASDKAW` - --> tests/fail/simple/invalid-function-type.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ - | - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.rs b/crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.rs deleted file mode 100644 index b10fe0538a..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.rs +++ /dev/null @@ -1,14 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_proxy() -> Self { - 2 - } - "#, -])] -pub struct MyStruct; -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.stderr b/crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.stderr deleted file mode 100644 index 3c7899c07f..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-output-type-custom-body.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0308]: mismatched types - --> tests/fail/simple/invalid-output-type-custom-body.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ expected `MyStruct`, found integer -... -13 | pub struct MyStruct; - | -------- expected due to this - | - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/simple/invalid-output-type.rs b/crates/macro_tests/tests/fail/simple/invalid-output-type.rs deleted file mode 100644 index 09ee654d02..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-output-type.rs +++ /dev/null @@ -1,17 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn my_fn() -> usize; - "#, -])] -pub struct MyStruct; -impl MyStruct { - pub fn my_fn() -> Self { - MyStruct - } -} -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/simple/invalid-output-type.stderr b/crates/macro_tests/tests/fail/simple/invalid-output-type.stderr deleted file mode 100644 index dfcd615b6a..0000000000 --- a/crates/macro_tests/tests/fail/simple/invalid-output-type.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error[E0308]: mismatched types - --> tests/fail/simple/invalid-output-type.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ - | | - | expected `usize`, found `MyStruct` - | expected due to this - | - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/fail/simple/method-without-receiver.rs b/crates/macro_tests/tests/fail/simple/method-without-receiver.rs deleted file mode 100644 index 69eaee3fe8..0000000000 --- a/crates/macro_tests/tests/fail/simple/method-without-receiver.rs +++ /dev/null @@ -1,22 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Method")] - fn fn_taking_nothing() { - - } - "#, - - r#" - #[lua(kind="Method")] - fn fn_taking_usize(arg: usize) { - - } - "#, -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/fail/simple/method-without-receiver.stderr b/crates/macro_tests/tests/fail/simple/method-without-receiver.stderr deleted file mode 100644 index 44fbc6cdce..0000000000 --- a/crates/macro_tests/tests/fail/simple/method-without-receiver.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error: Expected receiver as first argument in the signature - --> tests/fail/simple/method-without-receiver.rs:4:10 - | -4 | #[derive(LuaProxy, Reflect, Clone)] - | ^^^^^^^^ - | - = note: this error originates in the derive macro `LuaProxy` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/crates/macro_tests/tests/macro_tests.rs b/crates/macro_tests/tests/macro_tests.rs deleted file mode 100644 index f009e7ebef..0000000000 --- a/crates/macro_tests/tests/macro_tests.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[test] -fn success() { - let t = trybuild::TestCases::new(); - t.pass("tests/success/**/*.rs"); -} - -#[test] -fn fail() { - let t = trybuild::TestCases::new(); - t.compile_fail("tests/fail/**/*.rs"); -} diff --git a/crates/macro_tests/tests/success/containers/option-argument.rs b/crates/macro_tests/tests/success/containers/option-argument.rs deleted file mode 100644 index 2cc6223e24..0000000000 --- a/crates/macro_tests/tests/success/containers/option-argument.rs +++ /dev/null @@ -1,16 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(derive(clone), functions[ -r#" - #[lua(kind="Function")] - fn fn_returning_string_option(_opt: Option) {} -"#,r#" - #[lua(kind="Function")] - fn fn_returning_some_proxy(#[proxy] _opt: Option) {} -"# -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/containers/option-output.rs b/crates/macro_tests/tests/success/containers/option-output.rs deleted file mode 100644 index c6f885eee9..0000000000 --- a/crates/macro_tests/tests/success/containers/option-output.rs +++ /dev/null @@ -1,36 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_string_option() -> Option { - Some("hello".to_owned()) - } - "#, - - r#" - #[lua(kind="Function")] - fn fn_returning_string_option_none() -> Option { - None - } - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_some_proxy() -> Option { - Some(MyStruct) - } - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_none_proxy() -> Option { - None - } - "#, -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/containers/vec-argument.rs b/crates/macro_tests/tests/success/containers/vec-argument.rs deleted file mode 100644 index 1c22bbd135..0000000000 --- a/crates/macro_tests/tests/success/containers/vec-argument.rs +++ /dev/null @@ -1,21 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(derive(clone), functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_string_vec(_vec: Vec) { - } - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_proxy_vec(_vec: Vec) { - - } - "#, -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/containers/vec-output.rs b/crates/macro_tests/tests/success/containers/vec-output.rs deleted file mode 100644 index 42ac7cfc9b..0000000000 --- a/crates/macro_tests/tests/success/containers/vec-output.rs +++ /dev/null @@ -1,29 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_string_vec() -> Vec { - vec!["hello".to_owned()] - } - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_proxy_vec() -> Vec { - vec![MyStruct, MyStruct] - } - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_proxy_vec_empty() -> Vec { - Vec::default() - } - "#, -])] -pub struct MyStruct; - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/references/proxy-non-receiver-reference.rs b/crates/macro_tests/tests/success/references/proxy-non-receiver-reference.rs deleted file mode 100644 index 2a0982c62e..0000000000 --- a/crates/macro_tests/tests/success/references/proxy-non-receiver-reference.rs +++ /dev/null @@ -1,22 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_some_string(#[proxy] other: &Self) -> String; - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -impl MyStruct { - pub fn fn_returning_some_string(other: &Self) -> String { - other.some_string.clone() - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/function.rs b/crates/macro_tests/tests/success/simple/function.rs deleted file mode 100644 index 32a96bd00e..0000000000 --- a/crates/macro_tests/tests/success/simple/function.rs +++ /dev/null @@ -1,33 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_some_string() -> String; - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_proxy() -> Self; - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} -impl MyStruct { - pub fn fn_returning_some_string() -> String { - "hello".to_owned() - } - - pub fn fn_returning_proxy() -> MyStruct { - MyStruct { - some_string: "hello".to_owned(), - me_vec: vec![1, 2, 3], - } - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/metafunction.rs b/crates/macro_tests/tests/success/simple/metafunction.rs deleted file mode 100644 index 97c2f69828..0000000000 --- a/crates/macro_tests/tests/success/simple/metafunction.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MetaFunction", metamethod="ToString")] - fn ToString(#[proxy] my_struct: &Self) -> String { - my_struct.some_string.clone() - } - "#, - - r#" - #[lua(kind="MetaFunction", output(proxy), metamethod="Index")] - fn Index(#[proxy] my_struct: &Self, _i: usize) -> Self { - my_struct.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/metamethod-owned-receiver.rs b/crates/macro_tests/tests/success/simple/metamethod-owned-receiver.rs deleted file mode 100644 index b9f476cdb1..0000000000 --- a/crates/macro_tests/tests/success/simple/metamethod-owned-receiver.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MetaMethod", metamethod="ToString")] - fn ToString(&self) -> String { - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="MetaMethod", metamethod="Index", output(proxy))] - fn Index(&self, _idx: usize) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/metamethod.rs b/crates/macro_tests/tests/success/simple/metamethod.rs deleted file mode 100644 index 7a0a13aadb..0000000000 --- a/crates/macro_tests/tests/success/simple/metamethod.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MetaMethod", metamethod="ToString")] - fn ToString(&self) -> String { - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="MetaMethod", metamethod="Index", output(proxy))] - fn Index(&self, _idx: usize) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/method-owned-receiver.rs b/crates/macro_tests/tests/success/simple/method-owned-receiver.rs deleted file mode 100644 index 955c623d95..0000000000 --- a/crates/macro_tests/tests/success/simple/method-owned-receiver.rs +++ /dev/null @@ -1,35 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(derive(clone), functions[ - r#" - #[lua(kind="Method")] - fn fn_returning_some_string(self) -> String { - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="Method", output(proxy))] - fn fn_returning_proxy(self) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -impl MyStruct { - pub fn fn_returning_some_string(self) -> String { - self.some_string - } - - pub fn fn_returning_proxy(self) -> Self { - self.clone() - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/method.rs b/crates/macro_tests/tests/success/simple/method.rs deleted file mode 100644 index 3a04d4e4a6..0000000000 --- a/crates/macro_tests/tests/success/simple/method.rs +++ /dev/null @@ -1,34 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Method")] - fn fn_returning_some_string(&self) -> String { - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="Method", output(proxy))] - fn fn_returning_proxy(&self) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -impl MyStruct { - pub fn fn_returning_some_string(&self) -> String { - self.some_string.clone() - } - - pub fn fn_returning_proxy(&self) -> Self { - self.clone() - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/mutable-function.rs b/crates/macro_tests/tests/success/simple/mutable-function.rs deleted file mode 100644 index 0b8ad7ea31..0000000000 --- a/crates/macro_tests/tests/success/simple/mutable-function.rs +++ /dev/null @@ -1,37 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="Function")] - fn fn_returning_some_string(#[proxy]arg: &mut MyStruct) -> String { - arg.some_string.clone() - } - "#, - - r#" - #[lua(kind="Function", output(proxy))] - fn fn_returning_proxy(#[proxy]arg: &mut MyStruct) -> Self { - arg.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} -impl MyStruct { - pub fn fn_returning_some_string() -> String { - "hello".to_owned() - } - - pub fn fn_returning_proxy() -> Self { - Self { - some_string: "hello".to_owned(), - me_vec: Default::default(), - } - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/mutable-metafunction.rs b/crates/macro_tests/tests/success/simple/mutable-metafunction.rs deleted file mode 100644 index 79b96ed249..0000000000 --- a/crates/macro_tests/tests/success/simple/mutable-metafunction.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MutableMetaFunction", metamethod="ToString")] - fn ToString(&self) -> String { - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="MutableMetaFunction", metamethod="Index", output(proxy))] - fn Index(&self, _i: usize) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/mutating-metamethod-owned-receiver.rs b/crates/macro_tests/tests/success/simple/mutating-metamethod-owned-receiver.rs deleted file mode 100644 index 26c0f06a05..0000000000 --- a/crates/macro_tests/tests/success/simple/mutating-metamethod-owned-receiver.rs +++ /dev/null @@ -1,26 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MutatingMetaMethod", metamethod="ToString")] - fn ToString(&mut self) -> String { - self.some_string = "lol".to_string(); - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="MutatingMetaMethod", metamethod="Index", output(proxy))] - fn Index(&mut self, _i: usize) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/mutating-metamethod.rs b/crates/macro_tests/tests/success/simple/mutating-metamethod.rs deleted file mode 100644 index 20b603028a..0000000000 --- a/crates/macro_tests/tests/success/simple/mutating-metamethod.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MutatingMetaMethod", metamethod="ToString")] - fn ToString(&mut self) -> String { - self.some_string = "lol".to_string(); - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="MutatingMetaMethod", metamethod="Index", output(proxy))] - fn Index(&mut self, _idx: usize) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/mutating-method-owned-receiver.rs b/crates/macro_tests/tests/success/simple/mutating-method-owned-receiver.rs deleted file mode 100644 index 49b91c02fd..0000000000 --- a/crates/macro_tests/tests/success/simple/mutating-method-owned-receiver.rs +++ /dev/null @@ -1,35 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; - -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(derive(clone), functions[ - r#" - #[lua(kind="MutatingMethod")] - fn fn_returning_some_string(mut self) -> String { - self.some_string.clone() - } - "#, - - r#" - #[lua(kind="MutatingMethod", output(proxy))] - fn fn_returning_proxy(mut self) -> Self { - self.clone() - } - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -impl MyStruct { - pub fn fn_returning_some_string(self) -> String { - self.some_string - } - - pub fn fn_returning_proxy(self) -> Self { - self.clone() - } -} - -pub fn main() {} diff --git a/crates/macro_tests/tests/success/simple/mutating-method.rs b/crates/macro_tests/tests/success/simple/mutating-method.rs deleted file mode 100644 index 8b107a7a6d..0000000000 --- a/crates/macro_tests/tests/success/simple/mutating-method.rs +++ /dev/null @@ -1,30 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::api::*; -#[derive(LuaProxy, Reflect, Clone)] -#[proxy(functions[ - r#" - #[lua(kind="MutatingMethod")] - fn fn_returning_some_string(&mut self) -> String; - "#, - - r#" - #[lua(kind="MutatingMethod", output(proxy))] - fn fn_returning_proxy(&mut self) -> Self; - "#, -])] -pub struct MyStruct { - some_string: String, - me_vec: Vec, -} - -impl MyStruct { - pub fn fn_returning_some_string(&mut self) -> String { - self.some_string.clone() - } - - pub fn fn_returning_proxy(&mut self) -> Self { - self.clone() - } -} - -pub fn main() {} diff --git a/readme.md b/readme.md index 7e62cfd51d..2aa6921469 100644 --- a/readme.md +++ b/readme.md @@ -6,283 +6,38 @@ Although Bevy doesn't directly support scripting, efforts are underway to incorporate it. This crate represents an initial attempt to enable scripting within Bevy's existing framework. It's important to note that this is a work in progress and not yet optimized or complete. As Bevy evolves, significant changes to this API are anticipated. -For a detailed look at how this crate works see [architecture.md](architecture.md) - ## Why Use Scripts? -- Refresh your game mechanics without the need for full crate recompilation +- Update your game mechanics without the need for re-compiling - Encapsulating game logic in scripts paves way for modders to create custom content easilly - Scripting game logic/UI in a simpler language broadens development accessibility to non-programmers on your team ## Features -- Hot re-loading scripts -- Lua, Teal, Rhai and Rune integrations -- Automatically generated Bevy bindings for Lua -- CLI rustc extensions for generating your own Lua bindings -- Event based hooks (i.e. `on_update`) -- Flexible event scheduling (i.e. allow handling events at handling stages based on the event) -- Multiple scripts per entity -- Multiple instances of the same script on one entity -- Extensive callback argument type support -- Utilities for generating script native documentation -- Loading external lua libraries via `require` (enabled with `unsafe_lua_modules` cargo feature due to potential unsafety) +- Script management via commands +- Hot loading +- Support for multiple scripting languages +- All script bindings managed in one place (`ScriptDynamicFunctionRegistry`) +- Customizable event driven communication between bevy and scripts (`on_update`, `on_init` etc..) +- Automatically generated bevy bindings +- ~Documentation generation~ temporarilly on hold ## Support -Support for languages is expressed in three levels: - -1. `ScriptHost` implementation, scripts can be loaded, scheduled and run in this language with support for custom `APIProvider` -2. A Bevy API Providedr is implemented which enables access to `entity`,`world` etc and provides support for at least basic operations such as `get_component`, `add_component`, `spawn` etc -3. Macros for generating proxy wrapper structures exist and can be used for custom types with the ability to add script-side functionality -4. Macros instantiations are automatically generated for native Bevy structures - 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| - -## Usage - -### Installation - -To install: - -- Add this crate to your Cargo.toml file dependencies - - The crate is still in development so I recommended pinning to a git commit -- Add ScriptingPlugin to your app -- Add the ScriptHosts you plan on using (`add_script_host`, `add_script_host_to_set`) - - Make sure to attach it to a system set running AFTER any systems which may generate modify/create/remove script components -- Add script handlers to capture events in the priority range you're expecting (`add_script_handler_to_set`,`add_script_handler`) -- Add systems which generate ScriptEvents corresponding to your script host -- Add systems which add ScriptCollection components to your entities and fill them with scripts - -An example can be seen below - -```rust, ignore - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - app.add_plugins(ScriptingPlugin) - .add_plugins(DefaultPlugins) - // pick and register only the hosts you want to use - // use any system set AFTER any systems which add/remove/modify script components - // in order for your script updates to propagate in a single frame - .add_script_host::>(PostUpdate) - .add_script_host::>(PostUpdate) - - // the handlers should be ran after any systems which produce script events. - // The PostUpdate set is okay only if your API doesn't require the core Bevy systems' commands - // to run beforehand. - // Note, this setup assumes a single script handler system set with all events having identical - // priority of zero (see examples for more complex scenarios) - .add_script_handler::, 0, 0>( - CoreSet::PostUpdate, - ) - .add_script_handler::, 0, 0>( - CoreSet::PostUpdate, - ) - - // generate events for scripts to pickup - .add_system(trigger_on_update_lua) - .add_system(trigger_on_update_rhai) - - // attach script components to entities - .add_startup_system(load_a_script); - app.run(); - - Ok(()) -} -``` - -### Firing Script Callbacks - -Scripts are activated by dispatching `ScriptEvents`. This crate employs custom priority event writers and readers, which means events are transmitted with an associated priority. This priority, in conjunction with your event pipeline, influences the sequence in which your events are processed. A priority of 0 is considered the highest. - -This mechanism can be utilized to construct game loops similar to those found in Unity or other game engines. - -An example event dispatching system can be seen below: - -```rust -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; - - -// event callback generator for lua -#[cfg(feature = "lua")] -pub fn trigger_on_update_lua(mut w: PriorityEventWriter>) { - let event = LuaEvent::<()> { - hook_name: "on_update".to_string(), - args: (), - recipients: Recipients::All - }; - - w.send(event,0); -} -``` - -### Adding scripts - -A script is composed of: - -- A reference to its code file, represented as an asset handle -- A name, typically the path relative to the assets folder - -Scripts are associated with entities through `bevy_mod_scripting::ScriptCollection` components, as illustrated below: - -```rust -use std::sync::Mutex; -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; - -// An example of a startup system which loads the lua script "console_integration.lua" -// placed in "assets/scripts/" and attaches it to a new entity -#[cfg(feature = "lua")] -pub fn load_a_script( - server: Res, - mut commands: Commands, -) { - // this handle is kept by the script so it will not be unloaded - let path = "scripts/console_integration.lua".to_string(); - let handle = server.load::(&path); - - - commands.spawn(()).insert(ScriptCollection:: { - scripts: vec![Script::::new( - path, handle, - )], - }); -} -``` - -### Defining an API - -To make an API accessible to your scripts, you need to implement the `APIProvider` trait. This can be registered with your script host using the `add_api_provider` method of `App`. `APIProviders` function similarly to plugins: - -```rust -use ::std::sync::Mutex; -use bevy_mod_scripting::prelude::*; - -#[cfg(feature = "lua")] -#[derive(Default)] -pub struct LuaAPI; - -#[cfg(feature = "lua")] -impl APIProvider for LuaAPI { - type APITarget = Mutex; - type DocTarget = LuaDocFragment; - type ScriptContext = Mutex; - - fn attach_api(&mut self, ctx: &mut Self::APITarget) -> Result<(),ScriptError> { - // ... access the lua context here when the script loads - Ok(()) - } -} -``` - -Register your API providers like so: - -```rust, ignore - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaAPI)) - //... -``` -The `APIProvider` interface also includes `setup_script` and `get_doc_fragment` methods. By default, these methods do not perform any operation. However, they can be utilized for specific purposes. For instance, `get_doc_fragment` can be used to generate documentation (refer to examples), and `setup_script` can ensure a one-time setup per script, like setting up a Lua package path. - -### Documentation Generation - -Documentation features are exposed at runtime via the `update_documentation` builder trait method for `App`: - -```rust, no_run -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin); - #[cfg(feature = "lua")] - { - app.add_script_host::>(PostUpdate) - // Note: This is a noop in optimized builds unless the `doc_always` feature is enabled! - // this will pickup any API providers added *BEFOREHAND* like this one - .add_api_provider::>(Box::new(LuaBevyAPIProvider)) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .update_documentation::>() - .add_script_handler::, 0, 0>(PostUpdate); - } - - Ok(()) -} - -``` -#### Lua - -`tealr`, a wrapper around the `mlua` crate, provides mechanisms for Lua documentation generation. It can generate `d.tl` files for static typing in Lua via the `teal` project, but using `teal` isn't necessary for documentation generation. - -See [this example](examples/lua/documentation_gen.rs) for a demonstration. - -The Bevy API documentation for this crate is auto-generated with each release and can be found [here](https://github.com/makspll/bevy_mod_scripting_lua) and [here](https://makspll.github.io/bevy_mod_scripting_lua/v0.3.0/). You may need to adjust the `page_root` in the auto-generated `assets/doc/tealr_doc_gen_config.json` file to a path like `assets/doc/YourAPI`. - -##### Teal - Lua static typing - -Teal is the recommended way of introducing lua to your bevy game. This functionality is locked behind the `teal` cargo feature however, since it's quite opinionanted when it comes to your asset structure (`script` and `scripts/build`, folders under `assets`), and also requires `lua` + `teal` + `tealr_doc_gen` (`cargo install --git https://github.com/lenscas/tealr_doc_gen --rev 91afd4a528e7f5b746ac3a6b299c422b42c05db6`) to be installed (see https://github.com/teal-language/tl and `tealr`). - -Once enabled, `.tl` files can be loaded as lua scripts in addition to `.lua` files and compiled on the fly. With full hot-reloading support. When you're ready to release your game, you just need to run `tl build` from the `assets/scripts` directory to compile your teal files. This will generate `.lua` files under `assets/scripts/build`. You can manage loading scripts using the [`bevy_mod_scripting::lua_path`] macro. - -If `teal` is enabled and you've added the `update_documentation` step to your app, every time you run/build your app in development the following will be generated/synced: - a `scripts/doc` directory containing documentation for your lua exposed API - a `scripts/types` directory containing `.d.tl` files for your lua IDE - a `scripts/tlconfig.lua` file will be generated _once_ if it does not yet exist - any scripts with a `.tl` extension will be compiled to lua code and type checked -On optimized release builds none of this happens (no debug_asserts). - -The recommended workflow is to use vscode and the official teal extension with an additional `tlconfig.lua` file at the **root** of your workspace with the -following content: - -```lua -return { - include_dir = { - "path_to_your_lib/", - } -} -``` - -## Configuration - -- `SCRIPT_DOC_DIR` - documentation is generated in `assets/scripts/docs` or to the path in this ENV variable if it's set. - -## Examples - -To see more complex applications of this library have a look at the examples: - -- [lua - complex game loop](examples/lua/complex_game_loop.rs) -- [lua - event recipients](examples/lua/event_recipients.rs) -- [lua - bevy API](examples/lua/bevy_api.rs) -- [rhai - bevy API](examples/rhai/bevy_api.rs) -- [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) - -Below is a video showcasing the game_of_life example: -[![Watch the video](https://img.youtube.com/vi/Mo9gh2g3ZHw/maxresdefault.jpg)](https://www.youtube.com/watch?v=Mo9gh2g3ZHw) - -# Compatibility - -| bevy_mod_scripting | bevy | -|---------------------|--------| -| 0.7 | 0.14 | -| 0.6 | 0.13.1 | +|Language | +|----| +|Lua| +|Lua51| +|Lua52| +|Lua53| +|Lua54| +|Luajit| +|Luajit52| +|Luau| +|Rhai| +|Rune| + +## Documentation + +For examples, installation and usage instructions see our shiny new [book](https://makspll.github.io/bevy_mod_scripting) \ No newline at end of file From 483ab27c06f6104d3499d0ec3b2bc4573fe514a7 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 14:47:22 +0000 Subject: [PATCH 143/217] remove teal features --- .github/workflows/bevy_mod_scripting.yml | 12 ++++++------ Cargo.toml | 8 +------- crates/languages/bevy_mod_scripting_lua/Cargo.toml | 3 --- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 2e1eb32795..29f8ceadfb 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -27,10 +27,10 @@ jobs: strategy: matrix: run_args: [ - {label: Windows - All Features, os: windows-latest, features: "lua54,rhai,teal,rune", cross: x86_64-pc-windows-msvc }, - {label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,teal,rune", cross: x86_64-apple-darwin }, - {label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,rune", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,teal,rune", cross: aarch64-unknown-linux-gnu }, + {label: Windows - All Features, os: windows-latest, features: "lua54,rhai,rune", cross: x86_64-pc-windows-msvc }, + {label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,rune", cross: x86_64-apple-darwin }, + {label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,rhai,rune", cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,rune", cross: aarch64-unknown-linux-gnu }, {label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51", cross: x86_64-unknown-linux-gnu }, {label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52", cross: x86_64-unknown-linux-gnu }, {label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53", cross: x86_64-unknown-linux-gnu }, @@ -96,7 +96,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: clippy - args: --features=lua54,rhai,teal,rune --profile=ephemeral-build -- -D warnings + args: --features=lua54,rhai,rune --profile=ephemeral-build -- -D warnings tests: name: Tests runs-on: ubuntu-latest @@ -116,7 +116,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: test - args: --workspace --features=lua54,rhai,teal,rune --profile=ephemeral-build + args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build docs: name: Docs runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index a21bbb7eb5..0bbc9dc763 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ name = "bevy_mod_scripting" path = "src/lib.rs" [package.metadata."docs.rs"] -features = ["lua", "lua54", "rhai", "teal", "rune"] +features = ["lua", "lua54", "rhai", "rune"] [features] ## core @@ -40,7 +40,6 @@ luau = ["bevy_mod_scripting_lua/luau", "lua"] # optional unsafe_lua_modules = ["bevy_mod_scripting_lua/unsafe_lua_modules"] -teal = ["bevy_mod_scripting_lua/teal"] mlua_serialize = ["bevy_mod_scripting_lua/mlua_serialize"] mlua_macros = ["bevy_mod_scripting_lua/mlua_macros"] mlua_async = ["bevy_mod_scripting_lua/mlua_async"] @@ -152,11 +151,6 @@ name = "coroutines_lua" path = "examples/lua/coroutines.rs" required-features = ["lua54"] -[[example]] -name = "documentation_gen_lua" -path = "examples/lua/documentation_gen.rs" -required-features = ["lua54", "teal"] - [[example]] name = "bevy_api_lua" path = "examples/lua/bevy_api.rs" diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 0406bdb59b..9d66ac5128 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -21,9 +21,6 @@ enable-features = ["lua54"] # enables loading possibly unsafe lua modules by lua scripts unsafe_lua_modules = [] -# enable teal utilities -teal = [] - lua51 = ["mlua/lua51"] lua52 = ["mlua/lua52"] lua53 = ["mlua/lua53"] From 53eb35f555bbef837fa6ec66a765586724f13ec2 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 14:54:19 +0000 Subject: [PATCH 144/217] complete first book deployment --- .github/workflows/mdbook.yml | 2 ++ docs/src/chapter_1.md | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mdbook.yml b/.github/workflows/mdbook.yml index 3cf89b1ea6..2a9dac9579 100644 --- a/.github/workflows/mdbook.yml +++ b/.github/workflows/mdbook.yml @@ -24,8 +24,10 @@ jobs: with: toolchain: stable override: true + - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 + - name: Install mdBook run: cargo install mdbook diff --git a/docs/src/chapter_1.md b/docs/src/chapter_1.md index 1259c54e97..93f9d2394a 100644 --- a/docs/src/chapter_1.md +++ b/docs/src/chapter_1.md @@ -3,4 +3,5 @@ ## Introduction -Welcome to the greatest documentation of all time WIP \ No newline at end of file +Welcome to the greatest documentation of all time WIP +test \ No newline at end of file From 5f1296f44ccee803df7875a39007ac594620aac8 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:34:36 +0000 Subject: [PATCH 145/217] enable more flags in bevy functions --- crates/bevy_mod_scripting_functions/Cargo.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index da75c7b755..8f54615154 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -18,6 +18,16 @@ readme = "readme.md" [dependencies] bevy = { workspace = true, features = [ "reflect_functions", + "bevy_asset", + "bevy_animation", + "bevy_core_pipeline", + "bevy_ui", + "bevy_pbr", + "bevy_render", + "bevy_text", + "bevy_sprite", + "file_watcher", + "multi_threaded" ] } uuid = "*" smol_str = "*" From 93f0cb24e33486b0bfff315bb1de970df69abb88 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:35:08 +0000 Subject: [PATCH 146/217] update docs and check.sh --- check.sh | 2 +- docs/src/SUMMARY.md | 3 ++- docs/src/chapter_1.md | 7 ----- docs/src/installation.md | 51 ++++++++++++++++++++++++++++++++++++ docs/src/managing-scripts.md | 45 +++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 9 deletions(-) delete mode 100644 docs/src/chapter_1.md create mode 100644 docs/src/installation.md create mode 100644 docs/src/managing-scripts.md diff --git a/check.sh b/check.sh index 18d7f7c1c4..31a157ed1d 100755 --- a/check.sh +++ b/check.sh @@ -6,5 +6,5 @@ CURRENT_DIR=$(basename "$PWD") if [[ "$CURRENT_DIR" == "bevy_api_gen" ]]; then cargo +nightly-2024-11-05 clippy --all-targets --message-format=json else - cargo clippy --workspace --all-targets --message-format=json --features="lua54 rhai teal rune bevy/file_watcher bevy/multi_threaded" + cargo clippy --workspace --all-targets --message-format=json --features="lua54 rhai rune bevy/file_watcher bevy/multi_threaded" fi diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 7390c82896..a85f909063 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,3 +1,4 @@ # Summary -- [Chapter 1](./chapter_1.md) +- [Installation](./installation.md) +- [Managing Scripts](./managing-scripts.md) \ No newline at end of file diff --git a/docs/src/chapter_1.md b/docs/src/chapter_1.md deleted file mode 100644 index 93f9d2394a..0000000000 --- a/docs/src/chapter_1.md +++ /dev/null @@ -1,7 +0,0 @@ -# Chapter 1 - - -## Introduction - -Welcome to the greatest documentation of all time WIP -test \ No newline at end of file diff --git a/docs/src/installation.md b/docs/src/installation.md new file mode 100644 index 0000000000..c0bae8982e --- /dev/null +++ b/docs/src/installation.md @@ -0,0 +1,51 @@ +# Installation + +## Cargo + +First you need to install the crate by adding this entry to your `Cargo.toml` dependencies list: + +```toml +bevy_mod_scripting = { version = "0.9.0", features = ["lua54"]} +``` + +Choose the language features you wish enabled and add them to the features block. + + +## Bevy Plugin + +The next step is to add the BMS plugin to your application, on top of any other extras you want included in your app: + +```rust,ignore +app.add_plugins(LuaScriptingPlugin::<()>::default()); +``` + +The above is how you'd setup BMS for Lua, if you want to use another language, simply use a corresponding plugin from the integration crate. + + +## Language Features + +Each language supported by BMS can be switched-on via feature flag as below: + +| Language | Feature Flag | +| ---- | ---- | +| Lua51 | lua51 | +| Lua52 | lua54 | +| Lua53 | lua53 | +| Lua54 | lua54 | +| Luajit | luajit | +| Luajit52 | luajit52 | +| Luau | luau | +| Rhai | rhai | +| Rune | rune | + +## Extra Features + +In order to fit as many use cases as possible, BMS allows you to disable a lot of its functionality. + +By default all of the useful features are enabled, but you may disable them if you wish if you are only needing BMS for script lifecycle management, and want to populate the bindings yourself. + +| Feature | Description | +| ---- | ---- | +| core_functions | If enabled, will enable all core functions, i.e. bevy integrations which let you interact with Bevy via reflection | +| bevy_bindings | If enabled, populates the function registry with additiona automatically generated bevy bindings. This includes functions on `glam` and `bevy::ecs` types. These are useful but will slow down compilation considerably. | + diff --git a/docs/src/managing-scripts.md b/docs/src/managing-scripts.md new file mode 100644 index 0000000000..36635d79c7 --- /dev/null +++ b/docs/src/managing-scripts.md @@ -0,0 +1,45 @@ +# Managing Scripts + +Scripts live in the standard bevy `assets` directory. Loading a script means: +- Parsing the script body +- Creating or updating the resources which store script state +- Assigning a name/id to the script so it can be referred to by the rest of the application. + +## Loading +BMS listens to `ScriptAsset` events and reacts accordingly. In order to load a script, all you need to do is request a handle to it via the asset server and store it somewhere. + +Below is an example system which loads a script called `assets/my_script.lua` and stores the handle in a local system parameter: + +```rust,ignore +fn load_script(server: Res, mut handle: Local>) { + let handle_ = server.load::("my_script.lua"); + *handle = handle_; +} +``` + +In practice you will likely store this handle in a resource or component, when your load all the scripts necessary for your application. + + +## Deleting scripts +In order to delete a previously loaded script, you will need to issue a `DeleteScript` command like so: + +```rust,ignore +DeleteScript::new("my_script.lua".into()) +``` + +This will delete references to the script and remove any internal handles to the asset. You will also need to clean up any handles to the asset you hold in your application in order for the asset to be unloaded. + +## Hot-loading scripts +To enable hot-loading of assets, you need to enable the necessary bevy features as normal [see the bevy cheatbook for instructions](https://bevy-cheatbook.github.io/assets/hot-reload.html). + +Assuming that hot-reloading is enabled for your app, any changes to script assets will automatically be picked up and the scripts re-loaded. + +## Manually (re)loading scripts +In order to manually re-load or load a script you can issue the `CreateOrUpdateScript` command: + +```rust,ignore +CreateOrUpdateScript::new("my_script.lua".into(), "print(\"hello world from new script body\")".into(), asset_handle) +``` + +## Loading timeframe +Scripts are processed via commands, so any asset events will be processed at the next command execution point running after BMS internal asset systems. \ No newline at end of file From 068e695fd07529315ec1d417b059099d8dcc4916 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:35:29 +0000 Subject: [PATCH 147/217] remove comment --- .../src/bindings/reference.rs | 226 ------------------ 1 file changed, 226 deletions(-) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index c7d184ee01..d9d65457c6 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -398,229 +398,3 @@ impl UserData for LuaStaticReflectReference { ); } } - -// #[cfg(test)] -// mod test { - -// use bevy::{ -// app::App, -// ecs::{reflect::AppTypeRegistry, world::World}, -// reflect::{FromReflect, OffsetAccess, Reflect}, -// }; -// use bevy_mod_scripting_core::{ -// bindings::ReflectAllocator, -// bindings::{ReflectBase, ReflectBaseType, WorldAccessGuard, WorldCallbackAccess}, -// }; -// use bevy_mod_scripting_derive::LuaProxy; - -// use crate::{bindings::world::LuaWorld, type_data::RegisterLua}; - -// use super::*; - -// #[derive(Reflect)] -// struct TestStruct { -// value: usize, -// proxy: TestProxied, -// proxies: Vec, -// } - -// #[derive(Reflect)] -// struct TestTupleStruct(usize, TestProxied, Vec); - -// #[derive(Reflect)] -// enum TestTupleEnum { -// Value(usize), -// Proxy(TestProxied), -// Proxies(Vec), -// } - -// #[derive(Reflect, LuaProxy)] -// #[proxy(bms_core_path = "bevy_mod_scripting_core", bms_lua_path = "crate")] -// #[reflect(LuaProxied)] -// pub struct TestProxied; - -// impl PartialEq for LuaTestProxied { -// fn eq(&self, other: &Self) -> bool { -// self.0 == other.0 -// } -// } - -// /// asserts that setting then indexing into a LuaReflectReference of type T with the given expression returns the expected value. -// /// Provides `t and `world` globals, with t being the LuaReflectReference to the provided value. -// fn assert_lua_set_get_returns< -// T: Reflect, -// F: Fn(ReflectReference) -> O, -// O: for<'l> FromLua<'l> + for<'l> IntoLua<'l> + PartialEq + std::fmt::Debug, -// >( -// mut world: &mut World, -// val: T, -// expr: &'static str, -// expected: F, -// ) { -// let lua = Lua::new(); -// let mut allocator = ReflectAllocator::default(); -// let reflect_ref = LuaReflectReference(ReflectReference::new_allocated(val, &mut allocator)); -// world.insert_resource(allocator); - -// WorldCallbackAccess::with_callback_access(world, |access| { -// let globals = lua.globals(); -// globals.set("test", reflect_ref.clone()).unwrap(); -// globals.set("world", LuaWorld(access.clone())).unwrap(); -// globals -// .set("expected", expected(reflect_ref.0.clone())) -// .unwrap(); - -// let lua_code = format!( -// r#" -// {expr} = expected -// return {expr} -// "# -// ); -// let result = lua -// .load(&lua_code) -// .into_function() -// .unwrap_or_else(|e| panic!("Could not load lua code into function: `{e}`")) -// .call(()) -// .unwrap_or_else(|e| { -// panic!("Could not convert expression value to expected type: `{e}`") -// }); -// let result: O = result; -// assert_eq!(result, expected(reflect_ref.0)); -// }); -// } - -// #[test] -// fn test_index_lua_value() { -// // so we have the registry and can just do this -// let mut app = App::new(); -// app.register_lua_value::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestStruct { -// value: 123, -// proxy: TestProxied, -// proxies: vec![], -// }, -// "test.value", -// |_| 123usize, -// ); - -// let mut app = App::new(); -// app.register_lua_value::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestTupleStruct(123, TestProxied, vec![]), -// "test._1", -// |_| 123usize, -// ); - -// let mut app = App::new(); -// app.register_lua_value::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestTupleEnum::Value(123usize), -// "test._1", -// |_| 123usize, -// ); -// } - -// #[test] -// fn test_index_lua_proxy() { -// // so we have the registry and can just do this -// let mut app = App::new(); -// app.register_lua_proxy::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestStruct { -// value: 123, -// proxy: TestProxied, -// proxies: vec![], -// }, -// "test.proxy", -// |mut r| { -// r.index_path(ParsedPath::parse_static("proxy").unwrap()); -// LuaTestProxied(r) -// }, -// ); - -// let mut app = App::new(); -// app.register_lua_proxy::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestTupleStruct(123, TestProxied, vec![]), -// "test._2", -// |mut r| { -// r.index_path(ParsedPath::parse_static(".1").unwrap()); -// LuaTestProxied(r) -// }, -// ); - -// let mut app = App::new(); -// app.register_lua_proxy::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestTupleEnum::Proxy(TestProxied), -// "test._1", -// |mut r| { -// r.index_path(ParsedPath::parse_static(".0").unwrap()); -// LuaTestProxied(r) -// }, -// ); -// } - -// #[test] -// fn test_index_lua_proxy_vec() { -// // so we have the registry and can just do this -// let mut app = App::new(); -// app.register_lua_proxy::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestStruct { -// value: 123, -// proxy: TestProxied, -// proxies: vec![TestProxied], -// }, -// "test.proxies[1]", -// |mut r| { -// r.index_path(ParsedPath::parse_static("proxies").unwrap()); -// r.index_path(ParsedPath::parse_static("[0]").unwrap()); -// LuaTestProxied(r) -// }, -// ); - -// let mut app = App::new(); -// app.register_lua_proxy::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestTupleStruct(123, TestProxied, vec![TestProxied]), -// "test._3[1]", -// |mut r| { -// r.index_path(ParsedPath::parse_static(".2").unwrap()); -// r.index_path(ParsedPath::parse_static("[0]").unwrap()); -// LuaTestProxied(r) -// }, -// ); - -// let mut app = App::new(); -// app.register_lua_proxy::(); - -// assert_lua_set_get_returns( -// app.world_mut(), -// TestTupleEnum::Proxies(vec![TestProxied]), -// "test._1[1]", -// |mut r| { -// r.index_path(ParsedPath::parse_static(".0").unwrap()); -// r.index_path(ParsedPath::parse_static("[0]").unwrap()); -// LuaTestProxied(r) -// }, -// ); -// } -// } From 548eeb740317b50b91d42ee8cadcd5ecf54c7827 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:49:05 +0000 Subject: [PATCH 148/217] update docs --- docs/src/controlling-script-bindings.md | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/src/controlling-script-bindings.md diff --git a/docs/src/controlling-script-bindings.md b/docs/src/controlling-script-bindings.md new file mode 100644 index 0000000000..660b0b1541 --- /dev/null +++ b/docs/src/controlling-script-bindings.md @@ -0,0 +1,26 @@ +# Controlling Script Bindings + +In this book we reffer to anything accessible by a script, which allows it to communicate with your Rust code a `binding` (which in previous versions was more generically referred to as a script API). + +The "binding" here being used as in: binding `script` code to `rust` code. + +## Function Registry + +Everything callable by scripts must first be registered in the dynamic function registry. Notably we do not make use of the normal bevy function registry to improve performance and usability. This means you cannot call just any function. + +In order for a function to be callable by a script it must adhere to a few requirements: +- Each argument must implement `FromScript`. +- Each return type must implement `IntoScript`. +- Each argument must also implement `GetInnerTypeDependencies` +- Each return type must also implement `GetInnerTypeDependencies` + +The into/from requirements allow us to convert these types to `ScriptValue`'s, and each supported scripting language can then marshall these into the script. + +Note these types are implemented for primitives, but if you want to interact with one of your `Reflect` implementing types, you will need to use one of `Ref`, `Mut` or `Val` wrappers in place of `&T`, `&mut T` and `T` respectively. + +These wrappers enable us to safely interact with bevy, and claim any necessary mutex'es on `Resources`, `Components` or `Allocations`. + +The `GetInnerTypeDependencies`, trait is simply a local trait alias for `GetTypeRegistration` with less strict type requirements. It allows us to register all the types necessary for the function calls, so that you don't have to register anything manually. If your type implements `GetTypeRegistration` you should not face any issues on this front. + + + From 478efdf266321f865a5616fdd531d5192c186a35 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:49:16 +0000 Subject: [PATCH 149/217] enable bevy input in functions for smol_str --- crates/bevy_mod_scripting_functions/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 8f54615154..bb40089c28 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -18,6 +18,7 @@ readme = "readme.md" [dependencies] bevy = { workspace = true, features = [ "reflect_functions", + "bevy_input", "bevy_asset", "bevy_animation", "bevy_core_pipeline", From 079ff47bd238a57eab44b6b0b5a7d698489558c7 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:54:33 +0000 Subject: [PATCH 150/217] it doens't exist --- crates/bevy_mod_scripting_functions/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index bb40089c28..8f54615154 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -18,7 +18,6 @@ readme = "readme.md" [dependencies] bevy = { workspace = true, features = [ "reflect_functions", - "bevy_input", "bevy_asset", "bevy_animation", "bevy_core_pipeline", From 71e6260086424ea6700e83fe7f02ba616b7d670e Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 16:56:09 +0000 Subject: [PATCH 151/217] add summary entry --- docs/src/SUMMARY.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index a85f909063..c6d20a071a 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,4 +1,5 @@ # Summary - [Installation](./installation.md) -- [Managing Scripts](./managing-scripts.md) \ No newline at end of file +- [Managing Scripts](./managing-scripts.md) +- [Controlling Script Bindings](./controlling-script-bindings.md) \ No newline at end of file From ca62197a4014071c884b2f87429a05c87cf095e5 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 17:02:10 +0000 Subject: [PATCH 152/217] add heading --- docs/src/SUMMARY.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index c6d20a071a..3065b90d48 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,5 +1,4 @@ -# Summary - +# Quick Start - [Installation](./installation.md) - [Managing Scripts](./managing-scripts.md) - [Controlling Script Bindings](./controlling-script-bindings.md) \ No newline at end of file From 1d578d43bc1c34efb77d47d60cccac44872b5be8 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 17:03:22 +0000 Subject: [PATCH 153/217] update check.ps1 and generate exe --- check.exe | Bin 26112 -> 26112 bytes check.ps1 | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/check.exe b/check.exe index 692eda88fb76ea326f6770b04065bba2ff6e8b12..e69db476314141b890ff041abaa4753a265cb706 100644 GIT binary patch delta 106 zcmV-w0G0oM%mIMR0g#9T&Bk_-i**iUdH?`d00000fB*o{1d$;VlOX}`0W6ad0uut6 z0h7^ODzi`mKpX*;vymQZ0g@mvvo9c-H4v}iy$e&14MwQ|rt6yYpY5~QRgeY&jFV|x MIgu~~v!YyH37du{lmGw# delta 109 zcmV-z0FwWJ%mIMR0g#9T2PtTgi**iYdH?`Z00000fB*o{1d$;VlOX}`0Wgyh0uutB z0h7^ODzi`mKpX*@vymQZ0R(hqVQiE7A2G8mAec1}eg$*-g;*d!t&zm=1rKySv(#0P P1_6+hWn4M4qFi1HU1lW> diff --git a/check.ps1 b/check.ps1 index 2f84d08820..f62f53e81f 100644 --- a/check.ps1 +++ b/check.ps1 @@ -5,5 +5,5 @@ $CURRENT_DIR = Split-Path -Leaf -Path (Get-Location) if ($CURRENT_DIR -eq "bevy_api_gen") { cargo +nightly-2024-12-15 clippy --all-targets --message-format=json } else { - cargo clippy --workspace --all-targets --message-format=json --features="lua54 rhai teal rune bevy/file_watcher bevy/multi_threaded" + cargo clippy --workspace --all-targets --message-format=json --features="lua54 rhai rune bevy/file_watcher bevy/multi_threaded" } \ No newline at end of file From a12b3e6783579aaec201b065b03441446e6a5c55 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 17:09:26 +0000 Subject: [PATCH 154/217] make headings better --- docs/src/SUMMARY.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 3065b90d48..3cca46c80a 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,4 +1,8 @@ -# Quick Start +# Summary + - [Installation](./installation.md) + +# Quick Start + - [Managing Scripts](./managing-scripts.md) - [Controlling Script Bindings](./controlling-script-bindings.md) \ No newline at end of file From d247deb3ec70c343ec94948d39ab13049eaa6f75 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 17:20:11 +0000 Subject: [PATCH 155/217] add argument conversion notes --- docs/src/controlling-script-bindings.md | 57 ++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/docs/src/controlling-script-bindings.md b/docs/src/controlling-script-bindings.md index 660b0b1541..fd5f5de3ac 100644 --- a/docs/src/controlling-script-bindings.md +++ b/docs/src/controlling-script-bindings.md @@ -4,7 +4,7 @@ In this book we reffer to anything accessible by a script, which allows it to co The "binding" here being used as in: binding `script` code to `rust` code. -## Function Registry +## Dynamic Functions Everything callable by scripts must first be registered in the dynamic function registry. Notably we do not make use of the normal bevy function registry to improve performance and usability. This means you cannot call just any function. @@ -22,5 +22,60 @@ These wrappers enable us to safely interact with bevy, and claim any necessary m The `GetInnerTypeDependencies`, trait is simply a local trait alias for `GetTypeRegistration` with less strict type requirements. It allows us to register all the types necessary for the function calls, so that you don't have to register anything manually. If your type implements `GetTypeRegistration` you should not face any issues on this front. +## Registering Script Functions +Registering functions can be done via the `NamespaceBuilder` like below: + +```rust,ignore + NamespaceBuilder::::new(&mut world) + .register( + "hello_world", + |s: String| { + println!(s) + }, + ); +``` + +This will allow you to call this function within lua like so: + +```lua +hello_world("hi from lua!") +``` + +## Context Arguments + +Each script function call always receives 2 context arguments, namely: +- `CallerContext` +- `WorldCallbackAccess` + +The first one is configured by the caller, and contains requests from the caller to your function, such as "I am calling you from a 1-indexed array system, please convert the index first", This argument is only relevant if you're targeting multiple languages. + +The second argument gives you access to the world from your function. + +You can opt-in to receive these arguments by adding them to your closure arguments in the above order (either both or just one) + +## Generic Arguments + +Sometimes you might want to be generic over the type of argument you're accepting, you can do so by accepting `ScriptValue` arguments like so: + +```rust,ignore + NamespaceBuilder::::new(&mut world) + .register( + "is_integer", + |s: ScriptValue| { + match s { + ScriptValue::Integer(i) => true, + _ => false + } + }, + ); +``` + +You can treat return values similarly. + +## Fallible functions + +Your script functions can return errors either by: +- Returning `Result` +- Returning `ScriptValue` and manually creating the `ScriptValue::Error(into_interop_erorr.into())` variant. From c3a4efe62eadeb358d1bce0fe40875457d4ec58e Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 17:42:44 +0000 Subject: [PATCH 156/217] pin smol str, begin rhai work --- .../bevy_mod_scripting_functions/Cargo.toml | 2 +- .../bevy_mod_scripting_functions/src/core.rs | 8 +- .../bevy_mod_scripting_rhai/Cargo.toml | 3 +- .../bevy_mod_scripting_rhai/src/assets.rs | 42 ---- .../bevy_mod_scripting_rhai/src/docs.rs | 17 -- .../bevy_mod_scripting_rhai/src/lib.rs | 192 ------------------ 6 files changed, 8 insertions(+), 256 deletions(-) delete mode 100644 crates/languages/bevy_mod_scripting_rhai/src/assets.rs delete mode 100644 crates/languages/bevy_mod_scripting_rhai/src/docs.rs diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 8f54615154..1ef274d575 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -30,5 +30,5 @@ bevy = { workspace = true, features = [ "multi_threaded" ] } uuid = "*" -smol_str = "*" +smol_str = "0.2.2" bevy_mod_scripting_core = { workspace = true } diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 23643c0b7e..22da5b6954 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -4,8 +4,7 @@ use std::borrow::Cow; use bevy::{ prelude::*, reflect::{ - func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, - ParsedPath, + func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, GetTypeRegistration, ParsedPath }, }; use bevy_mod_scripting_core::*; @@ -325,6 +324,11 @@ pub fn register_reflect_reference_functions( Ok(()) } + +trait Test: GetTypeRegistration {} + +// impl Test for smol_str::SmolStr {} + pub fn register_script_type_registration_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { diff --git a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index deb65b5e2c..00f3329500 100644 --- a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml @@ -17,6 +17,5 @@ path = "src/lib.rs" [dependencies] bevy = { workspace = true, default-features = false } -rhai = { version = "1.16", features = ["sync"] } +rhai = { version = "1.20.1", features = ["sync"] } bevy_mod_scripting_core = { workspace = true } -anyhow = "1.0.75" diff --git a/crates/languages/bevy_mod_scripting_rhai/src/assets.rs b/crates/languages/bevy_mod_scripting_rhai/src/assets.rs deleted file mode 100644 index 36b9249865..0000000000 --- a/crates/languages/bevy_mod_scripting_rhai/src/assets.rs +++ /dev/null @@ -1,42 +0,0 @@ -use bevy::{ - asset::{io::Reader, Asset, AssetLoader, LoadContext}, - reflect::TypePath, -}; - -use bevy_mod_scripting_core::prelude::*; - -#[derive(Asset, Debug, TypePath)] -/// A rhai code file in bytes -pub struct RhaiFile { - pub bytes: Vec, -} - -impl CodeAsset for RhaiFile { - fn bytes(&self) -> &[u8] { - self.bytes.as_slice() - } -} - -#[derive(Default)] -/// Asset loader for lua scripts -pub struct RhaiLoader; - -impl AssetLoader for RhaiLoader { - type Asset = RhaiFile; - type Settings = (); - type Error = anyhow::Error; - 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?; - Ok(RhaiFile { bytes }) - } - - fn extensions(&self) -> &[&str] { - &["rhai"] - } -} diff --git a/crates/languages/bevy_mod_scripting_rhai/src/docs.rs b/crates/languages/bevy_mod_scripting_rhai/src/docs.rs deleted file mode 100644 index 6fd312fee5..0000000000 --- a/crates/languages/bevy_mod_scripting_rhai/src/docs.rs +++ /dev/null @@ -1,17 +0,0 @@ -use bevy_mod_scripting_core::prelude::*; - -pub struct RhaiDocFragment; - -impl DocFragment for RhaiDocFragment { - fn merge(self, _o: Self) -> Self { - todo!() - } - - fn gen_docs(self) -> Result<(), ScriptError> { - todo!() - } - - fn name(&self) -> &'static str { - todo!() - } -} diff --git a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs index 267f2758ae..43ee61b3e5 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs @@ -157,195 +157,3 @@ pub fn with_world Result<(), ScriptError>>( f(context) }) } -// use crate::{ -// assets::{RhaiFile, RhaiLoader}, -// docs::RhaiDocFragment, -// }; -// use bevy::{ecs::schedule::ScheduleLabel, prelude::*}; -// use bevy_mod_scripting_core::{prelude::*, systems::*}; -// use rhai::*; -// use std::marker::PhantomData; - -// pub mod assets; -// pub mod docs; -// pub use rhai; -// pub mod prelude { -// pub use crate::{ -// assets::{RhaiFile, RhaiLoader}, -// docs::RhaiDocFragment, -// RhaiContext, RhaiEvent, RhaiScriptHost, -// }; -// pub use rhai; -// pub use rhai::{RhaiRuntime, FuncArgs}; -// } - -// #[derive(Resource)] -// pub struct RhaiScriptHost { -// pub RhaiRuntime: RhaiRuntime, -// _ph: PhantomData, -// } - -// #[allow(deprecated)] -// impl Default for RhaiScriptHost { -// fn default() -> Self { -// let mut e = RhaiRuntime::new(); -// // prevent shadowing of `state`,`world` and `entity` in variable in scripts -// e.on_def_var(|_, info, _| { -// Ok(info.name() != "state" && info.name() != "world" && info.name() != "entity") -// }); - -// Self { -// RhaiRuntime: e, -// _ph: Default::default(), -// } -// } -// } - -// pub struct RhaiContext { -// pub ast: AST, -// pub scope: Scope<'static>, -// } - -// #[derive(Clone, Event)] -// /// A Rhai Hook. The result of creating this event will be -// /// a call to the lua script with the hook_name and the given arguments -// pub struct RhaiEvent { -// pub hook_name: String, -// pub args: A, -// pub recipients: Recipients, -// } - -// impl ScriptEvent for RhaiEvent { -// fn recipients(&self) -> &crate::Recipients { -// &self.recipients -// } -// } - -// impl ScriptHost for RhaiScriptHost { -// type ScriptContext = RhaiContext; -// type ScriptEvent = RhaiEvent; -// type ScriptAsset = RhaiFile; -// type APITarget = RhaiRuntime; -// type DocTarget = RhaiDocFragment; - -// fn register_with_app_in_set( -// app: &mut bevy::prelude::App, -// schedule: impl ScheduleLabel, -// set: impl SystemSet, -// ) { -// app.add_priority_event::() -// .init_asset::() -// .init_asset_loader::() -// .init_resource::>() -// .init_resource::>() -// .init_resource::>() -// .register_type::>() -// .register_type::>() -// .register_type::>() -// .add_systems( -// schedule, -// ( -// script_add_synchronizer::, -// script_remove_synchronizer::, -// script_hot_reload_handler::, -// ) -// .chain() -// .in_set(set), -// ) -// // setup RhaiRuntime -// .add_systems( -// Startup, -// |mut providers: ResMut>, mut host: ResMut| { -// providers -// .attach_all(&mut host.RhaiRuntime) -// .expect("Error in adding api's for rhai"); -// }, -// ); -// } - -// fn setup_script( -// &mut self, -// script_data: &ScriptData, -// ctx: &mut Self::ScriptContext, -// providers: &mut APIProviders, -// ) -> Result<(), ScriptError> { -// providers.setup_all(script_data, ctx) -// } - -// fn load_script( -// &mut self, -// script: &[u8], -// script_data: &ScriptData, -// _: &mut APIProviders, -// ) -> Result { -// let mut scope = Scope::new(); -// let mut ast = self -// .RhaiRuntime -// .compile( -// std::str::from_utf8(script).map_err(|e| ScriptError::FailedToLoad { -// script: script_data.name.to_owned(), -// msg: e.to_string(), -// })?, -// ) -// .map_err(|e| ScriptError::SyntaxError { -// script: script_data.name.to_owned(), -// msg: e.to_string(), -// })?; - -// ast.set_source(script_data.name); - -// // persistent state for scripts -// scope.push("state", Map::new()); - -// Ok(RhaiContext { ast, scope }) -// } - -// fn handle_events<'a>( -// &mut self, -// world: &mut World, -// events: &[Self::ScriptEvent], -// ctxs: impl Iterator, &'a mut Self::ScriptContext)>, -// _providers: &mut APIProviders, -// ) { -// ctxs.for_each(|(fd, ctx)| { -// for event in events.iter() { -// // check if this script should handle this event -// if !event.recipients().is_recipient(&fd) { -// continue; -// }; - -// match self.RhaiRuntime.call_fn( -// &mut ctx.scope, -// &ctx.ast, -// &event.hook_name, -// event.args.clone(), -// ) { -// Ok(v) => v, -// Err(e) => { -// let mut state: CachedScriptState = world.remove_resource().unwrap(); - -// match *e { -// EvalAltResult::ErrorFunctionNotFound(..) => {} -// _ => { -// let (_, mut error_wrt, _) = state.event_state.get_mut(world); - -// let error = ScriptError::RuntimeError { -// script: fd.name.to_string(), -// msg: e.to_string(), -// }; -// error!("{}", error); -// error_wrt.send(ScriptErrorEvent { error }); -// } -// } - -// world.insert_resource(state); -// } -// }; -// } - -// // executing this at the end here means we execute global statements exactly once -// // all this method call does is set a variable on the AST to NONE so should not affect performance -// ctx.ast.clear_statements(); -// }); -// } -// } From 4872759a36d41d9f9a28ea25c156bbde7cd2b962 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 17:44:15 +0000 Subject: [PATCH 157/217] don't number installation page --- docs/src/SUMMARY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 3cca46c80a..7a6537bac6 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,6 +1,6 @@ # Summary -- [Installation](./installation.md) +[Installation](./installation.md) # Quick Start From 7ee53aa36004d650b0f7a2775f27d57325e81594 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 18:10:41 +0000 Subject: [PATCH 158/217] allow optionally disabling bindings --- Cargo.toml | 8 ++++- .../bevy_mod_scripting_functions/Cargo.toml | 3 +- .../bevy_mod_scripting_functions/src/core.rs | 35 +++++++++++++++---- .../bevy_mod_scripting_functions/src/lib.rs | 17 ++------- docs/src/installation.md | 5 +++ 5 files changed, 45 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0bbc9dc763..3895c4b15e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,8 @@ path = "src/lib.rs" features = ["lua", "lua54", "rhai", "rune"] [features] +default = ["core_functions", "bevy_bindings", "unsafe_lua_modules"] + ## core doc_always = ["bevy_mod_scripting_core/doc_always"] @@ -38,6 +40,10 @@ luajit = ["bevy_mod_scripting_lua/luajit", "lua"] luajit52 = ["bevy_mod_scripting_lua/luajit52", "lua"] luau = ["bevy_mod_scripting_lua/luau", "lua"] +# bindings +core_functions = ["bevy_mod_scripting_functions/core_functions"] +bevy_bindings = ["bevy_mod_scripting_functions/bevy_bindings"] + # optional unsafe_lua_modules = ["bevy_mod_scripting_lua/unsafe_lua_modules"] mlua_serialize = ["bevy_mod_scripting_lua/mlua_serialize"] @@ -62,7 +68,7 @@ bevy_mod_scripting_functions = { workspace = true } bevy = { version = "0.15.0", default-features = false } bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.9.0-alpha.1" } bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.9.0-alpha.1" } -bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1" } +bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1"} test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 1ef274d575..2d733efd9e 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -12,7 +12,8 @@ categories = ["game-development"] readme = "readme.md" [features] - +core_functions = [] +bevy_bindings = [] [dependencies] diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 22da5b6954..42424c47f4 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -23,11 +23,12 @@ use bindings::{ use error::{InteropError, InteropErrorInner}; use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; -use crate::{bevy_bindings::LuaBevyScriptingPlugin, namespaced_register::NamespaceBuilder}; +use crate::{namespaced_register::NamespaceBuilder}; pub fn register_bevy_bindings(app: &mut App) { - app.add_plugins(LuaBevyScriptingPlugin); + #[cfg(feature = "bevy_bindings")] + app.add_plugins(crate::bevy_bindings::LuaBevyScriptingPlugin); } pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { @@ -325,10 +326,6 @@ pub fn register_reflect_reference_functions( } -trait Test: GetTypeRegistration {} - -// impl Test for smol_str::SmolStr {} - pub fn register_script_type_registration_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { @@ -389,3 +386,29 @@ pub fn register_script_query_result_functions( }); Ok(()) } + +pub fn register_core_functions(app: &mut App) { + let world = app.world_mut(); + // we don't exclude from compilation here, + // since these are much smaller and still useful if not included initially + // perhaps people might want to include some but not all of these + + #[cfg(feature="core_functions")] + register_world_functions(world).expect("Failed to register world functions"); + + #[cfg(feature="core_functions")] + register_reflect_reference_functions(world) + .expect("Failed to register reflect reference functions"); + + #[cfg(feature="core_functions")] + register_script_type_registration_functions(world) + .expect("Failed to register script type registration functions"); + + #[cfg(feature="core_functions")] + register_script_query_builder_functions(world) + .expect("Failed to register script query builder functions"); + + #[cfg(feature="core_functions")] + register_script_query_result_functions(world) + .expect("Failed to register script query result functions"); +} diff --git a/crates/bevy_mod_scripting_functions/src/lib.rs b/crates/bevy_mod_scripting_functions/src/lib.rs index 0dcc70afee..3a446b9e7d 100644 --- a/crates/bevy_mod_scripting_functions/src/lib.rs +++ b/crates/bevy_mod_scripting_functions/src/lib.rs @@ -1,4 +1,5 @@ use ::bevy::prelude::*; +#[cfg(feature = "bevy_bindings")] pub mod bevy_bindings; pub mod core; @@ -12,20 +13,6 @@ pub struct ScriptFunctionsPlugin; impl Plugin for ScriptFunctionsPlugin { fn build(&self, app: &mut App) { register_bevy_bindings(app); - let world = app.world_mut(); - - register_world_functions(world).expect("Failed to register world functions"); - - register_reflect_reference_functions(world) - .expect("Failed to register reflect reference functions"); - - register_script_type_registration_functions(world) - .expect("Failed to register script type registration functions"); - - register_script_query_builder_functions(world) - .expect("Failed to register script query builder functions"); - - register_script_query_result_functions(world) - .expect("Failed to register script query result functions"); + register_core_functions(app); } } diff --git a/docs/src/installation.md b/docs/src/installation.md index c0bae8982e..b485ac9def 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -48,4 +48,9 @@ By default all of the useful features are enabled, but you may disable them if y | ---- | ---- | | core_functions | If enabled, will enable all core functions, i.e. bevy integrations which let you interact with Bevy via reflection | | bevy_bindings | If enabled, populates the function registry with additiona automatically generated bevy bindings. This includes functions on `glam` and `bevy::ecs` types. These are useful but will slow down compilation considerably. | +| mlua_async | Enables `mlua/async`| +| mlua_serialize | Enables `mlua/serialize` | +| mlua_macros | Enables `mlua/macros` | +| unsafe_lua_modules | Allows loading unsafe modules via `require` in lua | + From bb3e18d5c1c61ed311b21d87a59ba2b97a200d45 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 18:20:58 +0000 Subject: [PATCH 159/217] add error conversions for rhai --- Cargo.toml | 1 + crates/bevy_mod_scripting_core/Cargo.toml | 3 +++ crates/bevy_mod_scripting_core/src/error.rs | 21 +++++++++++++++++++ .../bevy_mod_scripting_rhai/Cargo.toml | 4 ++-- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3895c4b15e..f64c9b0d57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -71,6 +71,7 @@ bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1"} test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } +rhai = { version = "0.20" } [dev-dependencies] bevy = { workspace = true, default-features = true } diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index d1e6d0a0c7..c6981b2be7 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -21,9 +21,12 @@ doc_always = [] # if enabled enables some common mlua trait implementations mlua_impls = ["mlua"] +rhai_impls = ["rhai"] [dependencies] mlua = { optional = true, workspace = true } +rhai = { optional = true, workspace = true } + bevy = { workspace = true, default-features = false, features = [ "bevy_asset", "reflect_functions", diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index c550eecceb..803ec84c92 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -184,6 +184,27 @@ impl From for mlua::Error { } } +#[cfg(feature = "mlua_impls")] +impl From for ScriptError { + fn from(value: mlua::Error) -> Self { + ScriptError::from_mlua_error(value) + } +} + +#[cfg(feature = "rhai_impls")] +impl From for ScriptError { + fn from(value: rhai::ParseError) -> Self { + ScriptError::new_external(value) + } +} + +#[cfg(feature = "rhai_impls")] +impl From> for ScriptError { + fn from(value: Box) -> Self { + ScriptError::new_external(value) + } +} + #[derive(Debug, Clone, PartialEq, Reflect)] pub struct InteropError(#[reflect(ignore)] Arc); diff --git a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index 00f3329500..f545257c15 100644 --- a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml @@ -17,5 +17,5 @@ path = "src/lib.rs" [dependencies] bevy = { workspace = true, default-features = false } -rhai = { version = "1.20.1", features = ["sync"] } -bevy_mod_scripting_core = { workspace = true } +rhai = { workspace = true, features = ["sync"] } +bevy_mod_scripting_core = { workspace = true, features = ["rhai_impls"] } From 6a0ef2895cfbf599420da1ea966f6a4c3b850559 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 22:35:45 +0000 Subject: [PATCH 160/217] fix issue with unsafe_lua_modules and rhai --- .vscode/settings.json | 1 - Cargo.toml | 4 ++-- crates/languages/bevy_mod_scripting_lua/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 22a322ee64..ae2266a134 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,7 +11,6 @@ "rust-analyzer.rustc.source": "discover", "rust-analyzer.linkedProjects": [ "./crates/bevy_api_gen/Cargo.toml", - // "./crates/macro_tests/Cargo.toml", "Cargo.toml", ], "rust-analyzer.check.invocationStrategy": "per_workspace", diff --git a/Cargo.toml b/Cargo.toml index f64c9b0d57..dd87739541 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,10 +68,10 @@ bevy_mod_scripting_functions = { workspace = true } bevy = { version = "0.15.0", default-features = false } bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.9.0-alpha.1" } bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.9.0-alpha.1" } -bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1"} +bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1" } test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } -rhai = { version = "0.20" } +rhai = { version = "1.20.1" } [dev-dependencies] bevy = { workspace = true, default-features = true } diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 7a09c55544..dca7867dc6 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -125,7 +125,7 @@ pub fn lua_context_load( _: &mut (), ) -> Result { #[cfg(feature = "unsafe_lua_modules")] - let context = unsafe { Lua::unsafe_new() }; + let mut context = unsafe { Lua::unsafe_new() }; #[cfg(not(feature = "unsafe_lua_modules"))] let mut context = Lua::new(); From 144eaae8acef5bd8e27ae832df52e6395c1c12b7 Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 23:04:54 +0000 Subject: [PATCH 161/217] change handle to weak so unloading strong handle is enough to delete script, and update docs --- crates/bevy_mod_scripting_core/src/systems.rs | 2 +- docs/src/SUMMARY.md | 1 + docs/src/managing-scripts.md | 19 ++++---- docs/src/running-scripts.md | 47 +++++++++++++++++++ 4 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 docs/src/running-scripts.md diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 6119d90aaf..e9a39dd3e2 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -70,7 +70,7 @@ pub fn sync_script_data( commands.queue(CreateOrUpdateScript::::new( script_id, asset.content.clone(), - Some(script_assets.reserve_handle()), + Some(script_assets.reserve_handle().clone_weak()), )); } else { commands.queue(DeleteScript::::new(script_id)); diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 7a6537bac6..69651dd09e 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -5,4 +5,5 @@ # Quick Start - [Managing Scripts](./managing-scripts.md) +- [Running Scripts](./running-scripts.md) - [Controlling Script Bindings](./controlling-script-bindings.md) \ No newline at end of file diff --git a/docs/src/managing-scripts.md b/docs/src/managing-scripts.md index 36635d79c7..4687632156 100644 --- a/docs/src/managing-scripts.md +++ b/docs/src/managing-scripts.md @@ -17,15 +17,11 @@ fn load_script(server: Res, mut handle: Local>) } ``` -In practice you will likely store this handle in a resource or component, when your load all the scripts necessary for your application. +In practice you will likely store this handle in a resource or component, when your load all the scripts necessary for your application. +## Unloading +Scripts are automatically unloaded when the asset is dropped. This means that if you have a handle to a script and it goes out of scope, the script will be unloaded. -## Deleting scripts -In order to delete a previously loaded script, you will need to issue a `DeleteScript` command like so: - -```rust,ignore -DeleteScript::new("my_script.lua".into()) -``` This will delete references to the script and remove any internal handles to the asset. You will also need to clean up any handles to the asset you hold in your application in order for the asset to be unloaded. @@ -41,5 +37,12 @@ In order to manually re-load or load a script you can issue the `CreateOrUpdateS CreateOrUpdateScript::new("my_script.lua".into(), "print(\"hello world from new script body\")".into(), asset_handle) ``` -## Loading timeframe +## Manually Deleting scripts +In order to delete a previously loaded script, you will need to issue a `DeleteScript` command like so: + +```rust,ignore +DeleteScript::new("my_script.lua".into()) +``` + +## Loading/Unloading timeframe Scripts are processed via commands, so any asset events will be processed at the next command execution point running after BMS internal asset systems. \ No newline at end of file diff --git a/docs/src/running-scripts.md b/docs/src/running-scripts.md new file mode 100644 index 0000000000..9a710f9955 --- /dev/null +++ b/docs/src/running-scripts.md @@ -0,0 +1,47 @@ +# Attaching Scripts + +Once you have scripts discovered and loaded, you'll want to run them. At the moment BMS supports one method of triggering scripts, and that is by attaching them to entities via `ScriptComponent`'s and then sending script event's which trigger callbacks on the scripts. + +In order to attach a script and make it runnable simply add a `ScriptComponent` to an entity +```rust,ignore + commands.entity(my_entity).insert(ScriptComponent::new(vec!["my_script.lua", "my_other_script.lua"])); +``` + +# Running Scripts + +Scripts can run logic either when loaded or when triggered by an event. For example the script: + +```lua +print("hello from load time") +function on_event() + print("hello from event time") +end +``` + +Will print "hello from load time" when the script is loaded, and "hello from event time" when the script receives an event targeting the `on_event` callback with a receiver list including this script or entity. + +In order to trigger `on_event` you need to first define a label, then send an event containing the label: +```rust,ignore +// define the label +struct OnEventCallback; +impl IntoCallbackLabel for OnEventCallback { + fn into_callback_label() -> CallbackLabel { + "on_event".into() + } +} + +// trigger the event +fn send_event(mut writer: EventWriter>) { + writer.send(ScriptCallbackEvent::new_for_all( + OnEventCallback::into_callback_label(), + (), + )); +} +``` + +Note the `()` corresponds to the payload for the event, i.e. in this case we are not sending any arguments. + +TODO: this should be replaced with `ScriptValue` before release +``` +assert!(false, "TODO: replace with ScriptValue"); +``` \ No newline at end of file From 9adbe3f38adbdee20d4fae425519c2dea1bb5d9d Mon Sep 17 00:00:00 2001 From: makspll Date: Thu, 2 Jan 2025 23:06:17 +0000 Subject: [PATCH 162/217] add more conversions --- crates/bevy_mod_scripting_core/src/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index 803ec84c92..b1feaf048d 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -3,6 +3,7 @@ use std::{ borrow::Cow, fmt::{Debug, Display}, ops::{Deref, DerefMut}, + str::Utf8Error, sync::Arc, }; @@ -224,6 +225,12 @@ impl From for ScriptError { } } +impl From for ScriptError { + fn from(val: Utf8Error) -> Self { + ScriptError::new_external(val) + } +} + pub trait FlattenError { fn flatten_interop_error(self) -> Result; } From ca05cced91d30b318fabb68c3411fab2626b213b Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 3 Jan 2025 00:04:35 +0000 Subject: [PATCH 163/217] start cleaning up examples, use ScriptValue as argument for all things --- Cargo.toml | 17 --- crates/bevy_mod_scripting_core/src/event.rs | 33 ++++- crates/bevy_mod_scripting_core/src/handler.rs | 12 +- crates/bevy_mod_scripting_core/src/lib.rs | 16 +-- crates/bevy_mod_scripting_core/src/systems.rs | 55 ++++---- .../bevy_mod_scripting_lua/src/lib.rs | 28 ++-- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 9 +- .../bevy_mod_scripting_rhai/src/lib.rs | 21 ++- docs/src/installation.md | 2 +- docs/src/running-scripts.md | 22 +--- examples/lua/coroutines.rs | 50 -------- examples/lua/documentation_gen.rs | 99 --------------- examples/lua/event_recipients.rs | 62 --------- examples/lua/game_of_life.rs | 25 +--- examples/wrappers.rs | 120 ------------------ 15 files changed, 108 insertions(+), 463 deletions(-) delete mode 100644 examples/lua/coroutines.rs delete mode 100644 examples/lua/documentation_gen.rs delete mode 100644 examples/lua/event_recipients.rs delete mode 100644 examples/wrappers.rs diff --git a/Cargo.toml b/Cargo.toml index dd87739541..a7166e1ce4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -123,10 +123,6 @@ name = "console_integration_rhai" path = "examples/rhai/console_integration.rs" required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] -[[example]] -name = "complex_game_loop_lua" -path = "examples/lua/complex_game_loop.rs" -required-features = ["lua54"] [[example]] name = "dynamic_queries_lua" @@ -148,15 +144,6 @@ required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] name = "game_of_life_rhai" path = "examples/rhai/game_of_life.rs" -[[example]] -name = "event_recipients_lua" -path = "examples/lua/event_recipients.rs" -required-features = ["lua54"] - -[[example]] -name = "coroutines_lua" -path = "examples/lua/coroutines.rs" -required-features = ["lua54"] [[example]] name = "bevy_api_lua" @@ -168,10 +155,6 @@ name = "bevy_api_rhai" path = "examples/rhai/bevy_api.rs" required-features = ["rhai"] -[[example]] -name = "wrappers" -path = "examples/wrappers.rs" -required-features = ["lua54"] [[example]] name = "minimal_rune" diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index 2921d19c58..5e6ac51433 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -1,6 +1,6 @@ use bevy::{ecs::entity::Entity, prelude::Event}; -use crate::{error::ScriptError, handler::Args, script::ScriptId}; +use crate::{error::ScriptError, handler::Args, prelude::ScriptValue, script::ScriptId}; /// An error coming from a script #[derive(Debug, Event)] @@ -50,6 +50,23 @@ impl CallbackLabel { } } +#[macro_export] +macro_rules! callback_labels { + ($($name:ident => $label:expr),*) => { + pub enum CallbackLabels { + $($name),* + } + + impl IntoCallbackLabel for CallbackLabels { + fn into_callback_label() -> CallbackLabel { + match self { + $(CallbackLabels::$name => $label.into()),* + } + } + } + }; +} + pub trait IntoCallbackLabel { fn into_callback_label() -> CallbackLabel; } @@ -90,14 +107,18 @@ pub enum Recipients { /// A callback event meant to trigger a callback in a subset/set of scripts in the world with the given arguments #[derive(Clone, Event, Debug)] -pub struct ScriptCallbackEvent { +pub struct ScriptCallbackEvent { pub label: CallbackLabel, pub recipients: Recipients, - pub args: A, + pub args: Vec, } -impl ScriptCallbackEvent { - pub fn new>(label: L, args: A, recipients: Recipients) -> Self { +impl ScriptCallbackEvent { + pub fn new>( + label: L, + args: Vec, + recipients: Recipients, + ) -> Self { Self { label: label.into(), args, @@ -105,7 +126,7 @@ impl ScriptCallbackEvent { } } - pub fn new_for_all>(label: L, args: A) -> Self { + pub fn new_for_all>(label: L, args: Vec) -> Self { Self::new(label, args, Recipients::All) } } diff --git a/crates/bevy_mod_scripting_core/src/handler.rs b/crates/bevy_mod_scripting_core/src/handler.rs index 63bc1e0819..3df5818d17 100644 --- a/crates/bevy_mod_scripting_core/src/handler.rs +++ b/crates/bevy_mod_scripting_core/src/handler.rs @@ -3,7 +3,7 @@ use bevy::ecs::{entity::Entity, system::Resource, world::World}; use crate::{ context::{Context, ContextPreHandlingInitializer}, event::CallbackLabel, - prelude::ScriptError, + prelude::{ScriptError, ScriptValue}, runtime::Runtime, script::ScriptId, }; @@ -11,8 +11,8 @@ use crate::{ pub trait Args: Clone + Send + Sync + 'static {} impl Args for T {} -pub type HandlerFn = fn( - args: A, +pub type HandlerFn = fn( + args: Vec, entity: Entity, script_id: &ScriptId, callback: &CallbackLabel, @@ -24,11 +24,11 @@ pub type HandlerFn = fn( /// A resource that holds the settings for the callback handler for a specific combination of type parameters #[derive(Resource)] -pub struct CallbackSettings { - pub callback_handler: Option>, +pub struct CallbackSettings { + pub callback_handler: Option>, } -impl Default for CallbackSettings { +impl Default for CallbackSettings { fn default() -> Self { Self { callback_handler: None, diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index b5c2347b84..95ee688d4d 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -40,20 +40,20 @@ pub mod prelude { } /// Bevy plugin enabling scripting within the bevy mod scripting framework -pub struct ScriptingPlugin { +pub struct ScriptingPlugin { /// Callback for initiating the runtime pub runtime_builder: fn() -> R, /// Settings for the runtime pub runtime_settings: Option>, /// The handler used for executing callbacks in scripts - pub callback_handler: Option>, + pub callback_handler: Option>, /// The context builder for loading contexts pub context_builder: Option>, /// The context assigner for assigning contexts to scripts, if not provided default strategy of keeping each script in its own context is used pub context_assigner: Option>, } -impl Default for ScriptingPlugin { +impl Default for ScriptingPlugin { fn default() -> Self { Self { runtime_builder: R::default, @@ -65,10 +65,10 @@ impl Default for ScriptingPlugin Plugin for ScriptingPlugin { +impl Plugin for ScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { app.add_event::() - .add_event::>() + .add_event::() .init_resource::() .init_resource::() .init_resource::() @@ -84,7 +84,7 @@ impl Plugin for ScriptingPlugin { runtime: (self.runtime_builder)(), }) .init_non_send_resource::>() - .insert_resource::>(CallbackSettings { + .insert_resource::>(CallbackSettings { callback_handler: self.callback_handler, }) .insert_resource::>(ContextLoadingSettings { @@ -224,13 +224,13 @@ mod test { #[derive(Default, Clone)] struct R; app.add_plugins(AssetPlugin::default()); - app.add_plugins(ScriptingPlugin::::default()); + app.add_plugins(ScriptingPlugin::::default()); assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::>()); - assert!(app.world().contains_resource::>()); + assert!(app.world().contains_resource::>()); assert!(app .world() .contains_resource::>()); diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index e9a39dd3e2..0ec7388f65 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -94,8 +94,8 @@ macro_rules! push_err_and_continue { pub fn event_handler( world: &mut World, params: &mut SystemState<( - EventReader>, - Res>, + EventReader, + Res>, Res>, Res, Query<(Entity, Ref)>, @@ -232,6 +232,7 @@ mod test { use crate::{ event::CallbackLabel, handler::HandlerFn, + prelude::ScriptValue, script::{Script, ScriptId}, }; @@ -249,20 +250,20 @@ mod test { } struct TestContext { - pub invocations: Vec, + pub invocations: Vec, } fn setup_app( - handler_fn: HandlerFn, + handler_fn: HandlerFn, runtime: R, contexts: HashMap, scripts: HashMap, ) -> App { let mut app = App::new(); - app.add_event::>(); + app.add_event::(); app.add_event::(); - app.insert_resource::>(CallbackSettings { + app.insert_resource::>(CallbackSettings { callback_handler: Some(handler_fn), }); app.add_systems(Update, event_handler::); @@ -301,7 +302,7 @@ mod test { }; let mut app = setup_app::( |args, entity, script, _, ctxt, _, runtime, _| { - ctxt.invocations.push(args); + ctxt.invocations.extend(args); runtime.invocations.push((entity, script.clone())); Ok(()) }, @@ -314,11 +315,10 @@ mod test { .spawn(ScriptComponent(vec![test_script_id.clone()])) .id(); - app.world_mut() - .send_event(ScriptCallbackEvent::::new_for_all( - OnTestCallback::into_callback_label(), - "test_args".to_owned(), - )); + app.world_mut().send_event(ScriptCallbackEvent::new_for_all( + OnTestCallback::into_callback_label(), + vec![ScriptValue::String("test_args".into())], + )); app.update(); let test_context = app @@ -336,7 +336,7 @@ mod test { .get(&test_ctxt_id) .unwrap() .invocations, - vec!["test_args"] + vec![ScriptValue::String("test_args".into())] ); assert_eq!( @@ -389,7 +389,7 @@ mod test { }; let mut app = setup_app::( |args, entity, script, _, ctxt, _, runtime, _| { - ctxt.invocations.push(args); + ctxt.invocations.extend(args); runtime.invocations.push((entity, script.clone())); Ok(()) }, @@ -402,19 +402,17 @@ mod test { .spawn(ScriptComponent(vec![test_script_id.clone()])) .id(); - app.world_mut() - .send_event(ScriptCallbackEvent::::new( - OnTestCallback::into_callback_label(), - "test_args_script".to_owned(), - crate::event::Recipients::Script(test_script_id.clone()), - )); + app.world_mut().send_event(ScriptCallbackEvent::new( + OnTestCallback::into_callback_label(), + vec![ScriptValue::String("test_args_script".into())], + crate::event::Recipients::Script(test_script_id.clone()), + )); - app.world_mut() - .send_event(ScriptCallbackEvent::::new( - OnTestCallback::into_callback_label(), - "test_args_entity".to_owned(), - crate::event::Recipients::Entity(test_entity_id), - )); + app.world_mut().send_event(ScriptCallbackEvent::new( + OnTestCallback::into_callback_label(), + vec![ScriptValue::String("test_args_entity".into())], + crate::event::Recipients::Entity(test_entity_id), + )); app.update(); @@ -433,7 +431,10 @@ mod test { .get(&test_ctxt_id) .unwrap() .invocations, - vec!["test_args_script", "test_args_entity"] + vec![ + ScriptValue::String("test_args_script".into()), + ScriptValue::String("test_args_entity".into()) + ] ); assert_eq!( diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index dca7867dc6..ab5414aa68 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -6,7 +6,9 @@ use bevy::{ reflect::{impl_reflect, FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, }; use bevy_mod_scripting_core::{ - bindings::{ReflectAllocator, ReflectReference, WorldCallbackAccess}, + bindings::{ + script_value::ScriptValue, ReflectAllocator, ReflectReference, WorldCallbackAccess, + }, context::{ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, error::ScriptError, event::CallbackLabel, @@ -19,6 +21,7 @@ use bindings::{ // providers::bevy_ecs::LuaEntity, // proxy::LuaProxied, reference::{LuaReflectReference, LuaStaticReflectReference}, + script_value::LuaScriptValue, world::{GetWorld, LuaWorld}, }; pub use mlua; @@ -32,21 +35,18 @@ pub mod prelude { pub use crate::mlua::{self, prelude::*, Value}; } -pub trait LuaEventArg: Args + IntoLuaMulti {} -impl LuaEventArg for T {} - -pub struct LuaScriptingPlugin { - pub scripting_plugin: ScriptingPlugin, +pub struct LuaScriptingPlugin { + pub scripting_plugin: ScriptingPlugin, } -impl Default for LuaScriptingPlugin { +impl Default for LuaScriptingPlugin { fn default() -> Self { LuaScriptingPlugin { scripting_plugin: ScriptingPlugin { context_assigner: None, runtime_builder: Default::default, runtime_settings: None, - callback_handler: Some(lua_handler::), + callback_handler: Some(lua_handler), context_builder: Some(ContextBuilder:: { load: lua_context_load, reload: lua_context_reload, @@ -56,7 +56,7 @@ impl Default for LuaScriptingPlugin { } } -impl Plugin for LuaScriptingPlugin { +impl Plugin for LuaScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); // register_lua_values(app); @@ -169,8 +169,8 @@ pub fn lua_context_reload( } #[allow(clippy::too_many_arguments)] -pub fn lua_handler( - args: A, +pub fn lua_handler( + args: Vec, entity: bevy::ecs::entity::Entity, script_id: &ScriptId, callback_label: &CallbackLabel, @@ -191,7 +191,11 @@ pub fn lua_handler( }; handler - .call::<()>(args) + .call::<()>( + args.into_iter() + .map(LuaScriptValue::from) + .collect::>(), + ) .map_err(ScriptError::from_mlua_error)?; Ok(()) }) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index b8eff99d8b..7a096285fc 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -7,8 +7,9 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{ - access_map::ReflectAccessId, pretty_print::DisplayWithWorld, ReflectAllocator, - ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, + access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_value::ScriptValue, + ReflectAllocator, ReflectReference, ScriptTypeRegistration, WorldAccessGuard, + WorldCallbackAccess, }, context::ContextLoadingSettings, error::ScriptError, @@ -47,7 +48,7 @@ fn init_app() -> App { // we probably should cut down some fat in here, but it's fast enough so meh app.add_plugins(AssetPlugin::default()) .add_plugins(HierarchyPlugin) - .add_plugins(LuaScriptingPlugin::<()>::default()) + .add_plugins(LuaScriptingPlugin::default()) .add_plugins(ScriptFunctionsPlugin); // for some reason hierarchy plugin doesn't register the children component @@ -214,7 +215,7 @@ impl Test { })?; lua_handler( - (), + vec![ScriptValue::Unit], Entity::from_raw(1), &(self.name()).into(), &CallbackLabel::new("on_test").ok_or("invalid callback label")?, diff --git a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs index 43ee61b3e5..9de9961ae0 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs @@ -3,7 +3,7 @@ use bevy::{ ecs::{entity::Entity, world::World}, }; use bevy_mod_scripting_core::{ - bindings::WorldCallbackAccess, + bindings::{script_value::ScriptValue, WorldCallbackAccess}, context::{ContextAssigner, ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, error::ScriptError, event::CallbackLabel, @@ -19,9 +19,6 @@ pub mod prelude { pub use rhai::FuncArgs; } -pub trait RhaiEventArg: Args + FuncArgs {} -impl RhaiEventArg for T {} - pub type RhaiRuntime = Engine; pub struct RhaiScriptContext { @@ -29,17 +26,17 @@ pub struct RhaiScriptContext { pub scope: Scope<'static>, } -pub struct RhaiScriptingPlugin { - pub scripting_plugin: ScriptingPlugin, +pub struct RhaiScriptingPlugin { + pub scripting_plugin: ScriptingPlugin, } -impl Default for RhaiScriptingPlugin { +impl Default for RhaiScriptingPlugin { fn default() -> Self { RhaiScriptingPlugin { scripting_plugin: ScriptingPlugin { runtime_builder: RhaiRuntime::new, runtime_settings: None, - callback_handler: Some(rhai_callback_handler::), + callback_handler: Some(rhai_callback_handler), context_assigner: None, context_builder: Some(ContextBuilder { load: rhai_context_load, @@ -50,7 +47,7 @@ impl Default for RhaiScriptingPlugin { } } -impl Plugin for RhaiScriptingPlugin { +impl Plugin for RhaiScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); } @@ -71,7 +68,7 @@ pub fn rhai_context_load( ast, scope: Scope::new(), }; - with_world(world, &mut context, |mut context| { + with_world(world, &mut context, |context| { initializers .iter() .try_for_each(|init| init(script, context))?; @@ -110,8 +107,8 @@ pub fn rhai_context_reload( } #[allow(clippy::too_many_arguments)] -pub fn rhai_callback_handler( - args: A, +pub fn rhai_callback_handler( + args: Vec, entity: Entity, script_id: &ScriptId, callback: &CallbackLabel, diff --git a/docs/src/installation.md b/docs/src/installation.md index b485ac9def..0d134682fe 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -16,7 +16,7 @@ Choose the language features you wish enabled and add them to the features block The next step is to add the BMS plugin to your application, on top of any other extras you want included in your app: ```rust,ignore -app.add_plugins(LuaScriptingPlugin::<()>::default()); +app.add_plugins(LuaScriptingPlugin::default()); ``` The above is how you'd setup BMS for Lua, if you want to use another language, simply use a corresponding plugin from the integration crate. diff --git a/docs/src/running-scripts.md b/docs/src/running-scripts.md index 9a710f9955..805889d8d5 100644 --- a/docs/src/running-scripts.md +++ b/docs/src/running-scripts.md @@ -22,26 +22,16 @@ Will print "hello from load time" when the script is loaded, and "hello from eve In order to trigger `on_event` you need to first define a label, then send an event containing the label: ```rust,ignore -// define the label -struct OnEventCallback; -impl IntoCallbackLabel for OnEventCallback { - fn into_callback_label() -> CallbackLabel { - "on_event".into() - } -} +// define the label, you can define as many as you like here +callback_labels!(OnEvent => "on_event"); // trigger the event -fn send_event(mut writer: EventWriter>) { +fn send_event(mut writer: EventWriter) { writer.send(ScriptCallbackEvent::new_for_all( - OnEventCallback::into_callback_label(), - (), + CallbackLabels::OnEvent, + vec![ScriptValue::Unit], )); } ``` -Note the `()` corresponds to the payload for the event, i.e. in this case we are not sending any arguments. - -TODO: this should be replaced with `ScriptValue` before release -``` -assert!(false, "TODO: replace with ScriptValue"); -``` \ No newline at end of file +Note the second argument is the payload we are sending with the event, in this case we are sending an empty payload. \ No newline at end of file diff --git a/examples/lua/coroutines.rs b/examples/lua/coroutines.rs deleted file mode 100644 index 9c41bb56a7..0000000000 --- a/examples/lua/coroutines.rs +++ /dev/null @@ -1,50 +0,0 @@ -use asset::ScriptAsset; -use bevy::prelude::*; -use bevy_mod_scripting::lua::LuaScriptingPlugin; -use bevy_mod_scripting::prelude::*; -use script::ScriptComponent; - -struct OnEventCallback; -impl IntoCallbackLabel for OnEventCallback { - fn into_callback_label() -> CallbackLabel { - "on_update".into() - } -} - -fn load_script( - server: Res, - mut commands: Commands, - mut handle: Local>, -) { - let path = "scripts/coroutines.lua"; - let handle_ = server.load::(path); - *handle = handle_; - - commands.spawn(ScriptComponent::new(vec![path.into()])); -} - -fn send_event(mut writer: EventWriter>) { - writer.send(ScriptCallbackEvent::new_for_all( - OnEventCallback::into_callback_label(), - (), - )); -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins) - .add_plugins(LuaScriptingPlugin::<()>::default()) - .add_systems(Startup, load_script) - .add_systems( - Update, - ( - send_event, - event_handler::.after(send_event), - ), - ); - - app.run(); - - Ok(()) -} diff --git a/examples/lua/documentation_gen.rs b/examples/lua/documentation_gen.rs deleted file mode 100644 index 12e8e59ed7..0000000000 --- a/examples/lua/documentation_gen.rs +++ /dev/null @@ -1,99 +0,0 @@ -use bevy::prelude::*; - -use bevy_mod_scripting::{api::impl_tealr_type, prelude::*}; - -use std::sync::Mutex; - -#[derive(Clone)] -pub struct MyLuaArg; - -impl<'lua> IntoLua<'lua> for MyLuaArg { - fn into_lua(self, _lua: &'lua Lua) -> mlua::Result> { - Ok(Value::Nil) - } -} - -#[derive(Clone)] -/// This is acts as a documentation and function holder -/// We can add some general documentation about what it holds -/// but also specific function level documenation -pub struct APIModule; - -impl_tealr_type!(APIModule); - -impl TealData for APIModule { - fn add_methods<'lua, T: tealr::mlu::TealDataMethods<'lua, Self>>(methods: &mut T) { - methods - .document_type("This is type level documentation for our api, it will be shown first"); - methods.document_type(""); - - methods.document("Here we document the next function"); - methods.document("## Markdown!:"); - methods.document( - "```lua - local hello = \"string\" - \n```", - ); - methods.add_function("my_function", |_, ()| Ok("hello world!")); - methods.generate_help(); - } -} - -/// This is tealr's way to export global items -/// Here `my_api` will be available globally in the lua script - -#[derive(Default)] -struct Export; -impl tealr::mlu::ExportInstances for Export { - fn add_instances<'lua, T: tealr::mlu::InstanceCollector<'lua>>( - self, - instance_collector: &mut T, - ) -> mlua::Result<()> { - instance_collector.document_instance("Documentation for the exposed global variable"); - instance_collector.add_instance("my_api", |_| Ok(APIModule))?; - - Ok(()) - } -} - -#[derive(Default)] -pub struct LuaAPIProvider; - -impl APIProvider for LuaAPIProvider { - type APITarget = Mutex; - type DocTarget = LuaDocFragment; - type ScriptContext = Mutex; - - fn attach_api(&mut self, _ctx: &mut Self::APITarget) -> Result<(), ScriptError> { - Ok(()) - } - - fn get_doc_fragment(&self) -> Option { - Some(LuaDocFragment::new("MyAPI", |tw| - // we must select items we want included in the documentation - tw.process_type::() - .document_global_instance::().unwrap())) - } - - fn register_with_app(&self, _app: &mut App) {} -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - // add the providers and script host - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaAPIProvider)) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_api_provider::>(Box::new(LuaBevyAPIProvider)) - // this needs to be placed after any `add_api_provider` and `add_script_host` calls - // it will generate `doc` and `types` folders under `assets/scripts` containing the documentation and teal declaration files - // respectively. See example asset folder to see how they look like. The `teal_file.tl` script in example assets shows the usage of one of those - // declaration files, use the teal vscode extension to explore the type hints! - // Note: This is a noop in optimized builds unless the `doc_always` feature is enabled! - .update_documentation::>() - .add_script_handler::, 0, 0>(PostUpdate); - Ok(()) -} diff --git a/examples/lua/event_recipients.rs b/examples/lua/event_recipients.rs deleted file mode 100644 index 861b88381b..0000000000 --- a/examples/lua/event_recipients.rs +++ /dev/null @@ -1,62 +0,0 @@ -use bevy::{app::AppExit, core::FrameCount, prelude::*}; -use bevy_mod_scripting::lua::LuaScriptingPlugin; -use bevy_mod_scripting::prelude::*; -use bevy_mod_scripting_core::{asset::ScriptAsset, script::ScriptComponent}; - -fn load_script( - server: Res, - mut commands: Commands, - mut handle: Local>, -) { - let path = "scripts/event_recipients.lua"; - let handle_ = server.load::(path); - *handle = handle_; - - commands.spawn(ScriptComponent::new(vec![path.into()])); - commands.spawn(ScriptComponent::new(vec![path.into()])); -} - -fn trigger_script_callback(mut writer: EventWriter>) { - writer.send(ScriptCallbackEvent::new_for_all( - OnEventCallback::into_callback_label(), - 1, - )); - - writer.send(ScriptCallbackEvent::new( - OnEventCallback::into_callback_label(), - 2, - Recipients::Entity(Entity::from_raw(6)), - )); -} - -fn quit_after_few_frames(mut exit: EventWriter, count: Res) { - if count.0 > 5 { - exit.send(AppExit::Success); - } -} - -pub struct OnEventCallback; -impl IntoCallbackLabel for OnEventCallback { - fn into_callback_label() -> CallbackLabel { - "on_event".into() - } -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins) - .add_plugins(LuaScriptingPlugin::::default()) - .add_systems(Startup, load_script) - .add_systems( - Update, - ( - trigger_script_callback, - event_handler::.after(trigger_script_callback), - quit_after_few_frames, - ), - ) - .run(); - - Ok(()) -} diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 994d80d91c..b6431094f8 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -15,33 +15,12 @@ use bevy::{ use bevy_mod_scripting::prelude::*; -#[derive(Debug, Default, Clone, Reflect, Component, LuaProxy)] -#[reflect(Component, LuaProxyable)] +#[derive(Debug, Default, Clone, Reflect, Component)] +#[reflect(Component)] pub struct LifeState { pub cells: Vec, } -#[derive(Default)] -pub struct LifeAPI; - -impl APIProvider for LifeAPI { - type APITarget = Mutex; - type ScriptContext = Mutex; - type DocTarget = LuaDocFragment; - - fn attach_api(&mut self, _: &mut Self::APITarget) -> Result<(), ScriptError> { - // we don't actually provide anything global - Ok(()) - } - - fn register_with_app(&self, app: &mut App) { - // this will register the `LuaProxyable` typedata since we derived it - // this will resolve retrievals of this component to our custom lua object - app.register_type::(); - app.register_type::(); - } -} - #[derive(Reflect, Resource)] #[reflect(Resource)] pub struct Settings { diff --git a/examples/wrappers.rs b/examples/wrappers.rs deleted file mode 100644 index fb085ea5e0..0000000000 --- a/examples/wrappers.rs +++ /dev/null @@ -1,120 +0,0 @@ -use bevy::{app::AppExit, prelude::*}; -use bevy_mod_scripting::prelude::*; - -#[derive(LuaProxy, Reflect, Resource, Default, Debug, Clone)] -#[reflect(Resource, LuaProxyable)] -#[proxy( - derive(clone), - functions[ - r#" - #[lua(kind="MutatingMethod")] - fn set_my_string(&mut self, another_string: Option); - "#, - r#" - #[lua(kind="MutatingMethod")] - fn set_with_another(&mut self, #[proxy] another: Self); - "#, - r#" - #[lua(kind="Method")] - fn get_my_string(&self) -> String; - "#, - r#" - #[lua(kind="Method",raw)] - fn raw_method(&self, ctx : &Lua) -> Result { - let a = ctx.globals().get::<_,String>("world").unwrap(); - let a = self.inner()?; - Ok("".to_owned()) - } - "#, - r#" - #[lua(kind="MetaMethod", metamethod="ToString")] - fn to_string(&self) -> String { - format!("{:#?}", _self) - } - "# - ]) - ] -pub struct MyProxiedStruct { - my_string: String, -} - -impl MyProxiedStruct { - fn set_with_another(&mut self, another: MyProxiedStruct) { - self.my_string = another.my_string; - } - - fn set_my_string(&mut self, another_string: Option) { - if let Some(s) = another_string { - self.my_string = s; - } else { - self.my_string = "".to_owned(); - } - } - - fn get_my_string(&self) -> String { - self.my_string.clone() - } -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_script_host::>(PostUpdate) - .register_type::() - .init_resource::() - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_systems(Startup, |world: &mut World| { - world.insert_resource(MyProxiedStruct { - my_string: "I was retrieved from the world".to_owned(), - }); - - // run script - world.resource_scope(|world, mut host: Mut>| { - host.run_one_shot( - r#" - function once() - local type = world:get_type_by_name("MyProxiedStruct") - local resource = world:get_resource(type) - - print("The initial value is:", resource) - print("The string value is:", resource:get_my_string()) - - resource:set_my_string(nil) - print("The string value after calling 'set_my_string(nil)' is:", resource:get_my_string()) - - resource:set_my_string("I was changed by the script") - print("The string value after calling 'set_my_string(\"I was changed by the script\")' is:", resource:get_my_string()) - - resource:set_with_another(resource) - print("The string value after calling 'set_with_another(resource)' is:", resource:get_my_string()) - - end - "# - .as_bytes(), - "script.lua", - Entity::from_raw(0), - world, - LuaEvent { - hook_name: "once".to_owned(), - args: (), - recipients: Recipients::All, - }, - ) - .expect("Something went wrong in the script!"); - }); - - // print current state of MyThing - let my_thing = world - .get_resource::() - .expect("Could not find MyProxiedStruct Resource"); - println!("After the script MyProxiedStruct resource is now: {my_thing:#?}"); - // exit app - world.send_event(AppExit::Success); - }); - - app.run(); - - Ok(()) -} From b27dc46ad6b28b3a0f7f957120ab54ea07a6e088 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 3 Jan 2025 00:05:47 +0000 Subject: [PATCH 164/217] compile rune --- crates/languages/bevy_mod_scripting_rune/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/languages/bevy_mod_scripting_rune/src/lib.rs b/crates/languages/bevy_mod_scripting_rune/src/lib.rs index cbcc14d4ac..7c87609923 100644 --- a/crates/languages/bevy_mod_scripting_rune/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rune/src/lib.rs @@ -16,11 +16,11 @@ pub struct RuneScriptContext { pub type RuneRuntime = Vm; -pub struct RuneScriptingPlugin { - pub scripting_plugin: ScriptingPlugin, +pub struct RuneScriptingPlugin { + pub scripting_plugin: ScriptingPlugin, } -impl Default for RuneScriptingPlugin { +impl Default for RuneScriptingPlugin { fn default() -> Self { Self { scripting_plugin: ScriptingPlugin { From 5734de13707b80a598eeb155c98480e7cad01604 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 3 Jan 2025 00:22:59 +0000 Subject: [PATCH 165/217] update docs --- docs/src/running-scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/running-scripts.md b/docs/src/running-scripts.md index 805889d8d5..2af3f0b3ac 100644 --- a/docs/src/running-scripts.md +++ b/docs/src/running-scripts.md @@ -28,7 +28,7 @@ callback_labels!(OnEvent => "on_event"); // trigger the event fn send_event(mut writer: EventWriter) { writer.send(ScriptCallbackEvent::new_for_all( - CallbackLabels::OnEvent, + OnEvent, vec![ScriptValue::Unit], )); } From 1cac0aaefcef18f672c264361c74bcd222ca3aa5 Mon Sep 17 00:00:00 2001 From: makspll Date: Fri, 3 Jan 2025 13:08:40 +0000 Subject: [PATCH 166/217] make the generics more tenable, and update docs --- .../bevy_mod_scripting_core/src/commands.rs | 29 ++--- crates/bevy_mod_scripting_core/src/context.rs | 64 +++++----- crates/bevy_mod_scripting_core/src/event.rs | 21 ++-- crates/bevy_mod_scripting_core/src/handler.rs | 15 +-- crates/bevy_mod_scripting_core/src/lib.rs | 113 +++++++++++------- crates/bevy_mod_scripting_core/src/runtime.rs | 16 +-- crates/bevy_mod_scripting_core/src/systems.rs | 80 +++++++------ .../bevy_mod_scripting_lua/src/lib.rs | 63 +++++----- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 2 +- .../bevy_mod_scripting_rhai/src/lib.rs | 19 +-- .../bevy_mod_scripting_rune/src/lib.rs | 9 +- docs/src/managing-scripts.md | 8 +- docs/src/running-scripts.md | 15 ++- examples/lua/game_of_life.rs | 54 +++------ 14 files changed, 279 insertions(+), 229 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index a39f8d9f74..ed7ead6315 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -8,15 +8,16 @@ use crate::{ prelude::{Runtime, RuntimeContainer}, script::{Script, ScriptId, Scripts}, systems::handle_script_errors, + IntoScriptPluginParams, }; -pub struct DeleteScript { +pub struct DeleteScript { pub id: ScriptId, // hack to make this Send, C does not need to be Send since it is not stored in the command - pub _ph: PhantomData, + pub _ph: PhantomData, } -impl DeleteScript { +impl DeleteScript

{ pub fn new(id: ScriptId) -> Self { Self { id, @@ -25,17 +26,17 @@ impl DeleteScript { } } -impl Command for DeleteScript { +impl Command for DeleteScript

{ fn apply(self, world: &mut bevy::prelude::World) { let settings = world - .get_resource::>() + .get_resource::>() .expect("No ScriptLoadingSettings resource found") .clone(); world.resource_scope(|world, mut scripts: Mut| { if let Some(script) = scripts.scripts.remove(&self.id) { debug!("Deleting script with id: {}", self.id); - let mut ctxts = world.get_non_send_resource_mut::>(); + let mut ctxts = world.get_non_send_resource_mut::>(); let ctxts = ctxts.as_deref_mut().unwrap(); let assigner = settings .assigner @@ -58,15 +59,15 @@ impl Command for DeleteScript { /// Creates new script with the given ID, if a script with the given ID already exists, this is treated as an update /// /// If script comes from an asset, expects it to be loaded, otherwise this command will fail to process the script. -pub struct CreateOrUpdateScript { +pub struct CreateOrUpdateScript { id: ScriptId, content: Box<[u8]>, asset: Option>, // Hack to make this Send, C does not need to be Send since it is not stored in the command - _ph: std::marker::PhantomData, + _ph: std::marker::PhantomData, } -impl CreateOrUpdateScript { +impl CreateOrUpdateScript

{ pub fn new(id: ScriptId, content: Box<[u8]>, asset: Option>) -> Self { Self { id, @@ -77,17 +78,17 @@ impl CreateOrUpdateScript { } } -impl Command for CreateOrUpdateScript { +impl Command for CreateOrUpdateScript

{ fn apply(self, world: &mut bevy::prelude::World) { let settings = world - .get_resource::>() + .get_resource::>() .unwrap() .clone(); let mut contexts = world - .remove_non_send_resource::>() + .remove_non_send_resource::>() .unwrap(); let mut runtime = world - .remove_non_send_resource::>() + .remove_non_send_resource::>() .unwrap(); // assign context let assigner = settings.assigner.clone().expect("No context assigner set"); @@ -116,7 +117,7 @@ impl Command for CreateOrUpdateScript { match ctxt { Ok(ctxt) => contexts.insert(ctxt), Err(e) => { - handle_script_errors(world, [e.with_context(format!("Loading context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()))].into_iter()); + handle_script_errors(world, [e.with_context(format!("Loading context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()))].into_iter()); return; } } diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs index fcd5087cd5..48625cc459 100644 --- a/crates/bevy_mod_scripting_core/src/context.rs +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -5,6 +5,7 @@ use bevy::ecs::{entity::Entity, system::Resource, world::World}; use crate::{ prelude::{Runtime, ScriptError}, script::{Script, ScriptId}, + IntoScriptPluginParams, }; pub trait Context: 'static {} @@ -13,11 +14,11 @@ impl Context for T {} pub type ContextId = u32; #[derive(Resource)] -pub struct ScriptContexts { - pub(crate) contexts: HashMap, +pub struct ScriptContexts { + pub(crate) contexts: HashMap, } -impl Default for ScriptContexts { +impl Default for ScriptContexts

{ fn default() -> Self { Self { contexts: Default::default(), @@ -26,7 +27,7 @@ impl Default for ScriptContexts { } static CONTEXT_ID_COUNTER: AtomicU32 = AtomicU32::new(0); -impl ScriptContexts { +impl ScriptContexts

{ pub fn new() -> Self { Self { contexts: HashMap::new(), @@ -34,7 +35,7 @@ impl ScriptContexts { } /// Allocates a new ContextId and inserts the context into the map - pub fn insert(&mut self, ctxt: T) -> ContextId { + pub fn insert(&mut self, ctxt: P::C) -> ContextId { let id = CONTEXT_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed); self.contexts.insert(id, ctxt); id @@ -45,26 +46,27 @@ impl ScriptContexts { CONTEXT_ID_COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed) } - pub fn remove(&mut self, id: ContextId) -> Option { + pub fn remove(&mut self, id: ContextId) -> Option { self.contexts.remove(&id) } } /// Initializer run once after creating a context but before executing it for the first time -pub type ContextInitializer = fn(&ScriptId, &mut C) -> Result<(), ScriptError>; +pub type ContextInitializer = + fn(&ScriptId, &mut P::C) -> Result<(), ScriptError>; /// Initializer run every time before executing or loading a script -pub type ContextPreHandlingInitializer = - fn(&ScriptId, Entity, &mut C) -> Result<(), ScriptError>; +pub type ContextPreHandlingInitializer = + fn(&ScriptId, Entity, &mut P::C) -> Result<(), ScriptError>; #[derive(Resource)] -pub struct ContextLoadingSettings { - pub loader: Option>, - pub assigner: Option>, - pub context_initializers: Vec>, - pub context_pre_handling_initializers: Vec>, +pub struct ContextLoadingSettings { + pub loader: Option>, + pub assigner: Option>, + pub context_initializers: Vec>, + pub context_pre_handling_initializers: Vec>, } -impl Default for ContextLoadingSettings { +impl Default for ContextLoadingSettings

{ fn default() -> Self { Self { loader: None, @@ -75,7 +77,7 @@ impl Default for ContextLoadingSettings { } } -impl Clone for ContextLoadingSettings { +impl Clone for ContextLoadingSettings

{ fn clone(&self) -> Self { Self { loader: self.loader.clone(), @@ -87,27 +89,27 @@ impl Clone for ContextLoadingSettings { } /// A strategy for loading and reloading contexts -pub struct ContextBuilder { +pub struct ContextBuilder { pub load: fn( script: &ScriptId, content: &[u8], - &[ContextInitializer], - &[ContextPreHandlingInitializer], + &[ContextInitializer

], + &[ContextPreHandlingInitializer

], &mut World, - runtime: &mut R, - ) -> Result, + runtime: &mut P::R, + ) -> Result, pub reload: fn( script: &ScriptId, new_content: &[u8], - context: &mut C, - &[ContextInitializer], - &[ContextPreHandlingInitializer], + context: &mut P::C, + &[ContextInitializer

], + &[ContextPreHandlingInitializer

], &mut World, - &mut R, + &mut P::R, ) -> Result<(), ScriptError>, } -impl Clone for ContextBuilder { +impl Clone for ContextBuilder

{ fn clone(&self) -> Self { Self { load: self.load, @@ -117,23 +119,23 @@ impl Clone for ContextBuilder { } /// A strategy for assigning contexts to new and existing but re-loaded scripts as well as for managing old contexts -pub struct ContextAssigner { +pub struct ContextAssigner { /// Assign a context to the script, if script is `None`, this is a new script, otherwise it is an existing script with a context inside `contexts`. /// Returning None means the script should be assigned a new context pub assign: fn( old_script: Option<&Script>, script_id: &ScriptId, new_content: &[u8], - contexts: &ScriptContexts, + contexts: &ScriptContexts

, ) -> Option, /// Handle the removal of the script, if any clean up in contexts is necessary perform it here. /// This will also be called, when a script is assigned a contextId on reload different from the previous one /// the context_id in that case will be the old context_id and the one stored in the script will be the old one - pub remove: fn(context_id: ContextId, script: &Script, contexts: &mut ScriptContexts), + pub remove: fn(context_id: ContextId, script: &Script, contexts: &mut ScriptContexts

), } -impl Default for ContextAssigner { +impl Default for ContextAssigner

{ fn default() -> Self { Self { assign: |old, _, _, _| old.map(|s| s.context_id), @@ -142,7 +144,7 @@ impl Default for ContextAssigner { } } -impl Clone for ContextAssigner { +impl Clone for ContextAssigner

{ fn clone(&self) -> Self { Self { assign: self.assign, diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index 5e6ac51433..f0d41d7687 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -53,17 +53,15 @@ impl CallbackLabel { #[macro_export] macro_rules! callback_labels { ($($name:ident => $label:expr),*) => { - pub enum CallbackLabels { - $($name),* - } - impl IntoCallbackLabel for CallbackLabels { - fn into_callback_label() -> CallbackLabel { - match self { - $(CallbackLabels::$name => $label.into()),* + $( + pub struct $name; + impl IntoCallbackLabel for $name { + fn into_callback_label() -> CallbackLabel { + $label.into() } } - } + )* }; } @@ -71,11 +69,18 @@ pub trait IntoCallbackLabel { fn into_callback_label() -> CallbackLabel; } +impl From for CallbackLabel { + fn from(_: T) -> Self { + T::into_callback_label() + } +} + impl From<&str> for CallbackLabel { fn from(s: &str) -> Self { Self::new_lossy(s) } } + impl From for CallbackLabel { fn from(s: String) -> Self { Self::from(s.as_str()) diff --git a/crates/bevy_mod_scripting_core/src/handler.rs b/crates/bevy_mod_scripting_core/src/handler.rs index 3df5818d17..320b341494 100644 --- a/crates/bevy_mod_scripting_core/src/handler.rs +++ b/crates/bevy_mod_scripting_core/src/handler.rs @@ -6,29 +6,30 @@ use crate::{ prelude::{ScriptError, ScriptValue}, runtime::Runtime, script::ScriptId, + IntoScriptPluginParams, }; pub trait Args: Clone + Send + Sync + 'static {} impl Args for T {} -pub type HandlerFn = fn( +pub type HandlerFn = fn( args: Vec, entity: Entity, script_id: &ScriptId, callback: &CallbackLabel, - context: &mut C, - pre_handling_initializers: &[ContextPreHandlingInitializer], - runtime: &mut R, + context: &mut P::C, + pre_handling_initializers: &[ContextPreHandlingInitializer

], + runtime: &mut P::R, world: &mut World, ) -> Result<(), ScriptError>; /// A resource that holds the settings for the callback handler for a specific combination of type parameters #[derive(Resource)] -pub struct CallbackSettings { - pub callback_handler: Option>, +pub struct CallbackSettings { + pub callback_handler: Option>, } -impl Default for CallbackSettings { +impl Default for CallbackSettings

{ fn default() -> Self { Self { callback_handler: None, diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 95ee688d4d..7e6902c89e 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -39,24 +39,34 @@ pub mod prelude { pub use {crate::docs::*, crate::error::*, crate::event::*, crate::systems::*, crate::*}; } +/// Types which act like scripting plugins, by selecting a context and runtime +/// Each individual combination of context and runtime has specific infrastructure built for it and does not interact with other scripting plugins +pub trait IntoScriptPluginParams: 'static { + type C: Context; + type R: Runtime; +} + /// Bevy plugin enabling scripting within the bevy mod scripting framework -pub struct ScriptingPlugin { +pub struct ScriptingPlugin { /// Callback for initiating the runtime - pub runtime_builder: fn() -> R, + pub runtime_builder: fn() -> P::R, /// Settings for the runtime - pub runtime_settings: Option>, + pub runtime_settings: Option>, /// The handler used for executing callbacks in scripts - pub callback_handler: Option>, + pub callback_handler: Option>, /// The context builder for loading contexts - pub context_builder: Option>, + pub context_builder: Option>, /// The context assigner for assigning contexts to scripts, if not provided default strategy of keeping each script in its own context is used - pub context_assigner: Option>, + pub context_assigner: Option>, } -impl Default for ScriptingPlugin { +impl Default for ScriptingPlugin

+where + P::R: Default, +{ fn default() -> Self { Self { - runtime_builder: R::default, + runtime_builder: P::R::default, runtime_settings: Default::default(), callback_handler: Default::default(), context_builder: Default::default(), @@ -65,7 +75,7 @@ impl Default for ScriptingPlugin { } } -impl Plugin for ScriptingPlugin { +impl Plugin for ScriptingPlugin

{ fn build(&self, app: &mut bevy::prelude::App) { app.add_event::() .add_event::() @@ -80,21 +90,21 @@ impl Plugin for ScriptingPlugin { }) .insert_resource(self.runtime_settings.as_ref().cloned().unwrap_or_default()) .init_resource::() - .insert_non_send_resource::>(RuntimeContainer { + .insert_non_send_resource::>(RuntimeContainer { runtime: (self.runtime_builder)(), }) - .init_non_send_resource::>() - .insert_resource::>(CallbackSettings { + .init_non_send_resource::>() + .insert_resource::>(CallbackSettings { callback_handler: self.callback_handler, }) - .insert_resource::>(ContextLoadingSettings { + .insert_resource::>(ContextLoadingSettings { loader: self.context_builder.clone(), assigner: Some(self.context_assigner.clone().unwrap_or_default()), context_initializers: vec![], context_pre_handling_initializers: vec![], }) - .add_systems(PostUpdate, (garbage_collector, sync_script_data::)) - .add_systems(PostStartup, initialize_runtime::); + .add_systems(PostUpdate, (garbage_collector, sync_script_data::

)) + .add_systems(PostStartup, initialize_runtime::

); register_types(app); } @@ -107,17 +117,23 @@ fn register_types(app: &mut App) { app.register_type::(); } -pub trait AddRuntimeInitializer { - fn add_runtime_initializer(&mut self, initializer: RuntimeInitializer) -> &mut Self; +pub trait AddRuntimeInitializer { + fn add_runtime_initializer( + &mut self, + initializer: RuntimeInitializer

, + ) -> &mut Self; } -impl AddRuntimeInitializer for App { - fn add_runtime_initializer(&mut self, initializer: RuntimeInitializer) -> &mut Self { - if !self.world_mut().contains_resource::>() { - self.world_mut().init_resource::>(); +impl AddRuntimeInitializer for App { + fn add_runtime_initializer( + &mut self, + initializer: RuntimeInitializer

, + ) -> &mut Self { + if !self.world_mut().contains_resource::>() { + self.world_mut().init_resource::>(); } self.world_mut() - .resource_mut::>() + .resource_mut::>() .as_mut() .initializers .push(initializer); @@ -125,22 +141,22 @@ impl AddRuntimeInitializer for App { } } -pub trait AddContextInitializer { - fn add_context_initializer( +pub trait AddContextInitializer { + fn add_context_initializer( &mut self, - initializer: ContextInitializer, + initializer: ContextInitializer

, ) -> &mut Self; } -impl AddContextInitializer for App { - fn add_context_initializer( +impl AddContextInitializer for App { + fn add_context_initializer( &mut self, - initializer: ContextInitializer, + initializer: ContextInitializer

, ) -> &mut Self { self.world_mut() - .init_resource::>(); + .init_resource::>(); self.world_mut() - .resource_mut::>() + .resource_mut::>() .as_mut() .context_initializers .push(initializer); @@ -148,20 +164,20 @@ impl AddContextInitializer for App { } } -pub trait AddContextPreHandlingInitializer { - fn add_context_pre_handling_initializer( +pub trait AddContextPreHandlingInitializer { + fn add_context_pre_handling_initializer( &mut self, - initializer: ContextPreHandlingInitializer, + initializer: ContextPreHandlingInitializer

, ) -> &mut Self; } -impl AddContextPreHandlingInitializer for App { - fn add_context_pre_handling_initializer( +impl AddContextPreHandlingInitializer for App { + fn add_context_pre_handling_initializer( &mut self, - initializer: ContextPreHandlingInitializer, + initializer: ContextPreHandlingInitializer

, ) -> &mut Self { self.world_mut() - .resource_mut::>() + .resource_mut::>() .as_mut() .context_pre_handling_initializers .push(initializer); @@ -217,24 +233,31 @@ mod test { #[test] fn test_default_scripting_plugin_initializes_all_resources_correctly() { let mut app = App::new(); - #[derive(Default, Clone)] - struct A; + #[derive(Default, Clone)] struct C; #[derive(Default, Clone)] struct R; + + struct Plugin; + + impl IntoScriptPluginParams for Plugin { + type C = C; + type R = R; + } + app.add_plugins(AssetPlugin::default()); - app.add_plugins(ScriptingPlugin::::default()); + app.add_plugins(ScriptingPlugin::::default()); assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::()); assert!(app.world().contains_resource::()); - assert!(app.world().contains_resource::>()); - assert!(app.world().contains_resource::>()); + assert!(app.world().contains_resource::>()); + assert!(app.world().contains_resource::>()); assert!(app .world() - .contains_resource::>()); - assert!(app.world().contains_non_send::>()); - assert!(app.world().contains_non_send::>()); + .contains_resource::>()); + assert!(app.world().contains_non_send::>()); + assert!(app.world().contains_non_send::>()); } } diff --git a/crates/bevy_mod_scripting_core/src/runtime.rs b/crates/bevy_mod_scripting_core/src/runtime.rs index 6b9fe7fb67..0e10083346 100644 --- a/crates/bevy_mod_scripting_core/src/runtime.rs +++ b/crates/bevy_mod_scripting_core/src/runtime.rs @@ -3,17 +3,19 @@ use bevy::ecs::system::Resource; +use crate::IntoScriptPluginParams; + pub trait Runtime: 'static {} impl Runtime for T {} -pub type RuntimeInitializer = fn(&mut R); +pub type RuntimeInitializer = fn(&mut P::R); #[derive(Resource)] -pub struct RuntimeSettings { - pub initializers: Vec>, +pub struct RuntimeSettings { + pub initializers: Vec>, } -impl Default for RuntimeSettings { +impl Default for RuntimeSettings

{ fn default() -> Self { Self { initializers: Default::default(), @@ -21,7 +23,7 @@ impl Default for RuntimeSettings { } } -impl Clone for RuntimeSettings { +impl Clone for RuntimeSettings

{ fn clone(&self) -> Self { Self { initializers: self.initializers.clone(), @@ -31,6 +33,6 @@ impl Clone for RuntimeSettings { /// Stores a particular runtime. #[derive(Resource)] -pub struct RuntimeContainer { - pub runtime: R, +pub struct RuntimeContainer { + pub runtime: P::R, } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 0ec7388f65..552b27a13a 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -12,6 +12,7 @@ use crate::{ prelude::{AppReflectAllocator, RuntimeSettings}, runtime::{Runtime, RuntimeContainer}, script::{ScriptComponent, Scripts}, + IntoScriptPluginParams, }; /// Cleans up dangling script allocations @@ -20,9 +21,9 @@ pub fn garbage_collector(allocator: ResMut) { allocator.clean_garbage_allocations() } -pub fn initialize_runtime( - mut runtime: NonSendMut>, - settings: Res>, +pub fn initialize_runtime( + mut runtime: NonSendMut>, + settings: Res>, ) { for initializer in settings.initializers.iter() { (initializer)(&mut runtime.runtime); @@ -30,7 +31,7 @@ pub fn initialize_runtime( } /// Processes and reacts appropriately to script asset events, and queues commands to update the internal script state -pub fn sync_script_data( +pub fn sync_script_data( mut events: EventReader>, script_assets: Res>, asset_settings: Res, @@ -67,13 +68,13 @@ pub fn sync_script_data( let script_id = converter(path); if !remove { - commands.queue(CreateOrUpdateScript::::new( + commands.queue(CreateOrUpdateScript::

::new( script_id, asset.content.clone(), Some(script_assets.reserve_handle().clone_weak()), )); } else { - commands.queue(DeleteScript::::new(script_id)); + commands.queue(DeleteScript::

::new(script_id)); } } } @@ -91,12 +92,12 @@ macro_rules! push_err_and_continue { } /// Passes events with the specified label to the script callback with the same name and runs the callback -pub fn event_handler( +pub fn event_handler( world: &mut World, params: &mut SystemState<( EventReader, - Res>, - Res>, + Res>, + Res>, Res, Query<(Entity, Ref)>, )>, @@ -104,17 +105,17 @@ pub fn event_handler( debug!("Handling events with label `{}`", L::into_callback_label()); let mut runtime_container = world - .remove_non_send_resource::>() + .remove_non_send_resource::>() .unwrap_or_else(|| { panic!( "No runtime container for runtime {} found. Was the scripting plugin initialized correctly?", - type_name::() + type_name::() ) }); let runtime = &mut runtime_container.runtime; let mut script_contexts = world - .remove_non_send_resource::>() - .unwrap_or_else(|| panic!("No script contexts found for context {}", type_name::())); + .remove_non_send_resource::>() + .unwrap_or_else(|| panic!("No script contexts found for context {}", type_name::

())); let (mut script_events, callback_settings, context_settings, scripts, entities) = params.get_mut(world); @@ -124,10 +125,9 @@ pub fn event_handler( .as_ref() .unwrap_or_else(|| { panic!( - "No handler registered for - Runtime: {}, Context: {}, Args: {}", - type_name::(), - type_name::(), - type_name::() + "No handler registered for - Runtime: {}, Context: {}", + type_name::(), + type_name::() ) }); let pre_handling_initializers = context_settings.context_pre_handling_initializers.clone(); @@ -187,11 +187,10 @@ pub fn event_handler( world, ) .map_err(|e| { - e.with_script(script.id.clone()).with_context(&format!( - "Event handling for: Runtime {}, Context: {}, Args: {}", - type_name::(), - type_name::(), - type_name::() + e.with_script(script.id.clone()).with_context(format!( + "Event handling for: Runtime {}, Context: {}", + type_name::(), + type_name::(), )) }); @@ -245,6 +244,13 @@ mod test { } } + struct TestPlugin; + + impl IntoScriptPluginParams for TestPlugin { + type C = TestContext; + type R = TestRuntime; + } + struct TestRuntime { pub invocations: Vec<(Entity, ScriptId)>, } @@ -253,24 +259,24 @@ mod test { pub invocations: Vec, } - fn setup_app( - handler_fn: HandlerFn, - runtime: R, - contexts: HashMap, + fn setup_app( + handler_fn: HandlerFn

, + runtime: P::R, + contexts: HashMap, scripts: HashMap, ) -> App { let mut app = App::new(); app.add_event::(); app.add_event::(); - app.insert_resource::>(CallbackSettings { + app.insert_resource::>(CallbackSettings { callback_handler: Some(handler_fn), }); - app.add_systems(Update, event_handler::); + app.add_systems(Update, event_handler::); app.insert_resource::(Scripts { scripts }); - app.insert_non_send_resource::>(RuntimeContainer { runtime }); - app.insert_non_send_resource::>(ScriptContexts { contexts }); - app.insert_resource(ContextLoadingSettings:: { + app.insert_non_send_resource(RuntimeContainer::

{ runtime }); + app.insert_non_send_resource(ScriptContexts::

{ contexts }); + app.insert_resource(ContextLoadingSettings::

{ loader: None, assigner: None, context_initializers: vec![], @@ -300,7 +306,7 @@ mod test { let runtime = TestRuntime { invocations: vec![], }; - let mut app = setup_app::( + let mut app = setup_app::( |args, entity, script, _, ctxt, _, runtime, _| { ctxt.invocations.extend(args); runtime.invocations.push((entity, script.clone())); @@ -323,11 +329,11 @@ mod test { let test_context = app .world() - .get_non_send_resource::>() + .get_non_send_resource::>() .unwrap(); let test_runtime = app .world() - .get_non_send_resource::>() + .get_non_send_resource::>() .unwrap(); assert_eq!( @@ -387,7 +393,7 @@ mod test { let runtime = TestRuntime { invocations: vec![], }; - let mut app = setup_app::( + let mut app = setup_app::( |args, entity, script, _, ctxt, _, runtime, _| { ctxt.invocations.extend(args); runtime.invocations.push((entity, script.clone())); @@ -418,11 +424,11 @@ mod test { let test_context = app .world() - .get_non_send_resource::>() + .get_non_send_resource::>() .unwrap(); let test_runtime = app .world() - .get_non_send_resource::>() + .get_non_send_resource::>() .unwrap(); assert_eq!( diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index ab5414aa68..d0568d624d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -11,11 +11,13 @@ use bevy_mod_scripting_core::{ }, context::{ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, error::ScriptError, - event::CallbackLabel, + event::{CallbackLabel, IntoCallbackLabel}, handler::Args, reflection_extensions::PartialReflectExt, script::ScriptId, - AddContextInitializer, AddContextPreHandlingInitializer, ScriptingPlugin, + systems::event_handler, + AddContextInitializer, AddContextPreHandlingInitializer, IntoScriptPluginParams, + ScriptingPlugin, }; use bindings::{ // providers::bevy_ecs::LuaEntity, @@ -27,16 +29,17 @@ use bindings::{ pub use mlua; use mlua::{Function, IntoLuaMulti, Lua}; pub mod bindings; -// use type_data::{ -// pre_register_common_containers, register_lua_values, ReflectLuaProxied, ReflectLuaValue, -// }; - pub mod prelude { pub use crate::mlua::{self, prelude::*, Value}; } +impl IntoScriptPluginParams for LuaScriptingPlugin { + type C = Lua; + type R = (); +} + pub struct LuaScriptingPlugin { - pub scripting_plugin: ScriptingPlugin, + pub scripting_plugin: ScriptingPlugin, } impl Default for LuaScriptingPlugin { @@ -47,7 +50,7 @@ impl Default for LuaScriptingPlugin { runtime_builder: Default::default, runtime_settings: None, callback_handler: Some(lua_handler), - context_builder: Some(ContextBuilder:: { + context_builder: Some(ContextBuilder:: { load: lua_context_load, reload: lua_context_reload, }), @@ -60,21 +63,23 @@ impl Plugin for LuaScriptingPlugin { fn build(&self, app: &mut bevy::prelude::App) { self.scripting_plugin.build(app); // register_lua_values(app); - app.add_context_pre_handling_initializer::<()>(|script_id, entity, context: &mut Lua| { - let world = context.get_world(); - context - .globals() - .set( - "entity", - LuaReflectReference(::allocate(Box::new(entity), world)), - ) - .map_err(ScriptError::from_mlua_error)?; - context - .globals() - .set("script_id", script_id.clone()) - .map_err(ScriptError::from_mlua_error)?; - Ok(()) - }); + app.add_context_pre_handling_initializer::( + |script_id, entity, context: &mut Lua| { + let world = context.get_world(); + context + .globals() + .set( + "entity", + LuaReflectReference(::allocate(Box::new(entity), world)), + ) + .map_err(ScriptError::from_mlua_error)?; + context + .globals() + .set("script_id", script_id.clone()) + .map_err(ScriptError::from_mlua_error)?; + Ok(()) + }, + ); } fn cleanup(&self, app: &mut App) { @@ -85,7 +90,7 @@ impl Plugin for LuaScriptingPlugin { // type_registry.iter().map(|t| { // t. // }) - app.add_context_initializer::<()>(|_script_id, context: &mut Lua| { + app.add_context_initializer::(|_script_id, context: &mut Lua| { let world = context.get_world(); let type_registry = world.type_registry(); let type_registry = type_registry.read(); @@ -119,8 +124,8 @@ impl Plugin for LuaScriptingPlugin { pub fn lua_context_load( script_id: &ScriptId, content: &[u8], - initializers: &[ContextInitializer], - pre_handling_initializers: &[ContextPreHandlingInitializer], + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], world: &mut World, _: &mut (), ) -> Result { @@ -152,8 +157,8 @@ pub fn lua_context_reload( script: &ScriptId, content: &[u8], old_ctxt: &mut Lua, - initializers: &[ContextInitializer], - pre_handling_initializers: &[ContextPreHandlingInitializer], + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], world: &mut World, _: &mut (), ) -> Result<(), ScriptError> { @@ -175,7 +180,7 @@ pub fn lua_handler( script_id: &ScriptId, callback_label: &CallbackLabel, context: &mut Lua, - pre_handling_initializers: &[ContextPreHandlingInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], _: &mut (), world: &mut bevy::ecs::world::World, ) -> Result<(), bevy_mod_scripting_core::error::ScriptError> { diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 7a096285fc..97c7078e6b 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -191,7 +191,7 @@ impl Test { // let lua = Lua::new(); // set file information let mut app = init_app(); - let mut context_settings: ContextLoadingSettings = app + let mut context_settings: ContextLoadingSettings = app .world_mut() .remove_resource() .ok_or("could not find context loading settings")?; diff --git a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs index 9de9961ae0..2fff84c2a3 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs @@ -9,7 +9,7 @@ use bevy_mod_scripting_core::{ event::CallbackLabel, handler::Args, script::ScriptId, - ScriptingPlugin, + IntoScriptPluginParams, ScriptingPlugin, }; use rhai::{CallFnOptions, Engine, FnPtr, FuncArgs, Scope, AST}; @@ -26,8 +26,13 @@ pub struct RhaiScriptContext { pub scope: Scope<'static>, } +impl IntoScriptPluginParams for RhaiScriptingPlugin { + type C = RhaiScriptContext; + type R = RhaiRuntime; +} + pub struct RhaiScriptingPlugin { - pub scripting_plugin: ScriptingPlugin, + pub scripting_plugin: ScriptingPlugin, } impl Default for RhaiScriptingPlugin { @@ -56,8 +61,8 @@ impl Plugin for RhaiScriptingPlugin { pub fn rhai_context_load( script: &ScriptId, content: &[u8], - initializers: &[ContextInitializer], - pre_handling_initializers: &[ContextPreHandlingInitializer], + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], world: &mut World, runtime: &mut RhaiRuntime, ) -> Result { @@ -90,8 +95,8 @@ pub fn rhai_context_reload( script: &ScriptId, content: &[u8], context: &mut RhaiScriptContext, - initializers: &[ContextInitializer], - pre_handling_initializers: &[ContextPreHandlingInitializer], + initializers: &[ContextInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], world: &mut World, runtime: &mut RhaiRuntime, ) -> Result<(), ScriptError> { @@ -113,7 +118,7 @@ pub fn rhai_callback_handler( script_id: &ScriptId, callback: &CallbackLabel, context: &mut RhaiScriptContext, - pre_handling_initializers: &[ContextPreHandlingInitializer], + pre_handling_initializers: &[ContextPreHandlingInitializer], runtime: &mut RhaiRuntime, world: &mut World, ) -> Result<(), ScriptError> { diff --git a/crates/languages/bevy_mod_scripting_rune/src/lib.rs b/crates/languages/bevy_mod_scripting_rune/src/lib.rs index 7c87609923..52397536fc 100644 --- a/crates/languages/bevy_mod_scripting_rune/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rune/src/lib.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bevy_mod_scripting_core::ScriptingPlugin; +use bevy_mod_scripting_core::{IntoScriptPluginParams, ScriptingPlugin}; use rune::{ runtime::{Args, RuntimeContext}, Unit, Vm, @@ -16,8 +16,13 @@ pub struct RuneScriptContext { pub type RuneRuntime = Vm; +impl IntoScriptPluginParams for RuneScriptingPlugin { + type C = RuneScriptContext; + type R = RuneRuntime; +} + pub struct RuneScriptingPlugin { - pub scripting_plugin: ScriptingPlugin, + pub scripting_plugin: ScriptingPlugin, } impl Default for RuneScriptingPlugin { diff --git a/docs/src/managing-scripts.md b/docs/src/managing-scripts.md index 4687632156..0559668492 100644 --- a/docs/src/managing-scripts.md +++ b/docs/src/managing-scripts.md @@ -34,15 +34,19 @@ Assuming that hot-reloading is enabled for your app, any changes to script asset In order to manually re-load or load a script you can issue the `CreateOrUpdateScript` command: ```rust,ignore -CreateOrUpdateScript::new("my_script.lua".into(), "print(\"hello world from new script body\")".into(), asset_handle) +CreateOrUpdateScript::::new("my_script.lua".into(), "print(\"hello world from new script body\")".into(), asset_handle) ``` +replace `LuaScriptingPlugin` with the scripting plugin you are using. + ## Manually Deleting scripts In order to delete a previously loaded script, you will need to issue a `DeleteScript` command like so: ```rust,ignore -DeleteScript::new("my_script.lua".into()) +DeleteScript::::new("my_script.lua".into()) ``` +replace `LuaScriptingPlugin` with the scripting plugin you are using. + ## Loading/Unloading timeframe Scripts are processed via commands, so any asset events will be processed at the next command execution point running after BMS internal asset systems. \ No newline at end of file diff --git a/docs/src/running-scripts.md b/docs/src/running-scripts.md index 2af3f0b3ac..3d072515d7 100644 --- a/docs/src/running-scripts.md +++ b/docs/src/running-scripts.md @@ -34,4 +34,17 @@ fn send_event(mut writer: EventWriter) { } ``` -Note the second argument is the payload we are sending with the event, in this case we are sending an empty payload. \ No newline at end of file +Note the second argument is the payload we are sending with the event, in this case we are sending an empty payload. + + +# Event Handlers + +In order for the events you send to actually be picked up, you need to inject special systems into your application. These systems will listen for the events and trigger the appropriate callbacks on the scripts: + +```rust,ignore +app.add_systems(Update, event_handler::); +``` + +Note the system is parameterized by the label we defined earlier, and the scripting plugin we are using. You can add as many of these systems as you like. + +The event handler will catch all events with the label `OnEvent` and trigger the `on_event` callback on all targeted scripts which have that callback defined. \ No newline at end of file diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index b6431094f8..84a46d1690 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -14,6 +14,8 @@ use bevy::{ }; use bevy_mod_scripting::prelude::*; +use bevy_mod_scripting_lua::LuaScriptingPlugin; +use bindings::script_value::ScriptValue; #[derive(Debug, Default, Clone, Reflect, Component)] #[reflect(Component)] @@ -43,10 +45,9 @@ impl Default for Settings { } } -pub fn setup( +pub fn init_game_of_life_state( mut commands: Commands, mut assets: ResMut>, - asset_server: Res, settings: Res, ) { let mut image = Image::new_fill( @@ -63,8 +64,6 @@ pub fn setup( image.sampler = ImageSampler::nearest(); - let script_path = bevy_mod_scripting_lua::lua_path!("game_of_life"); - commands.spawn(Camera2d); commands .spawn(Sprite { @@ -82,12 +81,6 @@ pub fn setup( (settings.physical_grid_dimensions.0 * settings.physical_grid_dimensions.1) as usize ], - }) - .insert(ScriptCollection:: { - scripts: vec![Script::new( - script_path.to_owned(), - asset_server.load(script_path), - )], }); } @@ -143,28 +136,17 @@ pub fn update_rendered_state( } } -/// Sends events allowing scripts to drive update logic -pub fn send_on_update(mut events: PriorityEventWriter>) { - events.send( - LuaEvent { - hook_name: "on_update".to_owned(), - args: (), - recipients: Recipients::All, - }, - 1, - ) -} +callback_labels!( + OnUpdate => "on_update", + Init => "init" +); -/// Sends initialization event -pub fn send_init(mut events: PriorityEventWriter>) { - events.send( - LuaEvent { - hook_name: "init".to_owned(), - args: (), - recipients: Recipients::All, - }, - 0, - ) +/// Sends events allowing scripts to drive update logic +pub fn send_on_update(mut events: EventWriter) { + events.send(ScriptCallbackEvent::new_for_all( + OnUpdate, + vec![ScriptValue::Unit], + )); } const UPDATE_FREQUENCY: f32 = 1.0 / 60.0; @@ -176,17 +158,13 @@ fn main() -> std::io::Result<()> { .insert_resource(Time::::from_seconds(UPDATE_FREQUENCY.into())) .add_plugins(LogDiagnosticsPlugin::default()) .add_plugins(FrameTimeDiagnosticsPlugin) - .add_plugins(ScriptingPlugin) + .add_plugins(LuaScriptingPlugin::default()) .init_resource::() - .add_systems(Startup, setup) - .add_systems(Startup, send_init) + .add_systems(Startup, init_game_of_life_state) .add_systems(Update, sync_window_size) .add_systems(FixedUpdate, update_rendered_state.after(sync_window_size)) .add_systems(FixedUpdate, send_on_update.after(update_rendered_state)) - .add_systems(FixedUpdate, script_event_handler::, 0, 1>) - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_api_provider::>(Box::new(LifeAPI)); + .add_systems(FixedUpdate, event_handler::); app.run(); From bc9b207188dc7c7f8c7725b8057d37ce22160847 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 15:36:35 +0000 Subject: [PATCH 167/217] keep working on docs and fixing bugs --- Cargo.toml | 1 + assets/scripts/game_of_life.lua | 111 +-- .../src/bindings/allocator.rs | 40 +- .../src/bindings/function/from.rs | 6 +- .../src/bindings/function/mod.rs | 17 +- .../src/bindings/function/script_function.rs | 8 +- .../src/bindings/pretty_print.rs | 34 +- .../src/bindings/query.rs | 24 +- .../src/bindings/reference.rs | 2 + crates/bevy_mod_scripting_core/src/error.rs | 23 +- crates/bevy_mod_scripting_core/src/lib.rs | 4 +- crates/bevy_mod_scripting_core/src/systems.rs | 2 +- .../bevy_mod_scripting_functions/src/core.rs | 15 +- .../src/namespaced_register.rs | 47 +- .../src/bindings/reference.rs | 52 +- .../src/bindings/script_value.rs | 22 +- docs/multi-code-block.js | 3 + docs/src/SUMMARY.md | 13 +- docs/src/ScriptingReference/core-api.md | 594 +++++++++++++ docs/src/ScriptingReference/introduction.md | 5 + .../controlling-script-bindings.md | 0 docs/src/{ => Summary}/installation.md | 0 docs/src/{ => Summary}/managing-scripts.md | 0 docs/src/{ => Summary}/running-scripts.md | 0 examples/lua/game_of_life.rs | 128 ++- log.out | 841 ++++++++++++++++++ 26 files changed, 1875 insertions(+), 117 deletions(-) create mode 100644 docs/multi-code-block.js create mode 100644 docs/src/ScriptingReference/core-api.md create mode 100644 docs/src/ScriptingReference/introduction.md rename docs/src/{ => Summary}/controlling-script-bindings.md (100%) rename docs/src/{ => Summary}/installation.md (100%) rename docs/src/{ => Summary}/managing-scripts.md (100%) rename docs/src/{ => Summary}/running-scripts.md (100%) create mode 100644 log.out diff --git a/Cargo.toml b/Cargo.toml index a7166e1ce4..de668a6e47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,6 +79,7 @@ clap = { version = "4.1", features = ["derive"] } rand = "0.8.5" bevy_console = "0.13" rhai-rand = "0.1" +ansi-parser = "0.9" [workspace] members = [ diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index 56bbf6d91e..b58e326ee9 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -1,58 +1,63 @@ -math.randomseed(os.time()) - -function init() - local LifeState = world.get_type_by_name("LifeState") - local life_state = world.get_component(entity,LifeState) - local cells = life_state.cells - - -- set some cells alive - for _=1,10000 do - local index = math.random(#cells) - cells[index] = 255 - end +-- print("The game_of_life.lua script just got loaded") +-- print("Hello from Lua! I am initiating the game of life simulation state to a random state now") + +-- math.randomseed(os.time()) +-- _LifeState = world.get_type_by_name("LifeState") +_Settings = world.get_type_by_name("Settings") + +-- function fetch_life_state() +-- -- find the entity with life state +-- local life_state = nil +-- for i,result in pairs(world.query({_LifeState}):build()) do +-- life_state = result:components()[1] +-- break +-- end +-- return life_state +-- end + +function on_init() + -- print("On init was called") + -- local life_state = fetch_life_state() + -- local cells = life_state.cells + + -- -- set some cells alive + -- for _=1,10000 do + -- local index = math.random(#cells) + -- cells[index] = 255 + -- end end function on_update() - local LifeState = world.get_type_by_name("LifeState") - local Settings = world.get_type_by_name("Settings") - - local life_state = world.get_component(entity,LifeState) - -- note currently this is a copy of the cells, as of now the macro does not automatically support Vec proxies by reference - local cells = life_state.cells - - -- note that here we do not make use of LuaProxyable and just go off pure reflection - local settings = world.get_resource(Settings) - local dimensions = settings.physical_grid_dimensions - - - -- primitives are passed by value to lua, keep a hold of old state but turn 255's into 1's - local prev_state = {} - for k,v in pairs(cells) do - prev_state[k] = (not(v == 0)) and 1 or 0 - end - - for i=1,(dimensions[1] * dimensions[2]) do - local north = prev_state[i - dimensions[1]] or 1 - local south = prev_state[i + dimensions[1]] or 1 - local east = prev_state[i + 1] or 1 - local west = prev_state[i - 1] or 1 - local northeast = prev_state[i - dimensions[1] + 1] or 1 - local southeast = prev_state[i + dimensions[1] + 1] or 1 - local northwest = prev_state[i - dimensions[1] - 1] or 1 - local southwest = prev_state[i + dimensions[1] - 1] or 1 - - local neighbours = north + south + east + west - + northeast + southeast + northwest + southwest + -- local cells = fetch_life_state().cells + local settings = world.get_resource(_Settings) + -- local dimensions = settings.physical_grid_dimensions + -- local dimension_x = dimensions._1 + -- local dimension_y = dimensions._2 + + -- -- primitives are passed by value to lua, keep a hold of old state but turn 255's into 1's + -- local prev_state = {} + -- for k,v in pairs(cells) do + -- prev_state[k] = (not(v == 0)) and 1 or 0 + -- end + -- for i=1,(dimension_x * dimension_y) do + -- local north = prev_state[i - dimension_x] or 1 + -- local south = prev_state[i + dimension_x] or 1 + -- local east = prev_state[i + 1] or 1 + -- local west = prev_state[i - 1] or 1 + -- local northeast = prev_state[i - dimension_x + 1] or 1 + -- local southeast = prev_state[i + dimension_x + 1] or 1 + -- local northwest = prev_state[i - dimension_x - 1] or 1 + -- local southwest = prev_state[i + dimension_x - 1] or 1 + + -- local neighbours = north + south + east + west + -- + northeast + southeast + northwest + southwest - -- was dead and got 3 neighbours now - if prev_state[i] == 0 and neighbours == 3 then - cells[i] = 255 - -- was alive and should die now - elseif prev_state[i] == 1 and ((neighbours < 2) or (neighbours > 3)) then - cells[i] = 0 - end - end - - -- propagate the updates - life_state.cells = cells + -- -- was dead and got 3 neighbours now + -- if prev_state[i] == 0 and neighbours == 3 then + -- cells[i] = 255 + -- -- was alive and should die now + -- elseif prev_state[i] == 1 and ((neighbours < 2) or (neighbours > 3)) then + -- cells[i] = 0 + -- end + -- end end \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index 437f163853..b0c5a216fd 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -3,12 +3,14 @@ use bevy::reflect::{PartialReflect, Reflect}; use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use std::any::{Any, TypeId}; use std::cell::UnsafeCell; +use std::cmp::Ordering; use std::collections::HashMap; use std::fmt::{Display, Formatter}; +use std::hash::Hasher; use std::io::Read; use std::sync::Arc; -#[derive(Clone, PartialEq, Eq, Hash, Debug, PartialOrd, Ord)] +#[derive(Clone, Debug)] pub struct ReflectAllocationId(pub(crate) Arc); impl ReflectAllocationId { pub fn id(&self) -> usize { @@ -25,6 +27,32 @@ impl ReflectAllocationId { } } +impl std::hash::Hash for ReflectAllocationId { + fn hash(&self, state: &mut H) { + self.id().hash(state); + } +} + +impl PartialEq for ReflectAllocationId { + fn eq(&self, other: &Self) -> bool { + self.id() == other.id() + } +} + +impl Eq for ReflectAllocationId {} + +impl PartialOrd for ReflectAllocationId { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.id().cmp(&other.id())) + } +} + +impl Ord for ReflectAllocationId { + fn cmp(&self, other: &Self) -> Ordering { + self.id().cmp(&other.id()) + } +} + /// Pointer which owns the value it points to, and will deallocate it when dropped #[derive(Debug)] pub struct OwningPtr { @@ -193,7 +221,15 @@ impl ReflectAllocator { /// Runs a garbage collection pass on the allocations, removing any allocations which have no more strong references /// Needs to be run periodically to prevent memory leaks pub fn clean_garbage_allocations(&mut self) { - self.allocations.retain(|k, _| Arc::strong_count(&k.0) > 1); + bevy::log::debug!("Cleaning garbage allocations"); + + self.allocations.retain(|k, _| { + let retain = Arc::strong_count(&k.0) > 1; + if !retain { + bevy::log::debug!("Deallocating allocation {:?}", k); + } + retain + }); } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index 00a354c882..f721a7812a 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -182,8 +182,10 @@ impl FromScript for Val { T::from_reflect(r).ok_or_else(|| { InteropError::failed_from_reflect( Some(TypeId::of::()), - format!("from reflect failed to produce output when converting to Val from: {r:?}") - .to_owned(), + format!( + "Expected '{}' but receievd: {r:?}", + std::any::type_name::() + ), ) }) }, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index dab27e7d8d..0318a2a10d 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -46,10 +46,19 @@ impl CallScriptFunction for DynamicScriptFunction { ) -> Result { let args = args.into_iter().collect::>(); let world_callback_access = WorldCallbackAccess::from_guard(world.clone()); + bevy::log::debug!( + "Calling function {} with args {:?}", + self.name(), + args.display_with_world(world.clone()) + ); // should we be inlining call errors into the return value? let return_val = self.call(context, world_callback_access, args); match return_val { - ScriptValue::Error(e) => Err(InteropError::function_interop_error(self.name(), e)), + ScriptValue::Error(e) => Err(InteropError::function_interop_error( + self.name(), + context.self_type, + e, + )), v => Ok(v), } } @@ -67,7 +76,11 @@ impl CallScriptFunction for DynamicScriptFunctionMut { // should we be inlining call errors into the return value? let return_val = self.call(context, world_callback_access, args); match return_val { - ScriptValue::Error(e) => Err(InteropError::function_interop_error(self.name(), e)), + ScriptValue::Error(e) => Err(InteropError::function_interop_error( + self.name(), + context.self_type, + e, + )), v => Ok(v), } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 3f31828023..99bd1640ae 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -16,11 +16,11 @@ use bevy::{ }, }; use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; -use std::borrow::Cow; use std::collections::HashMap; use std::hash::Hash; use std::ops::{Deref, DerefMut}; use std::sync::Arc; +use std::{any::TypeId, borrow::Cow}; #[diagnostic::on_unimplemented( message = "Only functions with all arguments impplementing FromScript and return values supporting IntoScript are supported. Registering functions also requires they implement GetInnerTypeDependencies", @@ -96,8 +96,8 @@ macro_rules! register_tuple_dependencies { }; } -no_type_dependencies!(ReflectReference, InteropError); -self_type_dependency_only!(WorldCallbackAccess, CallerContext); +no_type_dependencies!(InteropError); +self_type_dependency_only!(WorldCallbackAccess, CallerContext, ReflectReference); recursive_type_dependencies!( (Val where T: GetTypeRegistration), @@ -118,8 +118,10 @@ pub trait GetFunctionTypeDependencies { /// The caller context when calling a script function. /// Functions can choose to react to caller preferences such as converting 1-indexed numbers to 0-indexed numbers #[derive(Clone, Copy, Debug, Reflect)] +#[reflect(opaque)] pub struct CallerContext { pub convert_to_0_indexed: bool, + pub self_type: Option, } /// The Script Function equivalent for dynamic functions. Currently unused diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 3d38d6e947..f84bfa2ea9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -76,7 +76,7 @@ impl ReflectReferencePrinter { let base_kind = match base.base_id { ReflectBase::Component(e, _) => format!("Component on entity {}", e), ReflectBase::Resource(_) => "Resource".to_owned(), - ReflectBase::Owned(_) => "Allocation".to_owned(), + ReflectBase::Owned(ref id) => format!("Allocation({})", id), }; out.push_str(&format!("{}({})", base_kind, type_path)); @@ -328,7 +328,7 @@ macro_rules! impl_dummy_display ( ($t:ty) => { impl std::fmt::Display for $t { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "Displaying {} without world access: {:#?}", stringify!($t), self)?; + write!(f, "", stringify!($t))?; Ok(()) } } @@ -403,7 +403,7 @@ impl DisplayWithWorld for ScriptValue { ScriptValue::Integer(i) => i.to_string(), ScriptValue::Float(f) => f.to_string(), ScriptValue::String(cow) => cow.to_string(), - ScriptValue::Error(script_error) => script_error.to_string(), + ScriptValue::Error(script_error) => script_error.display_with_world(world), ScriptValue::List(vec) => { let mut string = String::new(); ReflectReferencePrinter::pretty_print_key_values( @@ -417,3 +417,31 @@ impl DisplayWithWorld for ScriptValue { } } } + +impl DisplayWithWorld for Vec { + fn display_with_world(&self, world: WorldGuard) -> String { + let mut string = String::new(); + BracketType::Square.surrounded(&mut string, |string| { + for (i, v) in self.iter().enumerate() { + string.push_str(&v.display_with_world(world.clone())); + if i != self.len() - 1 { + string.push_str(", "); + } + } + }); + string + } + + fn display_value_with_world(&self, world: WorldGuard) -> String { + let mut string = String::new(); + BracketType::Square.surrounded(&mut string, |string| { + for (i, v) in self.iter().enumerate() { + string.push_str(&v.display_value_with_world(world.clone())); + if i != self.len() - 1 { + string.push_str(", "); + } + } + }); + string + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index a99f38fa21..e8381ae83c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -132,15 +132,33 @@ impl<'w> WorldAccessGuard<'w> { // which entities match the query // so we might be being slightly overkill for c in &query.components { - dynamic_query.ref_id(c.component_id().unwrap()); + dynamic_query.ref_id(c.component_id().ok_or_else(|| { + InteropError::unsupported_operation( + Some(c.type_id()), + None, + "query for component on non-component type".to_owned(), + ) + })?); } for w in query.with { - dynamic_query.with_id(w.component_id.unwrap()); + dynamic_query.with_id(w.component_id.ok_or_else(|| { + InteropError::unsupported_operation( + Some(w.type_id()), + None, + "query for entity with component which is non-component type".to_owned(), + ) + })?); } for without_id in query.without { - dynamic_query.without_id(without_id.component_id.unwrap()); + dynamic_query.without_id(without_id.component_id.ok_or_else(|| { + InteropError::unsupported_operation( + Some(without_id.type_id()), + None, + "query for entity without component which is non-component type".to_owned(), + ) + })?); } let mut built_query = dynamic_query.build(); diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 986c776206..46dad58dec 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -218,6 +218,7 @@ impl ReflectReference { /// /// # Panics /// - if the value is aliased and the access is not allowed + #[track_caller] pub fn with_reflect O>( &self, world: WorldGuard, @@ -238,6 +239,7 @@ impl ReflectReference { /// /// # Panics /// - if the value is aliased and the access is not allowed + #[track_caller] pub fn with_reflect_mut O>( &self, world: WorldGuard, diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index b1feaf048d..fca91b9381 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -379,9 +379,14 @@ impl InteropError { } /// Thrown when an error happens in a function call. The inner error provides details on the error. - pub fn function_interop_error(function_name: &str, error: InteropError) -> Self { + pub fn function_interop_error( + function_name: &str, + on: Option, + error: InteropError, + ) -> Self { Self(Arc::new(InteropErrorInner::FunctionInteropError { function_name: function_name.to_string(), + on, error, })) } @@ -524,6 +529,7 @@ pub enum InteropErrorInner { }, FunctionInteropError { function_name: String, + on: Option, error: InteropError, }, FunctionArgConversionError { @@ -659,11 +665,18 @@ impl DisplayWithWorld for InteropErrorInner { InteropErrorInner::MissingWorld => { "Missing world. The world was not initialized in the script context.".to_owned() }, - InteropErrorInner::FunctionInteropError { function_name, error } => { + InteropErrorInner::FunctionInteropError { function_name, on, error } => { + let opt_on = on.map(|t| format!("on type: {}", t.display_with_world(world.clone()))).unwrap_or_default(); + let display_name = if function_name.starts_with("TypeId") { + function_name.split("::").last().unwrap() + } else { + function_name.as_str() + }; format!( - "Error in function {}: {}", - function_name, - error.display_with_world(world) + "Error in function {} {}: {}", + display_name, + opt_on, + error.display_with_world(world), ) }, InteropErrorInner::FunctionArgConversionError { argument, error } => { diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 7e6902c89e..78fa08fe95 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -5,7 +5,8 @@ use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; use bindings::{ function::script_function::AppScriptFunctionRegistry, script_value::ScriptValue, - AppReflectAllocator, ReflectAllocator, ScriptTypeRegistration, WorldCallbackAccess, + AppReflectAllocator, ReflectAllocator, ReflectReference, ScriptTypeRegistration, + WorldCallbackAccess, }; use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, @@ -115,6 +116,7 @@ fn register_types(app: &mut App) { app.register_type::(); app.register_type::(); app.register_type::(); + app.register_type::(); } pub trait AddRuntimeInitializer { diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 552b27a13a..76c5960e8d 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -102,7 +102,7 @@ pub fn event_handler( Query<(Entity, Ref)>, )>, ) { - debug!("Handling events with label `{}`", L::into_callback_label()); + trace!("Handling events with label `{}`", L::into_callback_label()); let mut runtime_container = world .remove_non_send_resource::>() diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 42424c47f4..153f2b16e5 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -32,12 +32,13 @@ pub fn register_bevy_bindings(app: &mut App) { } pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrationError> { - NamespaceBuilder::::new(reg) - .register("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) + NamespaceBuilder::::new_unregistered(reg) .register( "get_type_by_name", |world: WorldCallbackAccess, type_name: String| { + println!("get_type_by_name in: {}", type_name); let val = world.get_type_by_name(type_name)?; + println!("get_type_by_name out: {:?}", val); Ok(val.map(Val)) }, ) @@ -97,6 +98,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat w.add_default_component(*e, r.clone()) }, ) + .register("spawn", |s: WorldCallbackAccess| Ok(Val(s.spawn()?))) .register( "insert_children", |caller_context: CallerContext, @@ -142,7 +144,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat }) .register( "query", - |s: WorldCallbackAccess, components: Vec>| { + |components: Vec>| { let mut query_builder = ScriptQueryBuilder::default(); query_builder.components(components.into_iter().map(|v| v.into_inner()).collect()); Ok(Val(query_builder)) @@ -163,6 +165,10 @@ pub fn register_reflect_reference_functions( s.display_with_world(world) }, ) + .register("display_value", |w: WorldCallbackAccess, s: ReflectReference| { + let world = w.try_read().expect("Stale world"); + s.display_value_with_world(world) + }) .register( "get", |caller_context: CallerContext, @@ -381,8 +387,7 @@ pub fn register_script_query_result_functions( NamespaceBuilder::::new(world) .register("entity", |s: Ref| Val::new(s.entity)) .register("components", |s: Ref| { - let components = s.components.to_vec(); - Val::new(components) + s.components.to_vec() }); Ok(()) } diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 708bfd9d15..984ec3aace 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -2,11 +2,14 @@ use std::{any::TypeId, borrow::Cow, marker::PhantomData}; use bevy::{ prelude::{AppFunctionRegistry, AppTypeRegistry, IntoFunction, World}, - reflect::func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, + reflect::{ + func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, + GetTypeRegistration, + }, }; use bevy_mod_scripting_core::bindings::function::script_function::{ - AppScriptFunctionRegistry, DynamicScriptFunction, GetFunctionTypeDependencies, ScriptFunction, - ScriptFunctionRegistry, + AppScriptFunctionRegistry, DynamicScriptFunction, GetFunctionTypeDependencies, + GetInnerTypeDependencies, ScriptFunction, ScriptFunctionRegistry, }; pub trait RegisterNamespacedFunction { @@ -33,9 +36,25 @@ pub trait GetNamespacedFunction { where N: Into>; + fn get_namespaced_function_typed(&self, name: N) -> Option<&DynamicScriptFunction> + where + N: Into>, + NS: IntoNamespace, + { + Self::get_namespaced_function(self, name, NS::into_namespace()) + } + fn has_namespaced_function(&self, name: N, namespace: Namespace) -> bool where N: Into>; + + fn has_namespaced_function_typed(&self, name: N) -> bool + where + N: Into>, + NS: IntoNamespace, + { + Self::has_namespaced_function(self, name, NS::into_namespace()) + } } pub enum Namespace { @@ -128,7 +147,25 @@ pub struct NamespaceBuilder<'a, N> { } impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { - pub fn new(world: &'a mut World) -> Self { + /// Creates a new `NamespaceBuilder` that will register functions in the namespace corresponding to the given type + /// It will also register the type itself in the type registry. + pub fn new(world: &'a mut World) -> Self + where + S: GetTypeRegistration, + { + { + let registry = world.get_resource_or_init::(); + let mut registry = registry.write(); + registry.register::(); + } + Self { + namespace: Default::default(), + world, + } + } + + /// Prefer using the `register` method on the `NamespaceBuilder` instead + pub fn new_unregistered(world: &'a mut World) -> Self { Self { namespace: Default::default(), world, @@ -149,7 +186,7 @@ impl<'a, S: IntoNamespace> NamespaceBuilder<'a, S> { registry.register_namespaced_function::(name, function); } { - let mut type_registry = self.world.get_resource_or_init::(); + let type_registry = self.world.get_resource_or_init::(); let mut type_registry = type_registry.write(); F::register_type_dependencies(&mut type_registry); } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index d9d65457c6..78b2c53750 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -72,7 +72,7 @@ fn lookup_function(lua: &Lua, key: &str, type_id: TypeId) -> Option return Ok(out.into()), Err(e) => last_error = Some(e), } @@ -174,7 +178,7 @@ impl UserData for LuaReflectReference { let out = index_func.call_script_function( vec![ScriptValue::Reference(self_), key], world.clone(), - lua_caller_context(), + lua_caller_context(Some(std::any::TypeId::of::())), )?; LuaScriptValue::from(out).into_lua(lua) }, @@ -192,7 +196,7 @@ impl UserData for LuaReflectReference { .call_script_function( vec![ScriptValue::Reference(self_), key, value], lua.get_world(), - lua_caller_context(), + lua_caller_context(Some(std::any::TypeId::of::())), )?; Ok(()) @@ -303,6 +307,16 @@ impl UserData for LuaReflectReference { }, ); + m.add_meta_function(MetaMethod::Len, |lua, self_: LuaScriptValue| { + let world = lua.get_world(); + let script_value: ScriptValue = self_.into(); + Ok(match script_value { + ScriptValue::Reference(r) => r.len(world)?, + ScriptValue::List(l) => Some(l.len()), + _ => None, + }) + }); + #[cfg(any( feature = "lua54", feature = "lua53", @@ -317,7 +331,7 @@ impl UserData for LuaReflectReference { Ok(LuaScriptValue::from(iter_func.call_script_function( vec![ScriptValue::Reference(s.into())], world, - lua_caller_context(), + lua_caller_context(Some(std::any::TypeId::of::())), )?)) }); @@ -361,12 +375,36 @@ impl UserData for LuaReflectReference { m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { let world = lua.get_world(); - Ok(self_.0.display_with_world(world)) + let self_: ReflectReference = self_.into(); + + let mut display_func = + lookup_dynamic_function_typed::(lua, "display_ref") + .expect("No 'display' function registered for a ReflectReference"); + + let out = display_func.call_script_function( + vec![ScriptValue::Reference(self_)], + world, + lua_caller_context(Some(std::any::TypeId::of::())), + )?; + + Ok(LuaScriptValue::from(out)) }); m.add_function("print_value", |lua, self_: LuaReflectReference| { let world = lua.get_world(); - Ok(self_.0.display_value_with_world(world)) + let self_: ReflectReference = self_.into(); + + let mut display_func = + lookup_dynamic_function_typed::(lua, "display_value") + .expect("No 'display_value' function registered for a ReflectReference"); + + let out = display_func.call_script_function( + vec![ScriptValue::Reference(self_)], + world, + lua_caller_context(Some(std::any::TypeId::of::())), + )?; + + Ok(LuaScriptValue::from(out)) }); } } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 7fce312b40..854f0d3243 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -1,4 +1,7 @@ -use std::ops::{Deref, DerefMut}; +use std::{ + any::TypeId, + ops::{Deref, DerefMut}, +}; use bevy_mod_scripting_core::bindings::{ function::{script_function::CallerContext, CallScriptFunction}, @@ -32,6 +35,12 @@ impl From for LuaScriptValue { } } +impl From for ScriptValue { + fn from(value: LuaScriptValue) -> Self { + value.0 + } +} + impl FromLua for LuaScriptValue { fn from_lua(value: mlua::Value, _lua: &mlua::Lua) -> mlua::Result { Ok(match value { @@ -74,9 +83,10 @@ impl FromLua for LuaScriptValue { } } -pub fn lua_caller_context() -> CallerContext { +pub fn lua_caller_context(self_type: Option) -> CallerContext { CallerContext { convert_to_0_indexed: true, + self_type, } } @@ -96,7 +106,7 @@ impl IntoLua for LuaScriptValue { let out = function.call_script_function( args.into_iter().map(Into::into), world, - lua_caller_context(), + lua_caller_context(None), )?; Ok(LuaScriptValue::from(out)) @@ -113,9 +123,3 @@ impl IntoLua for LuaScriptValue { }) } } - -impl From for ScriptValue { - fn from(value: LuaScriptValue) -> Self { - value.0 - } -} diff --git a/docs/multi-code-block.js b/docs/multi-code-block.js new file mode 100644 index 0000000000..9ec0c06733 --- /dev/null +++ b/docs/multi-code-block.js @@ -0,0 +1,3 @@ +document.addEventListener("DOMContentLoaded", function() { + console.log("Hello, world!"); +}); \ No newline at end of file diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 69651dd09e..b3e64ee1ae 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -1,9 +1,14 @@ # Summary -[Installation](./installation.md) +[Installation](./Summary/installation.md) # Quick Start -- [Managing Scripts](./managing-scripts.md) -- [Running Scripts](./running-scripts.md) -- [Controlling Script Bindings](./controlling-script-bindings.md) \ No newline at end of file +- [Managing Scripts](./Summary/managing-scripts.md) +- [Running Scripts](./Summary/running-scripts.md) +- [Controlling Script Bindings](./Summary/controlling-script-bindings.md) + +# Scripting Reference + +[Introduction](./ScriptingReference/introduction.md) +- [Core Bindings](./ScriptingReference/core-api.md) diff --git a/docs/src/ScriptingReference/core-api.md b/docs/src/ScriptingReference/core-api.md new file mode 100644 index 0000000000..5867ec0b53 --- /dev/null +++ b/docs/src/ScriptingReference/core-api.md @@ -0,0 +1,594 @@ +# Core Bindings + +The core bindings are manually written utilities for interacting with the `Bevy` world and everything contained within it. These bindings are used to create and manipulate entities, components, resources, and systems. + +Every language BMS supports will support these. + +## World + +The `World` is the entry point for interacting with `Bevy`. It is provided to scripts under either the `world` or `World` static variable. + +### get_type_by_name + +| Argument | Type | Description | +| --- | --- | --- | +| `type_name` | `String` | The name of the type to get, this can be either the short type name, i.e. `my_type` or the long name i.e. `my_crate::my_module::my_type` | + +| Return | Description | +| --- | --- | +| `Option` | The type if it exists, otherwise `None` | + +```lua +MyType = world.get_type_by_name("MyType") +if MyType == nil then + print("MyType not found") +end +``` + +### get_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to get the component from | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + +| Return | Description | +| --- | --- | +| `Option` | The reference to the component if it exists, otherwise `None` | + +```lua +local component = world.get_component(entity, MyType) +if component ~= nil then + print("found component:" .. component) +end +``` + +### has_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to check the component for | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + +| Return | Description | +| --- | --- | +| `bool` | `true` if the entity has the component, otherwise `false` | + +```lua +if world.has_component(entity, MyType) then + print("Entity has MyType") +end +``` + +### remove_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to remove the component from | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + +```lua +world.remove_component(entity, MyType) +``` + +### get_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | + +| Return | Description | +| --- | --- | +| `Option` | The resource if it exists, otherwise `None` | + +```lua +local resource = world.get_resource(MyType) +if resource ~= nil then + print("found resource:" .. resource) +end +``` + +### has_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | + +| Return | Description | +| --- | --- | +| `bool` | `true` if the resource exists, otherwise `false` | + +```lua +local hasResource = world.has_resource(MyType) +``` + +### remove_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | + +```lua +world.remove_resource(MyType) +``` + +### add_default_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to add the component to | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + +```lua +world.add_default_component(entity, MyType) +``` + +### spawn + +| Return | Description | +| --- | --- | +| `Entity` | The spawned entity | + +```lua +local entity = world.spawn() +``` + +### insert_children + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The parent entity | +| `index` | `usize` | The index to insert the children at | +| `children` | `Vec` | The children entities to insert | + +```lua +world.insert_children(parent, 1, {child1, child2}) +``` + +### push_children + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The parent entity | +| `children` | `Vec` | The children entities to push | + + +```lua +world.push_children(parent, {child1, child2}) +``` + +### get_children + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The parent entity | + +| Return | Description | +| --- | --- | +| `Vec` | The children entities | + +```lua +local children = world.get_children(parent) +for _, child in pairs(children) do + print("child: " .. child) +end +``` + +### get_parent + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The child entity | + +| Return | Description | +| --- | --- | +| `Option` | The parent entity if it exists, otherwise `None` | + +```lua +local parent = world.get_parent(child) +if parent ~= nil then + print("parent: " .. parent) +end +``` + +### despawn + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to despawn | + +```lua +world.despawn(entity) +``` + +### despawn_descendants + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to despawn descendants of | + +```lua +world.despawn_descendants(entity) +``` + +### despawn_recursive + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to despawn recursively | + +```lua +world.despawn_recursive(entity) +``` + +### has_entity + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to check | + +| Return | Description | +| --- | --- | +| `bool` | `true` if the entity exists, otherwise `false` | + +```lua +local exists = world.has_entity(entity) +if exists then + print("entity exists") +end +``` + +### query + +| Argument | Type | Description | +| --- | --- | --- | +| `components` | `Vec` | The components to query for | + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The query builder | + +```lua +query = world.query({MyType}) +``` + +### exit +Send the exit signal to the application, will gracefully shutdown the application. + +```lua +world.exit() +``` + +## ReflectReference + +ReflectReferences are simply references to date living either: +- In a component +- In a resource +- In the allocator + +Reflect references contain a standard interface which operates over the reflection layer exposed by `Bevy` and also provides a way to call various dynamic functions registered on the underlying pointed to data. + +### display_ref + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to display | + +| Return | Description | +| --- | --- | +| `String` | The reference in string format | + +```lua +print(ref:display_ref()) +print(ref) +``` + +### display_value + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to display | + +| Return | Description | +| --- | --- | +| `String` | The value in string format | + +```lua +print(ref:display_value()) +``` + +### get +The index function, allows you to index into the reflect reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to get the value for | + +| Return | Description | +| --- | --- | +| `ScriptValue` | The value | + +```lua +local value = ref:get(key) +-- same as +local value = ref.key +local value = ref[key] +local value = ref["key"] +-- for tuple structs +local valye = ref._1 +``` + +### set + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to set the value for | +| `value` | `ScriptValue` | The value to set | + +| Return | Description | +| --- | --- | +| `ScriptValue` | The result | + +```lua +ref:set(key, value) +-- same as +ref.key = value +ref[key] = value +ref["key"] = value +-- for tuple structs +ref._1 = value +``` + +### push +Generic push method, if the underlying type supports it, will push the value into the end of the reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `value` | `ScriptValue` | The value to push | + +```lua +ref:push(value) +``` + +### pop +Generic pop method, if the underlying type supports it, will pop the value from the end of the reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to pop from | + +| Return | Description | +| --- | --- | +| `ScriptValue` | The popped value | + +```lua +local value = ref:pop() +``` + +### insert +Generic insert method, if the underlying type supports it, will insert the value at the key. + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to insert the value for | +| `value` | `ScriptValue` | The value to insert | + +```lua +ref:insert(key, value) +``` + +### clear +Generic clear method, if the underlying type supports it, will clear the referenced container type. + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to clear | + + +```lua +ref:clear() +``` + +### len +Generic length method, if the underlying type supports it, will return the length of the referenced container or length relevant to the type itself (number of fields etc.). + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to get the length of | + +| Return | Description | +| --- | --- | +| `usize` | The length | + +```lua +length = ref:len() +``` + +### remove +Generic remove method, if the underlying type supports it, will remove the value at the key. + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to remove the value for | + +| Return | Description | +| --- | --- | +| `ScriptValue` | The removed value | + +```lua +local value = ref:remove(key) +``` + +### iter +The iterator function, returns a function which can be called to iterate over the reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to iterate over | + +| Return | Description | +| --- | --- | +| `ScriptFunctionMut` | The iterator function | + +```lua +local iter = ref:iter() +local val = iter() +while val do + print(val) + next = iter() +end + +-- same as +for val in pairs(ref) do + print(val) +end +``` + +## ScriptTypeRegistration + +A reference to a type registration, in general think of this as a handle to a type. + +### type_name + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + +| Return | Description | +| --- | --- | +| `String` | The type name | + +```lua +local name = MyType:type_name() +``` + +### short_name + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + +| Return | Description | +| --- | --- | +| `String` | The short name | + +```lua +local name = MyType:short_name() +``` + +### is_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + +| Return | Description | +| --- | --- | +| `bool` | `true` if the type is a resource, otherwise `false` | + +```lua +if MyType:is_resource() then + print("MyType is a resource") +end +``` + +### is_component + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + +| Return | Description | +| --- | --- | +| `bool` | `true` if the type is a component, otherwise `false` | + +```lua +if MyType:is_component() then + print("MyType is a component") +end +``` + +## ScriptQueryBuilder + +The query builder is used to build queries for entities with specific components. Can be used to interact with arbitrary entities in the world. + +### with + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | +| `with` | `ScriptTypeRegistration` | The component to include in the query | + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The updated query builder | + +```lua +query:with(MyType):with(MyOtherType) +``` + +### without + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | +| `without` | `ScriptTypeRegistration` | The component to exclude from the query | + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The updated query builder | + +```lua +query:without(MyType):without(MyOtherType) +``` + +### build + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | + +| Return | Description | +| --- | --- | +| `Vec` | The query results | + +```lua +local results = query.build() +for _, result in pairs(results) do + print(result) +end +``` + +## ScriptQueryResult + +The result of a query, built by the query builder. + +### entity + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryResult` | The query result | + +| Return | Description | +| --- | --- | +| `Entity` | The entity | + +```lua +local entity = result:entity() +``` + +### components + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryResult` | The query result | + +| Return | Description | +| --- | --- | +| `Vec` | The components | + +```lua +for _, component in pairs(result:components()) do + print(component) +end +``` \ No newline at end of file diff --git a/docs/src/ScriptingReference/introduction.md b/docs/src/ScriptingReference/introduction.md new file mode 100644 index 0000000000..ea1e0826b6 --- /dev/null +++ b/docs/src/ScriptingReference/introduction.md @@ -0,0 +1,5 @@ +# Scripting Reference + +This part of the book covers the user-facing API of the scripting languages supported by BMS. This will be where you will want to forward your script users to get started with scripting in BMS. + +If you are a modder, welcome! 👋, apologies for the rust-centricity of this guide, we are working on it! \ No newline at end of file diff --git a/docs/src/controlling-script-bindings.md b/docs/src/Summary/controlling-script-bindings.md similarity index 100% rename from docs/src/controlling-script-bindings.md rename to docs/src/Summary/controlling-script-bindings.md diff --git a/docs/src/installation.md b/docs/src/Summary/installation.md similarity index 100% rename from docs/src/installation.md rename to docs/src/Summary/installation.md diff --git a/docs/src/managing-scripts.md b/docs/src/Summary/managing-scripts.md similarity index 100% rename from docs/src/managing-scripts.md rename to docs/src/Summary/managing-scripts.md diff --git a/docs/src/running-scripts.md b/docs/src/Summary/running-scripts.md similarity index 100% rename from docs/src/running-scripts.md rename to docs/src/Summary/running-scripts.md diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 84a46d1690..dc47663a20 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -1,9 +1,12 @@ #![allow(deprecated)] use std::sync::Mutex; +use ansi_parser::AnsiParser; +use asset::ScriptAsset; use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, image::ImageSampler, + log::LogPlugin, prelude::*, reflect::Reflect, render::{ @@ -13,9 +16,102 @@ use bevy::{ window::{PrimaryWindow, WindowResized}, }; -use bevy_mod_scripting::prelude::*; +use bevy_console::{ + make_layer, send_log_buffer_to_console, AddConsoleCommand, ConsoleCommand, + ConsoleConfiguration, ConsoleOpen, ConsolePlugin, PrintConsoleLine, +}; +use bevy_mod_scripting::{prelude::*, ScriptFunctionsPlugin}; use bevy_mod_scripting_lua::LuaScriptingPlugin; use bindings::script_value::ScriptValue; +use clap::Parser; +use commands::DeleteScript; +use script::ScriptComponent; + +// CONSOLE SETUP + +fn console_app(app: &mut App) -> &mut App { + // forward logs to the console + app.add_plugins(( + DefaultPlugins.set(LogPlugin { + level: bevy::log::Level::INFO, + filter: "error,game_of_life=info".to_owned(), + custom_layer: make_layer, + }), + ConsolePlugin, + )) + .add_console_command::(run_script_cmd) + .add_systems(Startup, |mut open: ResMut| { + open.open = true; + }) +} + +fn run_script_cmd( + mut log: ConsoleCommand, + mut commands: Commands, + mut loaded_scripts: ResMut, +) { + if let Some(Ok(command)) = log.take() { + match command { + GameOfLifeCommand::Start => { + // create an entity with the script component + bevy::log::info!("Starting game of life!"); + commands.spawn(ScriptComponent::new( + vec!["scripts/game_of_life.lua".into()], + )); + } + GameOfLifeCommand::Stop => { + // we can simply drop the handle, or manually delete, I'll just drop the handle + bevy::log::info!("Stopping game of life!"); + + // I am not mapping the handles to the script names, so I'll just clear the entire list + loaded_scripts.0.clear(); + + // you could also do: + // commands.queue(DeleteScript::::new( + // "scripts/game_of_life.lua".into(), + // )); + } + } + } +} + +// we use bevy-debug-console to demonstrate how this can fit in in the runtime of a game +// note that using just the entity id instead of the full Entity has issues, +// but since we aren't despawning/spawning entities this works in our case +#[derive(Parser, ConsoleCommand)] +#[command(name = "gol")] +///Runs a Lua script from the `assets/scripts` directory +pub enum GameOfLifeCommand { + Start, + Stop, +} + +// GAME OF LIFE +fn game_of_life_app(app: &mut App) -> &mut App { + app.insert_resource(Time::::from_seconds(UPDATE_FREQUENCY.into())) + .add_plugins(( + // for FPS counters + LogDiagnosticsPlugin::default(), + FrameTimeDiagnosticsPlugin, + // for scripting + LuaScriptingPlugin::default(), + ScriptFunctionsPlugin, + )) + .register_type::() + .register_type::() + .init_resource::() + .init_resource::() + .add_systems(Startup, (init_game_of_life_state, load_script_assets)) + .add_systems(Update, sync_window_size) + .add_systems( + FixedUpdate, + ( + update_rendered_state.after(sync_window_size), + send_on_update.after(update_rendered_state), + event_handler::, + ), + ) +} #[derive(Debug, Default, Clone, Reflect, Component)] #[reflect(Component)] @@ -23,6 +119,9 @@ pub struct LifeState { pub cells: Vec, } +#[derive(Debug, Resource, Default)] +pub struct LoadedScripts(pub Vec>); + #[derive(Reflect, Resource)] #[reflect(Resource)] pub struct Settings { @@ -45,6 +144,16 @@ impl Default for Settings { } } +/// Prepares any scripts by loading them and storing the handles. +pub fn load_script_assets( + asset_server: Res, + mut loaded_scripts: ResMut, +) { + loaded_scripts + .0 + .push(asset_server.load("scripts/game_of_life.lua")); +} + pub fn init_game_of_life_state( mut commands: Commands, mut assets: ResMut>, @@ -82,6 +191,8 @@ pub fn init_game_of_life_state( as usize ], }); + + bevy::log::info!("Game of life was initialized. use `gol start` to start the game!"); } pub fn sync_window_size( @@ -151,20 +262,13 @@ pub fn send_on_update(mut events: EventWriter) { const UPDATE_FREQUENCY: f32 = 1.0 / 60.0; +// MAIN + fn main() -> std::io::Result<()> { let mut app = App::new(); - app.add_plugins(DefaultPlugins) - .insert_resource(Time::::from_seconds(UPDATE_FREQUENCY.into())) - .add_plugins(LogDiagnosticsPlugin::default()) - .add_plugins(FrameTimeDiagnosticsPlugin) - .add_plugins(LuaScriptingPlugin::default()) - .init_resource::() - .add_systems(Startup, init_game_of_life_state) - .add_systems(Update, sync_window_size) - .add_systems(FixedUpdate, update_rendered_state.after(sync_window_size)) - .add_systems(FixedUpdate, send_on_update.after(update_rendered_state)) - .add_systems(FixedUpdate, event_handler::); + console_app(&mut app); + game_of_life_app(&mut app); app.run(); diff --git a/log.out b/log.out new file mode 100644 index 0000000000..f16c4b42a2 --- /dev/null +++ b/log.out @@ -0,0 +1,841 @@ +warning: unused import: `Args` + --> crates/bevy_mod_scripting_core/src/lib.rs:14:15 + | +14 | use handler::{Args, CallbackSettings, HandlerFn}; + | ^^^^ + | + = note: `#[warn(unused_imports)]` on by default + +warning: unused import: `utils::BoxedFuture` + --> crates/bevy_mod_scripting_core/src/asset.rs:10:5 + | +10 | utils::BoxedFuture, + | ^^^^^^^^^^^^^^^^^^ + +warning: unused import: `AtomicUsize` + --> crates/bevy_mod_scripting_core/src/bindings/access_map.rs:2:32 + | +2 | sync::atomic::{AtomicBool, AtomicUsize}, + | ^^^^^^^^^^^ + +warning: unused imports: `Map` and `try_result::TryResult` + --> crates/bevy_mod_scripting_core/src/bindings/access_map.rs:10:15 + | +10 | use dashmap::{try_result::TryResult, DashMap, Entry, Map}; + | ^^^^^^^^^^^^^^^^^^^^^ ^^^ + +warning: unused imports: `any::TypeId`, `borrow::Cow`, `ops::Deref`, and `sync::Arc` + --> crates/bevy_mod_scripting_core/src/bindings/function/mod.rs:1:11 + | +1 | use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; + | ^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^ + +warning: unused imports: `ReflectReference` and `downcast_into_value` + --> crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs:6:44 + | +6 | bindings::{function::from::FromScript, ReflectReference, WorldGuard}, + | ^^^^^^^^^^^^^^^^ +7 | downcast_into_value, + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Path` + --> crates/bevy_mod_scripting_core/src/bindings/function/into.rs:4:12 + | +4 | path::{Path, PathBuf}, + | ^^^^ + +warning: unused imports: `GetTypeRegistration` and `ReflectRef` + --> crates/bevy_mod_scripting_core/src/bindings/function/into.rs:7:21 + | +7 | use bevy::reflect::{GetTypeRegistration, PartialReflect, ReflectRef}; + | ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ + +warning: unused import: `any::TypeId` + --> crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs:1:11 + | +1 | use std::{any::TypeId, ffi::OsString, path::PathBuf}; + | ^^^^^^^^^^^ + +warning: unused imports: `AppFunctionRegistry`, `DynamicFunction`, `FunctionInfo`, `IntoFunction`, `PartialReflect`, `TypeRegistration`, `TypedFunction`, and `World` + --> crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs:11:15 + | +11 | prelude::{AppFunctionRegistry, IntoFunction, Reflect, Resource, World}, + | ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^ +12 | reflect::{ +13 | func::{args::GetOwnership, DynamicFunction, FunctionError, FunctionInfo, TypedFunction}, + | ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^ +14 | FromReflect, GetTypeRegistration, PartialReflect, TypePath, TypeRegistration, TypeRegistry, + | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ + +warning: unused imports: `ArgInfo`, `ArgList`, `ArgValue`, `Arg`, `DynamicFunction`, `FunctionInfo`, `FunctionResult`, `Ownership`, `PartialReflect`, and `Return` + --> crates/bevy_mod_scripting_core/src/bindings/function/mod.rs:11:16 + | +11 | args::{Arg, ArgInfo, Ownership}, + | ^^^ ^^^^^^^ ^^^^^^^^^ +12 | ArgList, ArgValue, DynamicFunction, FunctionInfo, FunctionResult, Return, + | ^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^ +13 | }, +14 | PartialReflect, + | ^^^^^^^^^^^^^^ + +warning: unused imports: `FlattenError`, `InteropErrorInner`, `PartialReflectExt`, `ReturnValExt`, `ScriptError`, and `ScriptResult` + --> crates/bevy_mod_scripting_core/src/bindings/function/mod.rs:19:13 + | +19 | error::{FlattenError, InteropError, InteropErrorInner, ScriptError, ScriptResult}, + | ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^ +20 | reflection_extensions::{PartialReflectExt, ReturnValExt}, + | ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ + +warning: unused imports: `ReflectBase`, `ReflectReference`, `WorldAccessGuard`, `access_map::ReflectAccessId`, and `pretty_print::DisplayWithWorld` + --> crates/bevy_mod_scripting_core/src/bindings/function/mod.rs:24:5 + | +24 | access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_value::ScriptValue, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +25 | ReflectBase, ReflectReference, WorldAccessGuard, WorldCallbackAccess, WorldGuard, + | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ + +warning: unused imports: `CONCURRENT_WORLD_ACCESS_MSG` and `STALE_WORLD_MSG` + --> crates/bevy_mod_scripting_core/src/bindings/query.rs:3:16 + | +3 | bindings::{CONCURRENT_WORLD_ACCESS_MSG, STALE_WORLD_MSG}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ + +warning: unused imports: `WorldAccessGuard` and `WorldCallbackAccess` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:9:5 + | +9 | WorldAccessGuard, WorldCallbackAccess, WorldGuard, + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `ScriptResult` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:14:33 + | +14 | prelude::{ReflectAllocator, ScriptResult}, + | ^^^^^^^^^^^^ + +warning: unused imports: `ArgValue`, `ReflectFromReflect`, `ReflectMut`, `ReflectPathError`, `ReflectRef`, and `args::ArgInfo` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:26:16 + | +26 | func::{args::ArgInfo, ArgValue}, + | ^^^^^^^^^^^^^ ^^^^^^^^ +27 | ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectFromReflect, ReflectMut, + | ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +28 | ReflectPath, ReflectPathError, ReflectRef, TypeData, + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^ + +warning: unused import: `itertools::Either` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:31:5 + | +31 | use itertools::Either; + | ^^^^^^^^^^^^^^^^^ + +warning: unused import: `sync::Arc` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:32:36 + | +32 | use std::{any::TypeId, fmt::Debug, sync::Arc}; + | ^^^^^^^^^ + +warning: unused imports: `CStr`, `CString`, `OsStr`, `OsString`, `PathBuf`, `Path`, `TypeId`, and `type_name` + --> crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs:2:11 + | +2 | any::{type_name, TypeId}, + | ^^^^^^^^^ ^^^^^^ +3 | borrow::Cow, +4 | ffi::{CStr, CString, OsStr, OsString}, + | ^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^ +5 | path::{Path, PathBuf}, + | ^^^^ ^^^^^^^ + +warning: unused imports: `Access`, `DynamicEnum`, `DynamicList`, `DynamicTuple`, `DynamicVariant`, `PartialReflect`, `ReflectFromReflect`, and `TypeData` + --> crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs:9:5 + | +9 | Access, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, + | ^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^ +10 | PartialReflect, Reflect, ReflectFromReflect, TypeData, + | ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ ^^^^^^^^ + +warning: unused imports: `InteropErrorInner`, `PartialReflectExt`, `ScriptError`, `ScriptResult`, `TypeIdExtensions`, and `TypeInfoExtensions` + --> crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs:14:27 + | +14 | error::{InteropError, InteropErrorInner, ScriptError, ScriptResult}, + | ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^ +15 | reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, + | ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `DynamicScriptFunction`, `WorldGuard`, and `pretty_print::DisplayWithWorld` + --> crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs:19:33 + | +19 | function::script_function::{DynamicScriptFunction, DynamicScriptFunctionMut}, + | ^^^^^^^^^^^^^^^^^^^^^ +20 | pretty_print::DisplayWithWorld, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +21 | ReflectReference, WorldGuard, + | ^^^^^^^^^^ + +warning: unused imports: `AtomicUsize`, `Ordering`, `marker::PhantomData`, and `mem` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:11:5 + | +11 | marker::PhantomData, + | ^^^^^^^^^^^^^^^^^^^ +12 | mem, + | ^^^ +... +15 | atomic::{AtomicUsize, Ordering}, + | ^^^^^^^^^^^ ^^^^^^^^ + +warning: unused imports: `TypeRegistry` and `utils::HashMap` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:33:19 + | +33 | TypePath, TypeRegistry, TypeRegistryArc, + | ^^^^^^^^^^^^ +34 | }, +35 | utils::HashMap, + | ^^^^^^^^^^^^^^ + +warning: unused import: `smallvec::SmallVec` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:38:5 + | +38 | use smallvec::SmallVec; + | ^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `ReflectAllocator`, `ScriptError`, `ScriptResult`, and `bindings::ReflectAllocationId` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:41:5 + | +41 | bindings::ReflectAllocationId, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +42 | error::InteropError, +43 | prelude::{ReflectAllocator, ScriptError, ScriptResult}, + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ ^^^^^^^^^^^^ + +warning: unused imports: `Context` and `Runtime` + --> crates/bevy_mod_scripting_core/src/commands.rs:7:15 + | +7 | context::{Context, ContextLoadingSettings, ScriptContexts}, + | ^^^^^^^ +8 | prelude::{Runtime, RuntimeContainer}, + | ^^^^^^^ + +warning: unused import: `Runtime` + --> crates/bevy_mod_scripting_core/src/context.rs:6:15 + | +6 | prelude::{Runtime, ScriptError}, + | ^^^^^^^ + +warning: unused import: `borrow::Cow` + --> crates/bevy_mod_scripting_core/src/error.rs:3:5 + | +3 | borrow::Cow, + | ^^^^^^^^^^^ + +warning: unused imports: `ApplyError`, `FunctionInfo`, `ReflectPathError`, and `args::ArgInfo` + --> crates/bevy_mod_scripting_core/src/error.rs:14:16 + | +14 | func::{args::ArgInfo, FunctionError, FunctionInfo}, + | ^^^^^^^^^^^^^ ^^^^^^^^^^^^ +15 | ApplyError, PartialReflect, Reflect, ReflectPathError, + | ^^^^^^^^^^ ^^^^^^^^^^^^^^^^ + +warning: unused import: `thiserror::Error` + --> crates/bevy_mod_scripting_core/src/error.rs:18:5 + | +18 | use thiserror::Error; + | ^^^^^^^^^^^^^^^^ + +warning: unused imports: `ReflectAllocationId` and `ReflectBase` + --> crates/bevy_mod_scripting_core/src/error.rs:24:9 + | +24 | ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference, + | ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^ + +warning: unused import: `handler::Args` + --> crates/bevy_mod_scripting_core/src/event.rs:3:33 + | +3 | use crate::{error::ScriptError, handler::Args, prelude::ScriptValue, script::ScriptId}; + | ^^^^^^^^^^^^^ + +warning: unused imports: `Context` and `runtime::Runtime` + --> crates/bevy_mod_scripting_core/src/handler.rs:4:15 + | +4 | context::{Context, ContextPreHandlingInitializer}, + | ^^^^^^^ +... +7 | runtime::Runtime, + | ^^^^^^^^^^^^^^^^ + +warning: unused imports: `CStr`, `CString`, `OsStr`, `OsString`, `PathBuf`, `Path`, and `borrow::Cow` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:3:5 + | +3 | borrow::Cow, + | ^^^^^^^^^^^ +4 | cmp::max, +5 | ffi::{CStr, CString, OsStr, OsString}, + | ^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^ +6 | ops::Sub, +7 | path::{Path, PathBuf}, + | ^^^^ ^^^^^^^ + +warning: unused imports: `WorldAccessGuard` and `script_value::ScriptValue` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:19:41 + | +19 | pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +20 | WorldAccessGuard, WorldGuard, + | ^^^^^^^^^^^^^^^^ + +warning: unused imports: `Args`, `Context`, `ReflectAllocator`, `Runtime`, and `ScriptResult` + --> crates/bevy_mod_scripting_core/src/systems.rs:6:48 + | +6 | bindings::{pretty_print::DisplayWithWorld, ReflectAllocator, WorldAccessGuard, WorldGuard}, + | ^^^^^^^^^^^^^^^^ +7 | commands::{CreateOrUpdateScript, DeleteScript}, +8 | context::{Context, ContextLoadingSettings, ScriptContexts}, + | ^^^^^^^ +9 | error::{ScriptError, ScriptResult}, + | ^^^^^^^^^^^^ +10 | event::{IntoCallbackLabel, ScriptCallbackEvent, ScriptErrorEvent}, +11 | handler::{Args, CallbackSettings}, + | ^^^^ +12 | prelude::{AppReflectAllocator, RuntimeSettings}, +13 | runtime::{Runtime, RuntimeContainer}, + | ^^^^^^^ + +warning: unused import: `AsyncReadExt` + --> crates/bevy_mod_scripting_core/src/asset.rs:7:33 + | +7 | asset::{Asset, AssetLoader, AsyncReadExt}, + | ^^^^^^^^^^^^ + +warning: unused import: `std::io::Read` + --> crates/bevy_mod_scripting_core/src/bindings/allocator.rs:8:5 + | +8 | use std::io::Read; + | ^^^^^^^^^^^^^ + +warning: unused import: `Reflect` + --> crates/bevy_mod_scripting_core/src/bindings/allocator.rs:2:37 + | +2 | use bevy::reflect::{PartialReflect, Reflect}; + | ^^^^^^^ + +warning: unused import: `Any` + --> crates/bevy_mod_scripting_core/src/bindings/allocator.rs:4:16 + | +4 | use std::any::{Any, TypeId}; + | ^^^ + +warning: unused import: `GetTypeRegistration` + --> crates/bevy_mod_scripting_core/src/bindings/function/from.rs:6:34 + | +6 | use bevy::reflect::{FromReflect, GetTypeRegistration, Reflect}; + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `itertools::Itertools` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:15:5 + | +15 | use itertools::Itertools; + | ^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `pretty_print::DisplayWithWorld` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:19:9 + | +19 | pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `TypeData` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:13:17 + | +13 | ReflectMut, TypeData, TypeInfo, + | ^^^^^^^^ + +warning: unused import: `FromType` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:12:32 + | +12 | func::Return, FromReflect, FromType, List, PartialReflect, Reflect, ReflectFromReflect, + | ^^^^^^^^ + +warning: unused import: `AccessMapKey` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:8:18 + | +8 | access_map::{AccessMapKey, ReflectAccessId}, + | ^^^^^^^^^^^^ + +warning: unused import: `pretty_print::DisplayWithWorld` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:12:16 + | +12 | bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `List` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:12:42 + | +12 | func::Return, FromReflect, FromType, List, PartialReflect, Reflect, ReflectFromReflect, + | ^^^^ + +warning: unused import: `TypeData` + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:28:52 + | +28 | ReflectPath, ReflectPathError, ReflectRef, TypeData, + | ^^^^^^^^ + +warning: unused import: `str::FromStr` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:8:5 + | +8 | str::FromStr, + | ^^^^^^^^^^^^ + +warning: unused import: `ops::Sub` + --> crates/bevy_mod_scripting_core/src/reflection_extensions.rs:6:5 + | +6 | ops::Sub, + | ^^^^^^^^ + +warning: unused import: `ops::Deref` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:13:5 + | +13 | ops::Deref, + | ^^^^^^^^^^ + +warning: unused import: `DerefMut` + --> crates/bevy_mod_scripting_core/src/error.rs:5:18 + | +5 | ops::{Deref, DerefMut}, + | ^^^^^^^^ + +warning: unused import: `func::args::FromArg` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:32:9 + | +32 | func::args::FromArg, std_traits::ReflectDefault, ParsedPath, PartialReflect, Reflect, + | ^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `PartialReflect` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:32:70 + | +32 | func::args::FromArg, std_traits::ReflectDefault, ParsedPath, PartialReflect, Reflect, + | ^^^^^^^^^^^^^^ + +warning: unused import: `TypePath` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:33:9 + | +33 | TypePath, TypeRegistry, TypeRegistryArc, + | ^^^^^^^^ + +warning: unused import: `reflection_extensions::TypeIdExtensions` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:44:5 + | +44 | reflection_extensions::TypeIdExtensions, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused variable: `value` + --> crates/bevy_mod_scripting_core/src/bindings/function/from.rs:37:20 + | +37 | fn from_script(value: ScriptValue, _world: WorldGuard) -> Result { + | ^^^^^ help: if this is intentional, prefix it with an underscore: `_value` + | + = note: `#[warn(unused_variables)]` on by default + +warning: unused variable: `v` + --> crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs:151:32 + | +151 | ScriptValue::Float(v) => { + | ^ help: if this is intentional, prefix it with an underscore: `_v` + +warning: unused variable: `e` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:701:27 + | +701 | .map_err(|e| InteropError::missing_entity(entity))?; + | ^ help: if this is intentional, prefix it with an underscore: `_e` + +warning: unused variable: `e` + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:777:27 + | +777 | .map_err(|e| InteropError::missing_entity(entity))?; + | ^ help: if this is intentional, prefix it with an underscore: `_e` + +warning: function `map_key_to_concrete` is never used + --> crates/bevy_mod_scripting_core/src/bindings/reference.rs:465:4 + | +465 | fn map_key_to_concrete(key: &str, key_type_id: TypeId) -> Option> { + | ^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: constant `STALE_WORLD_MSG` is never used + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:116:18 + | +116 | pub(crate) const STALE_WORLD_MSG: &str = "Tried to access world via stale reference"; + | ^^^^^^^^^^^^^^^ + +warning: constant `CONCURRENT_WORLD_ACCESS_MSG` is never used + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:117:18 + | +117 | pub(crate) const CONCURRENT_WORLD_ACCESS_MSG: &str = + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: constant `CONCURRENT_ACCESS_MSG` is never used + --> crates/bevy_mod_scripting_core/src/bindings/world.rs:119:18 + | +119 | pub(crate) const CONCURRENT_ACCESS_MSG: &str = + | ^^^^^^^^^^^^^^^^^^^^^ + +warning: bounds on generic parameters in type aliases are not enforced + --> crates/bevy_mod_scripting_core/src/context.rs:55:32 + | +55 | pub type ContextInitializer = + | ^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias + | + = note: this is a known limitation of the type checker that may be lifted in a future edition. + see issue #112792 for more information + = note: `#[warn(type_alias_bounds)]` on by default +help: remove this bound + | +55 - pub type ContextInitializer = +55 + pub type ContextInitializer

= + | +help: fully qualify this associated type + | +56 | fn(&ScriptId, &mut

::C) -> Result<(), ScriptError>; + | + +++++++++++++++ + +warning: bounds on generic parameters in type aliases are not enforced + --> crates/bevy_mod_scripting_core/src/context.rs:58:43 + | +58 | pub type ContextPreHandlingInitializer = + | ^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias + | + = note: this is a known limitation of the type checker that may be lifted in a future edition. + see issue #112792 for more information +help: remove this bound + | +58 - pub type ContextPreHandlingInitializer = +58 + pub type ContextPreHandlingInitializer

= + | +help: fully qualify this associated type + | +59 | fn(&ScriptId, Entity, &mut

::C) -> Result<(), ScriptError>; + | + +++++++++++++++ + +warning: bounds on generic parameters in type aliases are not enforced + --> crates/bevy_mod_scripting_core/src/handler.rs:15:23 + | +15 | pub type HandlerFn = fn( + | ^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias + | + = note: this is a known limitation of the type checker that may be lifted in a future edition. + see issue #112792 for more information +help: remove this bound + | +15 - pub type HandlerFn = fn( +15 + pub type HandlerFn

= fn( + | +help: fully qualify this associated type + | +20 | context: &mut

::C, + | + +++++++++++++++ +help: fully qualify this associated type + | +22 | runtime: &mut

::R, + | + +++++++++++++++ + +warning: bounds on generic parameters in type aliases are not enforced + --> crates/bevy_mod_scripting_core/src/runtime.rs:11:32 + | +11 | pub type RuntimeInitializer = fn(&mut P::R); + | ^^^^^^^^^^^^^^^^^^^^^^ will not be checked at usage sites of the type alias + | + = note: this is a known limitation of the type checker that may be lifted in a future edition. + see issue #112792 for more information +help: remove this bound + | +11 - pub type RuntimeInitializer = fn(&mut P::R); +11 + pub type RuntimeInitializer

= fn(&mut P::R); + | +help: fully qualify this associated type + | +11 | pub type RuntimeInitializer = fn(&mut

::R); + | + +++++++++++++++ + +warning: `bevy_mod_scripting_core` (lib) generated 71 warnings (run `cargo fix --lib -p bevy_mod_scripting_core` to apply 38 suggestions) +warning: unused import: `std::borrow::Cow` + --> crates/bevy_mod_scripting_functions/src/core.rs:2:5 + | +2 | use std::borrow::Cow; + | ^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default + +warning: unused imports: `FunctionRegistryArc`, `FunctionRegistry`, and `GetTypeRegistration` + --> crates/bevy_mod_scripting_functions/src/core.rs:7:43 + | +7 | func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, GetTypeRegistration, ParsedPath + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `GetFunctionTypeDependencies`, `Mut`, `ScriptFunction`, and `WorldAccessGuard` + --> crates/bevy_mod_scripting_functions/src/core.rs:13:16 + | +13 | from::{Mut, Ref, Val}, + | ^^^ +... +16 | script_function::{CallerContext, GetFunctionTypeDependencies, ScriptFunction, ScriptFunctionMut}, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ +... +21 | ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, + | ^^^^^^^^^^^^^^^^ + +warning: unused import: `InteropErrorInner` + --> crates/bevy_mod_scripting_functions/src/core.rs:23:27 + | +23 | use error::{InteropError, InteropErrorInner}; + | ^^^^^^^^^^^^^^^^^ + +warning: unused imports: `AppFunctionRegistry`, `DynamicFunction`, `FunctionRegistrationError`, `FunctionRegistry`, and `IntoFunction` + --> crates/bevy_mod_scripting_functions/src/namespaced_register.rs:4:15 + | +4 | prelude::{AppFunctionRegistry, AppTypeRegistry, IntoFunction, World}, + | ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ +5 | reflect::func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, + | ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ + +warning: unused variable: `s` + --> crates/bevy_mod_scripting_functions/src/core.rs:145:14 + | +145 | |s: WorldCallbackAccess, components: Vec>| { + | ^ help: if this is intentional, prefix it with an underscore: `_s` + | + = note: `#[warn(unused_variables)]` on by default + +warning: unused variable: `idx` + --> crates/bevy_mod_scripting_functions/src/core.rs:313:32 + | +313 | let (next_ref, idx) = infinite_iter.next_ref(); + | ^^^ help: if this is intentional, prefix it with an underscore: `_idx` + +warning: variable does not need to be mutable + --> crates/bevy_mod_scripting_functions/src/namespaced_register.rs:152:21 + | +152 | let mut type_registry = self.world.get_resource_or_init::(); + | ----^^^^^^^^^^^^^ + | | + | help: remove this `mut` + | + = note: `#[warn(unused_mut)]` on by default + +warning: `bevy_mod_scripting_functions` (lib) generated 8 warnings (run `cargo fix --lib -p bevy_mod_scripting_functions` to apply 6 suggestions) +warning: unexpected `cfg` condition value: `teal` + --> crates/languages/bevy_mod_scripting_lua/src/util.rs:16:11 + | +16 | #[cfg(all(feature = "teal", debug_assertions))] + | ^^^^^^^^^^^^^^^^ + | + = note: expected values for `feature` are: `lua51`, `lua52`, `lua53`, `lua54`, `luajit`, `luajit52`, `luau`, `mlua_async`, `mlua_macros`, `mlua_serialize`, and `unsafe_lua_modules` + = help: consider adding `teal` as a feature in `Cargo.toml` + = note: see for more information about checking conditional configuration + = note: `#[warn(unexpected_cfgs)]` on by default + +warning: unexpected `cfg` condition value: `teal` + --> crates/languages/bevy_mod_scripting_lua/src/util.rs:32:34 + | +32 | #[cfg(all(not(debug_assertions), feature = "teal"))] + | ^^^^^^^^^^^^^^^^ + | + = note: expected values for `feature` are: `lua51`, `lua52`, `lua53`, `lua54`, `luajit`, `luajit52`, `luau`, `mlua_async`, `mlua_macros`, `mlua_serialize`, and `unsafe_lua_modules` + = help: consider adding `teal` as a feature in `Cargo.toml` + = note: see for more information about checking conditional configuration + +warning: unexpected `cfg` condition value: `teal` + --> crates/languages/bevy_mod_scripting_lua/src/util.rs:48:11 + | +48 | #[cfg(not(feature = "teal"))] + | ^^^^^^^^^^^^^^^^ + | + = note: expected values for `feature` are: `lua51`, `lua52`, `lua53`, `lua54`, `luajit`, `luajit52`, `luau`, `mlua_async`, `mlua_macros`, `mlua_serialize`, and `unsafe_lua_modules` + = help: consider adding `teal` as a feature in `Cargo.toml` + = note: see for more information about checking conditional configuration + +warning: unused imports: `DerefMut` and `Deref` + --> crates/languages/bevy_mod_scripting_lua/src/util.rs:1:16 + | +1 | use std::ops::{Deref, DerefMut}; + | ^^^^^ ^^^^^^^^ + | + = note: `#[warn(unused_imports)]` on by default + +warning: unused imports: `AppTypeRegistry`, `FromType`, `GetTypeRegistration`, `Mut`, `PartialReflect`, `Startup`, `TypePath`, and `impl_reflect` + --> crates/languages/bevy_mod_scripting_lua/src/lib.rs:3:24 + | +3 | app::{App, Plugin, Startup}, + | ^^^^^^^ +4 | ecs::{entity::Entity, world::World}, +5 | prelude::{AppTypeRegistry, Mut}, + | ^^^^^^^^^^^^^^^ ^^^ +6 | reflect::{impl_reflect, FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, + | ^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^ + +warning: unused imports: `IntoCallbackLabel`, `ReflectAllocator`, `ReflectReference`, `handler::Args`, and `systems::event_handler` + --> crates/languages/bevy_mod_scripting_lua/src/lib.rs:10:36 + | +10 | script_value::ScriptValue, ReflectAllocator, ReflectReference, WorldCallbackAccess, + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ +... +14 | event::{CallbackLabel, IntoCallbackLabel}, + | ^^^^^^^^^^^^^^^^^ +15 | handler::Args, + | ^^^^^^^^^^^^^ +... +18 | systems::event_handler, + | ^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `LuaWorld` + --> crates/languages/bevy_mod_scripting_lua/src/lib.rs:27:23 + | +27 | world::{GetWorld, LuaWorld}, + | ^^^^^^^^ + +warning: unused import: `IntoLuaMulti` + --> crates/languages/bevy_mod_scripting_lua/src/lib.rs:30:22 + | +30 | use mlua::{Function, IntoLuaMulti, Lua}; + | ^^^^^^^^^^^^ + +warning: unused imports: `CStr`, `CString`, `OsStr`, `OsString`, `PathBuf`, `Path`, `borrow::Cow`, and `sync::Arc` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:3:5 + | +3 | borrow::Cow, + | ^^^^^^^^^^^ +4 | error::Error, +5 | ffi::{CStr, CString, OsStr, OsString}, + | ^^^^ ^^^^^^^ ^^^^^ ^^^^^^^^ +6 | path::{Path, PathBuf}, + | ^^^^ ^^^^^^^ +7 | sync::Arc, + | ^^^^^^^^^ + +warning: unused imports: `OffsetAccess`, `ParsedPath`, `ReflectFromReflect`, `func::DynamicFunction`, `prelude::AppFunctionRegistry`, `reflect::AppTypeRegistry`, and `world::Mut` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:11:11 + | +11 | ecs::{reflect::AppTypeRegistry, world::Mut}, + | ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ +12 | prelude::AppFunctionRegistry, + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +13 | reflect::{ +14 | func::DynamicFunction, OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect, + | ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `CallerContext`, `Either`, `ReflectAllocator`, `ReflectRefIter`, `ReflectReferencePrinter`, `ScriptError`, `ScriptResult`, `TypeIdSource`, and `WorldCallbackAccess` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:20:58 + | +20 | script_function::{AppScriptFunctionRegistry, CallerContext, DynamicScriptFunction}, + | ^^^^^^^^^^^^^ +... +23 | pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, + | ^^^^^^^^^^^^^^^^^^^^^^^ +24 | script_value::ScriptValue, +25 | ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^ +26 | WorldCallbackAccess, WorldGuard, + | ^^^^^^^^^^^^^^^^^^^ +27 | }, +28 | error::{InteropError, ScriptError, ScriptResult}, + | ^^^^^^^^^^^ ^^^^^^^^^^^^ +29 | reflection_extensions::{PartialReflectExt, TypeIdExtensions}, +30 | Either, + | ^^^^^^ + +warning: unused import: `Value` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:33:75 + | +33 | use mlua::{Function, IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value, Variadic}; + | ^^^^^ + +warning: unused import: `world::LuaWorld` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:40:57 + | +40 | use crate::bindings::{script_value::lua_caller_context, world::LuaWorld}; + | ^^^^^^^^^^^^^^^ + +warning: unused imports: `ReflectBase` and `ReflectReference` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs:6:5 + | +6 | ReflectBase, ReflectReference, + | ^^^^^^^^^^^ ^^^^^^^^^^^^^^^^ + +warning: unused imports: `IntoLuaMulti` and `MultiValue` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs:8:30 + | +8 | use mlua::{FromLua, IntoLua, IntoLuaMulti, MultiValue, Value, Variadic}; + | ^^^^^^^^^^^^ ^^^^^^^^^^ + +warning: unused imports: `component::ComponentId`, `reflect::AppTypeRegistry`, and `world::Mut` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:3:17 + | +3 | use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; + | ^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^ + +warning: unused imports: `AppFunctionRegistry`, `Entity`, and `World` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:4:21 + | +4 | use bevy::prelude::{AppFunctionRegistry, Entity, World}; + | ^^^^^^^^^^^^^^^^^^^ ^^^^^^ ^^^^^ + +warning: unused imports: `ReflectReference`, `ScriptTypeRegistration`, and `error::ScriptError` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:9:16 + | +9 | bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, + | ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^ +10 | error::ScriptError, + | ^^^^^^^^^^^^^^^^^^ + +warning: unused imports: `GetNamespacedFunction` and `Namespace` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:12:57 + | +12 | use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; + | ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^ + +warning: unused imports: `MetaMethod`, `UserDataFields`, `UserDataMethods`, `Value`, and `Variadic` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:13:12 + | +13 | use mlua::{MetaMethod, UserData, UserDataFields, UserDataMethods, Value, Variadic}; + | ^^^^^^^^^^ ^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ ^^^^^ ^^^^^^^^ + +warning: unused import: `super::script_value::LuaScriptValue` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs:15:5 + | +15 | use super::script_value::LuaScriptValue; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: unused import: `Any` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:2:11 + | +2 | any::{Any, TypeId}, + | ^^^ + +warning: unused import: `error::Error` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:4:5 + | +4 | error::Error, + | ^^^^^^^^^^^^ + +warning: unused import: `PartialReflect` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:14:58 + | +14 | func::DynamicFunction, OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect, + | ^^^^^^^^^^^^^^ + +warning: unused import: `ReflectionPathExt` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:25:61 + | +25 | ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, + | ^^^^^^^^^^^^^^^^^ + +warning: unused import: `PartialReflectExt` + --> crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs:29:29 + | +29 | reflection_extensions::{PartialReflectExt, TypeIdExtensions}, + | ^^^^^^^^^^^^^^^^^ + +warning: unused import: `Reflect` + --> crates/languages/bevy_mod_scripting_lua/src/lib.rs:6:76 + | +6 | reflect::{impl_reflect, FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, + | ^^^^^^^ + +warning: `bevy_mod_scripting_lua` (lib) generated 27 warnings (run `cargo fix --lib -p bevy_mod_scripting_lua` to apply 18 suggestions) + Compiling bevy_mod_scripting v0.9.0-alpha.1 (/home/makspll/git/bevy_mod_scripting) From a8664d18e459501880d9affee5d44d074b3321b6 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 15:36:42 +0000 Subject: [PATCH 168/217] add some js --- docs/book.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/book.toml b/docs/book.toml index dafeadc13d..014c9adf2b 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -4,3 +4,6 @@ language = "en" multilingual = false src = "src" title = "Bevy Scripting" + +[output.html] +additional-js = ["multi-code-block.js"] From 140c93cd305aa90fdc2744ffb3d519dc4d26141d Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 15:45:51 +0000 Subject: [PATCH 169/217] separate out modules --- docs/src/SUMMARY.md | 5 + .../ScriptingReference/reflect-reference.md | 193 +++++++++++++ .../script-query-builder.md | 53 ++++ .../ScriptingReference/script-query-result.md | 35 +++ .../script-type-registration.md | 67 +++++ docs/src/ScriptingReference/world.md | 263 ++++++++++++++++++ 6 files changed, 616 insertions(+) create mode 100644 docs/src/ScriptingReference/reflect-reference.md create mode 100644 docs/src/ScriptingReference/script-query-builder.md create mode 100644 docs/src/ScriptingReference/script-query-result.md create mode 100644 docs/src/ScriptingReference/script-type-registration.md create mode 100644 docs/src/ScriptingReference/world.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index b3e64ee1ae..08c7cb3fd5 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -12,3 +12,8 @@ [Introduction](./ScriptingReference/introduction.md) - [Core Bindings](./ScriptingReference/core-api.md) + - [World](./ScriptingReference/world.md) + - [ReflectReference](./ScriptingReference/reflect-reference.md) + - [ScriptTypeRegistration](./ScriptingReference/script-type-registration.md) + - [ScriptQueryBuilder](./ScriptingReference/script-query-builder.md) + - [ScriptQueryResult](./ScriptingReference/script-query-result.md) diff --git a/docs/src/ScriptingReference/reflect-reference.md b/docs/src/ScriptingReference/reflect-reference.md new file mode 100644 index 0000000000..72fb4bacbc --- /dev/null +++ b/docs/src/ScriptingReference/reflect-reference.md @@ -0,0 +1,193 @@ +# ReflectReference + +ReflectReferences are simply references to date living either: +- In a component +- In a resource +- In the allocator + +Reflect references contain a standard interface which operates over the reflection layer exposed by `Bevy` and also provides a way to call various dynamic functions registered on the underlying pointed to data. + +## display_ref + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to display | + + + +| Return | Description | +| --- | --- | +| `String` | The reference in string format | + +```lua +print(ref:display_ref()) +print(ref) +``` + +## display_value + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to display | + + +| Return | Description | +| --- | --- | +| `String` | The value in string format | + +```lua +print(ref:display_value()) +``` + +## get +The index function, allows you to index into the reflect reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to get the value for | + + +| Return | Description | +| --- | --- | +| `ScriptValue` | The value | + +```lua +local value = ref:get(key) +-- same as +local value = ref.key +local value = ref[key] +local value = ref["key"] +-- for tuple structs +local valye = ref._1 +``` + +## set + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to set the value for | +| `value` | `ScriptValue` | The value to set | + + +| Return | Description | +| --- | --- | +| `ScriptValue` | The result | + +```lua +ref:set(key, value) +-- same as +ref.key = value +ref[key] = value +ref["key"] = value +-- for tuple structs +ref._1 = value +``` + +## push +Generic push method, if the underlying type supports it, will push the value into the end of the reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `value` | `ScriptValue` | The value to push | + +```lua +ref:push(value) +``` + +## pop +Generic pop method, if the underlying type supports it, will pop the value from the end of the reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to pop from | + + +| Return | Description | +| --- | --- | +| `ScriptValue` | The popped value | + +```lua +local value = ref:pop() +``` + +## insert +Generic insert method, if the underlying type supports it, will insert the value at the key. + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to insert the value for | +| `value` | `ScriptValue` | The value to insert | + +```lua +ref:insert(key, value) +``` + +## clear +Generic clear method, if the underlying type supports it, will clear the referenced container type. + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to clear | + + +```lua +ref:clear() +``` + +## len +Generic length method, if the underlying type supports it, will return the length of the referenced container or length relevant to the type itself (number of fields etc.). + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to get the length of | + + +| Return | Description | +| --- | --- | +| `usize` | The length | + +```lua +length = ref:len() +``` + +## remove +Generic remove method, if the underlying type supports it, will remove the value at the key. + +| Argument | Type | Description | +| --- | --- | --- | +| `key` | `ScriptValue` | The key to remove the value for | + + +| Return | Description | +| --- | --- | +| `ScriptValue` | The removed value | + +```lua +local value = ref:remove(key) +``` + +## iter +The iterator function, returns a function which can be called to iterate over the reference. + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ReflectReference` | The reference to iterate over | + + +| Return | Description | +| --- | --- | +| `ScriptFunctionMut` | The iterator function | + +```lua +local iter = ref:iter() +local val = iter() +while val do + print(val) + next = iter() +end + +-- same as +for val in pairs(ref) do + print(val) +end +``` diff --git a/docs/src/ScriptingReference/script-query-builder.md b/docs/src/ScriptingReference/script-query-builder.md new file mode 100644 index 0000000000..9ac19760a4 --- /dev/null +++ b/docs/src/ScriptingReference/script-query-builder.md @@ -0,0 +1,53 @@ +# ScriptQueryBuilder + +The query builder is used to build queries for entities with specific components. Can be used to interact with arbitrary entities in the world. + +## with + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | +| `with` | `ScriptTypeRegistration` | The component to include in the query | + + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The updated query builder | + +```lua +query:with(MyType):with(MyOtherType) +``` + +## without + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | +| `without` | `ScriptTypeRegistration` | The component to exclude from the query | + + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The updated query builder | + +```lua +query:without(MyType):without(MyOtherType) +``` + +## build + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | + + +| Return | Description | +| --- | --- | +| `Vec` | The query results | + +```lua +local results = query.build() +for _, result in pairs(results) do + print(result) +end +``` diff --git a/docs/src/ScriptingReference/script-query-result.md b/docs/src/ScriptingReference/script-query-result.md new file mode 100644 index 0000000000..11a357fb3c --- /dev/null +++ b/docs/src/ScriptingReference/script-query-result.md @@ -0,0 +1,35 @@ +# ScriptQueryResult + +The result of a query, built by the query builder. + +## entity + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryResult` | The query result | + + +| Return | Description | +| --- | --- | +| `Entity` | The entity | + +```lua +local entity = result:entity() +``` + +## components + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryResult` | The query result | + + +| Return | Description | +| --- | --- | +| `Vec` | The components | + +```lua +for _, component in pairs(result:components()) do + print(component) +end +``` \ No newline at end of file diff --git a/docs/src/ScriptingReference/script-type-registration.md b/docs/src/ScriptingReference/script-type-registration.md new file mode 100644 index 0000000000..e2dad5cc01 --- /dev/null +++ b/docs/src/ScriptingReference/script-type-registration.md @@ -0,0 +1,67 @@ +# ScriptTypeRegistration + +A reference to a type registration, in general think of this as a handle to a type. + +## type_name + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + + +| Return | Description | +| --- | --- | +| `String` | The type name | + +```lua +local name = MyType:type_name() +``` + +## short_name + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + + +| Return | Description | +| --- | --- | +| `String` | The short name | + +```lua +local name = MyType:short_name() +``` + +## is_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + + +| Return | Description | +| --- | --- | +| `bool` | `true` if the type is a resource, otherwise `false` | + +```lua +if MyType:is_resource() then + print("MyType is a resource") +end +``` + +## is_component + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | + + +| Return | Description | +| --- | --- | +| `bool` | `true` if the type is a component, otherwise `false` | + +```lua +if MyType:is_component() then + print("MyType is a component") +end +``` diff --git a/docs/src/ScriptingReference/world.md b/docs/src/ScriptingReference/world.md new file mode 100644 index 0000000000..a63d7b58d6 --- /dev/null +++ b/docs/src/ScriptingReference/world.md @@ -0,0 +1,263 @@ +## World + +The `World` is the entry point for interacting with `Bevy`. It is provided to scripts under either the `world` or `World` static variable. + +### get_type_by_name + +| Argument | Type | Description | +| --- | --- | --- | +| `type_name` | `String` | The name of the type to get, this can be either the short type name, i.e. `my_type` or the long name i.e. `my_crate::my_module::my_type` | + + +| Return | Description | +| --- | --- | +| `Option` | The type if it exists, otherwise `None` | + +```lua +MyType = world.get_type_by_name("MyType") +if MyType == nil then + print("MyType not found") +end +``` + +### get_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to get the component from | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + + +| Return | Description | +| --- | --- | +| `Option` | The reference to the component if it exists, otherwise `None` | + +```lua +local component = world.get_component(entity, MyType) +if component ~= nil then + print("found component:" .. component) +end +``` + +### has_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to check the component for | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + + +| Return | Description | +| --- | --- | +| `bool` | `true` if the entity has the component, otherwise `false` | + +```lua +if world.has_component(entity, MyType) then + print("Entity has MyType") +end +``` + +### remove_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to remove the component from | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + +```lua +world.remove_component(entity, MyType) +``` + +### get_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | + + +| Return | Description | +| --- | --- | +| `Option` | The resource if it exists, otherwise `None` | + +```lua +local resource = world.get_resource(MyType) +if resource ~= nil then + print("found resource:" .. resource) +end +``` + +### has_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | + + +| Return | Description | +| --- | --- | +| `bool` | `true` if the resource exists, otherwise `false` | + +```lua +local hasResource = world.has_resource(MyType) +``` + +### remove_resource + +| Argument | Type | Description | +| --- | --- | --- | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | + +```lua +world.remove_resource(MyType) +``` + +### add_default_component + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to add the component to | +| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | + +```lua +world.add_default_component(entity, MyType) +``` + +### spawn + +| Return | Description | +| --- | --- | +| `Entity` | The spawned entity | + +```lua +local entity = world.spawn() +``` + +### insert_children + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The parent entity | +| `index` | `usize` | The index to insert the children at | +| `children` | `Vec` | The children entities to insert | + +```lua +world.insert_children(parent, 1, {child1, child2}) +``` + +### push_children + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The parent entity | +| `children` | `Vec` | The children entities to push | + + +```lua +world.push_children(parent, {child1, child2}) +``` + +### get_children + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The parent entity | + + +| Return | Description | +| --- | --- | +| `Vec` | The children entities | + +```lua +local children = world.get_children(parent) +for _, child in pairs(children) do + print("child: " .. child) +end +``` + +### get_parent + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The child entity | + + +| Return | Description | +| --- | --- | +| `Option` | The parent entity if it exists, otherwise `None` | + +```lua +local parent = world.get_parent(child) +if parent ~= nil then + print("parent: " .. parent) +end +``` + +### despawn + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to despawn | + +```lua +world.despawn(entity) +``` + +### despawn_descendants + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to despawn descendants of | + +```lua +world.despawn_descendants(entity) +``` + +### despawn_recursive + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to despawn recursively | + +```lua +world.despawn_recursive(entity) +``` + +### has_entity + +| Argument | Type | Description | +| --- | --- | --- | +| `entity` | `Entity` | The entity to check | + + +| Return | Description | +| --- | --- | +| `bool` | `true` if the entity exists, otherwise `false` | + +```lua +local exists = world.has_entity(entity) +if exists then + print("entity exists") +end +``` + +### query + +| Argument | Type | Description | +| --- | --- | --- | +| `components` | `Vec` | The components to query for | + + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The query builder | + +```lua +query = world.query({MyType}) +``` + +### exit +Send the exit signal to the application, will gracefully shutdown the application. + +```lua +world.exit() +``` From 8e8bb3dfc6a75face15468da697562ed129f1971 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 15:57:52 +0000 Subject: [PATCH 170/217] add nicer headings --- docs/src/ScriptingReference/core-api.md | 591 +----------------- .../ScriptingReference/reflect-reference.md | 31 +- .../script-query-builder.md | 9 + .../ScriptingReference/script-query-result.md | 6 + .../script-type-registration.md | 12 + docs/src/ScriptingReference/world.md | 45 ++ 6 files changed, 103 insertions(+), 591 deletions(-) diff --git a/docs/src/ScriptingReference/core-api.md b/docs/src/ScriptingReference/core-api.md index 5867ec0b53..6d0bcf0466 100644 --- a/docs/src/ScriptingReference/core-api.md +++ b/docs/src/ScriptingReference/core-api.md @@ -2,593 +2,4 @@ The core bindings are manually written utilities for interacting with the `Bevy` world and everything contained within it. These bindings are used to create and manipulate entities, components, resources, and systems. -Every language BMS supports will support these. - -## World - -The `World` is the entry point for interacting with `Bevy`. It is provided to scripts under either the `world` or `World` static variable. - -### get_type_by_name - -| Argument | Type | Description | -| --- | --- | --- | -| `type_name` | `String` | The name of the type to get, this can be either the short type name, i.e. `my_type` or the long name i.e. `my_crate::my_module::my_type` | - -| Return | Description | -| --- | --- | -| `Option` | The type if it exists, otherwise `None` | - -```lua -MyType = world.get_type_by_name("MyType") -if MyType == nil then - print("MyType not found") -end -``` - -### get_component - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to get the component from | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | - -| Return | Description | -| --- | --- | -| `Option` | The reference to the component if it exists, otherwise `None` | - -```lua -local component = world.get_component(entity, MyType) -if component ~= nil then - print("found component:" .. component) -end -``` - -### has_component - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to check the component for | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | - -| Return | Description | -| --- | --- | -| `bool` | `true` if the entity has the component, otherwise `false` | - -```lua -if world.has_component(entity, MyType) then - print("Entity has MyType") -end -``` - -### remove_component - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to remove the component from | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | - -```lua -world.remove_component(entity, MyType) -``` - -### get_resource - -| Argument | Type | Description | -| --- | --- | --- | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | - -| Return | Description | -| --- | --- | -| `Option` | The resource if it exists, otherwise `None` | - -```lua -local resource = world.get_resource(MyType) -if resource ~= nil then - print("found resource:" .. resource) -end -``` - -### has_resource - -| Argument | Type | Description | -| --- | --- | --- | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | - -| Return | Description | -| --- | --- | -| `bool` | `true` if the resource exists, otherwise `false` | - -```lua -local hasResource = world.has_resource(MyType) -``` - -### remove_resource - -| Argument | Type | Description | -| --- | --- | --- | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | - -```lua -world.remove_resource(MyType) -``` - -### add_default_component - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to add the component to | -| `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | - -```lua -world.add_default_component(entity, MyType) -``` - -### spawn - -| Return | Description | -| --- | --- | -| `Entity` | The spawned entity | - -```lua -local entity = world.spawn() -``` - -### insert_children - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The parent entity | -| `index` | `usize` | The index to insert the children at | -| `children` | `Vec` | The children entities to insert | - -```lua -world.insert_children(parent, 1, {child1, child2}) -``` - -### push_children - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The parent entity | -| `children` | `Vec` | The children entities to push | - - -```lua -world.push_children(parent, {child1, child2}) -``` - -### get_children - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The parent entity | - -| Return | Description | -| --- | --- | -| `Vec` | The children entities | - -```lua -local children = world.get_children(parent) -for _, child in pairs(children) do - print("child: " .. child) -end -``` - -### get_parent - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The child entity | - -| Return | Description | -| --- | --- | -| `Option` | The parent entity if it exists, otherwise `None` | - -```lua -local parent = world.get_parent(child) -if parent ~= nil then - print("parent: " .. parent) -end -``` - -### despawn - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to despawn | - -```lua -world.despawn(entity) -``` - -### despawn_descendants - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to despawn descendants of | - -```lua -world.despawn_descendants(entity) -``` - -### despawn_recursive - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to despawn recursively | - -```lua -world.despawn_recursive(entity) -``` - -### has_entity - -| Argument | Type | Description | -| --- | --- | --- | -| `entity` | `Entity` | The entity to check | - -| Return | Description | -| --- | --- | -| `bool` | `true` if the entity exists, otherwise `false` | - -```lua -local exists = world.has_entity(entity) -if exists then - print("entity exists") -end -``` - -### query - -| Argument | Type | Description | -| --- | --- | --- | -| `components` | `Vec` | The components to query for | - -| Return | Description | -| --- | --- | -| `ScriptQueryBuilder` | The query builder | - -```lua -query = world.query({MyType}) -``` - -### exit -Send the exit signal to the application, will gracefully shutdown the application. - -```lua -world.exit() -``` - -## ReflectReference - -ReflectReferences are simply references to date living either: -- In a component -- In a resource -- In the allocator - -Reflect references contain a standard interface which operates over the reflection layer exposed by `Bevy` and also provides a way to call various dynamic functions registered on the underlying pointed to data. - -### display_ref - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ReflectReference` | The reference to display | - -| Return | Description | -| --- | --- | -| `String` | The reference in string format | - -```lua -print(ref:display_ref()) -print(ref) -``` - -### display_value - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ReflectReference` | The reference to display | - -| Return | Description | -| --- | --- | -| `String` | The value in string format | - -```lua -print(ref:display_value()) -``` - -### get -The index function, allows you to index into the reflect reference. - -| Argument | Type | Description | -| --- | --- | --- | -| `key` | `ScriptValue` | The key to get the value for | - -| Return | Description | -| --- | --- | -| `ScriptValue` | The value | - -```lua -local value = ref:get(key) --- same as -local value = ref.key -local value = ref[key] -local value = ref["key"] --- for tuple structs -local valye = ref._1 -``` - -### set - -| Argument | Type | Description | -| --- | --- | --- | -| `key` | `ScriptValue` | The key to set the value for | -| `value` | `ScriptValue` | The value to set | - -| Return | Description | -| --- | --- | -| `ScriptValue` | The result | - -```lua -ref:set(key, value) --- same as -ref.key = value -ref[key] = value -ref["key"] = value --- for tuple structs -ref._1 = value -``` - -### push -Generic push method, if the underlying type supports it, will push the value into the end of the reference. - -| Argument | Type | Description | -| --- | --- | --- | -| `value` | `ScriptValue` | The value to push | - -```lua -ref:push(value) -``` - -### pop -Generic pop method, if the underlying type supports it, will pop the value from the end of the reference. - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ReflectReference` | The reference to pop from | - -| Return | Description | -| --- | --- | -| `ScriptValue` | The popped value | - -```lua -local value = ref:pop() -``` - -### insert -Generic insert method, if the underlying type supports it, will insert the value at the key. - -| Argument | Type | Description | -| --- | --- | --- | -| `key` | `ScriptValue` | The key to insert the value for | -| `value` | `ScriptValue` | The value to insert | - -```lua -ref:insert(key, value) -``` - -### clear -Generic clear method, if the underlying type supports it, will clear the referenced container type. - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ReflectReference` | The reference to clear | - - -```lua -ref:clear() -``` - -### len -Generic length method, if the underlying type supports it, will return the length of the referenced container or length relevant to the type itself (number of fields etc.). - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ReflectReference` | The reference to get the length of | - -| Return | Description | -| --- | --- | -| `usize` | The length | - -```lua -length = ref:len() -``` - -### remove -Generic remove method, if the underlying type supports it, will remove the value at the key. - -| Argument | Type | Description | -| --- | --- | --- | -| `key` | `ScriptValue` | The key to remove the value for | - -| Return | Description | -| --- | --- | -| `ScriptValue` | The removed value | - -```lua -local value = ref:remove(key) -``` - -### iter -The iterator function, returns a function which can be called to iterate over the reference. - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ReflectReference` | The reference to iterate over | - -| Return | Description | -| --- | --- | -| `ScriptFunctionMut` | The iterator function | - -```lua -local iter = ref:iter() -local val = iter() -while val do - print(val) - next = iter() -end - --- same as -for val in pairs(ref) do - print(val) -end -``` - -## ScriptTypeRegistration - -A reference to a type registration, in general think of this as a handle to a type. - -### type_name - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | - -| Return | Description | -| --- | --- | -| `String` | The type name | - -```lua -local name = MyType:type_name() -``` - -### short_name - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | - -| Return | Description | -| --- | --- | -| `String` | The short name | - -```lua -local name = MyType:short_name() -``` - -### is_resource - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | - -| Return | Description | -| --- | --- | -| `bool` | `true` if the type is a resource, otherwise `false` | - -```lua -if MyType:is_resource() then - print("MyType is a resource") -end -``` - -### is_component - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | - -| Return | Description | -| --- | --- | -| `bool` | `true` if the type is a component, otherwise `false` | - -```lua -if MyType:is_component() then - print("MyType is a component") -end -``` - -## ScriptQueryBuilder - -The query builder is used to build queries for entities with specific components. Can be used to interact with arbitrary entities in the world. - -### with - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptQueryBuilder` | The query builder | -| `with` | `ScriptTypeRegistration` | The component to include in the query | - -| Return | Description | -| --- | --- | -| `ScriptQueryBuilder` | The updated query builder | - -```lua -query:with(MyType):with(MyOtherType) -``` - -### without - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptQueryBuilder` | The query builder | -| `without` | `ScriptTypeRegistration` | The component to exclude from the query | - -| Return | Description | -| --- | --- | -| `ScriptQueryBuilder` | The updated query builder | - -```lua -query:without(MyType):without(MyOtherType) -``` - -### build - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptQueryBuilder` | The query builder | - -| Return | Description | -| --- | --- | -| `Vec` | The query results | - -```lua -local results = query.build() -for _, result in pairs(results) do - print(result) -end -``` - -## ScriptQueryResult - -The result of a query, built by the query builder. - -### entity - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptQueryResult` | The query result | - -| Return | Description | -| --- | --- | -| `Entity` | The entity | - -```lua -local entity = result:entity() -``` - -### components - -| Argument | Type | Description | -| --- | --- | --- | -| `s` | `ScriptQueryResult` | The query result | - -| Return | Description | -| --- | --- | -| `Vec` | The components | - -```lua -for _, component in pairs(result:components()) do - print(component) -end -``` \ No newline at end of file +Every language BMS supports will support these. \ No newline at end of file diff --git a/docs/src/ScriptingReference/reflect-reference.md b/docs/src/ScriptingReference/reflect-reference.md index 72fb4bacbc..052192a4e1 100644 --- a/docs/src/ScriptingReference/reflect-reference.md +++ b/docs/src/ScriptingReference/reflect-reference.md @@ -9,11 +9,13 @@ Reflect references contain a standard interface which operates over the reflecti ## display_ref +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ReflectReference` | The reference to display | - +Returns: | Return | Description | | --- | --- | @@ -26,10 +28,13 @@ print(ref) ## display_value +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ReflectReference` | The reference to display | +Returns: | Return | Description | | --- | --- | @@ -42,10 +47,13 @@ print(ref:display_value()) ## get The index function, allows you to index into the reflect reference. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `key` | `ScriptValue` | The key to get the value for | +Returns: | Return | Description | | --- | --- | @@ -63,11 +71,14 @@ local valye = ref._1 ## set +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `key` | `ScriptValue` | The key to set the value for | | `value` | `ScriptValue` | The value to set | +Returns: | Return | Description | | --- | --- | @@ -86,6 +97,8 @@ ref._1 = value ## push Generic push method, if the underlying type supports it, will push the value into the end of the reference. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `value` | `ScriptValue` | The value to push | @@ -97,10 +110,13 @@ ref:push(value) ## pop Generic pop method, if the underlying type supports it, will pop the value from the end of the reference. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ReflectReference` | The reference to pop from | +Returns: | Return | Description | | --- | --- | @@ -113,6 +129,8 @@ local value = ref:pop() ## insert Generic insert method, if the underlying type supports it, will insert the value at the key. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `key` | `ScriptValue` | The key to insert the value for | @@ -125,6 +143,8 @@ ref:insert(key, value) ## clear Generic clear method, if the underlying type supports it, will clear the referenced container type. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ReflectReference` | The reference to clear | @@ -137,10 +157,13 @@ ref:clear() ## len Generic length method, if the underlying type supports it, will return the length of the referenced container or length relevant to the type itself (number of fields etc.). +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ReflectReference` | The reference to get the length of | +Returns: | Return | Description | | --- | --- | @@ -153,10 +176,13 @@ length = ref:len() ## remove Generic remove method, if the underlying type supports it, will remove the value at the key. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `key` | `ScriptValue` | The key to remove the value for | +Returns: | Return | Description | | --- | --- | @@ -169,10 +195,13 @@ local value = ref:remove(key) ## iter The iterator function, returns a function which can be called to iterate over the reference. +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ReflectReference` | The reference to iterate over | +Returns: | Return | Description | | --- | --- | diff --git a/docs/src/ScriptingReference/script-query-builder.md b/docs/src/ScriptingReference/script-query-builder.md index 9ac19760a4..1d41d17267 100644 --- a/docs/src/ScriptingReference/script-query-builder.md +++ b/docs/src/ScriptingReference/script-query-builder.md @@ -4,11 +4,14 @@ The query builder is used to build queries for entities with specific components ## with +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptQueryBuilder` | The query builder | | `with` | `ScriptTypeRegistration` | The component to include in the query | +Returns: | Return | Description | | --- | --- | @@ -20,11 +23,14 @@ query:with(MyType):with(MyOtherType) ## without +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptQueryBuilder` | The query builder | | `without` | `ScriptTypeRegistration` | The component to exclude from the query | +Returns: | Return | Description | | --- | --- | @@ -36,10 +42,13 @@ query:without(MyType):without(MyOtherType) ## build +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptQueryBuilder` | The query builder | +Returns: | Return | Description | | --- | --- | diff --git a/docs/src/ScriptingReference/script-query-result.md b/docs/src/ScriptingReference/script-query-result.md index 11a357fb3c..f25e5d1c8d 100644 --- a/docs/src/ScriptingReference/script-query-result.md +++ b/docs/src/ScriptingReference/script-query-result.md @@ -4,10 +4,13 @@ The result of a query, built by the query builder. ## entity +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptQueryResult` | The query result | +Returns: | Return | Description | | --- | --- | @@ -19,10 +22,13 @@ local entity = result:entity() ## components +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptQueryResult` | The query result | +Returns: | Return | Description | | --- | --- | diff --git a/docs/src/ScriptingReference/script-type-registration.md b/docs/src/ScriptingReference/script-type-registration.md index e2dad5cc01..1eb45d62d7 100644 --- a/docs/src/ScriptingReference/script-type-registration.md +++ b/docs/src/ScriptingReference/script-type-registration.md @@ -4,10 +4,13 @@ A reference to a type registration, in general think of this as a handle to a ty ## type_name +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | +Returns: | Return | Description | | --- | --- | @@ -19,10 +22,13 @@ local name = MyType:type_name() ## short_name +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | +Returns: | Return | Description | | --- | --- | @@ -34,10 +40,13 @@ local name = MyType:short_name() ## is_resource +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | +Returns: | Return | Description | | --- | --- | @@ -51,10 +60,13 @@ end ## is_component +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `s` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` | +Returns: | Return | Description | | --- | --- | diff --git a/docs/src/ScriptingReference/world.md b/docs/src/ScriptingReference/world.md index a63d7b58d6..29370c1c85 100644 --- a/docs/src/ScriptingReference/world.md +++ b/docs/src/ScriptingReference/world.md @@ -4,10 +4,13 @@ The `World` is the entry point for interacting with `Bevy`. It is provided to sc ### get_type_by_name +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `type_name` | `String` | The name of the type to get, this can be either the short type name, i.e. `my_type` or the long name i.e. `my_crate::my_module::my_type` | +Returns: | Return | Description | | --- | --- | @@ -22,11 +25,14 @@ end ### get_component +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to get the component from | | `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | +Returns: | Return | Description | | --- | --- | @@ -41,11 +47,14 @@ end ### has_component +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to check the component for | | `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the component | +Returns: | Return | Description | | --- | --- | @@ -59,6 +68,8 @@ end ### remove_component +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to remove the component from | @@ -70,10 +81,13 @@ world.remove_component(entity, MyType) ### get_resource +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | +Returns: | Return | Description | | --- | --- | @@ -88,10 +102,13 @@ end ### has_resource +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | +Returns: | Return | Description | | --- | --- | @@ -103,6 +120,8 @@ local hasResource = world.has_resource(MyType) ### remove_resource +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `registration` | `ScriptTypeRegistration` | The type registration as returned by `get_type_by_name` of the resource | @@ -113,6 +132,8 @@ world.remove_resource(MyType) ### add_default_component +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to add the component to | @@ -124,6 +145,8 @@ world.add_default_component(entity, MyType) ### spawn +Returns: + | Return | Description | | --- | --- | | `Entity` | The spawned entity | @@ -134,6 +157,8 @@ local entity = world.spawn() ### insert_children +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The parent entity | @@ -146,6 +171,8 @@ world.insert_children(parent, 1, {child1, child2}) ### push_children +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The parent entity | @@ -158,10 +185,13 @@ world.push_children(parent, {child1, child2}) ### get_children +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The parent entity | +Returns: | Return | Description | | --- | --- | @@ -176,10 +206,13 @@ end ### get_parent +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The child entity | +Returns: | Return | Description | | --- | --- | @@ -194,6 +227,8 @@ end ### despawn +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to despawn | @@ -204,6 +239,8 @@ world.despawn(entity) ### despawn_descendants +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to despawn descendants of | @@ -214,6 +251,8 @@ world.despawn_descendants(entity) ### despawn_recursive +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to despawn recursively | @@ -224,10 +263,13 @@ world.despawn_recursive(entity) ### has_entity +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `entity` | `Entity` | The entity to check | +Returns: | Return | Description | | --- | --- | @@ -242,10 +284,13 @@ end ### query +Arguments: + | Argument | Type | Description | | --- | --- | --- | | `components` | `Vec` | The components to query for | +Returns: | Return | Description | | --- | --- | From 4347d503665d9b9326560d892cd44af637bc1c52 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 16:01:02 +0000 Subject: [PATCH 171/217] add introduction --- docs/src/SUMMARY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 08c7cb3fd5..dbc03f822b 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -10,7 +10,7 @@ # Scripting Reference -[Introduction](./ScriptingReference/introduction.md) +- [Introduction](./ScriptingReference/introduction.md) - [Core Bindings](./ScriptingReference/core-api.md) - [World](./ScriptingReference/world.md) - [ReflectReference](./ScriptingReference/reflect-reference.md) From 9932a86d7961c279b8c97ebcd153dffae8e6016e Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 18:16:16 +0000 Subject: [PATCH 172/217] finally --- assets/scripts/game_of_life.lua | 102 +++++++++--------- .../src/bindings/access_map.rs | 38 +++---- .../src/bindings/allocator.rs | 77 ++++++------- .../bevy_mod_scripting_functions/src/core.rs | 31 ++++-- .../src/bindings/reference.rs | 55 ---------- .../script-query-builder.md | 2 +- examples/lua/game_of_life.rs | 1 - 7 files changed, 128 insertions(+), 178 deletions(-) diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index b58e326ee9..f87230f085 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -1,63 +1,61 @@ --- print("The game_of_life.lua script just got loaded") --- print("Hello from Lua! I am initiating the game of life simulation state to a random state now") +print("The game_of_life.lua script just got loaded") +print("Hello from Lua! I am initiating the game of life simulation state to a random state now") --- math.randomseed(os.time()) --- _LifeState = world.get_type_by_name("LifeState") -_Settings = world.get_type_by_name("Settings") +math.randomseed(os.time()) +LifeState = world.get_type_by_name("LifeState") +Settings = world.get_type_by_name("Settings") --- function fetch_life_state() --- -- find the entity with life state --- local life_state = nil --- for i,result in pairs(world.query({_LifeState}):build()) do --- life_state = result:components()[1] --- break --- end --- return life_state --- end +function fetch_life_state() + -- find the entity with life state + local life_state = nil + for i,result in pairs(world.query({LifeState}):build()) do + life_state = result:components()[1] + break + end + return life_state +end -function on_init() - -- print("On init was called") - -- local life_state = fetch_life_state() - -- local cells = life_state.cells +local life_state = fetch_life_state() +local cells = life_state.cells - -- -- set some cells alive - -- for _=1,10000 do - -- local index = math.random(#cells) - -- cells[index] = 255 - -- end +-- set some cells alive +for _=1,10000 do + local index = math.random(#cells) + cells[index] = 255 end function on_update() - -- local cells = fetch_life_state().cells - local settings = world.get_resource(_Settings) - -- local dimensions = settings.physical_grid_dimensions - -- local dimension_x = dimensions._1 - -- local dimension_y = dimensions._2 + local cells = fetch_life_state().cells + world.log_all_allocations() + local settings = world.get_resource(Settings) + local dimensions = settings.physical_grid_dimensions + local dimension_x = dimensions._1 + local dimension_y = dimensions._2 - -- -- primitives are passed by value to lua, keep a hold of old state but turn 255's into 1's - -- local prev_state = {} - -- for k,v in pairs(cells) do - -- prev_state[k] = (not(v == 0)) and 1 or 0 - -- end - -- for i=1,(dimension_x * dimension_y) do - -- local north = prev_state[i - dimension_x] or 1 - -- local south = prev_state[i + dimension_x] or 1 - -- local east = prev_state[i + 1] or 1 - -- local west = prev_state[i - 1] or 1 - -- local northeast = prev_state[i - dimension_x + 1] or 1 - -- local southeast = prev_state[i + dimension_x + 1] or 1 - -- local northwest = prev_state[i - dimension_x - 1] or 1 - -- local southwest = prev_state[i + dimension_x - 1] or 1 + -- primitives are passed by value to lua, keep a hold of old state but turn 255's into 1's + local prev_state = {} + for v in pairs(cells) do + prev_state[#prev_state+1] = (not(v == 0)) and 1 or 0 + end + for i=1,(dimension_x * dimension_y) do + local north = prev_state[i - dimension_x] or 1 + local south = prev_state[i + dimension_x] or 1 + local east = prev_state[i + 1] or 1 + local west = prev_state[i - 1] or 1 + local northeast = prev_state[i - dimension_x + 1] or 1 + local southeast = prev_state[i + dimension_x + 1] or 1 + local northwest = prev_state[i - dimension_x - 1] or 1 + local southwest = prev_state[i + dimension_x - 1] or 1 - -- local neighbours = north + south + east + west - -- + northeast + southeast + northwest + southwest + local neighbours = north + south + east + west + + northeast + southeast + northwest + southwest - -- -- was dead and got 3 neighbours now - -- if prev_state[i] == 0 and neighbours == 3 then - -- cells[i] = 255 - -- -- was alive and should die now - -- elseif prev_state[i] == 1 and ((neighbours < 2) or (neighbours > 3)) then - -- cells[i] = 0 - -- end - -- end + -- was dead and got 3 neighbours now + if prev_state[i] == 0 and neighbours == 3 then + cells[i] = 255 + -- was alive and should die now + elseif prev_state[i] == 1 and ((neighbours < 2) or (neighbours > 3)) then + cells[i] = 0 + end + end end \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs index ff4e077e19..123581ff16 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -58,16 +58,16 @@ impl AccessCount { } pub trait AccessMapKey { - fn as_usize(&self) -> usize; - fn from_usize(value: usize) -> Self; + fn as_index(&self) -> u64; + fn from_index(value: u64) -> Self; } -impl AccessMapKey for usize { - fn as_usize(&self) -> usize { +impl AccessMapKey for u64 { + fn as_index(&self) -> u64 { *self } - fn from_usize(value: usize) -> Self { + fn from_index(value: u64) -> Self { value } } @@ -84,11 +84,11 @@ pub enum ReflectAccessKind { #[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)] pub struct ReflectAccessId { kind: ReflectAccessKind, - id: usize, + id: u64, } impl AccessMapKey for ReflectAccessId { - fn as_usize(&self) -> usize { + fn as_index(&self) -> u64 { // project two linear non-negative ranges to a single linear non-negative range // y1 = 2x - 0 // y2 = 2x - 1 @@ -98,7 +98,7 @@ impl AccessMapKey for ReflectAccessId { } } - fn from_usize(value: usize) -> Self { + fn from_index(value: u64) -> Self { // retrieve the kind of range based on if the value is odd or even // y1 if even, y2 if odd // to retrieve value of x: @@ -117,7 +117,7 @@ impl ReflectAccessId { pub fn for_resource(cell: &UnsafeWorldCell) -> Option { Some(Self { kind: ReflectAccessKind::ComponentOrResource, - id: cell.components().resource_id::()?.index(), + id: cell.components().resource_id::()?.index() as u64, }) } @@ -139,7 +139,7 @@ impl ReflectAccessId { pub fn for_component_id(id: ComponentId) -> Self { Self { kind: ReflectAccessKind::ComponentOrResource, - id: id.index(), + id: id.index() as u64, } } @@ -156,7 +156,7 @@ impl From for ReflectAccessId { fn from(value: ComponentId) -> Self { Self { kind: ReflectAccessKind::ComponentOrResource, - id: value.index(), + id: value.index() as u64, } } } @@ -172,13 +172,13 @@ impl From for ReflectAccessId { impl From for ComponentId { fn from(val: ReflectAccessId) -> Self { - ComponentId::new(val.id) + ComponentId::new(val.id as usize) } } #[derive(Debug, Default)] pub struct AccessMap { - individual_accesses: DashMap, + individual_accesses: DashMap, global_lock: AtomicBool, } @@ -189,7 +189,7 @@ impl AccessMap { if self.global_lock.load(std::sync::atomic::Ordering::Relaxed) { return false; } - let key = key.as_usize(); + let key = key.as_index(); let access = self.individual_accesses.try_entry(key); match access.map(Entry::or_default) { Some(mut entry) if entry.can_read() => { @@ -209,7 +209,7 @@ impl AccessMap { if self.global_lock.load(std::sync::atomic::Ordering::Relaxed) { return false; } - let key = key.as_usize(); + let key = key.as_index(); let access = self.individual_accesses.try_entry(key); match access.map(Entry::or_default) { Some(mut entry) if entry.can_write() => { @@ -244,7 +244,7 @@ impl AccessMap { /// # Panics /// if the access is released from a different thread than it was claimed from pub fn release_access(&self, key: K) { - let key = key.as_usize(); + let key = key.as_index(); let access = self.individual_accesses.entry(key); match access { dashmap::mapref::entry::Entry::Occupied(mut entry) => { @@ -274,7 +274,7 @@ impl AccessMap { pub fn list_accesses(&self) -> Vec<(K, AccessCount)> { self.individual_accesses .iter() - .map(|e| (K::from_usize(*e.key()), e.value().clone())) + .map(|e| (K::from_index(*e.key()), e.value().clone())) .collect() } @@ -293,7 +293,7 @@ impl AccessMap { key: K, ) -> Option> { self.individual_accesses - .try_get(&key.as_usize()) + .try_get(&key.as_index()) .try_unwrap() .and_then(|access| access.as_location()) } @@ -389,7 +389,7 @@ mod test { access_map.claim_read_access(0); access_map.claim_write_access(1); - let accesses = access_map.list_accesses::(); + let accesses = access_map.list_accesses::(); assert_eq!(accesses.len(), 2); let access_0 = accesses.iter().find(|(k, _)| *k == 0).unwrap(); diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index b0c5a216fd..0c33340e09 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -8,17 +8,18 @@ use std::collections::HashMap; use std::fmt::{Display, Formatter}; use std::hash::Hasher; use std::io::Read; +use std::sync::atomic::{AtomicU64, AtomicUsize}; use std::sync::Arc; #[derive(Clone, Debug)] -pub struct ReflectAllocationId(pub(crate) Arc); +pub struct ReflectAllocationId(pub(crate) Arc); impl ReflectAllocationId { - pub fn id(&self) -> usize { + pub fn id(&self) -> u64 { *self.0 } /// Creates a new [`ReflectAllocationId`] from its id - pub(crate) fn new(id: usize) -> Self { + pub(crate) fn new(id: u64) -> Self { Self(Arc::new(id)) } @@ -139,7 +140,7 @@ impl AppReflectAllocator { pub struct ReflectAllocator { // TODO: experiment with object pools, sparse set etc. allocations: HashMap, - types: HashMap, + types: HashMap, } impl ReflectAllocator { @@ -150,9 +151,11 @@ impl ReflectAllocator { } pub fn allocate_boxed(&mut self, value: Box) -> ReflectAllocationId { - let type_id = value.get_represented_type_info().map(|i| i.type_id()); + static COUNTER: AtomicU64 = AtomicU64::new(0); - let id = ReflectAllocationId::new(self.allocations.len()); + let type_id = value.get_represented_type_info().map(|i| i.type_id()); + let id = + ReflectAllocationId::new(COUNTER.fetch_add(1, std::sync::atomic::Ordering::Relaxed)); let index = id.id(); let value = ReflectAllocation::new(value); self.allocations.insert(id.clone(), value); @@ -161,34 +164,6 @@ impl ReflectAllocator { } id } - - // /// Moves the given boxed [`PartialReflect`] value into the allocator, returning an [`AllocationId`] which can be used to access it later - // pub fn allocate_boxed( - // &mut self, - // existing: Box, - // ) -> (ReflectAllocationId, ReflectAllocation) { - // let type_id = existing.get_represented_type_info().map(|i| i.type_id()); - // let id = ReflectAllocationId(self.allocations.len()); - - // let raw_ptr = Box::into_raw(existing); - // // Safety: - // // - we are the only ones to have access to this value since we have the Box - // // - UnsafeCell is repr(transparent), meaning we can safely transmute between it and the trait object - // // TODO: I don't think we can use this, because from_raw has a pre-condition that requires the pointer to have been an arc before - // let arc: Arc> = - // unsafe { Arc::from_raw(raw_ptr as *const _) }; - // let allocation = ReflectAllocation::new(arc); - // self.allocations.insert(id, allocation.clone()); - // if let Some(type_id) = type_id { - // self.types.insert(id, type_id); - // } - // (id, allocation) - // } - - // pub fn get(&self, id: &ReflectAllocationId) -> Option { - // self.allocations.get(id).cloned() - // } - pub fn insert( &mut self, id: ReflectAllocationId, @@ -221,15 +196,14 @@ impl ReflectAllocator { /// Runs a garbage collection pass on the allocations, removing any allocations which have no more strong references /// Needs to be run periodically to prevent memory leaks pub fn clean_garbage_allocations(&mut self) { - bevy::log::debug!("Cleaning garbage allocations"); - - self.allocations.retain(|k, _| { - let retain = Arc::strong_count(&k.0) > 1; - if !retain { - bevy::log::debug!("Deallocating allocation {:?}", k); - } - retain - }); + bevy::log::trace!("Cleaning garbage allocations"); + self.allocations.retain(|k, _| Arc::strong_count(&k.0) > 1); + } + + pub fn iter_allocations( + &self, + ) -> impl Iterator { + self.allocations.iter() } } @@ -247,6 +221,23 @@ mod test { assert_eq!(allocator.allocations.len(), 0); } + #[test] + fn test_reflect_allocator_allocate_clean_and_access_does_not_overwrite_id() { + let mut allocator = ReflectAllocator::default(); + let id = allocator.allocate(0); + let id2 = allocator.allocate("string"); + assert_eq!(allocator.allocations.len(), 2); + drop(id); + allocator.clean_garbage_allocations(); + assert_eq!(allocator.allocations.len(), 1); + allocator.allocate(3); + assert_eq!(allocator.allocations.len(), 2); + + // Safety: only one reference to the allocation exists + let ref_ = unsafe { &*allocator.get(&id2).unwrap().get_ptr() }; + assert!(ref_.reflect_partial_eq(&"string").unwrap()); + } + #[test] fn test_reflect_allocator_garbage_clean_no_garbage() { let mut allocator = ReflectAllocator::default(); diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 153f2b16e5..803f677d1c 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -9,16 +9,12 @@ use bevy::{ }; use bevy_mod_scripting_core::*; use bindings::{ - function::{ + access_map::ReflectAccessId, function::{ from::{Mut, Ref, Val}, from_ref::FromScriptRef, into_ref::IntoScriptRef, script_function::{CallerContext, GetFunctionTypeDependencies, ScriptFunction, ScriptFunctionMut}, - }, - pretty_print::DisplayWithWorld, - script_value::ScriptValue, - ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, - ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess, + }, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectAllocationId, ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess }; use error::{InteropError, InteropErrorInner}; use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; @@ -150,7 +146,28 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat Ok(Val(query_builder)) }, ) - .register("exit", |s: WorldCallbackAccess| s.exit()); + .register("exit", |s: WorldCallbackAccess| s.exit()) + .register("log_all_allocations", |s: WorldCallbackAccess| { + let world = s.try_read().expect("stale world"); + let allocator = world.allocator(); + let allocator = allocator.read(); + for (id,a) in allocator.iter_allocations() { + let raid = ReflectAccessId::for_allocation(id.clone()); + if world.claim_read_access(raid) { + { + let ptr = a.get_ptr(); + let a = unsafe { &*ptr }; + bevy::log::info!("Allocation Id: {}, value: {:?}", id.id(), a); + } + // Safety: ref released above + unsafe { world.release_access(raid) }; + } else { + panic!("Failed to claim read access for allocation id: {}", id.id()); + } + + } + + }); Ok(()) } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 78b2c53750..f8443a4b22 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -335,44 +335,6 @@ impl UserData for LuaReflectReference { )?)) }); - // #[cfg(any( - // feature = "lua54", - // feature = "lua53", - // feature = "lua52", - // feature = "luajit52", - // ))] - // m.add_meta_function(MetaMethod::Pairs, |l, s: LuaReflectReference| { - // bevy::log::debug!("ReflectReference::Pairs with value: {:?}", s); - // let mut iterator_base = s.0.into_iter_infinite(); - // let iterator = TypedFunction::from_rust_mut( - // move |l, ()| { - // let (next_ref, idx) = iterator_base.next_ref(); - // bevy::log::debug!("iteration: {:?}", idx); - // let next = LuaReflectReference(next_ref).to_lua_proxy(l); - // let next = match next { - // Ok(n) => Some(n), - // Err(e) => { - // bevy::log::debug!("Error in iteration: {:?}", e); - // None - // } - // }; - // bevy::log::debug!("next: {:?}", next); - // // TODO: we should differentiate between no more values and an actual error - // match (next, idx) { - // (None, bevy_mod_scripting_core::bindings::IterationKey::Index(_)) => { - // Ok((Value::Nil, Value::Nil)) - // } - // (Some(n), bevy_mod_scripting_core::bindings::IterationKey::Index(i)) => { - // Ok((Value::Integer((i + 1) as i64), n)) - // } - // } - // }, - // l, - // )?; - - // Ok((iterator, Value::Nil, Value::Nil)) - // }); - m.add_meta_function(MetaMethod::ToString, |lua, self_: LuaReflectReference| { let world = lua.get_world(); let self_: ReflectReference = self_.into(); @@ -389,23 +351,6 @@ impl UserData for LuaReflectReference { Ok(LuaScriptValue::from(out)) }); - - m.add_function("print_value", |lua, self_: LuaReflectReference| { - let world = lua.get_world(); - let self_: ReflectReference = self_.into(); - - let mut display_func = - lookup_dynamic_function_typed::(lua, "display_value") - .expect("No 'display_value' function registered for a ReflectReference"); - - let out = display_func.call_script_function( - vec![ScriptValue::Reference(self_)], - world, - lua_caller_context(Some(std::any::TypeId::of::())), - )?; - - Ok(LuaScriptValue::from(out)) - }); } } diff --git a/docs/src/ScriptingReference/script-query-builder.md b/docs/src/ScriptingReference/script-query-builder.md index 1d41d17267..59a07f0abc 100644 --- a/docs/src/ScriptingReference/script-query-builder.md +++ b/docs/src/ScriptingReference/script-query-builder.md @@ -55,7 +55,7 @@ Returns: | `Vec` | The query results | ```lua -local results = query.build() +local results = query:build() for _, result in pairs(results) do print(result) end diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index dc47663a20..0c03078853 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -242,7 +242,6 @@ pub fn update_rendered_state( let old_rendered_state = assets .get_mut(&old_rendered_state.image) .expect("World is not setup correctly"); - old_rendered_state.data = new_state.cells.clone(); } } From d52d896cfada40bd0b66adb3497769bf17452ad0 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 20:32:20 +0000 Subject: [PATCH 173/217] improve logs and things --- assets/scripts/game_of_life.lua | 51 ++++++++++++---- crates/bevy_mod_scripting_core/src/asset.rs | 24 +++++++- .../src/bindings/pretty_print.rs | 18 +++--- .../bevy_mod_scripting_core/src/commands.rs | 2 +- crates/bevy_mod_scripting_core/src/lib.rs | 6 +- crates/bevy_mod_scripting_core/src/systems.rs | 50 ++++++++++------ .../bevy_mod_scripting_functions/src/core.rs | 9 +-- .../src/bindings/reference.rs | 11 ++-- .../bevy_mod_scripting_lua/src/lib.rs | 16 ++--- examples/lua/game_of_life.rs | 59 +++++++++++++++---- 10 files changed, 167 insertions(+), 79 deletions(-) diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index f87230f085..c10d8b99b0 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -1,10 +1,11 @@ -print("The game_of_life.lua script just got loaded") -print("Hello from Lua! I am initiating the game of life simulation state to a random state now") - -math.randomseed(os.time()) LifeState = world.get_type_by_name("LifeState") Settings = world.get_type_by_name("Settings") +world.info("Lua: The game_of_life.lua script just got loaded") +world.info("Lua: Hello! I am initiating the game of life simulation state with randomness!") + +math.randomseed(os.time()) + function fetch_life_state() -- find the entity with life state local life_state = nil @@ -19,11 +20,34 @@ local life_state = fetch_life_state() local cells = life_state.cells -- set some cells alive -for _=1,10000 do +for _=1,1000 do local index = math.random(#cells) cells[index] = 255 end +function on_click(x,y) + -- get the settings + world.info("Lua: Clicked at x: " .. x .. " y: " .. y) + local settings = world.get_resource(Settings) + local dimensions = settings.physical_grid_dimensions + local screen = settings.display_grid_dimensions + + local dimension_x = dimensions._1 + local dimension_y = dimensions._2 + + local screen_x = screen._1 + local screen_y = screen._2 + + local cell_width = screen_x / dimension_x + local cell_height = screen_y / dimension_y + + local cell_x = math.floor(x / cell_width) + local cell_y = math.floor(y / cell_height) + + local index = (cell_y * dimension_x) + cell_x + cells[index] = 255 +end + function on_update() local cells = fetch_life_state().cells world.log_all_allocations() @@ -38,14 +62,15 @@ function on_update() prev_state[#prev_state+1] = (not(v == 0)) and 1 or 0 end for i=1,(dimension_x * dimension_y) do - local north = prev_state[i - dimension_x] or 1 - local south = prev_state[i + dimension_x] or 1 - local east = prev_state[i + 1] or 1 - local west = prev_state[i - 1] or 1 - local northeast = prev_state[i - dimension_x + 1] or 1 - local southeast = prev_state[i + dimension_x + 1] or 1 - local northwest = prev_state[i - dimension_x - 1] or 1 - local southwest = prev_state[i + dimension_x - 1] or 1 + -- wrap around the north and south edges + local north = prev_state[i - dimension_x] or prev_state[i + dimension_x * (dimension_y - 1)] + local south = prev_state[i + dimension_x] or prev_state[i - dimension_x * (dimension_y - 1)] + local east = prev_state[i + 1] or 0 + local west = prev_state[i - 1] or 0 + local northeast = prev_state[i - dimension_x + 1] or 0 + local southeast = prev_state[i + dimension_x + 1] or 0 + local northwest = prev_state[i - dimension_x - 1] or 0 + local southwest = prev_state[i + dimension_x - 1] or 0 local neighbours = north + south + east + west + northeast + southeast + northwest + southwest diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index 109a5a9f6d..a71a82361a 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -4,10 +4,10 @@ use std::{ }; use bevy::{ - asset::{Asset, AssetLoader, AsyncReadExt}, + asset::{Asset, AssetId, AssetLoader, AsyncReadExt}, ecs::system::Resource, reflect::TypePath, - utils::BoxedFuture, + utils::{BoxedFuture, HashMap}, }; use crate::{prelude::ScriptError, script::ScriptId}; @@ -84,3 +84,23 @@ impl Default for ScriptAssetSettings { pub struct AssetPathToScriptIdMapper { pub map: fn(&Path) -> ScriptId, } + +/// A cache of asset id's to their script id's. Necessary since when we drop an asset we won't have the ability to get the path from the asset. +#[derive(Default, Debug, Resource)] +pub struct AssetIdToScriptIdMap { + pub map: HashMap, ScriptId>, +} + +impl AssetIdToScriptIdMap { + pub fn insert(&mut self, id: AssetId, path: ScriptId) { + self.map.insert(id, path); + } + + pub fn get(&self, id: AssetId) -> Option<&ScriptId> { + self.map.get(&id) + } + + pub fn remove(&mut self, id: AssetId) -> Option { + self.map.remove(&id) + } +} diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index f84bfa2ea9..50d239d75b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -3,7 +3,10 @@ use crate::reflection_extensions::{FakeType, TypeIdExtensions}; use super::{ script_value::ScriptValue, ReflectBase, ReflectBaseType, ReflectReference, WorldGuard, }; -use bevy::reflect::{PartialReflect, ReflectRef}; +use bevy::{ + prelude::World, + reflect::{PartialReflect, ReflectRef}, +}; use itertools::Itertools; use std::{any::TypeId, borrow::Cow}; @@ -56,7 +59,7 @@ macro_rules! downcast_case { } impl ReflectReferencePrinter { - const UNREGISTERED_TYPE: &'static str = "Unregistered TypeId"; + const UNREGISTERED_TYPE: &'static str = "Unregistered"; const UNKNOWN_FIELD: &'static str = ""; pub fn new(reference: ReflectReference) -> Self { @@ -65,13 +68,7 @@ impl ReflectReferencePrinter { fn pretty_print_base(base: &ReflectBaseType, world: WorldGuard, out: &mut String) { let type_id = base.type_id; - let type_registry = world.type_registry(); - let type_registry = type_registry.read(); - - let type_path = type_registry - .get_type_info(type_id) - .map(|t| t.type_path_table().short_path()) - .unwrap_or_else(|| ReflectReferencePrinter::UNREGISTERED_TYPE); + let type_path = type_id.display_with_world(world.clone()); let base_kind = match base.base_id { ReflectBase::Component(e, _) => format!("Component on entity {}", e), @@ -365,6 +362,9 @@ impl DisplayWithWorld for TypeId { fn display_with_world(&self, world: WorldGuard) -> String { if *self == TypeId::of::() { return "Dynamic Type".to_owned(); + } else if *self == TypeId::of::() { + // does not implement Reflect, so we do this manually + return "World".to_owned(); } let type_registry = world.type_registry(); diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index ed7ead6315..3ff8c91fe1 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -117,7 +117,7 @@ impl Command for CreateOrUpdateScript

{ match ctxt { Ok(ctxt) => contexts.insert(ctxt), Err(e) => { - handle_script_errors(world, [e.with_context(format!("Loading context for script with id: {}. With runtime type: {} and context type: {}", self.id, type_name::(), type_name::()))].into_iter()); + handle_script_errors(world, [e.with_context(format!("Loading script with id: {}. Runtime type: {}, Context type: {}", self.id, type_name::(), type_name::()))].into_iter()); return; } } diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 78fa08fe95..052d8586af 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -1,7 +1,7 @@ #![allow(clippy::arc_with_non_send_sync)] use crate::event::ScriptErrorEvent; -use asset::{ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; +use asset::{AssetIdToScriptIdMap, ScriptAsset, ScriptAssetLoader, ScriptAssetSettings}; use bevy::prelude::*; use bindings::{ function::script_function::AppScriptFunctionRegistry, script_value::ScriptValue, @@ -83,6 +83,7 @@ impl Plugin for ScriptingPlugin

{ .init_resource::() .init_resource::() .init_resource::() + .init_resource::() .init_asset::() .register_asset_loader(ScriptAssetLoader { language: "<>".into(), @@ -230,6 +231,8 @@ impl StoreDocumentation for App { #[cfg(test)] mod test { + use asset::AssetIdToScriptIdMap; + use super::*; #[test] @@ -261,5 +264,6 @@ mod test { .contains_resource::>()); assert!(app.world().contains_non_send::>()); assert!(app.world().contains_non_send::>()); + assert!(app.world().contains_resource::()); } } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 76c5960e8d..0ef24a4032 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -2,7 +2,7 @@ use bevy::{ecs::system::SystemState, prelude::*}; use std::any::type_name; use crate::{ - asset::{ScriptAsset, ScriptAssetSettings}, + asset::{AssetIdToScriptIdMap, ScriptAsset, ScriptAssetSettings}, bindings::{pretty_print::DisplayWithWorld, ReflectAllocator, WorldAccessGuard, WorldGuard}, commands::{CreateOrUpdateScript, DeleteScript}, context::{Context, ContextLoadingSettings, ScriptContexts}, @@ -35,39 +35,51 @@ pub fn sync_script_data( mut events: EventReader>, script_assets: Res>, asset_settings: Res, + mut asset_path_map: ResMut, mut commands: Commands, ) { for event in events.read() { - debug!("Responding to script asset event: {:?}", event); + trace!("Received script asset event: {:?}", event); let (id, remove) = match event { // emitted when a new script asset is loaded for the first time AssetEvent::Added { id } => (id, false), AssetEvent::Modified { id } => (id, false), - AssetEvent::Removed { id } | AssetEvent::Unused { id } => (id, true), + AssetEvent::Removed { id } => (id, true), _ => continue, }; + info!("Responding to script asset event: {:?}", event); // get the path let asset = script_assets.get(*id); - let asset = match asset.as_ref() { - Some(a) => a, + + let script_id = match asset_path_map.get(*id) { + Some(id) => id.clone(), None => { - if remove { - debug!( - "Script presumably failed to load, no need to remove anything, ignoring." - ); - continue; - } else { - panic!("Asset was expected to be loaded!"); - } + // we should only enter this branch for new assets + let asset = match asset { + Some(asset) => asset, + None => { + // this can happen if an asset is loaded and immediately unloaded, we can ignore this + continue; + } + }; + + let path = &asset.asset_path; + let converter = asset_settings.script_id_mapper.map; + let script_id = converter(path); + asset_path_map.insert(*id, script_id.clone()); + + script_id } }; - let path = &asset.asset_path; - // convert it to script id - let converter = asset_settings.script_id_mapper.map; - let script_id = converter(path); - if !remove { + let asset = match asset { + Some(asset) => asset, + None => { + // this can happen if an asset is loaded and immediately unloaded, we can ignore this + continue; + } + }; commands.queue(CreateOrUpdateScript::

::new( script_id, asset.content.clone(), @@ -164,7 +176,7 @@ pub fn event_handler( let script = match scripts.scripts.get(script_id) { Some(s) => s, None => { - info!( + trace!( "Script `{}` on entity `{:?}` is either still loading or doesn't exist, ignoring.", script_id, entity ); diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 803f677d1c..cc55d4f9fa 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -32,9 +32,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat .register( "get_type_by_name", |world: WorldCallbackAccess, type_name: String| { - println!("get_type_by_name in: {}", type_name); let val = world.get_type_by_name(type_name)?; - println!("get_type_by_name out: {:?}", val); Ok(val.map(Val)) }, ) @@ -151,14 +149,9 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat let world = s.try_read().expect("stale world"); let allocator = world.allocator(); let allocator = allocator.read(); - for (id,a) in allocator.iter_allocations() { + for (id,_) in allocator.iter_allocations() { let raid = ReflectAccessId::for_allocation(id.clone()); if world.claim_read_access(raid) { - { - let ptr = a.get_ptr(); - let a = unsafe { &*ptr }; - bevy::log::info!("Allocation Id: {}, value: {:?}", id.id(), a); - } // Safety: ref released above unsafe { world.release_access(raid) }; } else { diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index f8443a4b22..c71648155f 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -144,9 +144,7 @@ fn try_call_overloads( } } - Err(last_error - .unwrap_or_else(|| InteropError::missing_function(type_id, key.to_string()).into()) - .into()) + Err(last_error.unwrap_or_else(|| InteropError::missing_function(type_id, key.to_string()))) } impl UserData for LuaReflectReference { @@ -375,8 +373,11 @@ impl UserData for LuaStaticReflectReference { return func?.into_lua(lua); } }; - - Err(InteropError::missing_function(type_id, key.to_string()).into()) + let world = lua.get_world(); + Err( + InteropError::missing_function(type_id, key.display_with_world(world.clone())) + .into(), + ) }, ); } diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index d0568d624d..b37a5150cf 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -27,7 +27,7 @@ use bindings::{ world::{GetWorld, LuaWorld}, }; pub use mlua; -use mlua::{Function, IntoLuaMulti, Lua}; +use mlua::{Function, IntoLua, IntoLuaMulti, Lua, MultiValue}; pub mod bindings; pub mod prelude { pub use crate::mlua::{self, prelude::*, Value}; @@ -195,13 +195,13 @@ pub fn lua_handler( Err(_) => return Ok(()), }; - handler - .call::<()>( - args.into_iter() - .map(LuaScriptValue::from) - .collect::>(), - ) - .map_err(ScriptError::from_mlua_error)?; + let input = MultiValue::from_vec( + args.into_iter() + .map(|arg| LuaScriptValue::from(arg).into_lua(context)) + .collect::>()?, + ); + + handler.call::<()>(input)?; Ok(()) }) } diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 0c03078853..097a5ab9be 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -1,5 +1,5 @@ #![allow(deprecated)] -use std::sync::Mutex; +use std::sync::{Arc, Mutex}; use ansi_parser::AnsiParser; use asset::ScriptAsset; @@ -20,7 +20,7 @@ use bevy_console::{ make_layer, send_log_buffer_to_console, AddConsoleCommand, ConsoleCommand, ConsoleConfiguration, ConsoleOpen, ConsolePlugin, PrintConsoleLine, }; -use bevy_mod_scripting::{prelude::*, ScriptFunctionsPlugin}; +use bevy_mod_scripting::{prelude::*, NamespaceBuilder, ScriptFunctionsPlugin}; use bevy_mod_scripting_lua::LuaScriptingPlugin; use bindings::script_value::ScriptValue; use clap::Parser; @@ -66,32 +66,31 @@ fn run_script_cmd( // I am not mapping the handles to the script names, so I'll just clear the entire list loaded_scripts.0.clear(); - // you could also do: + // you could also do // commands.queue(DeleteScript::::new( // "scripts/game_of_life.lua".into(), // )); + // as this will retain your script asset and handle } } } } -// we use bevy-debug-console to demonstrate how this can fit in in the runtime of a game -// note that using just the entity id instead of the full Entity has issues, -// but since we aren't despawning/spawning entities this works in our case #[derive(Parser, ConsoleCommand)] #[command(name = "gol")] -///Runs a Lua script from the `assets/scripts` directory +/// Controls the game of life pub enum GameOfLifeCommand { + /// Start the game of life by spawning an entity with the game_of_life.lua script Start, + /// Stop the game of life by dropping a handle to the game_of_life.lua script Stop, } -// GAME OF LIFE +// ------------- GAME OF LIFE fn game_of_life_app(app: &mut App) -> &mut App { app.insert_resource(Time::::from_seconds(UPDATE_FREQUENCY.into())) .add_plugins(( // for FPS counters - LogDiagnosticsPlugin::default(), FrameTimeDiagnosticsPlugin, // for scripting LuaScriptingPlugin::default(), @@ -102,15 +101,20 @@ fn game_of_life_app(app: &mut App) -> &mut App { .init_resource::() .init_resource::() .add_systems(Startup, (init_game_of_life_state, load_script_assets)) - .add_systems(Update, sync_window_size) + .add_systems(Update, (sync_window_size, send_on_click)) .add_systems( FixedUpdate, ( update_rendered_state.after(sync_window_size), send_on_update.after(update_rendered_state), - event_handler::, + ( + event_handler::, + event_handler::, + ) + .after(send_on_update), ), - ) + ); + register_script_functions(app) } #[derive(Debug, Default, Clone, Reflect, Component)] @@ -154,6 +158,14 @@ pub fn load_script_assets( .push(asset_server.load("scripts/game_of_life.lua")); } +pub fn register_script_functions(app: &mut App) -> &mut App { + let world = app.world_mut(); + NamespaceBuilder::::new_unregistered(world).register("info", |s: String| { + bevy::log::info!(s); + }); + app +} + pub fn init_game_of_life_state( mut commands: Commands, mut assets: ResMut>, @@ -248,7 +260,7 @@ pub fn update_rendered_state( callback_labels!( OnUpdate => "on_update", - Init => "init" + OnClick => "on_click" ); /// Sends events allowing scripts to drive update logic @@ -259,6 +271,27 @@ pub fn send_on_update(mut events: EventWriter) { )); } +pub fn send_on_click( + buttons: Res>, + q_windows: Query<&Window, With>, + mut events: EventWriter, +) { + if buttons.just_pressed(MouseButton::Left) { + let window = q_windows.single(); + let pos = window.cursor_position().unwrap_or_default(); + let x = pos.x as u32; + let y = pos.y as u32; + bevy::log::info!("Mouse clicked at: ({}, {})", x, y); + events.send(ScriptCallbackEvent::new_for_all( + OnClick, + vec![ + ScriptValue::Integer(x as i64), + ScriptValue::Integer(y as i64), + ], + )); + } +} + const UPDATE_FREQUENCY: f32 = 1.0 / 60.0; // MAIN From 0307fb99891d8c81df85e914a82f55f38f85a658 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 21:27:38 +0000 Subject: [PATCH 174/217] add on load and unload hooks --- assets/scripts/game_of_life.lua | 39 +++++++--- .../bevy_mod_scripting_core/src/commands.rs | 73 ++++++++++++++++++- crates/bevy_mod_scripting_core/src/context.rs | 22 ++++-- crates/bevy_mod_scripting_core/src/event.rs | 5 ++ crates/bevy_mod_scripting_core/src/systems.rs | 1 + examples/lua/game_of_life.rs | 10 +-- 6 files changed, 124 insertions(+), 26 deletions(-) diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index c10d8b99b0..9f36e46d07 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -2,32 +2,40 @@ LifeState = world.get_type_by_name("LifeState") Settings = world.get_type_by_name("Settings") world.info("Lua: The game_of_life.lua script just got loaded") -world.info("Lua: Hello! I am initiating the game of life simulation state with randomness!") math.randomseed(os.time()) function fetch_life_state() -- find the entity with life state local life_state = nil + for i,result in pairs(world.query({LifeState}):build()) do life_state = result:components()[1] break end return life_state -end - -local life_state = fetch_life_state() -local cells = life_state.cells +end --- set some cells alive -for _=1,1000 do - local index = math.random(#cells) - cells[index] = 255 -end +function on_script_loaded() + world.info("Lua: Hello! I am initiating the game of life simulation state with randomness!") + world.info("Lua: Click on the screen to set cells alive") + + local life_state = fetch_life_state() + local cells = life_state.cells + + -- set some cells alive + for _=1,1000 do + local index = math.random(#cells) + cells[index] = 255 + end +end function on_click(x,y) -- get the settings world.info("Lua: Clicked at x: " .. x .. " y: " .. y) + local life_state = fetch_life_state() + local cells = life_state.cells + local settings = world.get_resource(Settings) local dimensions = settings.physical_grid_dimensions local screen = settings.display_grid_dimensions @@ -83,4 +91,15 @@ function on_update() cells[i] = 0 end end +end + +function on_script_unloaded() + world.info("Lua: I am being unloaded, goodbye!") + + -- set state to 0's + local life_state = fetch_life_state() + local cells = life_state.cells + for i=1,#cells do + cells[i] = 0 + end end \ No newline at end of file diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index 3ff8c91fe1..cd1a57d4a7 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -1,10 +1,17 @@ use std::{any::type_name, marker::PhantomData}; -use bevy::{asset::Handle, ecs::world::Mut, log::debug, prelude::Command}; +use bevy::{ + asset::Handle, + ecs::world::Mut, + log::{debug, info}, + prelude::Command, +}; use crate::{ asset::ScriptAsset, context::{Context, ContextLoadingSettings, ScriptContexts}, + event::{IntoCallbackLabel, OnScriptLoaded, OnScriptUnloaded}, + handler::CallbackSettings, prelude::{Runtime, RuntimeContainer}, script::{Script, ScriptId, Scripts}, systems::handle_script_errors, @@ -33,17 +40,47 @@ impl Command for DeleteScript

{ .expect("No ScriptLoadingSettings resource found") .clone(); + let runner = world + .get_resource::>() + .expect("No CallbackSettings resource found") + .callback_handler + .expect("No callback handler set"); + + let mut ctxts = world + .remove_non_send_resource::>() + .unwrap(); + + let mut runtime_container = world + .remove_non_send_resource::>() + .unwrap(); + world.resource_scope(|world, mut scripts: Mut| { if let Some(script) = scripts.scripts.remove(&self.id) { debug!("Deleting script with id: {}", self.id); - let mut ctxts = world.get_non_send_resource_mut::>(); - let ctxts = ctxts.as_deref_mut().unwrap(); + + // first let the script uninstall itself + match (runner)( + vec![], + bevy::ecs::entity::Entity::from_raw(0), + &self.id, + &OnScriptUnloaded::into_callback_label(), + ctxts.get_mut(script.context_id).unwrap(), + &settings.context_pre_handling_initializers, + &mut runtime_container.runtime, + world, + ) { + Ok(_) => {}, + Err(e) => { + handle_script_errors(world, [e.with_context(format!("Running unload hook for script with id: {}. Runtime type: {}, Context type: {}", self.id, type_name::(), type_name::()))].into_iter()); + } + } + let assigner = settings .assigner .as_ref() .expect("Could not find context assigner in settings"); debug!("Removing script with id: {}", self.id); - (assigner.remove)(script.context_id, &script, ctxts) + (assigner.remove)(script.context_id, &script, &mut ctxts) } else { bevy::log::error!( "Attempted to delete script with id: {} but it does not exist, doing nothing!", @@ -53,6 +90,8 @@ impl Command for DeleteScript

{ }); world.insert_resource(settings); + world.insert_non_send_resource(ctxts); + world.insert_non_send_resource(runtime_container); } } @@ -80,6 +119,10 @@ impl CreateOrUpdateScript

{ impl Command for CreateOrUpdateScript

{ fn apply(self, world: &mut bevy::prelude::World) { + debug!( + "CreateOrUpdateScript command applying to script_id: {}", + self.id + ); let settings = world .get_resource::>() .unwrap() @@ -90,9 +133,12 @@ impl Command for CreateOrUpdateScript

{ let mut runtime = world .remove_non_send_resource::>() .unwrap(); + + let mut runner = world.get_resource::>().unwrap(); // assign context let assigner = settings.assigner.clone().expect("No context assigner set"); let builder = settings.loader.clone().expect("No context loader set"); + let runner = runner.callback_handler.expect("No callback handler set"); world.resource_scope(|world, mut scripts: Mut| { @@ -111,6 +157,15 @@ impl Command for CreateOrUpdateScript

{ debug!("Context assigned: {:?}", current_context_id); let current_context_id = if let Some(id) = current_context_id { + // reload existing context + let current_context = contexts.get_mut(id).unwrap(); + match (builder.reload)(&self.id, &self.content, current_context, &settings.context_initializers, &settings.context_pre_handling_initializers, world, &mut runtime.runtime) { + Ok(_) => {}, + Err(e) => { + handle_script_errors(world, [e.with_context(format!("Reloading script with id: {}. Runtime type: {}, Context type: {}", self.id, type_name::(), type_name::()))].into_iter()); + return; + } + }; id } else { let ctxt = (builder.load)(&self.id, &self.content, &settings.context_initializers, &settings.context_pre_handling_initializers, world, &mut runtime.runtime); @@ -123,6 +178,7 @@ impl Command for CreateOrUpdateScript

{ } }; + if let Some(previous) = previous_context_id { if previous != current_context_id { debug!( @@ -134,6 +190,13 @@ impl Command for CreateOrUpdateScript

{ } } + let context = contexts.get_mut(current_context_id).expect("Context not found"); + match (runner)(vec![], bevy::ecs::entity::Entity::from_raw(0), &self.id, &OnScriptLoaded::into_callback_label(), context, &settings.context_pre_handling_initializers, &mut runtime.runtime, world) { + Ok(_) => {}, + Err(e) => { + handle_script_errors(world, [e.with_context(format!("Running initialization hook for script with id: {}. Runtime type: {}, Context type: {}", self.id, type_name::(), type_name::()))].into_iter()); + }, + } // now we can insert the actual script scripts.scripts.insert( @@ -144,6 +207,8 @@ impl Command for CreateOrUpdateScript

{ context_id: current_context_id, }, ); + + // finally we trigger on_script_loaded }); world.insert_resource(settings); world.insert_non_send_resource(runtime); diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs index 48625cc459..154c496a83 100644 --- a/crates/bevy_mod_scripting_core/src/context.rs +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -49,6 +49,14 @@ impl ScriptContexts

{ pub fn remove(&mut self, id: ContextId) -> Option { self.contexts.remove(&id) } + + pub fn get(&self, id: ContextId) -> Option<&P::C> { + self.contexts.get(&id) + } + + pub fn get_mut(&mut self, id: ContextId) -> Option<&mut P::C> { + self.contexts.get_mut(&id) + } } /// Initializer run once after creating a context but before executing it for the first time @@ -93,19 +101,19 @@ pub struct ContextBuilder { pub load: fn( script: &ScriptId, content: &[u8], - &[ContextInitializer

], - &[ContextPreHandlingInitializer

], - &mut World, + context_initializers: &[ContextInitializer

], + pre_handling_initializers: &[ContextPreHandlingInitializer

], + world: &mut World, runtime: &mut P::R, ) -> Result, pub reload: fn( script: &ScriptId, new_content: &[u8], context: &mut P::C, - &[ContextInitializer

], - &[ContextPreHandlingInitializer

], - &mut World, - &mut P::R, + context_initializers: &[ContextInitializer

], + pre_handling_initializers: &[ContextPreHandlingInitializer

], + world: &mut World, + runtime: &mut P::R, ) -> Result<(), ScriptError>, } diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index f0d41d7687..0cc8fd6495 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -65,6 +65,11 @@ macro_rules! callback_labels { }; } +callback_labels!( + OnScriptLoaded => "on_script_loaded", + OnScriptUnloaded => "on_script_unloaded" +); + pub trait IntoCallbackLabel { fn into_callback_label() -> CallbackLabel; } diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 0ef24a4032..bf4b40965a 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -80,6 +80,7 @@ pub fn sync_script_data( continue; } }; + info!("Creating or updating script with id: {}", script_id); commands.queue(CreateOrUpdateScript::

::new( script_id, asset.content.clone(), diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 097a5ab9be..27aa2d8e91 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -54,14 +54,16 @@ fn run_script_cmd( match command { GameOfLifeCommand::Start => { // create an entity with the script component - bevy::log::info!("Starting game of life!"); + bevy::log::info!( + "Starting game of life spawning entity with the game_of_life.lua script" + ); commands.spawn(ScriptComponent::new( vec!["scripts/game_of_life.lua".into()], )); } GameOfLifeCommand::Stop => { // we can simply drop the handle, or manually delete, I'll just drop the handle - bevy::log::info!("Stopping game of life!"); + bevy::log::info!("Stopping game of life by dropping the handle to the script"); // I am not mapping the handles to the script names, so I'll just clear the entire list loaded_scripts.0.clear(); @@ -90,8 +92,6 @@ pub enum GameOfLifeCommand { fn game_of_life_app(app: &mut App) -> &mut App { app.insert_resource(Time::::from_seconds(UPDATE_FREQUENCY.into())) .add_plugins(( - // for FPS counters - FrameTimeDiagnosticsPlugin, // for scripting LuaScriptingPlugin::default(), ScriptFunctionsPlugin, @@ -205,6 +205,7 @@ pub fn init_game_of_life_state( }); bevy::log::info!("Game of life was initialized. use `gol start` to start the game!"); + bevy::log::info!("Type `help gol` for more commands."); } pub fn sync_window_size( @@ -281,7 +282,6 @@ pub fn send_on_click( let pos = window.cursor_position().unwrap_or_default(); let x = pos.x as u32; let y = pos.y as u32; - bevy::log::info!("Mouse clicked at: ({}, {})", x, y); events.send(ScriptCallbackEvent::new_for_all( OnClick, vec![ From c42963ad7bdc1915a2611047fe83679b88c0f7ed Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 21:30:35 +0000 Subject: [PATCH 175/217] add docs about callbacks --- docs/src/SUMMARY.md | 1 + docs/src/ScriptingReference/core-callbacks.md | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 docs/src/ScriptingReference/core-callbacks.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index dbc03f822b..6e3b71226c 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -17,3 +17,4 @@ - [ScriptTypeRegistration](./ScriptingReference/script-type-registration.md) - [ScriptQueryBuilder](./ScriptingReference/script-query-builder.md) - [ScriptQueryResult](./ScriptingReference/script-query-result.md) +- [Core Callbacks](./ScriptingReference/core-callbacks.md) diff --git a/docs/src/ScriptingReference/core-callbacks.md b/docs/src/ScriptingReference/core-callbacks.md new file mode 100644 index 0000000000..14af4dfdbd --- /dev/null +++ b/docs/src/ScriptingReference/core-callbacks.md @@ -0,0 +1,28 @@ +# Core Callbacks + +On top of callbacks which are registered by your application, BMS provides a set of core callbacks which are always available. + +The two core callbacks are: +- `on_script_loaded` +- `on_script_unloaded` + +## `on_script_loaded` + +This will be called right after a script has been loaded or reloaded. This is a good place to initialize your script. You should avoid placing a lot of logic into the global body of your script, and instead put it into this callback. Otherwise errors in the initialization will fail the loading of the script. + +```lua +print("you can also use this space, but it's not recommended") +function on_script_loaded() + print("Hello world") +end +``` + +## `on_script_unloaded` + +This will be called right before a script is unloaded. This is a good place to clean up any resources that your script has allocated. Note this is not called when a script is reloaded, only when it is being removed from the system. + +```lua +function on_script_unloaded() + print("Goodbye world") +end +``` \ No newline at end of file From f4d2125fe5d1639c43cc984feb10eedc4fcf1bc4 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 22:36:49 +0000 Subject: [PATCH 176/217] change query signature slightly --- assets/scripts/game_of_life.lua | 34 ++++++++++++++----- .../src/bindings/query.rs | 18 ++++++++-- .../bevy_mod_scripting_functions/src/core.rs | 14 +++++--- .../query/empty_query_returns_nothing.lua | 2 +- .../query_returns_all_entities_matching.lua | 2 +- .../script-query-builder.md | 21 ++++++++++++ docs/src/ScriptingReference/world.md | 8 +---- 7 files changed, 74 insertions(+), 25 deletions(-) diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index 9f36e46d07..0a76d4a68f 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -6,14 +6,9 @@ world.info("Lua: The game_of_life.lua script just got loaded") math.randomseed(os.time()) function fetch_life_state() - -- find the entity with life state - local life_state = nil - - for i,result in pairs(world.query({LifeState}):build()) do - life_state = result:components()[1] - break - end - return life_state + -- find the first entity with life state + local i,v = next(world.query():component(LifeState):build()) + return v:components()[1] end function on_script_loaded() @@ -53,7 +48,28 @@ function on_click(x,y) local cell_y = math.floor(y / cell_height) local index = (cell_y * dimension_x) + cell_x - cells[index] = 255 + + -- toggle a bunch of cells around if they exist + local cell_offsets = { + {0,0}, + {1,0}, + {0,1}, + {1,1}, + {-1,0}, + {0,-1}, + {-1,-1}, + {1,-1}, + {-1,1} + } + + for _,offset in pairs(cell_offsets) do + local offset_x = offset[1] + local offset_y = offset[2] + local new_index = index + offset_x + offset_y * dimension_x + if new_index > 0 and new_index <= (dimension_x * dimension_y) then + cells[new_index] = 255 + end + end end function on_update() diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index e8381ae83c..c05180c9c9 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -90,16 +90,30 @@ impl ScriptQueryBuilder { self.components.extend(components); self } + pub fn component(&mut self, component: ScriptTypeRegistration) -> &mut Self { + self.components.push(component); + self + } - pub fn with(&mut self, with: Vec) -> &mut Self { + pub fn with_components(&mut self, with: Vec) -> &mut Self { self.with.extend(with); self } - pub fn without(&mut self, without: Vec) -> &mut Self { + pub fn with_component(&mut self, with: ScriptTypeRegistration) -> &mut Self { + self.with.push(with); + self + } + + pub fn without_components(&mut self, without: Vec) -> &mut Self { self.without.extend(without); self } + + pub fn without_component(&mut self, without: ScriptTypeRegistration) -> &mut Self { + self.without.push(without); + self + } } #[derive(Clone, Reflect)] diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index cc55d4f9fa..e557f6ef01 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -138,9 +138,8 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat }) .register( "query", - |components: Vec>| { - let mut query_builder = ScriptQueryBuilder::default(); - query_builder.components(components.into_iter().map(|v| v.into_inner()).collect()); + || { + let query_builder = ScriptQueryBuilder::default(); Ok(Val(query_builder)) }, ) @@ -363,11 +362,16 @@ pub fn register_script_query_builder_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) + .register("component", |s: Val, components: Val| { + let mut builder = s.into_inner(); + builder.component(components.into_inner()); + Val(builder) + }) .register( "with", |s: Val, with: Val| { let mut builder = s.into_inner(); - builder.with(vec![with.into_inner()]); + builder.with_component(with.into_inner()); Val(builder) }, ) @@ -375,7 +379,7 @@ pub fn register_script_query_builder_functions( "without", |s: Val, without: Val| { let mut builder = s.into_inner(); - builder.without(vec![without.into_inner()]); + builder.without_component(without.into_inner()); Val(builder) }, ) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua index e49c5e147c..3d4e35356d 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/empty_query_returns_nothing.lua @@ -1,5 +1,5 @@ local component_a = world.get_type_by_name("TestComponent") -for i,result in pairs(world.query({component_a}):with(component_a):without(component_a):build()) do +for i,result in pairs(world.query():component(component_a):without(component_a):build()) do assert(false, "This should not be reached") end \ No newline at end of file diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua index 1ce43b8b0c..5a3e83b055 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/query/query_returns_all_entities_matching.lua @@ -13,7 +13,7 @@ world.add_default_component(entity_c, component_with) world.add_default_component(entity_b, component_without) local found_entities = {} -for i,result in pairs(world.query({component_with}):with(component_with):without(component_without):build()) do +for i,result in pairs(world.query():component(component_with):without(component_without):build()) do table.insert(found_entities, result:entity()) end diff --git a/docs/src/ScriptingReference/script-query-builder.md b/docs/src/ScriptingReference/script-query-builder.md index 59a07f0abc..3f0654b14d 100644 --- a/docs/src/ScriptingReference/script-query-builder.md +++ b/docs/src/ScriptingReference/script-query-builder.md @@ -2,6 +2,27 @@ The query builder is used to build queries for entities with specific components. Can be used to interact with arbitrary entities in the world. +## component + +Adds a component to the query, this will be accessible in the query results under the index corresponding to the index of this component in the query. + +Arguments: + +| Argument | Type | Description | +| --- | --- | --- | +| `s` | `ScriptQueryBuilder` | The query builder | +| `component` | `ScriptTypeRegistration` | The component to query for | + +Returns: + +| Return | Description | +| --- | --- | +| `ScriptQueryBuilder` | The updated query builder | + +```lua +query:component(MyType):component(MyOtherType) +``` + ## with Arguments: diff --git a/docs/src/ScriptingReference/world.md b/docs/src/ScriptingReference/world.md index 29370c1c85..387b40232f 100644 --- a/docs/src/ScriptingReference/world.md +++ b/docs/src/ScriptingReference/world.md @@ -284,12 +284,6 @@ end ### query -Arguments: - -| Argument | Type | Description | -| --- | --- | --- | -| `components` | `Vec` | The components to query for | - Returns: | Return | Description | @@ -297,7 +291,7 @@ Returns: | `ScriptQueryBuilder` | The query builder | ```lua -query = world.query({MyType}) +local queryBuilder = world.query() ``` ### exit From 7bafd98d114504102edb11d7e64ff4765677c91f Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 22:42:38 +0000 Subject: [PATCH 177/217] cleanup some imports --- crates/bevy_mod_scripting_core/src/bindings/function/from.rs | 2 +- .../bevy_mod_scripting_core/src/bindings/function/from_ref.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index f721a7812a..184b57b47c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -3,7 +3,7 @@ use crate::{ error::InteropError, prelude::ScriptValue, }; -use bevy::reflect::{FromReflect, GetTypeRegistration, Reflect}; +use bevy::reflect::{FromReflect, Reflect}; use std::{ any::TypeId, ffi::OsString, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs index b72974b447..d5b850ae5b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs @@ -3,8 +3,7 @@ use std::{any::TypeId, ffi::OsString, path::PathBuf}; use bevy::reflect::{DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, PartialReflect}; use crate::{ - bindings::{function::from::FromScript, ReflectReference, WorldGuard}, - downcast_into_value, + bindings::{function::from::FromScript, WorldGuard}, error::InteropError, match_by_type, prelude::ScriptValue, From e6beb492126d0924780aaf088a251c5116d3d9ff Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:06:04 +0000 Subject: [PATCH 178/217] clippy fixes --- crates/bevy_mod_scripting_core/src/asset.rs | 16 +- .../src/bindings/access_map.rs | 10 +- .../src/bindings/allocator.rs | 21 +- .../src/bindings/function/from.rs | 2 +- .../src/bindings/function/into.rs | 4 +- .../src/bindings/function/into_ref.rs | 2 +- .../src/bindings/function/mod.rs | 16 +- .../src/bindings/function/script_function.rs | 29 +- .../src/bindings/query.rs | 23 +- .../src/bindings/reference.rs | 37 +-- .../src/bindings/script_value/mod.rs | 31 +-- .../src/bindings/world.rs | 60 +--- .../bevy_mod_scripting_core/src/commands.rs | 17 +- crates/bevy_mod_scripting_core/src/context.rs | 16 +- crates/bevy_mod_scripting_core/src/error.rs | 33 +-- crates/bevy_mod_scripting_core/src/event.rs | 3 +- crates/bevy_mod_scripting_core/src/handler.rs | 12 +- crates/bevy_mod_scripting_core/src/lib.rs | 2 +- .../src/reflection_extensions.rs | 42 +-- crates/bevy_mod_scripting_core/src/systems.rs | 15 +- .../bevy_mod_scripting_functions/src/core.rs | 18 +- .../src/namespaced_register.rs | 10 +- .../src/bindings/reference.rs | 33 +-- .../src/bindings/script_value.rs | 3 +- .../src/bindings/world.rs | 13 +- .../bevy_mod_scripting_lua/src/lib.rs | 19 +- .../bevy_mod_scripting_lua/src/util.rs | 263 ------------------ .../bevy_mod_scripting_rhai/src/lib.rs | 5 +- 28 files changed, 138 insertions(+), 617 deletions(-) delete mode 100644 crates/languages/bevy_mod_scripting_lua/src/util.rs diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index a71a82361a..3240609be7 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -1,16 +1,14 @@ -use std::{ - borrow::Cow, - path::{Path, PathBuf}, -}; - +use crate::{prelude::ScriptError, script::ScriptId}; use bevy::{ - asset::{Asset, AssetId, AssetLoader, AsyncReadExt}, + asset::{Asset, AssetId, AssetLoader}, ecs::system::Resource, reflect::TypePath, - utils::{BoxedFuture, HashMap}, + utils::HashMap, +}; +use std::{ + borrow::Cow, + path::{Path, PathBuf}, }; - -use crate::{prelude::ScriptError, script::ScriptId}; /// Represents a script loaded into memory as an asset #[derive(Asset, TypePath, Clone)] diff --git a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs index 123581ff16..8dbbc39208 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/access_map.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/access_map.rs @@ -1,13 +1,10 @@ -use std::{ - sync::atomic::{AtomicBool, AtomicUsize}, - thread::ThreadId, -}; +use std::{sync::atomic::AtomicBool, thread::ThreadId}; use bevy::{ ecs::{component::ComponentId, world::unsafe_world_cell::UnsafeWorldCell}, prelude::Resource, }; -use dashmap::{try_result::TryResult, DashMap, Entry, Map}; +use dashmap::{DashMap, Entry}; use smallvec::SmallVec; use super::{ReflectAllocationId, ReflectBase}; @@ -49,7 +46,7 @@ impl AccessCount { } fn as_location(&self) -> Option> { - self.read_by.first().map(|o| o.location.clone()) + self.read_by.first().map(|o| o.location) } fn readers(&self) -> usize { @@ -372,6 +369,7 @@ macro_rules! with_global_access { ) ); } else { + #[allow(clippy::redundant_closure_call)] let result = (|| $body)(); $access_map.release_global_access(); result diff --git a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs index 0c33340e09..2499dd41b3 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/allocator.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/allocator.rs @@ -1,15 +1,14 @@ -use bevy::ecs::system::Resource; -use bevy::reflect::{PartialReflect, Reflect}; +use bevy::{ecs::system::Resource, reflect::PartialReflect}; use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; -use std::any::{Any, TypeId}; -use std::cell::UnsafeCell; -use std::cmp::Ordering; -use std::collections::HashMap; -use std::fmt::{Display, Formatter}; -use std::hash::Hasher; -use std::io::Read; -use std::sync::atomic::{AtomicU64, AtomicUsize}; -use std::sync::Arc; +use std::{ + any::TypeId, + cell::UnsafeCell, + cmp::Ordering, + collections::HashMap, + fmt::{Display, Formatter}, + hash::Hasher, + sync::{atomic::AtomicU64, Arc}, +}; #[derive(Clone, Debug)] pub struct ReflectAllocationId(pub(crate) Arc); diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index 184b57b47c..ea42e570c8 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -34,7 +34,7 @@ impl FromScript for ScriptValue { impl FromScript for () { type This<'w> = Self; - fn from_script(value: ScriptValue, _world: WorldGuard) -> Result { + fn from_script(_value: ScriptValue, _world: WorldGuard) -> Result { Ok(()) } } diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index ef96128ac5..f7e090148c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -1,10 +1,10 @@ use std::{ borrow::Cow, ffi::OsString, - path::{Path, PathBuf}, + path::PathBuf, }; -use bevy::reflect::{GetTypeRegistration, PartialReflect, ReflectRef}; +use bevy::reflect::PartialReflect; use crate::{ bindings::{ReflectReference, WorldGuard}, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs index e71d191bc1..b7192d5b12 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs @@ -1,4 +1,4 @@ -use std::{any::TypeId, ffi::OsString, path::PathBuf}; +use std::{ffi::OsString, path::PathBuf}; use bevy::reflect::{ParsedPath, PartialReflect}; diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index 0318a2a10d..3540443495 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -1,4 +1,3 @@ -use std::{any::TypeId, borrow::Cow, ops::Deref, sync::Arc}; pub mod from; pub mod from_ref; @@ -6,23 +5,12 @@ pub mod into; pub mod into_ref; pub mod script_function; -use bevy::reflect::{ - func::{ - args::{Arg, ArgInfo, Ownership}, - ArgList, ArgValue, DynamicFunction, FunctionInfo, FunctionResult, Return, - }, - PartialReflect, -}; use script_function::{CallerContext, DynamicScriptFunction, DynamicScriptFunctionMut}; -use crate::{ - error::{FlattenError, InteropError, InteropErrorInner, ScriptError, ScriptResult}, - reflection_extensions::{PartialReflectExt, ReturnValExt}, -}; +use crate::error::InteropError; use super::{ - access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_value::ScriptValue, - ReflectBase, ReflectReference, WorldAccessGuard, WorldCallbackAccess, WorldGuard, + pretty_print::DisplayWithWorld, script_value::ScriptValue, WorldCallbackAccess, WorldGuard, }; /// Can be implemented for callables which require dynamic access to the world to be called. diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 99bd1640ae..1acf27caf8 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -8,11 +8,10 @@ use crate::{ prelude::{ScriptValue, WorldCallbackAccess}, }; use bevy::{ - prelude::{AppFunctionRegistry, IntoFunction, Reflect, Resource, World}, + prelude::{Reflect, Resource}, reflect::{ - func::{args::GetOwnership, DynamicFunction, FunctionError, FunctionInfo, TypedFunction}, - FromReflect, GetTypeRegistration, PartialReflect, TypePath, TypeRegistration, TypeRegistry, - Typed, + func::{args::GetOwnership, FunctionError}, + FromReflect, GetTypeRegistration, TypePath, TypeRegistry, Typed, }, }; use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; @@ -531,28 +530,6 @@ macro_rules! assert_is_script_function { #[cfg(test)] mod test { use super::*; - use crate::bindings::function::script_function::ScriptFunction; - use crate::prelude::AppReflectAllocator; - use bevy::reflect::func::{ArgList, ArgValue, Return}; - use test_utils::test_data::*; - - fn test_setup_world() -> World { - setup_world(|w, _| w.insert_resource(AppReflectAllocator::default())) - } - - fn assert_function_info_eq(a: &FunctionInfo, b: &FunctionInfo) { - assert_eq!(a.name(), b.name(), "Function names do not match"); - assert_eq!( - a.args().len(), - b.args().len(), - "Function arg count does not match" - ); - for (a, b) in a.args().iter().zip(b.args().iter()) { - assert_eq!(a.type_id(), b.type_id(), "Function arg types do not match"); - assert_eq!(a.name(), b.name(), "Function arg names do not match"); - } - } - #[test] fn test_register_script_function() { let mut registry = ScriptFunctionRegistry::default(); diff --git a/crates/bevy_mod_scripting_core/src/bindings/query.rs b/crates/bevy_mod_scripting_core/src/bindings/query.rs index c05180c9c9..d6a438f819 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/query.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/query.rs @@ -1,9 +1,5 @@ use super::{ReflectReference, WorldAccessGuard, WorldCallbackAccess}; -use crate::{ - bindings::{CONCURRENT_WORLD_ACCESS_MSG, STALE_WORLD_MSG}, - error::InteropError, - with_global_access, -}; +use crate::{error::InteropError, with_global_access}; use bevy::{ ecs::{component::ComponentId, entity::Entity}, prelude::{EntityRef, QueryBuilder}, @@ -133,7 +129,7 @@ impl WorldCallbackAccess { } } -impl<'w> WorldAccessGuard<'w> { +impl WorldAccessGuard<'_> { pub fn query( &self, query: ScriptQueryBuilder, @@ -203,18 +199,3 @@ impl<'w> WorldAccessGuard<'w> { }) } } - -#[cfg(test)] -mod test { - use test_utils::test_data::setup_world; - - use super::*; - - // #[test] - // fn test_simple_query() { - // let world = setup_world(|w,r|{ - // w.spawn(TestComponent::init()) - // w.spawn(Te) - // }) - // } -} diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index 46dad58dec..e71f93710c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -4,14 +4,11 @@ //! reflection gives us access to `dyn PartialReflect` objects via their type name, //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. -use super::{ - access_map::{AccessMapKey, ReflectAccessId}, - WorldAccessGuard, WorldCallbackAccess, WorldGuard, -}; +use super::{access_map::ReflectAccessId, WorldGuard}; use crate::{ - bindings::{pretty_print::DisplayWithWorld, ReflectAllocationId}, + bindings::ReflectAllocationId, error::InteropError, - prelude::{ReflectAllocator, ScriptResult}, + prelude::ReflectAllocator, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, with_access_read, with_access_write, }; @@ -22,14 +19,9 @@ use bevy::{ }, prelude::{Component, ReflectDefault, Resource}, ptr::Ptr, - reflect::{ - func::{args::ArgInfo, ArgValue}, - ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectFromReflect, ReflectMut, - ReflectPath, ReflectPathError, ReflectRef, TypeData, - }, + reflect::{ParsedPath, PartialReflect, Reflect, ReflectFromPtr, ReflectPath}, }; -use itertools::Either; -use std::{any::TypeId, fmt::Debug, sync::Arc}; +use std::{any::TypeId, fmt::Debug}; /// An accessor to a `dyn PartialReflect` struct, stores a base ID of the type and a reflection path /// safe to build but to reflect on the value inside you need to ensure aliasing rules are upheld @@ -464,25 +456,6 @@ impl ReflectBase { } } -fn map_key_to_concrete(key: &str, key_type_id: TypeId) -> Option> { - match key_type_id { - _ if key_type_id == std::any::TypeId::of::() => Some(Box::new(key.to_owned())), - _ if key_type_id == std::any::TypeId::of::() => key - .parse::() - .ok() - .map(|u| Box::new(u) as Box), - _ if key_type_id == std::any::TypeId::of::() => key - .parse::() - .ok() - .map(|f| Box::new(f) as Box), - _ if key_type_id == std::any::TypeId::of::() => key - .parse::() - .ok() - .map(|b| Box::new(b) as Box), - _ => None, - } -} - pub trait ReflectionPathExt { fn convert_to_0_indexed(&mut self); diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs index 6503dadaa2..cbf8ea3655 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs @@ -1,25 +1,10 @@ -use std::{ - any::{type_name, TypeId}, - borrow::Cow, - ffi::{CStr, CString, OsStr, OsString}, - path::{Path, PathBuf}, -}; - -use bevy::reflect::{ - Access, DynamicEnum, DynamicList, DynamicTuple, DynamicVariant, OffsetAccess, ParsedPath, - PartialReflect, Reflect, ReflectFromReflect, TypeData, -}; - -use crate::{ - error::{InteropError, InteropErrorInner, ScriptError, ScriptResult}, - reflection_extensions::{PartialReflectExt, TypeIdExtensions, TypeInfoExtensions}, -}; - -use super::{ - function::script_function::{DynamicScriptFunction, DynamicScriptFunctionMut}, - pretty_print::DisplayWithWorld, - ReflectReference, WorldGuard, -}; +use std::borrow::Cow; + +use bevy::reflect::{OffsetAccess, ParsedPath, Reflect}; + +use crate::error::InteropError; + +use super::{function::script_function::DynamicScriptFunctionMut, ReflectReference}; /// An abstraction of values that can be passed to and from scripts. /// This allows us to re-use logic between scripting languages. @@ -148,7 +133,7 @@ impl TryFrom for ParsedPath { access: bevy::reflect::Access::ListIndex(i as usize), offset: Some(1), }]), - ScriptValue::Float(v) => { + ScriptValue::Float(_) => { return Err(InteropError::invalid_index( value, "Floating point numbers cannot be used to index into reflected values" diff --git a/crates/bevy_mod_scripting_core/src/bindings/world.rs b/crates/bevy_mod_scripting_core/src/bindings/world.rs index 2999585b5b..613adab29c 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/world.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/world.rs @@ -5,19 +5,11 @@ //! Scripting languages only really support `Clone` objects so if we want to support references, //! we need wrapper types which have owned and ref variants. -use std::{ - any::TypeId, - fmt::Debug, - marker::PhantomData, - mem, - ops::Deref, - sync::{ - atomic::{AtomicUsize, Ordering}, - Arc, Weak, - }, - time::Duration, +use super::{ + access_map::{AccessCount, AccessMap, ReflectAccessId}, + AppReflectAllocator, ReflectBase, ReflectBaseType, ReflectReference, ScriptTypeRegistration, }; - +use crate::{error::InteropError, with_access_read, with_access_write, with_global_access}; use bevy::{ app::AppExit, ecs::{ @@ -28,31 +20,13 @@ use bevy::{ world::{unsafe_world_cell::UnsafeWorldCell, CommandQueue, Mut, World}, }, hierarchy::{BuildChildren, Children, DespawnRecursiveExt, Parent}, - reflect::{ - func::args::FromArg, std_traits::ReflectDefault, ParsedPath, PartialReflect, Reflect, - TypePath, TypeRegistry, TypeRegistryArc, - }, - utils::HashMap, + reflect::{std_traits::ReflectDefault, ParsedPath, Reflect, TypeRegistryArc}, }; - -use smallvec::SmallVec; - -use crate::{ - bindings::ReflectAllocationId, - error::InteropError, - prelude::{ReflectAllocator, ScriptError, ScriptResult}, - reflection_extensions::TypeIdExtensions, - with_access_read, with_access_write, with_global_access, -}; - -use super::{ - access_map::{AccessCount, AccessMap, ReflectAccessId}, - // proxy::{Proxy, Unproxy}, - AppReflectAllocator, - ReflectBase, - ReflectBaseType, - ReflectReference, - ScriptTypeRegistration, +use std::{ + any::TypeId, + fmt::Debug, + sync::{Arc, Weak}, + time::Duration, }; /// Prefer to directly using [`WorldAccessGuard`]. If the underlying type changes, this alias will be updated. @@ -109,16 +83,10 @@ impl WorldCallbackAccess { pub fn try_read(&self) -> Result, InteropError> { self.0 .upgrade() - .ok_or_else(|| InteropError::stale_world_access()) + .ok_or_else(InteropError::stale_world_access) } } -pub(crate) const STALE_WORLD_MSG: &str = "Tried to access world via stale reference"; -pub(crate) const CONCURRENT_WORLD_ACCESS_MSG: &str = - "Something else is accessing the world right now!"; -pub(crate) const CONCURRENT_ACCESS_MSG: &str = - "Something else is accessing the resource/component/allocation right now!"; - /// common world methods, see: /// - [`crate::bindings::query`] for query related functionality impl WorldCallbackAccess { @@ -636,7 +604,7 @@ impl<'w> WorldAccessGuard<'w> { } /// Impl block for higher level world methods -impl<'w> WorldAccessGuard<'w> { +impl WorldAccessGuard<'_> { pub fn spawn(&self) -> Entity { with_global_access!(self.0.accesses, "Could not spawn entity", { // Safety we have global access @@ -698,7 +666,7 @@ impl<'w> WorldAccessGuard<'w> { let mut entity = world .get_entity_mut(entity) - .map_err(|e| InteropError::missing_entity(entity))?; + .map_err(|_| InteropError::missing_entity(entity))?; { let registry = type_registry.read(); component_data.insert(&mut entity, instance.as_partial_reflect(), ®istry); @@ -774,7 +742,7 @@ impl<'w> WorldAccessGuard<'w> { let world = unsafe { self.0.cell.world_mut() }; let mut entity = world .get_entity_mut(entity) - .map_err(|e| InteropError::missing_entity(entity))?; + .map_err(|_| InteropError::missing_entity(entity))?; component_data.remove(&mut entity); Ok(()) }) diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index cd1a57d4a7..5be92c9841 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -1,22 +1,15 @@ -use std::{any::type_name, marker::PhantomData}; - -use bevy::{ - asset::Handle, - ecs::world::Mut, - log::{debug, info}, - prelude::Command, -}; - use crate::{ asset::ScriptAsset, - context::{Context, ContextLoadingSettings, ScriptContexts}, + context::{ContextLoadingSettings, ScriptContexts}, event::{IntoCallbackLabel, OnScriptLoaded, OnScriptUnloaded}, handler::CallbackSettings, - prelude::{Runtime, RuntimeContainer}, + prelude::RuntimeContainer, script::{Script, ScriptId, Scripts}, systems::handle_script_errors, IntoScriptPluginParams, }; +use bevy::{asset::Handle, ecs::world::Mut, log::debug, prelude::Command}; +use std::{any::type_name, marker::PhantomData}; pub struct DeleteScript { pub id: ScriptId, @@ -134,7 +127,7 @@ impl Command for CreateOrUpdateScript

{ .remove_non_send_resource::>() .unwrap(); - let mut runner = world.get_resource::>().unwrap(); + let runner = world.get_resource::>().unwrap(); // assign context let assigner = settings.assigner.clone().expect("No context assigner set"); let builder = settings.loader.clone().expect("No context loader set"); diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs index 154c496a83..9ca5188261 100644 --- a/crates/bevy_mod_scripting_core/src/context.rs +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -1,12 +1,10 @@ -use std::{collections::HashMap, sync::atomic::AtomicU32}; - -use bevy::ecs::{entity::Entity, system::Resource, world::World}; - use crate::{ - prelude::{Runtime, ScriptError}, + prelude::ScriptError, script::{Script, ScriptId}, IntoScriptPluginParams, }; +use bevy::ecs::{entity::Entity, system::Resource, world::World}; +use std::{collections::HashMap, sync::atomic::AtomicU32}; pub trait Context: 'static {} impl Context for T {} @@ -60,11 +58,11 @@ impl ScriptContexts

{ } /// Initializer run once after creating a context but before executing it for the first time -pub type ContextInitializer = - fn(&ScriptId, &mut P::C) -> Result<(), ScriptError>; +pub type ContextInitializer

= + fn(&ScriptId, &mut

::C) -> Result<(), ScriptError>; /// Initializer run every time before executing or loading a script -pub type ContextPreHandlingInitializer = - fn(&ScriptId, Entity, &mut P::C) -> Result<(), ScriptError>; +pub type ContextPreHandlingInitializer

= + fn(&ScriptId, Entity, &mut

::C) -> Result<(), ScriptError>; #[derive(Resource)] pub struct ContextLoadingSettings { diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index fca91b9381..b6f7a3077b 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -1,31 +1,24 @@ -use std::{ - any::TypeId, - borrow::Cow, - fmt::{Debug, Display}, - ops::{Deref, DerefMut}, - str::Utf8Error, - sync::Arc, -}; - -use bevy::{ - ecs::component::ComponentId, - prelude::Entity, - reflect::{ - func::{args::ArgInfo, FunctionError, FunctionInfo}, - ApplyError, PartialReflect, Reflect, ReflectPathError, - }, -}; -use thiserror::Error; - use crate::{ bindings::{ access_map::DisplayCodeLocation, pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, - ReflectAllocationId, ReflectBase, ReflectBaseType, ReflectReference, + ReflectBaseType, ReflectReference, }, impl_dummy_display, prelude::ScriptValue, }; +use bevy::{ + ecs::component::ComponentId, + prelude::Entity, + reflect::{func::FunctionError, PartialReflect, Reflect}, +}; +use std::{ + any::TypeId, + fmt::{Debug, Display}, + ops::Deref, + str::Utf8Error, + sync::Arc, +}; pub type ScriptResult = Result; diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index 0cc8fd6495..53e2bcb4ab 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -1,7 +1,6 @@ +use crate::{error::ScriptError, prelude::ScriptValue, script::ScriptId}; use bevy::{ecs::entity::Entity, prelude::Event}; -use crate::{error::ScriptError, handler::Args, prelude::ScriptValue, script::ScriptId}; - /// An error coming from a script #[derive(Debug, Event)] pub struct ScriptErrorEvent { diff --git a/crates/bevy_mod_scripting_core/src/handler.rs b/crates/bevy_mod_scripting_core/src/handler.rs index 320b341494..bc122bdf2d 100644 --- a/crates/bevy_mod_scripting_core/src/handler.rs +++ b/crates/bevy_mod_scripting_core/src/handler.rs @@ -1,25 +1,23 @@ -use bevy::ecs::{entity::Entity, system::Resource, world::World}; - use crate::{ - context::{Context, ContextPreHandlingInitializer}, + context::ContextPreHandlingInitializer, event::CallbackLabel, prelude::{ScriptError, ScriptValue}, - runtime::Runtime, script::ScriptId, IntoScriptPluginParams, }; +use bevy::ecs::{entity::Entity, system::Resource, world::World}; pub trait Args: Clone + Send + Sync + 'static {} impl Args for T {} -pub type HandlerFn = fn( +pub type HandlerFn

= fn( args: Vec, entity: Entity, script_id: &ScriptId, callback: &CallbackLabel, - context: &mut P::C, + context: &mut

::C, pre_handling_initializers: &[ContextPreHandlingInitializer

], - runtime: &mut P::R, + runtime: &mut

::R, world: &mut World, ) -> Result<(), ScriptError>; diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index 052d8586af..e5aef4bd25 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -12,7 +12,7 @@ use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, ContextPreHandlingInitializer, ScriptContexts, }; -use handler::{Args, CallbackSettings, HandlerFn}; +use handler::{CallbackSettings, HandlerFn}; pub use itertools::Either; use prelude::{ initialize_runtime, diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 368fcaa265..28282c1a39 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -1,25 +1,13 @@ -use std::{ - any::{Any, TypeId}, - borrow::Cow, - cmp::max, - ffi::{CStr, CString, OsStr, OsString}, - ops::Sub, - path::{Path, PathBuf}, - str::FromStr, +use crate::{ + bindings::{ReflectReference, WorldGuard}, + error::InteropError, }; - use bevy::reflect::{ - func::Return, FromReflect, FromType, List, PartialReflect, Reflect, ReflectFromReflect, - ReflectMut, TypeData, TypeInfo, + func::Return, FromReflect, PartialReflect, Reflect, ReflectFromReflect, ReflectMut, TypeInfo, }; -use itertools::Itertools; - -use crate::{ - bindings::{ - pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, - WorldAccessGuard, WorldGuard, - }, - error::InteropError, +use std::{ + any::{Any, TypeId}, + cmp::max, }; /// Extension trait for [`PartialReflect`] providing additional functionality for working with specific types. pub trait PartialReflectExt { @@ -443,10 +431,7 @@ impl TypeInfoExtensions for TypeInfo { } fn is_list(&self) -> bool { - match self { - TypeInfo::List(_) => true, - _ => false, - } + matches!(self, TypeInfo::List(_)) } fn option_inner_type(&self) -> Option { @@ -470,9 +455,7 @@ impl TypeInfoExtensions for TypeInfo { pub trait ReturnValExt<'a> { fn try_into_or_boxed( self, - ) -> Result> - where - T: PartialReflect; + ) -> Result>; fn as_ref(&'a self) -> &'a dyn PartialReflect; } @@ -498,12 +481,7 @@ impl<'a> ReturnValExt<'a> for Return<'a> { #[cfg(test)] mod test { - use bevy::{ - prelude::{AppTypeRegistry, World}, - reflect::{DynamicMap, Map}, - }; - - use crate::prelude::AppReflectAllocator; + use bevy::reflect::{DynamicMap, Map}; use super::*; diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index bf4b40965a..63892cb905 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -1,19 +1,18 @@ -use bevy::{ecs::system::SystemState, prelude::*}; -use std::any::type_name; - use crate::{ asset::{AssetIdToScriptIdMap, ScriptAsset, ScriptAssetSettings}, - bindings::{pretty_print::DisplayWithWorld, ReflectAllocator, WorldAccessGuard, WorldGuard}, + bindings::{pretty_print::DisplayWithWorld, WorldAccessGuard, WorldGuard}, commands::{CreateOrUpdateScript, DeleteScript}, - context::{Context, ContextLoadingSettings, ScriptContexts}, - error::{ScriptError, ScriptResult}, + context::{ContextLoadingSettings, ScriptContexts}, + error::ScriptError, event::{IntoCallbackLabel, ScriptCallbackEvent, ScriptErrorEvent}, - handler::{Args, CallbackSettings}, + handler::CallbackSettings, prelude::{AppReflectAllocator, RuntimeSettings}, - runtime::{Runtime, RuntimeContainer}, + runtime::RuntimeContainer, script::{ScriptComponent, Scripts}, IntoScriptPluginParams, }; +use bevy::{ecs::system::SystemState, prelude::*}; +use std::any::type_name; /// Cleans up dangling script allocations pub fn garbage_collector(allocator: ResMut) { diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index e557f6ef01..055927e028 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -1,25 +1,23 @@ //! Contains functions defined by the [`bevy_mod_scripting_core`] crate -use std::borrow::Cow; +use crate::NamespaceBuilder; +use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; use bevy::{ prelude::*, reflect::{ - func::{FunctionRegistrationError, FunctionRegistry, FunctionRegistryArc}, GetTypeRegistration, ParsedPath + func::FunctionRegistrationError, ParsedPath }, }; use bevy_mod_scripting_core::*; use bindings::{ access_map::ReflectAccessId, function::{ - from::{Mut, Ref, Val}, + from::{Ref, Val}, from_ref::FromScriptRef, into_ref::IntoScriptRef, - script_function::{CallerContext, GetFunctionTypeDependencies, ScriptFunction, ScriptFunctionMut}, - }, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectAllocationId, ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess + script_function::{CallerContext, ScriptFunctionMut}, + }, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, WorldCallbackAccess }; -use error::{InteropError, InteropErrorInner}; -use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; - -use crate::{namespaced_register::NamespaceBuilder}; +use error::InteropError; pub fn register_bevy_bindings(app: &mut App) { @@ -325,7 +323,7 @@ pub fn register_reflect_reference_functions( return Ok(ScriptValue::Unit); } - let (next_ref, idx) = infinite_iter.next_ref(); + let (next_ref, _) = infinite_iter.next_ref(); let converted = ReflectReference::into_script_ref(next_ref, world.clone()); // println!("idx: {idx:?}, converted: {converted:?}"); diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 984ec3aace..179c022efc 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -1,16 +1,12 @@ -use std::{any::TypeId, borrow::Cow, marker::PhantomData}; - use bevy::{ - prelude::{AppFunctionRegistry, AppTypeRegistry, IntoFunction, World}, - reflect::{ - func::{DynamicFunction, FunctionRegistrationError, FunctionRegistry}, - GetTypeRegistration, - }, + prelude::{AppTypeRegistry, World}, + reflect::GetTypeRegistration, }; use bevy_mod_scripting_core::bindings::function::script_function::{ AppScriptFunctionRegistry, DynamicScriptFunction, GetFunctionTypeDependencies, GetInnerTypeDependencies, ScriptFunction, ScriptFunctionRegistry, }; +use std::{any::TypeId, borrow::Cow, marker::PhantomData}; pub trait RegisterNamespacedFunction { fn register_namespaced_function(&mut self, name: N, function: F) diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index c71648155f..62ca758252 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -1,43 +1,26 @@ -use std::{ - any::{Any, TypeId}, - borrow::Cow, - error::Error, - ffi::{CStr, CString, OsStr, OsString}, - path::{Path, PathBuf}, - sync::Arc, -}; +use std::any::TypeId; -use bevy::{ - ecs::{reflect::AppTypeRegistry, world::Mut}, - prelude::AppFunctionRegistry, - reflect::{ - func::DynamicFunction, OffsetAccess, ParsedPath, PartialReflect, ReflectFromReflect, - }, -}; use bevy_mod_scripting_core::{ bindings::{ function::{ - script_function::{AppScriptFunctionRegistry, CallerContext, DynamicScriptFunction}, + script_function::{AppScriptFunctionRegistry, DynamicScriptFunction}, CallScriptFunction, }, - pretty_print::{DisplayWithWorld, ReflectReferencePrinter}, - script_value::ScriptValue, - ReflectAllocator, ReflectRefIter, ReflectReference, ReflectionPathExt, TypeIdSource, - WorldCallbackAccess, WorldGuard, + pretty_print::DisplayWithWorld, + script_value::ScriptValue, ReflectReference, WorldGuard, }, - error::{InteropError, ScriptError, ScriptResult}, - reflection_extensions::{PartialReflectExt, TypeIdExtensions}, - Either, + error::InteropError, + reflection_extensions::TypeIdExtensions, }; use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; -use mlua::{Function, IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Value, Variadic}; +use mlua::{Function, IntoLua, Lua, MetaMethod, UserData, UserDataMethods, Variadic}; use super::{ // proxy::{LuaProxied, LuaValProxy}, script_value::LuaScriptValue, world::GetWorld, }; -use crate::bindings::{script_value::lua_caller_context, world::LuaWorld}; +use crate::bindings::script_value::lua_caller_context; /// Lua UserData wrapper for [`bevy_mod_scripting_core::bindings::ReflectReference`]. /// Acts as a lua reflection interface. Any value which is registered in the type registry can be interacted with using this type. diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs index 854f0d3243..946710bc27 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/script_value.rs @@ -6,9 +6,8 @@ use std::{ use bevy_mod_scripting_core::bindings::{ function::{script_function::CallerContext, CallScriptFunction}, script_value::ScriptValue, - ReflectBase, ReflectReference, }; -use mlua::{FromLua, IntoLua, IntoLuaMulti, MultiValue, Value, Variadic}; +use mlua::{FromLua, IntoLua, Value, Variadic}; use super::{reference::LuaReflectReference, world::GetWorld}; diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 8cfcf2d58d..5969b80d7a 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -1,18 +1,11 @@ use std::sync::Arc; -use bevy::ecs::{component::ComponentId, reflect::AppTypeRegistry, world::Mut}; -use bevy::prelude::{AppFunctionRegistry, Entity, World}; use bevy_mod_scripting_core::bindings::WorldGuard; use bevy_mod_scripting_core::error::InteropError; -use bevy_mod_scripting_core::{ - bindings::{ReflectReference, ScriptTypeRegistration, WorldAccessGuard, WorldCallbackAccess}, - error::ScriptError, -}; -use bevy_mod_scripting_functions::namespaced_register::{GetNamespacedFunction, Namespace}; -use mlua::{MetaMethod, UserData, UserDataFields, UserDataMethods, Value, Variadic}; - -use super::script_value::LuaScriptValue; +use bevy_mod_scripting_core::bindings::{WorldAccessGuard, WorldCallbackAccess}; +use mlua::UserData; + #[derive(Clone, Debug, mlua::FromLua)] pub struct LuaWorld(pub WorldCallbackAccess); diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index b37a5150cf..99a02414f2 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -1,33 +1,24 @@ -pub mod util; use bevy::{ - app::{App, Plugin, Startup}, + app::{App, Plugin}, ecs::{entity::Entity, world::World}, - prelude::{AppTypeRegistry, Mut}, - reflect::{impl_reflect, FromType, GetTypeRegistration, PartialReflect, Reflect, TypePath}, }; use bevy_mod_scripting_core::{ - bindings::{ - script_value::ScriptValue, ReflectAllocator, ReflectReference, WorldCallbackAccess, - }, + bindings::{script_value::ScriptValue, WorldCallbackAccess}, context::{ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, error::ScriptError, - event::{CallbackLabel, IntoCallbackLabel}, - handler::Args, + event::CallbackLabel, reflection_extensions::PartialReflectExt, script::ScriptId, - systems::event_handler, AddContextInitializer, AddContextPreHandlingInitializer, IntoScriptPluginParams, ScriptingPlugin, }; use bindings::{ - // providers::bevy_ecs::LuaEntity, - // proxy::LuaProxied, reference::{LuaReflectReference, LuaStaticReflectReference}, script_value::LuaScriptValue, - world::{GetWorld, LuaWorld}, + world::GetWorld, }; pub use mlua; -use mlua::{Function, IntoLua, IntoLuaMulti, Lua, MultiValue}; +use mlua::{Function, IntoLua, Lua, MultiValue}; pub mod bindings; pub mod prelude { pub use crate::mlua::{self, prelude::*, Value}; diff --git a/crates/languages/bevy_mod_scripting_lua/src/util.rs b/crates/languages/bevy_mod_scripting_lua/src/util.rs deleted file mode 100644 index 9a1148ff34..0000000000 --- a/crates/languages/bevy_mod_scripting_lua/src/util.rs +++ /dev/null @@ -1,263 +0,0 @@ -use std::ops::{Deref, DerefMut}; - -// use tealr::{ -// mlu::mlua::{FromLua, FromLuaMulti, IntoLua, IntoLuaMulti}, -// ToTypename, -// }; - -/// generates path to the given script depending on build configuration. -/// (optimized builds don't have the teal compiler available) -/// -/// Current configuration will provide "scripts/*.tl" paths -/// ```rust -/// use bevy_mod_scripting_lua::lua_path; -/// assert_eq!("scripts/my_script.tl",lua_path!("my_script")) -/// ``` -#[cfg(all(feature = "teal", debug_assertions))] -#[macro_export] -macro_rules! lua_path { - ($v:literal) => { - concat!("scripts/", $v, ".tl") - }; -} - -/// generates path to the given script depending on build configuration. -/// (optimized builds don't have the teal compiler available) -/// -/// Current configuration will provide "scripts/build/*.lua" paths -/// ```rust -/// use bevy_mod_scripting::lua_path; -/// assert_eq!("scripts/build/my_script.lua",lua_path!("my_script")) -/// ``` -#[cfg(all(not(debug_assertions), feature = "teal"))] -#[macro_export] -macro_rules! lua_path { - ($v:literal) => { - concat!("scripts/build/", $v, ".lua") - }; -} - -/// generates path to the given script depending on build configuration. -/// (optimized builds don't have the teal compiler available) -/// -/// Current configuration will provide "/scripts/*.lua" paths -/// ```rust -/// use bevy_mod_scripting_lua::lua_path; -/// assert_eq!("scripts/my_script.lua",lua_path!("my_script")) -/// ``` -#[cfg(not(feature = "teal"))] -#[macro_export] -macro_rules! lua_path { - ($v:literal) => { - concat!("scripts/", $v, ".lua") - }; -} - -#[cfg(feature = "lua51")] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua51 { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(feature = "lua51"))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua51 { - ( $( $tok:tt )* ) => {}; -} - -#[cfg(feature = "lua52")] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua52 { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(feature = "lua52"))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua52 { - ( $( $tok:tt )* ) => {}; -} - -#[cfg(feature = "lua53")] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua53 { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(feature = "lua53"))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua53 { - ( $( $tok:tt )* ) => {}; -} - -#[cfg(feature = "lua54")] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua54 { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(feature = "lua54"))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_lua54 { - ( $( $tok:tt )* ) => {}; -} - -#[cfg(feature = "luajit")] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_luajit { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(feature = "luajit"))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_luajit { - ( $( $tok:tt )* ) => {}; -} - -#[cfg(feature = "luajit52")] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_luajit52 { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(feature = "luajit52"))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_luajit52 { - ( $( $tok:tt )* ) => {}; -} - -#[cfg(any( - feature = "lua52", - feature = "lua53", - feature = "lua54", - feature = "luajit52" -))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_any_lua52_lua53_lua54_luajit52 { - ( $( $tok:tt )* ) => { $( $tok )* } -} - -#[cfg(not(any( - feature = "lua52", - feature = "lua53", - feature = "lua54", - feature = "luajit52" -)))] -#[doc(hidden)] -#[macro_export] -macro_rules! __cfg_feature_any_lua52_lua53_lua54_luajit52 { - ( $( $tok:tt )* ) => {}; -} - -// #[macro_export] -// macro_rules! impl_userdata_from_lua { -// ($ty:ident) => { -// impl<'lua> ::tealr::mlu::mlua::FromLua<'lua> for $ty { -// fn from_lua( -// value: ::tealr::mlu::mlua::Value<'lua>, -// _lua: &::tealr::mlu::mlua::Lua, -// ) -> Result { -// match value { -// tealr::mlu::mlua::Value::UserData(ud) => { -// // for types which deref to something else we need to be explicit -// let self_ref: std::cell::Ref = ud.borrow::()?; -// let self_ref: &Self = std::ops::Deref::deref(&self_ref); -// Ok(self_ref.clone()) -// } -// _ => { -// return Err(::tealr::mlu::mlua::Error::FromLuaConversionError { -// from: value.type_name(), -// to: stringify!($ty), -// message: None, -// }) -// } -// } -// } -// } -// }; -// } - -// #[macro_export] -// macro_rules! impl_userdata_with_tealdata { -// ($ty:ident) => { -// impl ::tealr::mlu::mlua::UserData for $ty -// where -// Self: ::tealr::mlu::TealData, -// { -// fn add_methods<'lua, T: ::tealr::mlu::mlua::UserDataMethods<'lua, Self>>( -// methods: &mut T, -// ) { -// let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_methods(methods); -// ::add_methods(&mut wrapper); -// } - -// fn add_fields<'lua, T: ::tealr::mlu::mlua::UserDataFields<'lua, Self>>(fields: &mut T) { -// let mut wrapper = tealr::mlu::UserDataWrapper::from_user_data_fields(fields); -// ::add_fields(&mut wrapper); -// } -// } -// }; -// } - -// /// Variadic newtype with [`ToTypename`] implemantation -// pub struct Variadic(pub(crate) tealr::mlu::mlua::Variadic); - -// impl Variadic { -// pub fn new>(iter: I) -> Self { -// Variadic(tealr::mlu::mlua::Variadic::from_iter(iter.into_iter())) -// } -// } - -// impl Deref for Variadic { -// type Target = tealr::mlu::mlua::Variadic; - -// fn deref(&self) -> &Self::Target { -// &self.0 -// } -// } - -// impl DerefMut for Variadic { -// fn deref_mut(&mut self) -> &mut Self::Target { -// &mut self.0 -// } -// } - -// impl ToTypename for Variadic { -// fn to_typename() -> tealr::Type { -// let single_type = T::to_typename(); -// let collection_type = >::to_typename(); -// tealr::Type::Or(vec![single_type, collection_type]) -// } -// } - -// impl<'lua, T: FromLua<'lua>> FromLuaMulti<'lua> for Variadic { -// fn from_lua_multi( -// values: tealr::mlu::mlua::MultiValue<'lua>, -// lua: &'lua tealr::mlu::mlua::Lua, -// ) -> tealr::mlu::mlua::Result { -// Ok(Variadic(tealr::mlu::mlua::Variadic::from_lua_multi( -// values, lua, -// )?)) -// } -// } - -// impl<'lua, T: IntoLua<'lua>> IntoLuaMulti<'lua> for Variadic { -// fn into_lua_multi( -// self, -// lua: &'lua tealr::mlu::mlua::Lua, -// ) -> tealr::mlu::mlua::Result> { -// self.0.into_lua_multi(lua) -// } -// } diff --git a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs index 2fff84c2a3..f4f3238d61 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs @@ -4,14 +4,13 @@ use bevy::{ }; use bevy_mod_scripting_core::{ bindings::{script_value::ScriptValue, WorldCallbackAccess}, - context::{ContextAssigner, ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, + context::{ContextBuilder, ContextInitializer, ContextPreHandlingInitializer}, error::ScriptError, event::CallbackLabel, - handler::Args, script::ScriptId, IntoScriptPluginParams, ScriptingPlugin, }; -use rhai::{CallFnOptions, Engine, FnPtr, FuncArgs, Scope, AST}; +use rhai::{CallFnOptions, Engine, FnPtr, Scope, AST}; pub use rhai; pub mod prelude { From 7924df08bb41c16e8d021a2d6cedb92c8b4706bc Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:06:15 +0000 Subject: [PATCH 179/217] clippy fixes --- crates/bevy_mod_scripting_core/src/runtime.rs | 5 ++--- crates/bevy_mod_scripting_core/src/script.rs | 6 ++---- crates/bevy_mod_scripting_core/src/world.rs | 5 ++--- .../bevy_mod_scripting_rune/src/lib.rs | 19 ++++++++++--------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/runtime.rs b/crates/bevy_mod_scripting_core/src/runtime.rs index 0e10083346..8f0a6aa189 100644 --- a/crates/bevy_mod_scripting_core/src/runtime.rs +++ b/crates/bevy_mod_scripting_core/src/runtime.rs @@ -1,14 +1,13 @@ //! "Runtime" here refers to the execution evironment of scripts. This might be the VM executing bytecode or the interpreter executing source code. //! The important thing is that there is only one runtime which is used to execute all scripts of a particular type or `context`. -use bevy::ecs::system::Resource; - use crate::IntoScriptPluginParams; +use bevy::ecs::system::Resource; pub trait Runtime: 'static {} impl Runtime for T {} -pub type RuntimeInitializer = fn(&mut P::R); +pub type RuntimeInitializer

= fn(&mut

::R); #[derive(Resource)] pub struct RuntimeSettings { diff --git a/crates/bevy_mod_scripting_core/src/script.rs b/crates/bevy_mod_scripting_core/src/script.rs index 9817eb8bd1..0afcc20b26 100644 --- a/crates/bevy_mod_scripting_core/src/script.rs +++ b/crates/bevy_mod_scripting_core/src/script.rs @@ -1,10 +1,8 @@ //! Everything to do with the way scripts and their contexts are stored and handled. -use std::{borrow::Cow, collections::HashMap, ops::Deref}; - -use bevy::{asset::Handle, ecs::system::Resource, reflect::Reflect}; - use crate::{asset::ScriptAsset, context::ContextId}; +use bevy::{asset::Handle, ecs::system::Resource, reflect::Reflect}; +use std::{borrow::Cow, collections::HashMap, ops::Deref}; pub type ScriptId = Cow<'static, str>; diff --git a/crates/bevy_mod_scripting_core/src/world.rs b/crates/bevy_mod_scripting_core/src/world.rs index f16d38bfe9..2dee3cc48a 100644 --- a/crates/bevy_mod_scripting_core/src/world.rs +++ b/crates/bevy_mod_scripting_core/src/world.rs @@ -1,10 +1,9 @@ -use std::ops::Deref; -use std::sync::Arc; - use bevy::prelude::World; use parking_lot::{ MappedRwLockReadGuard, MappedRwLockWriteGuard, RwLock, RwLockReadGuard, RwLockWriteGuard, }; +use std::ops::Deref; +use std::sync::Arc; /// Pointer to a bevy world, safely allows multiple access via RwLock /// diff --git a/crates/languages/bevy_mod_scripting_rune/src/lib.rs b/crates/languages/bevy_mod_scripting_rune/src/lib.rs index 52397536fc..8603087847 100644 --- a/crates/languages/bevy_mod_scripting_rune/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rune/src/lib.rs @@ -27,15 +27,16 @@ pub struct RuneScriptingPlugin { impl Default for RuneScriptingPlugin { fn default() -> Self { - Self { - scripting_plugin: ScriptingPlugin { - runtime_builder: todo!(), - runtime_settings: todo!(), - callback_handler: todo!(), - context_builder: todo!(), - context_assigner: todo!(), - }, - } + todo!() + // Self { + // scripting_plugin: ScriptingPlugin { + // runtime_builder: todo!(), + // runtime_settings: todo!(), + // callback_handler: todo!(), + // context_builder: todo!(), + // context_assigner: todo!(), + // }, + // } } } From 6aab6f07078ed3a3c1bd6a70097d8d523d282ff4 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:07:11 +0000 Subject: [PATCH 180/217] clippy fixes --- .../src/namespaced_register.rs | 4 ++-- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 17 +++++------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs index 179c022efc..6a8ee66997 100644 --- a/crates/bevy_mod_scripting_functions/src/namespaced_register.rs +++ b/crates/bevy_mod_scripting_functions/src/namespaced_register.rs @@ -3,8 +3,8 @@ use bevy::{ reflect::GetTypeRegistration, }; use bevy_mod_scripting_core::bindings::function::script_function::{ - AppScriptFunctionRegistry, DynamicScriptFunction, GetFunctionTypeDependencies, - GetInnerTypeDependencies, ScriptFunction, ScriptFunctionRegistry, + AppScriptFunctionRegistry, DynamicScriptFunction, GetFunctionTypeDependencies, ScriptFunction, + ScriptFunctionRegistry, }; use std::{any::TypeId, borrow::Cow, marker::PhantomData}; diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 97c7078e6b..95a733697c 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -1,34 +1,27 @@ use bevy::{ app::App, - asset::{AssetPlugin, AssetServer}, - prelude::{AppTypeRegistry, Children, Entity, HierarchyPlugin, Parent, World}, + asset::AssetPlugin, + prelude::{Children, Entity, HierarchyPlugin, Parent, World}, reflect::{Reflect, TypeRegistration}, - MinimalPlugins, }; use bevy_mod_scripting_core::{ bindings::{ access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_value::ScriptValue, - ReflectAllocator, ReflectReference, ScriptTypeRegistration, WorldAccessGuard, - WorldCallbackAccess, + ScriptTypeRegistration, WorldAccessGuard, }, context::ContextLoadingSettings, error::ScriptError, event::CallbackLabel, - script::ScriptId, }; use bevy_mod_scripting_functions::ScriptFunctionsPlugin; use bevy_mod_scripting_lua::{ - bindings::{ - reference::LuaReflectReference, - world::{GetWorld, LuaWorld}, - }, + bindings::{reference::LuaReflectReference, world::GetWorld}, lua_context_load, lua_handler, - prelude::{Lua, LuaFunction, LuaHookTriggers}, + prelude::{Lua, LuaFunction}, LuaScriptingPlugin, }; use libtest_mimic::{Arguments, Failed, Trial}; use std::{ - any::TypeId, borrow::Cow, fs::{self, DirEntry}, io, panic, From c85c1c5f5a6357b75e2b27282e95b60dbeabad78 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:10:31 +0000 Subject: [PATCH 181/217] more clippy --- crates/bevy_mod_scripting_core/src/context.rs | 4 ++-- crates/languages/bevy_mod_scripting_lua/src/lib.rs | 2 +- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 14 ++------------ 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs index 9ca5188261..dffb70a046 100644 --- a/crates/bevy_mod_scripting_core/src/context.rs +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -59,10 +59,10 @@ impl ScriptContexts

{ /// Initializer run once after creating a context but before executing it for the first time pub type ContextInitializer

= - fn(&ScriptId, &mut

::C) -> Result<(), ScriptError>; + fn(&str, &mut

::C) -> Result<(), ScriptError>; /// Initializer run every time before executing or loading a script pub type ContextPreHandlingInitializer

= - fn(&ScriptId, Entity, &mut

::C) -> Result<(), ScriptError>; + fn(&str, Entity, &mut

::C) -> Result<(), ScriptError>; #[derive(Resource)] pub struct ContextLoadingSettings { diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 99a02414f2..891432538c 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -66,7 +66,7 @@ impl Plugin for LuaScriptingPlugin { .map_err(ScriptError::from_mlua_error)?; context .globals() - .set("script_id", script_id.clone()) + .set("script_id", script_id) .map_err(ScriptError::from_mlua_error)?; Ok(()) }, diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 95a733697c..66b981d29c 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -7,7 +7,7 @@ use bevy::{ use bevy_mod_scripting_core::{ bindings::{ access_map::ReflectAccessId, pretty_print::DisplayWithWorld, script_value::ScriptValue, - ScriptTypeRegistration, WorldAccessGuard, + ReflectReference, ScriptTypeRegistration, WorldAccessGuard, }, context::ContextLoadingSettings, error::ScriptError, @@ -22,7 +22,6 @@ use bevy_mod_scripting_lua::{ }; use libtest_mimic::{Arguments, Failed, Trial}; use std::{ - borrow::Cow, fs::{self, DirEntry}, io, panic, path::{Path, PathBuf}, @@ -53,7 +52,7 @@ fn init_app() -> App { app } -fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Result<(), ScriptError> { +fn init_lua_test_utils(_script_name: &str, lua: &mut Lua) -> Result<(), ScriptError> { let _get_mock_type = lua .create_function(|l, ()| { let world = l.get_world(); @@ -92,15 +91,6 @@ fn init_lua_test_utils(_script_name: &Cow<'static, str>, lua: &mut Lua) -> Resul .create_function(|lua, (f, regex): (LuaFunction, String)| { let world = lua.get_world(); - // let result = match std::panic::catch_unwind(|| ) { - // Ok(e) => e, - // Err(panic) => { - // return Err(mlua::Error::RuntimeError(format!( - // "Function panicked: {:?}", - // panic - // ))) - // } - // }; let result = f.call::<()>(()); let err = match result { Ok(_) => { From f811df5a92faf7cc056d4e22812aec58da1aeffe Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:11:15 +0000 Subject: [PATCH 182/217] fmt --- .../src/bindings/function/into.rs | 6 +- .../src/bindings/function/mod.rs | 1 - .../bevy_mod_scripting_functions/src/core.rs | 57 +++++++++---------- .../src/bindings/reference.rs | 3 +- .../src/bindings/world.rs | 4 +- 5 files changed, 32 insertions(+), 39 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index f7e090148c..b53fbde948 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -1,8 +1,4 @@ -use std::{ - borrow::Cow, - ffi::OsString, - path::PathBuf, -}; +use std::{borrow::Cow, ffi::OsString, path::PathBuf}; use bevy::reflect::PartialReflect; diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs index 3540443495..ae9f0f02b6 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/mod.rs @@ -1,4 +1,3 @@ - pub mod from; pub mod from_ref; pub mod into; diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 055927e028..705b031a32 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -1,24 +1,26 @@ //! Contains functions defined by the [`bevy_mod_scripting_core`] crate use crate::NamespaceBuilder; -use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; use bevy::{ prelude::*, - reflect::{ - func::FunctionRegistrationError, ParsedPath - }, + reflect::{func::FunctionRegistrationError, ParsedPath}, }; use bevy_mod_scripting_core::*; use bindings::{ - access_map::ReflectAccessId, function::{ + access_map::ReflectAccessId, + function::{ from::{Ref, Val}, from_ref::FromScriptRef, into_ref::IntoScriptRef, script_function::{CallerContext, ScriptFunctionMut}, - }, pretty_print::DisplayWithWorld, script_value::ScriptValue, ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, ScriptTypeRegistration, WorldCallbackAccess + }, + pretty_print::DisplayWithWorld, + script_value::ScriptValue, + ReflectReference, ReflectionPathExt, ScriptQueryBuilder, ScriptQueryResult, + ScriptTypeRegistration, WorldCallbackAccess, }; use error::InteropError; - +use reflection_extensions::{PartialReflectExt, TypeIdExtensions}; pub fn register_bevy_bindings(app: &mut App) { #[cfg(feature = "bevy_bindings")] @@ -134,19 +136,16 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat .register("has_entity", |s: WorldCallbackAccess, e: Val| { s.has_entity(*e) }) - .register( - "query", - || { - let query_builder = ScriptQueryBuilder::default(); - Ok(Val(query_builder)) - }, - ) + .register("query", || { + let query_builder = ScriptQueryBuilder::default(); + Ok(Val(query_builder)) + }) .register("exit", |s: WorldCallbackAccess| s.exit()) .register("log_all_allocations", |s: WorldCallbackAccess| { let world = s.try_read().expect("stale world"); let allocator = world.allocator(); let allocator = allocator.read(); - for (id,_) in allocator.iter_allocations() { + for (id, _) in allocator.iter_allocations() { let raid = ReflectAccessId::for_allocation(id.clone()); if world.claim_read_access(raid) { // Safety: ref released above @@ -154,9 +153,7 @@ pub fn register_world_functions(reg: &mut World) -> Result<(), FunctionRegistrat } else { panic!("Failed to claim read access for allocation id: {}", id.id()); } - } - }); Ok(()) } @@ -338,7 +335,6 @@ pub fn register_reflect_reference_functions( Ok(()) } - pub fn register_script_type_registration_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { @@ -360,11 +356,14 @@ pub fn register_script_query_builder_functions( registry: &mut World, ) -> Result<(), FunctionRegistrationError> { NamespaceBuilder::::new(registry) - .register("component", |s: Val, components: Val| { - let mut builder = s.into_inner(); - builder.component(components.into_inner()); - Val(builder) - }) + .register( + "component", + |s: Val, components: Val| { + let mut builder = s.into_inner(); + builder.component(components.into_inner()); + Val(builder) + }, + ) .register( "with", |s: Val, with: Val| { @@ -409,23 +408,23 @@ pub fn register_core_functions(app: &mut App) { // we don't exclude from compilation here, // since these are much smaller and still useful if not included initially // perhaps people might want to include some but not all of these - - #[cfg(feature="core_functions")] + + #[cfg(feature = "core_functions")] register_world_functions(world).expect("Failed to register world functions"); - #[cfg(feature="core_functions")] + #[cfg(feature = "core_functions")] register_reflect_reference_functions(world) .expect("Failed to register reflect reference functions"); - #[cfg(feature="core_functions")] + #[cfg(feature = "core_functions")] register_script_type_registration_functions(world) .expect("Failed to register script type registration functions"); - #[cfg(feature="core_functions")] + #[cfg(feature = "core_functions")] register_script_query_builder_functions(world) .expect("Failed to register script query builder functions"); - #[cfg(feature="core_functions")] + #[cfg(feature = "core_functions")] register_script_query_result_functions(world) .expect("Failed to register script query result functions"); } diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs index 62ca758252..8b26442240 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/reference.rs @@ -7,7 +7,8 @@ use bevy_mod_scripting_core::{ CallScriptFunction, }, pretty_print::DisplayWithWorld, - script_value::ScriptValue, ReflectReference, WorldGuard, + script_value::ScriptValue, + ReflectReference, WorldGuard, }, error::InteropError, reflection_extensions::TypeIdExtensions, diff --git a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs index 5969b80d7a..b04a900b2d 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/bindings/world.rs @@ -1,12 +1,10 @@ use std::sync::Arc; - use bevy_mod_scripting_core::bindings::WorldGuard; -use bevy_mod_scripting_core::error::InteropError; use bevy_mod_scripting_core::bindings::{WorldAccessGuard, WorldCallbackAccess}; +use bevy_mod_scripting_core::error::InteropError; use mlua::UserData; - #[derive(Clone, Debug, mlua::FromLua)] pub struct LuaWorld(pub WorldCallbackAccess); From 8190504300b0f235079fe8b5486e67282d757bf0 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:12:27 +0000 Subject: [PATCH 183/217] remove unnecessary examples --- Cargo.toml | 43 ------- examples/lua/bevy_api.rs | 94 -------------- examples/lua/console_integration.rs | 180 --------------------------- examples/lua/dynamic_queries.rs | 59 --------- examples/rhai/bevy_api.rs | 180 --------------------------- examples/rhai/console_integration.rs | 174 -------------------------- examples/rhai/dynamic_queries.rs | 63 ---------- examples/rune/event_recipients.rs | 119 ------------------ examples/rune/minimal.rs | 57 --------- 9 files changed, 969 deletions(-) delete mode 100644 examples/lua/bevy_api.rs delete mode 100644 examples/lua/console_integration.rs delete mode 100644 examples/lua/dynamic_queries.rs delete mode 100644 examples/rhai/bevy_api.rs delete mode 100644 examples/rhai/console_integration.rs delete mode 100644 examples/rhai/dynamic_queries.rs delete mode 100644 examples/rune/event_recipients.rs delete mode 100644 examples/rune/minimal.rs diff --git a/Cargo.toml b/Cargo.toml index de668a6e47..be00130b60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,27 +114,6 @@ debug = false inherits = "release" debug = true -[[example]] -name = "console_integration_lua" -path = "examples/lua/console_integration.rs" -required-features = ["lua54", "bevy/file_watcher", "bevy/multi_threaded"] - -[[example]] -name = "console_integration_rhai" -path = "examples/rhai/console_integration.rs" -required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] - - -[[example]] -name = "dynamic_queries_lua" -path = "examples/lua/dynamic_queries.rs" -required-features = ["lua54"] - -[[example]] -name = "dynamic_queries_rhai" -path = "examples/rhai/dynamic_queries.rs" -required-features = ["rhai"] - [[example]] name = "game_of_life_lua" path = "examples/lua/game_of_life.rs" @@ -144,25 +123,3 @@ required-features = ["lua54", "bevy/file_watcher", "bevy/multi_threaded"] required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] name = "game_of_life_rhai" path = "examples/rhai/game_of_life.rs" - - -[[example]] -name = "bevy_api_lua" -path = "examples/lua/bevy_api.rs" -required-features = ["lua54"] - -[[example]] -name = "bevy_api_rhai" -path = "examples/rhai/bevy_api.rs" -required-features = ["rhai"] - - -[[example]] -name = "minimal_rune" -path = "examples/rune/minimal.rs" -required-features = ["rune"] - -[[example]] -name = "event_recipients_rune" -path = "examples/rune/event_recipients.rs" -required-features = ["rune"] diff --git a/examples/lua/bevy_api.rs b/examples/lua/bevy_api.rs deleted file mode 100644 index 257e4e4aa1..0000000000 --- a/examples/lua/bevy_api.rs +++ /dev/null @@ -1,94 +0,0 @@ -use asset::ScriptAsset; -use bevy::app::AppExit; -use bevy::prelude::*; -use bevy::utils::hashbrown::HashMap; -use bevy_mod_scripting::lua::LuaScriptingPlugin; -use bevy_mod_scripting::{prelude::*, BevyFunctionsPlugin}; -use script::ScriptComponent; - -#[derive(Component, Default, Reflect)] -#[reflect(Component)] -pub struct MyComponent { - quat: Quat, - vec2: Vec2, - usize: usize, - f32: f32, - mat3: Mat3, - vec_of_usize: Vec, - vec_of_usize2: Vec, - map_of_strings: HashMap, - option_usize: Option, - option_vec3: Option, - vec_of_option_bools: Vec>, - option_vec_of_bools: Option>, -} - -const SCRIPT_NAME: &str = "scripts/bevy_api.lua"; - -fn load_script(server: Res, mut handle: Local>) { - let handle_ = server.load::(SCRIPT_NAME); - *handle = handle_; -} - -fn init_data(mut commands: Commands) { - commands.spawn(( - MyComponent { - usize: 5, - vec2: Vec2::new(1.0, 2.0), - f32: 6.7, - mat3: Mat3::from_cols( - Vec3::new(1.0, 2.0, 3.0), - Vec3::new(4.0, 5.0, 6.0), - Vec3::new(7.0, 8.0, 9.0), - ), - quat: Quat::from_xyzw(1.0, 2.0, 3.0, 4.0), - option_vec3: None, - vec_of_option_bools: vec![Some(true), None, Some(false)], - option_vec_of_bools: Some(vec![true, true, true]), - vec_of_usize: vec![1, 2, 3], - vec_of_usize2: vec![4, 5, 6], - map_of_strings: HashMap::from_iter(vec![("key".into(), "value".into())]), - option_usize: None, - }, - ScriptComponent::new(vec![SCRIPT_NAME.into()]), - )); -} - -struct EventCallbackLabel; -impl IntoCallbackLabel for EventCallbackLabel { - fn into_callback_label() -> CallbackLabel { - "on_event".into() - } -} - -pub fn send_event(mut writer: EventWriter>) { - writer.send(ScriptCallbackEvent::new_for_all( - EventCallbackLabel::into_callback_label(), - (), - )); -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.register_type::>(); - app.register_type_data::, ReflectFromReflect>(); - - app.add_plugins(DefaultPlugins) - .add_plugins(LuaScriptingPlugin::<()>::default()) - .add_plugins(BevyFunctionsPlugin) - // .add_plugins(LuaBevyScriptingPlugin) - .register_type::() - .add_systems(Startup, (init_data, load_script)) - .add_systems( - Update, - ( - send_event, - event_handler::.after(send_event), - ), - ); - - app.run(); - - Ok(()) -} diff --git a/examples/lua/console_integration.rs b/examples/lua/console_integration.rs deleted file mode 100644 index ca1711d25d..0000000000 --- a/examples/lua/console_integration.rs +++ /dev/null @@ -1,180 +0,0 @@ -use bevy::{ecs::event::Events, prelude::*}; -use bevy_console::{AddConsoleCommand, ConsoleCommand, ConsolePlugin, PrintConsoleLine}; -use bevy_mod_scripting::prelude::*; -use clap::Parser; - -use std::sync::Mutex; - -#[derive(Default)] -pub struct LuaAPIProvider; - -/// the custom Lua api, world is provided via a global pointer, -/// and callbacks are defined only once at script creation -impl APIProvider for LuaAPIProvider { - type APITarget = Mutex; - type DocTarget = LuaDocFragment; - type ScriptContext = Mutex; - - fn attach_api(&mut self, ctx: &mut Self::APITarget) -> Result<(), ScriptError> { - // callbacks can receive any `ToLuaMulti` arguments, here '()' and - // return any `FromLuaMulti` arguments, here a `usize` - // check the Rlua documentation for more details - - let ctx = ctx.get_mut().unwrap(); - - ctx.globals() - .set( - "print_to_console", - ctx.create_function(|ctx, msg: String| { - // retrieve the world pointer - let world = ctx.get_world()?; - let mut world = world.write(); - - let mut events: Mut> = - world.get_resource_mut().unwrap(); - events.send(PrintConsoleLine { line: msg }); - - // return something - Ok(()) - }) - .map_err(ScriptError::new_other)?, - ) - .map_err(ScriptError::new_other)?; - - Ok(()) - } - - fn setup_script( - &mut self, - _: &ScriptData, - _: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - Ok(()) - } -} - -/// sends updates to script host which are then handled by the scripts -/// in their designated system sets -pub fn trigger_on_update_lua(mut w: PriorityEventWriter>) { - let event = LuaEvent { - hook_name: "on_update".to_string(), - args: (), - recipients: Recipients::All, - }; - - w.send(event, 0); -} - -pub fn forward_script_err_to_console( - mut r: EventReader, - mut w: EventWriter, -) { - for e in r.read() { - w.send(PrintConsoleLine { - line: format!("ERROR:{}", e.error), - }); - } -} - -// we use bevy-debug-console to demonstrate how this can fit in in the runtime of a game -// note that using just the entity id instead of the full Entity has issues, -// but since we aren't despawning/spawning entities this works in our case -#[derive(Parser, ConsoleCommand)] -#[command(name = "run_script")] -///Runs a Lua script from the `assets/scripts` directory -pub struct RunScriptCmd { - /// the relative path to the script, e.g.: `/hello.lua` for a script located in `assets/scripts/hello.lua` - pub path: String, - - /// the entity id to attach this script to - pub entity: Option, -} - -pub fn run_script_cmd( - mut log: ConsoleCommand, - server: Res, - mut commands: Commands, - mut existing_scripts: Query<&mut ScriptCollection>, -) { - if let Some(Ok(RunScriptCmd { path, entity })) = log.take() { - let handle = server.load::(&format!("scripts/{}", &path)); - - match entity { - Some(e) => { - if let Ok(mut scripts) = existing_scripts.get_mut(Entity::from_raw(e)) { - info!("Creating script: scripts/{} {:?}", &path, e); - scripts.scripts.push(Script::::new(path, handle)); - } else { - log.reply_failed("Something went wrong".to_string()); - }; - } - None => { - info!("Creating script: scripts/{}", &path); - - commands.spawn(()).insert(ScriptCollection:: { - scripts: vec![Script::::new(path, handle)], - }); - } - }; - } -} - -pub fn delete_script_cmd( - mut log: ConsoleCommand, - mut scripts: Query<(Entity, &mut ScriptCollection)>, -) { - if let Some(Ok(DeleteScriptCmd { name, entity_id })) = log.take() { - for (e, mut s) in scripts.iter_mut() { - if e.index() == entity_id { - let old_len = s.scripts.len(); - s.scripts.retain(|s| s.name() != name); - - if old_len > s.scripts.len() { - log.reply_ok(format!("Deleted script {}, on entity: {}", name, entity_id)); - } else { - log.reply_failed(format!( - "Entity {} did own a script named: {}", - entity_id, name - )) - }; - return; - } - } - - log.reply_failed("Could not find given entity ID with a script") - } -} - -#[derive(Parser, ConsoleCommand)] -#[command(name = "delete_script")] -///Runs a Lua script from the `assets/scripts` directory -pub struct DeleteScriptCmd { - /// the name of the script - pub name: String, - - /// the entity the script is attached to - pub entity_id: u32, -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_plugins(ConsolePlugin) - // register bevy_console commands - .add_console_command::(run_script_cmd) - .add_console_command::(delete_script_cmd) - // choose and register the script hosts you want to use - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaAPIProvider)) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_script_handler::, 0, 0>(PostUpdate) - // add your systems - .add_systems(Update, trigger_on_update_lua) - .add_systems(Update, forward_script_err_to_console); - - info!("press '~' to open the console. Type in `run_script \"console_integration.lua\"` to run example script!"); - app.run(); - - Ok(()) -} diff --git a/examples/lua/dynamic_queries.rs b/examples/lua/dynamic_queries.rs deleted file mode 100644 index d2e89aac31..0000000000 --- a/examples/lua/dynamic_queries.rs +++ /dev/null @@ -1,59 +0,0 @@ -use asset::ScriptAsset; -use bevy::{core::FrameCount, prelude::*}; -use bevy_mod_scripting::prelude::*; -use bevy_mod_scripting_lua::{bindings::providers::LuaBevyScriptingPlugin, LuaScriptingPlugin}; -use script::ScriptComponent; - -#[derive(Component, Reflect)] -#[reflect(Component)] -pub struct ComponentA; - -#[derive(Component, Reflect)] -#[reflect(Component)] -pub struct ComponentB; - -#[derive(Component, Reflect)] -#[reflect(Component)] -pub struct ComponentC; - -fn load_script( - server: Res, - mut commands: Commands, - mut handle: Local>, -) { - let path = "scripts/dynamic_queries.lua"; - let handle_ = server.load::(path); - *handle = handle_; - - commands.spawn(ScriptComponent::new(vec![path.into()])); -} - -fn main() { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins); - app.add_plugins(LuaScriptingPlugin::<()>::default()); - app.add_plugins(LuaBevyScriptingPlugin) - .register_type::() - .register_type::() - .register_type::() - .add_systems(Startup, (setup, load_script)) - .run(); -} - -fn setup(mut commands: Commands) { - commands.spawn((ComponentA,)); - commands.spawn((ComponentA, ComponentB)); - commands.spawn((ComponentA, ComponentC)); - commands.spawn((ComponentA, ComponentB, ComponentC)); - - commands.spawn((ComponentB,)); - commands.spawn((ComponentB, ComponentC)); - commands.spawn((ComponentB, ComponentA)); - commands.spawn((ComponentB, ComponentA, ComponentC)); - - commands.spawn((ComponentC,)); - commands.spawn((ComponentC, ComponentA)); - commands.spawn((ComponentC, ComponentB)); - commands.spawn((ComponentC, ComponentA, ComponentB)); -} diff --git a/examples/rhai/bevy_api.rs b/examples/rhai/bevy_api.rs deleted file mode 100644 index 88dcc65cb4..0000000000 --- a/examples/rhai/bevy_api.rs +++ /dev/null @@ -1,180 +0,0 @@ -use bevy::app::AppExit; - -use bevy::prelude::*; -use bevy_mod_scripting::{api::rhai::bevy::RhaiBevyAPIProvider, prelude::*}; -use bevy_mod_scripting_rhai::rhai::Engine; -use bevy_script_api::rhai::{std::RegisterVecType, RegisterForeignRhaiType}; - -#[derive(Component, Default, Reflect)] -#[reflect(Component)] -pub struct MyComponent { - quat: Quat, - vec2: Vec2, - usize: usize, - f32: f32, - mat3: Mat3, - option_vec3: Option, - vec_of_option_bools: Vec>, - option_vec_of_bools: Option>, -} - -pub struct MyAPIProvider; -// unlike mlua, rhai does not have the concept of generic types, all functionality is based around -// registering monomorphized functions, therefore we must register functions of generic types for every type we want -// to use them with, it's less convenient and is what the compiler would do anyway but hey it works! -impl APIProvider for MyAPIProvider { - type APITarget = Engine; - - type ScriptContext = RhaiContext; - - type DocTarget = RhaiDocFragment; - - fn attach_api(&mut self, api: &mut Self::APITarget) -> Result<(), ScriptError> { - api.set_max_expr_depths(999, 999); - api.register_vec_functions::>(); - api.register_vec_functions::(); - Ok(()) - } -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .register_type::() - .register_foreign_rhai_type::>() - .register_foreign_rhai_type::>>() - .register_foreign_rhai_type::>>() - // note the implementation for Option is there, but we must register `LuaProxyable` for it - // this system set handles addition and removal of script contexts, we can safely use `CoreSet::PostUpdate` - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(RhaiBevyAPIProvider)) - .add_api_provider::>(Box::new(MyAPIProvider)) - .add_systems(Update, |world: &mut World| { - let entity = world - .spawn(()) - .insert(MyComponent { - usize: 5, - vec2: Vec2::new(1.0, 2.0), - f32: 6.7, - mat3: Mat3::from_cols( - Vec3::new(1.0, 2.0, 3.0), - Vec3::new(4.0, 5.0, 6.0), - Vec3::new(7.0, 8.0, 9.0), - ), - quat: Quat::from_xyzw(1.0, 2.0, 3.0, 4.0), - option_vec3: Some(Vec3::new(1.0, 2.0, 3.0)), - vec_of_option_bools: vec![Some(true), None, Some(false)], - option_vec_of_bools: Some(vec![true, true, true]), - }) - .id(); - - // run script - world.resource_scope(|world, mut host: Mut>| { - host.run_one_shot( - r#" - fn once() { - print(world); - debug(world.get_children(entity)); - - // we first retrieve ID's for our component and resource by their short name (long name/full path also work) - let my_component_type = world.get_type_by_name("MyComponent"); - - // then ask the world to give us a reference to `MyComponent` on the entity we just spawned - // resources work the same way, but we use `get_resource` instead of `get_component` - // the comp object is resolved to a `bevy_script_api::script_ref::ReflectValue`. - // we can use a custom proxy instead (by implementing RhaiProxyable), but this is the simplest way to get started. - let comp = world.get_component(entity,my_component_type); - - print("Before script: " + comp); - - print("============="); - - comp.usize = 2; - print("comp.usize: after assigning to 2: " + comp.usize); - - // not supported yet (no Bevy proxies yet) - // print("comp.option_vec3 before: " + comp.option_vec3); - // comp.option_vec3 = Vec3::new(2,1,3); - // print("comp.option_vec3 after: " + comp.option_vec3); - - // print("comp.option_vec3[0] before: " + comp.option_vec3[0]); - // comp.option_vec3[1] = 5; - // print("comp.option_vec3[0] after: " + comp.option_vec3[0]); - - print("============="); - - print("comp.vec_of_option_bools before: " + comp.vec_of_option_bools); - comp.vec_of_option_bools = [true,false,true]; - print("comp.vec_of_option_bools after: " + comp.vec_of_option_bools); - - print("comp.vec_of_option_bools[0] before: " + comp.vec_of_option_bools[0]); - comp.vec_of_option_bools[0] = false; - print("comp.vec_of_option_bools[0] after: " + comp.vec_of_option_bools[0]); - - print("comp.vec_of_option_bools before insert: " + comp.vec_of_option_bools); - comp.vec_of_option_bools.insert(1,()); - print("comp.vec_of_option_bools after insert: " + comp.vec_of_option_bools); - - print("comp.vec_of_option_bools before push: " + comp.vec_of_option_bools); - comp.vec_of_option_bools.push(false); - print("comp.vec_of_option_bools after push: " + comp.vec_of_option_bools); - - print("comp.vec_of_option_bools len after push: " + comp.vec_of_option_bools.len()); - - print("comp.vec_of_option_bools before pop: " + comp.vec_of_option_bools); - print(comp.vec_of_option_bools.pop()); - print("comp.vec_of_option_bools after pop: " + comp.vec_of_option_bools); - - print("the elements inside comp.vec_of_option_bools: "); - for e in comp.vec_of_option_bools { - print(`elem: ${e}`); - } - - comp.vec_of_option_bools.clear(); - print("comp.vec_of_option_bools after clear: " + comp.vec_of_option_bools); - print("comp.vec_of_option_bools len after clear: " + comp.vec_of_option_bools.len()); - - print("============="); - - print("comp.option_vec_of_bools before: " + comp.option_vec_of_bools); - print(comp.option_vec_of_bools.pop()); - print("comp.option_vec_of_bools after pop: " + comp.option_vec_of_bools); - - print("comp.option_vec_of_bools len after pop: " + comp.option_vec_of_bools.len()); - - print("the elements inside comp.option_vec_of_bools: "); - for e in comp.option_vec_of_bools { - print(`elem: ${e}`); - } - - print("============="); - - - let comp_after = world.get_component(entity, my_component_type); - print("after script:"); - print(comp_after); - - } - "# - .as_bytes(), - "script.rhai", - entity, - world, - RhaiEvent { - hook_name: "once".to_owned(), - args: (), - recipients: Recipients::All, - }, - ) - .expect("Something went wrong in the script!"); - }); - - world.send_event(AppExit::Success); - }); - - app.run(); - - Ok(()) -} diff --git a/examples/rhai/console_integration.rs b/examples/rhai/console_integration.rs deleted file mode 100644 index caeef23930..0000000000 --- a/examples/rhai/console_integration.rs +++ /dev/null @@ -1,174 +0,0 @@ -use bevy::{ecs::event::Events, prelude::*}; -use bevy_console::{AddConsoleCommand, ConsoleCommand, ConsolePlugin, PrintConsoleLine}; -use bevy_mod_scripting::prelude::*; -use bevy_script_api::common::bevy::ScriptWorld; -use clap::Parser; -/// custom Rhai API, world is provided as a usize (by the script this time), since -/// Rhai does not allow global/local variable access from a callback -#[derive(Default)] -pub struct RhaiAPI; - -impl APIProvider for RhaiAPI { - type APITarget = Engine; - type DocTarget = RhaiDocFragment; - type ScriptContext = RhaiContext; - - fn attach_api(&mut self, engine: &mut Self::APITarget) -> Result<(), ScriptError> { - // rhai allows us to decouple the api from the script context, - // so here we do not have access to the script scope, but the advantage is that - // this single engine is shared with all of our scripts. - // we can also set script wide settings here like this one for all our scripts. - - engine.set_max_expr_depths(0, 0); - - engine.register_fn( - "print_to_console", - |world: &mut ScriptWorld, msg: String| { - let mut world = world.write(); - - let mut events: Mut> = world.get_resource_mut().unwrap(); - events.send(PrintConsoleLine { line: msg }); - }, - ); - - engine.register_fn("entity_id", |entity: Entity| entity.index()); - - Ok(()) - } - - fn setup_script( - &mut self, - _: &ScriptData, - _: &mut Self::ScriptContext, - ) -> Result<(), ScriptError> { - Ok(()) - } -} - -// sends updates to script host which are then handled by the scripts -// in the designated system sets -pub fn trigger_on_update_rhai(mut w: PriorityEventWriter>) { - let event = RhaiEvent { - hook_name: "on_update".to_string(), - args: (), - recipients: Recipients::All, - }; - - w.send(event, 0); -} - -pub fn forward_script_err_to_console( - mut r: EventReader, - mut w: EventWriter, -) { - for e in r.read() { - w.send(PrintConsoleLine { - line: format!("ERROR:{}", e.error), - }); - } -} - -// we use bevy-debug-console to demonstrate how this can fit in in the runtime of a game -// note that using just the entity id instead of the full Entity has issues, -// but since we aren't despawning/spawning entities this works in our case -#[derive(Parser, ConsoleCommand)] -#[command(name = "run_script")] -///Runs a Lua script from the `assets/scripts` directory -pub struct RunScriptCmd { - /// the relative path to the script, e.g.: `/hello.lua` for a script located in `assets/scripts/hello.lua` - pub path: String, - - /// the entity id to attach this script to - pub entity: Option, -} - -pub fn run_script_cmd( - mut log: ConsoleCommand, - server: Res, - mut commands: Commands, - mut existing_scripts: Query<&mut ScriptCollection>, -) { - if let Some(Ok(RunScriptCmd { path, entity })) = log.take() { - let handle = server.load::(&format!("scripts/{}", &path)); - - match entity { - Some(e) => { - if let Ok(mut scripts) = existing_scripts.get_mut(Entity::from_raw(e)) { - info!("Creating script: scripts/{} {:?}", &path, e); - - scripts.scripts.push(Script::::new(path, handle)); - } else { - log.reply_failed("Something went wrong".to_string()); - }; - } - None => { - info!("Creating script: scripts/{}", &path); - - commands.spawn(()).insert(ScriptCollection:: { - scripts: vec![Script::::new(path, handle)], - }); - } - }; - } -} - -pub fn delete_script_cmd( - mut log: ConsoleCommand, - mut scripts: Query<(Entity, &mut ScriptCollection)>, -) { - if let Some(Ok(DeleteScriptCmd { name, entity_id })) = log.take() { - for (e, mut s) in scripts.iter_mut() { - if e.index() == entity_id { - let old_len = s.scripts.len(); - s.scripts.retain(|s| s.name() != name); - - if old_len > s.scripts.len() { - log.reply_ok(format!("Deleted script {}, on entity: {}", name, entity_id)); - } else { - log.reply_failed(format!( - "Entity {} did own a script named: {}", - entity_id, name - )) - }; - return; - } - } - - log.reply_failed("Could not find given entity ID with a script") - } -} - -#[derive(Parser, ConsoleCommand)] -#[command(name = "delete_script")] -///Runs a Lua script from the `assets/scripts` directory -pub struct DeleteScriptCmd { - ///the name of the script - pub name: String, - - ///the entity the script is attached to - pub entity_id: u32, -} - -fn main() -> std::io::Result<()> { - let mut app = App::new(); - app.add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_plugins(ConsolePlugin) - // register bevy_console commands - .add_console_command::(run_script_cmd) - .add_console_command::(delete_script_cmd) - // choose and register the script hosts you want to use - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(RhaiAPI)) - .add_api_provider::>(Box::new(RhaiBevyAPIProvider)) - .add_script_handler::, 0, 0>(PostUpdate) - // add your systems - .add_systems(Update, trigger_on_update_rhai) - .add_systems(Update, forward_script_err_to_console); - - info!("press '~' to open the console. Type in `run_script \"console_integration.rhai\"` to run example script!"); - - app.run(); - - Ok(()) -} diff --git a/examples/rhai/dynamic_queries.rs b/examples/rhai/dynamic_queries.rs deleted file mode 100644 index 887215d428..0000000000 --- a/examples/rhai/dynamic_queries.rs +++ /dev/null @@ -1,63 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; - -#[derive(Component, Reflect)] -#[reflect(Component)] -pub struct ComponentA; - -#[derive(Component, Reflect)] -#[reflect(Component)] -pub struct ComponentB; - -#[derive(Component, Reflect)] -#[reflect(Component)] -pub struct ComponentC; - -fn main() { - let mut app = App::new(); - - app.add_plugins((DefaultPlugins, ScriptingPlugin)) - .register_type::() - .register_type::() - .register_type::() - .add_script_host::>(PostUpdate) - .add_script_handler::, 0, 0>(PostUpdate) - .add_api_provider::>(Box::new(RhaiBevyAPIProvider)) - .add_systems(Startup, (setup, apply_deferred, run).chain()) - .run(); -} - -fn setup(mut commands: Commands, asset_server: Res) { - commands.spawn((ComponentA,)); - commands.spawn((ComponentA, ComponentB)); - commands.spawn((ComponentA, ComponentC)); - commands.spawn((ComponentA, ComponentB, ComponentC)); - - commands.spawn((ComponentB,)); - commands.spawn((ComponentB, ComponentC)); - commands.spawn((ComponentB, ComponentA)); - commands.spawn((ComponentB, ComponentA, ComponentC)); - - commands.spawn((ComponentC,)); - commands.spawn((ComponentC, ComponentA)); - commands.spawn((ComponentC, ComponentB)); - commands.spawn((ComponentC, ComponentA, ComponentB)); - - let path = "scripts/dynamic_queries.rhai"; - let handle = asset_server.load(path); - - commands.spawn(ScriptCollection:: { - scripts: vec![Script::new(path.into(), handle)], - }); -} - -fn run(mut events: PriorityEventWriter>) { - events.send( - RhaiEvent { - hook_name: "on_event".into(), - args: (), - recipients: Recipients::All, - }, - 0, - ); -} diff --git a/examples/rune/event_recipients.rs b/examples/rune/event_recipients.rs deleted file mode 100644 index 8b469edf1a..0000000000 --- a/examples/rune/event_recipients.rs +++ /dev/null @@ -1,119 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; -use rand::prelude::SliceRandom; -use std::sync::atomic::AtomicU32; -use std::sync::atomic::Ordering::Relaxed; - -#[derive(Clone)] -pub struct MyRuneArg(usize); - -impl Args for MyRuneArg { - fn into_stack(self, stack: &mut rune::runtime::Stack) -> rune::runtime::VmResult<()> { - (self.0,).into_stack(stack) - } - - fn try_into_vec(self) -> rune::runtime::VmResult> { - (self.0,).try_into_vec() - } - - fn count(&self) -> usize { - 1 - } -} - -/// A custom Rune API. -#[derive(Default)] -pub struct RuneAPIProvider; - -impl APIProvider for RuneAPIProvider { - type APITarget = Context; - type DocTarget = RuneDocFragment; - type ScriptContext = RuneScriptContext; - - fn attach_api(&mut self, ctx: &mut Self::APITarget) -> Result<(), ScriptError> { - let mut module = rune::Module::new(); - - module - .function("info", |msg: String| info!("{msg}")) - .build() - .map_err(ScriptError::new_other)?; - - ctx.install(module).map_err(ScriptError::new_other)?; - - Ok(()) - } -} - -static COUNTER: AtomicU32 = AtomicU32::new(0); - -/// Utility for generating random events from a list. -fn fire_random_event( - w: &mut PriorityEventWriter>, - events: &[ScriptEventData], -) { - let mut rng = rand::thread_rng(); - let id = COUNTER.fetch_add(1, Relaxed); - let arg = MyRuneArg(id as usize); - let event = events - .choose(&mut rng) - .map(|v| RuneEvent { - hook_name: v.0.to_string(), - args: arg, - recipients: v.1.clone(), - }) - .unwrap(); - - info!( - "\t - event: {},\t recipients: {:?},\t id: {}", - event.hook_name, event.recipients, id - ); - w.send(event, 0); -} - -fn do_update(mut w: PriorityEventWriter>) { - info!("Update, firing:"); - - let all_events = [ - ScriptEventData("on_event", Recipients::All), - ScriptEventData("on_event", Recipients::ScriptID(0)), - ScriptEventData("on_event", Recipients::ScriptID(1)), - ScriptEventData( - "on_event", - Recipients::ScriptName("scripts/event_recipients.rune".to_owned()), - ), - ]; - - // fire random event, for any of the system sets - fire_random_event(&mut w, &all_events); -} - -#[derive(Clone)] -pub struct ScriptEventData(&'static str, Recipients); - -fn load_scripts(server: Res, mut commands: Commands) { - // Spawn two identical scripts. - // Their id's will be 0 and 1. - let path = "scripts/event_recipients.rune"; - let handle = server.load::(path); - let scripts = (0..2) - .map(|_| Script::::new(path.to_string(), handle.clone())) - .collect(); - - commands - .spawn(()) - .insert(ScriptCollection:: { scripts }); -} - -fn main() { - App::new() - .add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_systems(Startup, load_scripts) - // Randomly fire events for either all scripts, the script with an id of `0`, - // or the script with an id of `1`. - .add_systems(Update, do_update) - .add_script_handler::, 0, 0>(PostUpdate) - .add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(RuneAPIProvider)) - .run(); -} diff --git a/examples/rune/minimal.rs b/examples/rune/minimal.rs deleted file mode 100644 index ff75fbc5eb..0000000000 --- a/examples/rune/minimal.rs +++ /dev/null @@ -1,57 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; - -fn main() { - App::new() - .add_plugins(DefaultPlugins) - .add_plugins(ScriptingPlugin) - .add_systems(Startup, setup) - .add_systems(Update, update) - .add_script_host::>(PostUpdate) - .add_script_handler::, 0, 1>(PostUpdate) - .add_api_provider::>(Box::new(MyAPIProvider)) - .run(); -} - -struct MyAPIProvider; - -impl APIProvider for MyAPIProvider { - type APITarget = Context; - type ScriptContext = RuneScriptContext; - type DocTarget = RuneDocFragment; - - fn attach_api(&mut self, api: &mut Self::APITarget) -> Result<(), ScriptError> { - let mut module = rune::Module::new(); - - module - .function("print_fancy", |msg: &str| println!("✨ {msg} ✨")) - .build() - .map_err(ScriptError::new_other)?; - - api.install(module).map_err(ScriptError::new_other)?; - - Ok(()) - } -} - -fn setup(mut commands: Commands, asset_server: Res) { - let script_path = "scripts/minimal.rune"; - - commands.spawn(ScriptCollection:: { - scripts: vec![Script::new( - script_path.to_owned(), - asset_server.load(script_path), - )], - }); -} - -fn update(mut events: PriorityEventWriter>) { - events.send( - RuneEvent { - hook_name: "on_event".into(), - args: (), - recipients: Recipients::All, - }, - 0, - ); -} From 3c96f449c898fd0a8b4f299710d9b7a50b6fa5b0 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:14:37 +0000 Subject: [PATCH 184/217] remove trailing whitespace --- crates/bevy_mod_scripting_functions/src/core.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_mod_scripting_functions/src/core.rs b/crates/bevy_mod_scripting_functions/src/core.rs index 705b031a32..15b160cb7d 100644 --- a/crates/bevy_mod_scripting_functions/src/core.rs +++ b/crates/bevy_mod_scripting_functions/src/core.rs @@ -240,7 +240,7 @@ pub fn register_reflect_reference_functions( .register("pop", |w: WorldCallbackAccess, s: ReflectReference| { let world = w.try_read().expect("stale world"); let o = s.with_reflect_mut(world.clone(), |s| s.try_pop_boxed())??; - let reference = { + let reference = { let allocator = world.allocator(); let mut allocator = allocator.write(); ReflectReference::new_allocated_boxed(o, &mut allocator) From e903e673254727f22a2953f4517d19253c5f6eee Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:22:01 +0000 Subject: [PATCH 185/217] remove doc gen for now --- .github/workflows/doc_gen.yml | 60 ----------------------------------- Cargo.toml | 7 ---- src/documentation/main.rs | 32 ------------------- 3 files changed, 99 deletions(-) delete mode 100644 .github/workflows/doc_gen.yml delete mode 100644 src/documentation/main.rs diff --git a/.github/workflows/doc_gen.yml b/.github/workflows/doc_gen.yml deleted file mode 100644 index ed7055970e..0000000000 --- a/.github/workflows/doc_gen.yml +++ /dev/null @@ -1,60 +0,0 @@ -on: - release: - types: [published] - workflow_dispatch: - inputs: - manual_tag: - description: 'release tag' - required: true - default: 'undefined' - type: string - -name: Documentation Generation - -jobs: - lua: - name: Lua Documentation - runs-on: ubuntu-latest - steps: - - name: Install alsa and udev - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - uses: Swatinem/rust-cache@v2.2.0 - - run: cargo install --git https://github.com/lenscas/tealr_doc_gen - - run: mkdir -p ./assets/scripts/doc/ - - run: cp tealr_doc_gen_config.json ./assets/scripts/doc/tealr_doc_gen_config.json - - run: sed -i "s//bevy_mod_scripting_lua\/${{github.event.release.tag_name || inputs.manual_tag}}\//" ./assets/scripts/doc/tealr_doc_gen_config.json - - uses: actions-rs/cargo@v1 - with: - command: run - args: --features=lua54 lua - - run: cat ./assets/scripts/doc/tealr_doc_gen_config.json - - name: Push to pages - uses: cpina/github-action-push-to-another-repository@main - env: - SSH_DEPLOY_KEY: ${{ secrets.LUA_DOCUMENTATION_SSH_KEY }} - with: - source-directory: './assets/scripts/doc/CoreBevyAPI/bevy_mod_scripting_lua/${{ github.event.release.tag_name || inputs.manual_tag }}' - destination-github-username: 'makspll' - destination-repository-name: 'bevy_mod_scripting_lua' - user-email: makspl17@gmail.com - target-branch: main - target-directory: ${{ github.event.release.tag_name || inputs.manual_tag }} - - name: Pushes to pages as latest - if: ${{ github.event.release.tag_name }} == '' - uses: cpina/github-action-push-to-another-repository@main - env: - SSH_DEPLOY_KEY: ${{ secrets.LUA_DOCUMENTATION_SSH_KEY }} - with: - source-directory: './assets/scripts/doc/CoreBevyAPI/bevy_mod_scripting_lua/${{ github.event.release.tag_name || inputs.manual_tag }}' - destination-github-username: 'makspll' - destination-repository-name: 'bevy_mod_scripting_lua' - user-email: makspl17@gmail.com - target-branch: main - target-directory: latest - diff --git a/Cargo.toml b/Cargo.toml index be00130b60..469c8e56c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,6 @@ categories = ["game-development"] readme = "readme.md" include = ["readme.md", "/src", "/examples", "/assets", "LICENSE"] -[[bin]] -name = "bevy_mod_scripting_doc_gen" -path = "src/documentation/main.rs" - [lib] name = "bevy_mod_scripting" path = "src/lib.rs" @@ -26,9 +22,6 @@ features = ["lua", "lua54", "rhai", "rune"] [features] default = ["core_functions", "bevy_bindings", "unsafe_lua_modules"] -## core -doc_always = ["bevy_mod_scripting_core/doc_always"] - ## lua lua = ["bevy_mod_scripting_lua"] # one of these must be selected diff --git a/src/documentation/main.rs b/src/documentation/main.rs deleted file mode 100644 index d7802bea16..0000000000 --- a/src/documentation/main.rs +++ /dev/null @@ -1,32 +0,0 @@ -use bevy::prelude::*; -use bevy_mod_scripting::prelude::*; -use std::env; - -fn main() { - let args: Vec = env::args().collect(); - let mut app = App::new(); - app.add_plugins(MinimalPlugins) - .add_plugins(ScriptingPlugin) - .add_plugins(AssetPlugin::default()); - - static INVALID_ARGUMENT_WARNING: &str = "Expected one of: 'lua','rhai' as arguments"; - - let lang = args.get(1).expect(INVALID_ARGUMENT_WARNING); - - match lang.as_str() { - "lua" => { - #[cfg(all(feature = "lua", feature = "lua_script_api"))] - app.add_script_host::>(PostUpdate) - .add_api_provider::>(Box::new(LuaCoreBevyAPIProvider)) - .add_api_provider::>(Box::new(LuaBevyAPIProvider)) - .update_documentation::>(); - - #[cfg(any(not(feature = "lua"), not(feature = "lua_script_api")))] - println!("Re-run with the following features enabled: `lua`,`lua_script_api`") - } - "rhai" => { - println!("Rhai documentation generation is not supported yet"); - } - _ => println!("{}", INVALID_ARGUMENT_WARNING), - } -} From aa34b7ebdf03e1ae4525a2972482db5ce8b717e9 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:38:22 +0000 Subject: [PATCH 186/217] remove unused dependencies --- Cargo.toml | 2 - crates/bevy_mod_scripting_common/CHANGELOG.md | 21 - crates/bevy_mod_scripting_common/Cargo.toml | 33 - crates/bevy_mod_scripting_common/readme.md | 3 - crates/bevy_mod_scripting_common/src/input.rs | 678 ------------------ crates/bevy_mod_scripting_common/src/lib.rs | 2 - crates/bevy_mod_scripting_common/src/utils.rs | 59 -- crates/bevy_mod_scripting_core/Cargo.toml | 1 - crates/bevy_mod_scripting_derive/Cargo.toml | 36 - crates/bevy_mod_scripting_derive/readme.md | 3 - crates/bevy_mod_scripting_derive/src/lib.rs | 1 - .../bevy_mod_scripting_lua/Cargo.toml | 2 - docs/book.toml | 4 +- release-plz.toml | 7 +- 14 files changed, 4 insertions(+), 848 deletions(-) delete mode 100644 crates/bevy_mod_scripting_common/CHANGELOG.md delete mode 100644 crates/bevy_mod_scripting_common/Cargo.toml delete mode 100644 crates/bevy_mod_scripting_common/readme.md delete mode 100644 crates/bevy_mod_scripting_common/src/input.rs delete mode 100644 crates/bevy_mod_scripting_common/src/lib.rs delete mode 100644 crates/bevy_mod_scripting_common/src/utils.rs delete mode 100644 crates/bevy_mod_scripting_derive/Cargo.toml delete mode 100644 crates/bevy_mod_scripting_derive/readme.md delete mode 100644 crates/bevy_mod_scripting_derive/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 469c8e56c2..7ba504583e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,6 @@ bevy_mod_scripting_functions = { workspace = true } [workspace.dependencies] bevy = { version = "0.15.0", default-features = false } bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.9.0-alpha.1" } -bevy_mod_scripting_common = { path = "crates/bevy_mod_scripting_common", version = "0.9.0-alpha.1" } bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1" } test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } @@ -81,7 +80,6 @@ members = [ "crates/languages/bevy_mod_scripting_lua", "crates/languages/bevy_mod_scripting_rhai", "crates/languages/bevy_mod_scripting_rune", - "crates/bevy_mod_scripting_common", "crates/test_utils", "crates/bevy_mod_scripting_functions", ] diff --git a/crates/bevy_mod_scripting_common/CHANGELOG.md b/crates/bevy_mod_scripting_common/CHANGELOG.md deleted file mode 100644 index 6b6f15881a..0000000000 --- a/crates/bevy_mod_scripting_common/CHANGELOG.md +++ /dev/null @@ -1,21 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [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 - -- Migrate to bevy 0.14 ([#127](https://github.com/makspll/bevy_mod_scripting/pull/127)) -- update metadata diff --git a/crates/bevy_mod_scripting_common/Cargo.toml b/crates/bevy_mod_scripting_common/Cargo.toml deleted file mode 100644 index 0adb317a98..0000000000 --- a/crates/bevy_mod_scripting_common/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "bevy_mod_scripting_common" -version = "0.9.0-alpha.1" -authors = ["Maksymilian Mozolewski "] -edition = "2021" -license = "MIT OR Apache-2.0" -description = "Traits and syn structures for language implementors" -repository = "https://github.com/makspll/bevy_mod_scripting" -homepage = "https://github.com/makspll/bevy_mod_scripting" -keywords = ["bevy", "gamedev", "scripting", "lua"] -categories = ["game-development"] -readme = "readme.md" - -[lib] -name = "bevy_mod_scripting_common" -path = "src/lib.rs" - -[dependencies] -darling = "0.20.3" -paste = "1.0.7" -syn = { version = "2.0.38", features = [ - "full", - "fold", - "extra-traits", - "visit-mut", -] } -quote = "1.0.8" -proc-macro2 = "1.0" -convert_case = "0.5.0" -serde = { version = "1.0", features = ["derive"] } -serde_derive = "1.0.137" -indexmap = { version = "1.9.1", features = ["serde"] } -strum = { version = "0.24.1", features = ["derive"] } diff --git a/crates/bevy_mod_scripting_common/readme.md b/crates/bevy_mod_scripting_common/readme.md deleted file mode 100644 index 674bf81c2c..0000000000 --- a/crates/bevy_mod_scripting_common/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# bevy_mod_scripting_common - -This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/bevy_mod_scripting_common/src/input.rs b/crates/bevy_mod_scripting_common/src/input.rs deleted file mode 100644 index 2547c91823..0000000000 --- a/crates/bevy_mod_scripting_common/src/input.rs +++ /dev/null @@ -1,678 +0,0 @@ -#![allow(clippy::manual_unwrap_or_default)] // from darling -use darling::{util::Flag, FromDeriveInput, FromMeta}; -use proc_macro2::Ident; -use quote::format_ident; -use std::{ - collections::HashMap, - ops::{Deref, DerefMut}, - str::FromStr, -}; -use strum::{Display, EnumString}; -use syn::{ - punctuated::Punctuated, - spanned::Spanned, - token::{And, Gt, Lt, Mut, PathSep}, - visit_mut::VisitMut, - AngleBracketedGenericArguments, Attribute, Error, Field, Fields, GenericArgument, PatType, - Path, PathArguments, PathSegment, Receiver, TraitItemFn, Type, TypePath, TypeReference, - TypeTuple, Variant, -}; - -use crate::utils::ident_to_type_path; - -/// Flags which detail required functionality or additional derivation requirements -#[derive(Debug, FromMeta, Default)] -pub struct ProxyFlags { - pub clone: Flag, -} - -/// Enumeration of commonly encountered Rust standard library type identifiers which can be effectively proxied in Lua, -/// These types are `container` types, which wrap other types rather than standalone and literal types. -#[derive(EnumString, Debug, Clone, Copy, Display, PartialEq, Eq)] -pub enum StdTypeIdent { - Option, - Result, - Vec, - Box, - Rc, - Arc, - Cow, - Cell, - RefCell, - Mutex, - RwLock, - Pin, -} - -/// Detailed information about the proxy, here we can access fields/variants etc. -#[derive(Debug)] -pub enum ProxyData { - Struct { fields: Fields }, -} - -/// For types of the form `Option` i.e. an outer identifier with a nested type inside angle brackets. -/// This type helps us destructure these patterns and unwrap/wrap proxies fully without dealing with the complicated full syn::Type enum -#[derive(Debug, Clone)] -pub struct UnitPath { - pub std_type_ident: Option, - pub ident: Ident, - pub colon2_token: Option, - pub lt_token: Lt, - pub gt_token: Gt, - pub inner: Box, -} - -/// For types of the form `Result` i.e. an outer identifier with two nested types inside angle brackets. -#[derive(Debug, Clone)] -pub struct DuoPath { - pub std_type_ident: Option, - pub ident: Ident, - pub colon2_token: Option, - pub lt_token: Lt, - pub gt_token: Gt, - pub left: Box, - pub right: Box, -} - -/// Represents a type prefixed with an outer reference, e.g. `&T` or `&mut T` -#[derive(Debug, Clone)] -pub struct Reference { - pub and_token: And, - pub mutability: Option, - pub inner: Box, -} - -/// Represents the identifier part of a type which doubles as a proxy type, e.g. `T` in `Option` -/// Stores both the proxied and proxy identifier i.e. `T` and `LuaT` -#[derive(Debug, Clone)] -pub struct ProxyType { - pub proxied_path: Path, - pub proxy_ident: Ident, -} - -/// Proxies can also be returned in "container" types, such as: -/// - Option -/// - Result -/// - Vec -/// - Tuple -/// -/// This type helps us destructure these patterns and unwrap/wrap proxies fully without dealing with the full syn::Type enum -#[derive(Debug, Clone)] -pub enum SimpleType { - /// The unit type `()` - Unit, - /// A type of the form `Option` - UnitPath(UnitPath), - /// A type of the form `Result` a list containing two elements is referred to as a - DuoPath(DuoPath), - - /// A type with an outer reference, e.g. `&T` or `&mut T` - Reference(Reference), - /// A type which doubles as a proxy type, e.g. `T` in `Option` - ProxyType(ProxyType), - /// A type which is not a proxy type, e.g. `i32`, required for composite types which can contain both proxy and non-proxy types - /// like tuples: `(i32, T)` - Type(syn::Type), -} - -impl SimpleType { - /// Constructs a new SimpleProxyType from a `syn::FnArg` using contextual resolution for receivers such as `Self` and `self` with the proxied type identifier given. - pub fn new_from_fn_arg( - proxy_prefix: &'static str, - arg: &syn::FnArg, - proxied_type_path: &Path, - proxied_to_proxy_ident_map: &HashMap>, - ) -> Result { - match arg { - syn::FnArg::Receiver(Receiver { - reference, - mutability, - .. - }) => match reference { - Some((and, ..)) => { - let mutability = mutability.as_ref().copied(); - let inner = Box::new(SimpleType::new_from_contextual_type( - proxy_prefix, - &Type::Path(TypePath { - qself: None, - path: proxied_type_path.clone(), - }), - proxied_type_path, - proxied_to_proxy_ident_map, - )?); - Ok(Self::Reference(Reference { - and_token: *and, - mutability, - inner, - })) - } - None => Self::new_from_contextual_type( - proxy_prefix, - &Type::Path(TypePath { - qself: None, - path: proxied_type_path.clone(), - }), - proxied_type_path, - proxied_to_proxy_ident_map, - ), - }, - syn::FnArg::Typed(PatType { ty, .. }) => Self::new_from_contextual_type( - proxy_prefix, - ty.as_ref(), - proxied_type_path, - proxied_to_proxy_ident_map, - ), - } - } - - /// Constructs a new SimpleProxyType from a `syn::Type`, contextual receivers such as `Self` and `self` will cause an error - /// to be returned. - pub fn new_from_fully_specified_type( - proxy_prefix: &'static str, - proxied_type: &Type, - proxied_to_proxy_ident_map: &HashMap>, - ) -> Result { - Self::new_from_type( - proxy_prefix, - proxied_type, - None, - proxied_to_proxy_ident_map, - false, - ) - } - - pub fn new_from_fully_specified_type_proxy_all( - proxy_prefix: &'static str, - proxied_type: &Type, - ) -> Result { - Self::new_from_type(proxy_prefix, proxied_type, None, &Default::default(), true) - } - - /// Constructs a new SimpleProxyType from a `syn::Type`, contextual receivers such as `Self` and `self` will be replaced - /// with the given identifier prefixed with the proxy_prefix - pub fn new_from_contextual_type( - proxy_prefix: &'static str, - proxied_type: &Type, - proxied_type_path: &Path, - proxied_to_proxy_ident_map: &HashMap>, - ) -> Result { - Self::new_from_type( - proxy_prefix, - proxied_type, - Some(proxied_type_path), - proxied_to_proxy_ident_map, - false, - ) - } - - /// Constructs a new SimpleProxyType from a `syn::Type`, contextual receivers such as `Self` and `self` will be replaced - /// with the given identifier prefixed with the proxy_prefix - /// All types will be proxied with the given proxy prefix - pub fn new_from_contextual_type_proxy_all( - proxy_prefix: &'static str, - proxied_type: &Type, - proxied_type_path: &Path, - ) -> Result { - Self::new_from_type( - proxy_prefix, - proxied_type, - Some(proxied_type_path), - &Default::default(), - true, - ) - } - - /// Builds a SimpleType::ProxyType or SimpleType::Type depending on the passed data, - /// - if the proxied type identifier has a Some value in the proxied_to_proxy_ident_map map then the proxy_ident will be set to the value in the map, - /// - if it has a None value it will be set to the proxied type identifier prefixed with the proxy_prefix, - /// - If it's not in the map it's built as a SimpleType::Type - fn new_proxied_type_or_type( - proxy_prefix: &'static str, - proxied_path: Path, - proxied_to_proxy_ident_map: &HashMap>, - proxy_prefix_all: bool, - ) -> SimpleType { - let last_segment = &proxied_path.segments.last().unwrap().ident; - let replacement_ident = proxied_to_proxy_ident_map.get(last_segment); - - if proxy_prefix_all || replacement_ident.is_some() { - let proxy_ident = replacement_ident - .cloned() - .flatten() - .unwrap_or_else(|| format_ident!("{proxy_prefix}{}", last_segment)); - - SimpleType::ProxyType(ProxyType { - proxied_path, - proxy_ident, - }) - } else { - Self::Type(syn::Type::Path(TypePath { - qself: None, - path: proxied_path.clone(), - })) - } - } - - /// Constructs a new SimpleProxyType from a `syn::Type`, if `proxied_type_identifier` is given then contextual - /// receivers such as `Self` and `self` will be replaced with the given identifier prefixed with the proxy_prefix, otherwise an error will be returned. - /// types with base identifiers not in the proxied_to_proxy_ident_map list are treated as non-proxy types and will be wrapped in a SimpleProxyType::Type. - /// If the proxy_prefix_all option is passed, the ident map will be ignored and EVERY type inside will be treated as a default proxy (prefixed with the proxy prefix as well) - fn new_from_type( - proxy_prefix: &'static str, - proxied_type: &Type, - proxied_type_path: Option<&Path>, - proxied_to_proxy_ident_map: &HashMap>, - proxy_prefix_all: bool, - ) -> Result { - match proxied_type { - Type::Path(p) if p.path.is_ident("self") || p.path.is_ident("Self") => { - let proxied_path: &Path = proxied_type_path.ok_or_else(|| { - Error::new_spanned( - proxied_type, - "Did not expect contextual receiver in constructing simple proxy type" - .to_owned(), - ) - })?; - Ok(Self::new_proxied_type_or_type( - proxy_prefix, - proxied_path.clone(), - proxied_to_proxy_ident_map, - proxy_prefix_all, - )) - } - Type::Path(p) if !p.path.segments.is_empty() => { - let last_segment = p.path.segments.last().unwrap(); - if last_segment.arguments.is_empty() { - return Ok(Self::new_proxied_type_or_type( - proxy_prefix, - p.path.clone(), - proxied_to_proxy_ident_map, - proxy_prefix_all, - )); - } else if let PathArguments::AngleBracketed(args) = &last_segment.arguments { - if args.args.len() == 1 { - if let GenericArgument::Type(arg_type) = args.args.first().unwrap() { - let inner = Box::new(Self::new_from_type( - proxy_prefix, - arg_type, - proxied_type_path, - proxied_to_proxy_ident_map, - proxy_prefix_all, - )?); - return Ok(SimpleType::UnitPath(UnitPath { - std_type_ident: StdTypeIdent::from_str( - &last_segment.ident.to_string(), - ) - .ok(), - ident: last_segment.ident.clone(), - colon2_token: args.colon2_token, - lt_token: args.lt_token, - gt_token: args.gt_token, - inner, - })); - } - } else if args.args.len() == 2 { - let mut args_iter = args.args.iter(); - if let (GenericArgument::Type(left), GenericArgument::Type(right)) = - (args_iter.next().unwrap(), args_iter.next().unwrap()) - { - let left = Box::new(Self::new_from_type( - proxy_prefix, - left, - proxied_type_path, - proxied_to_proxy_ident_map, - proxy_prefix_all, - )?); - let right = Box::new(Self::new_from_type( - proxy_prefix, - right, - proxied_type_path, - proxied_to_proxy_ident_map, - proxy_prefix_all, - )?); - return Ok(SimpleType::DuoPath(DuoPath { - std_type_ident: StdTypeIdent::from_str( - &last_segment.ident.to_string(), - ) - .ok(), - ident: last_segment.ident.clone(), - colon2_token: args.colon2_token, - lt_token: args.lt_token, - gt_token: args.gt_token, - left, - right, - })); - } - } - } - Err(Error::new_spanned( - proxied_type, - "Unsupported type".to_owned(), - )) - } - Type::Reference(tr) => Ok(SimpleType::Reference(Reference { - and_token: tr.and_token, - mutability: tr.mutability, - inner: Box::new(Self::new_from_type( - proxy_prefix, - &tr.elem, - proxied_type_path, - proxied_to_proxy_ident_map, - proxy_prefix_all, - )?), - })), - Type::Infer(_) => Ok(SimpleType::Type(proxied_type.clone())), - Type::Tuple(TypeTuple { elems, .. }) if elems.is_empty() => Ok(SimpleType::Unit), - t => Ok(SimpleType::Type(t.clone())), - } - } - - /// Returns true if the type has an outer reference, (e.g. `&Type`) - pub fn has_outer_ref(&self) -> bool { - matches!(self, SimpleType::Reference { .. }) - } - - pub fn has_outer_mut_ref(&self) -> bool { - matches!(self, SimpleType::Reference (Reference{ mutability, .. }) if mutability.is_some()) - } - - /// Returns true if the type has an inner reference, (e.g. `Type<&T>`) - pub fn has_ref(&self) -> bool { - match self { - SimpleType::Unit => false, - SimpleType::UnitPath(UnitPath { inner, .. }) => inner.has_ref(), - SimpleType::DuoPath(DuoPath { left, right, .. }) => left.has_ref() || right.has_ref(), - SimpleType::Reference(_) => true, - SimpleType::ProxyType(ProxyType { .. }) => false, - SimpleType::Type(_) => false, - } - } - - /// Returns true if the type has an inner proxy type - pub fn contains_proxy_type(&self) -> bool { - match self { - SimpleType::Unit => false, - SimpleType::UnitPath(UnitPath { inner, .. }) => inner.contains_proxy_type(), - SimpleType::DuoPath(DuoPath { left, right, .. }) => { - left.contains_proxy_type() || right.contains_proxy_type() - } - SimpleType::Reference(Reference { inner, .. }) => inner.contains_proxy_type(), - SimpleType::ProxyType(_) => true, - SimpleType::Type(_) => false, - } - } -} - -pub trait VisitSimpleType -where - T: std::fmt::Debug, -{ - fn visit(&mut self, simple_type: &SimpleType) -> T { - self.visit_simple_type(simple_type, false) - } - - fn visit_simple_type(&mut self, simple_type: &SimpleType, is_child_of_reference: bool) -> T { - match simple_type { - SimpleType::Unit => self.visit_unit(is_child_of_reference), - SimpleType::UnitPath(unit_path) => { - self.visit_unit_path(unit_path, is_child_of_reference) - } - SimpleType::DuoPath(duo_path) => self.visit_duo_path(duo_path, is_child_of_reference), - SimpleType::Reference(reference) => { - self.visit_reference(reference, is_child_of_reference) - } - SimpleType::ProxyType(proxy_type) => { - self.visit_proxy_type(proxy_type, is_child_of_reference) - } - SimpleType::Type(_type) => self.visit_type(_type, is_child_of_reference), - } - } - fn visit_unit_path(&mut self, unit_path: &UnitPath, _is_child_of_reference: bool) -> T { - self.visit_simple_type(&unit_path.inner, false) - } - - fn visit_duo_path(&mut self, duo_path: &DuoPath, _is_child_of_reference: bool) -> T { - self.visit_simple_type(&duo_path.left, false); - self.visit_simple_type(&duo_path.right, false) - } - - fn visit_reference(&mut self, reference: &Reference, _is_child_of_reference: bool) -> T { - self.visit_simple_type(&reference.inner, true) - } - fn visit_unit(&mut self, is_child_of_reference: bool) -> T; - fn visit_proxy_type(&mut self, proxy_type: &ProxyType, is_child_of_reference: bool) -> T; - fn visit_type(&mut self, _type: &Type, is_child_of_reference: bool) -> T; -} - -pub struct TypeConstructorVisitor { - /// if true then leaf proxies will be converted to their proxy type, otherwise they will be converted to their proxied type - pub generate_proxy_type: bool, - pub strip_outer_ref: bool, -} - -impl TypeConstructorVisitor { - pub fn new(generate_proxy_type: bool, strip_outer_ref: bool) -> Self { - Self { - generate_proxy_type, - strip_outer_ref, - } - } -} - -impl VisitSimpleType for TypeConstructorVisitor { - fn visit_unit(&mut self, _: bool) -> Type { - Type::Tuple(TypeTuple { - paren_token: Default::default(), - elems: Default::default(), - }) - } - - fn visit_unit_path(&mut self, unit_path: &UnitPath, _: bool) -> Type { - Type::Path(TypePath { - qself: None, - path: PathSegment { - ident: unit_path.ident.clone(), - arguments: PathArguments::AngleBracketed(AngleBracketedGenericArguments { - colon2_token: unit_path.colon2_token, - lt_token: unit_path.lt_token, - args: Punctuated::from_iter([GenericArgument::Type( - self.visit_simple_type(&unit_path.inner, false), - )]), - gt_token: unit_path.gt_token, - }), - } - .into(), - }) - } - - fn visit_duo_path(&mut self, duo_path: &DuoPath, _: bool) -> Type { - let left = self.visit_simple_type(&duo_path.left, false); - let right = self.visit_simple_type(&duo_path.right, false); - - Type::Path(TypePath { - qself: None, - path: PathSegment { - ident: duo_path.ident.clone(), - arguments: PathArguments::AngleBracketed(AngleBracketedGenericArguments { - colon2_token: duo_path.colon2_token, - lt_token: duo_path.lt_token, - args: Punctuated::from_iter([ - GenericArgument::Type(left), - GenericArgument::Type(right), - ]), - gt_token: duo_path.gt_token, - }), - } - .into(), - }) - } - - fn visit_proxy_type(&mut self, proxy_type: &ProxyType, _: bool) -> Type { - if self.generate_proxy_type { - Type::Path(ident_to_type_path(proxy_type.proxy_ident.clone())) - } else { - Type::Path(TypePath { - qself: None, - path: proxy_type.proxied_path.clone(), - }) - } - } - - fn visit_type(&mut self, _type: &Type, _: bool) -> Type { - _type.clone() - } - - fn visit_reference(&mut self, reference: &Reference, _: bool) -> Type { - if self.strip_outer_ref { - self.visit_simple_type(&reference.inner, false) - } else { - self.strip_outer_ref = false; - Type::Reference(TypeReference { - and_token: reference.and_token, - lifetime: None, - mutability: reference.mutability, - elem: Box::new(self.visit_simple_type(&reference.inner, true)), - }) - } - } -} - -#[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, - pub attrs: Vec, - - pub remote: Option, - /// The name to use for the proxy type, if not provided the language derive macro - /// will generate one using a standard prefix. - #[darling(rename = "name")] - pub proxy_name: Option, - - /// The body of the type for which we are generating a proxy - pub data: darling::ast::Data, - - /// Flags signifying which additional trait implementation should be generated on the proxy type - #[darling(default)] - pub derive: ProxyFlags, - - /// A list of multi-lang function definitions to be generated on the proxy type - #[darling(default)] - pub functions: TraitItemFnsWrapper, -} - -#[derive(Default)] -pub struct TraitItemFnsWrapper(pub Vec); - -impl FromMeta for TraitItemFnsWrapper { - fn from_string(value: &str) -> darling::Result { - let token_stream: proc_macro2::TokenStream = value.parse().map_err(syn::Error::from)?; - let trait_items_vec = vec![syn::parse2(token_stream)?]; - Ok(TraitItemFnsWrapper(trait_items_vec)) - } - - fn from_list(items: &[darling::ast::NestedMeta]) -> darling::Result { - Ok(TraitItemFnsWrapper( - items - .iter() - .map(Self::from_nested_meta) - .collect::, _>>()? - .into_iter() - .flat_map(|v| v.0.into_iter()) - .collect::>(), - )) - } -} - -impl Deref for TraitItemFnsWrapper { - type Target = Vec; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} -impl DerefMut for TraitItemFnsWrapper { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -/// Replaces every occurence of an identifier with -/// the given string while preserving the original span -pub struct IdentifierRenamingVisitor<'a> { - pub target: &'a str, - pub replacement: &'a str, -} - -impl VisitMut for IdentifierRenamingVisitor<'_> { - fn visit_ident_mut(&mut self, i: &mut Ident) { - if *i == self.target { - *i = Ident::new(self.replacement, i.span()); - } - } -} - -#[cfg(test)] -mod test { - use super::VisitSimpleType; - - struct TestVisitor; - impl VisitSimpleType for TestVisitor { - fn visit_unit(&mut self, is_child_of_reference: bool) -> bool { - is_child_of_reference - } - fn visit_proxy_type(&mut self, _: &super::ProxyType, is_child_of_reference: bool) -> bool { - is_child_of_reference - } - fn visit_type(&mut self, _: &syn::Type, is_child_of_reference: bool) -> bool { - is_child_of_reference - } - } - - #[test] - pub fn test_child_of_reference() { - let mut visitor = TestVisitor; - assert!(!visitor.visit(&super::SimpleType::Unit)); - assert!( - !visitor.visit(&super::SimpleType::ProxyType(super::ProxyType { - proxied_path: syn::Ident::new("T", proc_macro2::Span::call_site()).into(), - proxy_ident: syn::Ident::new("LuaT", proc_macro2::Span::call_site()), - })) - ); - assert!( - !visitor.visit(&super::SimpleType::Type(syn::Type::Path(syn::TypePath { - qself: None, - path: syn::Path::from(syn::Ident::new("T", proc_macro2::Span::call_site())), - }))) - ); - assert!( - visitor.visit(&super::SimpleType::Reference(super::Reference { - and_token: syn::Token![&](proc_macro2::Span::call_site()), - mutability: None, - inner: Box::new(super::SimpleType::Unit), - })) - ); - assert!( - visitor.visit(&super::SimpleType::Reference(super::Reference { - and_token: syn::Token![&](proc_macro2::Span::call_site()), - mutability: None, - inner: Box::new(super::SimpleType::ProxyType(super::ProxyType { - proxied_path: syn::Ident::new("T", proc_macro2::Span::call_site()).into(), - proxy_ident: syn::Ident::new("LuaT", proc_macro2::Span::call_site()), - })), - })) - ); - assert!( - visitor.visit(&super::SimpleType::Reference(super::Reference { - and_token: syn::Token![&](proc_macro2::Span::call_site()), - mutability: None, - inner: Box::new(super::SimpleType::Type(syn::Type::Path(syn::TypePath { - qself: None, - path: syn::Path::from(syn::Ident::new("T", proc_macro2::Span::call_site())), - }))), - })) - ); - } -} diff --git a/crates/bevy_mod_scripting_common/src/lib.rs b/crates/bevy_mod_scripting_common/src/lib.rs deleted file mode 100644 index 5d7b01f967..0000000000 --- a/crates/bevy_mod_scripting_common/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod input; -pub mod utils; diff --git a/crates/bevy_mod_scripting_common/src/utils.rs b/crates/bevy_mod_scripting_common/src/utils.rs deleted file mode 100644 index d8df6bb792..0000000000 --- a/crates/bevy_mod_scripting_common/src/utils.rs +++ /dev/null @@ -1,59 +0,0 @@ -use proc_macro2::{Ident, TokenStream}; -use quote::ToTokens; -use syn::{ - parse::{Parse, ParseStream}, - Attribute, Path, PathArguments, PathSegment, Type, TypePath, -}; - -pub fn doc_attribute_to_string_lit(attrs: &Attribute) -> Option { - attrs - .meta - .require_name_value() - .map(|v| v.value.to_token_stream()) - .ok() -} - -pub fn ident_to_type_path(ident: Ident) -> TypePath { - TypePath { - qself: None, - path: Path { - leading_colon: None, - segments: [PathSegment { - ident, - arguments: PathArguments::None, - }] - .into_iter() - .collect(), - }, - } -} -/// Converts the given ToTokens into token stream, stringifies it and removes whitespace -pub fn stringify_token_group(t: &T) -> String { - let mut k = t.into_token_stream().to_string(); - k.retain(|c| !c.is_whitespace()); - k -} - -/// Converts simple type to base string (i.e. one which has a single type identifier) -pub fn type_base_string(t: &Type) -> Option { - match t { - Type::Paren(v) => type_base_string(&v.elem), - Type::Path(p) => Some(p.path.segments.last()?.ident.to_string()), - Type::Ptr(p) => type_base_string(&p.elem), - Type::Reference(r) => type_base_string(&r.elem), - Type::Slice(v) => type_base_string(&v.elem), - _ => None, - } -} - -#[derive(Default, Debug, Clone)] -pub struct EmptyToken; - -impl Parse for EmptyToken { - fn parse(_: ParseStream) -> Result { - Ok(Self) - } -} -impl ToTokens for EmptyToken { - fn to_tokens(&self, _: &mut TokenStream) {} -} diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index c6981b2be7..1796f540f2 100644 --- a/crates/bevy_mod_scripting_core/Cargo.toml +++ b/crates/bevy_mod_scripting_core/Cargo.toml @@ -33,7 +33,6 @@ bevy = { workspace = true, default-features = false, features = [ ] } thiserror = "1.0.31" -paste = "1.0.7" parking_lot = "0.12.1" dashmap = "6" smallvec = "1.11" diff --git a/crates/bevy_mod_scripting_derive/Cargo.toml b/crates/bevy_mod_scripting_derive/Cargo.toml deleted file mode 100644 index 56257fb9ee..0000000000 --- a/crates/bevy_mod_scripting_derive/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "bevy_mod_scripting_derive" -version = "0.6.0" -authors = ["Maksymilian Mozolewski "] -edition = "2021" -license = "MIT OR Apache-2.0" -description = "Necessary functionality for Lua support with bevy_mod_scripting" -repository = "https://github.com/makspll/bevy_mod_scripting" -homepage = "https://github.com/makspll/bevy_mod_scripting" -keywords = ["bevy", "gamedev", "scripting", "rhai"] -categories = ["game-development"] -readme = "readme.md" - -[lib] -name = "bevy_mod_scripting_derive" -path = "src/lib.rs" -proc-macro = true - -[dependencies] -paste = "1.0.7" -darling = "0.20.3" -syn = { version = "2.0.38", features = [ - "full", - "fold", - "extra-traits", - "visit-mut", -] } -quote = "1.0.8" -proc-macro2 = "1.0" -convert_case = "0.5.0" -rustdoc-types = "0.11.0" -serde = { version = "1.0", features = ["derive"] } -serde_derive = "1.0.137" -indexmap = { version = "1.9.1", features = ["serde"] } -strum = { version = "0.24.1", features = ["derive"] } -vec1 = "1.10.1" diff --git a/crates/bevy_mod_scripting_derive/readme.md b/crates/bevy_mod_scripting_derive/readme.md deleted file mode 100644 index e058ed4f00..0000000000 --- a/crates/bevy_mod_scripting_derive/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# bevy_mod_scripting_lua_derive - -This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/bevy_mod_scripting_derive/src/lib.rs b/crates/bevy_mod_scripting_derive/src/lib.rs deleted file mode 100644 index 8b13789179..0000000000 --- a/crates/bevy_mod_scripting_derive/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 9d66ac5128..04f422bab3 100644 --- a/crates/languages/bevy_mod_scripting_lua/Cargo.toml +++ b/crates/languages/bevy_mod_scripting_lua/Cargo.toml @@ -42,8 +42,6 @@ bevy_mod_scripting_core = { workspace = true, features = ["mlua_impls"] } bevy_mod_scripting_functions = { workspace = true, features = [] } mlua = { workspace = true, features = ["vendored", "send", "macros"] } parking_lot = "0.12.1" -serde_json = "1.0.81" -anyhow = "1.0.75" uuid = "1.1" smol_str = "0.2.2" smallvec = "1.13" diff --git a/docs/book.toml b/docs/book.toml index 014c9adf2b..60a512579f 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -1,9 +1,11 @@ [book] -authors = ["makspll"] +authors = ["Maksymilian Mozolewski"] language = "en" multilingual = false src = "src" title = "Bevy Scripting" +description = "Documentation for the Bevy Scripting library" [output.html] additional-js = ["multi-code-block.js"] +git-repository-url = "https://github.com/makspll/bevy_mod_scripting" diff --git a/release-plz.toml b/release-plz.toml index 5a3d533ec7..3dfa498035 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -23,7 +23,6 @@ git_release_body = """ """ changelog_include = [ "bevy_mod_scripting_lua", - "bevy_mod_scripting_common", "bevy_mod_scripting_core", "bevy_mod_scripting_rhai", "bevy_mod_scripting_rune", @@ -36,10 +35,6 @@ name = "bevy_mod_scripting_lua" publish_features = ["lua54"] version_group = "main" -[[package]] -name = "bevy_mod_scripting_common" -version_group = "main" - [[package]] name = "bevy_mod_scripting_core" version_group = "main" @@ -58,4 +53,4 @@ version_group = "main" [[package]] name = "bevy_event_priority" -version_group = "main" \ No newline at end of file +version_group = "main" From bdf9bfdaaede1a7de825e2f40cc78cdd3e6f3f3c Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:38:46 +0000 Subject: [PATCH 187/217] exclude rhai example for now --- Cargo.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7ba504583e..0014a3ec76 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -110,7 +110,7 @@ name = "game_of_life_lua" path = "examples/lua/game_of_life.rs" required-features = ["lua54", "bevy/file_watcher", "bevy/multi_threaded"] -[[example]] -required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] -name = "game_of_life_rhai" -path = "examples/rhai/game_of_life.rs" +# [[example]] +# required-features = ["rhai", "bevy/file_watcher", "bevy/multi_threaded"] +# name = "game_of_life_rhai" +# path = "examples/rhai/game_of_life.rs" From 705c10b0d8c2a3a32707f05c4aa235a1a3316d90 Mon Sep 17 00:00:00 2001 From: makspll Date: Sat, 4 Jan 2025 23:57:19 +0000 Subject: [PATCH 188/217] remove preludes, remove more crates --- Cargo.toml | 1 - crates/bevy_event_priority/CHANGELOG.md | 26 -- crates/bevy_event_priority/Cargo.toml | 20 - crates/bevy_event_priority/readme.md | 3 - crates/bevy_event_priority/src/lib.rs | 412 ------------------ crates/bevy_mod_scripting_core/src/asset.rs | 2 +- .../src/bindings/function/from.rs | 2 +- .../src/bindings/function/from_ref.rs | 2 +- .../src/bindings/function/into.rs | 3 +- .../src/bindings/function/into_ref.rs | 2 +- .../src/bindings/function/script_function.rs | 2 +- .../src/bindings/reference.rs | 3 +- .../{script_value/mod.rs => script_value.rs} | 0 .../bevy_mod_scripting_core/src/commands.rs | 2 +- crates/bevy_mod_scripting_core/src/context.rs | 2 +- crates/bevy_mod_scripting_core/src/error.rs | 2 +- crates/bevy_mod_scripting_core/src/event.rs | 2 +- crates/bevy_mod_scripting_core/src/handler.rs | 7 +- crates/bevy_mod_scripting_core/src/lib.rs | 16 +- crates/bevy_mod_scripting_core/src/systems.rs | 7 +- .../bevy_mod_scripting_lua/src/lib.rs | 3 - .../bevy_mod_scripting_rhai/src/lib.rs | 4 - release-plz.toml | 5 - src/lib.rs | 13 - 24 files changed, 21 insertions(+), 520 deletions(-) delete mode 100644 crates/bevy_event_priority/CHANGELOG.md delete mode 100644 crates/bevy_event_priority/Cargo.toml delete mode 100644 crates/bevy_event_priority/readme.md delete mode 100644 crates/bevy_event_priority/src/lib.rs rename crates/bevy_mod_scripting_core/src/bindings/{script_value/mod.rs => script_value.rs} (100%) diff --git a/Cargo.toml b/Cargo.toml index 0014a3ec76..c7c9d9fb9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,6 @@ ansi-parser = "0.9" [workspace] members = [ "crates/bevy_mod_scripting_core", - "crates/bevy_event_priority", "crates/languages/bevy_mod_scripting_lua", "crates/languages/bevy_mod_scripting_rhai", "crates/languages/bevy_mod_scripting_rune", diff --git a/crates/bevy_event_priority/CHANGELOG.md b/crates/bevy_event_priority/CHANGELOG.md deleted file mode 100644 index bef6372140..0000000000 --- a/crates/bevy_event_priority/CHANGELOG.md +++ /dev/null @@ -1,26 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [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 - -- 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 - -- update metadata diff --git a/crates/bevy_event_priority/Cargo.toml b/crates/bevy_event_priority/Cargo.toml deleted file mode 100644 index eaabdb5e11..0000000000 --- a/crates/bevy_event_priority/Cargo.toml +++ /dev/null @@ -1,20 +0,0 @@ -[package] -name = "bevy_event_priority" -version = "0.9.0-alpha.1" -authors = ["Maksymilian Mozolewski "] -edition = "2021" -license = "MIT OR Apache-2.0" -description = "Bevy plugin providing priority based event handling" -repository = "https://github.com/makspll/bevy_mod_scripting" -homepage = "https://github.com/makspll/bevy_mod_scripting" -keywords = ["bevy", "gamedev", "scripting", "lua"] -categories = ["game-development"] -readme = "readme.md" - - -[lib] -name = "bevy_event_priority" -path = "src/lib.rs" - -[dependencies] -bevy = { workspace = true, default-features = false } diff --git a/crates/bevy_event_priority/readme.md b/crates/bevy_event_priority/readme.md deleted file mode 100644 index d29e475621..0000000000 --- a/crates/bevy_event_priority/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# bevy_event_priority - -This crate is a part of the ["bevy_mod_scripting" workspace](https://github.com/makspll/bevy_mod_scripting). \ No newline at end of file diff --git a/crates/bevy_event_priority/src/lib.rs b/crates/bevy_event_priority/src/lib.rs deleted file mode 100644 index 9dffb1bec9..0000000000 --- a/crates/bevy_event_priority/src/lib.rs +++ /dev/null @@ -1,412 +0,0 @@ -use bevy::ecs::system::SystemParam; -use bevy::prelude::*; -use std::marker::PhantomData; -use std::sync::atomic::Ordering::Relaxed; -use std::{collections::BinaryHeap, sync::atomic::AtomicU32}; - -pub trait PriorityEvent: Send + Sync + 'static {} -impl PriorityEvent for E {} - -#[derive(Debug)] -struct EventInstance { - prio: u32, - event_id: u32, - event: E, -} - -impl EventInstance { - fn new(event: E, prio: u32) -> Self { - static COUNTER: AtomicU32 = AtomicU32::new(0); - - Self { - prio, - event_id: COUNTER.fetch_add(1, Relaxed), - event, - } - } -} - -impl PartialEq for EventInstance { - fn eq(&self, other: &Self) -> bool { - self.prio == other.prio && self.event_id == other.event_id - } -} -impl Eq for EventInstance {} - -impl Ord for EventInstance { - fn cmp(&self, other: &Self) -> std::cmp::Ordering { - match self.prio.cmp(&other.prio) { - std::cmp::Ordering::Equal => self.event_id.cmp(&other.event_id), - v => v, - } - .reverse() - } -} -impl PartialOrd for EventInstance { - fn partial_cmp(&self, other: &Self) -> Option { - Some(self.cmp(other)) - } -} - -impl Clone for EventInstance { - fn clone(&self) -> Self { - Self { - prio: self.prio, - event_id: self.event_id, - event: self.event.clone(), - } - } -} - -/// An event priority queue. -/// Used when the ordering of events should be influenced by other factors. -/// This implementation does NOT provide double buffering. -/// Writers and readers are expected to remove events as soon as they are read, -/// this implies a one to one mapping between events and event handlers. -#[derive(Debug, Resource)] -pub struct PriorityEvents { - events: BinaryHeap>, -} - -impl Default for PriorityEvents { - fn default() -> Self { - Self { - events: BinaryHeap::new(), - } - } -} - -#[derive(SystemParam)] -pub struct PriorityEventReader<'w, 's, E: PriorityEvent> { - events: ResMut<'w, PriorityEvents>, - #[system_param(ignore)] - marker: PhantomData<&'s usize>, -} - -pub struct PriorityIterator<'w, E: PriorityEvent> { - min: u32, - max: u32, - events: &'w mut PriorityEvents, -} - -impl Iterator for PriorityIterator<'_, E> { - type Item = E; - - fn next(&mut self) -> Option { - while let Some(e) = self.events.events.peek() { - if e.prio > self.min { - return None; - } else if e.prio < self.max { - // discard events which should have already run - self.events.events.pop(); - } else { - break; - }; - } - - self.events.events.pop().map(|e| e.event) - } -} - -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 - /// i.e. will handle events in the priority range [min,max] (inclusive) - pub fn iter_prio_range(&mut self, max: u32, min: u32) -> impl Iterator + '_ { - PriorityIterator { - min, - max, - events: self.events.as_mut(), - } - } - - /// Determines the number of events available to be read, without consuming any - pub fn len(&self) -> usize { - self.events.events.len() - } - - /// Determines if there are any events to be read, without consuming any. - pub fn is_empty(&self) -> bool { - self.len() == 0 - } -} - -#[derive(SystemParam)] -pub struct PriorityEventWriter<'w, 's, E: PriorityEvent> { - events: ResMut<'w, PriorityEvents>, - - #[system_param(ignore)] - marker: PhantomData<&'s usize>, -} - -impl PriorityEventWriter<'_, '_, E> { - pub fn send(&mut self, event: E, prio: u32) { - self.events.events.push(EventInstance::new(event, prio)); - } - - pub fn send_batch(&mut self, events: impl Iterator, prio: u32) { - self.events - .events - .extend(events.map(|v| EventInstance::new(v, prio))) - } - - pub fn send_default(&mut self, prio: u32) - where - E: Default, - { - self.events - .events - .push(EventInstance::new(E::default(), prio)) - } -} - -/// a convenience for initialising prioritised event types -pub trait AddPriorityEvent { - fn add_priority_event(&mut self) -> &mut Self; -} - -impl AddPriorityEvent for App { - fn add_priority_event(&mut self) -> &mut Self { - self.init_resource::>(); - - self - } -} - -#[cfg(test)] -mod tests { - use bevy::{ecs::system::SystemState, prelude::World}; - - use super::*; - - #[derive(Copy, Clone, PartialEq, Eq, Debug)] - struct TestEvent(usize); - - fn collect_events(events: BinaryHeap>) -> Vec { - events - .into_sorted_vec() - .iter() - .map(|e| e.event) - .rev() - .collect() - } - - #[test] - fn test_events() { - let mut world = World::new(); - let mut state_writer: SystemState> = - SystemState::new(&mut world); - let mut state_reader: SystemState> = - SystemState::new(&mut world); - - world.init_resource::>(); - - // stage 1 - - { - let mut w = state_writer.get_mut(&mut world); - - // system writes three events, out of order - w.send(TestEvent(0), 5); - w.send(TestEvent(1), 1); - w.send(TestEvent(2), 0); - } - - // events are send and ordered in decreasing priority order - assert_eq!( - collect_events(world.resource::>().events.clone()), - vec![TestEvent(2), TestEvent(1), TestEvent(0)] - ); - - // stage 2 - - { - let mut w = state_reader.get_mut(&mut world); - - // system reads only top event - w.iter_prio_range(0, 0).for_each(drop); - } - - // first event is consumed immediately - assert_eq!( - collect_events(world.resource::>().events.clone()), - vec![TestEvent(1), TestEvent(0)] - ); - - // stage 3 - - { - let mut w = state_reader.get_mut(&mut world); - - // system reads all events - w.iter_prio_range(1, 5).for_each(drop); - } - - // first event is consumed immediately - assert_eq!( - collect_events(world.resource::>().events.clone()), - Vec::default() - ); - } - - #[test] - fn test_not_cleared_events() { - let mut world = World::new(); - let mut state_writer: SystemState> = - SystemState::new(&mut world); - let mut state_reader: SystemState> = - SystemState::new(&mut world); - - world.init_resource::>(); - - // two systems run at different frequencies, both serve non-overlapping priorities - - // stage 1 - // system sends events of lower priority than it serves - { - let mut w = state_writer.get_mut(&mut world); - - w.send(TestEvent(0), 1); - } - { - let mut w = state_reader.get_mut(&mut world); - - w.iter_prio_range(0, 0).for_each(drop); - } - - assert_eq!( - collect_events(world.resource::>().events.clone()), - vec![TestEvent(0)] - ); - - // stage 2 - // same system runs writes another of the same event - - { - let mut w = state_writer.get_mut(&mut world); - - w.send(TestEvent(0), 1); - } - { - let mut w = state_reader.get_mut(&mut world); - - w.iter_prio_range(0, 0).for_each(drop); - } - - assert_eq!( - collect_events(world.resource::>().events.clone()), - vec![TestEvent(0), TestEvent(0)] - ); - - // stage 3 - // this time another system runs clearing those events - { - let mut w = state_reader.get_mut(&mut world); - - w.iter_prio_range(1, 1).for_each(drop); - } - assert_eq!( - collect_events(world.resource::>().events.clone()), - Vec::default() - ); - } - - #[test] - fn test_higher_prio_destroyed() { - let mut world = World::new(); - let mut state_writer: SystemState> = - SystemState::new(&mut world); - let mut state_reader: SystemState> = - SystemState::new(&mut world); - - world.init_resource::>(); - - // two systems run at different frequencies, both serve non-overlapping priorities - - // stage 1 - // system sends events of higher priority than another serves - { - let mut w = state_writer.get_mut(&mut world); - - w.send(TestEvent(0), 0); - } - - // stage 2 - // system receives event of higher priority than it serves - { - let mut w = state_reader.get_mut(&mut world); - - // event is not read but discarded - assert_eq!( - w.iter_prio_range(1, 1).collect::>(), - Vec::default() - ); - } - - // the event is cleared - assert_eq!( - collect_events(world.resource::>().events.clone()), - vec![] - ); - } - - #[test] - fn test_prio_range() { - let mut world = World::new(); - let mut state_writer: SystemState> = - SystemState::new(&mut world); - let mut state_reader: SystemState> = - SystemState::new(&mut world); - - world.init_resource::>(); - - // two systems run at different frequencies, both serve non-overlapping priorities - - // stage 1 - // system sends events of various priorities - { - let mut w = state_writer.get_mut(&mut world); - - w.send(TestEvent(0), 0); - w.send(TestEvent(1), 1); - w.send(TestEvent(2), 2); - w.send(TestEvent(3), 3); - w.send(TestEvent(4), 4); - w.send(TestEvent(5), 5); - } - - // stage 2 - // multiple systems in order of priority remove them one by one - { - let mut w = state_reader.get_mut(&mut world); - - assert_eq!( - w.iter_prio_range(0, 1).collect::>(), - vec![TestEvent(0), TestEvent(1)] - ); - - assert_eq!( - w.iter_prio_range(2, 2).collect::>(), - vec![TestEvent(2)] - ); - - assert_eq!( - w.iter_prio_range(3, 3).collect::>(), - vec![TestEvent(3)] - ); - - // 4 is discarded - assert_eq!( - w.iter_prio_range(5, 5).collect::>(), - vec![TestEvent(5)] - ); - } - - // the events are all cleared - assert_eq!( - collect_events(world.resource::>().events.clone()), - vec![] - ); - } -} diff --git a/crates/bevy_mod_scripting_core/src/asset.rs b/crates/bevy_mod_scripting_core/src/asset.rs index 3240609be7..5fa3445efe 100644 --- a/crates/bevy_mod_scripting_core/src/asset.rs +++ b/crates/bevy_mod_scripting_core/src/asset.rs @@ -1,4 +1,4 @@ -use crate::{prelude::ScriptError, script::ScriptId}; +use crate::{error::ScriptError, script::ScriptId}; use bevy::{ asset::{Asset, AssetId, AssetLoader}, ecs::system::Resource, diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs index ea42e570c8..383e4569f5 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from.rs @@ -1,7 +1,7 @@ use crate::{ bindings::{access_map::ReflectAccessId, ReflectReference, WorldGuard}, error::InteropError, - prelude::ScriptValue, + ScriptValue, }; use bevy::reflect::{FromReflect, Reflect}; use std::{ diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs index d5b850ae5b..cdab793254 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/from_ref.rs @@ -6,8 +6,8 @@ use crate::{ bindings::{function::from::FromScript, WorldGuard}, error::InteropError, match_by_type, - prelude::ScriptValue, reflection_extensions::TypeInfoExtensions, + ScriptValue, }; /// Converts from a [`ScriptValue`] to a value equivalent to the given [`TypeId`]. diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs index b53fbde948..d5ab5145b2 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into.rs @@ -3,9 +3,8 @@ use std::{borrow::Cow, ffi::OsString, path::PathBuf}; use bevy::reflect::PartialReflect; use crate::{ - bindings::{ReflectReference, WorldGuard}, + bindings::{script_value::ScriptValue, ReflectReference, WorldGuard}, error::InteropError, - prelude::ScriptValue, self_type_dependency_only, }; diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs index b7192d5b12..f95bdb3b45 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/into_ref.rs @@ -5,8 +5,8 @@ use bevy::reflect::{ParsedPath, PartialReflect}; use crate::{ bindings::{function::into::IntoScript, ReflectReference, WorldGuard}, error::InteropError, - prelude::ScriptValue, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, + ScriptValue, }; /// Converts a value represented by a reference into a [`crate::bindings::function::ScriptValue`]. diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index 1acf27caf8..c2a3df85d0 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -5,7 +5,7 @@ use crate::{ ReflectReference, }, error::InteropError, - prelude::{ScriptValue, WorldCallbackAccess}, + ScriptValue, WorldCallbackAccess, }; use bevy::{ prelude::{Reflect, Resource}, diff --git a/crates/bevy_mod_scripting_core/src/bindings/reference.rs b/crates/bevy_mod_scripting_core/src/bindings/reference.rs index e71f93710c..92948b5ae5 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/reference.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/reference.rs @@ -8,9 +8,8 @@ use super::{access_map::ReflectAccessId, WorldGuard}; use crate::{ bindings::ReflectAllocationId, error::InteropError, - prelude::ReflectAllocator, reflection_extensions::{PartialReflectExt, TypeIdExtensions}, - with_access_read, with_access_write, + with_access_read, with_access_write, ReflectAllocator, }; use bevy::{ ecs::{ diff --git a/crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs b/crates/bevy_mod_scripting_core/src/bindings/script_value.rs similarity index 100% rename from crates/bevy_mod_scripting_core/src/bindings/script_value/mod.rs rename to crates/bevy_mod_scripting_core/src/bindings/script_value.rs diff --git a/crates/bevy_mod_scripting_core/src/commands.rs b/crates/bevy_mod_scripting_core/src/commands.rs index 5be92c9841..86d289d30e 100644 --- a/crates/bevy_mod_scripting_core/src/commands.rs +++ b/crates/bevy_mod_scripting_core/src/commands.rs @@ -3,7 +3,7 @@ use crate::{ context::{ContextLoadingSettings, ScriptContexts}, event::{IntoCallbackLabel, OnScriptLoaded, OnScriptUnloaded}, handler::CallbackSettings, - prelude::RuntimeContainer, + runtime::RuntimeContainer, script::{Script, ScriptId, Scripts}, systems::handle_script_errors, IntoScriptPluginParams, diff --git a/crates/bevy_mod_scripting_core/src/context.rs b/crates/bevy_mod_scripting_core/src/context.rs index dffb70a046..b548f62355 100644 --- a/crates/bevy_mod_scripting_core/src/context.rs +++ b/crates/bevy_mod_scripting_core/src/context.rs @@ -1,5 +1,5 @@ use crate::{ - prelude::ScriptError, + error::ScriptError, script::{Script, ScriptId}, IntoScriptPluginParams, }; diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index b6f7a3077b..d59c9012a5 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -2,10 +2,10 @@ use crate::{ bindings::{ access_map::DisplayCodeLocation, pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, + script_value::ScriptValue, ReflectBaseType, ReflectReference, }, impl_dummy_display, - prelude::ScriptValue, }; use bevy::{ ecs::component::ComponentId, diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index 53e2bcb4ab..541c62ffe8 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -1,4 +1,4 @@ -use crate::{error::ScriptError, prelude::ScriptValue, script::ScriptId}; +use crate::{bindings::script_value::ScriptValue, error::ScriptError, script::ScriptId}; use bevy::{ecs::entity::Entity, prelude::Event}; /// An error coming from a script diff --git a/crates/bevy_mod_scripting_core/src/handler.rs b/crates/bevy_mod_scripting_core/src/handler.rs index bc122bdf2d..fdc6784b09 100644 --- a/crates/bevy_mod_scripting_core/src/handler.rs +++ b/crates/bevy_mod_scripting_core/src/handler.rs @@ -1,9 +1,6 @@ use crate::{ - context::ContextPreHandlingInitializer, - event::CallbackLabel, - prelude::{ScriptError, ScriptValue}, - script::ScriptId, - IntoScriptPluginParams, + bindings::script_value::ScriptValue, context::ContextPreHandlingInitializer, + error::ScriptError, event::CallbackLabel, script::ScriptId, IntoScriptPluginParams, }; use bevy::ecs::{entity::Entity, system::Resource, world::World}; diff --git a/crates/bevy_mod_scripting_core/src/lib.rs b/crates/bevy_mod_scripting_core/src/lib.rs index e5aef4bd25..450913eb9b 100644 --- a/crates/bevy_mod_scripting_core/src/lib.rs +++ b/crates/bevy_mod_scripting_core/src/lib.rs @@ -12,16 +12,13 @@ use context::{ Context, ContextAssigner, ContextBuilder, ContextInitializer, ContextLoadingSettings, ContextPreHandlingInitializer, ScriptContexts, }; +use docs::{Documentation, DocumentationFragment}; +use event::ScriptCallbackEvent; use handler::{CallbackSettings, HandlerFn}; -pub use itertools::Either; -use prelude::{ - initialize_runtime, - runtime::{RuntimeInitializer, RuntimeSettings}, - sync_script_data, Documentation, DocumentationFragment, ScriptCallbackEvent, -}; -use runtime::{Runtime, RuntimeContainer}; + +use runtime::{Runtime, RuntimeContainer, RuntimeInitializer, RuntimeSettings}; use script::Scripts; -use systems::garbage_collector; +use systems::{garbage_collector, initialize_runtime, sync_script_data}; pub mod asset; pub mod bindings; @@ -36,9 +33,6 @@ pub mod runtime; pub mod script; pub mod systems; pub mod world; -pub mod prelude { - pub use {crate::docs::*, crate::error::*, crate::event::*, crate::systems::*, crate::*}; -} /// Types which act like scripting plugins, by selecting a context and runtime /// Each individual combination of context and runtime has specific infrastructure built for it and does not interact with other scripting plugins diff --git a/crates/bevy_mod_scripting_core/src/systems.rs b/crates/bevy_mod_scripting_core/src/systems.rs index 63892cb905..632a5ac8c2 100644 --- a/crates/bevy_mod_scripting_core/src/systems.rs +++ b/crates/bevy_mod_scripting_core/src/systems.rs @@ -1,13 +1,12 @@ use crate::{ asset::{AssetIdToScriptIdMap, ScriptAsset, ScriptAssetSettings}, - bindings::{pretty_print::DisplayWithWorld, WorldAccessGuard, WorldGuard}, + bindings::{pretty_print::DisplayWithWorld, AppReflectAllocator, WorldAccessGuard, WorldGuard}, commands::{CreateOrUpdateScript, DeleteScript}, context::{ContextLoadingSettings, ScriptContexts}, error::ScriptError, event::{IntoCallbackLabel, ScriptCallbackEvent, ScriptErrorEvent}, handler::CallbackSettings, - prelude::{AppReflectAllocator, RuntimeSettings}, - runtime::RuntimeContainer, + runtime::{RuntimeContainer, RuntimeSettings}, script::{ScriptComponent, Scripts}, IntoScriptPluginParams, }; @@ -241,9 +240,9 @@ mod test { use std::{borrow::Cow, collections::HashMap}; use crate::{ + bindings::script_value::ScriptValue, event::CallbackLabel, handler::HandlerFn, - prelude::ScriptValue, script::{Script, ScriptId}, }; diff --git a/crates/languages/bevy_mod_scripting_lua/src/lib.rs b/crates/languages/bevy_mod_scripting_lua/src/lib.rs index 891432538c..0b904cd7a2 100644 --- a/crates/languages/bevy_mod_scripting_lua/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_lua/src/lib.rs @@ -20,9 +20,6 @@ use bindings::{ pub use mlua; use mlua::{Function, IntoLua, Lua, MultiValue}; pub mod bindings; -pub mod prelude { - pub use crate::mlua::{self, prelude::*, Value}; -} impl IntoScriptPluginParams for LuaScriptingPlugin { type C = Lua; diff --git a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs index f4f3238d61..e507c4aa05 100644 --- a/crates/languages/bevy_mod_scripting_rhai/src/lib.rs +++ b/crates/languages/bevy_mod_scripting_rhai/src/lib.rs @@ -13,10 +13,6 @@ use bevy_mod_scripting_core::{ use rhai::{CallFnOptions, Engine, FnPtr, Scope, AST}; pub use rhai; -pub mod prelude { - pub use rhai; - pub use rhai::FuncArgs; -} pub type RhaiRuntime = Engine; diff --git a/release-plz.toml b/release-plz.toml index 3dfa498035..4e81f25eba 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -27,7 +27,6 @@ changelog_include = [ "bevy_mod_scripting_rhai", "bevy_mod_scripting_rune", "bevy_mod_scripting_functions", - "bevy_event_priority", ] [[package]] @@ -50,7 +49,3 @@ version_group = "main" [[package]] name = "bevy_mod_scripting_functions" version_group = "main" - -[[package]] -name = "bevy_event_priority" -version_group = "main" diff --git a/src/lib.rs b/src/lib.rs index 77a11261a1..6a00b7edd9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,17 +19,4 @@ pub mod rune { pub use bevy_mod_scripting_rune::*; } -pub mod prelude { - pub use bevy_mod_scripting_core::prelude::*; - - #[cfg(feature = "lua")] - pub use bevy_mod_scripting_lua::prelude::*; - - #[cfg(feature = "rhai")] - pub use bevy_mod_scripting_rhai::prelude::*; - - // #[cfg(feature = "rune")] - // pub use bevy_mod_scripting_rune::prelude::*; -} - pub use bevy_mod_scripting_functions::*; From 5ba4cb4ebd7ab77ca40302d0ffedf15b55e47576 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 00:02:37 +0000 Subject: [PATCH 189/217] further clean up --- crates/bevy_mod_scripting_core/src/event.rs | 4 ++-- .../bevy_mod_scripting_lua/tests/lua_tests.rs | 7 +++---- examples/lua/game_of_life.rs | 17 +++++------------ 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/event.rs b/crates/bevy_mod_scripting_core/src/event.rs index 541c62ffe8..c84af073df 100644 --- a/crates/bevy_mod_scripting_core/src/event.rs +++ b/crates/bevy_mod_scripting_core/src/event.rs @@ -55,8 +55,8 @@ macro_rules! callback_labels { $( pub struct $name; - impl IntoCallbackLabel for $name { - fn into_callback_label() -> CallbackLabel { + impl $crate::event::IntoCallbackLabel for $name { + fn into_callback_label() -> $crate::event::CallbackLabel { $label.into() } } diff --git a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs index 66b981d29c..356c56ba80 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs +++ b/crates/languages/bevy_mod_scripting_lua/tests/lua_tests.rs @@ -16,11 +16,10 @@ use bevy_mod_scripting_core::{ use bevy_mod_scripting_functions::ScriptFunctionsPlugin; use bevy_mod_scripting_lua::{ bindings::{reference::LuaReflectReference, world::GetWorld}, - lua_context_load, lua_handler, - prelude::{Lua, LuaFunction}, - LuaScriptingPlugin, + lua_context_load, lua_handler, LuaScriptingPlugin, }; use libtest_mimic::{Arguments, Failed, Trial}; +use mlua::{Function, Lua}; use std::{ fs::{self, DirEntry}, io, panic, @@ -88,7 +87,7 @@ fn init_lua_test_utils(_script_name: &str, lua: &mut Lua) -> Result<(), ScriptEr .unwrap(); let assert_throws = lua - .create_function(|lua, (f, regex): (LuaFunction, String)| { + .create_function(|lua, (f, regex): (Function, String)| { let world = lua.get_world(); let result = f.call::<()>(()); diff --git a/examples/lua/game_of_life.rs b/examples/lua/game_of_life.rs index 27aa2d8e91..0487a48a87 100644 --- a/examples/lua/game_of_life.rs +++ b/examples/lua/game_of_life.rs @@ -1,10 +1,6 @@ #![allow(deprecated)] -use std::sync::{Arc, Mutex}; -use ansi_parser::AnsiParser; -use asset::ScriptAsset; use bevy::{ - diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, image::ImageSampler, log::LogPlugin, prelude::*, @@ -15,17 +11,14 @@ use bevy::{ }, window::{PrimaryWindow, WindowResized}, }; - -use bevy_console::{ - make_layer, send_log_buffer_to_console, AddConsoleCommand, ConsoleCommand, - ConsoleConfiguration, ConsoleOpen, ConsolePlugin, PrintConsoleLine, +use bevy_console::{make_layer, AddConsoleCommand, ConsoleCommand, ConsoleOpen, ConsolePlugin}; +use bevy_mod_scripting::{NamespaceBuilder, ScriptFunctionsPlugin}; +use bevy_mod_scripting_core::{ + asset::ScriptAsset, bindings::script_value::ScriptValue, callback_labels, + event::ScriptCallbackEvent, script::ScriptComponent, systems::event_handler, }; -use bevy_mod_scripting::{prelude::*, NamespaceBuilder, ScriptFunctionsPlugin}; use bevy_mod_scripting_lua::LuaScriptingPlugin; -use bindings::script_value::ScriptValue; use clap::Parser; -use commands::DeleteScript; -use script::ScriptComponent; // CONSOLE SETUP From 1813cda4665623798ad91a8f2f8188fd0c2bb3d0 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 00:37:57 +0000 Subject: [PATCH 190/217] make display without world more sensible --- .../src/bindings/pretty_print.rs | 180 +++++++++------ crates/bevy_mod_scripting_core/src/error.rs | 215 +++++++++++++++--- .../src/reflection_extensions.rs | 15 -- 3 files changed, 298 insertions(+), 112 deletions(-) diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 50d239d75b..13ea1fd55f 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -66,49 +66,76 @@ impl ReflectReferencePrinter { Self { reference } } - fn pretty_print_base(base: &ReflectBaseType, world: WorldGuard, out: &mut String) { - let type_id = base.type_id; - let type_path = type_id.display_with_world(world.clone()); - - let base_kind = match base.base_id { - ReflectBase::Component(e, _) => format!("Component on entity {}", e), - ReflectBase::Resource(_) => "Resource".to_owned(), - ReflectBase::Owned(ref id) => format!("Allocation({})", id), - }; - - out.push_str(&format!("{}({})", base_kind, type_path)); - } - /// Given a reflect reference, prints the type path of the reference resolving the type names with short names. /// I.e. `MyType(Component).field_name[0].field_name[1] -> FieldType::Name` - pub fn pretty_print(&self, world: WorldGuard) -> String { + pub fn pretty_print(&self, world: Option) -> String { let mut pretty_path = String::new(); pretty_path.push_str(" {}", type_path)); + if let Some(tail_type_id) = tail_type_id { + let type_path = { + let type_registry = type_registry.read(); + type_registry + .get_type_info(tail_type_id) + .map(|t| t.type_path_table().short_path()) + .unwrap_or(Self::UNREGISTERED_TYPE) + }; + pretty_path.push_str(&format!(" -> {}", type_path)); + } + } else { + Self::pretty_print_base(&self.reference.base, None, &mut pretty_path); } - pretty_path.push('>'); - pretty_path } + /// Prints the actual value of the reference. Tries to use best available method to print the value. + pub fn pretty_print_value(&self, world: Option) -> String { + let mut output = String::new(); + + match world { + Some(world) => { + // instead of relying on type registrations, simply traverse the reflection tree and print sensible values + self.reference + .with_reflect(world, |r| { + self.pretty_print_value_inner(r, &mut output); + }) + .unwrap_or_else(|e| { + output.push_str(&format!("", e)); + }); + } + None => { + output.push_str(""); + } + } + + output + } + + fn pretty_print_base(base: &ReflectBaseType, world: Option, out: &mut String) { + let type_id = base.type_id; + let type_path = if let Some(world) = world { + type_id.display_with_world(world.clone()) + } else { + format!("{:?}", type_id) + }; + + let base_kind = match base.base_id { + ReflectBase::Component(e, _) => format!("Component on entity {}", e), + ReflectBase::Resource(_) => "Resource".to_owned(), + ReflectBase::Owned(ref id) => format!("Allocation({})", id), + }; + + out.push_str(&format!("{}({})", base_kind, type_path)); + } pub fn pretty_print_value_opaque(&self, v: &dyn PartialReflect, output: &mut String) { let type_id = v .get_represented_type_info() @@ -144,22 +171,6 @@ impl ReflectReferencePrinter { output.push(')'); } - /// Prints the actual value of the reference. Tries to use best available method to print the value. - pub fn pretty_print_value(&self, world: WorldGuard) -> String { - let mut output = String::new(); - - // instead of relying on type registrations, simply traverse the reflection tree and print sensible values - self.reference - .with_reflect(world, |r| { - self.pretty_print_value_inner(r, &mut output); - }) - .unwrap_or_else(|e| { - output.push_str(&format!("", e)); - }); - - output - } - fn pretty_print_key_values< K: AsRef, V: AsRef, @@ -302,13 +313,15 @@ impl ReflectReferencePrinter { } } -/// Alais for [`DisplayWithWorldAndDummy`] + [`std::fmt::Display`], ideally display should warn that it's not the full representation. -pub trait DisplayWithWorldAndDummy: DisplayWithWorld + std::fmt::Display {} -impl DisplayWithWorldAndDummy for T {} +// /// Alais for [`DisplayWithWorldAndDummy`] + [`std::fmt::Display`], ideally display should warn that it's not the full representation. +// pub trait DisplayWithWorldAndDummy: DisplayWithWorld + std::fmt::Display {} +// impl DisplayWithWorldAndDummy for T {} /// For types which can't be pretty printed without world access. /// Implementors should try to print the best value they can, and never panick. pub trait DisplayWithWorld: std::fmt::Debug { + fn display_without_world(&self) -> String; + /// Display the `shallowest` representation of the type using world access. /// For references this is the type path and the type of the value they are pointing to. fn display_with_world(&self, world: WorldGuard) -> String; @@ -320,42 +333,36 @@ pub trait DisplayWithWorld: std::fmt::Debug { } } -#[macro_export] -macro_rules! impl_dummy_display ( - ($t:ty) => { - impl std::fmt::Display for $t { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "", stringify!($t))?; - Ok(()) - } - } - }; -); - -impl_dummy_display!(ReflectReference); - impl DisplayWithWorld for ReflectReference { fn display_with_world(&self, world: WorldGuard) -> String { - ReflectReferencePrinter::new(self.clone()).pretty_print(world) + ReflectReferencePrinter::new(self.clone()).pretty_print(Some(world)) } fn display_value_with_world(&self, world: WorldGuard) -> String { - ReflectReferencePrinter::new(self.clone()).pretty_print_value(world) + ReflectReferencePrinter::new(self.clone()).pretty_print_value(Some(world)) } -} -impl_dummy_display!(ReflectBaseType); + fn display_without_world(&self) -> String { + ReflectReferencePrinter::new(self.clone()).pretty_print(None) + } +} impl DisplayWithWorld for ReflectBaseType { fn display_with_world(&self, world: WorldGuard) -> String { let mut string = String::new(); - ReflectReferencePrinter::pretty_print_base(self, world, &mut string); + ReflectReferencePrinter::pretty_print_base(self, Some(world), &mut string); string } fn display_value_with_world(&self, world: WorldGuard) -> String { self.display_with_world(world) } + + fn display_without_world(&self) -> String { + let mut string = String::new(); + ReflectReferencePrinter::pretty_print_base(self, None, &mut string); + string + } } impl DisplayWithWorld for TypeId { @@ -382,9 +389,11 @@ impl DisplayWithWorld for TypeId { fn display_value_with_world(&self, world: WorldGuard) -> String { self.display_with_world(world) } -} -impl_dummy_display!(ScriptValue); + fn display_without_world(&self) -> String { + format!("{:?}", self) + } +} impl DisplayWithWorld for ScriptValue { fn display_with_world(&self, world: WorldGuard) -> String { @@ -404,16 +413,32 @@ impl DisplayWithWorld for ScriptValue { ScriptValue::Float(f) => f.to_string(), ScriptValue::String(cow) => cow.to_string(), ScriptValue::Error(script_error) => script_error.display_with_world(world), + ScriptValue::List(vec) => vec.display_without_world(), + } + } + + fn display_without_world(&self) -> String { + match self { + ScriptValue::Unit => "()".to_owned(), + ScriptValue::Bool(b) => b.to_string(), + ScriptValue::Integer(i) => i.to_string(), + ScriptValue::Float(f) => f.to_string(), + ScriptValue::String(cow) => cow.to_string(), ScriptValue::List(vec) => { let mut string = String::new(); ReflectReferencePrinter::pretty_print_key_values( BracketType::Square, vec.iter() - .map(|v| (None::, v.display_value_with_world(world.clone()))), + .map(|v| (None::, v.display_without_world())), &mut string, ); string } + ScriptValue::Reference(reflect_reference) => reflect_reference.display_without_world(), + ScriptValue::Function(dynamic_script_function_mut) => { + format!("Function({})", dynamic_script_function_mut.name()) + } + ScriptValue::Error(interop_error) => interop_error.display_without_world(), } } } @@ -444,4 +469,17 @@ impl DisplayWithWorld for Vec { }); string } + + fn display_without_world(&self) -> String { + let mut string = String::new(); + BracketType::Square.surrounded(&mut string, |string| { + for (i, v) in self.iter().enumerate() { + string.push_str(&v.display_without_world()); + if i != self.len() - 1 { + string.push_str(", "); + } + } + }); + string + } } diff --git a/crates/bevy_mod_scripting_core/src/error.rs b/crates/bevy_mod_scripting_core/src/error.rs index d59c9012a5..e8902de562 100644 --- a/crates/bevy_mod_scripting_core/src/error.rs +++ b/crates/bevy_mod_scripting_core/src/error.rs @@ -1,11 +1,6 @@ -use crate::{ - bindings::{ - access_map::DisplayCodeLocation, - pretty_print::{DisplayWithWorld, DisplayWithWorldAndDummy}, - script_value::ScriptValue, - ReflectBaseType, ReflectReference, - }, - impl_dummy_display, +use crate::bindings::{ + access_map::DisplayCodeLocation, pretty_print::DisplayWithWorld, script_value::ScriptValue, + ReflectBaseType, ReflectReference, }; use bevy::{ ecs::component::ComponentId, @@ -48,7 +43,7 @@ pub struct ScriptErrorInner { #[derive(Debug, Clone)] pub enum ErrorKind { Display(Arc), - WithWorld(Arc), + WithWorld(Arc), } impl DisplayWithWorld for ErrorKind { @@ -58,14 +53,18 @@ impl DisplayWithWorld for ErrorKind { ErrorKind::WithWorld(e) => e.display_with_world(world), } } + + fn display_without_world(&self) -> String { + match self { + ErrorKind::Display(e) => e.to_string(), + ErrorKind::WithWorld(e) => e.display_without_world(), + } + } } impl Display for ErrorKind { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - ErrorKind::Display(e) => write!(f, "{}", e), - ErrorKind::WithWorld(e) => write!(f, "{}", e), - } + write!(f, "{}", self.display_without_world()) } } @@ -106,7 +105,7 @@ impl ScriptError { })) } - pub fn new(reason: impl DisplayWithWorldAndDummy + Send + Sync + 'static) -> Self { + pub fn new(reason: impl DisplayWithWorld + Send + Sync + 'static) -> Self { Self(Arc::new(ScriptErrorInner { script: None, reason: ErrorKind::WithWorld(Arc::new(reason)), @@ -133,15 +132,7 @@ impl ScriptError { impl std::fmt::Display for ScriptError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - if let Some(script) = &self.0.script { - write!( - f, - "error in script `{}`: {}.\nContext:{}", - script, self.0.reason, self.0.context - ) - } else { - write!(f, "error: {}.\nContext:{}", self.0.reason, self.0.context) - } + write!(f, "{}", self.display_without_world()) } } @@ -162,6 +153,17 @@ impl DisplayWithWorld for ScriptError { ) } } + + fn display_without_world(&self) -> String { + if let Some(script) = &self.0.script { + format!( + "error in script `{}`: {}.\nContext:{}", + script, self.0.reason, self.0.context, + ) + } else { + format!("error: {}.\nContext:{}", self.0.reason, self.0.context) + } + } } #[cfg(feature = "mlua_impls")] @@ -208,9 +210,17 @@ impl DisplayWithWorld for InteropError { fn display_with_world(&self, world: crate::bindings::WorldGuard) -> String { self.0.display_with_world(world) } + + fn display_without_world(&self) -> String { + self.0.display_without_world() + } } -impl_dummy_display!(InteropError); +impl Display for InteropError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.display_without_world()) + } +} impl From for ScriptError { fn from(val: InteropError) -> Self { @@ -438,8 +448,6 @@ impl InteropError { } } -impl_dummy_display!(InteropErrorInner); - /// For errors to do with reflection, type conversions or other interop issues #[derive(Debug)] pub enum InteropErrorInner { @@ -694,6 +702,161 @@ impl DisplayWithWorld for InteropErrorInner { }, } } + + // todo macro this + fn display_without_world(&self) -> String { + match self { + InteropErrorInner::MissingFunctionError { on, function_name } => { + format!( + "Could not find function: {} for type: {}", + function_name, + on.display_without_world() + ) + }, + InteropErrorInner::UnregisteredBase { base } => { + format!("Unregistered base type: {}", base.display_without_world()) + } + InteropErrorInner::CannotClaimAccess { base, location } => { + format!( + "Cannot claim access to base type: {}. The base is already claimed by something else in a way which prevents safe access. Location: {}", + base.display_without_world(), + location.display_location() + ) + } + InteropErrorInner::ImpossibleConversion { into } => { + format!("Cannot convert to type: {}", into.display_without_world()) + } + InteropErrorInner::TypeMismatch { expected, got } => { + format!( + "Type mismatch, expected: {}, got: {}", + expected.display_without_world(), + got.map(|t| t.display_without_world()) + .unwrap_or("None".to_owned()) + ) + } + InteropErrorInner::StringTypeMismatch { expected, got } => { + format!( + "Type mismatch, expected: {}, got: {}", + expected, + got.map(|t| t.display_without_world()) + .unwrap_or("None".to_owned()) + ) + } + InteropErrorInner::CouldNotDowncast { from, to } => { + format!( + "Could not downcast from: {} to: {}", + from.display_without_world(), + to.display_without_world() + ) + } + InteropErrorInner::GarbageCollectedAllocation { reference } => { + format!( + "Allocation was garbage collected. Could not access reference: {} as a result.", + reference.display_without_world(), + ) + } + InteropErrorInner::ReflectionPathError { error, reference } => { + format!( + "Error while reflecting path: {} on reference: {}", + error, + reference + .as_ref() + .map(|r| r.display_without_world()) + .unwrap_or("None".to_owned()), + ) + } + InteropErrorInner::MissingTypeData { type_id, type_data } => { + format!( + "Missing type data {} for type: {}. Did you register the type correctly?", + type_data, + type_id.display_without_world(), + ) + } + InteropErrorInner::FailedFromReflect { type_id, reason } => { + format!( + "Failed to convert from reflect for type: {} with reason: {}", + type_id + .map(|t| t.display_without_world()) + .unwrap_or("None".to_owned()), + reason + ) + } + InteropErrorInner::ValueMismatch { expected, got } => { + format!( + "Value mismatch, expected: {}, got: {}", + expected.display_without_world(), + got.display_without_world() + ) + } + InteropErrorInner::UnsupportedOperation { + base, + value, + operation, + } => { + format!( + "Unsupported operation: {} on base: {} with value: {:?}", + operation, + base.map(|t| t.display_without_world()) + .unwrap_or("None".to_owned()), + value + ) + } + InteropErrorInner::InvalidIndex { value, reason } => { + format!( + "Invalid index for value: {}: {}", + value.display_without_world(), + reason + ) + } + InteropErrorInner::MissingEntity { entity } => { + format!("Missing or invalid entity: {}", entity) + } + InteropErrorInner::InvalidComponent { component_id } => { + format!("Invalid component: {:?}", component_id) + } + InteropErrorInner::StaleWorldAccess => { + "Stale world access. The world has been dropped and a script tried to access it. Do not try to store or copy the world." + .to_owned() + } + InteropErrorInner::MissingWorld => { + "Missing world. The world was not initialized in the script context.".to_owned() + }, + InteropErrorInner::FunctionInteropError { function_name, on, error } => { + let opt_on = on.map(|t| format!("on type: {}", t.display_without_world())).unwrap_or_default(); + let display_name = if function_name.starts_with("TypeId") { + function_name.split("::").last().unwrap() + } else { + function_name.as_str() + }; + format!( + "Error in function {} {}: {}", + display_name, + opt_on, + error.display_without_world(), + ) + }, + InteropErrorInner::FunctionArgConversionError { argument, error } => { + format!( + "Error converting argument {}: {}", + argument, + error.display_without_world() + ) + }, + InteropErrorInner::FunctionCallError { inner } => { + format!("Error in function call: {}", inner) + }, + InteropErrorInner::BetterConversionExists{ context } => { + format!("Unfinished conversion in context of: {}. A better conversion exists but caller didn't handle the case.", context) + }, + InteropErrorInner::OtherError { error } => error.to_string(), + InteropErrorInner::LengthMismatch { expected, got } => { + format!("Array/List Length mismatch, expected: {}, got: {}", expected, got) + }, + InteropErrorInner::InvalidAccessCount { count, expected, context } => { + format!("Invalid access count, expected: {}, got: {}. {}", expected, count, context) + }, + } + } } /// Purely for purposes of the automatic [`GetTypeRegistration`] impl. diff --git a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs index 28282c1a39..29d8dfa3a8 100644 --- a/crates/bevy_mod_scripting_core/src/reflection_extensions.rs +++ b/crates/bevy_mod_scripting_core/src/reflection_extensions.rs @@ -512,13 +512,6 @@ mod test { #[test] fn test_is_type_negative() { assert!(!Some(42).is_type(Some("std"), "Option")); - assert_eq!( - "Encountered Runtime Error error in a script: Expected type Option from crate std, but got core::option::Option", - Some(42) - .expect_type(Some("std"), "Option") - .unwrap_err() - .to_string() - ); } #[test] @@ -539,14 +532,6 @@ mod test { assert!(None::.as_option().unwrap().is_none()); } - #[test] - fn test_as_option_error() { - assert_eq!( - "Encountered Runtime Error error in a script: Expected type Option from crate core, but got i32", - 42.as_option().unwrap_err().to_string() - ); - } - #[test] fn test_as_list() { let list = vec![1, 2, 3]; From 1c25ca97cd313c782adfbfb1938d94d72df50cc2 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 09:59:17 +0000 Subject: [PATCH 191/217] fix test and small refactor --- assets/scripts/game_of_life.lua | 2 +- .../src/bindings/pretty_print.rs | 13 +++---------- .../remove_resource/no_resource_data_errors.lua | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/assets/scripts/game_of_life.lua b/assets/scripts/game_of_life.lua index 0a76d4a68f..6941569943 100644 --- a/assets/scripts/game_of_life.lua +++ b/assets/scripts/game_of_life.lua @@ -13,7 +13,7 @@ end function on_script_loaded() world.info("Lua: Hello! I am initiating the game of life simulation state with randomness!") - world.info("Lua: Click on the screen to set cells alive") + world.info("Lua: Click on the screen to set cells alive after running the `gol start` command") local life_state = fetch_life_state() local cells = life_state.cells diff --git a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs index 13ea1fd55f..a9ebb8143b 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/pretty_print.rs @@ -74,20 +74,13 @@ impl ReflectReferencePrinter { pretty_path.push_str(" {}", type_path)); } } else { @@ -125,7 +118,7 @@ impl ReflectReferencePrinter { let type_path = if let Some(world) = world { type_id.display_with_world(world.clone()) } else { - format!("{:?}", type_id) + type_id.display_without_world() }; let base_kind = match base.base_id { diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua index 1a273e8e67..653421963b 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua @@ -3,4 +3,4 @@ local type = _get_mock_type() assert_throws(function () world.remove_resource(type) -end, "Missing type data ReflectResource for type: Unregistered TypeId.*") +end, "Missing type data ReflectResource for type: Unregistered(TypeId.*") From 466e718f6ff98aa1e9f99b8bdfd2badfdac4021d Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 10:22:27 +0000 Subject: [PATCH 192/217] fix typo --- .../tests/data/remove_resource/no_resource_data_errors.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua index 653421963b..2f7b85ebff 100644 --- a/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua +++ b/crates/languages/bevy_mod_scripting_lua/tests/data/remove_resource/no_resource_data_errors.lua @@ -3,4 +3,4 @@ local type = _get_mock_type() assert_throws(function () world.remove_resource(type) -end, "Missing type data ReflectResource for type: Unregistered(TypeId.*") +end, "Missing type data ReflectResource for type: Unregistered.TypeId.*") From 9661c3335038d2f5402cf51af7dd69f845496502 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 13:00:43 +0000 Subject: [PATCH 193/217] start integrating xtasks --- .cargo/config.toml | 3 + Cargo.toml | 1 + crates/xtask/Cargo.toml | 18 ++++ crates/xtask/readme.md | 3 + crates/xtask/src/main.rs | 197 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 222 insertions(+) create mode 100644 crates/xtask/Cargo.toml create mode 100644 crates/xtask/readme.md create mode 100644 crates/xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index b423dd3e7a..9051a9f9f9 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,5 @@ [env] TARGET_DIR = { value = "target", relative = true } + +[alias] +xtask = "run --package xtask --" diff --git a/Cargo.toml b/Cargo.toml index c7c9d9fb9d..5c86f82ae5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,6 +81,7 @@ members = [ "crates/languages/bevy_mod_scripting_rune", "crates/test_utils", "crates/bevy_mod_scripting_functions", + "crates/xtask", ] resolver = "2" exclude = ["crates/bevy_api_gen", "crates/macro_tests"] diff --git a/crates/xtask/Cargo.toml b/crates/xtask/Cargo.toml new file mode 100644 index 0000000000..45bca8fc15 --- /dev/null +++ b/crates/xtask/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "xtask" +version = "0.1.0" +edition = "2021" +publish = false + + +[[bin]] +name = "xtask" +path = "src/main.rs" + +[dependencies] +xtasks = "*" +clap = { version = "4", features = ["derive", "string"] } +strum = { version = "0.26", features = ["derive"] } +anyhow = "1" +pretty_env_logger = "0.5" +log = "0.4" diff --git a/crates/xtask/readme.md b/crates/xtask/readme.md new file mode 100644 index 0000000000..e95f8ae159 --- /dev/null +++ b/crates/xtask/readme.md @@ -0,0 +1,3 @@ +# X-Tasks + +This crate provides a set of tasks to be used in CI/CD pipelines as well as for local development. \ No newline at end of file diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs new file mode 100644 index 0000000000..09bb65e01a --- /dev/null +++ b/crates/xtask/src/main.rs @@ -0,0 +1,197 @@ +use anyhow::*; +use clap::Parser; +use log::*; +use std::{process::Command, str::FromStr}; +use strum::VariantNames; + +#[derive( + Clone, + Copy, + Debug, + PartialEq, + Eq, + strum::EnumString, + strum::EnumIter, + strum::Display, + strum::VariantNames, +)] +#[strum(serialize_all = "snake_case")] +enum Feature { + // Lua + Lua, + Lua51, + Lua52, + Lua53, + Lua54, + Luajit, + Luajit52, + Luau, + BevyBindings, + CoreFunctions, + UnsafeLuaModules, + MluaSerialize, + MluaMacros, + MluaAsync, + + // Rhai + Rhai, + + // Rune + Rune, +} + +#[derive(Debug, Clone)] +struct Features(Vec); + +impl Features { + fn to_cargo_args(&self) -> Vec { + if self.0.is_empty() { + vec![] + } else { + vec!["--features".to_owned(), self.to_string()] + } + } + + fn to_placeholder() -> clap::builder::Str { + format!("[{}]", Feature::VARIANTS.join("|")).into() + } +} + +impl std::fmt::Display for Features { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + for (i, feature) in self.0.iter().enumerate() { + if i > 0 { + write!(f, ",")?; + } + write!(f, "{}", feature)?; + } + std::result::Result::Ok(()) + } +} + +impl From for Features { + fn from(s: String) -> Self { + if s.is_empty() { + return Self(vec![]); + } + + let features = s + .trim() + .split(',') + .map(|f| { + Feature::from_str(f).unwrap_or_else(|_| { + eprintln!("Unknown feature: '{}'", f); + std::process::exit(1); + }) + }) + .collect(); + Self(features) + } +} + +#[derive(Debug, Parser)] +struct App { + #[clap(long, short, global = true, value_parser=clap::value_parser!(Features), value_name=Features::to_placeholder(), default_value="lua54",required = false)] + features: Features, + + #[clap(subcommand)] + subcmd: Xtasks, +} + +#[derive(Debug, clap::Subcommand)] +#[clap( + name = "xtask", + bin_name = "cargo xtask", + about = "A set of xtasks for managing the project. Run 'cargo xtask init' to get started." +)] +enum Xtasks { + /// Performs first time local-development environment setup + Init, + /// Build the main workspace only + Build, + /// Build the main workspace, apply all prefferred lints + Check, + /// Build the main workspace, and then run all tests + Test, + /// Perform a full check as it would be done in CI + CiCheck, +} + +impl Xtasks { + fn run(self, features: Features) -> Result<(), Error> { + match self { + Xtasks::Build => Self::build(features), + Xtasks::Check => self.check(), + Xtasks::Test => self.test(), + Xtasks::CiCheck => self.cicd(), + Xtasks::Init => self.init(), + } + } + + fn run_workspace_command( + command: &str, + context: &str, + features: Features, + ) -> Result<(), anyhow::Error> { + info!("Running workspace command: {}", command); + + let mut args = vec![]; + args.push(command.to_owned()); + args.push("--workspace".to_owned()); + args.extend(features.to_cargo_args()); + + let mut cmd = Command::new("cargo"); + cmd.args(args) + .stdout(std::process::Stdio::inherit()) + .stderr(std::process::Stdio::inherit()); + + info!("Using command: {:?}", cmd); + + let output = cmd.output().with_context(|| context.to_owned())?; + match output.status.code() { + Some(0) => Ok(()), + _ => bail!( + "{} failed with exit code: {}", + context, + output.status.code().unwrap_or(-1) + ), + } + } + + fn build(features: Features) -> Result<(), anyhow::Error> { + // build workspace using the given features + Self::run_workspace_command("build", "Failed to build workspace", features)?; + Ok(()) + } + + fn check(self) -> Result<(), anyhow::Error> { + todo!() + } + + fn test(self) -> Result<(), anyhow::Error> { + todo!() + } + + fn cicd(self) -> Result<(), anyhow::Error> { + todo!() + } + + fn init(self) -> Result<(), anyhow::Error> { + todo!() + } +} + +fn try_main() -> Result<(), anyhow::Error> { + pretty_env_logger::formatted_builder() + .filter_level(LevelFilter::Info) + .init(); + let args = App::try_parse()?; + args.subcmd.run(args.features) +} + +fn main() { + if let Err(e) = try_main() { + eprintln!("{}", e); + std::process::exit(1); + } +} From 16c806d00cc918cfa84a9ebe176d7c07288d8e5d Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 15:53:52 +0000 Subject: [PATCH 194/217] improve xtasks and start integrating with ci --- .github/workflows/bevy_mod_scripting.yml | 119 ++------ architecture.md | 199 ------------- .../src/bindings/function/script_function.rs | 51 ---- crates/xtask/Cargo.toml | 3 +- crates/xtask/src/main.rs | 268 ++++++++++++++++-- crates/xtask/templates/settings.json.tera | 31 ++ 6 files changed, 311 insertions(+), 360 deletions(-) delete mode 100644 architecture.md create mode 100644 crates/xtask/templates/settings.json.tera diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 29f8ceadfb..a8cc5d913f 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -27,85 +27,22 @@ jobs: strategy: matrix: run_args: [ - {label: Windows - All Features, os: windows-latest, features: "lua54,rhai,rune", cross: x86_64-pc-windows-msvc }, - {label: MacOS - All Features, os: macOS-latest, features: "lua54,rhai,rune", cross: x86_64-apple-darwin }, - {label: Ubuntu - All Features, os: ubuntu-latest, features: "lua54,rhai,rune", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu Aarch64 - All Features, os: ubuntu-latest, features: "lua54,rhai,rune", cross: aarch64-unknown-linux-gnu }, - {label: Ubuntu - Lua51, os: ubuntu-latest, features: "lua51", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu - Lua52, os: ubuntu-latest, features: "lua52", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu - Lua53, os: ubuntu-latest, features: "lua53", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu - Luajit, os: ubuntu-latest, features: "luajit", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu - Luajit52, os: ubuntu-latest, features: "luajit52", cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu - Luau, os: ubuntu-latest, features: "luau", cross: x86_64-unknown-linux-gnu } + {label: Windows, os: windows-latest, cross: x86_64-pc-windows-msvc }, + {label: MacOS, os: macOS-latest, cross: x86_64-apple-darwin }, + {label: Ubuntu, os: ubuntu-latest, cross: x86_64-unknown-linux-gnu }, + {label: Ubuntu Aarch64, os: ubuntu-latest, cross: aarch64-unknown-linux-gnu } ] - steps: - - if: runner.os == 'linux' - name: Install alsa and udev - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - if: runner.os != 'windows' - name: Clear space - run: rm -rf /usr/share/dotnet; rm -rf /opt/ghc; rm -rf "/usr/local/share/boost"; rm -rf "$AGENT_TOOLSDIRECTORY" - - uses: houseabsolute/actions-rust-cross@v0 - with: - command: check - target: ${{ matrix.run_args.cross }} - args: --workspace --features=${{ matrix.run_args.features }} --profile=ephemeral-build - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - name: Install alsa and udev - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - components: rustfmt - toolchain: stable - override: true - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - name: Install alsa and udev - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: clippy - override: true - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --features=lua54,rhai,rune --profile=ephemeral-build -- -D warnings tests: name: Tests - runs-on: ubuntu-latest + runs-on: {{ matrix.run_args.os }} steps: - name: Clear space run: sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: Checkout uses: actions/checkout@v3 - name: Install alsa and udev + if: {{ matrix.run_args.os != 'windows-latest' }} run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - uses: actions-rs/toolchain@v1 with: @@ -115,25 +52,27 @@ jobs: uses: Swatinem/rust-cache@v2.7.3 - uses: actions-rs/cargo@v1 with: - command: test + command: xtest ci-check + components: clippy, rustfmt, grcov + target: ${{ matrix.run_args.cross }} args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build - docs: - name: Docs - runs-on: ubuntu-latest - steps: - - name: Install alsa and udev - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - name: Find docs.rs features - run: echo "DOCS_FEATURES=$(cargo metadata --no-deps | python -c "import sys,json; [print(','.join(x['metadata']['docs.rs']['features'])) for x in json.load(sys.stdin)['packages'] if x['name'] == 'bevy_mod_scripting']")" >> $GITHUB_OUTPUT - id: features - - uses: actions-rs/cargo@v1 - with: - command: doc - args: --workspace --features=${{ steps.features.outputs.DOCS_FEATURES }} --profile=ephemeral-build + # docs: + # name: Docs + # runs-on: ubuntu-latest + # steps: + # - name: Install alsa and udev + # run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + # - uses: actions/checkout@v2 + # - uses: actions-rs/toolchain@v1 + # with: + # toolchain: stable + # override: true + # - name: Rust Cache + # uses: Swatinem/rust-cache@v2.7.3 + # - name: Find docs.rs features + # run: echo "DOCS_FEATURES=$(cargo metadata --no-deps | python -c "import sys,json; [print(','.join(x['metadata']['docs.rs']['features'])) for x in json.load(sys.stdin)['packages'] if x['name'] == 'bevy_mod_scripting']")" >> $GITHUB_OUTPUT + # id: features + # - uses: actions-rs/cargo@v1 + # with: + # command: doc + # args: --workspace --features=${{ steps.features.outputs.DOCS_FEATURES }} --profile=ephemeral-build diff --git a/architecture.md b/architecture.md deleted file mode 100644 index 9c940e7d14..0000000000 --- a/architecture.md +++ /dev/null @@ -1,199 +0,0 @@ -# Architecture - -## Reflection - -`bevy_mod_scripting` first and foremost relies on `Reflection`, a feature of Bevy which allows us to interact with type erased data. This is the foundation of the scripting system, as it allows us to interact with the Bevy ECS without knowing the exact types of the components/resources our scripts will be interacting with at compile time. - -Normally in Bevy, you would define your components and resources as structs, and then use them in your systems. This is very powerful but also very limiting, as it requires you to know the exact types of the components/resources you will be interacting with at compile time. This is where [`Reflection`](https://docs.rs/bevy_reflect/0.13.1/bevy_reflect/) comes in. - -Bevy provides us with a [`TypeRegistry`](https://docs.rs/bevy_reflect/0.13.1/bevy_reflect/struct.TypeRegistry.html), which is essentially just a map from type ids to [`TypeRegistrations`](https://docs.rs/bevy_reflect/0.13.1/bevy_reflect/struct.TypeRegistration.html). A `TypeRegistration` is a container for all sorts of metadata about the type but most importantly it allows us to query [`TypeData`](https://docs.rs/bevy_reflect/0.13.1/bevy_reflect/trait.TypeData.html) of any type which was previously registered via the `TypeRegistry`. - -How is this useful ? Well it allows us to register arbitrary information including function pointers which we can then retrieve given just a `TypeId`. This is exactly what we do with [`ReflectProxyable`](https://docs.rs/bevy_mod_scripting/0.3.0/bevy_mod_scripting/api/lua/struct.ReflectLuaProxyable.html), the interface between Bevy and Lua: - -```rust,ignore -pub fn ref_to_lua<'lua>( - &self, - ref_: ReflectReference, - lua: &'lua Lua -) -> Result, Error> - -pub fn apply_lua<'lua>( - &self, - ref_: &mut ReflectReference, - lua: &'lua Lua, - new_val: Value<'lua> -) -> Result<(), Error> -``` - -A `ReflectProxyable` `TypeData` is registered for every type which we want to have custom Lua bindings for. With this we can represent any Reflectable type in any way we want in Lua. For example we can represent a `Vec3` as a table with `x`, `y`, `z` fields, or we can represent it as a userdata with a metatable which has `__index` and `__newindex` metamethods. The best part about this is we do not need to even own the types we are adding this `TypeData` for! This bypasses the pesky orphan rule and allows us to add custom Lua bindings for any type in Bevy. - -Note: for your own types you can do this by deriving `Reflect` and adding a `reflect(LuaProxyable)` attribute like so: - -```rust,ignore -#[derive(Reflect)] -#[reflect(LuaProxyable)] -pub struct MyType { - pub x: f32, - pub y: f32, - pub z: f32, -} - -impl LuaProxyable for MyType { - // ... -} -``` - -Now when you register your type with the `AppTypeRegistry` it will automatically have a `ReflectLuaProxyable` `TypeData` registered for it! You must not forget to register your type with: - -```rust,ignore -app.register_type::(); -``` - -## Script References - -All accesses to the bevy world are done via `ReflectReference` types which look like this: - -```rust,ignore -pub struct ReflectReference { - /// The reflection path from the root - pub(crate) path: ReflectionPath, - pub(crate) world_ptr: WorldPointer, -} -``` - -I.e. they are essentially just a path to the data in the Bevy world. This allows us to have a reference to a piece of data in the Bevy world which can be passed around and modified in Lua safely. - -The `ReflectionPath` itself consists of a "base" reference and a list of path segments. Most interesting of which is the base: - -```rust,ignore -pub(crate) enum ReflectBase { - /// A bevy component reference - Component { - comp: ReflectComponent, - entity: Entity, - }, - /// A bevy resource reference - Resource { res: ReflectResource }, - - /// A script owned reflect type (for example a vector constructed in lua) - ScriptOwned { val: Weak> }, -} -``` - -Given a valid base and a valid path we should always be able to get a valid reference to a piece of data in the Bevy world. Note we make use of other `TypeData` here, i.e. `ReflectComponent` and `ReflectResource` which store function pointers for the specific types of components/resources we are dealing with that allow us to interact with them. For example `ReflectComponent` let's us call: - -```rust,ignore -pub fn reflect<'a>( - &self, - entity: EntityRef<'a> -) -> Option<&'a (dyn Reflect + 'static)> -``` - -To retrieve a reflect reference to our component on a specific entity! - -You might be wondering how exactly we get a `TypeId` from a script in the first place, and the answer is we use a simple String type name! The journey begins in our custom `World` UserData: - -```rust,ignore - methods.add_method("get_type_by_name", |_, world, type_name: String| { - let w = world.read(); - - let registry: &AppTypeRegistry = w.get_resource().unwrap(); - - let registry = registry.read(); - - Ok(registry - .get_with_short_type_path(&type_name) - .or_else(|| registry.get_with_type_path(&type_name)) - .map(|registration| LuaTypeRegistration::new(Arc::new(registration.clone())))) - }); -``` - -Given a String type name like: `my_crate::MyType` we can then retrieve both `TypeId` and `TypeRegistration` structs, which we can use to retrieve any `TypeData` we need! - - -## Bevy to Lua Bridge - -Now finally our `ReflectReference` type has a custom `IntoLua` implementation which does the following: -- Check the type has a `ReflectLuaProxyable` `TypeData` -- If it does, call `ref_to_lua` on it and generate the Lua representation of the data -- If it does not, default to a "vanilla" representation of the data i.e. a [`ReflectedValue`](https://docs.rs/bevy_mod_scripting/0.3.0/bevy_mod_scripting/api/struct.ReflectedValue.html) which is a simple wrapper around a `ReflectReference`. It uses pure reflection to provide `__index` and `__newindex` metamethods for the data. - -```rust,ignore - fn into_lua(self, ctx: &'lua Lua) -> mlua::Result> { - let world = self.world_ptr.clone(); - let world = world.read(); - - let typedata = &world.resource::(); - let g = typedata.read(); - - let type_id = self.get(|s| s.type_id())?; - if let Some(v) = g.get_type_data::(type_id) { - v.ref_to_lua(self, ctx) - } else { - ReflectedValue { ref_: self }.into_lua(ctx) - } - } -``` - -Note that assigning to bevy via ReflectedValue's will check if the value we're trying to assign has a `ReflectLuaProxyable` type data, and if it does it uses it's `apply_lua` method to apply the new value to the `ReflectReference`, if it does not it expects it to be another `ReflectedValue` and will clone then apply it to itself using pure reflection. - -All primitive data types will have a `ReflectLuaProxyable` type data registered for them via their `FromLua` and `Clone` implementations. - - -## Proxy macros -We provide a set of macros to make it easier to define custom Lua bindings for your types. For example: - -```rust,ignore -#[derive(LuaProxy, Reflect, Resource, Default, Debug, Clone)] -#[reflect(Resource, LuaProxyable)] -#[proxy( - derive(clone), - functions[ - r#" - #[lua(kind="MutatingMethod")] - fn set_my_string(&mut self, another_string: Option); - "#, - r#" - #[lua(kind="MutatingMethod")] - fn set_with_another(&mut self, #[proxy] another: Self); - "#, - r#" - #[lua(kind="Method")] - fn get_my_string(&self) -> String; - "#, - r#" - #[lua(kind="Method",raw)] - fn raw_method(&self, ctx : &Lua) -> Result { - let a = ctx.globals().get::<_,String>("world").unwrap(); - let a = self.inner()?; - Ok("".to_owned()) - } - "#, - r#" - #[lua(kind="MetaMethod", metamethod="ToString")] - fn to_string(&self) -> String { - format!("{:#?}", _self) - } - "# - ]) - ] -pub struct MyProxiedStruct { - my_string: String, -} -``` - -will generate a `LuaMyProxiedStruct` which will act as the Lua representation of `MyProxiedStruct`. It will have the following methods: -- `set_my_string` which will set the `my_string` field of the struct -- `set_with_another` which will set the struct to be equal to another struct -- `get_my_string` which will return the `my_string` field of the struct -- `ToString` metamethod which will return a string representation of the struct - -It will also implement `UserData` for the proxy, meaning it can be passed around in Lua as a first class citizen. And it will implement `LuaProxyable` for `MyProxiedStruct`, meaning you can register your type and have it work in Lua with no extra work! - -## Bevy API Generation - -A good scripting system should be able to interact with the Bevy API as well as the user's own types. We provide a way to generate Lua bindings for the Bevy API using a rustc plugin. We scrape the Bevy codebase and generate proxy macro invocations like the one above for every appropriate `Reflect` implementing type, and package them in `APIProvider` structs which you can use to provide the Bevy API to your Lua scripts. - -This generator is a work in progress but it is designed with the possibility of generating bindings for ANY crate in mind. It is not limited to Bevy, and can be used to generate bindings for any crate which uses `Reflect` types. In theory you should be able to use the CLI to generate your own bindings without writing macros yourself! See the [`bevy_api_gen`](crates/bevy_api_gen/readme.md) crate for more information. - - diff --git a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs index c2a3df85d0..3eb7bf2275 100644 --- a/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs +++ b/crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs @@ -476,57 +476,6 @@ macro_rules! impl_script_function_type_dependencies{ bevy::utils::all_tuples!(impl_script_function, 0, 13, T); bevy::utils::all_tuples!(impl_script_function_type_dependencies, 0, 13, T); -/// Utility for quickly checking your type can be used as an argument in a script function -/// -/// Usage: -/// ``` -/// assert_impls_into_script!(i32); -/// ``` -#[macro_export] -macro_rules! assert_impls_into_script { - ($ty:ty) => { - trait Check: $crate::bindings::function::into::IntoScript {} - impl Check for $ty {} - }; -} - -/// Utility for quickly checking your type can be used as a return value in a script function -/// -/// Usage: -/// ``` -/// assert_impls_from_script!(i32); -/// ``` -#[macro_export] -macro_rules! assert_impls_from_script { - ($ty:ty) => { - trait Check: $crate::bindings::function::from::FromScript {} - impl Check for $ty {} - }; - ($l:lifetime $ty:ty) => { - trait Check: $crate::bindings::function::from::FromScript {} - impl<$l> Check for $ty {} - }; -} - -/// Utility for quickly checking your function can be used as a script function -/// -/// Usage: -/// ``` -/// assert_is_script_function!(|a: i32, b: i32| a + b); -/// ``` -#[macro_export] -macro_rules! assert_is_script_function { - ($($tt:tt)*) => { - fn _check<'env,M,F: ScriptFunction<'env, M>>(f: F) { - - } - - fn test() { - _check($($tt)*); - } - } -} - #[cfg(test)] mod test { use super::*; diff --git a/crates/xtask/Cargo.toml b/crates/xtask/Cargo.toml index 45bca8fc15..07c4edff59 100644 --- a/crates/xtask/Cargo.toml +++ b/crates/xtask/Cargo.toml @@ -10,9 +10,10 @@ name = "xtask" path = "src/main.rs" [dependencies] -xtasks = "*" clap = { version = "4", features = ["derive", "string"] } strum = { version = "0.26", features = ["derive"] } anyhow = "1" pretty_env_logger = "0.5" log = "0.4" +itertools = "0.14" +cargo_metadata = "*" diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 09bb65e01a..8d36c2b019 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -1,7 +1,8 @@ use anyhow::*; use clap::Parser; +use itertools::Itertools; use log::*; -use std::{process::Command, str::FromStr}; +use std::{collections::HashMap, ffi::OsStr, process::Command, str::FromStr}; use strum::VariantNames; #[derive( @@ -14,6 +15,7 @@ use strum::VariantNames; strum::EnumIter, strum::Display, strum::VariantNames, + strum::VariantArray, )] #[strum(serialize_all = "snake_case")] enum Feature { @@ -40,10 +42,65 @@ enum Feature { Rune, } +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] +enum FeatureGroup { + LuaExclusive, + RhaiExclusive, + RuneExclusive, + NonExclusiveOther, +} + +impl FeatureGroup { + fn default_feature(self) -> Feature { + match self { + FeatureGroup::LuaExclusive => Feature::Lua54, + FeatureGroup::RhaiExclusive => Feature::Rhai, + FeatureGroup::RuneExclusive => Feature::Rune, + FeatureGroup::NonExclusiveOther => panic!("No default feature for non-exclusive group"), + } + } +} + +trait IntoFeatureGroup { + fn to_feature_group(self) -> FeatureGroup; +} + +impl IntoFeatureGroup for Feature { + fn to_feature_group(self) -> FeatureGroup { + match self { + Feature::Lua + | Feature::Lua51 + | Feature::Lua52 + | Feature::Lua53 + | Feature::Lua54 + | Feature::Luajit + | Feature::Luajit52 + | Feature::Luau => FeatureGroup::LuaExclusive, + Feature::Rhai => FeatureGroup::RhaiExclusive, + Feature::Rune => FeatureGroup::RuneExclusive, + _ => FeatureGroup::NonExclusiveOther, + } + } +} + #[derive(Debug, Clone)] struct Features(Vec); impl Features { + fn all_features() -> Self { + // remove exclusive features which are not the default + Self( + ::VARIANTS + .iter() + .filter(|f| { + let group = f.to_feature_group(); + (group != FeatureGroup::NonExclusiveOther) || (**f == group.default_feature()) + }) + .cloned() + .collect(), + ) + } + fn to_cargo_args(&self) -> Vec { if self.0.is_empty() { vec![] @@ -55,6 +112,15 @@ impl Features { fn to_placeholder() -> clap::builder::Str { format!("[{}]", Feature::VARIANTS.join("|")).into() } + + fn split_by_group(&self) -> HashMap> { + let mut groups = HashMap::new(); + for feature in &self.0 { + let group = feature.to_feature_group(); + groups.entry(group).or_insert_with(Vec::new).push(*feature); + } + groups + } } impl std::fmt::Display for Features { @@ -118,32 +184,81 @@ enum Xtasks { } impl Xtasks { - fn run(self, features: Features) -> Result<(), Error> { + fn run(self, features: Features) -> Result<()> { match self { Xtasks::Build => Self::build(features), - Xtasks::Check => self.check(), - Xtasks::Test => self.test(), - Xtasks::CiCheck => self.cicd(), - Xtasks::Init => self.init(), + Xtasks::Check => Self::check(features), + Xtasks::Test => Self::test(features), + Xtasks::CiCheck => Self::cicd(), + Xtasks::Init => Self::init(), } } - fn run_workspace_command( + fn cargo_metadata() -> Result { + let cargo_manifest_path = std::env::var("CARGO_MANIFEST_PATH").unwrap(); + + let mut cmd = cargo_metadata::MetadataCommand::new(); + cmd.manifest_path(cargo_manifest_path); + let out = cmd.exec()?; + Ok(out) + } + + fn workspace_dir() -> Result { + let metadata = Self::cargo_metadata()?; + let workspace_root = metadata.workspace_root; + Ok(workspace_root.into()) + } + + fn run_system_command>>( + command: &str, + context: &str, + add_args: I, + ) -> Result<()> { + info!("Running system command: {}", command); + + let mut cmd = Command::new(command); + cmd.args(add_args) + .stdout(std::process::Stdio::inherit()) + .stderr(std::process::Stdio::inherit()) + .current_dir(Self::workspace_dir()?); + + info!("Using command: {:?}", cmd); + + let output = cmd.output().with_context(|| context.to_owned())?; + match output.status.code() { + Some(0) => Ok(()), + _ => bail!( + "{} failed with exit code: {}", + context, + output.status.code().unwrap_or(-1) + ), + } + } + + fn run_workspace_command>>( command: &str, context: &str, features: Features, - ) -> Result<(), anyhow::Error> { + add_args: I, + ) -> Result<()> { info!("Running workspace command: {}", command); let mut args = vec![]; args.push(command.to_owned()); args.push("--workspace".to_owned()); args.extend(features.to_cargo_args()); + args.extend(add_args.into_iter().map(|s| { + s.as_ref() + .to_str() + .expect("invalid command argument") + .to_owned() + })); let mut cmd = Command::new("cargo"); cmd.args(args) .stdout(std::process::Stdio::inherit()) - .stderr(std::process::Stdio::inherit()); + .stderr(std::process::Stdio::inherit()) + .current_dir(Self::workspace_dir()?); info!("Using command: {:?}", cmd); @@ -158,30 +273,145 @@ impl Xtasks { } } - fn build(features: Features) -> Result<(), anyhow::Error> { + fn build(features: Features) -> Result<()> { // build workspace using the given features - Self::run_workspace_command("build", "Failed to build workspace", features)?; + Self::run_workspace_command( + "build", + "Failed to build workspace", + features, + vec!["--all-targets"], + )?; Ok(()) } - fn check(self) -> Result<(), anyhow::Error> { - todo!() + fn check(features: Features) -> Result<()> { + // start with cargo clippy + Self::run_workspace_command( + "clippy", + "Failed to run clippy", + features, + vec!["--all-targets", "--", "-D", "warnings"], + )?; + + // run cargo fmt checks + Self::run_system_command( + "cargo", + "Failed to run cargo fmt", + vec!["fmt", "--all", "--", "--check"], + )?; + + Ok(()) } - fn test(self) -> Result<(), anyhow::Error> { - todo!() + fn test(features: Features) -> Result<()> { + // run cargo test with instrumentation + std::env::set_var("CARGO_INCREMENTAL", "0"); + std::env::set_var("RUSTFLAGS", "-Cinstrument-coverage"); + let target_dir = std::env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_owned()); + let coverage_file = std::path::PathBuf::from(target_dir) + .join("coverage") + .join("cargo-test-%p-%m.profraw"); + std::env::set_var("LLVM_PROFILE_FILE", coverage_file); + + Self::run_workspace_command( + "test", + "Failed to run tests", + features, + Vec::::default(), + )?; + + // generate coverage report and lcov file + Self::run_system_command( + "grcov", + "Generating html coverage report", + vec![ + ".", + "--binary-path", + "./target/debug/deps/", + "-s", + ".", + "-t", + "html", + "--branch", + "--ignore-not-existing", + "--ignore", + "../*", + "--ignore", + "/*", + "-o", + "target/coverage/html", + ], + )?; + + Self::run_system_command( + "grcov", + "Failed to generate coverage report", + vec![ + ".", + "--binary-path", + "./target/debug/deps/", + "-s", + ".", + "-t", + "lcov", + "--branch", + "--ignore-not-existing", + "--ignore", + "../*", + "--ignore", + "/*", + "-o", + "target/coverage/lcov.info", + ], + ) } - fn cicd(self) -> Result<(), anyhow::Error> { - todo!() + fn cicd() -> Result<()> { + // run everything with the ephemereal profile + // first check everything compiles with every combination of features apart from mutually exclusive ones + let all_features = Features(::VARIANTS.into()); + + let grouped = all_features.split_by_group(); + + let non_exclusive = grouped + .get(&FeatureGroup::NonExclusiveOther) + .unwrap_or(&vec![]) + .clone(); + + // run powerset with all language features enabled without mutually exclusive + let powersets = non_exclusive.iter().cloned().powerset().collect::>(); + info!("Powersets: {:?}", powersets); + + for mut feature_set in powersets.into_iter().map(Features) { + info!("Running check with features: {}", feature_set); + // choose language features + for category in [ + FeatureGroup::LuaExclusive, + FeatureGroup::RhaiExclusive, + FeatureGroup::RuneExclusive, + ] { + feature_set.0.push(category.default_feature()); + } + + Self::build(feature_set)?; + } + + // run lints + let all_features = Features::all_features(); + Self::check(all_features.clone())?; + + // run tests + Self::test(all_features)?; + + Ok(()) } - fn init(self) -> Result<(), anyhow::Error> { + fn init() -> Result<()> { todo!() } } -fn try_main() -> Result<(), anyhow::Error> { +fn try_main() -> Result<()> { pretty_env_logger::formatted_builder() .filter_level(LevelFilter::Info) .init(); diff --git a/crates/xtask/templates/settings.json.tera b/crates/xtask/templates/settings.json.tera new file mode 100644 index 0000000000..2d90818aaf --- /dev/null +++ b/crates/xtask/templates/settings.json.tera @@ -0,0 +1,31 @@ +{ + "lldb.displayFormat": "auto", + "lldb.showDisassembly": "never", + "lldb.dereferencePointers": true, + "lldb.consoleMode": "commands", + "[rust]": { + "editor.formatOnSave": true, + "editor.formatOnSaveMode": "file", + "editor.defaultFormatter": "rust-lang.rust-analyzer" + }, + "rust-analyzer.rustc.source": "discover", + "rust-analyzer.linkedProjects": [ + "./crates/bevy_api_gen/Cargo.toml", + "Cargo.toml" + ], + "rust-analyzer.check.invocationStrategy": "per_workspace", + "rust-analyzer.check.invocationLocation": "workspace", + "rust-analyzer.check.overrideCommand": [ + "cargo xtask check" + ], + "rust-analyzer.cargo.buildScripts.overrideCommand": [ + "cargo xtask check" + ], + "rust-analyzer.showUnlinkedFileNotification": false, + "rust-analyzer.runnables.extraTestBinaryArgs": [ + "--show-output" + ], + "rust-analyzer.runnables.extraArgs": [ + "--profile=release-with-debug" + ] +} \ No newline at end of file From c5119368c3ba94b8709265912c80682b89500545 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:08:39 +0000 Subject: [PATCH 195/217] add contributing guides and improve messages --- CODE_OF_CONDUCT.md | 69 +++++++++++++++++ CONTRIBUTING.MD | 158 +++++++++++++++++++++++++++++++++++++++ crates/xtask/src/main.rs | 4 +- 3 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.MD diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..8abdfe3163 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,69 @@ +# Code of Conduct - bevy_mod_scripting + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behaviour that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologising to those affected by our mistakes, +and learning from the experience +* Focusing on what is best not just for us as individuals, but for the +overall community + +Examples of unacceptable behaviour include: + +* The use of sexualised language or imagery, and sexual attention or advances +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email +address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a +professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying and enforcing our standards of +acceptable behaviour and will take appropriate and fair corrective action in +response to any instances of unacceptable behaviour. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban +temporarily or permanently any contributor for other behaviours that they deem +inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behaviour may be +reported to the community leaders responsible for enforcement at <>. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant](https://contributor-covenant.org/), version +[1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct/code_of_conduct.md) and +[2.0](https://www.contributor-covenant.org/version/2/0/code_of_conduct/code_of_conduct.md), +and was generated by [contributing.md](https://contributing.md/generator). \ No newline at end of file diff --git a/CONTRIBUTING.MD b/CONTRIBUTING.MD new file mode 100644 index 0000000000..a6bc9b9c01 --- /dev/null +++ b/CONTRIBUTING.MD @@ -0,0 +1,158 @@ + +# Contributing to bevy_mod_scripting + +First off, thanks for taking the time to contribute! ❤️ + +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 + +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> - Star the project +> - Tweet about it +> - Refer this project in your project's readme +> - Mention the project at local meetups and tell your friends/colleagues + + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [I Have a Question](#i-have-a-question) +- [I Want To Contribute](#i-want-to-contribute) +- [Reporting Bugs](#reporting-bugs) +- [Suggesting Enhancements](#suggesting-enhancements) +- [Your First Code Contribution](#your-first-code-contribution) +- [Improving The Documentation](#improving-the-documentation) +- [Styleguides](#styleguides) +- [Commit Messages](#commit-messages) +- [Join The Project Team](#join-the-project-team) + + +## Code of Conduct + +This project and everyone participating in it is governed by the +[bevy_mod_scripting Code of Conduct](https://github.com/makspll/bevy_mod_scripting/blob//CODE_OF_CONDUCT.md). +By participating, you are expected to uphold this code. Please report unacceptable behavior +to <>. + + +## I Have a Question + +> If you want to ask a question, we assume that you have read the available [Documentation](https://makspll.github.io/bevy_mod_scripting/). + +Before you ask a question, it is best to search for existing [Issues](https://github.com/makspll/bevy_mod_scripting/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/makspll/bevy_mod_scripting/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + + + +## I Want To Contribute + +> ### Legal Notice +> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project licence. + +### Reporting Bugs + + +#### Before Submitting a Bug Report + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. + +- Make sure that you are using the latest version. +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://makspll.github.io/bevy_mod_scripting/). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/makspll/bevy_mod_scripting/issues?q=label%3Abug). +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. +- Collect information about the bug: +- Stack trace (Traceback) +- OS, Platform and Version (Windows, Linux, macOS, x86, ARM) +- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. +- Possibly your input and the output +- Can you reliably reproduce the issue? And can you also reproduce it with older versions? + + +#### How Do I Submit a Good Bug Report? + +> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. + + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- Open an [Issue](https://github.com/makspll/bevy_mod_scripting/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. +- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). + + + + +### Suggesting Enhancements + +This section guides you through submitting an enhancement suggestion for bevy_mod_scripting, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. + + +#### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the [documentation](https://makspll.github.io/bevy_mod_scripting/) carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a [search](https://github.com/makspll/bevy_mod_scripting/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. + + +#### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://github.com/makspll/bevy_mod_scripting/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- You may want to **include screenshots or screen recordings** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [LICEcap](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and the built-in [screen recorder in GNOME](https://help.gnome.org/users/gnome-help/stable/screen-shot-record.html.en) or [SimpleScreenRecorder](https://github.com/MaartenBaert/ssr) on Linux. +- **Explain why this enhancement would be useful** to most bevy_mod_scripting users. You may also want to point out the other projects that solved it better and which could serve as inspiration. + + + +### Your First Code Contribution + +This project uses xtask to manage the build and test process. You can run `cargo xtask` to see the available commands. Run `xtask init` to setup your local development environment. + + + +### Improving The Documentation + +Most of the documentation can be found in the `docs` folder. The documentation is written in markdown and built using mdbook. You can run `cargo xtask doc` to build the documentation. You can also run `cargo xtask doc --open` to build and open the documentation in your browser. + +## Styleguides +### Commit Messages + +Follow conventional commit messages for PR titles, and keep your commit messages as descriptive as possible. Don't stress about it though! + +For example if you are adding a new feature, name your PR title as `feat: add new feature` and your commit message as `adding new feature` or ideally `feat: add new feature`. + +## Join The Project Team + +We are open to new members and would be happy to welcome you to our team. If you are interested in becoming a long-term contributor, please send an email to `makspl17@gmail.com`. + +## Attribution +This guide is based on the [contributing.md](https://contributing.md/generator)! \ No newline at end of file diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 8d36c2b019..80d3d721d3 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -266,7 +266,7 @@ impl Xtasks { match output.status.code() { Some(0) => Ok(()), _ => bail!( - "{} failed with exit code: {}", + "{} failed with exit code: {}. Features: {features}", context, output.status.code().unwrap_or(-1) ), @@ -317,7 +317,7 @@ impl Xtasks { "test", "Failed to run tests", features, - Vec::::default(), + vec!["--exclude", "xtask"], )?; // generate coverage report and lcov file From 0f0daec46cb4cd9e04cfa3c021c6eb35d9d2395d Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:20:18 +0000 Subject: [PATCH 196/217] add docs command --- crates/xtask/src/main.rs | 64 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 80d3d721d3..c6c0d54337 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -2,7 +2,7 @@ use anyhow::*; use clap::Parser; use itertools::Itertools; use log::*; -use std::{collections::HashMap, ffi::OsStr, process::Command, str::FromStr}; +use std::{collections::HashMap, ffi::OsStr, path::Path, process::Command, str::FromStr}; use strum::VariantNames; #[derive( @@ -177,6 +177,8 @@ enum Xtasks { Build, /// Build the main workspace, apply all prefferred lints Check, + /// Build the rust crates.io docs as well as any other docs + Docs, /// Build the main workspace, and then run all tests Test, /// Perform a full check as it would be done in CI @@ -188,6 +190,7 @@ impl Xtasks { match self { Xtasks::Build => Self::build(features), Xtasks::Check => Self::check(features), + Xtasks::Docs => Self::docs(), Xtasks::Test => Self::test(features), Xtasks::CiCheck => Self::cicd(), Xtasks::Init => Self::init(), @@ -240,6 +243,7 @@ impl Xtasks { context: &str, features: Features, add_args: I, + dir: Option<&Path>, ) -> Result<()> { info!("Running workspace command: {}", command); @@ -253,12 +257,17 @@ impl Xtasks { .expect("invalid command argument") .to_owned() })); + let workspace_dir = Self::workspace_dir()?; + let workspace_dir = match dir { + Some(d) => workspace_dir.join(d), + None => workspace_dir, + }; let mut cmd = Command::new("cargo"); cmd.args(args) .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit()) - .current_dir(Self::workspace_dir()?); + .current_dir(workspace_dir); info!("Using command: {:?}", cmd); @@ -280,6 +289,7 @@ impl Xtasks { "Failed to build workspace", features, vec!["--all-targets"], + None, )?; Ok(()) } @@ -291,6 +301,7 @@ impl Xtasks { "Failed to run clippy", features, vec!["--all-targets", "--", "-D", "warnings"], + None, )?; // run cargo fmt checks @@ -303,14 +314,56 @@ impl Xtasks { Ok(()) } + fn docs() -> Result<()> { + // find [package.metadata."docs.rs"] key in Cargo.toml + let metadata = Self::cargo_metadata()?; + let package = metadata.root_package().expect("no root package"); + let docs_rs = package + .metadata + .get("docs.rs") + .expect("no docs.rs metadata"); + + let string_list = docs_rs + .as_array() + .expect("docs.rs metadata is not an array") + .iter() + .map(|v| v.as_str().expect("docs.rs metadata is not a string")) + .map(|s| Feature::from_str(s).expect("invalid feature")) + .collect::>(); + + let features = Features(string_list); + + Self::run_workspace_command( + "doc", + "Failed to build crates.io docs", + features.clone(), + vec!["--all"], + None, + )?; + + // build mdbook + Self::run_workspace_command( + "mdbook", + "Failed to build mdbook docs", + features, + vec!["--all"], + Some(Path::new("docs")), + )?; + Ok(()) + } + fn test(features: Features) -> Result<()> { // run cargo test with instrumentation std::env::set_var("CARGO_INCREMENTAL", "0"); std::env::set_var("RUSTFLAGS", "-Cinstrument-coverage"); let target_dir = std::env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_owned()); - let coverage_file = std::path::PathBuf::from(target_dir) - .join("coverage") - .join("cargo-test-%p-%m.profraw"); + let coverage_dir = std::path::PathBuf::from(target_dir).join("coverage"); + let coverage_file = coverage_dir.join("cargo-test-%p-%m.profraw"); + + // clear coverage directory + assert!(coverage_dir != std::path::Path::new("/")); + std::fs::remove_dir_all(coverage_dir)?; + std::env::set_var("LLVM_PROFILE_FILE", coverage_file); Self::run_workspace_command( @@ -318,6 +371,7 @@ impl Xtasks { "Failed to run tests", features, vec!["--exclude", "xtask"], + None, )?; // generate coverage report and lcov file From 34b74f3f72252563c931f552af05b08fd7142604 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:45:37 +0000 Subject: [PATCH 197/217] add docs command --- .github/workflows/bevy_mod_scripting.yml | 22 +------ crates/xtask/src/main.rs | 80 +++++++++++++++++++----- 2 files changed, 64 insertions(+), 38 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index a8cc5d913f..1933fc4f97 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -55,24 +55,4 @@ jobs: command: xtest ci-check components: clippy, rustfmt, grcov target: ${{ matrix.run_args.cross }} - args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build - # docs: - # name: Docs - # runs-on: ubuntu-latest - # steps: - # - name: Install alsa and udev - # run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - # - uses: actions/checkout@v2 - # - uses: actions-rs/toolchain@v1 - # with: - # toolchain: stable - # override: true - # - name: Rust Cache - # uses: Swatinem/rust-cache@v2.7.3 - # - name: Find docs.rs features - # run: echo "DOCS_FEATURES=$(cargo metadata --no-deps | python -c "import sys,json; [print(','.join(x['metadata']['docs.rs']['features'])) for x in json.load(sys.stdin)['packages'] if x['name'] == 'bevy_mod_scripting']")" >> $GITHUB_OUTPUT - # id: features - # - uses: actions-rs/cargo@v1 - # with: - # command: doc - # args: --workspace --features=${{ steps.features.outputs.DOCS_FEATURES }} --profile=ephemeral-build + args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build \ No newline at end of file diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index c6c0d54337..924e6728d2 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -178,7 +178,12 @@ enum Xtasks { /// Build the main workspace, apply all prefferred lints Check, /// Build the rust crates.io docs as well as any other docs - Docs, + Docs { + /// Open in browser + /// This will open the generated docs in the default browser + #[clap(long, short)] + open: bool, + }, /// Build the main workspace, and then run all tests Test, /// Perform a full check as it would be done in CI @@ -190,7 +195,7 @@ impl Xtasks { match self { Xtasks::Build => Self::build(features), Xtasks::Check => Self::check(features), - Xtasks::Docs => Self::docs(), + Xtasks::Docs { open } => Self::docs(open), Xtasks::Test => Self::test(features), Xtasks::CiCheck => Self::cicd(), Xtasks::Init => Self::init(), @@ -212,22 +217,35 @@ impl Xtasks { Ok(workspace_root.into()) } + fn relative_workspace_dir>(dir: P) -> Result { + let workspace_dir = Self::workspace_dir()?; + Ok(workspace_dir.join(dir)) + } + fn run_system_command>>( command: &str, context: &str, add_args: I, + dir: Option<&Path>, ) -> Result<()> { info!("Running system command: {}", command); + let working_dir = match dir { + Some(d) => Self::relative_workspace_dir(d)?, + None => Self::workspace_dir()?, + }; + let mut cmd = Command::new(command); cmd.args(add_args) .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit()) - .current_dir(Self::workspace_dir()?); + .current_dir(working_dir); info!("Using command: {:?}", cmd); - let output = cmd.output().with_context(|| context.to_owned())?; + let output = cmd.output(); + info!("Command output: {:?}", output); + let output = output.with_context(|| context.to_owned())?; match output.status.code() { Some(0) => Ok(()), _ => bail!( @@ -257,17 +275,17 @@ impl Xtasks { .expect("invalid command argument") .to_owned() })); - let workspace_dir = Self::workspace_dir()?; - let workspace_dir = match dir { - Some(d) => workspace_dir.join(d), - None => workspace_dir, + + let working_dir = match dir { + Some(d) => Self::relative_workspace_dir(d)?, + None => Self::workspace_dir()?, }; let mut cmd = Command::new("cargo"); cmd.args(args) .stdout(std::process::Stdio::inherit()) .stderr(std::process::Stdio::inherit()) - .current_dir(workspace_dir); + .current_dir(working_dir); info!("Using command: {:?}", cmd); @@ -309,21 +327,37 @@ impl Xtasks { "cargo", "Failed to run cargo fmt", vec!["fmt", "--all", "--", "--check"], + None, )?; Ok(()) } - fn docs() -> Result<()> { + fn docs(open: bool) -> Result<()> { // find [package.metadata."docs.rs"] key in Cargo.toml let metadata = Self::cargo_metadata()?; - let package = metadata.root_package().expect("no root package"); + + let package = metadata + .packages + .iter() + .find(|p| p.name == "bevy_mod_scripting") + .expect("Could not find bevy_mod_scripting package in metadata"); + + info!("Building with root package: {}", package.name); + let docs_rs = package .metadata .get("docs.rs") .expect("no docs.rs metadata"); - let string_list = docs_rs + let features = docs_rs + .as_object() + .expect("docs.rs metadata is not an object") + .get("features") + .expect("no 'features' in docs.rs metadata"); + + info!("Using docs.rs metadata: {:?}", docs_rs); + let string_list = features .as_array() .expect("docs.rs metadata is not an array") .iter() @@ -333,22 +367,29 @@ impl Xtasks { let features = Features(string_list); + let mut args = Vec::default(); + args.push("--all"); + if open { + args.push("--open"); + } Self::run_workspace_command( "doc", "Failed to build crates.io docs", features.clone(), - vec!["--all"], + args, None, )?; // build mdbook - Self::run_workspace_command( + let args = if open { vec!["build"] } else { vec!["serve"] }; + + Self::run_system_command( "mdbook", - "Failed to build mdbook docs", - features, - vec!["--all"], + "Failed to build or serve mdbook docs", + args, Some(Path::new("docs")), )?; + Ok(()) } @@ -395,6 +436,7 @@ impl Xtasks { "-o", "target/coverage/html", ], + None, )?; Self::run_system_command( @@ -417,6 +459,7 @@ impl Xtasks { "-o", "target/coverage/lcov.info", ], + None, ) } @@ -454,6 +497,9 @@ impl Xtasks { let all_features = Features::all_features(); Self::check(all_features.clone())?; + // run docs + Self::docs(false)?; + // run tests Self::test(all_features)?; From 3d244c1abb8f7f95efbeefc21eeabbc3598ffa76 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:47:14 +0000 Subject: [PATCH 198/217] fix CI --- .github/workflows/bevy_mod_scripting.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 1933fc4f97..aafdf48ea7 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -32,10 +32,6 @@ jobs: {label: Ubuntu, os: ubuntu-latest, cross: x86_64-unknown-linux-gnu }, {label: Ubuntu Aarch64, os: ubuntu-latest, cross: aarch64-unknown-linux-gnu } ] - - tests: - name: Tests - runs-on: {{ matrix.run_args.os }} steps: - name: Clear space run: sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY" From 5721f821a9369268f0949b0ae8112d27c873be3f Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:49:42 +0000 Subject: [PATCH 199/217] fix typos --- .github/workflows/bevy_mod_scripting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index aafdf48ea7..4eb17910df 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -38,7 +38,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Install alsa and udev - if: {{ matrix.run_args.os != 'windows-latest' }} + - if: runner.os == 'linux' run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - uses: actions-rs/toolchain@v1 with: @@ -49,6 +49,6 @@ jobs: - uses: actions-rs/cargo@v1 with: command: xtest ci-check - components: clippy, rustfmt, grcov + components: clippy, rustfmt, grcov, mdbook target: ${{ matrix.run_args.cross }} args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build \ No newline at end of file From e0c35b54798bc8936db78664c9f77cd30ee93b88 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:50:41 +0000 Subject: [PATCH 200/217] typo --- .github/workflows/bevy_mod_scripting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 4eb17910df..26ac3d7821 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -38,7 +38,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Install alsa and udev - - if: runner.os == 'linux' + if: runner.os == 'linux' run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev - uses: actions-rs/toolchain@v1 with: From a662f5201087527dd053fa6e2f34f8e9e792186f Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:51:35 +0000 Subject: [PATCH 201/217] parameterize more commands --- .github/workflows/bevy_mod_scripting.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 26ac3d7821..76affb3f2d 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -33,13 +33,13 @@ jobs: {label: Ubuntu Aarch64, os: ubuntu-latest, cross: aarch64-unknown-linux-gnu } ] steps: - - name: Clear space - run: sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: Checkout uses: actions/checkout@v3 - name: Install alsa and udev if: runner.os == 'linux' - run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + run: | + sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev + sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY" - uses: actions-rs/toolchain@v1 with: toolchain: stable From 52461e18450052f721cf1964381586fbe80c4f2b Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:52:48 +0000 Subject: [PATCH 202/217] fix command name --- .github/workflows/bevy_mod_scripting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 76affb3f2d..97d9217e71 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -48,7 +48,7 @@ jobs: uses: Swatinem/rust-cache@v2.7.3 - uses: actions-rs/cargo@v1 with: - command: xtest ci-check + command: xtask ci-check components: clippy, rustfmt, grcov, mdbook target: ${{ matrix.run_args.cross }} args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build \ No newline at end of file From 93b14a34d232070eb8ca3865be12fd909e75a072 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:53:09 +0000 Subject: [PATCH 203/217] add commands in the right place --- .github/workflows/bevy_mod_scripting.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 97d9217e71..b4fd22c144 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -48,7 +48,7 @@ jobs: uses: Swatinem/rust-cache@v2.7.3 - uses: actions-rs/cargo@v1 with: - command: xtask ci-check + command: xtask components: clippy, rustfmt, grcov, mdbook target: ${{ matrix.run_args.cross }} - args: --workspace --features=lua54,rhai,rune --profile=ephemeral-build \ No newline at end of file + args: ci-check \ No newline at end of file From bcef7982a9a845c48a7536363356a8ca60f90a1f Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:54:26 +0000 Subject: [PATCH 204/217] add components to correct action --- .github/workflows/bevy_mod_scripting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index b4fd22c144..d48f65a13b 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -43,12 +43,12 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable + components: clippy, rustfmt, grcov, mdbook override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 - uses: actions-rs/cargo@v1 with: command: xtask - components: clippy, rustfmt, grcov, mdbook target: ${{ matrix.run_args.cross }} args: ci-check \ No newline at end of file From 7fefc13a78ce9b8114402c6488967637f7e615a9 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 16:58:49 +0000 Subject: [PATCH 205/217] add component installation to init --- .github/workflows/bevy_mod_scripting.yml | 1 - crates/xtask/src/main.rs | 36 +++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index d48f65a13b..9f8cce4414 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -43,7 +43,6 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable - components: clippy, rustfmt, grcov, mdbook override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 924e6728d2..8c9cea9867 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -464,6 +464,9 @@ impl Xtasks { } fn cicd() -> Result<()> { + // setup the CI environment + Self::init()?; + // run everything with the ephemereal profile // first check everything compiles with every combination of features apart from mutually exclusive ones let all_features = Features(::VARIANTS.into()); @@ -507,7 +510,38 @@ impl Xtasks { } fn init() -> Result<()> { - todo!() + // install cargo mdbook + Self::run_system_command( + "cargo", + "Failed to install mdbook", + vec!["install", "mdbook"], + None, + )?; + + // install grcov + Self::run_system_command( + "cargo", + "Failed to install grcov", + vec!["install", "grcov"], + None, + )?; + + // install llvm-tools and clippy + Self::run_system_command( + "rustup", + "Failed to install rust components", + vec![ + "component", + "add", + "rust-src", + "rustc-dev", + "clippy", + "llvm-tools-preview", + ], + None, + )?; + + Ok(()) } } From e00d661e9af5ea6867ee53e66eab0093d468a419 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 17:03:58 +0000 Subject: [PATCH 206/217] add coverage report --- .github/workflows/bevy_mod_scripting.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 9f8cce4414..20ac1d2c9e 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -50,4 +50,8 @@ jobs: with: command: xtask target: ${{ matrix.run_args.cross }} - args: ci-check \ No newline at end of file + args: ci-check --target ${{ matrix.run_args.cross }} + use-cross: true + - uses: romeovs/lcov-reporter-action@v0.2.16 + with: + lcov-file: ./target/coverage/lcov.info \ No newline at end of file From 2fd8426b28b09df9df812068a60d4b4a39b0bec4 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 18:27:58 +0000 Subject: [PATCH 207/217] fix bug --- crates/xtask/src/main.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 8c9cea9867..4b203e3832 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -87,6 +87,7 @@ impl IntoFeatureGroup for Feature { struct Features(Vec); impl Features { + /// Returns all features except the exclusive ones which are not the default fn all_features() -> Self { // remove exclusive features which are not the default Self( @@ -94,7 +95,7 @@ impl Features { .iter() .filter(|f| { let group = f.to_feature_group(); - (group != FeatureGroup::NonExclusiveOther) || (**f == group.default_feature()) + (group == FeatureGroup::NonExclusiveOther) || (**f == group.default_feature()) }) .cloned() .collect(), @@ -480,10 +481,15 @@ impl Xtasks { // run powerset with all language features enabled without mutually exclusive let powersets = non_exclusive.iter().cloned().powerset().collect::>(); - info!("Powersets: {:?}", powersets); - - for mut feature_set in powersets.into_iter().map(Features) { - info!("Running check with features: {}", feature_set); + info!("Powerset: {:?}", powersets); + let length = powersets.len(); + + for (i, mut feature_set) in powersets.into_iter().map(Features).enumerate() { + info!( + "Running check {}/{length} with features: {}", + i + 1, + feature_set + ); // choose language features for category in [ FeatureGroup::LuaExclusive, From cf085496a578d74f1e702e3fbbcc04fccc8fb1ff Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 18:32:40 +0000 Subject: [PATCH 208/217] fix ci --- .github/workflows/bevy_mod_scripting.yml | 5 +- crates/xtask/src/main.rs | 98 +++++++++++++----------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 20ac1d2c9e..9d650764c2 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -46,12 +46,11 @@ jobs: override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 - - uses: actions-rs/cargo@v1 + - uses: houseabsolute/actions-rust-cross@v0 with: command: xtask target: ${{ matrix.run_args.cross }} - args: ci-check --target ${{ matrix.run_args.cross }} - use-cross: true + args: ci-check - uses: romeovs/lcov-reporter-action@v0.2.16 with: lcov-file: ./target/coverage/lcov.info \ No newline at end of file diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 4b203e3832..458ad321cc 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -184,6 +184,10 @@ enum Xtasks { /// This will open the generated docs in the default browser #[clap(long, short)] open: bool, + + /// Skip building rust docs + #[clap(long, short)] + no_rust_docs: bool, }, /// Build the main workspace, and then run all tests Test, @@ -196,7 +200,7 @@ impl Xtasks { match self { Xtasks::Build => Self::build(features), Xtasks::Check => Self::check(features), - Xtasks::Docs { open } => Self::docs(open), + Xtasks::Docs { open, no_rust_docs } => Self::docs(open, no_rust_docs), Xtasks::Test => Self::test(features), Xtasks::CiCheck => Self::cicd(), Xtasks::Init => Self::init(), @@ -334,54 +338,58 @@ impl Xtasks { Ok(()) } - fn docs(open: bool) -> Result<()> { + fn docs(open: bool, no_rust_docs: bool) -> Result<()> { // find [package.metadata."docs.rs"] key in Cargo.toml - let metadata = Self::cargo_metadata()?; + if !no_rust_docs { + info!("Building rust docs"); + let metadata = Self::cargo_metadata()?; + + let package = metadata + .packages + .iter() + .find(|p| p.name == "bevy_mod_scripting") + .expect("Could not find bevy_mod_scripting package in metadata"); + + info!("Building with root package: {}", package.name); + + let docs_rs = package + .metadata + .get("docs.rs") + .expect("no docs.rs metadata"); + + let features = docs_rs + .as_object() + .expect("docs.rs metadata is not an object") + .get("features") + .expect("no 'features' in docs.rs metadata"); + + info!("Using docs.rs metadata: {:?}", docs_rs); + let string_list = features + .as_array() + .expect("docs.rs metadata is not an array") + .iter() + .map(|v| v.as_str().expect("docs.rs metadata is not a string")) + .map(|s| Feature::from_str(s).expect("invalid feature")) + .collect::>(); - let package = metadata - .packages - .iter() - .find(|p| p.name == "bevy_mod_scripting") - .expect("Could not find bevy_mod_scripting package in metadata"); - - info!("Building with root package: {}", package.name); - - let docs_rs = package - .metadata - .get("docs.rs") - .expect("no docs.rs metadata"); - - let features = docs_rs - .as_object() - .expect("docs.rs metadata is not an object") - .get("features") - .expect("no 'features' in docs.rs metadata"); - - info!("Using docs.rs metadata: {:?}", docs_rs); - let string_list = features - .as_array() - .expect("docs.rs metadata is not an array") - .iter() - .map(|v| v.as_str().expect("docs.rs metadata is not a string")) - .map(|s| Feature::from_str(s).expect("invalid feature")) - .collect::>(); - - let features = Features(string_list); - - let mut args = Vec::default(); - args.push("--all"); - if open { - args.push("--open"); + let features = Features(string_list); + + let mut args = Vec::default(); + args.push("--all"); + if open { + args.push("--open"); + } + Self::run_workspace_command( + "doc", + "Failed to build crates.io docs", + features.clone(), + args, + None, + )?; } - Self::run_workspace_command( - "doc", - "Failed to build crates.io docs", - features.clone(), - args, - None, - )?; // build mdbook + info!("Building mdbook docs"); let args = if open { vec!["build"] } else { vec!["serve"] }; Self::run_system_command( @@ -507,7 +515,7 @@ impl Xtasks { Self::check(all_features.clone())?; // run docs - Self::docs(false)?; + Self::docs(false, false)?; // run tests Self::test(all_features)?; From 809e8feefd0aebe0ebfe25bee26344ed8d3873a9 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 18:39:54 +0000 Subject: [PATCH 209/217] simplify ci, remove cross --- .github/workflows/bevy_mod_scripting.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 9d650764c2..619bc9cefa 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -27,10 +27,10 @@ jobs: strategy: matrix: run_args: [ - {label: Windows, os: windows-latest, cross: x86_64-pc-windows-msvc }, - {label: MacOS, os: macOS-latest, cross: x86_64-apple-darwin }, - {label: Ubuntu, os: ubuntu-latest, cross: x86_64-unknown-linux-gnu }, - {label: Ubuntu Aarch64, os: ubuntu-latest, cross: aarch64-unknown-linux-gnu } + {label: Windows, os: windows-latest }, + {label: MacOS, os: macOS-latest }, + {label: Ubuntu, os: ubuntu-latest }, + {label: Ubuntu Aarch64, os: ubuntu-latest } ] steps: - name: Checkout @@ -46,11 +46,10 @@ jobs: override: true - name: Rust Cache uses: Swatinem/rust-cache@v2.7.3 - - uses: houseabsolute/actions-rust-cross@v0 + - uses: actions-rs/cargo@v1 with: command: xtask - target: ${{ matrix.run_args.cross }} - args: ci-check + args: ci-check - uses: romeovs/lcov-reporter-action@v0.2.16 with: lcov-file: ./target/coverage/lcov.info \ No newline at end of file From 01c52d85718d9bf1f5e5e6f0cf13fbc4bdd9773f Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 18:57:33 +0000 Subject: [PATCH 210/217] optimize powersets slightly, and change to ephemereal profile for speed up --- crates/xtask/src/main.rs | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 458ad321cc..19945f8e1b 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -207,6 +207,15 @@ impl Xtasks { } } + // TODO: have a global args struct instead of this + fn set_cargo_profile(profile: &str) { + std::env::set_var("BMS_CARGO_PROFILE", profile); + } + + fn get_cargo_profile() -> Option { + Some(std::env::var("BMS_CARGO_PROFILE").unwrap_or_default()) + } + fn cargo_metadata() -> Result { let cargo_manifest_path = std::env::var("CARGO_MANIFEST_PATH").unwrap(); @@ -227,6 +236,14 @@ impl Xtasks { Ok(workspace_dir.join(dir)) } + fn append_rustflags(flag: &str) { + let rustflags = std::env::var("RUSTFLAGS").unwrap_or_default(); + let mut flags = rustflags.split(' ').collect::>(); + flags.push(flag); + let flags = flags.join(" "); + std::env::set_var("RUSTFLAGS", flags); + } + fn run_system_command>>( command: &str, context: &str, @@ -281,6 +298,12 @@ impl Xtasks { .to_owned() })); + let profile = Self::get_cargo_profile(); + if let Some(profile) = profile { + args.push("--profile".to_owned()); + args.push(profile); + } + let working_dir = match dir { Some(d) => Self::relative_workspace_dir(d)?, None => Self::workspace_dir()?, @@ -405,7 +428,8 @@ impl Xtasks { fn test(features: Features) -> Result<()> { // run cargo test with instrumentation std::env::set_var("CARGO_INCREMENTAL", "0"); - std::env::set_var("RUSTFLAGS", "-Cinstrument-coverage"); + Self::append_rustflags("-Cinstrument-coverage"); + let target_dir = std::env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_owned()); let coverage_dir = std::path::PathBuf::from(target_dir).join("coverage"); let coverage_file = coverage_dir.join("cargo-test-%p-%m.profraw"); @@ -473,6 +497,9 @@ impl Xtasks { } fn cicd() -> Result<()> { + // set profile + Self::set_cargo_profile("ephemeral-build"); + // setup the CI environment Self::init()?; @@ -488,7 +515,9 @@ impl Xtasks { .clone(); // run powerset with all language features enabled without mutually exclusive - let powersets = non_exclusive.iter().cloned().powerset().collect::>(); + let mut powersets = non_exclusive.iter().cloned().powerset().collect::>(); + // start with longest to compile all first + powersets.reverse(); info!("Powerset: {:?}", powersets); let length = powersets.len(); From 8022f2aecab4ff18791aba5d91d6520e8e5dd5af Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 19:12:15 +0000 Subject: [PATCH 211/217] fix flipped condition and remove lua from features --- crates/xtask/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 19945f8e1b..ced753bb04 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -20,7 +20,6 @@ use strum::VariantNames; #[strum(serialize_all = "snake_case")] enum Feature { // Lua - Lua, Lua51, Lua52, Lua53, @@ -68,8 +67,7 @@ trait IntoFeatureGroup { impl IntoFeatureGroup for Feature { fn to_feature_group(self) -> FeatureGroup { match self { - Feature::Lua - | Feature::Lua51 + Feature::Lua51 | Feature::Lua52 | Feature::Lua53 | Feature::Lua54 @@ -413,7 +411,7 @@ impl Xtasks { // build mdbook info!("Building mdbook docs"); - let args = if open { vec!["build"] } else { vec!["serve"] }; + let args = if !open { vec!["build"] } else { vec!["serve"] }; Self::run_system_command( "mdbook", From 3a7264e1bdad5fd446b9f09f7003bdf8b6815b6e Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 19:23:38 +0000 Subject: [PATCH 212/217] reduce feature combinations to test --- crates/xtask/src/main.rs | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index ced753bb04..538cf8358e 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -46,7 +46,8 @@ enum FeatureGroup { LuaExclusive, RhaiExclusive, RuneExclusive, - NonExclusiveOther, + ForExternalCrate, + BMSFeature, } impl FeatureGroup { @@ -55,9 +56,16 @@ impl FeatureGroup { FeatureGroup::LuaExclusive => Feature::Lua54, FeatureGroup::RhaiExclusive => Feature::Rhai, FeatureGroup::RuneExclusive => Feature::Rune, - FeatureGroup::NonExclusiveOther => panic!("No default feature for non-exclusive group"), + _ => panic!("No default feature for non-exclusive group"), } } + + fn is_exclusive(self) -> bool { + matches!( + self, + FeatureGroup::LuaExclusive | FeatureGroup::RhaiExclusive | FeatureGroup::RuneExclusive + ) + } } trait IntoFeatureGroup { @@ -76,7 +84,11 @@ impl IntoFeatureGroup for Feature { | Feature::Luau => FeatureGroup::LuaExclusive, Feature::Rhai => FeatureGroup::RhaiExclusive, Feature::Rune => FeatureGroup::RuneExclusive, - _ => FeatureGroup::NonExclusiveOther, + Feature::MluaAsync + | Feature::MluaMacros + | Feature::MluaSerialize + | Feature::UnsafeLuaModules => FeatureGroup::ForExternalCrate, + _ => FeatureGroup::BMSFeature, } } } @@ -93,7 +105,7 @@ impl Features { .iter() .filter(|f| { let group = f.to_feature_group(); - (group == FeatureGroup::NonExclusiveOther) || (**f == group.default_feature()) + (!group.is_exclusive()) || (**f == group.default_feature()) }) .cloned() .collect(), @@ -507,13 +519,17 @@ impl Xtasks { let grouped = all_features.split_by_group(); - let non_exclusive = grouped - .get(&FeatureGroup::NonExclusiveOther) - .unwrap_or(&vec![]) - .clone(); + let features_to_combine = grouped + .get(&FeatureGroup::BMSFeature) + .expect("no bms features were found at all, bms definitely has feature flags"); // run powerset with all language features enabled without mutually exclusive - let mut powersets = non_exclusive.iter().cloned().powerset().collect::>(); + let mut powersets = features_to_combine + .iter() + .cloned() + .powerset() + .collect::>(); + // start with longest to compile all first powersets.reverse(); info!("Powerset: {:?}", powersets); @@ -525,6 +541,7 @@ impl Xtasks { i + 1, feature_set ); + // choose language features for category in [ FeatureGroup::LuaExclusive, @@ -534,6 +551,11 @@ impl Xtasks { feature_set.0.push(category.default_feature()); } + // include all non-bms features + if let Some(f) = grouped.get(&FeatureGroup::ForExternalCrate) { + feature_set.0.extend(f.iter().cloned()); + } + Self::build(feature_set)?; } From 976d8c229096d502fbd9cfd8b42d0ce099172f04 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 19:46:20 +0000 Subject: [PATCH 213/217] correct flags --- .github/workflows/bevy_mod_scripting.yml | 4 +++- crates/xtask/src/main.rs | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 619bc9cefa..41f4b5b5f1 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -21,7 +21,9 @@ concurrency: cancel-in-progress: true jobs: - check: + check: + permissions: + pull-requests: write name: Check - ${{ matrix.run_args.label }} runs-on: ${{ matrix.run_args.os }} strategy: diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 538cf8358e..05712b403c 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -300,6 +300,12 @@ impl Xtasks { let mut args = vec![]; args.push(command.to_owned()); args.push("--workspace".to_owned()); + let profile = Self::get_cargo_profile(); + if let Some(profile) = profile { + args.push("--profile".to_owned()); + args.push(profile); + } + args.extend(features.to_cargo_args()); args.extend(add_args.into_iter().map(|s| { s.as_ref() @@ -308,12 +314,6 @@ impl Xtasks { .to_owned() })); - let profile = Self::get_cargo_profile(); - if let Some(profile) = profile { - args.push("--profile".to_owned()); - args.push(profile); - } - let working_dir = match dir { Some(d) => Self::relative_workspace_dir(d)?, None => Self::workspace_dir()?, From 6a852e7ec4cf2a2663a160d08980ad7d53eef4d1 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 20:09:01 +0000 Subject: [PATCH 214/217] fix --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5c86f82ae5..0d5cd8b365 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ name = "bevy_mod_scripting" path = "src/lib.rs" [package.metadata."docs.rs"] -features = ["lua", "lua54", "rhai", "rune"] +features = ["lua54", "rhai", "rune"] [features] default = ["core_functions", "bevy_bindings", "unsafe_lua_modules"] From 51ca262adeb2469cf39e96777e5abc99921d7fe6 Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 20:47:51 +0000 Subject: [PATCH 215/217] fix possible errors --- crates/xtask/src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/xtask/src/main.rs b/crates/xtask/src/main.rs index 05712b403c..101d86cf23 100644 --- a/crates/xtask/src/main.rs +++ b/crates/xtask/src/main.rs @@ -446,7 +446,7 @@ impl Xtasks { // clear coverage directory assert!(coverage_dir != std::path::Path::new("/")); - std::fs::remove_dir_all(coverage_dir)?; + let _ = std::fs::remove_dir_all(coverage_dir); std::env::set_var("LLVM_PROFILE_FILE", coverage_file); @@ -566,6 +566,8 @@ impl Xtasks { // run docs Self::docs(false, false)?; + info!("All checks passed, running tests"); + // run tests Self::test(all_features)?; From 87612ec1a6daf0ab93872b906942abecbc66bb4e Mon Sep 17 00:00:00 2001 From: makspll Date: Sun, 5 Jan 2025 21:57:23 +0000 Subject: [PATCH 216/217] don't fail on coverage upload failure --- .github/workflows/bevy_mod_scripting.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bevy_mod_scripting.yml b/.github/workflows/bevy_mod_scripting.yml index 41f4b5b5f1..2e9f2e9ef0 100644 --- a/.github/workflows/bevy_mod_scripting.yml +++ b/.github/workflows/bevy_mod_scripting.yml @@ -53,5 +53,6 @@ jobs: command: xtask args: ci-check - uses: romeovs/lcov-reporter-action@v0.2.16 + continue-on-error: true with: lcov-file: ./target/coverage/lcov.info \ No newline at end of file From 07d67cb92abdb663c5217fa4573cc7e33d05a9ea Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 5 Jan 2025 21:59:20 +0000 Subject: [PATCH 217/217] chore: release v0.9.0-alpha.2 --- CHANGELOG.md | 85 +++++++++++++++++++ Cargo.toml | 12 +-- crates/bevy_mod_scripting_core/CHANGELOG.md | 30 +++++++ crates/bevy_mod_scripting_core/Cargo.toml | 2 +- .../bevy_mod_scripting_functions/CHANGELOG.md | 77 +++++++++++++++++ .../bevy_mod_scripting_functions/Cargo.toml | 2 +- .../bevy_mod_scripting_lua/Cargo.toml | 2 +- .../bevy_mod_scripting_rhai/Cargo.toml | 2 +- .../bevy_mod_scripting_rune/Cargo.toml | 2 +- 9 files changed, 203 insertions(+), 11 deletions(-) create mode 100644 crates/bevy_mod_scripting_functions/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d91457df6..5d4b224bc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,90 @@ # Changelog +## [0.9.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/v0.9.0-alpha.1...v0.9.0-alpha.2) - 2025-01-05 + +### Fixed + +- fix test and small refactor +- fix readme +- fix lifetime issue, allow refs + +### Other + +- Merge remote-tracking branch 'origin' into staging +- improve xtasks and start integrating with ci +- make display without world more sensible +- further clean up +- remove preludes, remove more crates +- remove unused dependencies +- fmt +- more clippy +- clippy fixes +- clippy fixes +- cleanup some imports +- change query signature slightly +- add on load and unload hooks +- improve logs and things +- finally +- keep working on docs and fixing bugs +- make the generics more tenable, and update docs +- start cleaning up examples, use ScriptValue as argument for all things +- add more conversions +- change handle to weak so unloading strong handle is enough to delete script, and update docs +- add error conversions for rhai +- remove trailing whitespace +- clippy fixes +- allow optionally disabling bindings +- pin smol str, begin rhai work +- it doens't exist +- enable bevy input in functions for smol_str +- enable more flags in bevy functions +- make iteration work +- just lookup length for iteration for now +- allow passing more arguments than needed +- implement iterators, and add function passing +- make overloading work for subtraction +- *(codegen)* update bevy bindings (#181) +- add script function registry and update registrations +- implement the rest of reflect reference functions +- remove need for world jerry-rig, use static reference +- get static calls working +- get bindings compiling, add more impls +- *(codegen)* update bevy bindings (#180) +- *(codegen)* update bevy bindings (#179) +- *(codegen)* update bevy bindings (#178) +- select new pre-release version +- clean up versions from last pre-release +- *(codegen)* update bevy bindings (#177) +- imports +- *(codegen)* update bevy bindings (#176) +- *(codegen)* update bevy bindings (#175) +- change imports +- move bindings under different module +- *(codegen)* update bevy bindings (#174) +- *(codegen)* update bevy bindings (#173) +- *(codegen)* update bevy bindings (#172) +- *(codegen)* update bevy bindings (#171) +- *(codegen)* update bevy bindings (#170) +- properly register the top level types too +- work out function type dependency registration basics +- WIP +- re-enable list applies +- handle errors properly +- initial from_script_ref +- shift to bakery paradigm +- remove older stuff +- change core functions to script functions +- refactor accesses slightly +- Big things coming +- WIP +- move script value things into another module +- refactor a bit +- add support for list +- refactor errors considerably +- dynamic get and set calls +- Implement ScriptValue things +- DYNAMIC CALLS WOOOOOOO + ## [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 diff --git a/Cargo.toml b/Cargo.toml index 0d5cd8b365..d2a0e17d92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting" -version = "0.9.0-alpha.1" +version = "0.9.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" @@ -52,15 +52,15 @@ 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.9.0-alpha.1", optional = true } -bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.9.0-alpha.1", optional = true } -bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.9.0-alpha.1", optional = true } +bevy_mod_scripting_lua = { path = "crates/languages/bevy_mod_scripting_lua", version = "0.9.0-alpha.2", optional = true } +bevy_mod_scripting_rhai = { path = "crates/languages/bevy_mod_scripting_rhai", version = "0.9.0-alpha.2", optional = true } +bevy_mod_scripting_rune = { path = "crates/languages/bevy_mod_scripting_rune", version = "0.9.0-alpha.2", optional = true } bevy_mod_scripting_functions = { workspace = true } [workspace.dependencies] bevy = { version = "0.15.0", default-features = false } -bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.9.0-alpha.1" } -bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.1" } +bevy_mod_scripting_core = { path = "crates/bevy_mod_scripting_core", version = "0.9.0-alpha.2" } +bevy_mod_scripting_functions = { path = "crates/bevy_mod_scripting_functions", version = "0.9.0-alpha.2" } test_utils = { path = "crates/test_utils" } mlua = { version = "0.10" } rhai = { version = "1.20.1" } diff --git a/crates/bevy_mod_scripting_core/CHANGELOG.md b/crates/bevy_mod_scripting_core/CHANGELOG.md index 4b1601dd9f..ee30ca9107 100644 --- a/crates/bevy_mod_scripting_core/CHANGELOG.md +++ b/crates/bevy_mod_scripting_core/CHANGELOG.md @@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.9.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_core-v0.9.0-alpha.1...bevy_mod_scripting_core-v0.9.0-alpha.2) - 2025-01-05 + +### Fixed + +- fix test and small refactor + +### Other + +- Merge remote-tracking branch 'origin' into staging +- improve xtasks and start integrating with ci +- make display without world more sensible +- further clean up +- remove preludes, remove more crates +- remove unused dependencies +- fmt +- more clippy +- clippy fixes +- clippy fixes +- cleanup some imports +- change query signature slightly +- add on load and unload hooks +- improve logs and things +- finally +- keep working on docs and fixing bugs +- make the generics more tenable, and update docs +- start cleaning up examples, use ScriptValue as argument for all things +- add more conversions +- change handle to weak so unloading strong handle is enough to delete script, and update docs +- add error conversions for rhai + ## [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 diff --git a/crates/bevy_mod_scripting_core/Cargo.toml b/crates/bevy_mod_scripting_core/Cargo.toml index 4645480fa3..3eb6054938 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.9.0-alpha.1" +version = "0.9.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/bevy_mod_scripting_functions/CHANGELOG.md b/crates/bevy_mod_scripting_functions/CHANGELOG.md new file mode 100644 index 0000000000..58f7b88f53 --- /dev/null +++ b/crates/bevy_mod_scripting_functions/CHANGELOG.md @@ -0,0 +1,77 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.9.0-alpha.2](https://github.com/makspll/bevy_mod_scripting/compare/bevy_mod_scripting_functions-v0.9.0-alpha.1...bevy_mod_scripting_functions-v0.9.0-alpha.2) - 2025-01-05 + +### Fixed + +- fix readme +- fix lifetime issue, allow refs + +### Other + +- remove trailing whitespace +- fmt +- clippy fixes +- clippy fixes +- change query signature slightly +- improve logs and things +- finally +- keep working on docs and fixing bugs +- allow optionally disabling bindings +- pin smol str, begin rhai work +- it doens't exist +- enable bevy input in functions for smol_str +- enable more flags in bevy functions +- make iteration work +- just lookup length for iteration for now +- allow passing more arguments than needed +- implement iterators, and add function passing +- make overloading work for subtraction +- *(codegen)* update bevy bindings (#181) +- add script function registry and update registrations +- implement the rest of reflect reference functions +- remove need for world jerry-rig, use static reference +- get static calls working +- get bindings compiling, add more impls +- *(codegen)* update bevy bindings (#180) +- *(codegen)* update bevy bindings (#179) +- *(codegen)* update bevy bindings (#178) +- select new pre-release version +- clean up versions from last pre-release +- *(codegen)* update bevy bindings (#177) +- imports +- *(codegen)* update bevy bindings (#176) +- *(codegen)* update bevy bindings (#175) +- change imports +- move bindings under different module +- *(codegen)* update bevy bindings (#174) +- *(codegen)* update bevy bindings (#173) +- *(codegen)* update bevy bindings (#172) +- *(codegen)* update bevy bindings (#171) +- *(codegen)* update bevy bindings (#170) +- properly register the top level types too +- work out function type dependency registration basics +- WIP +- re-enable list applies +- handle errors properly +- initial from_script_ref +- shift to bakery paradigm +- remove older stuff +- change core functions to script functions +- refactor accesses slightly +- Big things coming +- WIP +- move script value things into another module +- refactor a bit +- add support for list +- refactor errors considerably +- dynamic get and set calls +- Implement ScriptValue things +- DYNAMIC CALLS WOOOOOOO diff --git a/crates/bevy_mod_scripting_functions/Cargo.toml b/crates/bevy_mod_scripting_functions/Cargo.toml index 2d733efd9e..5edbd17979 100644 --- a/crates/bevy_mod_scripting_functions/Cargo.toml +++ b/crates/bevy_mod_scripting_functions/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_mod_scripting_functions" -version = "0.9.0-alpha.1" +version = "0.9.0-alpha.2" edition = "2021" authors = ["Maksymilian Mozolewski "] license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_lua/Cargo.toml b/crates/languages/bevy_mod_scripting_lua/Cargo.toml index 04f422bab3..c277aa298b 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.9.0-alpha.1" +version = "0.9.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_rhai/Cargo.toml b/crates/languages/bevy_mod_scripting_rhai/Cargo.toml index f545257c15..ee0604f420 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.9.0-alpha.1" +version = "0.9.0-alpha.2" authors = ["Maksymilian Mozolewski "] edition = "2021" license = "MIT OR Apache-2.0" diff --git a/crates/languages/bevy_mod_scripting_rune/Cargo.toml b/crates/languages/bevy_mod_scripting_rune/Cargo.toml index c929657bd8..7f6fecd361 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.9.0-alpha.1" +version = "0.9.0-alpha.2" edition = "2021" license = "MIT OR Apache-2.0" description = "Necessary functionality for Rune support with bevy_mod_scripting"